127 lines
2.8 KiB
Vue
127 lines
2.8 KiB
Vue
<template>
|
|
<basicModal @register="modalRegister" ref="modalRef" class="basicModal basicFormModal">
|
|
<template #default>
|
|
<n-descriptions :column="2" bordered :labelStyle="{ width: '110px' }" label-placement="left">
|
|
<n-descriptions-item label="消息标题:">{{ formData.title }}</n-descriptions-item>
|
|
<n-descriptions-item label="消息类型:">{{
|
|
getTyepText(formData.type)
|
|
}}</n-descriptions-item>
|
|
<n-descriptions-item label="业务类型:">{{
|
|
formData.bizType == 1 ? '订单' : '其他'
|
|
}}</n-descriptions-item>
|
|
<n-descriptions-item label="消息状态:">{{
|
|
formData.status == 1 ? '已读' : '未读'
|
|
}}</n-descriptions-item>
|
|
<n-descriptions-item label="消息内容:">{{ formData.content }}</n-descriptions-item>
|
|
</n-descriptions>
|
|
</template>
|
|
<template #action>
|
|
<span class="dialog-footer">
|
|
<n-button @click="dialogClose">关闭</n-button>
|
|
</span>
|
|
</template>
|
|
</basicModal>
|
|
</template>
|
|
<script lang="ts" setup>
|
|
import { getMessageDetail } from '@/api/dashboard/message';
|
|
import { useModal } from '@/components/Modal';
|
|
import { onMounted, reactive } from 'vue';
|
|
|
|
const emit = defineEmits(['success', 'update:visible']);
|
|
|
|
/**
|
|
* 定义表单参数
|
|
*/
|
|
const formData = reactive({
|
|
id: '',
|
|
title: '',
|
|
type: '',
|
|
bizType: '',
|
|
status: '',
|
|
content: '',
|
|
});
|
|
|
|
/**
|
|
* 定义接收的参数
|
|
*/
|
|
const props = defineProps({
|
|
visible: {
|
|
type: Boolean,
|
|
required: true,
|
|
default: false,
|
|
},
|
|
messageId: {
|
|
type: Number,
|
|
required: true,
|
|
default: 0,
|
|
},
|
|
});
|
|
|
|
/**
|
|
* 定义模态
|
|
*/
|
|
const [modalRegister, { openModal }] = useModal({
|
|
title: '日志详情',
|
|
subBtuText: '确定',
|
|
width: 600,
|
|
});
|
|
|
|
/**
|
|
* 关闭弹窗
|
|
*/
|
|
const dialogClose = () => {
|
|
emit('update:visible', false);
|
|
};
|
|
|
|
/**
|
|
* 设置表单参数
|
|
*/
|
|
const setFormData = async () => {
|
|
const data = await getMessageDetail(props.messageId);
|
|
for (const key in formData) {
|
|
if (data[key] != null && data[key] != undefined) {
|
|
//@ts-ignore
|
|
formData[key] = data[key];
|
|
}
|
|
}
|
|
};
|
|
|
|
/**
|
|
* 获取类型文本描述
|
|
* @param type 类型
|
|
*/
|
|
const getTyepText = (type) => {
|
|
let typeText = '';
|
|
switch (type) {
|
|
case 1:
|
|
typeText = '系统通知';
|
|
break;
|
|
case 2:
|
|
typeText = '用户私信 ';
|
|
break;
|
|
case 3:
|
|
typeText = '代办事项';
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
return typeText;
|
|
};
|
|
|
|
/**
|
|
* 钩子函数
|
|
*/
|
|
onMounted(() => {
|
|
if (props.messageId) {
|
|
setFormData();
|
|
}
|
|
});
|
|
|
|
/**
|
|
* 定义函数
|
|
*/
|
|
defineExpose({
|
|
openModal,
|
|
});
|
|
</script>
|