Commit fa183584223f9593cc683b4541fe7567d180c89a
Merge branch 'ft-dev' into 'main'
feat:通知增加查看功能 See merge request huang/yun-teng-iot-front!20
Showing
10 changed files
with
197 additions
and
75 deletions
1 | 1 | # Whether to open mock |
2 | -VITE_USE_MOCK = true | |
2 | +# VITE_USE_MOCK = true | |
3 | 3 | |
4 | 4 | # public path |
5 | 5 | VITE_PUBLIC_PATH = / |
6 | 6 | |
7 | 7 | # Cross-domain proxy, you can configure multiple |
8 | 8 | # Please note that no line breaks |
9 | -VITE_PROXY = [["/api","http://192.168.10.116:8082/api"],["/upload","http://192.168.10.116:3300/upload"]] | |
9 | +VITE_PROXY = [["/api","http://192.168.10.117:8082/api"],["/upload","http://192.168.10.116:3300/upload"]] | |
10 | 10 | # VITE_PROXY=[["/api","https://vvbin.cn/test"]] |
11 | 11 | |
12 | 12 | # Delete console | ... | ... |
... | ... | @@ -26,10 +26,9 @@ enum NotifyManagerApi { |
26 | 26 | // * 获取详情 |
27 | 27 | // * @param |
28 | 28 | // */ |
29 | -export const screenLinkPageByDeptIdGetDevice = (params: NoticeByIdParams) => { | |
29 | +export const noticeByIdGetInfo = (id: string) => { | |
30 | 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 | 10 | |
11 | 11 | const schema: DescItem[] = [ |
12 | 12 | { |
13 | + field: 'creator', | |
14 | + label: '创建者', | |
15 | + }, | |
16 | + { | |
13 | 17 | field: 'title', |
14 | 18 | label: '标题', |
15 | 19 | }, |
16 | 20 | { |
17 | - field: 'content', | |
18 | - label: '内容', | |
21 | + field: 'updateTime', | |
22 | + label: '更新时间', | |
19 | 23 | }, |
20 | 24 | { |
21 | 25 | field: 'senderName', |
22 | 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 | 40 | field: 'type', |
30 | 41 | label: '类型', |
31 | 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 | 57 | export default defineComponent({ |
43 | 58 | components: { Description, PageWrapper }, | ... | ... |
... | ... | @@ -4,36 +4,78 @@ |
4 | 4 | @register="registerDrawer" |
5 | 5 | :showFooter="false" |
6 | 6 | :title="getTitle" |
7 | - width="800px" | |
7 | + width="1000px" | |
8 | 8 | > |
9 | 9 | <DetailChild :emitChildData="childData" /> |
10 | + <BasicTable :columns="columns" :dataSource="tableData"> | |
11 | + <span></span> | |
12 | + </BasicTable> | |
10 | 13 | </BasicDrawer> |
11 | 14 | </template> |
12 | 15 | <script lang="ts"> |
13 | 16 | import { defineComponent, ref, computed, unref } from 'vue'; |
14 | 17 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
15 | 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 | 25 | export default defineComponent({ |
21 | 26 | name: 'ConfigDrawer', |
22 | - components: { BasicDrawer, DetailChild }, | |
27 | + components: { BasicDrawer, DetailChild, BasicTable }, | |
23 | 28 | emits: ['success', 'register'], |
24 | 29 | setup() { |
25 | - // const { createMessage } = useMessage(); | |
26 | 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 | 68 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { |
29 | 69 | setDrawerProps({ confirmLoading: false }); |
30 | 70 | isUpdate.value = !!data?.isUpdate; |
31 | - console.log(data.record); | |
32 | 71 | if (data.record) { |
33 | - // console.log(data.record.id); | |
34 | 72 | let getData = await notifyMyGetDetailApi(data.record.id); |
35 | 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 | 81 | if (unref(isUpdate)) { |
... | ... | @@ -47,6 +89,8 @@ |
47 | 89 | }; |
48 | 90 | |
49 | 91 | return { |
92 | + tableData, | |
93 | + columns, | |
50 | 94 | childData, |
51 | 95 | handleCancel, |
52 | 96 | getTitle, | ... | ... |
... | ... | @@ -16,17 +16,17 @@ |
16 | 16 | label: '查看', |
17 | 17 | icon: 'clarity:note-edit-line', |
18 | 18 | onClick: handleView.bind(null, record), |
19 | - // ifShow: (_action) => { | |
20 | - // return record.status == '已发布'; | |
21 | - // }, | |
19 | + ifShow: (_action) => { | |
20 | + return record.status == '已发布'; | |
21 | + }, | |
22 | 22 | }, |
23 | 23 | { |
24 | 24 | label: '编辑', |
25 | 25 | icon: 'clarity:note-edit-line', |
26 | 26 | onClick: handleEdit.bind(null, record), |
27 | - // ifShow: (_action) => { | |
28 | - // return record.status == '草稿'; | |
29 | - // }, | |
27 | + ifShow: (_action) => { | |
28 | + return record.status == '草稿'; | |
29 | + }, | |
30 | 30 | }, |
31 | 31 | { |
32 | 32 | label: '删除', | ... | ... |
... | ... | @@ -86,20 +86,27 @@ |
86 | 86 | Object.assign(getAllData, values); |
87 | 87 | isJudgeWherePoint.value.forEach((f) => { |
88 | 88 | if (f == 0) { |
89 | - pointArray.value = []; | |
89 | + if (pointArray.value.length == 0) { | |
90 | + pointArray.value = []; | |
91 | + } | |
90 | 92 | } else if (f == 1) { |
91 | 93 | //组织 |
92 | - pointArray.value.push(getAllData.organizationId); | |
94 | + if (pointArray.value.length == 0) { | |
95 | + pointArray.value.push(getAllData.organizationId); | |
96 | + } | |
93 | 97 | } else if (f == 2) { |
94 | 98 | //部门 |
95 | 99 | let findDeptId = newArray.value.find((f) => { |
96 | 100 | return f == isJudgeWherePoint.value[4]; |
97 | 101 | }); |
98 | - console.log(findDeptId); | |
99 | - pointArray.value.push(findDeptId); | |
102 | + if (pointArray.value.length == 0) { | |
103 | + pointArray.value.push(findDeptId); | |
104 | + } | |
100 | 105 | } else if (f == 3) { |
101 | 106 | //个人 |
102 | - pointArray.value = [3]; | |
107 | + if (pointArray.value.length == 0) { | |
108 | + pointArray.value = [3]; | |
109 | + } | |
103 | 110 | } |
104 | 111 | }); |
105 | 112 | getAllData.pointId = pointArray.value; |
... | ... | @@ -109,8 +116,8 @@ |
109 | 116 | emit('success'); |
110 | 117 | resetFields(); |
111 | 118 | setTimeout(() => { |
112 | - pointArray.value = []; | |
113 | - isJudgeWherePoint.value = []; | |
119 | + pointArray.value.length = 0; | |
120 | + isJudgeWherePoint.value.length = 0; | |
114 | 121 | }, 1000); |
115 | 122 | } |
116 | 123 | if (unref(isUpdate)) { |
... | ... | @@ -128,19 +135,27 @@ |
128 | 135 | Object.assign(getAllData, values); |
129 | 136 | isJudgeWherePoint.value.forEach((f) => { |
130 | 137 | if (f == 0) { |
131 | - pointArray.value = []; | |
138 | + if (pointArray.value.length == 0) { | |
139 | + pointArray.value = []; | |
140 | + } | |
132 | 141 | } else if (f == 1) { |
133 | 142 | //组织 |
134 | - pointArray.value.push(getAllData.organizationId); | |
143 | + if (pointArray.value.length == 0) { | |
144 | + pointArray.value.push(getAllData.organizationId); | |
145 | + } | |
135 | 146 | } else if (f == 2) { |
136 | 147 | //部门 |
137 | 148 | let findDeptId = newArray.value.find((f) => { |
138 | 149 | return f == isJudgeWherePoint.value[4]; |
139 | 150 | }); |
140 | - pointArray.value.push(findDeptId); | |
151 | + if (pointArray.value.length == 0) { | |
152 | + pointArray.value.push(findDeptId); | |
153 | + } | |
141 | 154 | } else if (f == 3) { |
142 | 155 | //个人 |
143 | - pointArray.value = [3]; | |
156 | + if (pointArray.value.length == 0) { | |
157 | + pointArray.value = [3]; | |
158 | + } | |
144 | 159 | } |
145 | 160 | }); |
146 | 161 | getAllData.pointId = pointArray.value; | ... | ... |
... | ... | @@ -6,20 +6,17 @@ |
6 | 6 | :title="getTitle" |
7 | 7 | width="800px" |
8 | 8 | > |
9 | - <PageWrapper title="我的通知详情"> | |
9 | + <PageWrapper title="站内通知详情"> | |
10 | 10 | <Description @register="register1" class="mt-4" /> |
11 | 11 | </PageWrapper> |
12 | - <BasicTable :columns="columns" :dataSource="tableData"> | |
13 | - <span></span> | |
14 | - </BasicTable> | |
15 | 12 | </BasicDrawer> |
16 | 13 | </template> |
17 | 14 | <script lang="ts"> |
18 | 15 | import { defineComponent, ref, computed, unref } from 'vue'; |
19 | 16 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
20 | - import { BasicTable } from '/@/components/Table'; | |
21 | 17 | import { Description, DescItem, useDescription } from '/@/components/Description/index'; |
22 | 18 | import { PageWrapper } from '/@/components/Page'; |
19 | + import { noticeByIdGetInfo } from '/@/api/stationnotification/stationnotifyApi'; | |
23 | 20 | |
24 | 21 | const schema: DescItem[] = [ |
25 | 22 | { |
... | ... | @@ -51,46 +48,47 @@ |
51 | 48 | : ''; |
52 | 49 | }, |
53 | 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 | + }, | |
54 | 67 | ]; |
55 | - | |
56 | 68 | export default defineComponent({ |
57 | 69 | name: 'ConfigDrawer', |
58 | - components: { BasicDrawer, BasicTable, Description, PageWrapper }, | |
70 | + components: { BasicDrawer, Description, PageWrapper }, | |
59 | 71 | emits: ['success', 'register'], |
60 | 72 | 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 | - ]; | |
73 | + let descInfo = ref(null); | |
76 | 74 | const isUpdate = ref(true); |
75 | + | |
77 | 76 | const [registerDrawer, { setDrawerProps }] = useDrawerInner(async (data) => { |
78 | 77 | setDrawerProps({ confirmLoading: false }); |
79 | 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 | 82 | const getTitle = computed(() => (!unref(isUpdate) ? '查看通知' : '查看通知')); |
83 | 83 | const [register1] = useDescription({ |
84 | 84 | title: '详情', |
85 | 85 | bordered: false, |
86 | - data: tableData, | |
86 | + data: descInfo, | |
87 | 87 | schema: schema, |
88 | 88 | }); |
89 | 89 | return { |
90 | 90 | register1, |
91 | - tableData, | |
92 | 91 | getTitle, |
93 | - columns, | |
94 | 92 | registerDrawer, |
95 | 93 | }; |
96 | 94 | }, | ... | ... |
... | ... | @@ -13,17 +13,19 @@ |
13 | 13 | v-model:value="model[field]" |
14 | 14 | :treeData="treeData" |
15 | 15 | :replaceFields="{ title: 'menuName' }" |
16 | - :checked-keys="roleMenus" | |
16 | + :checkedkeys="roleMenus" | |
17 | 17 | checkable |
18 | 18 | toolbar |
19 | + ref="tree" | |
19 | 20 | title="菜单分配" |
21 | + @check="handleCheckClick" | |
20 | 22 | /> |
21 | 23 | </template> |
22 | 24 | </BasicForm> |
23 | 25 | </BasicDrawer> |
24 | 26 | </template> |
25 | 27 | <script lang="ts"> |
26 | - import { defineComponent, ref, computed, unref } from 'vue'; | |
28 | + import { defineComponent, ref, computed, unref, getCurrentInstance } from 'vue'; | |
27 | 29 | import { BasicForm, useForm } from '/@/components/Form/index'; |
28 | 30 | import { formSchema } from './role.data'; |
29 | 31 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
... | ... | @@ -44,10 +46,13 @@ |
44 | 46 | components: { BasicDrawer, BasicForm, BasicTree }, |
45 | 47 | emits: ['success', 'register'], |
46 | 48 | setup(_, { emit }) { |
49 | + const { proxy } = getCurrentInstance(); | |
50 | + | |
47 | 51 | const isUpdate = ref(true); |
48 | 52 | const treeData = ref<TreeItem[]>([]); |
49 | 53 | const roleMenus = ref<string[]>([]); |
50 | 54 | const roleId = ref(''); |
55 | + const allCheckedKeys = ref<string[]>([]); | |
51 | 56 | |
52 | 57 | const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({ |
53 | 58 | labelWidth: 90, |
... | ... | @@ -66,6 +71,16 @@ |
66 | 71 | }); |
67 | 72 | } |
68 | 73 | |
74 | + /** | |
75 | + * 根据角色id获取所有的菜单ids----里面包含父级id---会造成回显数据时 | |
76 | + * 存在父级id则默认勾选所有子级id | |
77 | + */ | |
78 | + function useChildrenIdsRemoveParentId(str, arr) { | |
79 | + let index = arr.indexOf(str); | |
80 | + arr.splice(index, 1); | |
81 | + return arr; | |
82 | + } | |
83 | + | |
69 | 84 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { |
70 | 85 | resetFields(); |
71 | 86 | roleId.value = ''; |
... | ... | @@ -86,16 +101,35 @@ |
86 | 101 | }); |
87 | 102 | treeData.value = treeValues; |
88 | 103 | } |
89 | - if (data.record) { | |
90 | - roleMenus.value = await getMenusIdsByRoleId(data.record.id); | |
91 | - roleId.value = data.record.id; | |
92 | - } | |
93 | - isUpdate.value = !!data?.isUpdate; | |
94 | 104 | if (unref(isUpdate)) { |
105 | + if (data.record) { | |
106 | + //通过角色id去获取角色对应的菜单的ids | |
107 | + roleMenus.value = await getMenusIdsByRoleId(data.record.id); | |
108 | + treeData.value.map((m) => { | |
109 | + roleMenus.value.map((m1) => { | |
110 | + if (m.key === m1) { | |
111 | + proxy.useChildrenIdsRemoveParentId(m1, roleMenus.value); | |
112 | + } | |
113 | + }); | |
114 | + }); | |
115 | + proxy.$refs.tree.setCheckedKeys(roleMenus.value); | |
116 | + roleId.value = data.record.id; | |
117 | + } | |
95 | 118 | setFieldsValue({ |
96 | 119 | ...data.record, |
97 | 120 | }); |
98 | 121 | } |
122 | + | |
123 | + // if (data.record) { | |
124 | + // roleMenus.value = await getMenusIdsByRoleId(data.record.id); | |
125 | + // roleId.value = data.record.id; | |
126 | + // } | |
127 | + // isUpdate.value = !!data?.isUpdate; | |
128 | + // if (unref(isUpdate)) { | |
129 | + // setFieldsValue({ | |
130 | + // ...data.record, | |
131 | + // }); | |
132 | + // } | |
99 | 133 | }); |
100 | 134 | |
101 | 135 | const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色')); |
... | ... | @@ -110,7 +144,7 @@ |
110 | 144 | remark: values.remark, |
111 | 145 | status: values.status, |
112 | 146 | roleType: RoleEnum.ROLE_TENANT_ADMIN, |
113 | - menu: [...values.menu], | |
147 | + menu: allCheckedKeys.value as string[], | |
114 | 148 | }; |
115 | 149 | console.log(req, '请求参数'); |
116 | 150 | saveOrUpdateRoleInfoWithMenu(req).then(() => { |
... | ... | @@ -121,8 +155,25 @@ |
121 | 155 | setDrawerProps({ confirmLoading: false }); |
122 | 156 | } |
123 | 157 | } |
158 | + // Tree check事件 | |
159 | + const handleCheckClick = (_, e) => { | |
160 | + allCheckedKeys.value = []; | |
161 | + let nodes = e.checkedNodes; | |
162 | + let halfKeys = e.halfCheckedKeys; | |
163 | + nodes.map((node) => { | |
164 | + if (node.key != halfKeys[0] && halfKeys.length == []) { | |
165 | + allCheckedKeys.value.push(node.key); | |
166 | + } else { | |
167 | + allCheckedKeys.value.push(node.key); | |
168 | + } | |
169 | + }); | |
170 | + allCheckedKeys.value.push(...halfKeys); | |
171 | + }; | |
124 | 172 | |
125 | 173 | return { |
174 | + allCheckedKeys, | |
175 | + useChildrenIdsRemoveParentId, | |
176 | + handleCheckClick, | |
126 | 177 | registerDrawer, |
127 | 178 | registerForm, |
128 | 179 | getTitle, | ... | ... |