Commit 3613688cbcc568e1bb249ba70577b3b5c81461e5
Merge branch 'sqy_dev' into 'main'
fix:修改首页通知信息,修改我的通知UI,解决之前遗留的bug See merge request huang/yun-teng-iot-front!46
Showing
13 changed files
with
192 additions
and
179 deletions
@@ -89,7 +89,7 @@ export const notifyMyGetDetailApi = (id: string) => { | @@ -89,7 +89,7 @@ export const notifyMyGetDetailApi = (id: string) => { | ||
89 | }; | 89 | }; |
90 | 90 | ||
91 | /** | 91 | /** |
92 | - * 查询我的通知表格 | 92 | + * 查询我的通知表格分页 |
93 | * @param params pageSize page name | 93 | * @param params pageSize page name |
94 | */ | 94 | */ |
95 | export const notifyMyGetrPageApi = (params?: NoticeQueryParam) => { | 95 | export const notifyMyGetrPageApi = (params?: NoticeQueryParam) => { |
@@ -16,6 +16,8 @@ import { | @@ -16,6 +16,8 @@ import { | ||
16 | ChangeAccountParams, | 16 | ChangeAccountParams, |
17 | RoleListItem, | 17 | RoleListItem, |
18 | } from './model/systemModel'; | 18 | } from './model/systemModel'; |
19 | +import { USER_INFO_KEY } from '/@/enums/cacheEnum'; | ||
20 | +import { getAuthCache } from '/@/utils/auth'; | ||
19 | import { defHttp } from '/@/utils/http/axios'; | 21 | import { defHttp } from '/@/utils/http/axios'; |
20 | 22 | ||
21 | enum Api { | 23 | enum Api { |
@@ -84,10 +86,20 @@ export const getAllRoleList = async (params?: RoleParams) => { | @@ -84,10 +86,20 @@ export const getAllRoleList = async (params?: RoleParams) => { | ||
84 | return defHttp.post<RoleListGetResultModel>({ url: Api.GetAllRoleList, params }); | 86 | return defHttp.post<RoleListGetResultModel>({ url: Api.GetAllRoleList, params }); |
85 | }; | 87 | }; |
86 | 88 | ||
87 | -// 过滤角色列表----过滤掉不是PLATFORM_ADMIN的角色 | ||
88 | -export const filterRoleList = async (params?: RoleParams) => { | ||
89 | - const res = await defHttp.post<RoleListGetResultModel>({ url: Api.GetAllRoleList, params }); | ||
90 | - const options = res.filter((item) => item.roleType === 'PLATFORM_ADMIN'); | 89 | +// 过滤角色列表----根据登录的账号所属的角色-过滤掉其他平台类型的角色 |
90 | +export const filterRoleList = async () => { | ||
91 | + const res = await defHttp.post<RoleListGetResultModel>({ url: Api.GetAllRoleList }); | ||
92 | + const userInfo: any = getAuthCache(USER_INFO_KEY); | ||
93 | + const role = userInfo.roles[0]; | ||
94 | + const options = res.filter((item) => { | ||
95 | + if (role === 'SYS_ADMIN') { | ||
96 | + return item.roleType === 'PLATFORM_ADMIN'; | ||
97 | + } else if (role === 'PLATFORM_ADMIN') { | ||
98 | + return item.roleType === 'PLATFORM_ADMIN'; | ||
99 | + } else { | ||
100 | + return item.roleType === 'CUSTOMER_USER'; | ||
101 | + } | ||
102 | + }); | ||
91 | return Promise.resolve<RoleListItem[]>(options); | 103 | return Promise.resolve<RoleListItem[]>(options); |
92 | }; | 104 | }; |
93 | 105 |
@@ -63,7 +63,7 @@ | @@ -63,7 +63,7 @@ | ||
63 | const BMap = (window as any).BMap; | 63 | const BMap = (window as any).BMap; |
64 | if (!wrapEl) return; | 64 | if (!wrapEl) return; |
65 | const map = new BMap.Map(wrapEl); | 65 | const map = new BMap.Map(wrapEl); |
66 | - const point = new BMap.Point(116.14282, 35.19515); | 66 | + const point = new BMap.Point(104.04666605565338, 30.543516387560476); |
67 | 67 | ||
68 | map.centerAndZoom(point, 15); | 68 | map.centerAndZoom(point, 15); |
69 | map.enableScrollWheelZoom(true); | 69 | map.enableScrollWheelZoom(true); |
1 | <template> | 1 | <template> |
2 | <div> | 2 | <div> |
3 | - <PageWrapper dense contentFullHeight fixedHeight contentClass="flex"> | 3 | + <PageWrapper dense contentFullHeight contentClass="flex"> |
4 | <OrganizationIdTree | 4 | <OrganizationIdTree |
5 | class="w-1/4 xl:w-1/5" | 5 | class="w-1/4 xl:w-1/5" |
6 | @select="handleSelect" | 6 | @select="handleSelect" |
@@ -12,7 +12,7 @@ | @@ -12,7 +12,7 @@ | ||
12 | <a-button | 12 | <a-button |
13 | type="primary" | 13 | type="primary" |
14 | color="error" | 14 | color="error" |
15 | - @click="handleDeleteOrBatchDelete.bind(null)" | 15 | + @click="handleDeleteOrBatchDelete(null)" |
16 | :disabled="hasBatchDelete" | 16 | :disabled="hasBatchDelete" |
17 | > | 17 | > |
18 | 批量删除 | 18 | 批量删除 |
@@ -120,7 +120,7 @@ | @@ -120,7 +120,7 @@ | ||
120 | } | 120 | } |
121 | }; | 121 | }; |
122 | // 删除或批量删除 | 122 | // 删除或批量删除 |
123 | - const handleDeleteOrBatchDelete = async (record?: Recordable) => { | 123 | + const handleDeleteOrBatchDelete = async (record: Recordable | null) => { |
124 | if (record) { | 124 | if (record) { |
125 | try { | 125 | try { |
126 | await deleteAlarmContact([record.id]); | 126 | await deleteAlarmContact([record.id]); |
@@ -14,35 +14,43 @@ | @@ -14,35 +14,43 @@ | ||
14 | :bodyStyle="{ padding: 0 }" | 14 | :bodyStyle="{ padding: 0 }" |
15 | > | 15 | > |
16 | <div v-if="activeKey === 'tab1'"> | 16 | <div v-if="activeKey === 'tab1'"> |
17 | - <List item-layout="horizontal" :data-source="data"> | 17 | + <List item-layout="horizontal" :dataSource="dataSource"> |
18 | <template #renderItem="{ item }"> | 18 | <template #renderItem="{ item }"> |
19 | <ListItem> | 19 | <ListItem> |
20 | - <ListItemMeta :description="item.description"> | ||
21 | - <template #title> | ||
22 | - <a href="https://www.antdv.com/">{{ item.title }}</a> | ||
23 | - </template> | 20 | + <ListItemMeta> |
24 | <template #avatar> | 21 | <template #avatar> |
25 | - <Avatar :src="item.avatar" /> | 22 | + <Avatar src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" /> |
23 | + </template> | ||
24 | + <template #description> | ||
25 | + <span | ||
26 | + @click="go('/stationnotification/mynotification')" | ||
27 | + class="cursor-pointer noticeTitle" | ||
28 | + >{{ item.sysNotice.title }} | ||
29 | + </span> | ||
30 | + </template> | ||
31 | + <template #title> | ||
32 | + <span>{{ item.user.realName }}</span> | ||
26 | </template> | 33 | </template> |
27 | </ListItemMeta> | 34 | </ListItemMeta> |
28 | - <template #extra> {{ item.date }} </template> | 35 | + <template #extra> |
36 | + <Time :value="item.sysNotice.senderDate" /> | ||
37 | + </template> | ||
29 | </ListItem> | 38 | </ListItem> |
30 | </template> | 39 | </template> |
31 | </List> | 40 | </List> |
41 | + <Card hoverable title="联系我们" :bordered="false"> | ||
42 | + <template #cover> | ||
43 | + <img :src="getQrCode" alt="" style="width: 150px; height: 150px; margin: 50px auto" /> | ||
44 | + </template> | ||
45 | + <CardMeta> | ||
46 | + <template #description> | ||
47 | + <p>联系人: {{ getContacts }}</p> | ||
48 | + <p>联系电话: {{ getTel }}</p> | ||
49 | + <p>联系地址: {{ getAddress }} </p> | ||
50 | + </template> | ||
51 | + </CardMeta> | ||
52 | + </Card> | ||
32 | </div> | 53 | </div> |
33 | - <div v-else>222</div> | ||
34 | - </Card> | ||
35 | - <Card hoverable title="联系我们" :bordered="false"> | ||
36 | - <template #cover> | ||
37 | - <img :src="getQrCode" alt="" style="width: 150px; height: 150px; margin: 50px auto" /> | ||
38 | - </template> | ||
39 | - <CardMeta> | ||
40 | - <template #description> | ||
41 | - <p>联系人: {{ getContacts }}</p> | ||
42 | - <p>联系电话: {{ getTel }}</p> | ||
43 | - <p>联系地址: {{ getAddress }} </p> | ||
44 | - </template> | ||
45 | - </CardMeta> | ||
46 | </Card> | 54 | </Card> |
47 | </Card> | 55 | </Card> |
48 | </template> | 56 | </template> |
@@ -52,6 +60,9 @@ | @@ -52,6 +60,9 @@ | ||
52 | import { Card, AnchorLink, List, ListItem, ListItemMeta, Avatar, CardMeta } from 'ant-design-vue'; | 60 | import { Card, AnchorLink, List, ListItem, ListItemMeta, Avatar, CardMeta } from 'ant-design-vue'; |
53 | import { useUserStore } from '/@/store/modules/user'; | 61 | import { useUserStore } from '/@/store/modules/user'; |
54 | import { getEnterPriseDetail } from '/@/api/oem'; | 62 | import { getEnterPriseDetail } from '/@/api/oem'; |
63 | + import { notifyMyGetrPageApi } from '/@/api/stationnotification/stationnotifyApi'; | ||
64 | + import { Time } from '/@/components/Time'; | ||
65 | + import { useGo } from '/@/hooks/web/usePage'; | ||
55 | export default defineComponent({ | 66 | export default defineComponent({ |
56 | components: { | 67 | components: { |
57 | Card, | 68 | Card, |
@@ -60,6 +71,7 @@ | @@ -60,6 +71,7 @@ | ||
60 | ListItem, | 71 | ListItem, |
61 | ListItemMeta, | 72 | ListItemMeta, |
62 | Avatar, | 73 | Avatar, |
74 | + Time, | ||
63 | CardMeta, | 75 | CardMeta, |
64 | }, | 76 | }, |
65 | setup() { | 77 | setup() { |
@@ -90,57 +102,13 @@ | @@ -90,57 +102,13 @@ | ||
90 | const tabListTitle = [ | 102 | const tabListTitle = [ |
91 | { | 103 | { |
92 | key: 'tab1', | 104 | key: 'tab1', |
93 | - tab: '通知公告', | ||
94 | - }, | ||
95 | - { | ||
96 | - key: 'tab2', | ||
97 | - tab: '系统公告', | 105 | + tab: '我的通知', |
98 | }, | 106 | }, |
99 | ]; | 107 | ]; |
100 | const onTabChange = (key) => { | 108 | const onTabChange = (key) => { |
101 | activeKey.value = key; | 109 | activeKey.value = key; |
102 | }; | 110 | }; |
103 | 111 | ||
104 | - // 列表 | ||
105 | - interface DataItem { | ||
106 | - title: string; | ||
107 | - description: string; | ||
108 | - avatar: string; | ||
109 | - date: string; | ||
110 | - } | ||
111 | - const data: DataItem[] = [ | ||
112 | - { | ||
113 | - title: '企业管理员', | ||
114 | - description: '现在就来开创新的记录吧!', | ||
115 | - avatar: 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png', | ||
116 | - date: '5分钟前', | ||
117 | - }, | ||
118 | - { | ||
119 | - title: '企业管理员', | ||
120 | - description: '有新的告警数据需要处理,现在去查看吧', | ||
121 | - avatar: 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png', | ||
122 | - date: '7小时前', | ||
123 | - }, | ||
124 | - { | ||
125 | - title: '管理员', | ||
126 | - description: '有新的告警数据需要处理,现在去查看吧', | ||
127 | - avatar: 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png', | ||
128 | - date: '6小时前', | ||
129 | - }, | ||
130 | - { | ||
131 | - title: '管理员', | ||
132 | - description: '现在就来开创新的记录吧!', | ||
133 | - avatar: 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png', | ||
134 | - date: '1小时前', | ||
135 | - }, | ||
136 | - { | ||
137 | - title: '管理员', | ||
138 | - description: '现在就来开创新的记录吧!', | ||
139 | - avatar: 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png', | ||
140 | - date: '7小时前', | ||
141 | - }, | ||
142 | - ]; | ||
143 | - | ||
144 | const userStore = useUserStore(); | 112 | const userStore = useUserStore(); |
145 | const getContacts = computed(() => { | 113 | const getContacts = computed(() => { |
146 | return userStore.enterPriseInfo?.contacts; | 114 | return userStore.enterPriseInfo?.contacts; |
@@ -155,19 +123,32 @@ | @@ -155,19 +123,32 @@ | ||
155 | return userStore.enterPriseInfo?.qrCode; | 123 | return userStore.enterPriseInfo?.qrCode; |
156 | }); | 124 | }); |
157 | 125 | ||
126 | + // 通知数据 | ||
127 | + const dataSource = ref([]); | ||
128 | + const go = useGo(); | ||
129 | + onMounted(async () => { | ||
130 | + const res = await notifyMyGetrPageApi({ page: 1, pageSize: 5 }); | ||
131 | + dataSource.value = res.items; | ||
132 | + }); | ||
133 | + | ||
158 | return { | 134 | return { |
159 | activeKey, | 135 | activeKey, |
160 | tabListTitle, | 136 | tabListTitle, |
161 | onTabChange, | 137 | onTabChange, |
162 | - data, | ||
163 | helpDoc, | 138 | helpDoc, |
164 | getQrCode, | 139 | getQrCode, |
165 | getContacts, | 140 | getContacts, |
166 | getAddress, | 141 | getAddress, |
167 | getTel, | 142 | getTel, |
143 | + dataSource, | ||
144 | + go, | ||
168 | }; | 145 | }; |
169 | }, | 146 | }, |
170 | }); | 147 | }); |
171 | </script> | 148 | </script> |
172 | 149 | ||
173 | -<style lang="less" scoped></style> | 150 | +<style lang="less" scoped> |
151 | + .noticeTitle:hover { | ||
152 | + border-bottom: 1px solid #ccc; | ||
153 | + } | ||
154 | +</style> |
@@ -34,7 +34,7 @@ | @@ -34,7 +34,7 @@ | ||
34 | import { useDrawerInner } from '/@/components/Drawer'; | 34 | import { useDrawerInner } from '/@/components/Drawer'; |
35 | import { columns, searchFormSchema } from './email.data'; | 35 | import { columns, searchFormSchema } from './email.data'; |
36 | import { useMessage } from '/@/hooks/web/useMessage'; | 36 | import { useMessage } from '/@/hooks/web/useMessage'; |
37 | - import { deleteSmsLog, mailLogPage } from '/@/api/message/records'; | 37 | + import { deleteSmsLog, mailLogPage, deleteMailLog } from '/@/api/message/records'; |
38 | import { useModal } from '/@/components/Modal'; | 38 | import { useModal } from '/@/components/Modal'; |
39 | import EmailDetail from '/@/views/message/records/item/EmailDetail.vue'; | 39 | import EmailDetail from '/@/views/message/records/item/EmailDetail.vue'; |
40 | export default defineComponent({ | 40 | export default defineComponent({ |
@@ -77,7 +77,7 @@ | @@ -77,7 +77,7 @@ | ||
77 | 77 | ||
78 | function handleDelete(record: Recordable) { | 78 | function handleDelete(record: Recordable) { |
79 | let ids = [record.id]; | 79 | let ids = [record.id]; |
80 | - deleteSmsLog(ids).then((result) => { | 80 | + deleteMailLog(ids).then((result) => { |
81 | createMessage.success(result.message); | 81 | createMessage.success(result.message); |
82 | handleSuccess(); | 82 | handleSuccess(); |
83 | }); | 83 | }); |
1 | +<template> | ||
2 | + <div> | ||
3 | + <BasicModal | ||
4 | + v-bind="$attrs" | ||
5 | + @register="registerModal" | ||
6 | + :showFooter="false" | ||
7 | + :title="dataSource?.sysNotice?.title" | ||
8 | + width="50%" | ||
9 | + centered | ||
10 | + :showCancelBtn="false" | ||
11 | + :showOkBtn="false" | ||
12 | + @cancel="handleClose" | ||
13 | + > | ||
14 | + <PageWrapper dense contentFullHeight contentBackground> | ||
15 | + <div class="detail-notice-info"> | ||
16 | + <span class="mr-6" | ||
17 | + ><UserOutlined class="mr-2" />发送者:{{ dataSource?.user?.realName }}</span | ||
18 | + > | ||
19 | + <span class="mr-6" | ||
20 | + ><SolutionOutlined class="mr-2" />通知类型:{{ | ||
21 | + dataSource?.sysNotice?.type === 'NOTICE' | ||
22 | + ? '公告' | ||
23 | + : dataSource?.sysNotice?.type === 'MEETING' | ||
24 | + ? '会议' | ||
25 | + : dataSource?.sysNotice?.type === 'OTHER' | ||
26 | + ? '其他' | ||
27 | + : '' | ||
28 | + }}</span | ||
29 | + > | ||
30 | + <span class="mr-6" | ||
31 | + ><FieldTimeOutlined class="mr-2" />发送时间{{ dataSource?.sysNotice.senderDate }}</span | ||
32 | + > | ||
33 | + </div> | ||
34 | + <p v-html="dataSource?.sysNotice?.content"></p> | ||
35 | + </PageWrapper> | ||
36 | + </BasicModal> | ||
37 | + </div> | ||
38 | +</template> | ||
39 | +<script lang="ts"> | ||
40 | + import { defineComponent, ref, unref } from 'vue'; | ||
41 | + import { BasicModal, useModalInner } from '/@/components/Modal'; | ||
42 | + import { UserOutlined, SolutionOutlined, FieldTimeOutlined } from '@ant-design/icons-vue'; | ||
43 | + import { PageWrapper } from '/@/components/Page'; | ||
44 | + import { notifyMyGetDetailApi } from '/@/api/stationnotification/stationnotifyApi'; | ||
45 | + export default defineComponent({ | ||
46 | + name: 'MyNoticeDrawer', | ||
47 | + components: { BasicModal, PageWrapper, UserOutlined, SolutionOutlined, FieldTimeOutlined }, | ||
48 | + emits: ['success', 'register'], | ||
49 | + setup(_, { emit }) { | ||
50 | + const dataSource = ref(); | ||
51 | + const [registerModal] = useModalInner(async (data) => { | ||
52 | + dataSource.value = data.record; | ||
53 | + }); | ||
54 | + const handleClose = async () => { | ||
55 | + await notifyMyGetDetailApi(unref(dataSource).id); | ||
56 | + emit('success'); | ||
57 | + }; | ||
58 | + return { | ||
59 | + registerModal, | ||
60 | + handleClose, | ||
61 | + dataSource, | ||
62 | + }; | ||
63 | + }, | ||
64 | + }); | ||
65 | +</script> | ||
66 | + | ||
67 | +<style lang="less" scoped> | ||
68 | + .detail-notice-info { | ||
69 | + color: #999; | ||
70 | + border-top: 1px solid #ccc; | ||
71 | + border-bottom: 1px solid #ccc; | ||
72 | + padding-top: 5px; | ||
73 | + padding-bottom: 5px; | ||
74 | + } | ||
75 | +</style> |
@@ -7,11 +7,8 @@ import { h } from 'vue'; | @@ -7,11 +7,8 @@ import { h } from 'vue'; | ||
7 | export const columns: BasicColumn[] = [ | 7 | export const columns: BasicColumn[] = [ |
8 | { | 8 | { |
9 | title: '标题', | 9 | title: '标题', |
10 | - dataIndex: 'title', | 10 | + dataIndex: 'sysNotice.title', |
11 | width: 200, | 11 | width: 200, |
12 | - format: (text: string, record: Recordable) => { | ||
13 | - return record.sysNotice.title ?? '无'; | ||
14 | - }, | ||
15 | }, | 12 | }, |
16 | { | 13 | { |
17 | title: '类型', | 14 | title: '类型', |
@@ -29,15 +26,12 @@ export const columns: BasicColumn[] = [ | @@ -29,15 +26,12 @@ export const columns: BasicColumn[] = [ | ||
29 | }, | 26 | }, |
30 | { | 27 | { |
31 | title: '发送者', | 28 | title: '发送者', |
32 | - dataIndex: 'senderName', | 29 | + dataIndex: 'user.realName', |
33 | width: 200, | 30 | width: 200, |
34 | - format: (text: string, record: Recordable) => { | ||
35 | - return record.sysNotice.senderName ?? '无'; | ||
36 | - }, | ||
37 | }, | 31 | }, |
38 | { | 32 | { |
39 | title: '发送时间', | 33 | title: '发送时间', |
40 | - dataIndex: 'createTime', | 34 | + dataIndex: 'sysNotice.senderDate', |
41 | width: 200, | 35 | width: 200, |
42 | }, | 36 | }, |
43 | { | 37 | { |
@@ -14,21 +14,21 @@ | @@ -14,21 +14,21 @@ | ||
14 | /> | 14 | /> |
15 | </template> | 15 | </template> |
16 | </BasicTable> | 16 | </BasicTable> |
17 | - <NotifyDetailDrawer @register="registerDrawer" @success="handleSuccess" /> | 17 | + <CatNoticeModal @register="registerModal" @success="handleSuccess" /> |
18 | </div> | 18 | </div> |
19 | </template> | 19 | </template> |
20 | <script lang="ts"> | 20 | <script lang="ts"> |
21 | import { defineComponent } from 'vue'; | 21 | import { defineComponent } from 'vue'; |
22 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 22 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
23 | - import { useDrawer } from '/@/components/Drawer'; | ||
24 | - import NotifyDetailDrawer from './useDrawer.vue'; | 23 | + import { useModal } from '/@/components/Modal'; |
24 | + import CatNoticeModal from './CatNoticeModal.vue'; | ||
25 | import { columns, searchFormSchema } from './config.d'; | 25 | import { columns, searchFormSchema } from './config.d'; |
26 | import { notifyMyGetrPageApi } from '/@/api/stationnotification/stationnotifyApi'; | 26 | import { notifyMyGetrPageApi } from '/@/api/stationnotification/stationnotifyApi'; |
27 | export default defineComponent({ | 27 | export default defineComponent({ |
28 | name: 'LoginForm', | 28 | name: 'LoginForm', |
29 | - components: { BasicTable, NotifyDetailDrawer, TableAction }, | 29 | + components: { BasicTable, CatNoticeModal, TableAction }, |
30 | setup() { | 30 | setup() { |
31 | - const [registerDrawer, { openDrawer }] = useDrawer(); | 31 | + const [registerModal, { openModal }] = useModal(); |
32 | const [registerTable, { reload }] = useTable({ | 32 | const [registerTable, { reload }] = useTable({ |
33 | api: notifyMyGetrPageApi, | 33 | api: notifyMyGetrPageApi, |
34 | columns, | 34 | columns, |
@@ -50,7 +50,7 @@ | @@ -50,7 +50,7 @@ | ||
50 | }); | 50 | }); |
51 | 51 | ||
52 | function handleView(record: Recordable) { | 52 | function handleView(record: Recordable) { |
53 | - openDrawer(true, { | 53 | + openModal(true, { |
54 | record, | 54 | record, |
55 | }); | 55 | }); |
56 | } | 56 | } |
@@ -60,7 +60,7 @@ | @@ -60,7 +60,7 @@ | ||
60 | } | 60 | } |
61 | return { | 61 | return { |
62 | registerTable, | 62 | registerTable, |
63 | - registerDrawer, | 63 | + registerModal, |
64 | handleView, | 64 | handleView, |
65 | handleSuccess, | 65 | handleSuccess, |
66 | }; | 66 | }; |
src/views/stationnotification/mynotification/useDrawer.vue
deleted
100644 → 0
1 | -<template> | ||
2 | - <div> | ||
3 | - <BasicDrawer | ||
4 | - v-bind="$attrs" | ||
5 | - @register="registerDrawer" | ||
6 | - :showFooter="false" | ||
7 | - title="通知详情" | ||
8 | - width="70%" | ||
9 | - @close="handleClose" | ||
10 | - > | ||
11 | - <div v-html="DescInfo?.content"></div> | ||
12 | - <Description @register="registerDesc" /> | ||
13 | - </BasicDrawer> | ||
14 | - </div> | ||
15 | -</template> | ||
16 | -<script lang="ts"> | ||
17 | - import { defineComponent, ref } from 'vue'; | ||
18 | - import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | ||
19 | - import { Description, useDescription } from '/@/components/Description/index'; | ||
20 | - import { DescDetailSchema } from './config.d'; | ||
21 | - import { | ||
22 | - noticeByIdGetInfo, | ||
23 | - notifyMyGetDetailApi, | ||
24 | - } from '/@/api/stationnotification/stationnotifyApi'; | ||
25 | - export default defineComponent({ | ||
26 | - name: 'MyNoticeDrawer', | ||
27 | - components: { BasicDrawer, Description }, | ||
28 | - emits: ['success', 'register'], | ||
29 | - setup(_, { emit }) { | ||
30 | - const dataSource = ref(); | ||
31 | - let DescInfo = ref(); | ||
32 | - const [registerDrawer] = useDrawerInner(async (data) => { | ||
33 | - dataSource.value = data.record; | ||
34 | - const id = data.record.noticeId; | ||
35 | - let getDescInfo = await noticeByIdGetInfo(id); | ||
36 | - DescInfo.value = getDescInfo; | ||
37 | - }); | ||
38 | - const [registerDesc] = useDescription({ | ||
39 | - bordered: false, | ||
40 | - schema: DescDetailSchema, | ||
41 | - data: dataSource, | ||
42 | - }); | ||
43 | - const handleClose = async () => { | ||
44 | - await notifyMyGetDetailApi(dataSource.value.id); | ||
45 | - emit('success'); | ||
46 | - }; | ||
47 | - return { | ||
48 | - DescInfo, | ||
49 | - registerDesc, | ||
50 | - registerDrawer, | ||
51 | - handleClose, | ||
52 | - }; | ||
53 | - }, | ||
54 | - }); | ||
55 | -</script> |
1 | <template> | 1 | <template> |
2 | <div> | 2 | <div> |
3 | - <BasicTable | ||
4 | - :rowSelection="{ type: 'checkbox' }" | ||
5 | - @selection-change="useSelectionChange" | ||
6 | - @register="registerTable" | ||
7 | - > | 3 | + <BasicTable @register="registerTable"> |
8 | <template #toolbar> | 4 | <template #toolbar> |
9 | <a-button type="primary" @click="handleAdd"> 新增 </a-button> | 5 | <a-button type="primary" @click="handleAdd"> 新增 </a-button> |
10 | - <a-button color="error" @click="handleToolbarDel"> 删除 </a-button> | 6 | + <a-button color="error" @click="handleToolbarDel" :disabled="hasBatchDelete"> |
7 | + 批量删除 | ||
8 | + </a-button> | ||
11 | </template> | 9 | </template> |
12 | <template #action="{ record }"> | 10 | <template #action="{ record }"> |
13 | <TableAction | 11 | <TableAction |
@@ -46,7 +44,7 @@ | @@ -46,7 +44,7 @@ | ||
46 | </div> | 44 | </div> |
47 | </template> | 45 | </template> |
48 | <script lang="ts"> | 46 | <script lang="ts"> |
49 | - import { defineComponent, reactive } from 'vue'; | 47 | + import { defineComponent, computed, unref, ref } from 'vue'; |
50 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 48 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
51 | import { useDrawer } from '/@/components/Drawer'; | 49 | import { useDrawer } from '/@/components/Drawer'; |
52 | import NotifyManagerDrawer from './useDrawer.vue'; | 50 | import NotifyManagerDrawer from './useDrawer.vue'; |
@@ -56,15 +54,27 @@ | @@ -56,15 +54,27 @@ | ||
56 | import { notifyGetTableApi, notifyDeleteApi } from '/@/api/stationnotification/stationnotifyApi'; | 54 | import { notifyGetTableApi, notifyDeleteApi } from '/@/api/stationnotification/stationnotifyApi'; |
57 | 55 | ||
58 | export default defineComponent({ | 56 | export default defineComponent({ |
59 | - name: 'Index', | 57 | + name: 'Notificationmannager', |
60 | components: { BasicTable, NotifyManagerDrawer, TableAction, tableViewChild }, | 58 | components: { BasicTable, NotifyManagerDrawer, TableAction, tableViewChild }, |
61 | setup() { | 59 | setup() { |
62 | - let selectedRowKeys = reactive<string[]>([]); | ||
63 | - | ||
64 | const [registerDrawer, { openDrawer }] = useDrawer(); | 60 | const [registerDrawer, { openDrawer }] = useDrawer(); |
65 | const [registerAdd, { openDrawer: openDrawerAdd }] = useDrawer(); | 61 | const [registerAdd, { openDrawer: openDrawerAdd }] = useDrawer(); |
66 | const { createMessage } = useMessage(); | 62 | const { createMessage } = useMessage(); |
67 | - const [registerTable, { reload, getSelectRowKeys }] = useTable({ | 63 | + // 批量删除 |
64 | + const selectedRowIds = ref<string[]>([]); | ||
65 | + const hasBatchDelete = computed(() => unref(selectedRowIds).length <= 0); | ||
66 | + const onSelectRowChange = (selectedRowKeys: string[]) => { | ||
67 | + selectedRowIds.value = selectedRowKeys; | ||
68 | + console.log(selectedRowKeys); | ||
69 | + }; | ||
70 | + async function handleToolbarDel() { | ||
71 | + await notifyDeleteApi(selectedRowIds.value); | ||
72 | + createMessage.success('批量删除成功'); | ||
73 | + selectedRowIds.value = []; | ||
74 | + reload(); | ||
75 | + } | ||
76 | + | ||
77 | + const [registerTable, { reload }] = useTable({ | ||
68 | clickToRowSelect: false, | 78 | clickToRowSelect: false, |
69 | api: notifyGetTableApi, | 79 | api: notifyGetTableApi, |
70 | columns, | 80 | columns, |
@@ -72,6 +82,10 @@ | @@ -72,6 +82,10 @@ | ||
72 | labelWidth: 120, | 82 | labelWidth: 120, |
73 | schemas: searchFormSchema, | 83 | schemas: searchFormSchema, |
74 | }, | 84 | }, |
85 | + rowSelection: { | ||
86 | + onChange: onSelectRowChange, | ||
87 | + type: 'checkbox', | ||
88 | + }, | ||
75 | rowKey: 'id', | 89 | rowKey: 'id', |
76 | useSearchForm: true, | 90 | useSearchForm: true, |
77 | showTableSetting: true, | 91 | showTableSetting: true, |
@@ -92,15 +106,6 @@ | @@ -92,15 +106,6 @@ | ||
92 | }); | 106 | }); |
93 | } | 107 | } |
94 | 108 | ||
95 | - const useSelectionChange = () => { | ||
96 | - selectedRowKeys = getSelectRowKeys(); | ||
97 | - }; | ||
98 | - | ||
99 | - async function handleToolbarDel() { | ||
100 | - await notifyDeleteApi(selectedRowKeys); | ||
101 | - createMessage.success('删除成功'); | ||
102 | - reload(); | ||
103 | - } | ||
104 | const handleView = (record: Recordable) => { | 109 | const handleView = (record: Recordable) => { |
105 | openDrawer(true, { | 110 | openDrawer(true, { |
106 | record, | 111 | record, |
@@ -122,9 +127,9 @@ | @@ -122,9 +127,9 @@ | ||
122 | reload(); | 127 | reload(); |
123 | } | 128 | } |
124 | return { | 129 | return { |
130 | + hasBatchDelete, | ||
125 | handleView, | 131 | handleView, |
126 | registerAdd, | 132 | registerAdd, |
127 | - useSelectionChange, | ||
128 | registerTable, | 133 | registerTable, |
129 | registerDrawer, | 134 | registerDrawer, |
130 | handleAdd, | 135 | handleAdd, |
@@ -132,6 +137,7 @@ | @@ -132,6 +137,7 @@ | ||
132 | handleEdit, | 137 | handleEdit, |
133 | handleDelete, | 138 | handleDelete, |
134 | handleSuccess, | 139 | handleSuccess, |
140 | + onSelectRowChange, | ||
135 | }; | 141 | }; |
136 | }, | 142 | }, |
137 | }); | 143 | }); |
@@ -37,22 +37,22 @@ | @@ -37,22 +37,22 @@ | ||
37 | label: '发送者', | 37 | label: '发送者', |
38 | }, | 38 | }, |
39 | { | 39 | { |
40 | - field: 'senderDate', | ||
41 | - label: '发送时间', | ||
42 | - }, | ||
43 | - { | ||
44 | field: 'type', | 40 | field: 'type', |
45 | label: '类型:', | 41 | label: '类型:', |
46 | - render: (_, data) => { | ||
47 | - return data.type === 'NOTICE' | 42 | + render: (_, { type }) => { |
43 | + return type === 'NOTICE' | ||
48 | ? '公告' | 44 | ? '公告' |
49 | - : data.type === 'MEETING' | 45 | + : type === 'MEETING' |
50 | ? '会议' | 46 | ? '会议' |
51 | - : data.type === 'OTHER' | 47 | + : type === 'OTHER' |
52 | ? '其他' | 48 | ? '其他' |
53 | : ''; | 49 | : ''; |
54 | }, | 50 | }, |
55 | }, | 51 | }, |
52 | + { | ||
53 | + field: 'senderDate', | ||
54 | + label: '发送时间', | ||
55 | + }, | ||
56 | ]; | 56 | ]; |
57 | export default defineComponent({ | 57 | export default defineComponent({ |
58 | name: 'ConfigDrawer', | 58 | name: 'ConfigDrawer', |
@@ -90,7 +90,7 @@ | @@ -90,7 +90,7 @@ | ||
90 | 90 | ||
91 | const formData = reactive({ | 91 | const formData = reactive({ |
92 | account: 'sysadmin', | 92 | account: 'sysadmin', |
93 | - password: 'password', | 93 | + password: 'Sysadmin@123', |
94 | }); | 94 | }); |
95 | 95 | ||
96 | const { validForm } = useFormValid(formRef); | 96 | const { validForm } = useFormValid(formRef); |