合并结果

This commit is contained in:
tanghc
2019-03-21 14:02:05 +08:00
parent e56787fc55
commit 9ab2bacf42
20 changed files with 333 additions and 78 deletions

View File

@@ -1,13 +1,20 @@
lib.use(['element', 'table', 'tree', 'form'], function () {
var ROUTE_STATUS = {
'0': '待审核'
,'1': '<span class="x-green">已启用</span>'
,'2': '<span class="x-red">已禁用</span>'
}
var profile = window.profile;
var form = layui.form;
var updateForm = layui.Form('updateForm');
var addForm = layui.Form('addForm');
var table = layui.table;
var currentServiceId;
var routeTable;
var profile = window.profile;
var $updateForm = $('#updateForm');
var $addForm = $('#addForm');
var smTitle;
form.on('submit(searchFilter)', function (data) {
var param = data.field;
param.serviceId = currentServiceId;
@@ -108,16 +115,17 @@ lib.use(['element', 'table', 'tree', 'form'], function () {
, {field: 'path', title: 'path', width: 200}
, {
field: 'ignoreValidate', width: 80, title: '忽略验证', templet: function (row) {
return row.ignoreValidate
? '<span class="x-red">是</span>'
: '<span>否</span>';
return row.ignoreValidate ? '<span class="x-red">是</span>' : '<span>否</span>';
}
}
, {
field: 'disabled', title: '状态', width: 80, templet: function (row) {
return row.disabled
? '<span class="x-red">禁用</span>'
: '<span class="x-green">启用</span>';
field: 'mergeResult', title: '合并结果', width: 80, templet: function (row) {
return row.mergeResult ? '合并' : '<span class="x-yellow">不合并</span>';
}
}
, {
field: 'status', title: '状态', width: 80, templet: function (row) {
return ROUTE_STATUS[row.status + ''];
}
}
, {fixed: 'right', title: '操作', toolbar: '#optBar', width: 100}
@@ -128,38 +136,37 @@ lib.use(['element', 'table', 'tree', 'form'], function () {
table.on('tool(routeTable)', function(obj) {
var data = obj.data;
if(obj.event === 'edit'){
$updateForm.get(0).reset();
//表单初始赋值
data.profile = profile;
data.serviceId = currentServiceId;
data.disabled = data.disabled + '';
data.ignoreValidate = data.ignoreValidate + '';
form.val('updateWinFilter', data)
updateForm.setData(data);
// form.val('updateWinFilter', data);
layer.open({
type: 1
,title: '修改路由' + smTitle
,area: ['500px', '400px']
,area: ['500px', '460px']
,content: $('#updateWin') //这里content是一个DOM注意最好该元素要存放在body最外层否则可能被其它的相对元素所影响
});
}
});
table.on('toolbar(routeTable)', function(obj) {
if (obj.event === 'add') {
$addForm.find('input[name=id]').prop('readonly', false);
$addForm.get(0).reset();
var data = {};
data.profile = profile;
data.serviceId = currentServiceId;
data.id = '';
// 新加的路由先设置成禁用
data.disabled = 'true';
data.ignoreValidate = 'false';
form.val('addWinFilter', data);
data.status = 2;
data.ignoreValidate = 0;
data.mergeResult = 1;
addForm.setData(data);
layer.open({
type: 1
,title: '添加路由' + smTitle
,area: ['500px', '400px']
,area: ['500px', '460px']
,content: $('#addWin')
});
}