Commit 4fd8d1e5a4f1f9ee24c232f91311f64487cd8e5a
Merge branch 'f-dev' into 'main'
fix:修改teambition上的问题 See merge request huang/yun-teng-iot-front!234
Showing
10 changed files
with
136 additions
and
60 deletions
... | ... | @@ -111,7 +111,8 @@ export const getOrganizationAlarmConfig = (params: { organizationId }) => { |
111 | 111 | * 获取设备属性列表 |
112 | 112 | */ |
113 | 113 | export const getAttribute = (orgId, deviceIds) => { |
114 | + const joinText = deviceIds == null ? [] : '?deviceIds=' + deviceIds; | |
114 | 115 | return defHttp.get({ |
115 | - url: ScreenManagerApi.GET_ATTRBUTELIST + '/' + orgId + '?' + deviceIds, | |
116 | + url: ScreenManagerApi.GET_ATTRBUTELIST + '/' + orgId + joinText, | |
116 | 117 | }); |
117 | 118 | }; | ... | ... |
... | ... | @@ -58,7 +58,7 @@ export const phoneRule: Rule[] = [ |
58 | 58 | export const emailRule: Rule[] = [ |
59 | 59 | { |
60 | 60 | validator: (_, value: string) => { |
61 | - const reg = /^[a-zA-Z0-9]+([-_.][A-Za-zd]+)*@([a-zA-Z0-9]+[-.])+[A-Za-zd]{2,5}$/; | |
61 | + const reg = /^\w{3,}(\.\w+)*@[A-z0-9]+(\.[A-z]{2,5}){1,2}$/; | |
62 | 62 | if (!value) { |
63 | 63 | return Promise.resolve(); |
64 | 64 | } else if (!reg.test(value)) { | ... | ... |
... | ... | @@ -7,6 +7,7 @@ |
7 | 7 | search |
8 | 8 | :clickRowToExpand="false" |
9 | 9 | :treeData="treeData" |
10 | + :expandedKeys="treeExpandData" | |
10 | 11 | :replaceFields="{ key: 'id', title: 'name' }" |
11 | 12 | :selectedKeys="selectedKeys" |
12 | 13 | @select="handleSelect" |
... | ... | @@ -20,17 +21,25 @@ |
20 | 21 | const emit = defineEmits(['select']); |
21 | 22 | const treeData = ref<TreeItem[]>([]); |
22 | 23 | const selectedKeys = ref<string[]>(); |
23 | - | |
24 | + const treeExpandData = ref([]); | |
25 | + //获取所有父级id | |
26 | + function findForAllId(data = [], arr = []) { | |
27 | + for (const item of data) { | |
28 | + arr.push(item.id); | |
29 | + } | |
30 | + return arr; | |
31 | + } | |
24 | 32 | function handleSelect(keys) { |
25 | 33 | emit('select', keys[0]); |
26 | 34 | } |
27 | - | |
28 | 35 | function resetOrganization() { |
29 | 36 | selectedKeys.value = []; |
30 | 37 | } |
31 | - | |
32 | 38 | onMounted(async () => { |
33 | 39 | treeData.value = (await getOrganizationList()) as unknown as TreeItem[]; |
40 | + const getAllIds = findForAllId(treeData.value as any, []); | |
41 | + //设置要展开的id | |
42 | + treeExpandData.value = getAllIds; | |
34 | 43 | }); |
35 | 44 | defineExpose({ |
36 | 45 | resetOrganization, | ... | ... |
... | ... | @@ -204,12 +204,12 @@ |
204 | 204 | const helpDoc = ref([ |
205 | 205 | { |
206 | 206 | title: '如何接入设备?', |
207 | - href: 'https://docs.thingskit.com/', | |
207 | + href: 'https://docs.thingskit.com/thingskit-link/operation-guide/device-manage.html#%E8%AE%BE%E5%A4%87%E5%88%97%E8%A1%A8', | |
208 | 208 | target: '_blank ', |
209 | 209 | }, |
210 | 210 | { |
211 | 211 | title: '什么是设备配置?', |
212 | - href: 'https://docs.thingskit.com/', | |
212 | + href: 'https://docs.thingskit.com/thingskit-link/operation-guide/device-manage.html#%E8%AE%BE%E5%A4%87%E9%85%8D%E7%BD%AE', | |
213 | 213 | target: '_blank ', |
214 | 214 | }, |
215 | 215 | { | ... | ... |
... | ... | @@ -270,11 +270,11 @@ |
270 | 270 | try { |
271 | 271 | // 该设备是否正在被场景联动使用中? |
272 | 272 | const isEnabled = await checkDeviceOccupied(record.id); |
273 | - if (!isEnabled) { | |
273 | + if (!isEnabled.data) { | |
274 | + createMessage.warn(`${isEnabled.message}`); | |
275 | + } else { | |
274 | 276 | await cancelDispatchCustomer(record); |
275 | 277 | handleReload(); |
276 | - } else { | |
277 | - createMessage.warn('该设备正在使用中~'); | |
278 | 278 | } |
279 | 279 | } catch {} |
280 | 280 | } | ... | ... |
... | ... | @@ -18,7 +18,9 @@ |
18 | 18 | @click="handleDeleteOrBatchDelete(null)" |
19 | 19 | :disabled="singleStopDeleteStatus || hasBatchDelete" |
20 | 20 | > |
21 | - 批量删除 | |
21 | + <span :style="{ color: singleStopDeleteStatus || hasBatchDelete ? 'grey' : 'white' }" | |
22 | + >批量删除</span | |
23 | + > | |
22 | 24 | </a-button> |
23 | 25 | </Authority> |
24 | 26 | <a-button |
... | ... | @@ -128,6 +130,7 @@ |
128 | 130 | let isJudgeSelectRowsArr: any = ref([]); |
129 | 131 | const handleSuccess = () => { |
130 | 132 | reload(); |
133 | + resetSelectedRowKeys(); | |
131 | 134 | }; |
132 | 135 | const [registerModal, { openModal }] = useModal(); |
133 | 136 | const [ |
... | ... | @@ -155,16 +158,14 @@ |
155 | 158 | fixed: 'right', |
156 | 159 | }, |
157 | 160 | }); |
158 | - const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( | |
159 | - deleteConvertApi, | |
160 | - handleSuccess, | |
161 | - setProps | |
162 | - ); | |
161 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions, resetSelectedRowKeys } = | |
162 | + useBatchDelete(deleteConvertApi, handleSuccess, setProps); | |
163 | 163 | selectionOptions.rowSelection.getCheckboxProps = (record: Recordable) => { |
164 | - // Demo:status为1的选择框禁用 | |
164 | + //status为1的选择框禁用 | |
165 | 165 | if (record.status === 1) { |
166 | 166 | return { disabled: true }; |
167 | 167 | } else { |
168 | + disabledStatus2.value = true; | |
168 | 169 | singleStopDeleteStatus.value = false; |
169 | 170 | return { disabled: false }; |
170 | 171 | } |
... | ... | @@ -204,8 +205,13 @@ |
204 | 205 | if (res !== '') { |
205 | 206 | createMessage.success('流转配置启用成功'); |
206 | 207 | setLoading(false); |
207 | - reload(); | |
208 | + handleSuccess(); | |
209 | + singleStopDeleteStatus.value = true; | |
208 | 210 | disabledStatus1.value = true; |
211 | + disabledStatus2.value = true; | |
212 | + disabledStatus3.value = true; | |
213 | + resetSelectedRowKeys(); | |
214 | + clearSelectedRowKeys(); | |
209 | 215 | } else { |
210 | 216 | createMessage.error('流转配置启用失败'); |
211 | 217 | } |
... | ... | @@ -228,7 +234,13 @@ |
228 | 234 | if (res !== '') { |
229 | 235 | createMessage.success('流转配置禁用成功'); |
230 | 236 | setLoading(false); |
231 | - reload(); | |
237 | + handleSuccess(); | |
238 | + singleStopDeleteStatus.value = true; | |
239 | + disabledStatus1.value = true; | |
240 | + disabledStatus2.value = true; | |
241 | + disabledStatus3.value = true; | |
242 | + resetSelectedRowKeys(); | |
243 | + clearSelectedRowKeys(); | |
232 | 244 | } else { |
233 | 245 | createMessage.error('流转配置禁用失败'); |
234 | 246 | } |
... | ... | @@ -287,7 +299,7 @@ |
287 | 299 | if (res !== '') { |
288 | 300 | createMessage.success('流转配置多项禁用成功'); |
289 | 301 | setLoading(false); |
290 | - reload(); | |
302 | + handleSuccess(); | |
291 | 303 | } else { |
292 | 304 | createMessage.error('流转配置多项禁用失败'); |
293 | 305 | } |
... | ... | @@ -314,7 +326,7 @@ |
314 | 326 | if (res !== '') { |
315 | 327 | createMessage.success('流转配置多项启用成功'); |
316 | 328 | setLoading(false); |
317 | - reload(); | |
329 | + handleSuccess(); | |
318 | 330 | disabledStatus1.value = true; |
319 | 331 | singleStopDeleteStatus.value = true; |
320 | 332 | } else { | ... | ... |
... | ... | @@ -169,7 +169,6 @@ |
169 | 169 | organizationId, |
170 | 170 | triggers.map((m) => m.entityId).join(',') |
171 | 171 | ); |
172 | - | |
173 | 172 | // 生成回显时对应得组件数量 |
174 | 173 | triggerData.value = [...new Array(triggers.length).keys()]; |
175 | 174 | conditionData.value = [...new Array(doConditions.length).keys()]; |
... | ... | @@ -194,6 +193,8 @@ |
194 | 193 | }; |
195 | 194 | }); |
196 | 195 | deviceList.value = editEntryIdData.value; |
196 | + deviceExcludeDoAction.value = editEntryIdExcludeDoActionData.value; | |
197 | + | |
197 | 198 | //回显属性列表 |
198 | 199 | editAttrIdData = attrList; |
199 | 200 | nextTick(() => { |
... | ... | @@ -538,7 +539,6 @@ |
538 | 539 | function setFields(linkAge, isOrganizationChange = false) { |
539 | 540 | unref(linkAge).map((item) => { |
540 | 541 | isOrganizationChange && item.resetFieldsValueFunc(); |
541 | - console.log(item); | |
542 | 542 | if (item.isTriggerAndConditionFlag == 'isTriggerAndConditionFlag') { |
543 | 543 | item.updateExcludeActionFieldDeviceId(deviceExcludeDoAction); |
544 | 544 | } else { | ... | ... |
1 | 1 | import { BasicColumn, FormSchema } from '/@/components/Table'; |
2 | 2 | import moment from 'moment'; |
3 | +import { findDictItemByCode } from '/@/api/system/dict'; | |
3 | 4 | |
5 | +//格式化资源类型和操作类型 | |
6 | +let formatText; | |
7 | +let actionTypeText; | |
8 | +async function formatTextFunc() { | |
9 | + formatText = await findDictItemByCode({ dictCode: 'operate_log' }); | |
10 | + actionTypeText = await findDictItemByCode({ dictCode: 'exception_log' }); | |
11 | +} | |
12 | +formatTextFunc(); | |
4 | 13 | // 表格数据 |
5 | 14 | export const columns: BasicColumn[] = [ |
6 | 15 | { |
... | ... | @@ -17,6 +26,14 @@ export const columns: BasicColumn[] = [ |
17 | 26 | title: '资源类型', |
18 | 27 | dataIndex: 'entityType', |
19 | 28 | width: 180, |
29 | + format: (_, record) => { | |
30 | + const text = formatText.find((f) => { | |
31 | + if (f.itemValue == record.entityType) { | |
32 | + return f.itemText; | |
33 | + } | |
34 | + }); | |
35 | + return text?.itemText; | |
36 | + }, | |
20 | 37 | }, |
21 | 38 | { |
22 | 39 | title: '资源名称', |
... | ... | @@ -32,18 +49,29 @@ export const columns: BasicColumn[] = [ |
32 | 49 | title: '操作类型', |
33 | 50 | dataIndex: 'actionType', |
34 | 51 | width: 180, |
52 | + format: (_, record) => { | |
53 | + const text = actionTypeText.find((f) => { | |
54 | + if (f.itemValue == record.actionType) { | |
55 | + return f.itemText; | |
56 | + } | |
57 | + }); | |
58 | + return text?.itemText; | |
59 | + }, | |
35 | 60 | }, |
36 | 61 | { |
37 | 62 | title: '操作状态', |
38 | 63 | dataIndex: 'actionStatus', |
39 | 64 | width: 180, |
65 | + format: (_, record) => { | |
66 | + return record.actionStatus == 'SUCCESS' ? '成功' : '失败'; | |
67 | + }, | |
40 | 68 | }, |
41 | 69 | { |
42 | 70 | title: '操作时间', |
43 | 71 | dataIndex: 'createdTime', |
44 | - width: 80, | |
72 | + width: 180, | |
45 | 73 | format: (_, record) => { |
46 | - return moment(record.createdTime).format('YYYY-MM-DD'); | |
74 | + return moment(record.createdTime).format('YYYY-MM-DD-HH-MM-ss'); | |
47 | 75 | }, |
48 | 76 | }, |
49 | 77 | ]; | ... | ... |
1 | 1 | import { BasicColumn, FormSchema } from '/@/components/Table'; |
2 | 2 | import moment from 'moment'; |
3 | +import { findDictItemByCode } from '/@/api/system/dict'; | |
3 | 4 | |
5 | +//格式化资源类型和操作类型 | |
6 | +let formatText; | |
7 | +let actionTypeText; | |
8 | + | |
9 | +async function formatTextFunc() { | |
10 | + formatText = await findDictItemByCode({ dictCode: 'operate_log' }); | |
11 | + actionTypeText = await findDictItemByCode({ dictCode: 'exception_log' }); | |
12 | +} | |
13 | +formatTextFunc(); | |
4 | 14 | // 表格数据 |
5 | 15 | export const columns: BasicColumn[] = [ |
6 | 16 | { |
... | ... | @@ -17,6 +27,14 @@ export const columns: BasicColumn[] = [ |
17 | 27 | title: '资源类型', |
18 | 28 | dataIndex: 'entityType', |
19 | 29 | width: 180, |
30 | + format: (_, record) => { | |
31 | + const text = formatText.find((f) => { | |
32 | + if (f.itemValue == record.entityType) { | |
33 | + return f.itemText; | |
34 | + } | |
35 | + }); | |
36 | + return text?.itemText; | |
37 | + }, | |
20 | 38 | }, |
21 | 39 | { |
22 | 40 | title: '资源名称', |
... | ... | @@ -32,18 +50,29 @@ export const columns: BasicColumn[] = [ |
32 | 50 | title: '操作类型', |
33 | 51 | dataIndex: 'actionType', |
34 | 52 | width: 180, |
53 | + format: (_, record) => { | |
54 | + const text = actionTypeText.find((f) => { | |
55 | + if (f.itemValue == record.actionType) { | |
56 | + return f.itemText; | |
57 | + } | |
58 | + }); | |
59 | + return text?.itemText; | |
60 | + }, | |
35 | 61 | }, |
36 | 62 | { |
37 | 63 | title: '操作状态', |
38 | 64 | dataIndex: 'actionStatus', |
39 | 65 | width: 180, |
66 | + format: (_, record) => { | |
67 | + return record.actionStatus == 'SUCCESS' ? '成功' : '失败'; | |
68 | + }, | |
40 | 69 | }, |
41 | 70 | { |
42 | 71 | title: '操作时间', |
43 | 72 | dataIndex: 'createdTime', |
44 | - width: 80, | |
73 | + width: 180, | |
45 | 74 | format: (_, record) => { |
46 | - return moment(record.createdTime).format('YYYY-MM-DD'); | |
75 | + return moment(record.createdTime).format('YYYY-MM-DD-HH-MM-ss'); | |
47 | 76 | }, |
48 | 77 | }, |
49 | 78 | ]; |
... | ... | @@ -53,30 +82,28 @@ export const searchFormSchema: FormSchema[] = [ |
53 | 82 | { |
54 | 83 | field: 'entityType', |
55 | 84 | label: '资源类型', |
56 | - component: 'Select', | |
85 | + component: 'ApiSelect', | |
57 | 86 | componentProps: { |
58 | - options: [ | |
59 | - { label: 'DEVICE', value: 'DEVICE' }, | |
60 | - { label: 'DEVICE_PROFILE', value: 'DEVICE_PROFILE' }, | |
61 | - { label: 'RPC', value: 'RPC' }, | |
62 | - { label: 'TENANT', value: 'TENANT' }, | |
63 | - { label: 'TENANT_PROFILE', value: 'TENANT_PROFILE' }, | |
64 | - ], | |
87 | + api: findDictItemByCode, | |
88 | + params: { | |
89 | + dictCode: 'operate_log', | |
90 | + }, | |
91 | + labelField: 'itemText', | |
92 | + valueField: 'itemValue', | |
65 | 93 | }, |
66 | 94 | colProps: { span: 6 }, |
67 | 95 | }, |
68 | 96 | { |
69 | 97 | field: 'actionType', |
70 | 98 | label: '操作类型', |
71 | - component: 'Select', | |
99 | + component: 'ApiSelect', | |
72 | 100 | componentProps: { |
73 | - options: [ | |
74 | - { label: 'ALL', value: '' }, | |
75 | - { label: 'ADDED', value: 'ADDED' }, | |
76 | - { label: 'DELETED', value: 'DELETED' }, | |
77 | - { label: 'RPC_CALL', value: 'RPC_CALL' }, | |
78 | - { label: 'UPDATED', value: 'UPDATED' }, | |
79 | - ], | |
101 | + api: findDictItemByCode, | |
102 | + params: { | |
103 | + dictCode: 'exception_log', | |
104 | + }, | |
105 | + labelField: 'itemText', | |
106 | + valueField: 'itemValue', | |
80 | 107 | }, |
81 | 108 | colProps: { span: 6 }, |
82 | 109 | }, | ... | ... |
1 | 1 | import { BasicColumn, FormSchema } from '/@/components/Table'; |
2 | 2 | import moment from 'moment'; |
3 | +import { findDictItemByCode } from '/@/api/system/dict'; | |
3 | 4 | |
4 | 5 | // 表格数据 |
5 | 6 | export const columns: BasicColumn[] = [ |
... | ... | @@ -14,16 +15,6 @@ export const columns: BasicColumn[] = [ |
14 | 15 | width: 120, |
15 | 16 | }, |
16 | 17 | { |
17 | - title: '资源类型', | |
18 | - dataIndex: 'entityType', | |
19 | - width: 180, | |
20 | - }, | |
21 | - { | |
22 | - title: '资源名称', | |
23 | - dataIndex: 'entityName', | |
24 | - width: 180, | |
25 | - }, | |
26 | - { | |
27 | 18 | title: '操作人员', |
28 | 19 | dataIndex: 'userName', |
29 | 20 | width: 180, |
... | ... | @@ -32,18 +23,24 @@ export const columns: BasicColumn[] = [ |
32 | 23 | title: '操作类型', |
33 | 24 | dataIndex: 'actionType', |
34 | 25 | width: 180, |
26 | + format: (_, record) => { | |
27 | + return record.actionType == 'LOGIN' ? '登录' : '登出'; | |
28 | + }, | |
35 | 29 | }, |
36 | 30 | { |
37 | 31 | title: '操作状态', |
38 | 32 | dataIndex: 'actionStatus', |
39 | 33 | width: 180, |
34 | + format: (_, record) => { | |
35 | + return record.actionStatus == 'SUCCESS' ? '成功' : '失败'; | |
36 | + }, | |
40 | 37 | }, |
41 | 38 | { |
42 | 39 | title: '操作时间', |
43 | 40 | dataIndex: 'createdTime', |
44 | - width: 80, | |
41 | + width: 180, | |
45 | 42 | format: (_, record) => { |
46 | - return moment(record.createdTime).format('YYYY-MM-DD'); | |
43 | + return moment(record.createdTime).format('YYYY-MM-DD-HH-MM-ss'); | |
47 | 44 | }, |
48 | 45 | }, |
49 | 46 | ]; |
... | ... | @@ -53,12 +50,14 @@ export const searchFormSchema: FormSchema[] = [ |
53 | 50 | { |
54 | 51 | field: 'actionType', |
55 | 52 | label: '操作类型', |
56 | - component: 'Select', | |
53 | + component: 'ApiSelect', | |
57 | 54 | componentProps: { |
58 | - options: [ | |
59 | - { label: 'LOGIN', value: 'LOGIN' }, | |
60 | - { label: 'LOGOUT', value: 'LOGOUT' }, | |
61 | - ], | |
55 | + api: findDictItemByCode, | |
56 | + params: { | |
57 | + dictCode: 'user_log', | |
58 | + }, | |
59 | + labelField: 'itemText', | |
60 | + valueField: 'itemValue', | |
62 | 61 | }, |
63 | 62 | colProps: { span: 6 }, |
64 | 63 | }, | ... | ... |