Commit 368b665521c97a4509d45e30a77d41962e7469b5
Merge branch 'sqy_dev' into 'main'
fix:改写通知管理,优化代码,修改bug See merge request huang/yun-teng-iot-front!38
Showing
15 changed files
with
143 additions
and
295 deletions
| 1 | 1 | import { BasicPageParams } from '/@/api/model/baseModel'; |
| 2 | 2 | |
| 3 | 3 | export type NoticeQueryParam = BasicPageParams & NoticeParams; |
| 4 | - | |
| 4 | +export type NoticeUserParam = BasicPageParams & NoticeUserParams; | |
| 5 | 5 | export type NoticeParams = { |
| 6 | 6 | orderFiled?: string; |
| 7 | 7 | id?: string; |
| 8 | 8 | }; |
| 9 | 9 | |
| 10 | +export type NoticeUserParams = { | |
| 11 | + noticeId?: string; | |
| 12 | +}; | |
| 10 | 13 | export type NoticeByIdParams = { |
| 11 | 14 | id: string; |
| 12 | 15 | }; | ... | ... |
| 1 | 1 | import { defHttp } from '/@/utils/http/axios'; |
| 2 | 2 | import { |
| 3 | 3 | NoticeQueryParam, |
| 4 | + NoticeUserParam, | |
| 4 | 5 | NotifyAddDraftModel, |
| 5 | 6 | NotifyAddreLeaseModel, |
| 6 | 7 | } from '/@/api/stationnotification/model/stationnotifyModel'; |
| ... | ... | @@ -129,12 +130,10 @@ export const notifyOrganizationGetApi = () => { |
| 129 | 130 | }); |
| 130 | 131 | }; |
| 131 | 132 | |
| 132 | -export const getNotifyDetailPage = (id: string) => { | |
| 133 | - console.log(id, '-----------------'); | |
| 134 | - return (params) => { | |
| 135 | - return defHttp.get({ | |
| 136 | - url: `${NotifyManagerApi.NOTICE_GET_PAGE_URL}/${id}`, | |
| 137 | - params, | |
| 138 | - }); | |
| 139 | - }; | |
| 133 | +// 获取通知管理的查看表格数据 | |
| 134 | +export const getNotifyDetailPage = (params: NoticeUserParam) => { | |
| 135 | + return defHttp.get({ | |
| 136 | + url: NotifyManagerApi.NOTICE_GET_PAGE_URL + '/' + params.noticeId, | |
| 137 | + params, | |
| 138 | + }); | |
| 140 | 139 | }; | ... | ... |
| ... | ... | @@ -64,7 +64,10 @@ export const saveOrUpdateOrganization = (params?: OrganizationListItem, isUpdate |
| 64 | 64 | * @param ids 删除的ID |
| 65 | 65 | */ |
| 66 | 66 | export const delOrganization = (ids: string[]) => |
| 67 | - defHttp.delete({ url: Api.BaseOrganization, data: ids }); | |
| 67 | + defHttp.delete({ | |
| 68 | + url: Api.BaseOrganization, | |
| 69 | + data: ids, | |
| 70 | + }); | |
| 68 | 71 | |
| 69 | 72 | export const getMenuList = (params?: MenuParams) => |
| 70 | 73 | defHttp.get<MenuListGetResultModel>({ url: Api.MenuList, params }); | ... | ... |
src/views/stationnotification/mynotification/child/index.vue
deleted
100644 → 0
| 1 | -<template> | |
| 2 | - <div> | |
| 3 | - <PageWrapper title="我的通知详情"> | |
| 4 | - <Description @register="register1" class="mt-4" /> | |
| 5 | - </PageWrapper> | |
| 6 | - </div> | |
| 7 | -</template> | |
| 8 | -<script lang="ts"> | |
| 9 | - import { defineComponent, watch, ref } from 'vue'; | |
| 10 | - import { Description, DescItem, useDescription } from '/@/components/Description/index'; | |
| 11 | - import { PageWrapper } from '/@/components/Page'; | |
| 12 | - | |
| 13 | - const schema: DescItem[] = [ | |
| 14 | - { | |
| 15 | - field: 'creator', | |
| 16 | - label: '创建者', | |
| 17 | - }, | |
| 18 | - { | |
| 19 | - field: 'createTime', | |
| 20 | - label: '创建时间', | |
| 21 | - }, | |
| 22 | - { | |
| 23 | - field: 'title', | |
| 24 | - label: '标题', | |
| 25 | - }, | |
| 26 | - { | |
| 27 | - field: 'updateTime', | |
| 28 | - label: '更新时间', | |
| 29 | - }, | |
| 30 | - { | |
| 31 | - field: 'senderName', | |
| 32 | - label: '发送者', | |
| 33 | - }, | |
| 34 | - { | |
| 35 | - field: 'readDate', | |
| 36 | - label: '阅读时间', | |
| 37 | - }, | |
| 38 | - { | |
| 39 | - field: 'readStatus', | |
| 40 | - label: '阅读状态', | |
| 41 | - render: (_, data) => { | |
| 42 | - return data.readStatus === 0 ? '草稿' : data.readStatus === 1 ? '已读' : '其他'; | |
| 43 | - }, | |
| 44 | - }, | |
| 45 | - { | |
| 46 | - field: 'type', | |
| 47 | - label: '类型', | |
| 48 | - render: (_, data) => { | |
| 49 | - return data.type === 'NOTICE' | |
| 50 | - ? '公告' | |
| 51 | - : data.type === 'MEETING' | |
| 52 | - ? '会议' | |
| 53 | - : data.type === 'OTHER' | |
| 54 | - ? '其他' | |
| 55 | - : ''; | |
| 56 | - }, | |
| 57 | - }, | |
| 58 | - { | |
| 59 | - field: 'updater', | |
| 60 | - label: '更新者', | |
| 61 | - }, | |
| 62 | - ]; | |
| 63 | - export default defineComponent({ | |
| 64 | - components: { Description, PageWrapper }, | |
| 65 | - props: { | |
| 66 | - emitChildData: { | |
| 67 | - type: Object, | |
| 68 | - }, | |
| 69 | - }, | |
| 70 | - setup(props) { | |
| 71 | - let useDescriptionData: any = ref(null); | |
| 72 | - watch( | |
| 73 | - () => props.emitChildData, | |
| 74 | - async (newV) => { | |
| 75 | - useDescriptionData.value = newV; | |
| 76 | - } | |
| 77 | - ); | |
| 78 | - const [register1] = useDescription({ | |
| 79 | - title: '通知详情', | |
| 80 | - bordered: false, | |
| 81 | - data: useDescriptionData, | |
| 82 | - schema: schema, | |
| 83 | - }); | |
| 84 | - | |
| 85 | - return { register1 }; | |
| 86 | - }, | |
| 87 | - }); | |
| 88 | -</script> |
| 1 | 1 | import { BasicColumn, FormSchema } from '/@/components/Table'; |
| 2 | 2 | import { Tag } from 'ant-design-vue'; |
| 3 | +import { DescItem } from '/@/components/Description/index'; | |
| 4 | + | |
| 3 | 5 | import { h } from 'vue'; |
| 4 | 6 | |
| 5 | 7 | export const columns: BasicColumn[] = [ |
| ... | ... | @@ -8,7 +10,7 @@ export const columns: BasicColumn[] = [ |
| 8 | 10 | dataIndex: 'title', |
| 9 | 11 | width: 200, |
| 10 | 12 | format: (text: string, record: Recordable) => { |
| 11 | - return record.title ? record.title : '无'; | |
| 13 | + return record.sysNotice.title ?? '无'; | |
| 12 | 14 | }, |
| 13 | 15 | }, |
| 14 | 16 | { |
| ... | ... | @@ -16,11 +18,11 @@ export const columns: BasicColumn[] = [ |
| 16 | 18 | dataIndex: 'type', |
| 17 | 19 | width: 200, |
| 18 | 20 | format: (text: string, record: Recordable) => { |
| 19 | - return record.type === 'NOTICE' | |
| 21 | + return record.sysNotice.type === 'NOTICE' | |
| 20 | 22 | ? '公告' |
| 21 | - : record.type === 'MEETING' | |
| 23 | + : record.sysNotice.type === 'MEETING' | |
| 22 | 24 | ? '会议' |
| 23 | - : record.type === 'OTHER' | |
| 25 | + : record.sysNotice.type === 'OTHER' | |
| 24 | 26 | ? '其他' |
| 25 | 27 | : '无'; |
| 26 | 28 | }, |
| ... | ... | @@ -30,7 +32,7 @@ export const columns: BasicColumn[] = [ |
| 30 | 32 | dataIndex: 'senderName', |
| 31 | 33 | width: 200, |
| 32 | 34 | format: (text: string, record: Recordable) => { |
| 33 | - return record.senderName ? record.senderName : '无'; | |
| 35 | + return record.sysNotice.senderName ?? '无'; | |
| 34 | 36 | }, |
| 35 | 37 | }, |
| 36 | 38 | { |
| ... | ... | @@ -47,7 +49,7 @@ export const columns: BasicColumn[] = [ |
| 47 | 49 | const enable = status == 0 ? '未读' : status == 1 ? '已读' : '其他'; |
| 48 | 50 | const color = enable == '未读' ? 'green' : enable == '已读' ? 'yellow' : 'red'; |
| 49 | 51 | const text = enable == '未读' ? '未读' : enable == '已读' ? '已读' : '其他'; |
| 50 | - return h(Tag, { color: color }, () => text); | |
| 52 | + return h(Tag, { color }, () => text); | |
| 51 | 53 | }, |
| 52 | 54 | }, |
| 53 | 55 | ]; |
| ... | ... | @@ -76,3 +78,27 @@ export const searchFormSchema: FormSchema[] = [ |
| 76 | 78 | }, |
| 77 | 79 | }, |
| 78 | 80 | ]; |
| 81 | + | |
| 82 | +export const DescDetailSchema: DescItem[] = [ | |
| 83 | + { | |
| 84 | + field: 'sysNotice.senderName', | |
| 85 | + label: '发送者', | |
| 86 | + }, | |
| 87 | + { | |
| 88 | + field: 'sysNotice.senderDate', | |
| 89 | + label: '发送时间', | |
| 90 | + }, | |
| 91 | + { | |
| 92 | + field: 'sysNotice.type', | |
| 93 | + label: '类型', | |
| 94 | + render: (text) => { | |
| 95 | + return text === 'NOTICE' | |
| 96 | + ? '公告' | |
| 97 | + : text === 'MEETING' | |
| 98 | + ? '会议' | |
| 99 | + : text === 'OTHER' | |
| 100 | + ? '其他' | |
| 101 | + : ''; | |
| 102 | + }, | |
| 103 | + }, | |
| 104 | +]; | ... | ... |
| 1 | 1 | <template> |
| 2 | 2 | <div> |
| 3 | - <BasicTable | |
| 4 | - :rowSelection="{ type: 'checkbox' }" | |
| 5 | - @selection-change="useSelectionChange" | |
| 6 | - @register="registerTable" | |
| 7 | - > | |
| 3 | + <BasicTable @register="registerTable"> | |
| 8 | 4 | <template #action="{ record }"> |
| 9 | 5 | <TableAction |
| 10 | 6 | :actions="[ |
| 11 | 7 | { |
| 12 | 8 | label: '查看', |
| 9 | + tooltip: '查看', | |
| 13 | 10 | icon: 'clarity:note-edit-line', |
| 14 | 11 | onClick: handleView.bind(null, record), |
| 15 | 12 | }, |
| ... | ... | @@ -26,26 +23,19 @@ |
| 26 | 23 | import { useDrawer } from '/@/components/Drawer'; |
| 27 | 24 | import NotifyDetailDrawer from './useDrawer.vue'; |
| 28 | 25 | import { columns, searchFormSchema } from './config.d'; |
| 29 | - // import { useMessage } from '/@/hooks/web/useMessage'; | |
| 30 | - // ,notifyMyGetDetailApi,notifyMyGetrPageApi,notifyMyGetrReadApi | |
| 31 | 26 | import { notifyMyGetrPageApi } from '/@/api/stationnotification/stationnotifyApi'; |
| 32 | - | |
| 33 | 27 | export default defineComponent({ |
| 34 | 28 | name: 'Index', |
| 35 | 29 | components: { BasicTable, NotifyDetailDrawer, TableAction }, |
| 36 | 30 | setup() { |
| 37 | - let selectedRowKeys: Array<string> = []; | |
| 38 | 31 | const [registerDrawer, { openDrawer }] = useDrawer(); |
| 39 | - const [registerTable, { reload, getSelectRowKeys }] = useTable({ | |
| 40 | - title: '', | |
| 41 | - clickToRowSelect: false, | |
| 32 | + const [registerTable, { reload }] = useTable({ | |
| 42 | 33 | api: notifyMyGetrPageApi, |
| 43 | 34 | columns, |
| 44 | 35 | formConfig: { |
| 45 | 36 | labelWidth: 120, |
| 46 | 37 | schemas: searchFormSchema, |
| 47 | 38 | }, |
| 48 | - rowKey: 'id', | |
| 49 | 39 | useSearchForm: true, |
| 50 | 40 | showTableSetting: true, |
| 51 | 41 | bordered: true, |
| ... | ... | @@ -55,19 +45,13 @@ |
| 55 | 45 | title: '操作', |
| 56 | 46 | dataIndex: 'action', |
| 57 | 47 | slots: { customRender: 'action' }, |
| 58 | - fixed: undefined, | |
| 48 | + fixed: 'right', | |
| 59 | 49 | }, |
| 60 | 50 | }); |
| 61 | 51 | |
| 62 | - const useSelectionChange = () => { | |
| 63 | - selectedRowKeys = getSelectRowKeys(); | |
| 64 | - console.log(selectedRowKeys); | |
| 65 | - }; | |
| 66 | - | |
| 67 | 52 | function handleView(record: Recordable) { |
| 68 | 53 | openDrawer(true, { |
| 69 | 54 | record, |
| 70 | - isUpdate: true, | |
| 71 | 55 | }); |
| 72 | 56 | } |
| 73 | 57 | |
| ... | ... | @@ -75,7 +59,6 @@ |
| 75 | 59 | reload(); |
| 76 | 60 | } |
| 77 | 61 | return { |
| 78 | - useSelectionChange, | |
| 79 | 62 | registerTable, |
| 80 | 63 | registerDrawer, |
| 81 | 64 | handleView, | ... | ... |
| ... | ... | @@ -4,109 +4,53 @@ |
| 4 | 4 | v-bind="$attrs" |
| 5 | 5 | @register="registerDrawer" |
| 6 | 6 | :showFooter="false" |
| 7 | - :title="getTitle" | |
| 8 | - width="1000px" | |
| 7 | + title="通知详情" | |
| 8 | + width="70%" | |
| 9 | + @close="handleClose" | |
| 9 | 10 | > |
| 10 | - <DetailChild :emitChildData="childData" /> | |
| 11 | - <BasicTable :columns="columns" :dataSource="tableData"> | |
| 12 | - <span></span> | |
| 13 | - </BasicTable> | |
| 11 | + <div v-html="DescInfo?.content"></div> | |
| 12 | + <Description @register="registerDesc" /> | |
| 14 | 13 | </BasicDrawer> |
| 15 | 14 | </div> |
| 16 | 15 | </template> |
| 17 | 16 | <script lang="ts"> |
| 18 | - import { defineComponent, ref, computed, unref } from 'vue'; | |
| 17 | + import { defineComponent, ref } from 'vue'; | |
| 19 | 18 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
| 20 | - import DetailChild from './child/index.vue'; | |
| 19 | + import { Description, useDescription } from '/@/components/Description/index'; | |
| 20 | + import { DescDetailSchema } from './config.d'; | |
| 21 | 21 | import { |
| 22 | + noticeByIdGetInfo, | |
| 22 | 23 | notifyMyGetrReadApi, |
| 23 | 24 | notifyMyGetDetailApi, |
| 24 | 25 | } from '/@/api/stationnotification/stationnotifyApi'; |
| 25 | - import { BasicTable } from '/@/components/Table'; | |
| 26 | - import { BasicColumn } from '/@/components/Table/src/types/table'; | |
| 27 | - | |
| 28 | 26 | export default defineComponent({ |
| 29 | - name: 'ConfigDrawer', | |
| 30 | - components: { BasicDrawer, DetailChild, BasicTable }, | |
| 27 | + name: 'MyNoticeDrawer', | |
| 28 | + components: { BasicDrawer, Description }, | |
| 31 | 29 | emits: ['success', 'register'], |
| 32 | - setup() { | |
| 33 | - const isUpdate = ref(true); | |
| 34 | - const childData: any = ref(null); | |
| 35 | - const tableData = ref([]); | |
| 36 | - const columns: BasicColumn[] = [ | |
| 37 | - { | |
| 38 | - title: '创建时间', | |
| 39 | - dataIndex: 'createTime', | |
| 40 | - }, | |
| 41 | - { | |
| 42 | - title: '阅读状态', | |
| 43 | - dataIndex: 'readStatus', | |
| 44 | - format: (_text: string, record: Recordable) => { | |
| 45 | - return record.readStatus === '0' ? '草稿' : record.readStatus === '1' ? '已读' : '其他'; | |
| 46 | - }, | |
| 47 | - }, | |
| 48 | - { | |
| 49 | - title: '阅读时间', | |
| 50 | - dataIndex: 'readDate', | |
| 51 | - }, | |
| 52 | - { | |
| 53 | - title: '发送者', | |
| 54 | - dataIndex: 'senderName', | |
| 55 | - format: (_text: string, record: Recordable) => { | |
| 56 | - return record.sysNoticeDTO.senderName; | |
| 57 | - }, | |
| 58 | - }, | |
| 59 | - { | |
| 60 | - title: '发送时间', | |
| 61 | - dataIndex: 'senderDate', | |
| 62 | - format: (_text: string, record: Recordable) => { | |
| 63 | - return record.sysNoticeDTO.senderDate; | |
| 64 | - }, | |
| 65 | - }, | |
| 66 | - { | |
| 67 | - title: '类型', | |
| 68 | - dataIndex: 'type', | |
| 69 | - format: (_text: string, record: Recordable) => { | |
| 70 | - return record.sysNoticeDTO.type === 'NOTICE' | |
| 71 | - ? '公告' | |
| 72 | - : record.sysNoticeDTO.type === 'MEETING' | |
| 73 | - ? '会议' | |
| 74 | - : record.sysNoticeDTO.type === 'OTHER' | |
| 75 | - ? '其他' | |
| 76 | - : '无'; | |
| 77 | - }, | |
| 78 | - }, | |
| 79 | - ]; | |
| 80 | - const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { | |
| 81 | - setDrawerProps({ confirmLoading: false }); | |
| 82 | - isUpdate.value = !!data?.isUpdate; | |
| 83 | - if (data.record) { | |
| 84 | - let getData = await notifyMyGetDetailApi(data.record.id); | |
| 85 | - childData.value = getData; | |
| 86 | - let tableGet = await notifyMyGetrReadApi({ | |
| 87 | - page: 1, | |
| 88 | - pageSize: 10, | |
| 89 | - }); | |
| 90 | - tableData.value = tableGet.items; | |
| 91 | - } | |
| 92 | - //编辑 | |
| 93 | - if (unref(isUpdate)) { | |
| 94 | - } else { | |
| 95 | - } | |
| 30 | + setup(_, { emit }) { | |
| 31 | + const dataSource = ref(); | |
| 32 | + let DescInfo = ref(); | |
| 33 | + const [registerDrawer] = useDrawerInner(async (data) => { | |
| 34 | + dataSource.value = data.record; | |
| 35 | + const id = data.record.noticeId; | |
| 36 | + let getDescInfo = await noticeByIdGetInfo(id); | |
| 37 | + DescInfo.value = getDescInfo; | |
| 96 | 38 | }); |
| 97 | - | |
| 98 | - const getTitle = computed(() => (!unref(isUpdate) ? '新增通知' : '查看通知')); | |
| 99 | - const handleCancel = () => { | |
| 100 | - closeDrawer(); | |
| 39 | + const [registerDesc] = useDescription({ | |
| 40 | + bordered: false, | |
| 41 | + schema: DescDetailSchema, | |
| 42 | + data: dataSource, | |
| 43 | + }); | |
| 44 | + const handleClose = async () => { | |
| 45 | + console.log(dataSource.value); | |
| 46 | + await notifyMyGetDetailApi(dataSource.value.id); | |
| 47 | + emit('success'); | |
| 101 | 48 | }; |
| 102 | - | |
| 103 | 49 | return { |
| 104 | - tableData, | |
| 105 | - columns, | |
| 106 | - childData, | |
| 107 | - handleCancel, | |
| 108 | - getTitle, | |
| 50 | + DescInfo, | |
| 51 | + registerDesc, | |
| 109 | 52 | registerDrawer, |
| 53 | + handleClose, | |
| 110 | 54 | }; |
| 111 | 55 | }, |
| 112 | 56 | }); | ... | ... |
| ... | ... | @@ -118,27 +118,10 @@ export const formSchema: FormSchema[] = [ |
| 118 | 118 | }, |
| 119 | 119 | }, |
| 120 | 120 | { |
| 121 | - field: 'organizationId', | |
| 122 | - label: '所属组织', | |
| 123 | - colProps: { span: 12 }, | |
| 124 | - component: 'ApiTreeSelect', | |
| 125 | - componentProps: { | |
| 126 | - api: async () => { | |
| 127 | - const data = await getOrganizationList(); | |
| 128 | - copyTransFun(data as any as any[]); | |
| 129 | - return data; | |
| 130 | - }, | |
| 131 | - onChange: (v) => { | |
| 132 | - isDeptId.value = v; | |
| 133 | - }, | |
| 134 | - }, | |
| 135 | - ifShow: ({ values }) => isOrg(Reflect.get(values, 'receiverType')), | |
| 136 | - }, | |
| 137 | - { | |
| 138 | 121 | field: 'receiverType', |
| 139 | 122 | required: true, |
| 140 | 123 | label: '接收者', |
| 141 | - colProps: { span: 24 }, | |
| 124 | + colProps: { span: 13 }, | |
| 142 | 125 | component: 'Select', |
| 143 | 126 | componentProps: { |
| 144 | 127 | placeholder: '接收者', |
| ... | ... | @@ -159,35 +142,26 @@ export const formSchema: FormSchema[] = [ |
| 159 | 142 | } |
| 160 | 143 | }, |
| 161 | 144 | }, |
| 162 | - // componentProps: { | |
| 163 | - // api: findDictItemByCode, | |
| 164 | - // params: { | |
| 165 | - // dictCode: 'receiver_type', | |
| 166 | - // }, | |
| 167 | - // labelField: 'itemText', | |
| 168 | - // valueField: 'itemValue', | |
| 169 | - // onChange: (v) => { | |
| 170 | - // switch (v) { | |
| 171 | - // case '0': | |
| 172 | - // selectWhere.value = v; | |
| 173 | - // break; | |
| 174 | - // case '1': | |
| 175 | - // selectWhere.value = v; | |
| 176 | - // break; | |
| 177 | - // case '2': | |
| 178 | - // selectWhere.value = v; | |
| 179 | - // break; | |
| 180 | - // case '3': | |
| 181 | - // selectWhere.value = v; | |
| 182 | - // break; | |
| 183 | - // default: | |
| 184 | - // selectWhere.value = v; | |
| 185 | - // } | |
| 186 | - // }, | |
| 187 | - // }, | |
| 188 | 145 | }, |
| 189 | 146 | { |
| 190 | - field: '', | |
| 147 | + field: 'organizationId', | |
| 148 | + label: '所属组织', | |
| 149 | + colProps: { span: 13 }, | |
| 150 | + component: 'ApiTreeSelect', | |
| 151 | + componentProps: { | |
| 152 | + api: async () => { | |
| 153 | + const data = await getOrganizationList(); | |
| 154 | + copyTransFun(data as any as any[]); | |
| 155 | + return data; | |
| 156 | + }, | |
| 157 | + onChange: (v) => { | |
| 158 | + isDeptId.value = v; | |
| 159 | + }, | |
| 160 | + }, | |
| 161 | + ifShow: ({ values }) => isOrg(Reflect.get(values, 'receiverType')), | |
| 162 | + }, | |
| 163 | + { | |
| 164 | + field: 'abc', | |
| 191 | 165 | component: 'Input', |
| 192 | 166 | label: '', |
| 193 | 167 | colProps: { |
| ... | ... | @@ -224,17 +198,18 @@ export const searchFormSchema: FormSchema[] = [ |
| 224 | 198 | export const detailColumns: BasicColumn[] = [ |
| 225 | 199 | { |
| 226 | 200 | title: '接收者', |
| 227 | - dataIndex: 'title2', | |
| 201 | + dataIndex: 'user.realName', | |
| 228 | 202 | width: 200, |
| 229 | 203 | }, |
| 230 | 204 | { |
| 231 | 205 | title: '阅读状态', |
| 232 | - dataIndex: 'title3', | |
| 206 | + dataIndex: 'readStatus', | |
| 233 | 207 | width: 200, |
| 208 | + slots: { customRender: 'readStatus' }, | |
| 234 | 209 | }, |
| 235 | 210 | { |
| 236 | 211 | title: '阅读时间', |
| 237 | - dataIndex: 'title1', | |
| 212 | + dataIndex: 'readDate', | |
| 238 | 213 | width: 200, |
| 239 | 214 | }, |
| 240 | 215 | ]; | ... | ... |
| ... | ... | @@ -17,7 +17,7 @@ |
| 17 | 17 | icon: 'clarity:note-edit-line', |
| 18 | 18 | onClick: handleView.bind(null, record), |
| 19 | 19 | ifShow: (_action) => { |
| 20 | - return record.status == '已发布'; | |
| 20 | + return record.status === '已发布'; | |
| 21 | 21 | }, |
| 22 | 22 | }, |
| 23 | 23 | { |
| ... | ... | @@ -25,7 +25,7 @@ |
| 25 | 25 | icon: 'clarity:note-edit-line', |
| 26 | 26 | onClick: handleEdit.bind(null, record), |
| 27 | 27 | ifShow: (_action) => { |
| 28 | - return record.status == '草稿'; | |
| 28 | + return record.status === '草稿'; | |
| 29 | 29 | }, |
| 30 | 30 | }, |
| 31 | 31 | { |
| ... | ... | @@ -46,7 +46,7 @@ |
| 46 | 46 | </div> |
| 47 | 47 | </template> |
| 48 | 48 | <script lang="ts"> |
| 49 | - import { defineComponent, reactive, ref } from 'vue'; | |
| 49 | + import { defineComponent, reactive } from 'vue'; | |
| 50 | 50 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| 51 | 51 | import { useDrawer } from '/@/components/Drawer'; |
| 52 | 52 | import NotifyManagerDrawer from './useDrawer.vue'; |
| ... | ... | @@ -59,13 +59,12 @@ |
| 59 | 59 | name: 'Index', |
| 60 | 60 | components: { BasicTable, NotifyManagerDrawer, TableAction, tableViewChild }, |
| 61 | 61 | setup() { |
| 62 | - let selectedRowKeys: string[] = reactive([]); | |
| 62 | + let selectedRowKeys = reactive<string[]>([]); | |
| 63 | 63 | |
| 64 | - const [registerAdd, { openDrawer: openDrawerAdd }] = useDrawer(); | |
| 65 | 64 | const [registerDrawer, { openDrawer }] = useDrawer(); |
| 65 | + const [registerAdd, { openDrawer: openDrawerAdd }] = useDrawer(); | |
| 66 | 66 | const { createMessage } = useMessage(); |
| 67 | 67 | const [registerTable, { reload, getSelectRowKeys }] = useTable({ |
| 68 | - title: '', | |
| 69 | 68 | clickToRowSelect: false, |
| 70 | 69 | api: notifyGetTableApi, |
| 71 | 70 | columns, |
| ... | ... | @@ -83,7 +82,7 @@ |
| 83 | 82 | title: '操作', |
| 84 | 83 | dataIndex: 'action', |
| 85 | 84 | slots: { customRender: 'action' }, |
| 86 | - fixed: undefined, | |
| 85 | + fixed: 'right', | |
| 87 | 86 | }, |
| 88 | 87 | }); |
| 89 | 88 | |
| ... | ... | @@ -105,7 +104,6 @@ |
| 105 | 104 | const handleView = (record: Recordable) => { |
| 106 | 105 | openDrawer(true, { |
| 107 | 106 | record, |
| 108 | - isUpdate: true, | |
| 109 | 107 | }); |
| 110 | 108 | }; |
| 111 | 109 | function handleEdit(record: Recordable) { | ... | ... |
| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | notifyAddLeaseApi, |
| 33 | 33 | } from '/@/api/stationnotification/stationnotifyApi'; |
| 34 | 34 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 35 | - // import { getOrganizationList } from '/@/api/system/system'; | |
| 36 | - | |
| 37 | 35 | export default defineComponent({ |
| 38 | 36 | name: 'ConfigDrawer', |
| 39 | 37 | components: { BasicDrawer, BasicForm, Button }, |
| ... | ... | @@ -60,7 +58,6 @@ |
| 60 | 58 | isUpdate.value = !!data?.isUpdate; |
| 61 | 59 | //编辑 |
| 62 | 60 | if (unref(isUpdate)) { |
| 63 | - console.log(data.record); | |
| 64 | 61 | getId.value = data.record.id; |
| 65 | 62 | await setFieldsValue({ |
| 66 | 63 | ...data.record, |
| ... | ... | @@ -115,7 +112,7 @@ |
| 115 | 112 | getAllEditData.pointId = pointArray.value; |
| 116 | 113 | Object.assign(postAllEditData, getAllEditData); |
| 117 | 114 | await notifyAddLeaseApi(postAllEditData); |
| 118 | - createMessage.success('编辑成功'); | |
| 115 | + createMessage.success('新增成功'); | |
| 119 | 116 | closeDrawer(); |
| 120 | 117 | emit('success'); |
| 121 | 118 | } |
| ... | ... | @@ -156,7 +153,7 @@ |
| 156 | 153 | } |
| 157 | 154 | getAllEditData.pointId = pointArray.value; |
| 158 | 155 | Object.assign(postAllEditData, getAllEditData); |
| 159 | - await notifyAddLeaseApi(postAllEditData); | |
| 156 | + await notifyAddDraftApi(postAllEditData); | |
| 160 | 157 | createMessage.success('编辑成功'); |
| 161 | 158 | closeDrawer(); |
| 162 | 159 | emit('success'); | ... | ... |
| ... | ... | @@ -10,8 +10,13 @@ |
| 10 | 10 | > |
| 11 | 11 | <div v-html="descInfo?.content"></div> |
| 12 | 12 | <Description @register="registerDesc" class="mt-4" /> |
| 13 | - | |
| 14 | - <BasicTable @register="registerTable" /> | |
| 13 | + <BasicTable @register="registerTable" class="mt-4"> | |
| 14 | + <template #readStatus="{ record }"> | |
| 15 | + <Tag :color="record.readStatus === '0' ? 'orange' : 'green'"> | |
| 16 | + {{ record.readStatus === '0' ? '未读' : '已读' }} | |
| 17 | + </Tag> | |
| 18 | + </template> | |
| 19 | + </BasicTable> | |
| 15 | 20 | </BasicDrawer> |
| 16 | 21 | </div> |
| 17 | 22 | </template> |
| ... | ... | @@ -25,6 +30,7 @@ |
| 25 | 30 | } from '/@/api/stationnotification/stationnotifyApi'; |
| 26 | 31 | import { useTable, BasicTable } from '/@/components/Table'; |
| 27 | 32 | import { detailColumns } from './config.d'; |
| 33 | + import { Tag } from 'ant-design-vue'; | |
| 28 | 34 | const schema: DescItem[] = [ |
| 29 | 35 | { |
| 30 | 36 | field: 'senderName', |
| ... | ... | @@ -50,38 +56,40 @@ |
| 50 | 56 | ]; |
| 51 | 57 | export default defineComponent({ |
| 52 | 58 | name: 'ConfigDrawer', |
| 53 | - components: { BasicDrawer, Description, BasicTable }, | |
| 59 | + components: { BasicDrawer, Description, BasicTable, Tag }, | |
| 54 | 60 | emits: ['success', 'register'], |
| 55 | 61 | setup() { |
| 56 | 62 | let descInfo = ref(); |
| 57 | - const noticeId = ref(''); | |
| 63 | + let noticeId; | |
| 58 | 64 | const [registerDrawer] = useDrawerInner(async (data) => { |
| 59 | - if (data.isUpdate) { | |
| 60 | - let getDescInfo = await noticeByIdGetInfo(data.record.id); | |
| 61 | - noticeId.value = data.record.id; | |
| 62 | - descInfo.value = getDescInfo; | |
| 63 | - console.log(noticeId); | |
| 64 | - } | |
| 65 | + let getDescInfo = await noticeByIdGetInfo(data.record.id); | |
| 66 | + noticeId = data.record.id; | |
| 67 | + descInfo.value = getDescInfo; | |
| 68 | + reload(); | |
| 69 | + }); | |
| 70 | + const [registerTable, { reload }] = useTable({ | |
| 71 | + api: getNotifyDetailPage, | |
| 72 | + columns: detailColumns, | |
| 73 | + bordered: true, | |
| 74 | + showTableSetting: false, | |
| 75 | + showIndexColumn: false, | |
| 76 | + immediate: false, | |
| 77 | + beforeFetch: getNoticeId, | |
| 65 | 78 | }); |
| 79 | + function getNoticeId(data) { | |
| 80 | + Reflect.set(data, 'noticeId', noticeId); | |
| 81 | + } | |
| 66 | 82 | |
| 67 | 83 | const [registerDesc] = useDescription({ |
| 68 | 84 | bordered: true, |
| 69 | 85 | data: descInfo, |
| 70 | - schema: schema, | |
| 71 | - }); | |
| 72 | - const [registerTable] = useTable({ | |
| 73 | - api: getNotifyDetailPage(noticeId.value), | |
| 74 | - columns: detailColumns, | |
| 75 | - showTableSetting: false, | |
| 76 | - bordered: true, | |
| 77 | - showIndexColumn: false, | |
| 86 | + schema, | |
| 78 | 87 | }); |
| 79 | 88 | return { |
| 80 | 89 | descInfo, |
| 81 | 90 | registerDesc, |
| 82 | 91 | registerTable, |
| 83 | 92 | registerDrawer, |
| 84 | - noticeId, | |
| 85 | 93 | }; |
| 86 | 94 | }, |
| 87 | 95 | }); | ... | ... |