This commit is contained in:
toom1996
2025-06-23 11:48:04 +08:00
parent b6a57a6df6
commit 09d199167e
6 changed files with 179 additions and 82 deletions

View File

@ -70,6 +70,7 @@
<!-- 表格行工具栏 -->
<script type="text/html" id="table-bar">
<button class="pear-btn pear-btn-xs tool-btn" lay-event="research">重查</button>
<button class="pear-btn pear-btn-xs tool-btn" lay-event="edit">编辑</button>
<button class="pear-btn pear-btn-xs tool-btn" lay-event="delete">删除</button>
</script>
@ -83,6 +84,7 @@
// 相关常量
const PRIMARY_KEY = "id";
const RESEARCH_API = '/admin/api/keywords/monitor/research' // 重查关键词
const DELETE_API = '/admin/api/keywords/monitor/delete' // 删除监控词
const INDEX_API = '/admin/api/keywords/monitor'; // 表格数据
const VIEW_API = "/admin/api/keywords/monitor/view"; // 编辑按钮 - 查看
@ -147,9 +149,7 @@
});
}
// if (!count) {
render();
// }
// 编辑或删除行事件
table.on("tool(data-table)", function (obj) {
@ -190,6 +190,10 @@
*/
});
}
if (obj.event === 'research') {
research(obj)
}
});
// 表格顶部工具栏事件
@ -259,6 +263,31 @@
});
}
let research = function (obj) {
layer.confirm("确定重查?", {
icon: 3,
title: "提示"
}, function (index) {
layer.close(index);
let loading = layer.load();
layui.$.ajax({
url: RESEARCH_API,
type: "POST",
dateType: "json",
data: {
id: obj.data.id
},
success: function (res) {
layer.close(loading);
if (res.code) {
return layui.popup.failure(res.msg);
}
return layui.popup.success("操作成功", refreshTable);
}
})
});
}
// 删除一行
let remove = function (obj) {
return doRemove(obj.data[PRIMARY_KEY]);