模板状态更改时逻辑完善

This commit is contained in:
BianLzhaoMin 2025-02-19 13:30:25 +08:00
parent 0a42861847
commit 10e9cc1310
1 changed files with 14 additions and 9 deletions

View File

@ -114,7 +114,7 @@
, {
field: 'isEnable', align: 'center', title: '启用状态',
templet: function (d) {
// 根据 isUse 字段的值决定开关的状态
// 根据 isEnable 字段的值决定开关的状态
return '<input type="checkbox" lay-filter="switchTest" lay-skin="switch" lay-text="启用|禁用" ' +
(d.isEnable == '0' ? 'checked' : '') +
' data-configId="' + d.id + '">';
@ -176,15 +176,20 @@
url: ctxPath + '/setTemplate/changeEnable',
data: { configId },
success: function (data) {
layer.close(index);
if (data.res == 1) {
layer.msg(data.resMsg, { icon: 1, time: 2000 })
initTable()
} else {
obj.elem.checked = false;
layui.form.render('switch')
layer.msg(data.resMsg, { icon: 2, time: 2000 })
}
console.log('状态修改结果', data)
// if (data.res === 1) {
// layer.msg(data.resMsg, { icon: 1, time: 2000 });
// search(1);
// } else {
// layer.msg(data.resMsg, { icon: 2, time: 2000 });
// }
},
error: function (data) {
obj.elem.checked = false;
layui.form.render('switch')
layer.msg(data.resMsg, { icon: 1, time: 2000 })
}
});
}