...
|
...
|
@@ -22,10 +22,6 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect |
|
|
|
|
|
// 加载遮罩
|
|
|
var loading;
|
|
|
//获得权限列表
|
|
|
var checkList = common.checkPermission(accessToken);
|
|
|
|
|
|
var codeIsExist = false;
|
|
|
|
|
|
loadApplicationTable();
|
|
|
|
...
|
...
|
@@ -36,31 +32,24 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect |
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
$("#applicationQueryBtn").on("click", function () {
|
|
|
loadApplicationTable();
|
|
|
})
|
|
|
|
|
|
/**
|
|
|
* 加载应用信息表格
|
|
|
*/
|
|
|
function loadApplicationTable() {
|
|
|
conditions.appName = $('#condition-app-name').val().trim();
|
|
|
conditions.busTypeName = $('#condition-app-name').val().trim();
|
|
|
conditions.appDesc = $('#condition-app-name').val().trim();
|
|
|
applicationTable = table.render({
|
|
|
elem: '#table-application-table',
|
|
|
elem: '#application-table',
|
|
|
url: domainName + '/api-web/manage/application/page?access_token=' + accessToken,
|
|
|
where: conditions,
|
|
|
height: 'full-200',
|
|
|
height: 'full-250',
|
|
|
page: {
|
|
|
theme: '#1E9FFF'
|
|
|
},
|
|
|
limit: common.limit,
|
|
|
limits: common.limits,
|
|
|
cols: [[
|
|
|
{
|
|
|
type: 'checkbox'
|
|
|
}, {title: '序号', align: "center", type: 'numbers', event: 'dblclick', width: '5%'}, {
|
|
|
},{title: '序号', align: "center", type: 'numbers', event: 'dblclick', width: '5%'},{
|
|
|
// field: 'appCode', title: '应用编号', align: 'center', sort: true,
|
|
|
// templet:
|
|
|
// '<div>' +
|
...
|
...
|
@@ -70,21 +59,16 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect |
|
|
// ' </span>' +
|
|
|
// '</div>'
|
|
|
// }, {
|
|
|
field: 'appName', title: '应用名称', align: 'center', sort: true, width: '20%',
|
|
|
field: 'appName', title: '应用名称', align: 'center', sort: true,
|
|
|
templet:
|
|
|
'<div>' +
|
|
|
' <span' +
|
|
|
' data-index="{{d.LAY_TABLE_INDEX}}"' +
|
|
|
' data-bustypename="{{d.busTypeName}}"' +
|
|
|
' data-appdesc="{{d.appDesc}}"' +
|
|
|
' data-busid="{{d.busId}}"' +
|
|
|
' data-appid="{{d.appId}}"' +
|
|
|
' data-appcode="{{d.appCode}}"' +
|
|
|
' class="layui-table-link btn-application-edit">{{d.appName}}' +
|
|
|
' </span>' +
|
|
|
'</div>'
|
|
|
}, {
|
|
|
field: 'busTypeName', title: '所属业务', align: 'center', sort: true, width: '20%',
|
|
|
field: 'busTypeName', title: '所属业务', align: 'center', sort: true,
|
|
|
templet: function (d) {
|
|
|
if (d.busType.busTypeName == null) {
|
|
|
return ""
|
...
|
...
|
@@ -93,24 +77,20 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect |
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
field: 'appDesc', title: '应用描述', align: 'left', sort: true
|
|
|
field: 'appDesc', title: '应用描述', align: 'center', sort: true
|
|
|
}, {
|
|
|
field: 'createTime', title: '创建时间', align: 'center', sort: true, width: '10%'
|
|
|
field: 'createTime', title: '创建时间', align: 'center', sort: true
|
|
|
}, {
|
|
|
title: '操作', align: 'center', width: 120, fixed: 'right',
|
|
|
title: '操作', align: 'center',width:120,fixed:'right',
|
|
|
templet:
|
|
|
'<div>' +
|
|
|
'<button data-id="{{d.appId}}" class="layui-btn layui-btn-xs layui-btn-normal btn-application-delete" lay-tips="删除"><i class="layui-icon"></i></button>' +
|
|
|
' <span data-id="{{d.appId}}" class="layui-table-link btn-application-delete">删除</span>' +
|
|
|
'</div>'
|
|
|
}
|
|
|
]],
|
|
|
done: function (res) {
|
|
|
// 点击编号编辑事件
|
|
|
$('.btn-application-edit').click(function () {
|
|
|
if ($.inArray('back:application:update', checkList) == -1) {
|
|
|
layer.msg('暂无权限!', {icon: 7, time: 3000});
|
|
|
return;
|
|
|
}
|
|
|
var currentApplication = res.data[$(this).data('index')];
|
|
|
delete currentApplication.LAY_TABLE_INDEX;
|
|
|
saveApplication('edit', '编辑', currentApplication);
|
...
|
...
|
@@ -126,17 +106,13 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect |
|
|
|
|
|
// 新增按钮
|
|
|
$('#application-create').click(function () {
|
|
|
if ($.inArray('back:application:save', checkList) == -1) {
|
|
|
layer.msg('暂无权限!', {icon: 7, time: 3000});
|
|
|
return;
|
|
|
}
|
|
|
saveApplication('insert', '新增')
|
|
|
});
|
|
|
|
|
|
// 批量删除按钮
|
|
|
$('#btn-application-delete').click(function () {
|
|
|
var deletes = [];
|
|
|
$.each(table.checkStatus('table-application-table').data, function (index, value) {
|
|
|
$.each(table.checkStatus('application-table').data, function (index, value) {
|
|
|
deletes.push(value.appId);
|
|
|
});
|
|
|
deleteAppById(deletes);
|
...
|
...
|
@@ -170,7 +146,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect |
|
|
layer.open({
|
|
|
type: 1,
|
|
|
title: '<a class="layui-icon layui-icon-edit win_title_icon"></a>' + actionName,
|
|
|
area: ['40%', '50%'],
|
|
|
area: ['970px', '450px'],
|
|
|
content: $('#applicationEdit').html(),
|
|
|
btn: ['保存', '取消'],
|
|
|
success: function (layero, index) {
|
...
|
...
|
@@ -224,21 +200,13 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect |
|
|
form.render();
|
|
|
// 应用编号改变判断是否已经存在
|
|
|
$('#txt-application-code').change(function () {
|
|
|
var al = checkAppCodeExist($(this).val(), oldAppCode);
|
|
|
if (al == '1') {
|
|
|
if (checkAppCodeExist($(this).val())) {
|
|
|
$(this).val(oldAppCode);
|
|
|
codeIsExist = true;
|
|
|
layer.msg('该编号已存在,请重新输入!', {icon: 2, time: 3000});
|
|
|
} else {
|
|
|
codeIsExist = false;
|
|
|
}
|
|
|
});
|
|
|
// 绑定表单提交事件
|
|
|
form.on('submit(application-submit)', function (data) {
|
|
|
if (codeIsExist) {
|
|
|
codeIsExist = false;
|
|
|
return false;
|
|
|
}
|
|
|
loading = layer.load(2);
|
|
|
application = Object.assign(application, data.field);
|
|
|
application.appCode = appCodePrefix + application.appCode;
|
...
|
...
|
@@ -258,6 +226,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect |
|
|
if (response.success) {
|
|
|
layer.msg(actionName + '成功!', {icon: 1, time: 3000});
|
|
|
layer.close(index);
|
|
|
loadApplicationTable();
|
|
|
} else {
|
|
|
layer.msg(actionName + '失败!', {icon: 2, time: 3000});
|
|
|
}
|
...
|
...
|
@@ -269,9 +238,6 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect |
|
|
yes: function () {
|
|
|
// 触发表单提交
|
|
|
$('#btn-application-submit').click();
|
|
|
},
|
|
|
end: function () {
|
|
|
loadApplicationTable();
|
|
|
}
|
|
|
});
|
|
|
|
...
|
...
|
@@ -281,20 +247,19 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect |
|
|
* @param appCode 应用编号
|
|
|
* @returns {boolean} 存在: true,不存在: false
|
|
|
*/
|
|
|
function checkAppCodeExist(appCode, oldAppCode) {
|
|
|
var result = '0';
|
|
|
var newAppCode = appCodePrefix + appCode;
|
|
|
function checkAppCodeExist(appCode) {
|
|
|
var result = true;
|
|
|
admin.req({
|
|
|
url: domainName + '/api-web/manage/application/checkout/' + newAppCode,
|
|
|
url: domainName + '/api-web/manage/application/page',
|
|
|
async: false,
|
|
|
data: {
|
|
|
oldAppCode: oldAppCode
|
|
|
page: 1,
|
|
|
limit: 10,
|
|
|
appCode: appCodePrefix + appCode
|
|
|
}
|
|
|
}).done(function (response) {
|
|
|
if (response.success == true) {
|
|
|
if (response.count > 0) {
|
|
|
result = '1';
|
|
|
}
|
|
|
if (response.data.length === 0) {
|
|
|
result = false;
|
|
|
}
|
|
|
});
|
|
|
return result;
|
...
|
...
|
@@ -307,10 +272,6 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect |
|
|
* @param appIds 要删除的应用id
|
|
|
*/
|
|
|
function deleteAppById(appIds) {
|
|
|
if ($.inArray('back:application:delete', checkList) == -1) {
|
|
|
layer.msg('暂无权限!', {icon: 7, time: 3000});
|
|
|
return;
|
|
|
}
|
|
|
if (appIds.length === 0) {
|
|
|
layer.msg('请选择您要删除的数据。', {icon: 7, title: '提示'});
|
|
|
return;
|
...
|
...
|
@@ -339,4 +300,4 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect |
|
|
})
|
|
|
}
|
|
|
});
|
|
|
}); |
|
|
}); |
|
|
\ No newline at end of file |
...
|
...
|
|