|
@@ -27,13 +27,20 @@
|
|
|
</template>
|
|
|
<template #menu="{ size, row, index }">
|
|
|
<el-button
|
|
|
- v-if="row.state === '0'"
|
|
|
+ v-if="row.state === '0' || (row.type === '5' && row.state !== '2')"
|
|
|
type="primary"
|
|
|
link
|
|
|
size="small"
|
|
|
@click="handleEdit(row, 0)"
|
|
|
><i-ep-edit />编辑
|
|
|
</el-button>
|
|
|
+ <el-button
|
|
|
+ v-if="row.state === '1' && row.type === '5'"
|
|
|
+ type="danger"
|
|
|
+ size="small"
|
|
|
+ @click="overMessage(row.id)"
|
|
|
+ >过期
|
|
|
+ </el-button>
|
|
|
|
|
|
<el-button
|
|
|
type="primary"
|
|
@@ -125,7 +132,7 @@
|
|
|
import { ref, getCurrentInstance } from "vue";
|
|
|
import { useCrud } from "@/hooks/userCrud";
|
|
|
import Editor from "@/views/system/message/editor/index.vue";
|
|
|
-import { addMessage, updateMessage } from "@/api/system/message";
|
|
|
+import {addMessage, updateMessage, overEnd} from "@/api/system/message";
|
|
|
import { useCommonStoreHook } from "@/store";
|
|
|
import { getUserList } from "@/api/system/user";
|
|
|
import { queryDictDataByType } from "@/api/system/dict";
|
|
@@ -170,6 +177,23 @@ const handleSubmit = () => {
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
+const overMessage = (id) => {
|
|
|
+ ElMessageBox.confirm("确定要过期吗?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ lockScroll: false,
|
|
|
+ }).then(() => {
|
|
|
+ overEnd(id).then((data) => {
|
|
|
+ if (data.code === "200") {
|
|
|
+ ElMessage.success(data.msg);
|
|
|
+ dataList();
|
|
|
+ } else {
|
|
|
+ ElMessage.error(data.msg);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
+};
|
|
|
const handleEdit = (row, index) => {
|
|
|
message.value = row;
|
|
|
editorContent.value = row.content;
|
|
@@ -241,7 +265,7 @@ const queryUserList = () => {
|
|
|
// 设置表格列或者其他自定义的option
|
|
|
option.value = Object.assign(option.value, {
|
|
|
searchEnter: true,
|
|
|
- delBtn: false,
|
|
|
+ delBtn: true,
|
|
|
selection: false,
|
|
|
addBtn: false,
|
|
|
editBtn: false,
|
|
@@ -300,6 +324,7 @@ option.value = Object.assign(option.value, {
|
|
|
dicData: [
|
|
|
{ label: "暂存", value: "0" },
|
|
|
{ label: "已发送", value: "1" },
|
|
|
+ {label: "过期", value: "2"},
|
|
|
],
|
|
|
html: true,
|
|
|
formatter: (val) => {
|
|
@@ -307,6 +332,8 @@ option.value = Object.assign(option.value, {
|
|
|
return '<b class="el-tag el-tag--warning el-tag--light">暂存</b>';
|
|
|
} else if (val.state === "1") {
|
|
|
return '<b class="el-tag el-tag--success el-tag--light">已发送</b>';
|
|
|
+ } else if (val.state === "2") {
|
|
|
+ return '<b class="el-tag el-tag--danger el-tag--light">过期</b>';
|
|
|
}
|
|
|
},
|
|
|
},
|