<!DOCTYPE html>
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
<head>
|
<th:block th:include="include :: header('修改人口学变量定义')" />
|
</head>
|
<body class="white-bg">
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
<form class="form-horizontal m" id="form-demographyParam-edit" th:object="${entDemographyParam}">
|
<input type="hidden" id="langCodes" name="langCodes">
|
<input name="paramId" th:field="*{paramId}" type="hidden">
|
<div class="form-group">
|
<label class="col-sm-3 control-label">[[#{jsp.exam.demographyParam.demographicname}]]:</label>
|
<div class="col-sm-8">
|
<input name="paramCode" th:field="*{paramCode}" class="form-control" type="text" required th:readonly="true">
|
</div>
|
</div>
|
<div class="form-group">
|
<label class="col-sm-3 control-label">[[#{jsp.exam.demographyParam.variablestate}]]:</label>
|
<div class="col-sm-8">
|
<div class="radio-box" th:each="dict : ${@dict.getType('param_status_type')}">
|
<input type="radio" th:id="${dict.dictCode}" name="paramStatus" th:value="${dict.dictValue}" th:field="*{paramStatus}" required>
|
<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
</div>
|
</div>
|
</div>
|
<div class="form-group">
|
<label class="col-sm-3 control-label">[[#{jsp.exam.demographyParam.controltype}]]:</label>
|
<div class="col-sm-8">
|
<select name="types" class="form-control m-b" th:with="type=${@dict.getType('param_types')}" required>
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{types}"></option>
|
</select>
|
</div>
|
</div>
|
<div class="form-group">
|
<label class="col-sm-3 control-label">[[#{jsp.exam.demographyParam.dictionarytype}]]:</label>
|
<div class="col-sm-8">
|
<div class='input-group'>
|
<input name="dicttype" id="dicttype" th:field="*{dicttype}" class="form-control" type="text">
|
<span class='input-group-addon input-sm' onclick='selectDictTree()'><i class='fa fa-search'></i></span>
|
</div>
|
</div>
|
</div>
|
<div class="form-group">
|
<label class="col-sm-3 control-label">[[#{jsp.exam.demographyParam.isrequired}]]:</label>
|
<div class="col-sm-8">
|
<label class='check-box'><input th:type="checkbox" id="isRequired" name="isRequired" th:checked="*{isRequired} eq '1'" th:value="1"></label>
|
</div>
|
</div>
|
<div class="form-group">
|
<label class="col-sm-3 control-label">[[#{jsp.exam.demographyParam.isSelect}]]:</label>
|
<div class="col-sm-8">
|
<label class='check-box'><input th:type="checkbox" id="flag" name="flag" th:checked="*{flag}"></label>
|
</div>
|
</div>
|
<div class="form-group">
|
<label class="col-sm-3 control-label">[[#{jsp.exam.demographyParam.sort}]]:</label>
|
<div class="col-sm-8">
|
<input name="sort" th:field="*{sort}" class="form-control" type="number">
|
</div>
|
</div>
|
|
<div class="form-group">
|
<label class="col-sm-3 control-label">[[#{jsp.multilingual.version}]]:</label>
|
<div class="col-sm-3">
|
<select name="langType" id="langType" class="form-control m-b"
|
th:with="type=${@dict.getType('lang_type')}">
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
|
th:value="${dict.dictValue}"></option>
|
</select>
|
</div>
|
<div class="col-sm-4">
|
<input name="paramName" id="paramName" class="form-control" type="text">
|
</div>
|
<div class="col-sm-2">
|
<a class="btn btn-success" onclick="insertRow()">
|
<i class="fa fa-plus"></i> [[#{jsp.add.language}]]
|
</a>
|
</div>
|
</div>
|
<div class="row">
|
<div class="col-sm-12 select-table table-striped">
|
<table id="bootstrap-table" data-mobile-responsive="true"></table>
|
</div>
|
</div>
|
|
</form>
|
</div>
|
<th:block th:include="include :: footer" />
|
<script type="text/javascript">
|
var prefix = ctx + "exam/demographyParam";
|
$("#form-demographyParam-edit").validate({
|
focusCleanup: true
|
});
|
|
$(function() {
|
var options = {
|
url: prefix + "/listCodes",
|
showSearch: false,
|
showRefresh: false,
|
showToggle: false,
|
showColumns: false,
|
pagination: false,
|
uniqueId: "langType",
|
height: 400,
|
columns: [
|
{
|
field : 'langType',
|
title : '[[#{jsp.exam.demographyParam.languagetype}]]'
|
},
|
{
|
field : 'langCode',
|
title : '[[#{jsp.demographic.name}]]'
|
}
|
,
|
{
|
title: '[[#{basis.operate}]]',
|
align: 'center',
|
formatter: function(value, row, index) {
|
var actions = [];
|
actions.push('<a class="btn btn-danger" onclick="removeRowByUniqueId(\'' + row.langType + '\')"><i class="fa fa-remove"></i>[[#{basis.del}]]</a>');
|
return actions.join('');
|
}
|
}
|
]
|
};
|
$.table.init(options);
|
});
|
|
/*[[#{basis.add}]]表格行 */
|
function insertRow(){
|
var langCode = $("#paramName").val();
|
var langType = $("#langType").val();
|
|
if (langCode=='') {
|
$.modal.alertWarning('[[#{basis.pleaseentermultilingualinformation}]]');
|
return;
|
}
|
|
if (checkDuplicate(langType)) {
|
$.modal.alertWarning('[[#{basis.cclntadd}]]');
|
return;
|
}
|
|
$.btTable.bootstrapTable('insertRow', {
|
index: 0, // 你想插入到哪,0表示第一行
|
row: {
|
langType: langType,
|
langCode: langCode,
|
}
|
})
|
}
|
|
function checkDuplicate(langType) {
|
var data = $.btTable.bootstrapTable('getData');
|
var sdata = JSON.stringify(data);
|
var jsonArr = JSON.parse(sdata);
|
var check = false;
|
$.each(jsonArr,function(index,value){
|
if (langType==value.langType) {
|
check = true;
|
}
|
});
|
return check;
|
}
|
|
/* 删除行ID值为1的数据 */
|
function removeRowByUniqueId(id){
|
$.btTable.bootstrapTable('removeByUniqueId', id);
|
}
|
|
function submitHandler() {
|
if ($.validate.form()) {
|
var sdata = getData();
|
var jsonArr = JSON.parse(sdata);
|
if (jsonArr.length == 0) {
|
$.modal.alertWarning('[[#{basis.pleaseentermultilingualinformation}]]');
|
return;
|
}
|
$("#langCodes").val(sdata);
|
$.operate.save(prefix + "/edit", $('#form-demographyParam-edit').serialize());
|
}
|
}
|
|
/* 查询表格所有数据值 */
|
function getData(){
|
var data = $.btTable.bootstrapTable('getData');
|
return JSON.stringify(data);
|
}
|
|
// 选择字典处理函数
|
function selectDictTree() {
|
var dictType = '234';
|
var url = ctx + "system/dict/selectDictTree/" + 10 + "/" + dictType;
|
var options = {
|
title: '[[#{jsp.exam.demographyParam.dictionarytype}]]',
|
width: "380",
|
url: url,
|
callBack: doSubmit
|
};
|
$.modal.openOptions(options);
|
}
|
|
function doSubmit(index, layero){
|
var body = layer.getChildFrame('body', index);
|
var dictType = body.find('#dictType').val();
|
layer.close(index);
|
$("#dicttype").val(dictType);
|
}
|
</script>
|
</body>
|
</html>
|