feat: 新增删除消息

This commit is contained in:
wanglihui 2023-08-05 20:59:28 +08:00
parent b26f27c261
commit 045939e88e
4 changed files with 77 additions and 20 deletions

View File

@ -18,6 +18,15 @@ export function messageSendPost(data: any) {
});
}
// 删除消息
export function messageDelete(data: any) {
return request({
url: '/manager/message',
method: 'delete',
data
});
}
// 发全员消息
export function messageSendAllPost(data: any) {
return request({

View File

@ -18,7 +18,7 @@
</div>
<template #footer>
<el-space>
<el-button @click="onSend">取消</el-button>
<el-button @click="onClose">取消</el-button>
<el-button type="primary" :loading="loaging" @click="onSend">发送</el-button>
</el-space>
</template>

View File

@ -71,7 +71,7 @@ import { useRoute } from 'vue-router';
import { ElButton, ElSpace, ElAvatar, ElMessage, ElMessageBox } from 'element-plus';
import { BU_DOU_CONFIG } from '@/config';
// API
import { messageRecordGet } from '@/api/message';
import { messageRecordGet, messageDelete } from '@/api/message';
const route = useRoute();
/**
@ -144,7 +144,7 @@ const column = reactive<Column.ColumnOptions[]>([
{
prop: 'created_at',
label: '发送时间',
width: 170
width: 180
},
{
prop: 'operation',
@ -155,9 +155,13 @@ const column = reactive<Column.ColumnOptions[]>([
render: (scope: any) => {
return (
<ElSpace>
<ElButton type="danger" onClick={() => onDel(scope.row)}>
删除
</ElButton>
{scope.row['is_deleted'] == 0 ? (
<ElButton type="danger" onClick={() => onDel(scope.row)}>
删除
</ElButton>
) : (
''
)}
</ElSpace>
);
}
@ -197,8 +201,31 @@ const onCurrentChange = (current: number) => {
getUserList();
};
//
const msgDel = (data: any) => {
const list: any[] = [];
list.push({
message_id: data.message_id,
message_seq: data.message_seq
});
const formData = {
channel_id: route.query.groupNo,
channel_type: 2,
list
};
messageDelete(formData).then((res: any) => {
if (res.status == 200) {
getUserList();
ElMessage({
type: 'success',
message: '删除成功!'
});
}
});
};
//
const onDel = (_item: any) => {
const onDel = (item: any) => {
ElMessageBox.confirm('确定,是否删除此消息?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
@ -206,10 +233,7 @@ const onDel = (_item: any) => {
type: 'warning'
})
.then(() => {
ElMessage({
type: 'success',
message: '开发中..'
});
msgDel(item);
})
.catch(() => {
ElMessage({

View File

@ -73,7 +73,7 @@ import { useRoute } from 'vue-router';
import { ElButton, ElSpace, ElAvatar, ElMessage, ElMessageBox } from 'element-plus';
import { BU_DOU_CONFIG } from '@/config';
// API
import { messageRecordpersonalGet } from '@/api/message';
import { messageRecordpersonalGet, messageDelete } from '@/api/message';
const route = useRoute();
/**
@ -165,9 +165,13 @@ const column = reactive<Column.ColumnOptions[]>([
render: (scope: any) => {
return (
<ElSpace>
<ElButton type="danger" onClick={() => onDel(scope.row)}>
删除
</ElButton>
{scope.row['is_deleted'] == 0 ? (
<ElButton type="danger" onClick={() => onDel(scope.row)}>
删除
</ElButton>
) : (
''
)}
</ElSpace>
);
}
@ -208,8 +212,31 @@ const onCurrentChange = (current: number) => {
getUserList();
};
//
const msgDel = (data: any) => {
const list: any[] = [];
list.push({
message_id: data.message_id,
message_seq: data.message_seq
});
const formData = {
channel_id: route.query.uid,
channel_type: 1,
list
};
messageDelete(formData).then((res: any) => {
if (res.status == 200) {
getUserList();
ElMessage({
type: 'success',
message: '删除成功!'
});
}
});
};
//
const onDel = (_item: any) => {
const onDel = (item: any) => {
ElMessageBox.confirm('确定,是否删除此消息?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
@ -217,10 +244,7 @@ const onDel = (_item: any) => {
type: 'warning'
})
.then(() => {
ElMessage({
type: 'success',
message: '开发中..'
});
msgDel(item);
})
.catch(() => {
ElMessage({