You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
195 lines
7.9 KiB
195 lines
7.9 KiB
<#import "../master.ftl" as master>
|
|
<@master.layout>
|
|
<style>
|
|
#fm label {
|
|
width: 150px;
|
|
}
|
|
.page-header {
|
|
margin: 20px 0 -10px;
|
|
}
|
|
.input-div {
|
|
width: 100%;
|
|
}
|
|
</style>
|
|
|
|
<div class="page-header">
|
|
<h3>系统参数维护</h3>
|
|
</div>
|
|
|
|
<!-- 页面表单 -->
|
|
<table id="dg" class="easyui-datagrid" style="width:100%; height:400px;display: none;"
|
|
data-options="pagination: true, pageSize: 20, singleSelect:true, showFooter: true, fitColumns:true,
|
|
onSelect:onTableRowSelect, url:'/system/system_info/getList', method:'POST',
|
|
toolbar:'#tb'">
|
|
<thead>
|
|
<tr>
|
|
<th data-options="field:'site',width:100">Site</th>
|
|
<th data-options="field:'type',width:200">配置类型 (Type)</th>
|
|
<th data-options="field:'secondType',width:150">二级类型 (Second Type)</th>
|
|
<th data-options="field:'baseData',width:200">配置参数 (Base Data)</th>
|
|
<th data-options="field:'baseDesc',width:250">配置描述 (Base Desc)</th>
|
|
<th data-options="field:'status',width:80">状态 (Status)</th>
|
|
<th data-options="field:'sortNo',width:80">排序号</th>
|
|
<th data-options="field:'remark',width:200">备注 (Remark)</th>
|
|
<th data-options="field:'dataType',width:100">数据类型</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
|
|
<!-- 页面的查询框 -->
|
|
<div id="tb" style="padding:10px 5px;display: none;">
|
|
<div>
|
|
配置类型(Type): <input class="easyui-textbox" id="searchType" style="width:150px">
|
|
二级类型(Second Type): <input class="easyui-textbox" id="searchSecondType" style="width:150px">
|
|
<a href="#nowhere" id="queryLink" class="easyui-linkbutton" iconCls="icon-search">Query</a>
|
|
|
|
<a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="newSystemInfoModal()">New</a>
|
|
<a href="javascript:void(0)" id="tbEdit" data-options="disabled:true" class="easyui-linkbutton" iconCls="icon-edit" onclick="editSystemInfoModal()">Edit</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 新增和修改的modal -->
|
|
<div id="dlg" class="easyui-dialog" style="width:500px; display: none;"
|
|
closed="true" buttons="#dlg-buttons">
|
|
<form id="fm" method="post" novalidate style="margin:0;padding:20px 20px;">
|
|
<div style="margin-bottom:10px; display: none;" >
|
|
<input id="addId" name="id" class="easyui-textbox" style="display: none;" value="0">
|
|
</div>
|
|
<div style="width: 100%;">
|
|
<div class="input-div" style="margin-bottom:10px">
|
|
<input id="site" name="site" class="easyui-textbox" label="Site:" style="width:98%" value="ALL">
|
|
</div>
|
|
<div class="input-div" style="margin-bottom:10px">
|
|
<input id="type" name="type" class="easyui-textbox" required="true" label="配置类型 (Type):" style="width:98%">
|
|
</div>
|
|
<div class="input-div" style="margin-bottom:10px">
|
|
<input id="secondType" name="secondType" class="easyui-textbox" required="true" label="二级类型:" style="width:98%">
|
|
</div>
|
|
<div class="input-div" style="margin-bottom:10px; line-height: 30px;">
|
|
<label style="display:inline-block; width:150px;">配置参数 (Base Data):</label>
|
|
<!-- 移除 name="baseData" 属性,防止表单自动收集并和 onSubmit 的传参冲突 -->
|
|
<input id="baseDataCheckbox" type="checkbox" value="Y" style="vertical-align: middle; margin-top: -2px; width: 18px; height: 18px;">
|
|
</div>
|
|
<div class="input-div" style="margin-bottom:10px">
|
|
<input id="baseDesc" name="baseDesc" class="easyui-textbox" label="配置描述 (Base Desc):" style="width:98%">
|
|
</div>
|
|
<div class="input-div" style="margin-bottom:10px">
|
|
<input id="remark" name="remark" class="easyui-textbox" label="备注 (Remark):" style="width:98%">
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div id="dlg-buttons" style="display: none; text-align: center;width: 500px;">
|
|
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveSystemInfo()" style="width:90px">Save</a>
|
|
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')" style="width:90px">取消</a>
|
|
</div>
|
|
|
|
<script>
|
|
//临时参数
|
|
var currentRow;//当前行
|
|
//控制页面的高度
|
|
$(window).resize(function () {
|
|
$("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 30});
|
|
});
|
|
|
|
//初始化页面的高度
|
|
$(function () {
|
|
$(window).resize();
|
|
});
|
|
|
|
//查询功能
|
|
$("#queryLink").click(function(){
|
|
$('#dg').datagrid({
|
|
queryParams: {
|
|
type: $("#searchType").val(),
|
|
secondType: $("#searchSecondType").val() // 使用 secondType 查询
|
|
}
|
|
});
|
|
});
|
|
|
|
//处理菜单的功能
|
|
function onTableRowSelect(index, row) {
|
|
let noRowSelect = !!!row;
|
|
$("#tbEdit").linkbutton({"disabled": noRowSelect});
|
|
}
|
|
|
|
var url;
|
|
function newSystemInfoModal(){
|
|
$('#dlg').dialog('open').dialog('center').dialog('setTitle','新增系统参数');
|
|
$('#fm').form('clear');
|
|
url = '/system/system_info/save';
|
|
$('#addId').textbox("setValue", 0);
|
|
$('#site').textbox("setValue", "ALL");
|
|
$('#baseDataCheckbox').prop('checked', false);
|
|
|
|
// 新增时允许编辑 type
|
|
$('#type').textbox('textbox').removeAttr('readonly');
|
|
$('#secondType').textbox('textbox').removeAttr('readonly');
|
|
$('#type').textbox('textbox').css('background-color', '#fff');
|
|
$('#secondType').textbox('textbox').css('background-color', '#fff');
|
|
}
|
|
|
|
//保存信息
|
|
function saveSystemInfo(){
|
|
let type = $.trim($("#type").textbox('getValue'));
|
|
if(null == type || '' == type){
|
|
$.messager.alert('error', '请填写配置类型 (Type)!', 'error');
|
|
return false;
|
|
}
|
|
|
|
let baseData = '';
|
|
if ($('#baseDataCheckbox').prop('checked')) {
|
|
baseData = 'Y';
|
|
} else {
|
|
baseData = 'N';
|
|
}
|
|
|
|
//判断是否存在内容
|
|
$('#fm').form('submit', {
|
|
url: url,
|
|
onSubmit: function(param){
|
|
param.baseData = baseData; // 覆盖复选框可能带来的传值问题
|
|
},
|
|
success: function(result){
|
|
var result = eval("("+result+")");
|
|
if (result.success){
|
|
$('#dlg').dialog('close'); // close the dialog
|
|
$('#dg').datagrid('reload');
|
|
} else {
|
|
$.messager.alert('error',result.msg, 'error');
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
//编辑输入框
|
|
function editSystemInfoModal(){
|
|
var row = $('#dg').datagrid('getSelected');
|
|
if (row){
|
|
$('#dlg').dialog('open').dialog('center').dialog('setTitle','修改系统参数');
|
|
$('#fm').form('load', row);
|
|
|
|
// 根据数据回显复选框
|
|
if (row.baseData === 'Y') {
|
|
$('#baseDataCheckbox').prop('checked', true);
|
|
} else {
|
|
$('#baseDataCheckbox').prop('checked', false);
|
|
}
|
|
|
|
url = '/system/system_info/save';
|
|
$('#addId').textbox("setValue", row.id);
|
|
|
|
// 修改时 type 不可编辑
|
|
$('#type').textbox('textbox').attr('readonly','readonly');
|
|
$('#secondType').textbox('textbox').attr('readonly','readonly');
|
|
$('#type').textbox('textbox').css('background-color', '#f0f0f0'); // 给出不可编辑的视觉反馈
|
|
$('#secondType').textbox('textbox').css('background-color', '#f0f0f0'); // 给出不可编辑的视觉反馈
|
|
}else{
|
|
$.messager.alert('Warning','请选择一行!', 'warning');
|
|
}
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
</@master.layout>
|