viewDetailDrawer.vue
2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<template>
<BasicDrawer
v-bind="$attrs"
@register="registerDrawer"
:showFooter="false"
:title="getTitle"
width="800px"
>
<PageWrapper title="站内通知详情">
<Description @register="register1" class="mt-4" />
</PageWrapper>
</BasicDrawer>
</template>
<script lang="ts">
import { defineComponent, ref, computed, unref } from 'vue';
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
import { Description, DescItem, useDescription } from '/@/components/Description/index';
import { PageWrapper } from '/@/components/Page';
import { noticeByIdGetInfo } from '/@/api/stationnotification/stationnotifyApi';
const schema: DescItem[] = [
{
field: 'title',
label: '标题',
},
{
field: 'content',
label: '内容',
render: (_, data) => {
return !data.content ? '' : data.content.slice(3, data.content.length - 4);
},
},
{
field: 'senderName',
label: '发送者',
},
{
field: 'senderDate',
label: '发送时间',
},
{
field: 'type',
label: '类型',
render: (_, data) => {
return data.type === 'NOTICE'
? '公告'
: data.type === 'MEETING'
? '会议'
: data.type === 'OTHER'
? '其他'
: '';
},
},
{
field: 'status',
label: '状态',
},
{
field: 'updateTime',
label: '更新时间',
},
{
field: 'receiverType',
label: '接收类型',
},
{
field: 'createTime',
label: '创建时间',
},
];
export default defineComponent({
name: 'ConfigDrawer',
components: { BasicDrawer, Description, PageWrapper },
emits: ['success', 'register'],
setup() {
let descInfo = ref(null);
const isUpdate = ref(true);
const [registerDrawer, { setDrawerProps }] = useDrawerInner(async (data) => {
setDrawerProps({ confirmLoading: false });
isUpdate.value = !!data?.isUpdate;
let getDescInfo = await noticeByIdGetInfo(data.record.id);
descInfo.value = getDescInfo;
});
const getTitle = computed(() => (!unref(isUpdate) ? '查看通知' : '查看通知'));
const [register1] = useDescription({
title: '详情',
bordered: false,
data: descInfo,
schema: schema,
});
return {
register1,
getTitle,
registerDrawer,
};
},
});
</script>