Commit bfb42dc034a224c66122c6e564090ca7e80c277d

Authored by fengistao
1 parent fe541336

feat:通知增加查看功能

@@ -26,10 +26,9 @@ enum NotifyManagerApi { @@ -26,10 +26,9 @@ enum NotifyManagerApi {
26 // * 获取详情 26 // * 获取详情
27 // * @param 27 // * @param
28 // */ 28 // */
29 -export const screenLinkPageByDeptIdGetDevice = (params: NoticeByIdParams) => { 29 +export const noticeByIdGetInfo = (id: string) => {
30 return defHttp.get({ 30 return defHttp.get({
31 - url: NotifyManagerApi.NOTICE_GET_DETAIL_URL,  
32 - params, 31 + url: `${NotifyManagerApi.NOTICE_GET_DETAIL_URL}/${id}`,
33 }); 32 });
34 }; 33 };
35 34
@@ -10,34 +10,49 @@ @@ -10,34 +10,49 @@
10 10
11 const schema: DescItem[] = [ 11 const schema: DescItem[] = [
12 { 12 {
  13 + field: 'creator',
  14 + label: '创建者',
  15 + },
  16 + {
13 field: 'title', 17 field: 'title',
14 label: '标题', 18 label: '标题',
15 }, 19 },
16 { 20 {
17 - field: 'content',  
18 - label: '内容', 21 + field: 'updateTime',
  22 + label: '更新时间',
19 }, 23 },
20 { 24 {
21 field: 'senderName', 25 field: 'senderName',
22 label: '发送者', 26 label: '发送者',
23 }, 27 },
24 { 28 {
25 - field: 'createTime',  
26 - label: '发送时间', 29 + field: 'readDate',
  30 + label: '阅读时间',
  31 + },
  32 + {
  33 + field: 'readStatus',
  34 + label: '阅读状态',
  35 + render: (_, data) => {
  36 + return data.readStatus === 0 ? '草稿' : data.readStatus === 1 ? '已读' : '其他';
  37 + },
27 }, 38 },
28 { 39 {
29 field: 'type', 40 field: 'type',
30 label: '类型', 41 label: '类型',
31 render: (_, data) => { 42 render: (_, data) => {
32 - return data.type === 'MEETING' 43 + return data.type === 'NOTICE'
33 ? '公告' 44 ? '公告'
34 - : data.type === 'MEETING1' 45 + : data.type === 'MEETING'
35 ? '会议' 46 ? '会议'
36 - : data.type === 'MEETING2' 47 + : data.type === 'OTHER'
37 ? '其他' 48 ? '其他'
38 : ''; 49 : '';
39 }, 50 },
40 }, 51 },
  52 + {
  53 + field: 'updater',
  54 + label: '更新者',
  55 + },
41 ]; 56 ];
42 export default defineComponent({ 57 export default defineComponent({
43 components: { Description, PageWrapper }, 58 components: { Description, PageWrapper },
@@ -4,36 +4,78 @@ @@ -4,36 +4,78 @@
4 @register="registerDrawer" 4 @register="registerDrawer"
5 :showFooter="false" 5 :showFooter="false"
6 :title="getTitle" 6 :title="getTitle"
7 - width="800px" 7 + width="1000px"
8 > 8 >
9 <DetailChild :emitChildData="childData" /> 9 <DetailChild :emitChildData="childData" />
  10 + <BasicTable :columns="columns" :dataSource="tableData">
  11 + <span></span>
  12 + </BasicTable>
10 </BasicDrawer> 13 </BasicDrawer>
11 </template> 14 </template>
12 <script lang="ts"> 15 <script lang="ts">
13 import { defineComponent, ref, computed, unref } from 'vue'; 16 import { defineComponent, ref, computed, unref } from 'vue';
14 import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; 17 import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
15 import DetailChild from './child/index.vue'; 18 import DetailChild from './child/index.vue';
16 - import { notifyMyGetDetailApi } from '/@/api/stationnotification/stationnotifyApi';  
17 -  
18 - // import { useMessage } from '/@/hooks/web/useMessage'; 19 + import {
  20 + notifyMyGetrReadApi,
  21 + notifyMyGetDetailApi,
  22 + } from '/@/api/stationnotification/stationnotifyApi';
  23 + import { BasicTable } from '/@/components/Table';
19 24
20 export default defineComponent({ 25 export default defineComponent({
21 name: 'ConfigDrawer', 26 name: 'ConfigDrawer',
22 - components: { BasicDrawer, DetailChild }, 27 + components: { BasicDrawer, DetailChild, BasicTable },
23 emits: ['success', 'register'], 28 emits: ['success', 'register'],
24 setup() { 29 setup() {
25 - // const { createMessage } = useMessage();  
26 const isUpdate = ref(true); 30 const isUpdate = ref(true);
27 - let childData: any = ref(null); 31 + const childData: any = ref(null);
  32 + const tableData = ref([]);
  33 + const columns: BasicColumn[] = [
  34 + {
  35 + title: '创建时间',
  36 + dataIndex: 'createTime',
  37 + },
  38 + {
  39 + title: '阅读状态',
  40 + dataIndex: 'readStatus',
  41 + format: (_text: string, record: Recordable) => {
  42 + return record.readStatus === 0 ? '草稿' : record.readStatus === 1 ? '已读' : '其他';
  43 + },
  44 + },
  45 + {
  46 + title: '阅读时间',
  47 + dataIndex: 'readDate',
  48 + },
  49 + {
  50 + title: '发送者',
  51 + dataIndex: 'senderName',
  52 + },
  53 + {
  54 + title: '类型',
  55 + dataIndex: 'type',
  56 + render: (_, data) => {
  57 + return data.type === 'NOTICE'
  58 + ? '公告'
  59 + : data.type === 'MEETING'
  60 + ? '会议'
  61 + : data.type === 'OTHER'
  62 + ? '其他'
  63 + : '';
  64 + },
  65 + },
  66 + ];
  67 + // const { createMessage } = useMessage();
28 const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { 68 const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
29 setDrawerProps({ confirmLoading: false }); 69 setDrawerProps({ confirmLoading: false });
30 isUpdate.value = !!data?.isUpdate; 70 isUpdate.value = !!data?.isUpdate;
31 - console.log(data.record);  
32 if (data.record) { 71 if (data.record) {
33 - // console.log(data.record.id);  
34 let getData = await notifyMyGetDetailApi(data.record.id); 72 let getData = await notifyMyGetDetailApi(data.record.id);
35 childData.value = getData; 73 childData.value = getData;
36 - // createMessage.success() 74 + let tableGet = await notifyMyGetrReadApi({
  75 + page: 1,
  76 + pageSize: 10,
  77 + });
  78 + tableData.value = tableGet.items;
37 } 79 }
38 //编辑 80 //编辑
39 if (unref(isUpdate)) { 81 if (unref(isUpdate)) {
@@ -47,6 +89,8 @@ @@ -47,6 +89,8 @@
47 }; 89 };
48 90
49 return { 91 return {
  92 + tableData,
  93 + columns,
50 childData, 94 childData,
51 handleCancel, 95 handleCancel,
52 getTitle, 96 getTitle,
@@ -9,88 +9,86 @@ @@ -9,88 +9,86 @@
9 <PageWrapper title="站内通知详情"> 9 <PageWrapper title="站内通知详情">
10 <Description @register="register1" class="mt-4" /> 10 <Description @register="register1" class="mt-4" />
11 </PageWrapper> 11 </PageWrapper>
12 - <BasicTable :columns="columns" :dataSource="tableData">  
13 - <span></span>  
14 - </BasicTable>  
15 </BasicDrawer> 12 </BasicDrawer>
16 </template> 13 </template>
17 <script lang="ts"> 14 <script lang="ts">
18 import { defineComponent, ref, computed, unref } from 'vue'; 15 import { defineComponent, ref, computed, unref } from 'vue';
19 import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; 16 import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
20 - import { BasicTable } from '/@/components/Table';  
21 import { Description, DescItem, useDescription } from '/@/components/Description/index'; 17 import { Description, DescItem, useDescription } from '/@/components/Description/index';
22 import { PageWrapper } from '/@/components/Page'; 18 import { PageWrapper } from '/@/components/Page';
  19 + import { noticeByIdGetInfo } from '/@/api/stationnotification/stationnotifyApi';
23 20
  21 + const schema: DescItem[] = [
  22 + {
  23 + field: 'title',
  24 + label: '标题',
  25 + },
  26 + {
  27 + field: 'content',
  28 + label: '内容',
  29 + },
  30 + {
  31 + field: 'senderName',
  32 + label: '发送者',
  33 + },
  34 + {
  35 + field: 'senderDate',
  36 + label: '发送时间',
  37 + },
  38 + {
  39 + field: 'type',
  40 + label: '类型',
  41 + render: (_, data) => {
  42 + return data.type === 'MEETING'
  43 + ? '公告'
  44 + : data.type === 'MEETING1'
  45 + ? '会议'
  46 + : data.type === 'MEETING2'
  47 + ? '其他'
  48 + : '';
  49 + },
  50 + },
  51 + {
  52 + field: 'status',
  53 + label: '状态',
  54 + },
  55 + {
  56 + field: 'updateTime',
  57 + label: '更新时间',
  58 + },
  59 + {
  60 + field: 'receiverType',
  61 + label: '接收类型',
  62 + },
  63 + {
  64 + field: 'createTime',
  65 + label: '创建时间',
  66 + },
  67 + ];
24 export default defineComponent({ 68 export default defineComponent({
25 name: 'ConfigDrawer', 69 name: 'ConfigDrawer',
26 - components: { BasicDrawer, BasicTable, Description, PageWrapper }, 70 + components: { BasicDrawer, Description, PageWrapper },
27 emits: ['success', 'register'], 71 emits: ['success', 'register'],
28 setup() { 72 setup() {
29 - let tableData = ref([]);  
30 - const schema: DescItem[] = [  
31 - {  
32 - field: 'title',  
33 - label: '标题',  
34 - },  
35 - {  
36 - field: 'content',  
37 - label: '内容',  
38 - },  
39 - {  
40 - field: 'senderName',  
41 - label: '发送者',  
42 - },  
43 - {  
44 - field: 'senderDate',  
45 - label: '发送时间',  
46 - },  
47 - {  
48 - field: 'type',  
49 - label: '类型',  
50 - render: (_, data) => {  
51 - return data.type === 'MEETING'  
52 - ? '公告'  
53 - : data.type === 'MEETING1'  
54 - ? '会议'  
55 - : data.type === 'MEETING2'  
56 - ? '其他'  
57 - : '';  
58 - },  
59 - },  
60 - ];  
61 -  
62 - const columns: BasicColumn[] = [  
63 - {  
64 - title: '接收者',  
65 - dataIndex: 'senderName',  
66 - },  
67 - {  
68 - title: '阅读状态',  
69 - dataIndex: 'status',  
70 - },  
71 - {  
72 - title: '阅读时间',  
73 - dataIndex: 'createTime',  
74 - },  
75 - ]; 73 + let descInfo = ref(null);
76 const isUpdate = ref(true); 74 const isUpdate = ref(true);
  75 +
77 const [registerDrawer, { setDrawerProps }] = useDrawerInner(async (data) => { 76 const [registerDrawer, { setDrawerProps }] = useDrawerInner(async (data) => {
78 setDrawerProps({ confirmLoading: false }); 77 setDrawerProps({ confirmLoading: false });
79 isUpdate.value = !!data?.isUpdate; 78 isUpdate.value = !!data?.isUpdate;
80 - tableData.value.push(data.record); 79 + let getDescInfo = await noticeByIdGetInfo(data.record.id);
  80 + descInfo.value = getDescInfo;
81 }); 81 });
82 const getTitle = computed(() => (!unref(isUpdate) ? '查看通知' : '查看通知')); 82 const getTitle = computed(() => (!unref(isUpdate) ? '查看通知' : '查看通知'));
83 const [register1] = useDescription({ 83 const [register1] = useDescription({
84 title: '详情', 84 title: '详情',
85 bordered: false, 85 bordered: false,
86 - data: tableData, 86 + data: descInfo,
87 schema: schema, 87 schema: schema,
88 }); 88 });
89 return { 89 return {
90 register1, 90 register1,
91 - tableData,  
92 getTitle, 91 getTitle,
93 - columns,  
94 registerDrawer, 92 registerDrawer,
95 }; 93 };
96 }, 94 },