Commit a7476766 authored by “yiyousong”'s avatar “yiyousong”

feat: 消息任务列表添加删除

parent 138c61cf
...@@ -4,6 +4,10 @@ let baseURL = process.env.VUE_APP_API_BASE_URL; ...@@ -4,6 +4,10 @@ let baseURL = process.env.VUE_APP_API_BASE_URL;
export function getMsgTaskList(params) { export function getMsgTaskList(params) {
return http.post(`${baseURL}/zwfw/message/task/list`, params); return http.post(`${baseURL}/zwfw/message/task/list`, params);
} }
// 删除消息任务
export function deleteMsgTask(params) {
return http.get(`${baseURL}/zwfw/message/task/delete`, params);
}
// 查询消息配置列表 // 查询消息配置列表
export function getMsgConfigList(params) { export function getMsgConfigList(params) {
......
...@@ -226,6 +226,10 @@ export default { ...@@ -226,6 +226,10 @@ export default {
this.setMoment(); this.setMoment();
this.getMsgTaskList(); this.getMsgTaskList();
this.autoUpdate(); this.autoUpdate();
this.$bus.$off("updateMessageList");
this.$bus.$on("updateMessageList", () => {
this.getMsgTaskList();
});
}, },
methods: { methods: {
...mapMutations("user", ["reset"]), ...mapMutations("user", ["reset"]),
......
<template> <template>
<div> <div>
<div class="flex items-center justify-between mb-[20px]"> <div class="flex items-center justify-between mb-[20px]">
<div> <a-space>
<a-button type="danger" @click="handBatchDel">批量删除</a-button>
发送消息总量:<span class="primary font-bold">{{ total }}</span> 发送消息总量:<span class="primary font-bold">{{ total }}</span>
</div> </a-space>
<a-space> <a-space>
<a-select v-model="searchform.sendStatus"> <a-select v-model="searchform.sendStatus">
<a-select-option value=""> 全部状态 </a-select-option> <a-select-option value=""> 全部状态 </a-select-option>
...@@ -41,6 +42,10 @@ ...@@ -41,6 +42,10 @@
:columns="columns" :columns="columns"
:data-source="tableData" :data-source="tableData"
:loading="loading" :loading="loading"
:rowSelection="{
selectedRowKeys: selectedRowKeys,
onChange: onSelectChange,
}"
@change="changePagination" @change="changePagination"
> >
<template slot="action" slot-scope="text, record"> <template slot="action" slot-scope="text, record">
...@@ -48,6 +53,9 @@ ...@@ -48,6 +53,9 @@
<span class="cursor-pointer primary" @click="handleInfo(record)" <span class="cursor-pointer primary" @click="handleInfo(record)"
>查看详情</span >查看详情</span
> >
<span class="cursor-pointer delete" @click="handleDel(record.id)"
>删除</span
>
</a-space> </a-space>
</template> </template>
</a-table> </a-table>
...@@ -62,7 +70,7 @@ ...@@ -62,7 +70,7 @@
<script> <script>
import MessageInfo from "@/components/MessageInfo.vue"; import MessageInfo from "@/components/MessageInfo.vue";
import storage from "@/utils/js/Storage"; import storage from "@/utils/js/Storage";
import { getMsgTaskList } from "@/api/message"; import { getMsgTaskList, deleteMsgTask } from "@/api/message";
export default { export default {
components: { MessageInfo }, components: { MessageInfo },
data() { data() {
...@@ -118,7 +126,7 @@ export default { ...@@ -118,7 +126,7 @@ export default {
{ {
title: "操作", title: "操作",
align: "center", align: "center",
width: 100, width: 150,
scopedSlots: { customRender: "action" }, scopedSlots: { customRender: "action" },
}, },
], ],
...@@ -138,6 +146,7 @@ export default { ...@@ -138,6 +146,7 @@ export default {
this.$moment().format("YYYY-MM-DD"), this.$moment().format("YYYY-MM-DD"),
], ],
}, },
selectedRowKeys: [],
showMessageInfo: false, showMessageInfo: false,
}; };
}, },
...@@ -159,6 +168,10 @@ export default { ...@@ -159,6 +168,10 @@ export default {
this.loading = false; this.loading = false;
if (res.code === 1) { if (res.code === 1) {
let { data, total, dict } = res.data; let { data, total, dict } = res.data;
if (!data.length && this.current > 1) {
this.current -= 1;
this.getMsgTaskList();
}
data.forEach((v) => { data.forEach((v) => {
v.alarmTime = this.$moment(v.alarmTime).format("YYYY-MM-DD HH:mm:ss"); v.alarmTime = this.$moment(v.alarmTime).format("YYYY-MM-DD HH:mm:ss");
...@@ -183,6 +196,7 @@ export default { ...@@ -183,6 +196,7 @@ export default {
}, },
handSearch() { handSearch() {
this.current = 1; this.current = 1;
this.selectedRowKeys = [];
this.getMsgTaskList(); this.getMsgTaskList();
}, },
resetSearch() { resetSearch() {
...@@ -190,10 +204,41 @@ export default { ...@@ -190,10 +204,41 @@ export default {
this.$moment().format("YYYY-MM-DD"), this.$moment().format("YYYY-MM-DD"),
this.$moment().format("YYYY-MM-DD"), this.$moment().format("YYYY-MM-DD"),
]; ];
this.selectedRowKeys = [];
this.searchform.sendStatus = ""; this.searchform.sendStatus = "";
this.current = 1; this.current = 1;
this.getMsgTaskList(); this.getMsgTaskList();
}, },
onSelectChange(keys) {
this.selectedRowKeys = keys;
},
handBatchDel() {
if (!this.selectedRowKeys.length) {
this.$message.warning("请选勾选数据");
return;
}
let ids = this.selectedRowKeys.join(",");
this.handleDel(ids);
},
handleDel(id) {
this.$confirm({
okType: "danger",
title: "系统提示",
content: "删除不可恢复,是否继续?",
okText: "",
cancelText: "",
centered: true,
onOk: async () => {
let res = await deleteMsgTask({ id });
if (res.code === 1) {
this.$message.success(res.msg);
this.selectedRowKeys = [];
this.getMsgTaskList();
this.$bus.$emit("updateMessageList");
}
},
});
},
}, },
}; };
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment