Showing
15 changed files
with
388 additions
and
211 deletions
... | ... | @@ -19,6 +19,7 @@ enum ScreenManagerApi { |
19 | 19 | SCREEN_ORGANIZATION_URL = '/organization/me/list', |
20 | 20 | SCREEN_CHANGE_STATUS = '/convert/update/scene', |
21 | 21 | SCREEN_GET_BY_DEPTID = '/sceneLinkage/device/', |
22 | + SCREEN_BYDEVICEID_GET_ATTRBUTELIST = '/plugins/telemetry/', | |
22 | 23 | } |
23 | 24 | |
24 | 25 | /** |
... | ... | @@ -96,3 +97,25 @@ export const screenLinkPageByDeptIdGetDevice = (params: ScreenByDeptIdParams) => |
96 | 97 | params, |
97 | 98 | }); |
98 | 99 | }; |
100 | + | |
101 | +/** | |
102 | + * 根据设备id获取属性列表 | |
103 | + */ | |
104 | +export const screenLinkPageByDeviceIdGetAttribut = (entityType, entityId) => { | |
105 | + return defHttp.get( | |
106 | + { | |
107 | + url: | |
108 | + ScreenManagerApi.SCREEN_BYDEVICEID_GET_ATTRBUTELIST + | |
109 | + `${entityType}` + | |
110 | + '/' + | |
111 | + `${entityId}` + | |
112 | + '/' + | |
113 | + 'keys' + | |
114 | + '/' + | |
115 | + 'timeseries', | |
116 | + }, | |
117 | + { | |
118 | + joinPrefix: false, | |
119 | + } | |
120 | + ); | |
121 | +}; | ... | ... |
... | ... | @@ -32,15 +32,13 @@ enum Api { |
32 | 32 | postAddTenantProfile = '/tenantProfile', |
33 | 33 | getTenantProfile = '/tenantProfiles', |
34 | 34 | deleteTenantProfile = '/tenantProfile', |
35 | + setTenantProfile = '/tenantProfile', | |
35 | 36 | } |
36 | 37 | |
37 | -export async function deleteTenantProfileApi(ids: string[]) { | |
38 | +export async function deleteTenantProfileApi(ids: string) { | |
38 | 39 | await defHttp.delete( |
39 | 40 | { |
40 | - url: Api.deleteTenantProfile, | |
41 | - data: { | |
42 | - ids: ids, | |
43 | - }, | |
41 | + url: Api.deleteTenantProfile + '/' + ids, | |
44 | 42 | }, |
45 | 43 | { |
46 | 44 | joinPrefix: false, |
... | ... | @@ -48,12 +46,40 @@ export async function deleteTenantProfileApi(ids: string[]) { |
48 | 46 | ); |
49 | 47 | } |
50 | 48 | |
49 | +// export async function deleteTenantProfileApi(ids: string[]) { | |
50 | +// await defHttp.delete( | |
51 | +// { | |
52 | +// url: Api.deleteTenantProfile, | |
53 | +// data: { | |
54 | +// ids: ids, | |
55 | +// }, | |
56 | +// }, | |
57 | +// { | |
58 | +// joinPrefix: false, | |
59 | +// } | |
60 | +// ); | |
61 | +// } | |
62 | + | |
51 | 63 | export const getTableTenantProfileApi = (params?: QueryTenantProfilesParam) => { |
52 | 64 | return defHttp.get({ |
53 | 65 | url: Api.getTenantProfile, |
54 | 66 | params, |
55 | 67 | }); |
56 | 68 | }; |
69 | + | |
70 | +//设置该租户为默认 | |
71 | +export const setTenantProfileIsDefaultApi = (id: string, v, params?: {}) => { | |
72 | + return defHttp.post( | |
73 | + { | |
74 | + url: Api.setTenantProfile + '/' + id + '/' + v, | |
75 | + params, | |
76 | + }, | |
77 | + { | |
78 | + joinPrefix: false, | |
79 | + } | |
80 | + ); | |
81 | +}; | |
82 | + | |
57 | 83 | export const selectTenantProfileApi = async (params?: QueryTenantProfilesParam) => { |
58 | 84 | const { items } = await getTableTenantProfileApi(params); |
59 | 85 | items.forEach((item) => { | ... | ... |
... | ... | @@ -210,6 +210,7 @@ |
210 | 210 | try { |
211 | 211 | proxy.$refs.DeviceProfileStep3Ref.initAddAlarmRuleFunc(); |
212 | 212 | proxy.$refs.DeviceProfileStep3Ref.resetRegisterFormCreateAlarmFunc(); |
213 | + proxy.$refs.DeviceProfileStep3Ref.resetAlarmSeverityRefFunc(); | |
213 | 214 | } catch {} |
214 | 215 | } else if (isUpdate.value == 2) { |
215 | 216 | try { |
... | ... | @@ -339,6 +340,8 @@ |
339 | 340 | proxy.$refs.DeviceProfileStep4Ref.clearAlaramContactAndNoticeMethodFunc(); |
340 | 341 | proxy.$refs.DeviceProfileStep3Ref.clearDetailTemplateFunc(); |
341 | 342 | proxy.$refs.DeviceProfileStep3Ref.clearEditAllRegisterFormFunc(); |
343 | + proxy.$refs.DeviceProfileStep3Ref.resetAlarmSeverityRefFunc(); | |
344 | + emit('success'); | |
342 | 345 | } catch (e) { |
343 | 346 | return e; |
344 | 347 | } | ... | ... |
... | ... | @@ -3,37 +3,40 @@ import { FormSchema } from '/@/components/Form'; |
3 | 3 | export const formSchema: FormSchema[] = [ |
4 | 4 | { |
5 | 5 | field: 'default', |
6 | - component: 'Select', | |
7 | 6 | label: '报警严重程度:', |
8 | 7 | colProps: { |
9 | 8 | span: 17, |
10 | 9 | }, |
11 | - componentProps() { | |
12 | - return { | |
13 | - placeholder: '请选择报警严重程度', | |
14 | - options: [ | |
15 | - { | |
16 | - value: 'CRITICAL', | |
17 | - label: '危险', | |
18 | - }, | |
19 | - { | |
20 | - value: 'MAJOR', | |
21 | - label: '重要', | |
22 | - }, | |
23 | - { | |
24 | - value: 'MINOR', | |
25 | - label: '次要', | |
26 | - }, | |
27 | - { | |
28 | - value: 'WARNING', | |
29 | - label: '警告', | |
30 | - }, | |
31 | - { | |
32 | - value: 'INDETERMINATE', | |
33 | - label: '不确定', | |
34 | - }, | |
35 | - ], | |
36 | - }; | |
10 | + component: 'Select', | |
11 | + componentProps: { | |
12 | + placeholder: '请选择报警严重程度', | |
13 | + options: [ | |
14 | + { | |
15 | + value: 'CRITICAL', | |
16 | + label: '危险', | |
17 | + disabled: false, | |
18 | + }, | |
19 | + { | |
20 | + value: 'MAJOR', | |
21 | + label: '重要', | |
22 | + disabled: false, | |
23 | + }, | |
24 | + { | |
25 | + value: 'MINOR', | |
26 | + label: '次要', | |
27 | + disabled: false, | |
28 | + }, | |
29 | + { | |
30 | + value: 'WARNING', | |
31 | + label: '警告', | |
32 | + disabled: false, | |
33 | + }, | |
34 | + { | |
35 | + value: 'INDETERMINATE', | |
36 | + label: '不确定', | |
37 | + disabled: false, | |
38 | + }, | |
39 | + ], | |
37 | 40 | }, |
38 | 41 | }, |
39 | 42 | ]; | ... | ... |
... | ... | @@ -17,6 +17,7 @@ |
17 | 17 | import { BasicForm, useForm } from '/@/components/Form/index'; |
18 | 18 | import { Input } from 'ant-design-vue'; |
19 | 19 | import { useConditionDrawerSchema } from '../config'; |
20 | + import { screenLinkPageByDeviceIdGetAttribut } from '/@/api/ruleengine/ruleengineApi'; | |
20 | 21 | |
21 | 22 | export default defineComponent({ |
22 | 23 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, |
... | ... | @@ -38,11 +39,60 @@ |
38 | 39 | resetFields(); |
39 | 40 | }; |
40 | 41 | const updateFieldDeviceId = (v) => { |
42 | + const option = v; | |
41 | 43 | setTimeout(() => { |
42 | 44 | updateSchema({ |
43 | 45 | field: 'entityId', |
44 | 46 | componentProps: { |
45 | - options: v, | |
47 | + options: option, | |
48 | + onChange(e) { | |
49 | + updateFieldType2Func(e); | |
50 | + }, | |
51 | + }, | |
52 | + }); | |
53 | + }, 10); | |
54 | + }; | |
55 | + const updateFieldType2Func = async (e) => { | |
56 | + const data1 = await screenLinkPageByDeviceIdGetAttribut('DEVICE', e); | |
57 | + const data = data1.map((m) => { | |
58 | + return { | |
59 | + label: m, | |
60 | + value: m, | |
61 | + }; | |
62 | + }); | |
63 | + setTimeout(() => { | |
64 | + updateSchema({ | |
65 | + field: 'type', | |
66 | + componentProps() { | |
67 | + return { | |
68 | + placeholder: '请选择属性', | |
69 | + options: data, | |
70 | + onChange(e) { | |
71 | + if (e) { | |
72 | + updateSchema([ | |
73 | + { | |
74 | + field: 'operation', | |
75 | + ifShow: true, | |
76 | + }, | |
77 | + { | |
78 | + field: 'value', | |
79 | + ifShow: true, | |
80 | + }, | |
81 | + ]); | |
82 | + } else { | |
83 | + updateSchema([ | |
84 | + { | |
85 | + field: 'operation', | |
86 | + ifShow: false, | |
87 | + }, | |
88 | + { | |
89 | + field: 'value', | |
90 | + ifShow: false, | |
91 | + }, | |
92 | + ]); | |
93 | + } | |
94 | + }, | |
95 | + }; | |
46 | 96 | }, |
47 | 97 | }); |
48 | 98 | }, 10); | ... | ... |
... | ... | @@ -19,6 +19,7 @@ |
19 | 19 | import { BasicForm, useForm } from '/@/components/Form/index'; |
20 | 20 | import { Input } from 'ant-design-vue'; |
21 | 21 | import { useTriggerDrawerSchema } from '../config'; |
22 | + import { screenLinkPageByDeviceIdGetAttribut } from '/@/api/ruleengine/ruleengineApi'; | |
22 | 23 | |
23 | 24 | export default defineComponent({ |
24 | 25 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, |
... | ... | @@ -36,11 +37,63 @@ |
36 | 37 | return fieldValue.value; |
37 | 38 | }; |
38 | 39 | const updateFieldDeviceId = (v) => { |
40 | + const option = v; | |
39 | 41 | setTimeout(() => { |
40 | 42 | updateSchema({ |
41 | 43 | field: 'entityId', |
42 | - componentProps: { | |
43 | - options: v, | |
44 | + componentProps() { | |
45 | + return { | |
46 | + options: option, | |
47 | + onChange(e) { | |
48 | + updateFieldType2Func(e); | |
49 | + }, | |
50 | + }; | |
51 | + }, | |
52 | + }); | |
53 | + }, 10); | |
54 | + }; | |
55 | + | |
56 | + const updateFieldType2Func = async (e) => { | |
57 | + const data1 = await screenLinkPageByDeviceIdGetAttribut('DEVICE', e); | |
58 | + const data = data1.map((m) => { | |
59 | + return { | |
60 | + label: m, | |
61 | + value: m, | |
62 | + }; | |
63 | + }); | |
64 | + setTimeout(() => { | |
65 | + updateSchema({ | |
66 | + field: 'type2', | |
67 | + componentProps() { | |
68 | + return { | |
69 | + placeholder: '请选择属性', | |
70 | + options: data, | |
71 | + onChange(e) { | |
72 | + if (e) { | |
73 | + updateSchema([ | |
74 | + { | |
75 | + field: 'operation', | |
76 | + ifShow: true, | |
77 | + }, | |
78 | + { | |
79 | + field: 'value', | |
80 | + ifShow: true, | |
81 | + }, | |
82 | + ]); | |
83 | + } else { | |
84 | + updateSchema([ | |
85 | + { | |
86 | + field: 'operation', | |
87 | + ifShow: false, | |
88 | + }, | |
89 | + { | |
90 | + field: 'value', | |
91 | + ifShow: false, | |
92 | + }, | |
93 | + ]); | |
94 | + } | |
95 | + }, | |
96 | + }; | |
44 | 97 | }, |
45 | 98 | }); |
46 | 99 | }, 10); |
... | ... | @@ -58,13 +111,25 @@ |
58 | 111 | entityId1: props.editTriggerFather.entityId, |
59 | 112 | entityId2: props.editTriggerFather.entityId, |
60 | 113 | type1: props.editTriggerFather?.triggerCondition?.condition[0]?.key?.type, |
61 | - type2: props.editTriggerFather?.triggerCondition?.condition[0]?.predicate?.type, | |
114 | + type2: props.editTriggerFather?.triggerCondition?.condition[0]?.key?.key, | |
62 | 115 | operation: |
63 | 116 | props.editTriggerFather?.triggerCondition?.condition[0]?.predicate?.operation, |
64 | 117 | value: |
65 | 118 | props.editTriggerFather?.triggerCondition?.condition[0]?.predicate?.value |
66 | 119 | ?.defaultValue, |
67 | 120 | }); |
121 | + if (props.editTriggerFather?.triggerCondition?.condition[0]?.key?.key) { | |
122 | + updateSchema([ | |
123 | + { | |
124 | + field: 'operation', | |
125 | + ifShow: true, | |
126 | + }, | |
127 | + { | |
128 | + field: 'value', | |
129 | + ifShow: true, | |
130 | + }, | |
131 | + ]); | |
132 | + } | |
68 | 133 | }, 10); |
69 | 134 | } |
70 | 135 | }; |
... | ... | @@ -79,6 +144,14 @@ |
79 | 144 | }, |
80 | 145 | }); |
81 | 146 | }; |
147 | + const clearSelectAttribute = () => { | |
148 | + updateSchema({ | |
149 | + field: 'type2', | |
150 | + componentProps: { | |
151 | + options: [], | |
152 | + }, | |
153 | + }); | |
154 | + }; | |
82 | 155 | const editSelectDevice = () => { |
83 | 156 | if (props.newFilterMapFather != 1) { |
84 | 157 | setTimeout(() => { |
... | ... | @@ -110,6 +183,8 @@ |
110 | 183 | }); |
111 | 184 | }; |
112 | 185 | return { |
186 | + clearSelectAttribute, | |
187 | + updateFieldType2Func, | |
113 | 188 | updateFieldDeviceId, |
114 | 189 | resetFieldsValueFunc, |
115 | 190 | clearSelectScene, | ... | ... |
... | ... | @@ -209,6 +209,7 @@ export const searchFormSchema: FormSchema[] = [ |
209 | 209 | colProps: { span: 6 }, |
210 | 210 | component: 'ApiTreeSelect', |
211 | 211 | componentProps: { |
212 | + placeholder: '请选择组织', | |
212 | 213 | api: async () => { |
213 | 214 | const data = await screenLinkOrganizationGetApi(); |
214 | 215 | copyTransFun(data as any as any[]); |
... | ... | @@ -223,15 +224,15 @@ export const searchFormSchema: FormSchema[] = [ |
223 | 224 | colProps: { span: 6 }, |
224 | 225 | componentProps: { |
225 | 226 | maxLength: 36, |
226 | - placeholder: '请输入名称', | |
227 | + placeholder: '请输入场景联动名称', | |
227 | 228 | }, |
228 | 229 | }, |
229 | 230 | { |
230 | 231 | field: 'status', |
231 | - label: '设备状态', | |
232 | + label: '状态', | |
232 | 233 | component: 'Select', |
233 | 234 | componentProps: { |
234 | - placeholder: '请选择状态', | |
235 | + placeholder: '请选择', | |
235 | 236 | options: [ |
236 | 237 | { label: '已启用', value: '1' }, |
237 | 238 | { label: '未启用', value: '0' }, |
... | ... | @@ -261,8 +262,10 @@ export const useTriggerDrawerSchema: FormSchema[] = [ |
261 | 262 | field: 'entityId', |
262 | 263 | label: '', |
263 | 264 | component: 'Select', |
264 | - componentProps: { | |
265 | - placeholder: '请选择设备', | |
265 | + componentProps() { | |
266 | + return { | |
267 | + placeholder: '请选择设备', | |
268 | + }; | |
266 | 269 | }, |
267 | 270 | ifShow: ({ values }) => |
268 | 271 | !isTime(Reflect.get(values, 'triggerType')) && |
... | ... | @@ -292,7 +295,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ |
292 | 295 | componentProps: { |
293 | 296 | placeholder: '属性触发', |
294 | 297 | options: [ |
295 | - { label: '属性触发', value: 'ATTRIBUTE' }, | |
298 | + { label: '属性触发', value: 'TIME_SERIES' }, | |
296 | 299 | // { label: '上下线触发', value: 'ATTRIBUTE' }, |
297 | 300 | ], |
298 | 301 | }, |
... | ... | @@ -325,12 +328,13 @@ export const useTriggerDrawerSchema: FormSchema[] = [ |
325 | 328 | field: 'type2', |
326 | 329 | label: '', |
327 | 330 | component: 'Select', |
328 | - componentProps: { | |
329 | - placeholder: '全部属性', | |
330 | - options: [ | |
331 | - { label: '全部属性', value: 'STRING' }, | |
332 | - { label: 'wendu', value: 'NUMERIC' }, | |
333 | - ], | |
331 | + componentProps() { | |
332 | + return { | |
333 | + placeholder: '请选择属性', | |
334 | + onChange(v) { | |
335 | + console.log(v); | |
336 | + }, | |
337 | + }; | |
334 | 338 | }, |
335 | 339 | ifShow: ({ values }) => |
336 | 340 | !isTime(Reflect.get(values, 'triggerType')) && |
... | ... | @@ -353,12 +357,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ |
353 | 357 | { label: '>=', value: 'GREATER_OR_EQUAL' }, |
354 | 358 | ], |
355 | 359 | }, |
356 | - ifShow: ({ values }) => | |
357 | - isWenDu(Reflect.get(values, 'type2')) && | |
358 | - !isUpAndDown(Reflect.get(values, 'type1')) && | |
359 | - !isTime(Reflect.get(values, 'triggerType')) && | |
360 | - !isScene(Reflect.get(values, 'triggerType')) && | |
361 | - !isHand(Reflect.get(values, 'triggerType')), | |
360 | + ifShow: false, | |
362 | 361 | colProps: { span: 12 }, |
363 | 362 | }, |
364 | 363 | { |
... | ... | @@ -369,47 +368,41 @@ export const useTriggerDrawerSchema: FormSchema[] = [ |
369 | 368 | maxLength: 16, |
370 | 369 | placeholder: '请输入比较值', |
371 | 370 | }, |
372 | - ifShow: ({ values }) => | |
373 | - isWenDu(Reflect.get(values, 'type2')) && | |
374 | - !isUpAndDown(Reflect.get(values, 'type1')) && | |
375 | - !isTime(Reflect.get(values, 'triggerType')) && | |
376 | - !isScene(Reflect.get(values, 'triggerType')) && | |
377 | - !isHand(Reflect.get(values, 'triggerType')), | |
371 | + ifShow: false, | |
378 | 372 | colProps: { |
379 | 373 | span: 12, |
380 | 374 | }, |
381 | 375 | }, |
382 | 376 | |
383 | 377 | { |
384 | - field: 'entityId2', | |
378 | + field: 'sceneLinkageId', | |
385 | 379 | label: '', |
386 | 380 | component: 'Select', |
387 | 381 | colProps: { |
388 | 382 | span: 12, |
389 | 383 | }, |
390 | 384 | componentProps: { |
391 | - placeholder: '请输入场景触发器', | |
385 | + placeholder: '请选择场景', | |
392 | 386 | options: [ |
393 | - { label: '场景触发器1', value: '1' }, | |
394 | - { label: '场景触发器2', value: '2' }, | |
395 | - { label: '场景触发器3', value: '3' }, | |
387 | + { label: '场景触发器1', value: '' }, | |
388 | + { label: '场景触发器2', value: '' }, | |
396 | 389 | ], |
397 | 390 | }, |
398 | 391 | ifShow: ({ values }) => isScene(Reflect.get(values, 'triggerType')), |
399 | 392 | }, |
400 | 393 | |
401 | - { | |
402 | - field: 'no3', | |
403 | - label: '', | |
404 | - component: 'ApiSelect', | |
405 | - colProps: { | |
406 | - span: 12, | |
407 | - }, | |
408 | - componentProps: { | |
409 | - placeholder: '暂不实现', | |
410 | - }, | |
411 | - ifShow: ({ values }) => isHand(Reflect.get(values, 'triggerType')), | |
412 | - }, | |
394 | + // { | |
395 | + // field: 'no3', | |
396 | + // label: '', | |
397 | + // component: 'ApiSelect', | |
398 | + // colProps: { | |
399 | + // span: 12, | |
400 | + // }, | |
401 | + // componentProps: { | |
402 | + // placeholder: '暂不实现', | |
403 | + // }, | |
404 | + // ifShow: ({ values }) => isHand(Reflect.get(values, 'triggerType')), | |
405 | + // }, | |
413 | 406 | ]; |
414 | 407 | |
415 | 408 | export const useConditionDrawerSchema: FormSchema[] = [ |
... | ... | @@ -430,8 +423,10 @@ export const useConditionDrawerSchema: FormSchema[] = [ |
430 | 423 | field: 'entityId', |
431 | 424 | label: '', |
432 | 425 | component: 'Select', |
433 | - componentProps: { | |
434 | - placeholder: '请选择设备', | |
426 | + componentProps() { | |
427 | + return { | |
428 | + placeholder: '请选择设备', | |
429 | + }; | |
435 | 430 | }, |
436 | 431 | ifShow: ({ values }) => !isTimeAll(Reflect.get(values, 'triggerType')), |
437 | 432 | colProps: { |
... | ... | @@ -466,54 +461,19 @@ export const useConditionDrawerSchema: FormSchema[] = [ |
466 | 461 | field: 'type', |
467 | 462 | label: '', |
468 | 463 | component: 'Select', |
469 | - componentProps: { | |
470 | - placeholder: '请选择或者输入属性', | |
471 | - options: [ | |
472 | - { label: 'shidu', value: 'NUMERIC1' }, | |
473 | - { label: 'wendu', value: 'NUMERIC2' }, | |
474 | - ], | |
464 | + componentProps() { | |
465 | + return { | |
466 | + placeholder: '请选择属性', | |
467 | + onChange(v) { | |
468 | + console.log(v); | |
469 | + }, | |
470 | + }; | |
475 | 471 | }, |
476 | 472 | ifShow: ({ values }) => !isTimeAll(Reflect.get(values, 'triggerType')), |
477 | 473 | colProps: { span: 12 }, |
478 | 474 | }, |
479 | 475 | { |
480 | - field: 'operation1', | |
481 | - label: '', | |
482 | - component: 'Select', | |
483 | - componentProps: { | |
484 | - placeholder: '', | |
485 | - options: [ | |
486 | - { label: '=', value: 'EQUAL' }, | |
487 | - { label: '<', value: 'LESS' }, | |
488 | - { label: '>', value: 'GREATER' }, | |
489 | - { label: '<=', value: 'LESS_OR_EQUAL' }, | |
490 | - { label: '>=', value: 'GREATER_OR_EQUAL' }, | |
491 | - ], | |
492 | - }, | |
493 | - ifShow: ({ values }) => | |
494 | - isConditionShiDu(Reflect.get(values, 'type')) && | |
495 | - !isTimeAll(Reflect.get(values, 'triggerType')), | |
496 | - colProps: { span: 12 }, | |
497 | - }, | |
498 | - { | |
499 | - field: 'value1', | |
500 | - component: 'Input', | |
501 | - label: '', | |
502 | - componentProps: { | |
503 | - maxLength: 16, | |
504 | - placeholder: '请输入比较值', | |
505 | - }, | |
506 | - | |
507 | - ifShow: ({ values }) => | |
508 | - isConditionShiDu(Reflect.get(values, 'type')) && | |
509 | - !isTimeAll(Reflect.get(values, 'triggerType')), | |
510 | - colProps: { | |
511 | - span: 12, | |
512 | - }, | |
513 | - }, | |
514 | - | |
515 | - { | |
516 | - field: 'operation2', | |
476 | + field: 'operation', | |
517 | 477 | label: '', |
518 | 478 | component: 'Select', |
519 | 479 | componentProps: { |
... | ... | @@ -526,22 +486,18 @@ export const useConditionDrawerSchema: FormSchema[] = [ |
526 | 486 | { label: '>=', value: 'GREATER_OR_EQUAL' }, |
527 | 487 | ], |
528 | 488 | }, |
529 | - ifShow: ({ values }) => | |
530 | - isConditionWenDu(Reflect.get(values, 'type')) && | |
531 | - !isTimeAll(Reflect.get(values, 'triggerType')), | |
489 | + ifShow: false, | |
532 | 490 | colProps: { span: 12 }, |
533 | 491 | }, |
534 | 492 | { |
535 | - field: 'value2', | |
493 | + field: 'value', | |
536 | 494 | component: 'Input', |
537 | 495 | label: '', |
538 | 496 | componentProps: { |
539 | 497 | maxLength: 16, |
540 | 498 | placeholder: '请输入比较值', |
541 | 499 | }, |
542 | - ifShow: ({ values }) => | |
543 | - isConditionWenDu(Reflect.get(values, 'type')) && | |
544 | - !isTimeAll(Reflect.get(values, 'triggerType')), | |
500 | + ifShow: false, | |
545 | 501 | colProps: { |
546 | 502 | span: 12, |
547 | 503 | }, |
... | ... | @@ -555,7 +511,7 @@ export const useActionDrawerSchema: FormSchema[] = [ |
555 | 511 | component: 'Select', |
556 | 512 | required: true, |
557 | 513 | componentProps: { |
558 | - placeholder: '请选择设备输出', | |
514 | + placeholder: '设备输出', | |
559 | 515 | options: [ |
560 | 516 | { label: '设备输出', value: 'DEVICE_OUT' }, |
561 | 517 | { label: '消息通知', value: 'MSG_NOTIFY' }, |
... | ... | @@ -579,7 +535,9 @@ export const useActionDrawerSchema: FormSchema[] = [ |
579 | 535 | }, |
580 | 536 | { |
581 | 537 | field: 'doContext', |
582 | - component: 'Input', | |
538 | + component: 'InputTextArea', | |
539 | + defaultValue: | |
540 | + '{"method": "setDOValue","params": {"devID": "492S211218028819","data": {"DO1": 1,"DO2": 1,"DO3": 1,"DO4": 1}}}', | |
583 | 541 | label: '', |
584 | 542 | componentProps: { |
585 | 543 | maxLength: 255, |
... | ... | @@ -624,12 +582,10 @@ export const useActionDrawerSchema: FormSchema[] = [ |
624 | 582 | span: 12, |
625 | 583 | }, |
626 | 584 | componentProps: { |
627 | - placeholder: '请选择场景触发器', | |
585 | + placeholder: '请选择场景', | |
628 | 586 | options: [ |
629 | 587 | { label: '场景触发器1', value: '1' }, |
630 | 588 | { label: '场景触发器2', value: '2' }, |
631 | - { label: '场景触发器3', value: '3' }, | |
632 | - { label: '场景触发器4', value: '4' }, | |
633 | 589 | ], |
634 | 590 | }, |
635 | 591 | ifShow: ({ values }) => isScene(Reflect.get(values, 'outTarget')), | ... | ... |
... | ... | @@ -6,14 +6,15 @@ |
6 | 6 | :rowSelection="{ type: 'checkbox' }" |
7 | 7 | > |
8 | 8 | <template #toolbar> |
9 | - <a-button | |
10 | - v-if="isTenant || isSysadmin || isCustomer || isPlatform" | |
11 | - type="primary" | |
12 | - @click="handleAdd" | |
13 | - > | |
9 | + <a-button v-if="isTenant || isCustomer || isPlatform" type="primary" @click="handleAdd"> | |
14 | 10 | 新增场景联动 |
15 | 11 | </a-button> |
16 | - <a-button color="error" @click="handleDeleteOrBatchDelete(null)" :disabled="hasBatchDelete"> | |
12 | + <a-button | |
13 | + v-if="isTenant || isCustomer || isPlatform" | |
14 | + color="error" | |
15 | + @click="handleDeleteOrBatchDelete(null)" | |
16 | + :disabled="hasBatchDelete" | |
17 | + > | |
17 | 18 | 批量删除 |
18 | 19 | </a-button> |
19 | 20 | </template> |
... | ... | @@ -24,13 +25,13 @@ |
24 | 25 | label: '编辑', |
25 | 26 | icon: 'clarity:note-edit-line', |
26 | 27 | onClick: handleEdit.bind(null, record), |
27 | - ifShow: isTenant || isCustomer, | |
28 | + ifShow: isTenant || isCustomer || isPlatform, | |
28 | 29 | }, |
29 | 30 | { |
30 | 31 | label: '删除', |
31 | 32 | icon: 'ant-design:delete-outlined', |
32 | 33 | color: 'error', |
33 | - ifShow: isTenant || isCustomer, | |
34 | + ifShow: isTenant || isCustomer || isPlatform, | |
34 | 35 | popConfirm: { |
35 | 36 | title: '是否确认删除', |
36 | 37 | confirm: handleDeleteOrBatchDelete.bind(null, record), | ... | ... |
... | ... | @@ -294,6 +294,7 @@ |
294 | 294 | setTimeout(() => { |
295 | 295 | proxy.$refs.refTriggerChild?.resetFieldsValueFunc(); |
296 | 296 | proxy.$refs.refTriggerChild?.clearSelectDevice(); |
297 | + proxy.$refs.refTriggerChild?.clearSelectAttribute(); | |
297 | 298 | proxy.$refs.refConditionChild?.resetFieldsValueFunc(); |
298 | 299 | proxy.$refs.refConditionChild?.clearSelectDevice(); |
299 | 300 | proxy.$refs.refActionChild?.resetFieldsValueFunc(); |
... | ... | @@ -492,17 +493,19 @@ |
492 | 493 | condition: [ |
493 | 494 | { |
494 | 495 | key: { |
495 | - key: m.key1 == null ? 'CO2' : m.key1, | |
496 | + key: m.type2 == null ? 'CO2' : m.type2, | |
496 | 497 | type: m.type1 == null ? 'TIME_SERIES' : m.type1, |
497 | 498 | }, |
498 | - valueType: m.type2 == null ? 'NUMERIC' : m.type2, | |
499 | - value: {}, | |
499 | + // valueType: m.type2 == null ? 'NUMERIC' : m.type2, | |
500 | + valueType: 'NUMERIC', | |
501 | + // value: {}, | |
500 | 502 | predicate: { |
501 | - type: m.type2 == null ? 'NUMERIC' : m.type2, | |
503 | + // type: m.type2 == null ? 'NUMERIC' : m.type2, | |
504 | + type: 'NUMERIC', | |
502 | 505 | value: { |
503 | 506 | defaultValue: Number(m.value) == null ? 0 : Number(m.value), |
504 | 507 | }, |
505 | - operation: m.operation == null ? 'GREATER_OR_EQUAL' : m.operation, | |
508 | + operation: m.operation == null ? 'EQUAL' : m.operation, | |
506 | 509 | }, |
507 | 510 | }, |
508 | 511 | ], |
... | ... | @@ -520,32 +523,17 @@ |
520 | 523 | condition: [ |
521 | 524 | { |
522 | 525 | key: { |
526 | + key: m.type == null ? 'CO2' : m.type, | |
523 | 527 | type: 'TIME_SERIES', |
524 | - key: 'CO2', | |
525 | 528 | }, |
526 | - valueType: | |
527 | - m.type == 'NUMERIC1' | |
528 | - ? 'NUMERIC' | |
529 | - : m.type == 'NUMERIC2' | |
530 | - ? 'NUMERIC' | |
531 | - : 'NUMERIC', | |
532 | - value: {}, | |
529 | + valueType: 'NUMERIC', | |
530 | + // value: {}, | |
533 | 531 | predicate: { |
534 | - type: | |
535 | - m.type == 'NUMERIC1' | |
536 | - ? 'NUMERIC' | |
537 | - : m.type == 'NUMERIC2' | |
538 | - ? 'NUMERIC' | |
539 | - : 'NUMERIC', | |
532 | + type: 'NUMERIC', | |
540 | 533 | value: { |
541 | - defaultValue: | |
542 | - Number(m.value1) == null | |
543 | - ? 0 | |
544 | - : Number(m.value1) || Number(m.value2) == null | |
545 | - ? 0 | |
546 | - : Number(m.value2), | |
534 | + defaultValue: Number(m.value) == null ? 0 : Number(m.value), | |
547 | 535 | }, |
548 | - operation: m.operation1 || m.operatio2, | |
536 | + operation: m.operation, | |
549 | 537 | }, |
550 | 538 | }, |
551 | 539 | ], |
... | ... | @@ -650,18 +638,21 @@ |
650 | 638 | (addTriggerPushData.value as any) = addTriggerPushData.value.map((m: any) => { |
651 | 639 | return { |
652 | 640 | triggerType: m?.triggerType, |
653 | - entityId: m?.entityId || m?.entityId1 || m?.entityId2, | |
641 | + entityId: m?.entityId || m?.entityId1, | |
642 | + sceneLinkageId: m?.sceneLinkageId, | |
654 | 643 | triggerCondition: { |
655 | 644 | condition: [ |
656 | 645 | { |
657 | 646 | key: { |
658 | - key: m.key1 == null ? 'CO2' : m.key1, | |
647 | + key: m.type2 == null ? 'CO2' : m.type2, | |
659 | 648 | type: m.type1 == null ? 'TIME_SERIES' : m.type1, |
660 | 649 | }, |
661 | - valueType: m.type2 == null ? 'NUMERIC' : m.type2, | |
662 | - value: {}, | |
650 | + // valueType: m.type2 == null ? 'NUMERIC' : m.type2, | |
651 | + valueType: 'NUMERIC', | |
652 | + // value: {}, | |
663 | 653 | predicate: { |
664 | - type: m.type2 == null ? 'NUMERIC' : m.type2, | |
654 | + // type: m.type2 == null ? 'NUMERIC' : m.type2, | |
655 | + type: 'NUMERIC', | |
665 | 656 | value: { |
666 | 657 | defaultValue: Number(m.value) == null ? 0 : Number(m.value), |
667 | 658 | }, |
... | ... | @@ -754,32 +745,17 @@ |
754 | 745 | condition: [ |
755 | 746 | { |
756 | 747 | key: { |
748 | + key: m.type == null ? 'CO2' : m.type, | |
757 | 749 | type: 'TIME_SERIES', |
758 | - key: 'CO2', | |
759 | 750 | }, |
760 | - valueType: | |
761 | - m.type == 'NUMERIC1' | |
762 | - ? 'NUMERIC' | |
763 | - : m.type == 'NUMERIC2' | |
764 | - ? 'NUMERIC' | |
765 | - : 'NUMERIC', | |
766 | - value: {}, | |
751 | + valueType: 'NUMERIC', | |
752 | + // value: {}, | |
767 | 753 | predicate: { |
768 | - type: | |
769 | - m.type == 'NUMERIC1' | |
770 | - ? 'NUMERIC' | |
771 | - : m.type == 'NUMERIC2' | |
772 | - ? 'NUMERIC' | |
773 | - : 'NUMERIC', | |
754 | + type: 'NUMERIC', | |
774 | 755 | value: { |
775 | - defaultValue: | |
776 | - Number(m.value1) == null | |
777 | - ? 0 | |
778 | - : Number(m.value1) || Number(m.value2) == null | |
779 | - ? 0 | |
780 | - : Number(m.value2), | |
756 | + defaultValue: Number(m.value) == null ? 0 : Number(m.value), | |
781 | 757 | }, |
782 | - operation: m.operation1 || m.operatio2, | |
758 | + operation: m.operation, | |
783 | 759 | }, |
784 | 760 | }, |
785 | 761 | ], | ... | ... |
... | ... | @@ -45,7 +45,6 @@ |
45 | 45 | const permissionStore = usePermissionStore(); |
46 | 46 | const { createMessage } = useMessage(); |
47 | 47 | const userInfo = getAuthCache(USER_INFO_KEY); |
48 | - // console.log(userInfo, 'userInfo'); | |
49 | 48 | async function handleSubmit() { |
50 | 49 | try { |
51 | 50 | const values = await validate(); | ... | ... |
... | ... | @@ -33,7 +33,6 @@ |
33 | 33 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { |
34 | 34 | await resetFields(); |
35 | 35 | setDrawerProps({ confirmLoading: false }); |
36 | - console.log(data); | |
37 | 36 | isUpdate.value = !!data?.isUpdate; |
38 | 37 | if (unref(isUpdate)) { |
39 | 38 | id = data.record.id; | ... | ... |
... | ... | @@ -45,7 +45,6 @@ |
45 | 45 | ...data.record, |
46 | 46 | }); |
47 | 47 | organizationId = Reflect.get(data.record, 'id'); |
48 | - console.log(organizationId); | |
49 | 48 | let treeData: any = await getOrganizationList(); |
50 | 49 | |
51 | 50 | // 过滤当前选中的组织, |
... | ... | @@ -66,7 +65,6 @@ |
66 | 65 | }); |
67 | 66 | } else { |
68 | 67 | let treeData = await getOrganizationList(); |
69 | - console.log(treeData); | |
70 | 68 | await updateSchema({ |
71 | 69 | field: 'parentId', |
72 | 70 | componentProps: { treeData }, | ... | ... |
... | ... | @@ -15,6 +15,11 @@ |
15 | 15 | <TableAction |
16 | 16 | :actions="[ |
17 | 17 | { |
18 | + label: '设置该租户为默认', | |
19 | + icon: 'ant-design:eye-outlined', | |
20 | + onClick: handleDefault.bind(null, record), | |
21 | + }, | |
22 | + { | |
18 | 23 | label: '编辑', |
19 | 24 | icon: 'clarity:note-edit-line', |
20 | 25 | onClick: handleEdit.bind(null, record), |
... | ... | @@ -46,7 +51,11 @@ |
46 | 51 | import TenantSettingDrawer from './useDrawer.vue'; |
47 | 52 | import { columns, searchFormSchema } from './config'; |
48 | 53 | import { useMessage } from '/@/hooks/web/useMessage'; |
49 | - import { getTableTenantProfileApi, deleteTenantProfileApi } from '/@/api/tenant/tenantApi'; | |
54 | + import { | |
55 | + getTableTenantProfileApi, | |
56 | + deleteTenantProfileApi, | |
57 | + setTenantProfileIsDefaultApi, | |
58 | + } from '/@/api/tenant/tenantApi'; | |
50 | 59 | |
51 | 60 | export default defineComponent({ |
52 | 61 | name: 'Index', |
... | ... | @@ -57,7 +66,7 @@ |
57 | 66 | let selectedRowKeys: Array<string> = []; |
58 | 67 | const [registerDrawer, { openDrawer }] = useDrawer(); |
59 | 68 | const { createMessage } = useMessage(); |
60 | - const [registerTable, { reload, getSelectRowKeys }] = useTable({ | |
69 | + const [registerTable, { reload, getSelectRows }] = useTable({ | |
61 | 70 | title: '', |
62 | 71 | clickToRowSelect: false, |
63 | 72 | api: getTableTenantProfileApi, |
... | ... | @@ -93,28 +102,57 @@ |
93 | 102 | echoEditData = record; |
94 | 103 | } |
95 | 104 | async function handleDelete(record: Recordable) { |
96 | - let ids = [record.id]; | |
105 | + let ids = record.id.id; | |
97 | 106 | await deleteTenantProfileApi(ids); |
98 | 107 | createMessage.success('删除成功'); |
99 | 108 | reload(); |
100 | 109 | } |
101 | 110 | const useSelectionChange = () => { |
102 | - selectedRowKeys = getSelectRowKeys(); | |
111 | + selectedRowKeys = getSelectRows(); | |
103 | 112 | if (selectedRowKeys.length !== 0) { |
104 | 113 | disabled.value = false; |
105 | 114 | } else { |
106 | 115 | disabled.value = true; |
107 | 116 | } |
108 | 117 | }; |
109 | - const handleMutilteDelete = async () => { | |
110 | - await deleteTenantProfileApi(selectedRowKeys); | |
111 | - createMessage.success('删除成功'); | |
118 | + const handleMutilteDelete = () => { | |
119 | + selectedRowKeys.forEach(async (f: any) => { | |
120 | + await deleteTenantProfileApi(f.id.id); | |
121 | + createMessage.success('删除成功'); | |
122 | + reload(); | |
123 | + selectedRowKeys.length = 0; | |
124 | + }); | |
125 | + }; | |
126 | + | |
127 | + const handleDefault = async (record: Recordable) => { | |
128 | + let id = record.id.id; | |
129 | + const obj = { | |
130 | + headers: { | |
131 | + normalizedNames: {}, | |
132 | + lazyUpdate: null, | |
133 | + }, | |
134 | + params: { | |
135 | + updates: null, | |
136 | + cloneFrom: null, | |
137 | + encoder: {}, | |
138 | + map: null, | |
139 | + interceptorConfig: { | |
140 | + ignoreLoading: false, | |
141 | + ignoreErrors: false, | |
142 | + resendRequest: false, | |
143 | + }, | |
144 | + }, | |
145 | + }; | |
146 | + const data = await setTenantProfileIsDefaultApi(id, 'default', obj); | |
147 | + if (!data) return createMessage.error('设置该租户配置为默认失败'); | |
148 | + createMessage.success('设置该租户配置为默认成功'); | |
112 | 149 | reload(); |
113 | 150 | }; |
114 | 151 | function handleSuccess() { |
115 | 152 | reload(); |
116 | 153 | } |
117 | 154 | return { |
155 | + handleDefault, | |
118 | 156 | disabled, |
119 | 157 | echoEditData, |
120 | 158 | registerTable, | ... | ... |
1 | 1 | <template> |
2 | 2 | <div> |
3 | - <BasicTable @register="registerTable"> | |
3 | + <BasicTable | |
4 | + @register="registerTable" | |
5 | + @selection-change="useSelectionChange" | |
6 | + :rowSelection="{ type: 'checkbox' }" | |
7 | + > | |
4 | 8 | <template #toolbar> |
5 | 9 | <a-button type="primary" @click="handleCreate"> 新增角色 </a-button> |
10 | + <a-button type="default" :disabled="disabled" @click="handleBatchDelete"> | |
11 | + 批量删除 | |
12 | + </a-button> | |
6 | 13 | </template> |
7 | 14 | <template #action="{ record }"> |
8 | 15 | <TableAction |
... | ... | @@ -29,11 +36,10 @@ |
29 | 36 | </div> |
30 | 37 | </template> |
31 | 38 | <script lang="ts"> |
32 | - import { defineComponent } from 'vue'; | |
33 | - | |
39 | + import { defineComponent, ref } from 'vue'; | |
34 | 40 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
35 | 41 | import { delRole, getRoleListByPage } from '/@/api/system/system'; |
36 | - | |
42 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
37 | 43 | import { useDrawer } from '/@/components/Drawer'; |
38 | 44 | import RoleDrawer from './RoleDrawer.vue'; |
39 | 45 | import { columns, searchFormSchema } from './role.data'; |
... | ... | @@ -44,7 +50,10 @@ |
44 | 50 | components: { BasicTable, RoleDrawer, TableAction }, |
45 | 51 | setup() { |
46 | 52 | const [registerDrawer, { openDrawer }] = useDrawer(); |
47 | - const [registerTable, { reload }] = useTable({ | |
53 | + let selectedRowKeys: Array<string> = []; | |
54 | + const disabled = ref(true); | |
55 | + const { createMessage } = useMessage(); | |
56 | + const [registerTable, { reload, getSelectRows }] = useTable({ | |
48 | 57 | title: '租户角色列表', |
49 | 58 | api: getRoleListByPage, |
50 | 59 | columns, |
... | ... | @@ -82,14 +91,35 @@ |
82 | 91 | async function handleDelete(record: Recordable) { |
83 | 92 | const roleIds = [record.id]; |
84 | 93 | delRole(roleIds).then(() => { |
94 | + createMessage.success('删除成功'); | |
85 | 95 | reload(); |
86 | 96 | }); |
87 | 97 | } |
98 | + | |
99 | + const useSelectionChange = () => { | |
100 | + selectedRowKeys = getSelectRows(); | |
101 | + if (selectedRowKeys.length !== 0) { | |
102 | + disabled.value = false; | |
103 | + } else { | |
104 | + disabled.value = true; | |
105 | + } | |
106 | + }; | |
107 | + const handleBatchDelete = async () => { | |
108 | + let roleIds = selectedRowKeys.map((m: any) => { | |
109 | + return m.id; | |
110 | + }); | |
111 | + await delRole(roleIds); | |
112 | + createMessage.success('批量删除成功'); | |
113 | + reload(); | |
114 | + }; | |
88 | 115 | function handleSuccess() { |
89 | 116 | reload(); |
90 | 117 | } |
91 | 118 | |
92 | 119 | return { |
120 | + disabled, | |
121 | + useSelectionChange, | |
122 | + handleBatchDelete, | |
93 | 123 | registerTable, |
94 | 124 | registerDrawer, |
95 | 125 | handleCreate, | ... | ... |