Showing
8 changed files
with
339 additions
and
61 deletions
| ... | ... | @@ -18,6 +18,8 @@ enum NotifyManagerApi { |
| 18 | 18 | NOTICE_GET_MYDETAIL_URL = '/noticeUser', |
| 19 | 19 | NOTICE_GET_PAGE_URL = '/noticeUser/page', |
| 20 | 20 | NOTICE_GET_READ_URL = '/noticeUser/read', |
| 21 | + NOTICE_GET_DICT_URL = '/dictItem', | |
| 22 | + NOTICE_GET_DEPT_URL = '/organization/me/organizations', | |
| 21 | 23 | } |
| 22 | 24 | |
| 23 | 25 | // /** |
| ... | ... | @@ -105,3 +107,23 @@ export const notifyMyGetrReadApi = (params?: NoticeQueryParam) => { |
| 105 | 107 | params, |
| 106 | 108 | }); |
| 107 | 109 | }; |
| 110 | + | |
| 111 | +/** | |
| 112 | + * 获取字典----id | |
| 113 | + * @param 无参数 | |
| 114 | + */ | |
| 115 | +export const notifyDictGetApi = () => { | |
| 116 | + return defHttp.get({ | |
| 117 | + url: `${NotifyManagerApi.NOTICE_GET_DICT_URL}?page=1&pageSize=10&dictId=74a3878d-1bb9-4a59-bd2d-d5e4646c7239&_t=1638928298910`, | |
| 118 | + }); | |
| 119 | +}; | |
| 120 | + | |
| 121 | +/** | |
| 122 | + * 获取部门 | |
| 123 | + * @param 无参数 | |
| 124 | + */ | |
| 125 | +export const notifyOrganizationGetApi = () => { | |
| 126 | + return defHttp.get({ | |
| 127 | + url: NotifyManagerApi.NOTICE_GET_DEPT_URL, | |
| 128 | + }); | |
| 129 | +}; | ... | ... |
| 1 | 1 | export enum RoleEnum { |
| 2 | - ROLE_SYS_ADMIN = 'ROLE_SYS_ADMIN', | |
| 3 | - ROLE_TENANT_ADMIN = 'ROLE_TENANT_ADMIN', | |
| 4 | - ROLE_NORMAL_USER = 'ROLE_NORMAL_USER', | |
| 5 | - ROLE_PLATFORM_ADMIN = 'ROLE_PLATFORM_ADMIN', | |
| 2 | + ROLE_SYS_ADMIN = 'SYS_ADMIN', | |
| 3 | + ROLE_TENANT_ADMIN = 'TENANT_ADMIN', | |
| 4 | + ROLE_NORMAL_USER = 'CUSTOMER_USER', | |
| 5 | + ROLE_PLATFORM_ADMIN = 'PLATFORM_ADMIN', | |
| 6 | 6 | } | ... | ... |
| ... | ... | @@ -5,6 +5,9 @@ export const columns: BasicColumn[] = [ |
| 5 | 5 | title: '标题', |
| 6 | 6 | dataIndex: 'title', |
| 7 | 7 | width: 200, |
| 8 | + format: (text: string, record: Recordable) => { | |
| 9 | + return record.title ? record.title : '无'; | |
| 10 | + }, | |
| 8 | 11 | }, |
| 9 | 12 | { |
| 10 | 13 | title: '类型', |
| ... | ... | @@ -22,12 +25,15 @@ export const columns: BasicColumn[] = [ |
| 22 | 25 | }, |
| 23 | 26 | { |
| 24 | 27 | title: '发送者', |
| 25 | - dataIndex: 'receiverId', | |
| 28 | + dataIndex: 'senderName', | |
| 26 | 29 | width: 200, |
| 30 | + format: (text: string, record: Recordable) => { | |
| 31 | + return record.senderName ? record.senderName : '无'; | |
| 32 | + }, | |
| 27 | 33 | }, |
| 28 | 34 | { |
| 29 | 35 | title: '发送时间', |
| 30 | - dataIndex: 'readDate', | |
| 36 | + dataIndex: 'createTime', | |
| 31 | 37 | width: 200, |
| 32 | 38 | }, |
| 33 | 39 | { |
| ... | ... | @@ -51,13 +57,22 @@ export const searchFormSchema: FormSchema[] = [ |
| 51 | 57 | field: 'orderField', |
| 52 | 58 | label: '', |
| 53 | 59 | colProps: { span: 8 }, |
| 54 | - component: 'ApiTreeSelect', | |
| 60 | + component: 'Select', | |
| 55 | 61 | componentProps: { |
| 56 | - // api: async () => { | |
| 57 | - // const data = await screenLinkOrganizationGetApi(); | |
| 58 | - // copyTransFun(data as any as any[]); | |
| 59 | - // return data; | |
| 60 | - // }, | |
| 62 | + options: [ | |
| 63 | + { | |
| 64 | + label: '公告', | |
| 65 | + value: 'NOTICE', | |
| 66 | + }, | |
| 67 | + { | |
| 68 | + label: '会议', | |
| 69 | + value: 'MEETING', | |
| 70 | + }, | |
| 71 | + { | |
| 72 | + label: '其他', | |
| 73 | + value: 'OTHER', | |
| 74 | + }, | |
| 75 | + ], | |
| 61 | 76 | }, |
| 62 | 77 | }, |
| 63 | 78 | ]; | ... | ... |
| 1 | 1 | import { BasicColumn, FormSchema } from '/@/components/Table'; |
| 2 | 2 | import { Tinymce } from '/@/components/Tinymce/index'; |
| 3 | -import { h } from 'vue'; | |
| 3 | +import { h, ref } from 'vue'; | |
| 4 | +import { findDictItemByCode } from '/@/api/system/dict'; | |
| 5 | +import { getOrganizationList } from '/@/api/system/system'; | |
| 6 | +import { copyTransFun } from '/@/utils/fnUtils'; | |
| 7 | + | |
| 8 | +export const selectAll = ref(null); | |
| 9 | +export const selectOrg = ref(null); | |
| 10 | +export const selectDep = ref(null); | |
| 11 | +export const selectPer = ref(null); | |
| 12 | +export const isDeptId = ref(null); | |
| 4 | 13 | |
| 5 | 14 | export const columns: BasicColumn[] = [ |
| 6 | 15 | { |
| 7 | 16 | title: '类型', |
| 8 | 17 | dataIndex: 'type', |
| 9 | 18 | width: 200, |
| 10 | - format: (text: string, record: Recordable) => { | |
| 11 | - return record.type === 'MEETING' | |
| 19 | + format: (_text: string, record: Recordable) => { | |
| 20 | + return record.type === 'NOTICE' | |
| 12 | 21 | ? '公告' |
| 13 | - : record.type === 'MEETING1' | |
| 22 | + : record.type === 'MEETING' | |
| 14 | 23 | ? '会议' |
| 15 | - : record.type === 'MEETING2' | |
| 24 | + : record.type === 'OTHER' | |
| 16 | 25 | ? '其他' |
| 17 | 26 | : ''; |
| 18 | 27 | }, |
| ... | ... | @@ -26,24 +35,24 @@ export const columns: BasicColumn[] = [ |
| 26 | 35 | title: '内容', |
| 27 | 36 | dataIndex: 'content', |
| 28 | 37 | width: 120, |
| 38 | + format: (text: string, record: Recordable) => { | |
| 39 | + return !record.content ? '' : record.content.slice(3, record.content.length - 4); | |
| 40 | + }, | |
| 29 | 41 | }, |
| 30 | 42 | { |
| 31 | 43 | title: '发送者', |
| 32 | 44 | dataIndex: 'senderName', |
| 33 | 45 | width: 200, |
| 46 | + format: (text: string, record: Recordable) => { | |
| 47 | + return record.senderName ? record.senderName : '无'; | |
| 48 | + }, | |
| 34 | 49 | }, |
| 35 | 50 | { |
| 36 | 51 | title: '状态', |
| 37 | 52 | dataIndex: 'status', |
| 38 | 53 | width: 200, |
| 39 | - format: (text: string, record: Recordable) => { | |
| 40 | - return record.status == 0 | |
| 41 | - ? '草稿' | |
| 42 | - : record.type == 1 | |
| 43 | - ? '已发' | |
| 44 | - : record.type == 2 | |
| 45 | - ? '其他' | |
| 46 | - : '其他'; | |
| 54 | + format: (_text: string, record: Recordable) => { | |
| 55 | + return record.status; | |
| 47 | 56 | }, |
| 48 | 57 | }, |
| 49 | 58 | ]; |
| ... | ... | @@ -59,15 +68,15 @@ export const formSchema: FormSchema[] = [ |
| 59 | 68 | options: [ |
| 60 | 69 | { |
| 61 | 70 | label: '公告', |
| 62 | - value: '1', | |
| 71 | + value: 'NOTICE', | |
| 63 | 72 | }, |
| 64 | 73 | { |
| 65 | 74 | label: '会议', |
| 66 | - value: '2', | |
| 75 | + value: 'MEETING', | |
| 67 | 76 | }, |
| 68 | 77 | { |
| 69 | 78 | label: '其他', |
| 70 | - value: '3', | |
| 79 | + value: 'OTHER', | |
| 71 | 80 | }, |
| 72 | 81 | ], |
| 73 | 82 | }, |
| ... | ... | @@ -87,7 +96,7 @@ export const formSchema: FormSchema[] = [ |
| 87 | 96 | component: 'Input', |
| 88 | 97 | colProps: { span: 24 }, |
| 89 | 98 | label: '内容', |
| 90 | - defaultValue: '请输入内容', | |
| 99 | + defaultValue: '', | |
| 91 | 100 | rules: [{ required: true }], |
| 92 | 101 | render: ({ model, field }) => { |
| 93 | 102 | return h(Tinymce, { |
| ... | ... | @@ -99,21 +108,46 @@ export const formSchema: FormSchema[] = [ |
| 99 | 108 | }, |
| 100 | 109 | }, |
| 101 | 110 | { |
| 102 | - field: 'receiverTypeIds', | |
| 111 | + field: 'organizationId', | |
| 112 | + label: '所属组织', | |
| 113 | + colProps: { span: 12 }, | |
| 114 | + component: 'ApiTreeSelect', | |
| 115 | + componentProps: { | |
| 116 | + api: async () => { | |
| 117 | + const data = await getOrganizationList(); | |
| 118 | + copyTransFun(data as any as any[]); | |
| 119 | + return data; | |
| 120 | + }, | |
| 121 | + onChange: (v) => { | |
| 122 | + isDeptId.value = v; | |
| 123 | + console.log(isDeptId.value); | |
| 124 | + }, | |
| 125 | + }, | |
| 126 | + }, | |
| 127 | + { | |
| 128 | + field: 'receiverType', | |
| 129 | + required: true, | |
| 103 | 130 | label: '接收者', |
| 104 | 131 | colProps: { span: 24 }, |
| 105 | - component: 'RadioGroup', | |
| 132 | + component: 'ApiSelect', | |
| 106 | 133 | componentProps: { |
| 107 | - options: [ | |
| 108 | - { | |
| 109 | - label: '全部', | |
| 110 | - value: '1', | |
| 111 | - }, | |
| 112 | - { | |
| 113 | - label: '部门', | |
| 114 | - value: '2', | |
| 115 | - }, | |
| 116 | - ], | |
| 134 | + api: findDictItemByCode, | |
| 135 | + params: { | |
| 136 | + dictCode: 'receiver_type', | |
| 137 | + }, | |
| 138 | + labelField: 'itemText', | |
| 139 | + valueField: 'itemValue', | |
| 140 | + onChange: (v) => { | |
| 141 | + if (v == 0) { | |
| 142 | + selectAll.value = 0; | |
| 143 | + } else if (v == 1) { | |
| 144 | + selectOrg.value = 1; | |
| 145 | + } else if (v == 2) { | |
| 146 | + selectDep.value = 2; | |
| 147 | + } else if (v == 3) { | |
| 148 | + selectPer.value = 3; | |
| 149 | + } | |
| 150 | + }, | |
| 117 | 151 | }, |
| 118 | 152 | }, |
| 119 | 153 | { |
| ... | ... | @@ -132,13 +166,22 @@ export const searchFormSchema: FormSchema[] = [ |
| 132 | 166 | field: 'orderField', |
| 133 | 167 | label: '', |
| 134 | 168 | colProps: { span: 8 }, |
| 135 | - component: 'ApiSelect', | |
| 169 | + component: 'Select', | |
| 136 | 170 | componentProps: { |
| 137 | - // api: async () => { | |
| 138 | - // const data = await screenLinkOrganizationGetApi(); | |
| 139 | - // copyTransFun(data as any as any[]); | |
| 140 | - // return data; | |
| 141 | - // }, | |
| 171 | + options: [ | |
| 172 | + { | |
| 173 | + label: '公告', | |
| 174 | + value: 'NOTICE', | |
| 175 | + }, | |
| 176 | + { | |
| 177 | + label: '会议', | |
| 178 | + value: 'MEETING', | |
| 179 | + }, | |
| 180 | + { | |
| 181 | + label: '其他', | |
| 182 | + value: 'OTHER', | |
| 183 | + }, | |
| 184 | + ], | |
| 142 | 185 | }, |
| 143 | 186 | }, |
| 144 | 187 | ]; | ... | ... |
| ... | ... | @@ -13,9 +13,20 @@ |
| 13 | 13 | <TableAction |
| 14 | 14 | :actions="[ |
| 15 | 15 | { |
| 16 | + label: '查看', | |
| 17 | + icon: 'clarity:note-edit-line', | |
| 18 | + onClick: handleView.bind(null, record), | |
| 19 | + // ifShow: (_action) => { | |
| 20 | + // return record.status == '已发布'; | |
| 21 | + // }, | |
| 22 | + }, | |
| 23 | + { | |
| 16 | 24 | label: '编辑', |
| 17 | 25 | icon: 'clarity:note-edit-line', |
| 18 | 26 | onClick: handleEdit.bind(null, record), |
| 27 | + // ifShow: (_action) => { | |
| 28 | + // return record.status == '草稿'; | |
| 29 | + // }, | |
| 19 | 30 | }, |
| 20 | 31 | { |
| 21 | 32 | label: '删除', |
| ... | ... | @@ -31,25 +42,29 @@ |
| 31 | 42 | </template> |
| 32 | 43 | </BasicTable> |
| 33 | 44 | <NotifyManagerDrawer |
| 45 | + v-if="isJudgeStatus" | |
| 34 | 46 | :getChildrenData="echoEditData" |
| 35 | 47 | @register="registerDrawer" |
| 36 | 48 | @success="handleSuccess" |
| 37 | 49 | /> |
| 50 | + <tableViewChild v-if="!isJudgeStatus" @register="registerDrawer" /> | |
| 38 | 51 | </div> |
| 39 | 52 | </template> |
| 40 | 53 | <script lang="ts"> |
| 41 | - import { defineComponent, reactive } from 'vue'; | |
| 54 | + import { defineComponent, reactive, ref } from 'vue'; | |
| 42 | 55 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| 43 | 56 | import { useDrawer } from '/@/components/Drawer'; |
| 44 | 57 | import NotifyManagerDrawer from './useDrawer.vue'; |
| 58 | + import tableViewChild from './viewDetailDrawer.vue'; | |
| 45 | 59 | import { columns, searchFormSchema } from './config.d'; |
| 46 | 60 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 47 | 61 | import { notifyGetTableApi, notifyDeleteApi } from '/@/api/stationnotification/stationnotifyApi'; |
| 48 | 62 | |
| 49 | 63 | export default defineComponent({ |
| 50 | 64 | name: 'index', |
| 51 | - components: { BasicTable, NotifyManagerDrawer, TableAction }, | |
| 65 | + components: { BasicTable, NotifyManagerDrawer, TableAction, tableViewChild }, | |
| 52 | 66 | setup() { |
| 67 | + let isJudgeStatus = ref(true); | |
| 53 | 68 | let selectedRowKeys: Array<string> = []; |
| 54 | 69 | let echoEditData = reactive({}); |
| 55 | 70 | const [registerDrawer, { openDrawer }] = useDrawer(); |
| ... | ... | @@ -81,6 +96,7 @@ |
| 81 | 96 | openDrawer(true, { |
| 82 | 97 | isUpdate: false, |
| 83 | 98 | }); |
| 99 | + isJudgeStatus.value = true; | |
| 84 | 100 | } |
| 85 | 101 | |
| 86 | 102 | const useSelectionChange = () => { |
| ... | ... | @@ -93,16 +109,22 @@ |
| 93 | 109 | createMessage.success('删除成功'); |
| 94 | 110 | reload(); |
| 95 | 111 | } |
| 96 | - | |
| 112 | + const handleView = (record: Recordable) => { | |
| 113 | + openDrawer(true, { | |
| 114 | + record, | |
| 115 | + isUpdate: true, | |
| 116 | + }); | |
| 117 | + isJudgeStatus.value = false; | |
| 118 | + }; | |
| 97 | 119 | function handleEdit(record: Recordable) { |
| 98 | 120 | openDrawer(true, { |
| 99 | 121 | record, |
| 100 | 122 | isUpdate: true, |
| 101 | 123 | }); |
| 124 | + isJudgeStatus.value = true; | |
| 102 | 125 | } |
| 103 | 126 | async function handleDelete(record: Recordable) { |
| 104 | - console.log(record.id); | |
| 105 | - let ids = '1'; | |
| 127 | + let ids = record.id; | |
| 106 | 128 | await notifyDeleteApi(ids); |
| 107 | 129 | createMessage.success('删除成功'); |
| 108 | 130 | reload(); |
| ... | ... | @@ -111,6 +133,8 @@ |
| 111 | 133 | reload(); |
| 112 | 134 | } |
| 113 | 135 | return { |
| 136 | + isJudgeStatus, | |
| 137 | + handleView, | |
| 114 | 138 | useSelectionChange, |
| 115 | 139 | echoEditData, |
| 116 | 140 | registerTable, | ... | ... |
| ... | ... | @@ -18,24 +18,29 @@ |
| 18 | 18 | </BasicDrawer> |
| 19 | 19 | </template> |
| 20 | 20 | <script lang="ts"> |
| 21 | - import { defineComponent, ref, computed, unref } from 'vue'; | |
| 21 | + import { defineComponent, ref, computed, unref, reactive, watch, onMounted } from 'vue'; | |
| 22 | 22 | import { Button } from '/@/components/Button'; |
| 23 | 23 | import { BasicForm, useForm } from '/@/components/Form'; |
| 24 | - import { formSchema } from './config.d'; | |
| 24 | + import { formSchema, selectAll, selectOrg, selectDep, selectPer, isDeptId } from './config.d'; | |
| 25 | 25 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
| 26 | 26 | import { |
| 27 | 27 | notifyAddDraftApi, |
| 28 | 28 | notifyAddLeaseApi, |
| 29 | 29 | } from '/@/api/stationnotification/stationnotifyApi'; |
| 30 | 30 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 31 | + import { getOrganizationList } from '/@/api/system/system'; | |
| 31 | 32 | |
| 32 | 33 | export default defineComponent({ |
| 33 | 34 | name: 'ConfigDrawer', |
| 34 | 35 | components: { BasicDrawer, BasicForm, Button }, |
| 35 | 36 | emits: ['success', 'register'], |
| 36 | - setup() { | |
| 37 | + setup(_, { emit }) { | |
| 37 | 38 | const { createMessage } = useMessage(); |
| 38 | 39 | const isUpdate = ref(true); |
| 40 | + const pointArray = ref([]); | |
| 41 | + const isJudgeWherePoint = ref([]); | |
| 42 | + const newArray = ref([]); | |
| 43 | + let getAllData: any = reactive({}); | |
| 39 | 44 | const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ |
| 40 | 45 | labelWidth: 120, |
| 41 | 46 | schemas: formSchema, |
| ... | ... | @@ -59,32 +64,103 @@ |
| 59 | 64 | closeDrawer(); |
| 60 | 65 | }; |
| 61 | 66 | |
| 67 | + watch([selectAll, selectOrg, selectDep, selectPer, isDeptId], (newV) => { | |
| 68 | + isJudgeWherePoint.value = newV; | |
| 69 | + }); | |
| 70 | + | |
| 71 | + onMounted(() => { | |
| 72 | + getOrganizationList().then((res) => { | |
| 73 | + res.map((m) => { | |
| 74 | + if (m.children) { | |
| 75 | + m.children.map((m1) => { | |
| 76 | + newArray.value.push(m1.id); | |
| 77 | + }); | |
| 78 | + } | |
| 79 | + }); | |
| 80 | + }); | |
| 81 | + }); | |
| 82 | + | |
| 62 | 83 | async function handleSend() { |
| 63 | 84 | if (!unref(isUpdate)) { |
| 64 | 85 | const values = await validate(); |
| 65 | - // saveForm = getFieldsValue(); | |
| 66 | - await notifyAddLeaseApi(values); | |
| 86 | + Object.assign(getAllData, values); | |
| 87 | + isJudgeWherePoint.value.forEach((f) => { | |
| 88 | + if (f == 0) { | |
| 89 | + pointArray.value = []; | |
| 90 | + } else if (f == 1) { | |
| 91 | + //组织 | |
| 92 | + pointArray.value.push(getAllData.organizationId); | |
| 93 | + } else if (f == 2) { | |
| 94 | + //部门 | |
| 95 | + let findDeptId = newArray.value.find((f) => { | |
| 96 | + return f == isJudgeWherePoint.value[4]; | |
| 97 | + }); | |
| 98 | + console.log(findDeptId); | |
| 99 | + pointArray.value.push(findDeptId); | |
| 100 | + } else if (f == 3) { | |
| 101 | + //个人 | |
| 102 | + pointArray.value = [3]; | |
| 103 | + } | |
| 104 | + }); | |
| 105 | + getAllData.pointId = pointArray.value; | |
| 106 | + await notifyAddLeaseApi(getAllData); | |
| 67 | 107 | createMessage.success('新增成功'); |
| 108 | + closeDrawer(); | |
| 109 | + emit('success'); | |
| 110 | + resetFields(); | |
| 111 | + setTimeout(() => { | |
| 112 | + pointArray.value = []; | |
| 113 | + isJudgeWherePoint.value = []; | |
| 114 | + }, 1000); | |
| 68 | 115 | } |
| 69 | 116 | if (unref(isUpdate)) { |
| 70 | 117 | const values = await validate(); |
| 71 | 118 | // saveForm = getFieldsValue(); |
| 72 | 119 | await notifyAddLeaseApi(values); |
| 73 | 120 | createMessage.success('编辑成功'); |
| 121 | + closeDrawer(); | |
| 122 | + emit('success'); | |
| 74 | 123 | } |
| 75 | 124 | } |
| 76 | 125 | async function handleSubmit() { |
| 77 | 126 | if (!unref(isUpdate)) { |
| 78 | 127 | const values = await validate(); |
| 79 | - // saveForm = getFieldsValue(); | |
| 80 | - await notifyAddDraftApi(values); | |
| 128 | + Object.assign(getAllData, values); | |
| 129 | + isJudgeWherePoint.value.forEach((f) => { | |
| 130 | + if (f == 0) { | |
| 131 | + pointArray.value = []; | |
| 132 | + } else if (f == 1) { | |
| 133 | + //组织 | |
| 134 | + pointArray.value.push(getAllData.organizationId); | |
| 135 | + } else if (f == 2) { | |
| 136 | + //部门 | |
| 137 | + let findDeptId = newArray.value.find((f) => { | |
| 138 | + return f == isJudgeWherePoint.value[4]; | |
| 139 | + }); | |
| 140 | + pointArray.value.push(findDeptId); | |
| 141 | + } else if (f == 3) { | |
| 142 | + //个人 | |
| 143 | + pointArray.value = [3]; | |
| 144 | + } | |
| 145 | + }); | |
| 146 | + getAllData.pointId = pointArray.value; | |
| 147 | + await notifyAddDraftApi(getAllData); | |
| 81 | 148 | createMessage.success('新增成功'); |
| 149 | + closeDrawer(); | |
| 150 | + emit('success'); | |
| 151 | + resetFields(); | |
| 152 | + setTimeout(() => { | |
| 153 | + pointArray.value = []; | |
| 154 | + isJudgeWherePoint.value = []; | |
| 155 | + }, 1000); | |
| 82 | 156 | } |
| 83 | 157 | if (unref(isUpdate)) { |
| 84 | 158 | const values = await validate(); |
| 85 | 159 | // saveForm = getFieldsValue(); |
| 86 | 160 | await notifyAddDraftApi(values); |
| 87 | 161 | createMessage.success('编辑成功'); |
| 162 | + closeDrawer(); | |
| 163 | + emit('success'); | |
| 88 | 164 | } |
| 89 | 165 | } |
| 90 | 166 | return { | ... | ... |
| 1 | +<template> | |
| 2 | + <BasicDrawer | |
| 3 | + v-bind="$attrs" | |
| 4 | + @register="registerDrawer" | |
| 5 | + :showFooter="false" | |
| 6 | + :title="getTitle" | |
| 7 | + width="800px" | |
| 8 | + > | |
| 9 | + <PageWrapper title="我的通知详情"> | |
| 10 | + <Description @register="register1" class="mt-4" /> | |
| 11 | + </PageWrapper> | |
| 12 | + <BasicTable :columns="columns" :dataSource="tableData"> | |
| 13 | + <span></span> | |
| 14 | + </BasicTable> | |
| 15 | + </BasicDrawer> | |
| 16 | +</template> | |
| 17 | +<script lang="ts"> | |
| 18 | + import { defineComponent, ref, computed, unref } from 'vue'; | |
| 19 | + import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | |
| 20 | + import { BasicTable } from '/@/components/Table'; | |
| 21 | + import { Description, DescItem, useDescription } from '/@/components/Description/index'; | |
| 22 | + import { PageWrapper } from '/@/components/Page'; | |
| 23 | + | |
| 24 | + const schema: DescItem[] = [ | |
| 25 | + { | |
| 26 | + field: 'title', | |
| 27 | + label: '标题', | |
| 28 | + }, | |
| 29 | + { | |
| 30 | + field: 'content', | |
| 31 | + label: '内容', | |
| 32 | + }, | |
| 33 | + { | |
| 34 | + field: 'senderName', | |
| 35 | + label: '发送者', | |
| 36 | + }, | |
| 37 | + { | |
| 38 | + field: 'senderDate', | |
| 39 | + label: '发送时间', | |
| 40 | + }, | |
| 41 | + { | |
| 42 | + field: 'type', | |
| 43 | + label: '类型', | |
| 44 | + render: (_, data) => { | |
| 45 | + return data.type === 'MEETING' | |
| 46 | + ? '公告' | |
| 47 | + : data.type === 'MEETING1' | |
| 48 | + ? '会议' | |
| 49 | + : data.type === 'MEETING2' | |
| 50 | + ? '其他' | |
| 51 | + : ''; | |
| 52 | + }, | |
| 53 | + }, | |
| 54 | + ]; | |
| 55 | + | |
| 56 | + export default defineComponent({ | |
| 57 | + name: 'ConfigDrawer', | |
| 58 | + components: { BasicDrawer, BasicTable, Description, PageWrapper }, | |
| 59 | + emits: ['success', 'register'], | |
| 60 | + setup() { | |
| 61 | + let tableData: [] = ref([]); | |
| 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 | + ]; | |
| 76 | + const isUpdate = ref(true); | |
| 77 | + const [registerDrawer, { setDrawerProps }] = useDrawerInner(async (data) => { | |
| 78 | + setDrawerProps({ confirmLoading: false }); | |
| 79 | + isUpdate.value = !!data?.isUpdate; | |
| 80 | + tableData.value.push(data.record); | |
| 81 | + }); | |
| 82 | + const getTitle = computed(() => (!unref(isUpdate) ? '查看通知' : '查看通知')); | |
| 83 | + const [register1] = useDescription({ | |
| 84 | + title: '详情', | |
| 85 | + bordered: false, | |
| 86 | + data: tableData, | |
| 87 | + schema: schema, | |
| 88 | + }); | |
| 89 | + return { | |
| 90 | + register1, | |
| 91 | + tableData, | |
| 92 | + getTitle, | |
| 93 | + columns, | |
| 94 | + registerDrawer, | |
| 95 | + }; | |
| 96 | + }, | |
| 97 | + }); | |
| 98 | +</script> | ... | ... |