Commit f46761aa00af8a5de9b8a2e6d1e37c10a28d74bc
1 parent
414440ca
fix:修改一些验证(alarm/config,alarm/contacts),fix:修改设备管理凭证400提示(device/list/cpns/model…
…/MangeDevice,fix:修改通知管理,notice/manager/index
Showing
12 changed files
with
63 additions
and
60 deletions
@@ -141,19 +141,18 @@ | @@ -141,19 +141,18 @@ | ||
141 | }; | 141 | }; |
142 | const useSelectionChange = () => { | 142 | const useSelectionChange = () => { |
143 | let getRows = getSelectRows(); | 143 | let getRows = getSelectRows(); |
144 | - getRows.forEach((f) => { | ||
145 | - if (f.status == 1 && f.status !== 0) { | ||
146 | - hasBatchDelete.value = true; | ||
147 | - } else if (f.status == 0 && f.status !== 1) { | ||
148 | - hasBatchDelete.value = false; | ||
149 | - } else if (f.status == 0 && f.status == 1) { | ||
150 | - hasBatchDelete.value = true; | ||
151 | - } | ||
152 | - }); | ||
153 | - selectArray = getRows.filter((f) => f.status !== 1).map((m) => m.id); | ||
154 | - if (selectArray.length == 0) { | 144 | + const isJudge = getRows.map((m) => m.status); |
145 | + if (isJudge.length === 0) { | ||
155 | hasBatchDelete.value = true; | 146 | hasBatchDelete.value = true; |
156 | } | 147 | } |
148 | + if (isJudge.includes(1) && isJudge.includes(0)) { | ||
149 | + hasBatchDelete.value = true; | ||
150 | + } else if (isJudge.includes(1) && !isJudge.includes(0)) { | ||
151 | + hasBatchDelete.value = true; | ||
152 | + } else if (!isJudge.includes(1) && isJudge.includes(0)) { | ||
153 | + hasBatchDelete.value = false; | ||
154 | + } | ||
155 | + selectArray = getRows.filter((f) => f.status !== 1).map((m) => m.id); | ||
157 | }; | 156 | }; |
158 | // 删除或批量删除 | 157 | // 删除或批量删除 |
159 | const handleDeleteOrBatchDelete = async (record: Recordable | null) => { | 158 | const handleDeleteOrBatchDelete = async (record: Recordable | null) => { |
@@ -162,9 +161,7 @@ | @@ -162,9 +161,7 @@ | ||
162 | await deleteAlarmConfig([record.id]); | 161 | await deleteAlarmConfig([record.id]); |
163 | createMessage.success('删除成功'); | 162 | createMessage.success('删除成功'); |
164 | handleSuccess(); | 163 | handleSuccess(); |
165 | - } catch (e: any) { | ||
166 | - // createMessage.error(e.msg); | ||
167 | - } | 164 | + } catch (e: any) {} |
168 | } else { | 165 | } else { |
169 | try { | 166 | try { |
170 | await deleteAlarmConfig(selectArray); | 167 | await deleteAlarmConfig(selectArray); |
@@ -172,7 +169,6 @@ | @@ -172,7 +169,6 @@ | ||
172 | handleSuccess(); | 169 | handleSuccess(); |
173 | selectArray.length = 0; | 170 | selectArray.length = 0; |
174 | } catch (e: any) { | 171 | } catch (e: any) { |
175 | - // createMessage.error(e.msg); | ||
176 | selectArray.length = 0; | 172 | selectArray.length = 0; |
177 | } finally { | 173 | } finally { |
178 | selectArray.length = 0; | 174 | selectArray.length = 0; |
@@ -77,6 +77,7 @@ export const formSchema: FormSchema[] = [ | @@ -77,6 +77,7 @@ export const formSchema: FormSchema[] = [ | ||
77 | { | 77 | { |
78 | field: 'organizationId', | 78 | field: 'organizationId', |
79 | label: '所属组织', | 79 | label: '所属组织', |
80 | + required: true, | ||
80 | component: 'ApiTreeSelect', | 81 | component: 'ApiTreeSelect', |
81 | componentProps: { | 82 | componentProps: { |
82 | api: async () => { | 83 | api: async () => { |
@@ -6,17 +6,17 @@ import { DeviceTypeEnum, DeviceState } from '/@/api/device/model/deviceModel'; | @@ -6,17 +6,17 @@ import { DeviceTypeEnum, DeviceState } from '/@/api/device/model/deviceModel'; | ||
6 | // 表格列数据 | 6 | // 表格列数据 |
7 | export const columns: BasicColumn[] = [ | 7 | export const columns: BasicColumn[] = [ |
8 | { | 8 | { |
9 | - title: '设备名称', | ||
10 | - dataIndex: 'name', | ||
11 | - width: 120, | ||
12 | - }, | ||
13 | - { | ||
14 | title: '设备图片', | 9 | title: '设备图片', |
15 | dataIndex: 'deviceInfo.avatar', | 10 | dataIndex: 'deviceInfo.avatar', |
16 | width: 120, | 11 | width: 120, |
17 | slots: { customRender: 'img' }, | 12 | slots: { customRender: 'img' }, |
18 | }, | 13 | }, |
19 | { | 14 | { |
15 | + title: '设备名称', | ||
16 | + dataIndex: 'name', | ||
17 | + width: 120, | ||
18 | + }, | ||
19 | + { | ||
20 | title: '设备类型', | 20 | title: '设备类型', |
21 | dataIndex: 'deviceType', | 21 | dataIndex: 'deviceType', |
22 | width: 100, | 22 | width: 100, |
@@ -171,6 +171,7 @@ | @@ -171,6 +171,7 @@ | ||
171 | ]); | 171 | ]); |
172 | }; | 172 | }; |
173 | const handleOk = async () => { | 173 | const handleOk = async () => { |
174 | + const { createMessage } = useMessage(); | ||
174 | // 验证 | 175 | // 验证 |
175 | const valid = await validate(); | 176 | const valid = await validate(); |
176 | if (!valid) return; | 177 | if (!valid) return; |
@@ -197,14 +198,17 @@ | @@ -197,14 +198,17 @@ | ||
197 | ? field.publicKey | 198 | ? field.publicKey |
198 | : null, | 199 | : null, |
199 | }; | 200 | }; |
200 | - | ||
201 | - await saveDeviceToken(editData); | ||
202 | - const { createMessage } = useMessage(); | ||
203 | - createMessage.success('修改设备凭证成功'); | ||
204 | - | ||
205 | - // 请求 | ||
206 | - closeModal(); | ||
207 | - handleCancel(); | 201 | + saveDeviceToken(editData) |
202 | + .then((res) => { | ||
203 | + if (!res) return; | ||
204 | + createMessage.success('修改设备凭证成功'); | ||
205 | + // 请求 | ||
206 | + closeModal(); | ||
207 | + handleCancel(); | ||
208 | + }) | ||
209 | + .catch((e) => { | ||
210 | + createMessage.error(e); | ||
211 | + }); | ||
208 | }; | 212 | }; |
209 | return { | 213 | return { |
210 | registerModal, | 214 | registerModal, |
@@ -103,7 +103,7 @@ | @@ -103,7 +103,7 @@ | ||
103 | { | 103 | { |
104 | label: '删除', | 104 | label: '删除', |
105 | icon: 'ant-design:delete-outlined', | 105 | icon: 'ant-design:delete-outlined', |
106 | - ifShow: authBtn(role), | 106 | + ifShow: authBtn(role) && record.customerId === undefined, |
107 | color: 'error', | 107 | color: 'error', |
108 | popConfirm: { | 108 | popConfirm: { |
109 | title: '是否确认删除', | 109 | title: '是否确认删除', |
@@ -167,11 +167,17 @@ | @@ -167,11 +167,17 @@ | ||
167 | if (isUpdate.value == 1) { | 167 | if (isUpdate.value == 1) { |
168 | delete postDeviceConfogData.id; | 168 | delete postDeviceConfogData.id; |
169 | } | 169 | } |
170 | - await deviceConfigAddOrEdit(postDeviceConfogData); | ||
171 | - createMessage.success(isUpdate.value == 1 ? '新增' + '成功' : '编辑' + '成功'); | ||
172 | - closeModal(); | ||
173 | - emit('success'); | ||
174 | - isNextStatus.value = false; | 170 | + deviceConfigAddOrEdit(postDeviceConfogData) |
171 | + .then((res) => { | ||
172 | + if (!res) return; | ||
173 | + createMessage.success(isUpdate.value == 1 ? '新增' + '成功' : '编辑' + '成功'); | ||
174 | + closeModal(); | ||
175 | + emit('success'); | ||
176 | + isNextStatus.value = false; | ||
177 | + }) | ||
178 | + .catch((e) => { | ||
179 | + createMessage.error(e); | ||
180 | + }); | ||
175 | }; | 181 | }; |
176 | const handleCancel = () => { | 182 | const handleCancel = () => { |
177 | nextTick(() => { | 183 | nextTick(() => { |
@@ -6,17 +6,17 @@ import { numberRule } from '/@/utils/rules'; | @@ -6,17 +6,17 @@ import { numberRule } from '/@/utils/rules'; | ||
6 | 6 | ||
7 | export const columns: BasicColumn[] = [ | 7 | export const columns: BasicColumn[] = [ |
8 | { | 8 | { |
9 | - title: '名称', | ||
10 | - dataIndex: 'name', | ||
11 | - width: 120, | ||
12 | - }, | ||
13 | - { | ||
14 | title: '配置图片', //图标 | 9 | title: '配置图片', //图标 |
15 | dataIndex: 'image', | 10 | dataIndex: 'image', |
16 | width: 80, | 11 | width: 80, |
17 | slots: { customRender: 'img' }, | 12 | slots: { customRender: 'img' }, |
18 | }, | 13 | }, |
19 | { | 14 | { |
15 | + title: '名称', | ||
16 | + dataIndex: 'name', | ||
17 | + width: 120, | ||
18 | + }, | ||
19 | + { | ||
20 | title: '配置类型', | 20 | title: '配置类型', |
21 | dataIndex: 'type', | 21 | dataIndex: 'type', |
22 | width: 90, | 22 | width: 90, |
@@ -98,6 +98,7 @@ | @@ -98,6 +98,7 @@ | ||
98 | const getPathUrlName = ref(''); | 98 | const getPathUrlName = ref(''); |
99 | const disabled = ref(true); | 99 | const disabled = ref(true); |
100 | const onCloseVal = ref(0); | 100 | const onCloseVal = ref(0); |
101 | + const immediateStatus = ref(false); | ||
101 | 102 | ||
102 | const { createMessage } = useMessage(); | 103 | const { createMessage } = useMessage(); |
103 | const [registerModal, { openModal }] = useModal(); | 104 | const [registerModal, { openModal }] = useModal(); |
@@ -106,6 +107,7 @@ | @@ -106,6 +107,7 @@ | ||
106 | title: '设备配置列表', | 107 | title: '设备配置列表', |
107 | clickToRowSelect: false, | 108 | clickToRowSelect: false, |
108 | api: deviceConfigGetQuery, | 109 | api: deviceConfigGetQuery, |
110 | + immediate: immediateStatus.value, | ||
109 | columns, | 111 | columns, |
110 | formConfig: { | 112 | formConfig: { |
111 | labelWidth: 120, | 113 | labelWidth: 120, |
@@ -162,12 +164,13 @@ | @@ -162,12 +164,13 @@ | ||
162 | resetFields(); | 164 | resetFields(); |
163 | } | 165 | } |
164 | }); | 166 | }); |
167 | + } else { | ||
168 | + setTimeout(() => { | ||
169 | + reload(); | ||
170 | + }, 80); | ||
165 | } | 171 | } |
166 | }; | 172 | }; |
167 | - setTimeout(() => { | ||
168 | - setRowClassName(); | ||
169 | - }, 500); | ||
170 | - | 173 | + setRowClassName(); |
171 | onUnmounted(() => { | 174 | onUnmounted(() => { |
172 | getPathUrlName.value = ''; | 175 | getPathUrlName.value = ''; |
173 | onCloseVal.value = 1; | 176 | onCloseVal.value = 1; |
@@ -91,7 +91,7 @@ | @@ -91,7 +91,7 @@ | ||
91 | } | 91 | } |
92 | const isLt2M = (file.size as number) / 1024 / 1024 < 2; | 92 | const isLt2M = (file.size as number) / 1024 / 1024 < 2; |
93 | if (!isLt2M) { | 93 | if (!isLt2M) { |
94 | - createMessage.error('图片大小不能超过5MB!'); | 94 | + createMessage.error('图片大小不能超过2MB!'); |
95 | } | 95 | } |
96 | return isJpgOrPng && isLt2M; | 96 | return isJpgOrPng && isLt2M; |
97 | }; | 97 | }; |
@@ -15,7 +15,8 @@ | @@ -15,7 +15,8 @@ | ||
15 | icon: 'ant-design:eye-outlined', | 15 | icon: 'ant-design:eye-outlined', |
16 | onClick: handleView.bind(null, record), | 16 | onClick: handleView.bind(null, record), |
17 | ifShow: (_action) => { | 17 | ifShow: (_action) => { |
18 | - return record.status === 1 && rolePermission == 'CUSTOMER_USER'; | 18 | + const isCurrent = record.status === 1 && record.creator === userId; |
19 | + return isCurrent; | ||
19 | }, | 20 | }, |
20 | }, | 21 | }, |
21 | { | 22 | { |
@@ -23,14 +24,15 @@ | @@ -23,14 +24,15 @@ | ||
23 | icon: 'clarity:note-edit-line', | 24 | icon: 'clarity:note-edit-line', |
24 | onClick: handleEdit.bind(null, record), | 25 | onClick: handleEdit.bind(null, record), |
25 | ifShow: (_action) => { | 26 | ifShow: (_action) => { |
26 | - return record.status === 0 && record.creator == userId; | 27 | + const isCurrent = record.status === 0 && record.creator === userId; |
28 | + return isCurrent; | ||
27 | }, | 29 | }, |
28 | }, | 30 | }, |
29 | { | 31 | { |
30 | label: '删除', | 32 | label: '删除', |
31 | icon: 'ant-design:delete-outlined', | 33 | icon: 'ant-design:delete-outlined', |
32 | color: 'error', | 34 | color: 'error', |
33 | - ifShow: record.creator == userId, | 35 | + ifShow: record.creator === userId, |
34 | popConfirm: { | 36 | popConfirm: { |
35 | title: '是否确认删除', | 37 | title: '是否确认删除', |
36 | confirm: handleDeleteOrBatchDelete.bind(null, record), | 38 | confirm: handleDeleteOrBatchDelete.bind(null, record), |
@@ -49,7 +51,7 @@ | @@ -49,7 +51,7 @@ | ||
49 | </div> | 51 | </div> |
50 | </template> | 52 | </template> |
51 | <script lang="ts"> | 53 | <script lang="ts"> |
52 | - import { defineComponent, ref, computed } from 'vue'; | 54 | + import { defineComponent, ref } from 'vue'; |
53 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 55 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
54 | import { useDrawer } from '/@/components/Drawer'; | 56 | import { useDrawer } from '/@/components/Drawer'; |
55 | import NotifyManagerDrawer from './useDrawer.vue'; | 57 | import NotifyManagerDrawer from './useDrawer.vue'; |
@@ -59,22 +61,14 @@ | @@ -59,22 +61,14 @@ | ||
59 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | 61 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
60 | import { USER_INFO_KEY } from '/@/enums/cacheEnum'; | 62 | import { USER_INFO_KEY } from '/@/enums/cacheEnum'; |
61 | import { getAuthCache } from '/@/utils/auth'; | 63 | import { getAuthCache } from '/@/utils/auth'; |
62 | - import { RoleEnum } from '/@/enums/roleEnum'; | ||
63 | - import { usePermission } from '/@/hooks/web/usePermission'; | ||
64 | - import { useUserStore } from '/@/store/modules/user'; | ||
65 | 64 | ||
66 | export default defineComponent({ | 65 | export default defineComponent({ |
67 | name: 'Notificationmannager', | 66 | name: 'Notificationmannager', |
68 | components: { BasicTable, NotifyManagerDrawer, TableAction, tableViewChild }, | 67 | components: { BasicTable, NotifyManagerDrawer, TableAction, tableViewChild }, |
69 | setup() { | 68 | setup() { |
70 | - const { hasPermission } = usePermission(); | ||
71 | - const userStore = useUserStore(); | ||
72 | - const isTenant = computed(() => userStore.getRoleList.includes(RoleEnum.TENANT_ADMIN)); | ||
73 | - const isCustomer = computed(() => userStore.getRoleList.includes(RoleEnum.CUSTOMER_USER)); | ||
74 | const userInfo: any = getAuthCache(USER_INFO_KEY); | 69 | const userInfo: any = getAuthCache(USER_INFO_KEY); |
75 | const userId = userInfo.userId; | 70 | const userId = userInfo.userId; |
76 | const tenantId = userInfo.tenantId; | 71 | const tenantId = userInfo.tenantId; |
77 | - const rolePermission: string = userInfo.roles[0]; | ||
78 | const [registerDrawer, { openDrawer }] = useDrawer(); | 72 | const [registerDrawer, { openDrawer }] = useDrawer(); |
79 | const [registerAdd, { openDrawer: openDrawerAdd }] = useDrawer(); | 73 | const [registerAdd, { openDrawer: openDrawerAdd }] = useDrawer(); |
80 | // 批量删除 | 74 | // 批量删除 |
@@ -137,12 +131,8 @@ | @@ -137,12 +131,8 @@ | ||
137 | handleSuccess, | 131 | handleSuccess, |
138 | handleDeleteOrBatchDelete, | 132 | handleDeleteOrBatchDelete, |
139 | NotifyManagerDrawerRef, | 133 | NotifyManagerDrawerRef, |
140 | - rolePermission, | ||
141 | userId, | 134 | userId, |
142 | tenantId, | 135 | tenantId, |
143 | - hasPermission, | ||
144 | - isTenant, | ||
145 | - isCustomer, | ||
146 | }; | 136 | }; |
147 | }, | 137 | }, |
148 | }); | 138 | }); |
@@ -380,6 +380,7 @@ export const modeMqttForm: FormSchema[] = [ | @@ -380,6 +380,7 @@ export const modeMqttForm: FormSchema[] = [ | ||
380 | component: 'Select', | 380 | component: 'Select', |
381 | label: 'type', | 381 | label: 'type', |
382 | colProps: { span: 12 }, | 382 | colProps: { span: 12 }, |
383 | + defaultValue: 'anonymous', | ||
383 | componentProps: { | 384 | componentProps: { |
384 | placeholder: '请选择Credentials', | 385 | placeholder: '请选择Credentials', |
385 | options: [ | 386 | options: [ |
@@ -898,6 +899,7 @@ export const modeApiForm: FormSchema[] = [ | @@ -898,6 +899,7 @@ export const modeApiForm: FormSchema[] = [ | ||
898 | component: 'Select', | 899 | component: 'Select', |
899 | label: 'type', | 900 | label: 'type', |
900 | colProps: { span: 12 }, | 901 | colProps: { span: 12 }, |
902 | + defaultValue: 'anonymous', | ||
901 | componentProps: { | 903 | componentProps: { |
902 | placeholder: '请选择Number of acknowledgments', | 904 | placeholder: '请选择Number of acknowledgments', |
903 | options: [ | 905 | options: [ |
@@ -122,6 +122,7 @@ export const schemas: FormSchema[] = [ | @@ -122,6 +122,7 @@ export const schemas: FormSchema[] = [ | ||
122 | { | 122 | { |
123 | field: 'prov', | 123 | field: 'prov', |
124 | label: '所在城市', | 124 | label: '所在城市', |
125 | + required: true, | ||
125 | component: 'Input', | 126 | component: 'Input', |
126 | colProps: { | 127 | colProps: { |
127 | span: 24, | 128 | span: 24, |