From 8f0a0dcceed466a2bf0f92f9423c47666e6ca4ad Mon Sep 17 00:00:00 2001
From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com>
Date: Wed, 19 Feb 2025 11:27:43 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E8=AF=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../evaluate/template/evaluateTemplate.html | 30 +++++++++++++++----
1 file changed, 24 insertions(+), 6 deletions(-)
diff --git a/src/main/resources/static/pages/evaluate/template/evaluateTemplate.html b/src/main/resources/static/pages/evaluate/template/evaluateTemplate.html
index ec262a1..22bd9ea 100644
--- a/src/main/resources/static/pages/evaluate/template/evaluateTemplate.html
+++ b/src/main/resources/static/pages/evaluate/template/evaluateTemplate.html
@@ -110,12 +110,14 @@
, { field: 'name', align: 'center', title: '模板名称' }
, { field: 'createUser', align: 'center', title: '创建人' }
, { field: 'createTime', align: 'center', title: '创建时间' }
- , { field: 'version', align: 'center', title: '版本' },
+ , { field: 'version', align: 'center', title: '版本', width: 120, },
, {
field: 'isEnable', align: 'center', title: '启用状态',
templet: function (d) {
// 根据 isUse 字段的值决定开关的状态
- return '';
+ return '';
}
},
{
@@ -166,10 +168,26 @@
// 监听开关事件
done: function () {
layui.form.on('switch(switchTest)', function (obj) {
- var status = obj.elem.checked ? '开' : '关';
- // 这里可以添加你更新启用状态的逻辑,向服务器发送修改请求
- // console.log('状态更新为:' + status);
- alert('状态更新为:' + status)
+ const configId = obj.elem.getAttribute('data-configId')
+ // 如果为 true 则打开状态 调后台接口
+ if (obj.elem.checked) {
+ $.ajax({
+ type: "POST",
+ url: ctxPath + '/setTemplate/changeEnable',
+ data: { configId },
+ success: function (data) {
+ layer.close(index);
+
+ 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 });
+ // }
+ }
+ });
+ }
});
}
});