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

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

parent 138c61cf
......@@ -4,6 +4,10 @@ let baseURL = process.env.VUE_APP_API_BASE_URL;
export function getMsgTaskList(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) {
......
......@@ -226,6 +226,10 @@ export default {
this.setMoment();
this.getMsgTaskList();
this.autoUpdate();
this.$bus.$off("updateMessageList");
this.$bus.$on("updateMessageList", () => {
this.getMsgTaskList();
});
},
methods: {
...mapMutations("user", ["reset"]),
......
<template>
<div>
<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>
</div>
</a-space>
<a-space>
<a-select v-model="searchform.sendStatus">
<a-select-option value=""> 全部状态 </a-select-option>
......@@ -41,6 +42,10 @@
:columns="columns"
:data-source="tableData"
:loading="loading"
:rowSelection="{
selectedRowKeys: selectedRowKeys,
onChange: onSelectChange,
}"
@change="changePagination"
>
<template slot="action" slot-scope="text, record">
......@@ -48,6 +53,9 @@
<span class="cursor-pointer primary" @click="handleInfo(record)"
>查看详情</span
>
<span class="cursor-pointer delete" @click="handleDel(record.id)"
>删除</span
>
</a-space>
</template>
</a-table>
......@@ -62,7 +70,7 @@
<script>
import MessageInfo from "@/components/MessageInfo.vue";
import storage from "@/utils/js/Storage";
import { getMsgTaskList } from "@/api/message";
import { getMsgTaskList, deleteMsgTask } from "@/api/message";
export default {
components: { MessageInfo },
data() {
......@@ -118,7 +126,7 @@ export default {
{
title: "操作",
align: "center",
width: 100,
width: 150,
scopedSlots: { customRender: "action" },
},
],
......@@ -138,6 +146,7 @@ export default {
this.$moment().format("YYYY-MM-DD"),
],
},
selectedRowKeys: [],
showMessageInfo: false,
};
},
......@@ -159,6 +168,10 @@ export default {
this.loading = false;
if (res.code === 1) {
let { data, total, dict } = res.data;
if (!data.length && this.current > 1) {
this.current -= 1;
this.getMsgTaskList();
}
data.forEach((v) => {
v.alarmTime = this.$moment(v.alarmTime).format("YYYY-MM-DD HH:mm:ss");
......@@ -183,6 +196,7 @@ export default {
},
handSearch() {
this.current = 1;
this.selectedRowKeys = [];
this.getMsgTaskList();
},
resetSearch() {
......@@ -190,10 +204,41 @@ export default {
this.$moment().format("YYYY-MM-DD"),
this.$moment().format("YYYY-MM-DD"),
];
this.selectedRowKeys = [];
this.searchform.sendStatus = "";
this.current = 1;
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>
......
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