增加配置
This commit is contained in:
parent
5e0884433d
commit
83923d8384
@ -251,6 +251,47 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
|
||||
<a href="javascript:void(0);"><cite>系统参数配置</cite></a>
|
||||
</span>
|
||||
<button id="systemParamsPlusBtn" type="button" class="layui-btn layui-btn-xs" style="float: right; margin-top: 12px;">
|
||||
<i class="fa fa-plus" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="layui-card-body" style="padding: 15px;">
|
||||
<div class="layui-form-item">
|
||||
<table class="layui-table">
|
||||
<colgroup>
|
||||
<col width="150">
|
||||
<col>
|
||||
<col width="60">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>参数名</th>
|
||||
<th>参数值</th>
|
||||
<th style="text-align: center;">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="systemParamsBody"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card" th:if="${appLogin eq 'appLogin'}">
|
||||
<div class="layui-card-header">
|
||||
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
|
||||
<a href="javascript:void(0);"><cite>APP参数配置</cite></a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="layui-card-body" style="padding: 15px;">
|
||||
<div class="layui-form-item">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-footer" style="left: 0;">
|
||||
@ -458,6 +499,90 @@
|
||||
});
|
||||
});
|
||||
|
||||
// 系统参数事件
|
||||
(function() {
|
||||
var systemParamsArray = [];
|
||||
|
||||
function getTr(index, key, value) {
|
||||
return '<tr>' +
|
||||
' <td>' +
|
||||
' <input type="text" id="systemParamsKey'+ index +'" placeholder="输入参数名" class="layui-input system-params-key" value="'+ (key ? key : '') +'" data-index="'+ index +'">' +
|
||||
' </td>' +
|
||||
' <td>' +
|
||||
' <input type="text" id="systemParamsValue'+ index +'" placeholder="输入参数值" class="layui-input system-params-value" value="'+ (value ? value : '') +'" data-index="'+ index +'">' +
|
||||
' </td>' +
|
||||
' <td style="text-align: center;">' +
|
||||
' <button type="button" class="layui-btn layui-btn-xs layui-btn-danger system-params-remove-btn" data-index="'+ index +'">' +
|
||||
' <i class="fa fa-times" aria-hidden="true"></i>' +
|
||||
' </button>' +
|
||||
' </td>' +
|
||||
'</tr>';
|
||||
}
|
||||
|
||||
function refreshTr() {
|
||||
var trs = '';
|
||||
for(var i = 0; i < systemParamsArray.length; i++) {
|
||||
var item = systemParamsArray[i];
|
||||
trs += getTr(i, item.key, item.value);
|
||||
}
|
||||
$('#systemParamsBody').empty();
|
||||
$('#systemParamsBody').append(trs);
|
||||
}
|
||||
|
||||
function isKeyExist(key) {
|
||||
if(!key) {
|
||||
return false;
|
||||
}
|
||||
for(var i = 0, item; item = systemParamsArray[i++];) {
|
||||
if(key == item.key) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function init() {
|
||||
|
||||
}
|
||||
init();
|
||||
|
||||
$(document).on('keyup', '.system-params-key', function() {
|
||||
var self = this;
|
||||
var index = this.dataset.index;
|
||||
var value = this.value;
|
||||
setTimeout(function() {
|
||||
if(isKeyExist(value)) {
|
||||
systemParamsArray[index].key = '';
|
||||
top.dialog.msg('参数名重复');
|
||||
self.value = '';
|
||||
self.focus();
|
||||
return;
|
||||
} else {
|
||||
systemParamsArray[index].key = value;
|
||||
}
|
||||
}, 50)
|
||||
});
|
||||
|
||||
$(document).on('keyup', '.system-params-value', function() {
|
||||
var index = this.dataset.index;
|
||||
systemParamsArray[index].value = this.value;
|
||||
});
|
||||
|
||||
$(document).on('click', '#systemParamsPlusBtn', function() {
|
||||
systemParamsArray.push({
|
||||
key: '',
|
||||
value: ''
|
||||
});
|
||||
refreshTr();
|
||||
})
|
||||
|
||||
$(document).on('click', '.system-params-remove-btn', function() {
|
||||
var index = this.dataset.index;
|
||||
systemParamsArray.splice(index, 1);
|
||||
refreshTr();
|
||||
})
|
||||
})();
|
||||
|
||||
// 初始化
|
||||
function initData() {
|
||||
var loadLayerIndex;
|
||||
|
Loading…
Reference in New Issue
Block a user