Commit dda9765328973fa08048f5c7c2f83a1b8220cfd3
Committed by
xp.Huang
1 parent
3ca746d2
产品新增网关子时修改选择网关和组织的逻辑
Showing
5 changed files
with
36 additions
and
22 deletions
... | ... | @@ -41,7 +41,7 @@ VITE_GLOB_ALARM_NOTIFY_POLLING_INTERVAL_TIME = 500000 |
41 | 41 | VITE_GLOB_ALARM_NOTIFY_DURATION = 5 |
42 | 42 | |
43 | 43 | # Should Disabled Task Center Execute Interval Unit (Second) |
44 | -VITE_GLOB_DISABLED_TASK_CENTER_EXECUTE_INTERVAL_UNIT_SECOND = true | |
44 | +VITE_GLOB_DISABLED_TASK_CENTER_EXECUTE_INTERVAL_UNIT_SECOND = false | |
45 | 45 | |
46 | 46 | # Software version number |
47 | 47 | VITE_GLOB_SOFTWARE_VERSION_NUMBER = ThingsKit v1.2.0_release | ... | ... |
... | ... | @@ -37,10 +37,11 @@ export interface AccountListItem { |
37 | 37 | } |
38 | 38 | |
39 | 39 | export interface OrganizationListItem { |
40 | - id: string; | |
41 | - name: string; | |
40 | + id?: string; | |
41 | + name?: string; | |
42 | 42 | parentId?: string; |
43 | - remark: string; | |
43 | + remark?: string; | |
44 | + organizationId?: string; | |
44 | 45 | } |
45 | 46 | |
46 | 47 | export interface MenuListItem { | ... | ... |
... | ... | @@ -16,6 +16,9 @@ import { FileItem } from '/@/components/Form/src/components/ApiUpload.vue'; |
16 | 16 | import { createImgPreview } from '/@/components/Preview'; |
17 | 17 | import { uploadThumbnail } from '/@/api/configuration/center/configurationCenter'; |
18 | 18 | |
19 | +import { getOrganizationList } from '/@/api/system/system'; | |
20 | +import { copyTransFun } from '/@/utils/fnUtils'; | |
21 | + | |
19 | 22 | useComponentRegister('JSONEditor', JSONEditor); |
20 | 23 | useComponentRegister('ObjectModelValidateForm', ObjectModelValidateForm); |
21 | 24 | |
... | ... | @@ -263,22 +266,15 @@ export const step1Schemas: FormSchema[] = [ |
263 | 266 | ifShow: ({ values }) => isGateWay(values.deviceType), |
264 | 267 | }, |
265 | 268 | { |
266 | - field: 'organizationId', | |
267 | - label: '所属组织', | |
268 | - component: 'Input', | |
269 | - required: true, | |
270 | - slot: 'addOrg', | |
271 | - }, | |
272 | - { | |
273 | 269 | field: 'gatewayId', |
274 | 270 | label: '网关设备', |
275 | 271 | required: true, |
276 | 272 | component: 'ApiSelect', |
277 | - ifShow: ({ values }) => values.deviceType === 'SENSOR' && values.organizationId, | |
273 | + ifShow: ({ values }) => values.deviceType === 'SENSOR', | |
278 | 274 | componentProps: ({ formModel, formActionType }) => { |
279 | - const { organizationId, transportType } = formModel; | |
275 | + const { transportType } = formModel; | |
280 | 276 | const { validateFields } = formActionType; |
281 | - if (![organizationId, transportType].every(Boolean)) return {}; | |
277 | + if (!transportType) return {}; | |
282 | 278 | return { |
283 | 279 | api: async (params: Recordable) => { |
284 | 280 | try { |
... | ... | @@ -291,19 +287,36 @@ export const step1Schemas: FormSchema[] = [ |
291 | 287 | }, |
292 | 288 | showSearch: true, |
293 | 289 | params: { |
294 | - organizationId, | |
295 | 290 | transportType, |
296 | 291 | }, |
297 | 292 | valueField: 'tbDeviceId', |
298 | 293 | labelField: 'alias', |
299 | - onChange: async () => { | |
294 | + onChange: async (value, options) => { | |
300 | 295 | await nextTick(); |
296 | + if (value) { | |
297 | + const data = await getOrganizationList({ organizationId: options?.organizationId }); | |
298 | + copyTransFun(data as any as any[]); | |
299 | + formModel.organizationList = data; | |
300 | + } | |
301 | 301 | validateFields(['gatewayId']); |
302 | 302 | }, |
303 | 303 | }; |
304 | 304 | }, |
305 | 305 | }, |
306 | 306 | { |
307 | + field: 'organizationList', | |
308 | + label: '依据网关设备请求的组织数组', | |
309 | + component: 'Input', | |
310 | + ifShow: false, | |
311 | + }, | |
312 | + { | |
313 | + field: 'organizationId', | |
314 | + label: '所属组织', | |
315 | + component: 'Input', | |
316 | + required: true, | |
317 | + slot: 'addOrg', | |
318 | + }, | |
319 | + { | |
307 | 320 | field: 'label', |
308 | 321 | label: '设备标签', |
309 | 322 | component: 'Input', | ... | ... |
... | ... | @@ -14,7 +14,7 @@ |
14 | 14 | placeholder="请选择组织" |
15 | 15 | allow-clear |
16 | 16 | tree-default-expand-all |
17 | - :tree-data="treeData" | |
17 | + :tree-data="model?.['organizationList'] || treeData" | |
18 | 18 | /> |
19 | 19 | </div> |
20 | 20 | <div> |
... | ... | @@ -448,10 +448,10 @@ |
448 | 448 | } |
449 | 449 | |
450 | 450 | const handleTreeOrg = () => { |
451 | - const clearGatewayId = { | |
452 | - gatewayId: '', | |
453 | - }; | |
454 | - setFieldsValue(clearGatewayId); | |
451 | + // const clearGatewayId = { | |
452 | + // gatewayId: '', | |
453 | + // }; | |
454 | + // setFieldsValue(clearGatewayId); | |
455 | 455 | }; |
456 | 456 | |
457 | 457 | return { | ... | ... |