Showing
28 changed files
with
1009 additions
and
601 deletions
@@ -6,15 +6,16 @@ import { | @@ -6,15 +6,16 @@ import { | ||
6 | } from './model/dataManagerModel'; | 6 | } from './model/dataManagerModel'; |
7 | 7 | ||
8 | enum DataManagerApi { | 8 | enum DataManagerApi { |
9 | - DATA_MANAGER_CONVERT_ADD_OR_EDIT = '/convert', | ||
10 | - DATA_MANAGER_CONVERT_DELETE = '/convert', | ||
11 | - DATA_MANAGER_CONVERT_POST_CHECK_NAME = '/convert/check', | ||
12 | - DATA_MANAGER_CONVERT_POST_ENABLE_OR_DISABLED = '/convert/update', | 9 | + DATA_MANAGER_CONVERT_ADD_OR_EDIT = '/convert/config', |
10 | + DATA_MANAGER_CONVERT_DELETE = '/convert/config', | ||
11 | + DATA_MANAGER_CONVERT_POST_CHECK_NAME = '/convert/check/config', | ||
12 | + DATA_MANAGER_CONVERT_POST_ENABLE_OR_DISABLED = '/convert/update/config', | ||
13 | DATA_MANAGER_CONVERT_GET = '/convert', | 13 | DATA_MANAGER_CONVERT_GET = '/convert', |
14 | } | 14 | } |
15 | 15 | ||
16 | // 转换配置分页查询 | 16 | // 转换配置分页查询 |
17 | export const getConvertApi = (params: TDataManagerModelQuery) => { | 17 | export const getConvertApi = (params: TDataManagerModelQuery) => { |
18 | + params.nodeType = 1; | ||
18 | return defHttp.get<TDataManagerModelQuery>({ | 19 | return defHttp.get<TDataManagerModelQuery>({ |
19 | url: DataManagerApi.DATA_MANAGER_CONVERT_GET, | 20 | url: DataManagerApi.DATA_MANAGER_CONVERT_GET, |
20 | params, | 21 | params, |
@@ -40,15 +41,16 @@ export const deleteConvertApi = (ids: string[]) => { | @@ -40,15 +41,16 @@ export const deleteConvertApi = (ids: string[]) => { | ||
40 | }; | 41 | }; |
41 | 42 | ||
42 | // 查询配置名称是否存在 | 43 | // 查询配置名称是否存在 |
43 | -export const isExistDataManagerNameApi = (params?: TDataManagerModelQuery) => { | ||
44 | - return defHttp.get({ | 44 | +export const isExistDataManagerNameApi = (check: {}) => { |
45 | + return defHttp.post({ | ||
45 | url: DataManagerApi.DATA_MANAGER_CONVERT_POST_CHECK_NAME, | 46 | url: DataManagerApi.DATA_MANAGER_CONVERT_POST_CHECK_NAME, |
46 | - params, | 47 | + data: check, |
47 | }); | 48 | }); |
48 | }; | 49 | }; |
49 | 50 | ||
50 | // 启用或者禁用配置 | 51 | // 启用或者禁用配置 |
51 | export const isEnableOrDisableApi = (params: IEnableOrDisableModel) => { | 52 | export const isEnableOrDisableApi = (params: IEnableOrDisableModel) => { |
53 | + params.nodeType = 1; | ||
52 | return defHttp.post<IEnableOrDisableModel>({ | 54 | return defHttp.post<IEnableOrDisableModel>({ |
53 | url: DataManagerApi.DATA_MANAGER_CONVERT_POST_ENABLE_OR_DISABLED, | 55 | url: DataManagerApi.DATA_MANAGER_CONVERT_POST_ENABLE_OR_DISABLED, |
54 | params, | 56 | params, |
@@ -5,6 +5,7 @@ export type TDataManagerModelQuery = BasicPageParams & TDataManagerParam; | @@ -5,6 +5,7 @@ export type TDataManagerModelQuery = BasicPageParams & TDataManagerParam; | ||
5 | export type TDataManagerParam = { | 5 | export type TDataManagerParam = { |
6 | name?: string; | 6 | name?: string; |
7 | status?: string; | 7 | status?: string; |
8 | + nodeType?: number; | ||
8 | }; | 9 | }; |
9 | 10 | ||
10 | export interface IDataManagerModel { | 11 | export interface IDataManagerModel { |
@@ -31,4 +32,5 @@ export interface IDataManagerModel { | @@ -31,4 +32,5 @@ export interface IDataManagerModel { | ||
31 | export interface IEnableOrDisableModel { | 32 | export interface IEnableOrDisableModel { |
32 | convertIds?: [string]; | 33 | convertIds?: [string]; |
33 | status?: number; | 34 | status?: number; |
35 | + nodeType?: number; | ||
34 | } | 36 | } |
@@ -65,7 +65,7 @@ function dynamicImport( | @@ -65,7 +65,7 @@ function dynamicImport( | ||
65 | 65 | ||
66 | // Turn background objects into routing objects | 66 | // Turn background objects into routing objects |
67 | export function transformObjToRoute<T = AppRouteModule>(routeList: AppRouteModule[]): T[] { | 67 | export function transformObjToRoute<T = AppRouteModule>(routeList: AppRouteModule[]): T[] { |
68 | - routeList.forEach((route) => { | 68 | + routeList?.forEach((route) => { |
69 | const component = route.component as string; | 69 | const component = route.component as string; |
70 | if (component) { | 70 | if (component) { |
71 | if (component.toUpperCase() === 'LAYOUT') { | 71 | if (component.toUpperCase() === 'LAYOUT') { |
@@ -123,19 +123,23 @@ export const usePermissionStore = defineStore({ | @@ -123,19 +123,23 @@ export const usePermissionStore = defineStore({ | ||
123 | let homePath: string = userStore.getUserInfo.homePath || PageEnum.BASE_HOME; | 123 | let homePath: string = userStore.getUserInfo.homePath || PageEnum.BASE_HOME; |
124 | function patcher(routes: AppRouteRecordRaw[], parentPath = '') { | 124 | function patcher(routes: AppRouteRecordRaw[], parentPath = '') { |
125 | if (parentPath) parentPath = parentPath + '/'; | 125 | if (parentPath) parentPath = parentPath + '/'; |
126 | - routes?.forEach((route: AppRouteRecordRaw) => { | ||
127 | - const { path, children, redirect } = route; | ||
128 | - const currentPath = path.startsWith('/') ? path : parentPath + path; | ||
129 | - if (currentPath === homePath) { | ||
130 | - if (redirect) { | ||
131 | - homePath = route.redirect! as string; | ||
132 | - } else { | ||
133 | - route.meta = Object.assign({}, route.meta, { affix: true }); | ||
134 | - throw new Error('end'); | 126 | + try { |
127 | + routes?.forEach((route: AppRouteRecordRaw) => { | ||
128 | + const { path, children, redirect } = route; | ||
129 | + const currentPath = path.startsWith('/') ? path : parentPath + path; | ||
130 | + if (currentPath === homePath) { | ||
131 | + if (redirect) { | ||
132 | + homePath = route.redirect! as string; | ||
133 | + } else { | ||
134 | + route.meta = Object.assign({}, route.meta, { affix: true }); | ||
135 | + throw new Error('end'); | ||
136 | + } | ||
135 | } | 137 | } |
136 | - } | ||
137 | - children && children.length > 0 && patcher(children, currentPath); | ||
138 | - }); | 138 | + children && children.length > 0 && patcher(children, currentPath); |
139 | + }); | ||
140 | + } catch (e) { | ||
141 | + return e; | ||
142 | + } | ||
139 | } | 143 | } |
140 | try { | 144 | try { |
141 | patcher(routes); | 145 | patcher(routes); |
@@ -57,6 +57,7 @@ | @@ -57,6 +57,7 @@ | ||
57 | }); | 57 | }); |
58 | const getTypeObj = reactive({ | 58 | const getTypeObj = reactive({ |
59 | type: '', | 59 | type: '', |
60 | + remark: '', | ||
60 | }); | 61 | }); |
61 | const additionalInfoV = { | 62 | const additionalInfoV = { |
62 | additionalInfo: { | 63 | additionalInfo: { |
@@ -146,28 +147,35 @@ | @@ -146,28 +147,35 @@ | ||
146 | } | 147 | } |
147 | }; | 148 | }; |
148 | const addOrEditFunc = async () => { | 149 | const addOrEditFunc = async () => { |
150 | + if (!unref(isUpdate)) { | ||
151 | + proxy.$refs.refTransferConfigParams.clearSonValueValidateFunc(); | ||
152 | + } | ||
149 | getModeSonFormValue.value = await proxy.$refs.refTransferConfigMode.getSonValueFunc(); | 153 | getModeSonFormValue.value = await proxy.$refs.refTransferConfigMode.getSonValueFunc(); |
150 | getSonFormValue.value = await proxy.$refs.refTransferConfigParams.getSonValueDataFunc(); | 154 | getSonFormValue.value = await proxy.$refs.refTransferConfigParams.getSonValueDataFunc(); |
151 | if (getModeSonFormValue.value?.type == 'org.thingsboard.rule.engine.kafka.TbKafkaNode') { | 155 | if (getModeSonFormValue.value?.type == 'org.thingsboard.rule.engine.kafka.TbKafkaNode') { |
152 | getTypeObj.type = 'org.thingsboard.rule.engine.kafka.TbKafkaNode'; | 156 | getTypeObj.type = 'org.thingsboard.rule.engine.kafka.TbKafkaNode'; |
157 | + getTypeObj.remark = getModeSonFormValue.value.remark; | ||
153 | getNameObj.name = getSonFormValue.value?.configuration?.name; | 158 | getNameObj.name = getSonFormValue.value?.configuration?.name; |
154 | commonFunc(); | 159 | commonFunc(); |
155 | } else if ( | 160 | } else if ( |
156 | getModeSonFormValue.value?.type == 'org.thingsboard.rule.engine.mqtt.TbMqttNode' | 161 | getModeSonFormValue.value?.type == 'org.thingsboard.rule.engine.mqtt.TbMqttNode' |
157 | ) { | 162 | ) { |
158 | getTypeObj.type = 'org.thingsboard.rule.engine.mqtt.TbMqttNode'; | 163 | getTypeObj.type = 'org.thingsboard.rule.engine.mqtt.TbMqttNode'; |
164 | + getTypeObj.remark = getModeSonFormValue.value.remark; | ||
159 | getNameObj.name = getSonFormValue.value?.configuration?.name; | 165 | getNameObj.name = getSonFormValue.value?.configuration?.name; |
160 | commonFunc(); | 166 | commonFunc(); |
161 | } else if ( | 167 | } else if ( |
162 | getModeSonFormValue.value?.type == 'org.thingsboard.rule.engine.rabbitmq.TbRabbitMqNode' | 168 | getModeSonFormValue.value?.type == 'org.thingsboard.rule.engine.rabbitmq.TbRabbitMqNode' |
163 | ) { | 169 | ) { |
164 | getTypeObj.type = 'org.thingsboard.rule.engine.rabbitmq.TbRabbitMqNode'; | 170 | getTypeObj.type = 'org.thingsboard.rule.engine.rabbitmq.TbRabbitMqNode'; |
171 | + getTypeObj.remark = getModeSonFormValue.value.remark; | ||
165 | getNameObj.name = getSonFormValue.value?.configuration?.name; | 172 | getNameObj.name = getSonFormValue.value?.configuration?.name; |
166 | commonFunc(); | 173 | commonFunc(); |
167 | } else if ( | 174 | } else if ( |
168 | getModeSonFormValue.value?.type == 'org.thingsboard.rule.engine.rest.TbRestApiCallNode' | 175 | getModeSonFormValue.value?.type == 'org.thingsboard.rule.engine.rest.TbRestApiCallNode' |
169 | ) { | 176 | ) { |
170 | getTypeObj.type = 'org.thingsboard.rule.engine.rest.TbRestApiCallNode'; | 177 | getTypeObj.type = 'org.thingsboard.rule.engine.rest.TbRestApiCallNode'; |
178 | + getTypeObj.remark = getModeSonFormValue.value.remark; | ||
171 | getNameObj.name = getSonFormValue.value?.configuration?.name; | 179 | getNameObj.name = getSonFormValue.value?.configuration?.name; |
172 | commonFunc(); | 180 | commonFunc(); |
173 | } | 181 | } |
@@ -192,12 +200,14 @@ | @@ -192,12 +200,14 @@ | ||
192 | await postAddConvertApi(allPostForm); | 200 | await postAddConvertApi(allPostForm); |
193 | createMessage.success('数据转换新增成功'); | 201 | createMessage.success('数据转换新增成功'); |
194 | emit('success'); | 202 | emit('success'); |
203 | + defineClearFunc(); | ||
195 | closeModal(); | 204 | closeModal(); |
196 | } else { | 205 | } else { |
197 | await addOrEditFunc(); | 206 | await addOrEditFunc(); |
198 | await postAddConvertApi(allPostForm); | 207 | await postAddConvertApi(allPostForm); |
199 | createMessage.success('数据转换编辑成功'); | 208 | createMessage.success('数据转换编辑成功'); |
200 | emit('success'); | 209 | emit('success'); |
210 | + defineClearFunc(); | ||
201 | closeModal(); | 211 | closeModal(); |
202 | } | 212 | } |
203 | }; | 213 | }; |
@@ -20,24 +20,24 @@ export const columns: BasicColumn[] = [ | @@ -20,24 +20,24 @@ export const columns: BasicColumn[] = [ | ||
20 | : record.type === 'org.thingsboard.rule.engine.mqtt.TbMqttNode' | 20 | : record.type === 'org.thingsboard.rule.engine.mqtt.TbMqttNode' |
21 | ? 'MQTT' | 21 | ? 'MQTT' |
22 | : record.type === 'org.thingsboard.rule.engine.rabbitmq.TbRabbitMqNode' | 22 | : record.type === 'org.thingsboard.rule.engine.rabbitmq.TbRabbitMqNode' |
23 | - ? 'RabbitMq' | ||
24 | - : 'Api'; | 23 | + ? 'RabbitMQ' |
24 | + : 'REST_API'; | ||
25 | const color = | 25 | const color = |
26 | enable == 'KafKa' | 26 | enable == 'KafKa' |
27 | - ? '#0960cb' | 27 | + ? '#0099FF' |
28 | : enable == 'MQTT' | 28 | : enable == 'MQTT' |
29 | - ? '#ed6f6f' | ||
30 | - : enable == 'RabbitMq' | ||
31 | - ? '#efbd47' | ||
32 | - : '#55d187'; | 29 | + ? '#7C7CC9' |
30 | + : enable == 'RabbitMQ' | ||
31 | + ? '#E8A15E' | ||
32 | + : '#81B1AB'; | ||
33 | const text = | 33 | const text = |
34 | enable == 'KafKa' | 34 | enable == 'KafKa' |
35 | ? 'KafKa' | 35 | ? 'KafKa' |
36 | : enable == 'MQTT' | 36 | : enable == 'MQTT' |
37 | ? 'MQTT' | 37 | ? 'MQTT' |
38 | - : enable == 'RabbitMq' | ||
39 | - ? 'RabbitMq' | ||
40 | - : 'Api'; | 38 | + : enable == 'RabbitMQ' |
39 | + ? 'RabbitMQ' | ||
40 | + : 'REST_API'; | ||
41 | return h(Tag, { color: color }, () => text); | 41 | return h(Tag, { color: color }, () => text); |
42 | }, | 42 | }, |
43 | 43 | ||
@@ -47,8 +47,8 @@ export const columns: BasicColumn[] = [ | @@ -47,8 +47,8 @@ export const columns: BasicColumn[] = [ | ||
47 | : record.type === 'org.thingsboard.rule.engine.mqtt.TbMqttNode' | 47 | : record.type === 'org.thingsboard.rule.engine.mqtt.TbMqttNode' |
48 | ? 'MQTT' | 48 | ? 'MQTT' |
49 | : record.type === 'org.thingsboard.rule.engine.rabbitmq.TbRabbitMqNode' | 49 | : record.type === 'org.thingsboard.rule.engine.rabbitmq.TbRabbitMqNode' |
50 | - ? 'RabbitMq' | ||
51 | - : 'Api'; | 50 | + ? 'RabbitMQ' |
51 | + : 'REST_API'; | ||
52 | }, | 52 | }, |
53 | }, | 53 | }, |
54 | { | 54 | { |
@@ -58,14 +58,14 @@ export const columns: BasicColumn[] = [ | @@ -58,14 +58,14 @@ export const columns: BasicColumn[] = [ | ||
58 | customRender: ({ record }) => { | 58 | customRender: ({ record }) => { |
59 | const status = record.status; | 59 | const status = record.status; |
60 | const enable = ~~status === 1; | 60 | const enable = ~~status === 1; |
61 | - const color = enable ? '#55d187' : '#efbd47'; | 61 | + const color = enable ? '#2aae67' : '#eb846f'; |
62 | const text = enable ? '启用' : '禁用'; | 62 | const text = enable ? '启用' : '禁用'; |
63 | return h(Tag, { color: color }, () => text); | 63 | return h(Tag, { color: color }, () => text); |
64 | }, | 64 | }, |
65 | }, | 65 | }, |
66 | { | 66 | { |
67 | title: '描述', | 67 | title: '描述', |
68 | - dataIndex: 'configuration.description', | 68 | + dataIndex: 'remark', |
69 | width: 200, | 69 | width: 200, |
70 | }, | 70 | }, |
71 | { | 71 | { |
@@ -80,7 +80,7 @@ export const searchFormSchema: FormSchema[] = [ | @@ -80,7 +80,7 @@ export const searchFormSchema: FormSchema[] = [ | ||
80 | field: 'name', | 80 | field: 'name', |
81 | label: '名称', | 81 | label: '名称', |
82 | component: 'Input', | 82 | component: 'Input', |
83 | - colProps: { span: 8 }, | 83 | + colProps: { span: 6 }, |
84 | componentProps: { | 84 | componentProps: { |
85 | maxLength: 36, | 85 | maxLength: 36, |
86 | placeholder: '请输入名称', | 86 | placeholder: '请输入名称', |
1 | import { FormSchema } from '/@/components/Form'; | 1 | import { FormSchema } from '/@/components/Form'; |
2 | import { findDictItemByCode } from '/@/api/system/dict'; | 2 | import { findDictItemByCode } from '/@/api/system/dict'; |
3 | +import { isExistDataManagerNameApi } from '/@/api/datamanager/dataManagerApi'; | ||
4 | +import { ref } from 'vue'; | ||
5 | +import { useMessage } from '/@/hooks/web/useMessage'; | ||
6 | +const { createMessage } = useMessage(); | ||
7 | + | ||
8 | +const typeValue = ref(''); | ||
3 | 9 | ||
4 | export enum CredentialsEnum { | 10 | export enum CredentialsEnum { |
5 | IS_ANONYMOUS = 'anonymous', | 11 | IS_ANONYMOUS = 'anonymous', |
@@ -23,13 +29,28 @@ export const modeForm: FormSchema[] = [ | @@ -23,13 +29,28 @@ export const modeForm: FormSchema[] = [ | ||
23 | colProps: { | 29 | colProps: { |
24 | span: 13, | 30 | span: 13, |
25 | }, | 31 | }, |
32 | + componentProps({}) { | ||
33 | + return { | ||
34 | + api: findDictItemByCode, | ||
35 | + params: { | ||
36 | + dictCode: 'convert_data_to', | ||
37 | + }, | ||
38 | + labelField: 'itemText', | ||
39 | + valueField: 'itemValue', | ||
40 | + onChange(value) { | ||
41 | + typeValue.value = value; | ||
42 | + }, | ||
43 | + }; | ||
44 | + }, | ||
45 | + }, | ||
46 | + { | ||
47 | + field: 'remark', | ||
48 | + label: '描述', | ||
49 | + colProps: { span: 13 }, | ||
50 | + component: 'Input', | ||
26 | componentProps: { | 51 | componentProps: { |
27 | - api: findDictItemByCode, | ||
28 | - params: { | ||
29 | - dictCode: 'convert_data_to', | ||
30 | - }, | ||
31 | - labelField: 'itemText', | ||
32 | - valueField: 'itemValue', | 52 | + maxLength: 255, |
53 | + placeholder: '请输入描述', | ||
33 | }, | 54 | }, |
34 | }, | 55 | }, |
35 | ]; | 56 | ]; |
@@ -95,6 +116,39 @@ export const modeKafkaForm: FormSchema[] = [ | @@ -95,6 +116,39 @@ export const modeKafkaForm: FormSchema[] = [ | ||
95 | maxLength: 255, | 116 | maxLength: 255, |
96 | placeholder: '请输入名称', | 117 | placeholder: '请输入名称', |
97 | }, | 118 | }, |
119 | + dynamicRules: ({ values }) => { | ||
120 | + return [ | ||
121 | + { | ||
122 | + required: true, | ||
123 | + validator(_, value) { | ||
124 | + return new Promise((resolve, reject) => { | ||
125 | + if (value == '') { | ||
126 | + reject('请输入名称'); | ||
127 | + } else { | ||
128 | + if (values.name != undefined) { | ||
129 | + isExistDataManagerNameApi({ | ||
130 | + name: value, | ||
131 | + type: | ||
132 | + typeValue.value == '' | ||
133 | + ? 'org.thingsboard.rule.engine.kafka.TbKafkaNode' | ||
134 | + : typeValue.value, | ||
135 | + }).then((data) => { | ||
136 | + if (data == true) { | ||
137 | + createMessage.error('名称已存在'); | ||
138 | + resolve(); | ||
139 | + } else { | ||
140 | + resolve(); | ||
141 | + } | ||
142 | + }); | ||
143 | + } else { | ||
144 | + resolve(); | ||
145 | + } | ||
146 | + } | ||
147 | + }); | ||
148 | + }, | ||
149 | + }, | ||
150 | + ]; | ||
151 | + }, | ||
98 | }, | 152 | }, |
99 | { | 153 | { |
100 | field: 'topicPattern', | 154 | field: 'topicPattern', |
@@ -264,6 +318,39 @@ export const modeMqttForm: FormSchema[] = [ | @@ -264,6 +318,39 @@ export const modeMqttForm: FormSchema[] = [ | ||
264 | maxLength: 255, | 318 | maxLength: 255, |
265 | placeholder: '请输入名称', | 319 | placeholder: '请输入名称', |
266 | }, | 320 | }, |
321 | + dynamicRules: ({ values }) => { | ||
322 | + return [ | ||
323 | + { | ||
324 | + required: true, | ||
325 | + validator(_, value) { | ||
326 | + return new Promise((resolve, reject) => { | ||
327 | + if (value == '') { | ||
328 | + reject('请输入名称'); | ||
329 | + } else { | ||
330 | + if (values.name != undefined) { | ||
331 | + isExistDataManagerNameApi({ | ||
332 | + name: value, | ||
333 | + type: | ||
334 | + typeValue.value == '' | ||
335 | + ? 'org.thingsboard.rule.engine.mqtt.TbMqttNode' | ||
336 | + : typeValue.value, | ||
337 | + }).then((data) => { | ||
338 | + if (data == true) { | ||
339 | + createMessage.error('名称已存在'); | ||
340 | + resolve(); | ||
341 | + } else { | ||
342 | + resolve(); | ||
343 | + } | ||
344 | + }); | ||
345 | + } else { | ||
346 | + resolve(); | ||
347 | + } | ||
348 | + } | ||
349 | + }); | ||
350 | + }, | ||
351 | + }, | ||
352 | + ]; | ||
353 | + }, | ||
267 | }, | 354 | }, |
268 | { | 355 | { |
269 | field: 'topicPattern', | 356 | field: 'topicPattern', |
@@ -431,6 +518,39 @@ export const modeRabbitMqForm: FormSchema[] = [ | @@ -431,6 +518,39 @@ export const modeRabbitMqForm: FormSchema[] = [ | ||
431 | maxLength: 255, | 518 | maxLength: 255, |
432 | placeholder: '请输入名称', | 519 | placeholder: '请输入名称', |
433 | }, | 520 | }, |
521 | + dynamicRules: ({ values }) => { | ||
522 | + return [ | ||
523 | + { | ||
524 | + required: true, | ||
525 | + validator(_, value) { | ||
526 | + return new Promise((resolve, reject) => { | ||
527 | + if (value == '') { | ||
528 | + reject('请输入名称'); | ||
529 | + } else { | ||
530 | + if (values.name != undefined) { | ||
531 | + isExistDataManagerNameApi({ | ||
532 | + name: value, | ||
533 | + type: | ||
534 | + typeValue.value == '' | ||
535 | + ? 'org.thingsboard.rule.engine.rabbitmq.TbRabbitMqNode' | ||
536 | + : typeValue.value, | ||
537 | + }).then((data) => { | ||
538 | + if (data == true) { | ||
539 | + createMessage.error('名称已存在'); | ||
540 | + resolve(); | ||
541 | + } else { | ||
542 | + resolve(); | ||
543 | + } | ||
544 | + }); | ||
545 | + } else { | ||
546 | + resolve(); | ||
547 | + } | ||
548 | + } | ||
549 | + }); | ||
550 | + }, | ||
551 | + }, | ||
552 | + ]; | ||
553 | + }, | ||
434 | }, | 554 | }, |
435 | { | 555 | { |
436 | field: 'exchangeNamePattern', | 556 | field: 'exchangeNamePattern', |
@@ -535,7 +655,7 @@ export const modeRabbitMqForm: FormSchema[] = [ | @@ -535,7 +655,7 @@ export const modeRabbitMqForm: FormSchema[] = [ | ||
535 | }, | 655 | }, |
536 | { | 656 | { |
537 | field: 'connectionTimeout', | 657 | field: 'connectionTimeout', |
538 | - label: 'Connection', | 658 | + label: 'Connect', |
539 | colProps: { span: 12 }, | 659 | colProps: { span: 12 }, |
540 | component: 'InputNumber', | 660 | component: 'InputNumber', |
541 | defaultValue: 60000, | 661 | defaultValue: 60000, |
@@ -586,6 +706,39 @@ export const modeApiForm: FormSchema[] = [ | @@ -586,6 +706,39 @@ export const modeApiForm: FormSchema[] = [ | ||
586 | maxLength: 255, | 706 | maxLength: 255, |
587 | placeholder: '请输入名称', | 707 | placeholder: '请输入名称', |
588 | }, | 708 | }, |
709 | + dynamicRules: ({ values }) => { | ||
710 | + return [ | ||
711 | + { | ||
712 | + required: true, | ||
713 | + validator(_, value) { | ||
714 | + return new Promise((resolve, reject) => { | ||
715 | + if (value == '') { | ||
716 | + reject('请输入名称'); | ||
717 | + } else { | ||
718 | + if (values.name != undefined) { | ||
719 | + isExistDataManagerNameApi({ | ||
720 | + name: value, | ||
721 | + type: | ||
722 | + typeValue.value == '' | ||
723 | + ? 'org.thingsboard.rule.engine.rest.TbRestApiCallNode' | ||
724 | + : typeValue.value, | ||
725 | + }).then((data) => { | ||
726 | + if (data == true) { | ||
727 | + createMessage.error('名称已存在'); | ||
728 | + resolve(); | ||
729 | + } else { | ||
730 | + resolve(); | ||
731 | + } | ||
732 | + }); | ||
733 | + } else { | ||
734 | + resolve(); | ||
735 | + } | ||
736 | + } | ||
737 | + }); | ||
738 | + }, | ||
739 | + }, | ||
740 | + ]; | ||
741 | + }, | ||
589 | }, | 742 | }, |
590 | { | 743 | { |
591 | field: 'restEndpointUrlPattern', | 744 | field: 'restEndpointUrlPattern', |
@@ -30,7 +30,7 @@ | @@ -30,7 +30,7 @@ | ||
30 | width: 2.9vw; | 30 | width: 2.9vw; |
31 | height: 3.3vh; | 31 | height: 3.3vh; |
32 | background-color: #0960bd; | 32 | background-color: #0960bd; |
33 | - border-radius: 1px; | 33 | + border-radius: 2px; |
34 | cursor: pointer; | 34 | cursor: pointer; |
35 | text-align: center; | 35 | text-align: center; |
36 | line-height: 3.1vh; | 36 | line-height: 3.1vh; |
@@ -44,7 +44,7 @@ | @@ -44,7 +44,7 @@ | ||
44 | height: 3.3vh; | 44 | height: 3.3vh; |
45 | margin-left: 1vw; | 45 | margin-left: 1vw; |
46 | background-color: #ed6f6f; | 46 | background-color: #ed6f6f; |
47 | - border-radius: 1px; | 47 | + border-radius: 2px; |
48 | cursor: pointer; | 48 | cursor: pointer; |
49 | text-align: center; | 49 | text-align: center; |
50 | line-height: 3.1vh; | 50 | line-height: 3.1vh; |
@@ -59,7 +59,7 @@ | @@ -59,7 +59,7 @@ | ||
59 | </template> | 59 | </template> |
60 | <template #uploadAdd1="{ field }"> | 60 | <template #uploadAdd1="{ field }"> |
61 | <span style="display: none">{{ field }}</span> | 61 | <span style="display: none">{{ field }}</span> |
62 | - <UploadDragger | 62 | + <a-upload-dragger |
63 | v-model:fileList="fileList" | 63 | v-model:fileList="fileList" |
64 | name="file" | 64 | name="file" |
65 | :multiple="true" | 65 | :multiple="true" |
@@ -74,11 +74,11 @@ | @@ -74,11 +74,11 @@ | ||
74 | Support for a single or bulk upload. Strictly prohibit from uploading company data or | 74 | Support for a single or bulk upload. Strictly prohibit from uploading company data or |
75 | other band files | 75 | other band files |
76 | </p> | 76 | </p> |
77 | - </UploadDragger> | 77 | + </a-upload-dragger> |
78 | </template> | 78 | </template> |
79 | <template #uploadAdd2="{ field }"> | 79 | <template #uploadAdd2="{ field }"> |
80 | <span style="display: none">{{ field }}</span> | 80 | <span style="display: none">{{ field }}</span> |
81 | - <UploadDragger | 81 | + <a-upload-dragger |
82 | v-model:fileList="fileList" | 82 | v-model:fileList="fileList" |
83 | name="file" | 83 | name="file" |
84 | :multiple="true" | 84 | :multiple="true" |
@@ -93,11 +93,11 @@ | @@ -93,11 +93,11 @@ | ||
93 | Support for a single or bulk upload. Strictly prohibit from uploading company data or | 93 | Support for a single or bulk upload. Strictly prohibit from uploading company data or |
94 | other band files | 94 | other band files |
95 | </p> | 95 | </p> |
96 | - </UploadDragger> | 96 | + </a-upload-dragger> |
97 | </template> | 97 | </template> |
98 | <template #uploadAdd3="{ field }"> | 98 | <template #uploadAdd3="{ field }"> |
99 | <span style="display: none">{{ field }}</span> | 99 | <span style="display: none">{{ field }}</span> |
100 | - <UploadDragger | 100 | + <a-upload-dragger |
101 | v-model:fileList="fileList" | 101 | v-model:fileList="fileList" |
102 | name="file" | 102 | name="file" |
103 | :multiple="true" | 103 | :multiple="true" |
@@ -112,7 +112,7 @@ | @@ -112,7 +112,7 @@ | ||
112 | Support for a single or bulk upload. Strictly prohibit from uploading company data or | 112 | Support for a single or bulk upload. Strictly prohibit from uploading company data or |
113 | other band files | 113 | other band files |
114 | </p> | 114 | </p> |
115 | - </UploadDragger> | 115 | + </a-upload-dragger> |
116 | </template> | 116 | </template> |
117 | </BasicForm> | 117 | </BasicForm> |
118 | </div> | 118 | </div> |
@@ -136,8 +136,7 @@ | @@ -136,8 +136,7 @@ | ||
136 | [Descriptions.name]: Descriptions, | 136 | [Descriptions.name]: Descriptions, |
137 | [Descriptions.Item.name]: Descriptions.Item, | 137 | [Descriptions.Item.name]: Descriptions.Item, |
138 | InboxOutlined, | 138 | InboxOutlined, |
139 | - | ||
140 | - [Upload.UploadDragger]: Upload.UploadDragger, | 139 | + [Upload.Dragger.name]: Upload.Dragger, |
141 | }, | 140 | }, |
142 | emits: ['next', 'prev', 'register'], | 141 | emits: ['next', 'prev', 'register'], |
143 | setup(_, { emit }) { | 142 | setup(_, { emit }) { |
@@ -276,11 +275,14 @@ | @@ -276,11 +275,14 @@ | ||
276 | width: 45vw; | 275 | width: 45vw; |
277 | margin: 1vh 1vw; | 276 | margin: 1vh 1vw; |
278 | position: relative; | 277 | position: relative; |
278 | + :deep .ant-input-number { | ||
279 | + width: 18.35vw !important; | ||
280 | + } | ||
279 | :deep .ant-btn { | 281 | :deep .ant-btn { |
280 | position: absolute; | 282 | position: absolute; |
281 | right: 1vw; | 283 | right: 1vw; |
282 | background-color: #0960bd; | 284 | background-color: #0960bd; |
283 | - border-radius: 1px; | 285 | + border-radius: 2px; |
284 | span { | 286 | span { |
285 | color: white; | 287 | color: white; |
286 | } | 288 | } |
@@ -32,7 +32,7 @@ | @@ -32,7 +32,7 @@ | ||
32 | width: 2.9vw; | 32 | width: 2.9vw; |
33 | height: 3.3vh; | 33 | height: 3.3vh; |
34 | background-color: #0960bd; | 34 | background-color: #0960bd; |
35 | - border-radius: 1px; | 35 | + border-radius: 2px; |
36 | cursor: pointer; | 36 | cursor: pointer; |
37 | text-align: center; | 37 | text-align: center; |
38 | line-height: 3.1vh; | 38 | line-height: 3.1vh; |
@@ -46,7 +46,7 @@ | @@ -46,7 +46,7 @@ | ||
46 | height: 3.3vh; | 46 | height: 3.3vh; |
47 | margin-left: 1vw; | 47 | margin-left: 1vw; |
48 | background-color: #ed6f6f; | 48 | background-color: #ed6f6f; |
49 | - border-radius: 1px; | 49 | + border-radius: 2px; |
50 | cursor: pointer; | 50 | cursor: pointer; |
51 | text-align: center; | 51 | text-align: center; |
52 | line-height: 3.1vh; | 52 | line-height: 3.1vh; |
@@ -67,7 +67,7 @@ | @@ -67,7 +67,7 @@ | ||
67 | margin-left: 22vw; | 67 | margin-left: 22vw; |
68 | margin-top: 2vh; | 68 | margin-top: 2vh; |
69 | background-color: #0960bd; | 69 | background-color: #0960bd; |
70 | - border-radius: 1px; | 70 | + border-radius: 2px; |
71 | cursor: pointer; | 71 | cursor: pointer; |
72 | text-align: center; | 72 | text-align: center; |
73 | line-height: 3.1vh; | 73 | line-height: 3.1vh; |
@@ -115,17 +115,18 @@ | @@ -115,17 +115,18 @@ | ||
115 | otherProperties: {}, | 115 | otherProperties: {}, |
116 | }); | 116 | }); |
117 | 117 | ||
118 | - const [register, { validate, setFieldsValue, resetFields: defineClearFunc }] = useForm({ | ||
119 | - labelWidth: 80, | ||
120 | - schemas: modeKafkaForm, | ||
121 | - actionColOptions: { | ||
122 | - span: 14, | ||
123 | - }, | ||
124 | - resetButtonOptions: { | ||
125 | - text: '上一步', | ||
126 | - }, | ||
127 | - resetFunc: customResetFunc, | ||
128 | - }); | 118 | + const [register, { validate, setFieldsValue, resetFields: defineClearFunc, clearValidate }] = |
119 | + useForm({ | ||
120 | + labelWidth: 80, | ||
121 | + schemas: modeKafkaForm, | ||
122 | + actionColOptions: { | ||
123 | + span: 14, | ||
124 | + }, | ||
125 | + resetButtonOptions: { | ||
126 | + text: '上一步', | ||
127 | + }, | ||
128 | + resetFunc: customResetFunc, | ||
129 | + }); | ||
129 | 130 | ||
130 | const [ | 131 | const [ |
131 | registerKeyAndValue, | 132 | registerKeyAndValue, |
@@ -138,6 +139,11 @@ | @@ -138,6 +139,11 @@ | ||
138 | }, | 139 | }, |
139 | }); | 140 | }); |
140 | 141 | ||
142 | + const clearValidateFunc = async () => { | ||
143 | + console.log(1); | ||
144 | + await clearValidate(['name']); | ||
145 | + }; | ||
146 | + | ||
141 | const setStepTwoFieldsValueFunc = async (v, v1) => { | 147 | const setStepTwoFieldsValueFunc = async (v, v1) => { |
142 | setFieldsValue(v); | 148 | setFieldsValue(v); |
143 | vType.value = v1; | 149 | vType.value = v1; |
@@ -199,6 +205,7 @@ | @@ -199,6 +205,7 @@ | ||
199 | } | 205 | } |
200 | }; | 206 | }; |
201 | return { | 207 | return { |
208 | + clearValidateFunc, | ||
202 | getSonValueFunc, | 209 | getSonValueFunc, |
203 | keyAndValueArr, | 210 | keyAndValueArr, |
204 | register, | 211 | register, |
@@ -224,6 +231,9 @@ | @@ -224,6 +231,9 @@ | ||
224 | width: 45vw; | 231 | width: 45vw; |
225 | margin: 1vh 1vw; | 232 | margin: 1vh 1vw; |
226 | position: relative; | 233 | position: relative; |
234 | + :deep .ant-input-number { | ||
235 | + width: 18.35vw !important; | ||
236 | + } | ||
227 | } | 237 | } |
228 | } | 238 | } |
229 | </style> | 239 | </style> |
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | <BasicForm :showSubmitButton="false" @register="register"> | 4 | <BasicForm :showSubmitButton="false" @register="register"> |
5 | <template #uploadAdd1="{ field }"> | 5 | <template #uploadAdd1="{ field }"> |
6 | <span style="display: none">{{ field }}</span> | 6 | <span style="display: none">{{ field }}</span> |
7 | - <UploadDragger | 7 | + <a-upload-dragger |
8 | v-model:fileList="fileList" | 8 | v-model:fileList="fileList" |
9 | name="file" | 9 | name="file" |
10 | :multiple="true" | 10 | :multiple="true" |
@@ -19,11 +19,11 @@ | @@ -19,11 +19,11 @@ | ||
19 | Support for a single or bulk upload. Strictly prohibit from uploading company data or | 19 | Support for a single or bulk upload. Strictly prohibit from uploading company data or |
20 | other band files | 20 | other band files |
21 | </p> | 21 | </p> |
22 | - </UploadDragger> | 22 | + </a-upload-dragger> |
23 | </template> | 23 | </template> |
24 | <template #uploadAdd2="{ field }"> | 24 | <template #uploadAdd2="{ field }"> |
25 | <span style="display: none">{{ field }}</span> | 25 | <span style="display: none">{{ field }}</span> |
26 | - <UploadDragger | 26 | + <a-upload-dragger |
27 | v-model:fileList="fileList" | 27 | v-model:fileList="fileList" |
28 | name="file" | 28 | name="file" |
29 | :multiple="true" | 29 | :multiple="true" |
@@ -38,11 +38,11 @@ | @@ -38,11 +38,11 @@ | ||
38 | Support for a single or bulk upload. Strictly prohibit from uploading company data or | 38 | Support for a single or bulk upload. Strictly prohibit from uploading company data or |
39 | other band files | 39 | other band files |
40 | </p> | 40 | </p> |
41 | - </UploadDragger> | 41 | + </a-upload-dragger> |
42 | </template> | 42 | </template> |
43 | <template #uploadAdd3="{ field }"> | 43 | <template #uploadAdd3="{ field }"> |
44 | <span style="display: none">{{ field }}</span> | 44 | <span style="display: none">{{ field }}</span> |
45 | - <UploadDragger | 45 | + <a-upload-dragger |
46 | v-model:fileList="fileList" | 46 | v-model:fileList="fileList" |
47 | name="file" | 47 | name="file" |
48 | :multiple="true" | 48 | :multiple="true" |
@@ -57,7 +57,7 @@ | @@ -57,7 +57,7 @@ | ||
57 | Support for a single or bulk upload. Strictly prohibit from uploading company data or | 57 | Support for a single or bulk upload. Strictly prohibit from uploading company data or |
58 | other band files | 58 | other band files |
59 | </p> | 59 | </p> |
60 | - </UploadDragger> | 60 | + </a-upload-dragger> |
61 | </template> | 61 | </template> |
62 | </BasicForm> | 62 | </BasicForm> |
63 | </div> | 63 | </div> |
@@ -78,8 +78,7 @@ | @@ -78,8 +78,7 @@ | ||
78 | [Descriptions.name]: Descriptions, | 78 | [Descriptions.name]: Descriptions, |
79 | [Descriptions.Item.name]: Descriptions.Item, | 79 | [Descriptions.Item.name]: Descriptions.Item, |
80 | InboxOutlined, | 80 | InboxOutlined, |
81 | - | ||
82 | - [Upload.UploadDragger]: Upload.UploadDragger, | 81 | + [Upload.Dragger.name]: Upload.Dragger, |
83 | }, | 82 | }, |
84 | emits: ['next', 'prev', 'register'], | 83 | emits: ['next', 'prev', 'register'], |
85 | setup(_, { emit }) { | 84 | setup(_, { emit }) { |
@@ -106,7 +105,6 @@ | @@ -106,7 +105,6 @@ | ||
106 | submitFunc: customSubmitFunc, | 105 | submitFunc: customSubmitFunc, |
107 | }); | 106 | }); |
108 | const setStepTwoFieldsValueFunc = (v, v1) => { | 107 | const setStepTwoFieldsValueFunc = (v, v1) => { |
109 | - console.log(v); | ||
110 | setFieldsValue(v); | 108 | setFieldsValue(v); |
111 | setFieldsValue({ | 109 | setFieldsValue({ |
112 | name: v1, | 110 | name: v1, |
@@ -157,11 +155,14 @@ | @@ -157,11 +155,14 @@ | ||
157 | width: 45vw; | 155 | width: 45vw; |
158 | margin: 1vh 1vw; | 156 | margin: 1vh 1vw; |
159 | position: relative; | 157 | position: relative; |
158 | + :deep .ant-input-number { | ||
159 | + width: 18.35vw !important; | ||
160 | + } | ||
160 | :deep .ant-btn { | 161 | :deep .ant-btn { |
161 | position: absolute; | 162 | position: absolute; |
162 | right: 1vw; | 163 | right: 1vw; |
163 | background-color: #0960bd; | 164 | background-color: #0960bd; |
164 | - border-radius: 1px; | 165 | + border-radius: 2px; |
165 | span { | 166 | span { |
166 | color: white; | 167 | color: white; |
167 | } | 168 | } |
@@ -205,11 +205,14 @@ | @@ -205,11 +205,14 @@ | ||
205 | width: 44vw; | 205 | width: 44vw; |
206 | margin: 1vh 1vw; | 206 | margin: 1vh 1vw; |
207 | position: relative; | 207 | position: relative; |
208 | + :deep .ant-input-number { | ||
209 | + width: 17.85vw !important; | ||
210 | + } | ||
208 | :deep .ant-btn { | 211 | :deep .ant-btn { |
209 | position: absolute; | 212 | position: absolute; |
210 | right: 1vw; | 213 | right: 1vw; |
211 | background-color: #0960bd; | 214 | background-color: #0960bd; |
212 | - border-radius: 1px; | 215 | + border-radius: 2px; |
213 | span { | 216 | span { |
214 | color: white; | 217 | color: white; |
215 | } | 218 | } |
@@ -66,6 +66,16 @@ | @@ -66,6 +66,16 @@ | ||
66 | return e; | 66 | return e; |
67 | } | 67 | } |
68 | }; | 68 | }; |
69 | + const clearSonValueValidateFunc = () => { | ||
70 | + try { | ||
71 | + proxy.$refs.refTransferConfigKafka?.clearValidateFunc(); | ||
72 | + // proxy.$refs.refTransferConfigMqtt?.customClearStepTwoValueFunc(); | ||
73 | + // proxy.$refs.refTransferConfigRabbitMq?.customClearStepTwoValueFunc(); | ||
74 | + // proxy.$refs.refTransferConfigApi?.customClearStepTwoValueFunc(); | ||
75 | + } catch (e) { | ||
76 | + return e; | ||
77 | + } | ||
78 | + }; | ||
69 | const getSonValueDataFunc = () => { | 79 | const getSonValueDataFunc = () => { |
70 | if (isWhereComp.value == 'org.thingsboard.rule.engine.kafka.TbKafkaNode') { | 80 | if (isWhereComp.value == 'org.thingsboard.rule.engine.kafka.TbKafkaNode') { |
71 | getTransferConfigKafkaValue.value = proxy.$refs.refTransferConfigKafka.getSonValueFunc(); | 81 | getTransferConfigKafkaValue.value = proxy.$refs.refTransferConfigKafka.getSonValueFunc(); |
@@ -80,7 +90,6 @@ | @@ -80,7 +90,6 @@ | ||
80 | return getTransferConfigKafkaValue.value; | 90 | return getTransferConfigKafkaValue.value; |
81 | }; | 91 | }; |
82 | const editSonValueDataFunc = (v) => { | 92 | const editSonValueDataFunc = (v) => { |
83 | - console.log(v.type); | ||
84 | try { | 93 | try { |
85 | if (v.type == 'org.thingsboard.rule.engine.kafka.TbKafkaNode') { | 94 | if (v.type == 'org.thingsboard.rule.engine.kafka.TbKafkaNode') { |
86 | isWhereComp.value = v.type; | 95 | isWhereComp.value = v.type; |
@@ -103,6 +112,7 @@ | @@ -103,6 +112,7 @@ | ||
103 | } | 112 | } |
104 | }; | 113 | }; |
105 | return { | 114 | return { |
115 | + clearSonValueValidateFunc, | ||
106 | clearSonValueDataFunc, | 116 | clearSonValueDataFunc, |
107 | editSonValueDataFunc, | 117 | editSonValueDataFunc, |
108 | refTransferConfigKafka, | 118 | refTransferConfigKafka, |
@@ -11,26 +11,23 @@ | @@ -11,26 +11,23 @@ | ||
11 | <a-button | 11 | <a-button |
12 | :disabled="disabledStatus1" | 12 | :disabled="disabledStatus1" |
13 | @click="handleDelete" | 13 | @click="handleDelete" |
14 | - style="background-color: rgba(237, 111, 111, 1)" | ||
15 | - type="primary" | 14 | + :type="disabledStatus1 ? 'default' : 'primary'" |
16 | > | 15 | > |
17 | - <span style="color: white">批量删除</span> | 16 | + <span :style="{ color: disabledStatus1 ? 'grey' : 'white' }">批量删除</span> |
18 | </a-button> | 17 | </a-button> |
19 | <a-button | 18 | <a-button |
20 | :disabled="disabledStatus2" | 19 | :disabled="disabledStatus2" |
21 | @click="handleMutiuteDisable" | 20 | @click="handleMutiuteDisable" |
22 | - style="background-color: rgba(128, 128, 128.2)" | ||
23 | - type="primary" | 21 | + :type="disabledStatus2 ? 'default' : 'primary'" |
24 | > | 22 | > |
25 | - <span style="color: white">批量禁用</span> | 23 | + <span :style="{ color: disabledStatus2 ? 'grey' : 'white' }">批量禁用</span> |
26 | </a-button> | 24 | </a-button> |
27 | <a-button | 25 | <a-button |
28 | :disabled="disabledStatus3" | 26 | :disabled="disabledStatus3" |
29 | @click="handleMutiuteEnable" | 27 | @click="handleMutiuteEnable" |
30 | - style="background-color: #55d187" | ||
31 | - type="primary" | 28 | + :type="disabledStatus3 ? 'default' : 'primary'" |
32 | > | 29 | > |
33 | - <span style="color: white">批量启用</span> | 30 | + <span :style="{ color: disabledStatus3 ? 'grey' : 'white' }">批量启用</span> |
34 | </a-button> | 31 | </a-button> |
35 | </template> | 32 | </template> |
36 | <template #action="{ record }"> | 33 | <template #action="{ record }"> |
@@ -71,8 +68,7 @@ | @@ -71,8 +68,7 @@ | ||
71 | }, | 68 | }, |
72 | { | 69 | { |
73 | label: '禁用', | 70 | label: '禁用', |
74 | - icon: 'ant-design:close-outlined', | ||
75 | - color: 'warning', | 71 | + icon: 'ant-design:close-circle-outlined', |
76 | popConfirm: { | 72 | popConfirm: { |
77 | title: '是否禁用?', | 73 | title: '是否禁用?', |
78 | confirm: handleDisable.bind(null, record), | 74 | confirm: handleDisable.bind(null, record), |
@@ -168,9 +164,9 @@ | @@ -168,9 +164,9 @@ | ||
168 | }; | 164 | }; |
169 | 165 | ||
170 | const handleEnableOrDisable = async (record: Recordable) => { | 166 | const handleEnableOrDisable = async (record: Recordable) => { |
167 | + setLoading(true); | ||
168 | + enableObj.convertIds.length = 0; | ||
171 | try { | 169 | try { |
172 | - setLoading(true); | ||
173 | - enableObj.convertIds.length = 0; | ||
174 | enableObj.status = record.status; | 170 | enableObj.status = record.status; |
175 | enableObj.convertIds.push(record.id as never); | 171 | enableObj.convertIds.push(record.id as never); |
176 | if (enableObj.status == 0) { | 172 | if (enableObj.status == 0) { |
@@ -191,9 +187,9 @@ | @@ -191,9 +187,9 @@ | ||
191 | } | 187 | } |
192 | }; | 188 | }; |
193 | const handleDisable = async (record: Recordable) => { | 189 | const handleDisable = async (record: Recordable) => { |
190 | + setLoading(true); | ||
191 | + enableObj.convertIds.length = 0; | ||
194 | try { | 192 | try { |
195 | - setLoading(true); | ||
196 | - enableObj.convertIds.length = 0; | ||
197 | enableObj.status = record.status; | 193 | enableObj.status = record.status; |
198 | enableObj.convertIds.push(record.id as never); | 194 | enableObj.convertIds.push(record.id as never); |
199 | if (enableObj.status == 1) { | 195 | if (enableObj.status == 1) { |
@@ -228,6 +224,11 @@ | @@ -228,6 +224,11 @@ | ||
228 | const hasDisableStatus = isJudgeSelectRowsArr.value.map((m) => { | 224 | const hasDisableStatus = isJudgeSelectRowsArr.value.map((m) => { |
229 | return m.status; | 225 | return m.status; |
230 | }); | 226 | }); |
227 | + if (hasDisableStatus.length == 0) { | ||
228 | + disabledStatus1.value = true; | ||
229 | + disabledStatus2.value = true; | ||
230 | + disabledStatus3.value = true; | ||
231 | + } | ||
231 | hasDisableStatus.every((e) => { | 232 | hasDisableStatus.every((e) => { |
232 | if (e == 1) { | 233 | if (e == 1) { |
233 | disabledStatus3.value = true; | 234 | disabledStatus3.value = true; |
@@ -251,12 +252,25 @@ | @@ -251,12 +252,25 @@ | ||
251 | }; | 252 | }; |
252 | 253 | ||
253 | const handleDelete = async () => { | 254 | const handleDelete = async () => { |
254 | - await deleteConvertApi(selectedRowKeys.value); | ||
255 | - createMessage.success('删除成功'); | ||
256 | - reload(); | ||
257 | - clearSelectedRowKeys(); | 255 | + try { |
256 | + setLoading(true); | ||
257 | + const data = await deleteConvertApi(selectedRowKeys.value); | ||
258 | + if (data == true) { | ||
259 | + createMessage.success('删除成功'); | ||
260 | + setLoading(false); | ||
261 | + reload(); | ||
262 | + } else { | ||
263 | + createMessage.error('删除失败'); | ||
264 | + } | ||
265 | + } catch (e) { | ||
266 | + return e; | ||
267 | + } finally { | ||
268 | + setLoading(false); | ||
269 | + clearSelectedRowKeys(); | ||
270 | + } | ||
258 | }; | 271 | }; |
259 | const handleMutiuteDisable = async () => { | 272 | const handleMutiuteDisable = async () => { |
273 | + enableObj.convertIds.length = 0; | ||
260 | try { | 274 | try { |
261 | setLoading(true); | 275 | setLoading(true); |
262 | getSelectRowsArr.value = getSelectRows(); | 276 | getSelectRowsArr.value = getSelectRows(); |
@@ -283,6 +297,7 @@ | @@ -283,6 +297,7 @@ | ||
283 | }; | 297 | }; |
284 | 298 | ||
285 | const handleMutiuteEnable = async () => { | 299 | const handleMutiuteEnable = async () => { |
300 | + enableObj.convertIds.length = 0; | ||
286 | try { | 301 | try { |
287 | setLoading(true); | 302 | setLoading(true); |
288 | getSelectRowsArr.value = getSelectRows(); | 303 | getSelectRowsArr.value = getSelectRows(); |
@@ -120,11 +120,13 @@ | @@ -120,11 +120,13 @@ | ||
120 | const [register, { closeModal }] = useModalInner(async (data) => { | 120 | const [register, { closeModal }] = useModalInner(async (data) => { |
121 | isUpdate.value = data.isUpdate; | 121 | isUpdate.value = data.isUpdate; |
122 | if (isUpdate.value == 1) { | 122 | if (isUpdate.value == 1) { |
123 | + proxy.$refs.DeviceProfileStep3Ref.isAddRuleStatusFunc(true); | ||
123 | isShowRule.value = true; | 124 | isShowRule.value = true; |
124 | isShowOkBtnFalse.value = true; | 125 | isShowOkBtnFalse.value = true; |
125 | current.value = 0; | 126 | current.value = 0; |
126 | isStatus.value = !data.isUpdate; | 127 | isStatus.value = !data.isUpdate; |
127 | //清空第一步数据 | 128 | //清空第一步数据 |
129 | + proxy.$refs.DeviceProfileStep1Ref.resetIconFunc(); | ||
128 | proxy.$refs.DeviceProfileStep1Ref.customResetStepOneFunc(); | 130 | proxy.$refs.DeviceProfileStep1Ref.customResetStepOneFunc(); |
129 | proxy.$refs.DeviceProfileStep3Ref.clearAllRegisterFormFunc(); | 131 | proxy.$refs.DeviceProfileStep3Ref.clearAllRegisterFormFunc(); |
130 | //报警详细信息 | 132 | //报警详细信息 |
@@ -133,6 +135,7 @@ | @@ -133,6 +135,7 @@ | ||
133 | stepThreeData: {}, | 135 | stepThreeData: {}, |
134 | }); | 136 | }); |
135 | } else if (isUpdate.value == 2) { | 137 | } else if (isUpdate.value == 2) { |
138 | + proxy.$refs.DeviceProfileStep3Ref.isAddRuleStatusFunc(true); | ||
136 | isShowRule.value = true; | 139 | isShowRule.value = true; |
137 | isShowOkBtnFalse.value = true; | 140 | isShowOkBtnFalse.value = true; |
138 | current.value = 0; | 141 | current.value = 0; |
@@ -152,6 +155,7 @@ | @@ -152,6 +155,7 @@ | ||
152 | getBackendData = await deviceConfigGetDetail(postEditId.value); | 155 | getBackendData = await deviceConfigGetDetail(postEditId.value); |
153 | editData.value = getBackendData; | 156 | editData.value = getBackendData; |
154 | } else if (isUpdate.value == 3) { | 157 | } else if (isUpdate.value == 3) { |
158 | + proxy.$refs.DeviceProfileStep3Ref.isAddRuleStatusFunc(false); | ||
155 | isShowRule.value = false; | 159 | isShowRule.value = false; |
156 | isShowOkBtnFalse.value = false; | 160 | isShowOkBtnFalse.value = false; |
157 | current.value = 0; | 161 | current.value = 0; |
@@ -214,6 +218,9 @@ | @@ -214,6 +218,9 @@ | ||
214 | stepThreeData: editData.value?.profileData.alarms[0].createRules, | 218 | stepThreeData: editData.value?.profileData.alarms[0].createRules, |
215 | stepThreeClearData: editData.value?.profileData.alarms[0].clearRule, | 219 | stepThreeClearData: editData.value?.profileData.alarms[0].clearRule, |
216 | }); | 220 | }); |
221 | + proxy.$refs.DeviceProfileStep3Ref.setCreateRegisterFormChangeDetailFunc( | ||
222 | + editData.value?.profileData.alarms[0].createRules | ||
223 | + ); | ||
217 | proxy.$refs.DeviceProfileStep3Ref.setRegisterFormClearChangeDetailFunc({ | 224 | proxy.$refs.DeviceProfileStep3Ref.setRegisterFormClearChangeDetailFunc({ |
218 | alarmDetails: editData.value?.profileData.alarms[0].clearRule.alarmDetails, | 225 | alarmDetails: editData.value?.profileData.alarms[0].clearRule.alarmDetails, |
219 | }); | 226 | }); |
@@ -232,6 +239,9 @@ | @@ -232,6 +239,9 @@ | ||
232 | stepThreeData: editData.value?.profileData.alarms[0].createRules, | 239 | stepThreeData: editData.value?.profileData.alarms[0].createRules, |
233 | stepThreeClearData: editData.value?.profileData.alarms[0].clearRule, | 240 | stepThreeClearData: editData.value?.profileData.alarms[0].clearRule, |
234 | }); | 241 | }); |
242 | + proxy.$refs.DeviceProfileStep3Ref.setCreateRegisterFormChangeDetailFunc( | ||
243 | + editData.value?.profileData.alarms[0].createRules | ||
244 | + ); | ||
235 | proxy.$refs.DeviceProfileStep3Ref.setRegisterFormClearChangeDetailFunc({ | 245 | proxy.$refs.DeviceProfileStep3Ref.setRegisterFormClearChangeDetailFunc({ |
236 | alarmDetails: editData.value?.profileData.alarms[0].clearRule.alarmDetails, | 246 | alarmDetails: editData.value?.profileData.alarms[0].clearRule.alarmDetails, |
237 | }); | 247 | }); |
@@ -312,6 +322,11 @@ | @@ -312,6 +322,11 @@ | ||
312 | 322 | ||
313 | const handleCancel = () => { | 323 | const handleCancel = () => { |
314 | closeModal(); | 324 | closeModal(); |
325 | + try { | ||
326 | + proxy.$refs.DeviceProfileStep4Ref.clearAlaramContactAndNoticeMethodFunc(); | ||
327 | + } catch (e) { | ||
328 | + return e; | ||
329 | + } | ||
315 | }; | 330 | }; |
316 | return { | 331 | return { |
317 | isShowRule, | 332 | isShowRule, |
@@ -12,7 +12,9 @@ | @@ -12,7 +12,9 @@ | ||
12 | <ImpExcel @success="loadDataSuccess" dateFormat="YYYY-MM-DD"> | 12 | <ImpExcel @success="loadDataSuccess" dateFormat="YYYY-MM-DD"> |
13 | <a-button @click="handleImport"> 导入设备配置 </a-button> | 13 | <a-button @click="handleImport"> 导入设备配置 </a-button> |
14 | </ImpExcel> | 14 | </ImpExcel> |
15 | - <a-button danger color="error" @click="handleTableDel"> 删除 </a-button> | 15 | + <a-button danger color="error" @click="handleTableDel" :disabled="disabled"> |
16 | + 批量删除 | ||
17 | + </a-button> | ||
16 | </template> | 18 | </template> |
17 | <template #action="{ record }"> | 19 | <template #action="{ record }"> |
18 | <TableAction | 20 | <TableAction |
@@ -75,10 +77,11 @@ | @@ -75,10 +77,11 @@ | ||
75 | let selectedRowKeys: string[] = reactive([]); | 77 | let selectedRowKeys: string[] = reactive([]); |
76 | const getPathUrl = ref(''); | 78 | const getPathUrl = ref(''); |
77 | const getPathUrlName = ref(''); | 79 | const getPathUrlName = ref(''); |
80 | + const disabled = ref(true); | ||
78 | 81 | ||
79 | const { createMessage } = useMessage(); | 82 | const { createMessage } = useMessage(); |
80 | const [registerModal, { openModal }] = useModal(); | 83 | const [registerModal, { openModal }] = useModal(); |
81 | - const [registerModalDetail, { openModal: openModalDetail }] = useModal(); | 84 | + const [registerModalDetail] = useModal(); |
82 | const [registerTable, { reload, getSelectRowKeys }] = useTable({ | 85 | const [registerTable, { reload, getSelectRowKeys }] = useTable({ |
83 | title: '设备配置列表', | 86 | title: '设备配置列表', |
84 | pagination: true, | 87 | pagination: true, |
@@ -179,6 +182,11 @@ | @@ -179,6 +182,11 @@ | ||
179 | } | 182 | } |
180 | const useSelectionChange = () => { | 183 | const useSelectionChange = () => { |
181 | selectedRowKeys = getSelectRowKeys(); | 184 | selectedRowKeys = getSelectRowKeys(); |
185 | + if (selectedRowKeys.length > 0) { | ||
186 | + disabled.value = false; | ||
187 | + } else { | ||
188 | + disabled.value = true; | ||
189 | + } | ||
182 | }; | 190 | }; |
183 | async function handleTableDel() { | 191 | async function handleTableDel() { |
184 | await deviceConfigDelete(selectedRowKeys); | 192 | await deviceConfigDelete(selectedRowKeys); |
@@ -219,6 +227,7 @@ | @@ -219,6 +227,7 @@ | ||
219 | reload(); | 227 | reload(); |
220 | } | 228 | } |
221 | return { | 229 | return { |
230 | + disabled, | ||
222 | deviceDetailRef, | 231 | deviceDetailRef, |
223 | setRowClassName, | 232 | setRowClassName, |
224 | registerModalDetail, | 233 | registerModalDetail, |
1 | <template> | 1 | <template> |
2 | <div class="step1"> | 2 | <div class="step1"> |
3 | <div class="step1-form"> | 3 | <div class="step1-form"> |
4 | - <div | ||
5 | - style=" | ||
6 | - width: 12vw; | ||
7 | - height: 24vh; | ||
8 | - margin-left: 25px; | ||
9 | - display: flex; | ||
10 | - justify-content: space-between; | ||
11 | - align-items: center; | ||
12 | - " | ||
13 | - > | ||
14 | - <div style="width: 4vw; height: 24vh">请上传图片</div> | ||
15 | - <div class="device-icon-style" style="width: 8vw; height: 24vh"> | ||
16 | - <Upload | ||
17 | - style="width: 20vw" | ||
18 | - name="avatar" | ||
19 | - list-type="picture-card" | ||
20 | - class="avatar-uploader" | ||
21 | - :show-upload-list="false" | ||
22 | - :customRequest="customUploadqrcodePic" | ||
23 | - :before-upload="beforeUploadqrcodePic" | ||
24 | - > | ||
25 | - <img | ||
26 | - style="text-align: center; width: 13vw; height: 15vh" | ||
27 | - v-if="peresonalPic" | ||
28 | - :src="peresonalPic" | ||
29 | - alt="avatar" | ||
30 | - /> | ||
31 | - <div v-else> | ||
32 | - <div style="margin-top: 30px"> | ||
33 | - <PlusOutlined style="font-size: 30px; margin-left: -166px" /> | 4 | + <div> |
5 | + <BasicForm @register="register"> | ||
6 | + <template #imageSelect> | ||
7 | + <Upload | ||
8 | + style="width: 20vw" | ||
9 | + name="avatar" | ||
10 | + list-type="picture-card" | ||
11 | + class="avatar-uploader" | ||
12 | + :show-upload-list="false" | ||
13 | + :customRequest="customUploadqrcodePic" | ||
14 | + :before-upload="beforeUploadqrcodePic" | ||
15 | + > | ||
16 | + <img | ||
17 | + v-if="peresonalPic" | ||
18 | + :src="peresonalPic" | ||
19 | + alt="avatar" | ||
20 | + style="width: 6.25rem; height: 6.25rem" | ||
21 | + /> | ||
22 | + <div v-else> | ||
23 | + <PlusOutlined /> | ||
24 | + <div class="ant-upload-text">图片上传</div> | ||
34 | </div> | 25 | </div> |
35 | - <div | ||
36 | - class="ant-upload-text flex" | ||
37 | - style="width: 280px; height: 130px; align-items: center; margin-left: 43px" | ||
38 | - > | ||
39 | - 请上传图片</div | ||
40 | - > | ||
41 | - </div> | ||
42 | - </Upload> | ||
43 | - </div> | ||
44 | - </div> | ||
45 | - <div style="margin-top: -50px"> | ||
46 | - <BasicForm @register="register" /> | 26 | + </Upload> |
27 | + </template> | ||
28 | + </BasicForm> | ||
47 | </div> | 29 | </div> |
48 | </div> | 30 | </div> |
49 | </div> | 31 | </div> |
@@ -173,8 +155,8 @@ | @@ -173,8 +155,8 @@ | ||
173 | :deep .ant-upload-select-picture-card { | 155 | :deep .ant-upload-select-picture-card { |
174 | display: inherit; | 156 | display: inherit; |
175 | float: none; | 157 | float: none; |
176 | - width: 8.6vw; | ||
177 | - height: 17vh; | 158 | + width: 4.9vw; |
159 | + height: 9.5vh; | ||
178 | margin-right: 8px; | 160 | margin-right: 8px; |
179 | text-align: center; | 161 | text-align: center; |
180 | vertical-align: top; | 162 | vertical-align: top; |
@@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
7 | <template #action> | 7 | <template #action> |
8 | <div class="cursor-pointer"> | 8 | <div class="cursor-pointer"> |
9 | <img | 9 | <img |
10 | + v-if="isAddRuleStatus" | ||
10 | style="cursor: pointer" | 11 | style="cursor: pointer" |
11 | @click="deleteAlarmRule(index)" | 12 | @click="deleteAlarmRule(index)" |
12 | alt="移除" | 13 | alt="移除" |
@@ -68,10 +69,20 @@ | @@ -68,10 +69,20 @@ | ||
68 | <!-- 报警严重程度 --> | 69 | <!-- 报警严重程度 --> |
69 | <div style="margin-left: 10px; margin-top: 20px" | 70 | <div style="margin-left: 10px; margin-top: 20px" |
70 | ><BasicForm @register="registerFormCreateAlarm" /> | 71 | ><BasicForm @register="registerFormCreateAlarm" /> |
72 | + <div | ||
73 | + v-for="(i8, index8) in getStepThreeEditStatus ? createAlarmArray : []" | ||
74 | + :key="index8" | ||
75 | + style="position: relative" | ||
76 | + > | ||
77 | + <p | ||
78 | + style="position: absolute; top: -6vh; left: 6.5vw" | ||
79 | + v-if="index8 == createIndex" | ||
80 | + >{{ formatAlarmFunc(i8) }}</p | ||
81 | + > | ||
82 | + </div> | ||
71 | </div> | 83 | </div> |
72 | <!-- 报警严重程度 --> | 84 | <!-- 报警严重程度 --> |
73 | - | ||
74 | - <div style="margin-left: 5px; margin-top: -50px"> | 85 | + <div style="margin-left: 5px; margin-top: -35px"> |
75 | <div style="color: #f5594e" class="ml-4" | 86 | <div style="color: #f5594e" class="ml-4" |
76 | >报警规则条件: | 87 | >报警规则条件: |
77 | <Button | 88 | <Button |
@@ -89,25 +100,7 @@ | @@ -89,25 +100,7 @@ | ||
89 | :key="index2" | 100 | :key="index2" |
90 | > | 101 | > |
91 | <p v-if="index2 == createIndex && !getStepThreeEditStatus" | 102 | <p v-if="index2 == createIndex && !getStepThreeEditStatus" |
92 | - >报警规则条件:{{ | ||
93 | - v2.predicate.operation == 'EQUAL' | ||
94 | - ? v2.key.key + '等于' + v2.predicate.value.defaultValue | ||
95 | - : v2.predicate.operation == 'STARTS_WITH' | ||
96 | - ? v2.key.key + '开始于' + v2.predicate.value.defaultValue | ||
97 | - : v2.predicate.operation == 'ENDS_WITH' | ||
98 | - ? v2.key.key + '结束于' + v2.predicate.value.defaultValue | ||
99 | - : v2.predicate.operation == 'NOT_CONTAINS' | ||
100 | - ? v2.key.key + '不包含' + v2.predicate.value.defaultValue | ||
101 | - : v2.predicate.operation == 'NOT_EQUAL' | ||
102 | - ? v2.key.key + '不等于' + v2.predicate.value.defaultValue | ||
103 | - : v2.predicate.operation == 'GREATER' | ||
104 | - ? v2.key.key + '大于' + v2.predicate.value.defaultValue | ||
105 | - : v2.predicate.operation == 'LESS' | ||
106 | - ? v2.key.key + '小于' + v2.predicate.value.defaultValue | ||
107 | - : v2.predicate.operation == 'GREATER_OR_EQUAL' | ||
108 | - ? v2.key.key + '大于或等于' + v2.predicate.value.defaultValue | ||
109 | - : v2.key.key + '小于或等于' + v2.predicate.value.defaultValue | ||
110 | - }}</p | 103 | + >报警规则条件:{{ formatAddRuleFunc(v2) }}</p |
111 | > | 104 | > |
112 | <p v-if="index2 == createIndex && getStepThreeEditStatus" | 105 | <p v-if="index2 == createIndex && getStepThreeEditStatus" |
113 | >报警规则条件:{{ openRuleConditionComp(v2) }}</p | 106 | >报警规则条件:{{ openRuleConditionComp(v2) }}</p |
@@ -149,6 +142,18 @@ | @@ -149,6 +142,18 @@ | ||
149 | <div style="position: absolute; top: -5px; left: 106px; width: 581px"> | 142 | <div style="position: absolute; top: -5px; left: 106px; width: 581px"> |
150 | <BasicForm @register="registerFormChangeDetail" /> | 143 | <BasicForm @register="registerFormChangeDetail" /> |
151 | </div> | 144 | </div> |
145 | + <div | ||
146 | + v-for="(i7, index7) in getStepThreeEditStatus | ||
147 | + ? detailDetailModelArray | ||
148 | + : []" | ||
149 | + :key="index7" | ||
150 | + > | ||
151 | + <p | ||
152 | + style="margin-top: 1.5vh; margin-left: 5.6vw" | ||
153 | + v-if="index7 == createIndex" | ||
154 | + >{{ i7 }}</p | ||
155 | + > | ||
156 | + </div> | ||
152 | </div> | 157 | </div> |
153 | <div style="margin-top: 25px; position: relative"> | 158 | <div style="margin-top: 25px; position: relative"> |
154 | <div style="margin-left: -14px"> | 159 | <div style="margin-left: -14px"> |
@@ -162,6 +167,7 @@ | @@ -162,6 +167,7 @@ | ||
162 | style="display: inline-block; position: relative; top: -257px; left: 757px" | 167 | style="display: inline-block; position: relative; top: -257px; left: 757px" |
163 | > | 168 | > |
164 | <img | 169 | <img |
170 | + v-if="isAddRuleStatus" | ||
165 | style="cursor: pointer" | 171 | style="cursor: pointer" |
166 | @click="deleteCondition(index, createIndex)" | 172 | @click="deleteCondition(index, createIndex)" |
167 | alt="移除" | 173 | alt="移除" |
@@ -173,7 +179,11 @@ | @@ -173,7 +179,11 @@ | ||
173 | </div> | 179 | </div> |
174 | </template> | 180 | </template> |
175 | <div> | 181 | <div> |
176 | - <a-button style="border-radius: 10px" class="mt-5" @click="addCreateRole(index)" | 182 | + <a-button |
183 | + v-if="isAddRuleStatus" | ||
184 | + style="border-radius: 10px" | ||
185 | + class="mt-5" | ||
186 | + @click="addCreateRole(index)" | ||
177 | ><PlusCircleOutlined />添加创建条件</a-button | 187 | ><PlusCircleOutlined />添加创建条件</a-button |
178 | > | 188 | > |
179 | </div> | 189 | </div> |
@@ -227,25 +237,7 @@ | @@ -227,25 +237,7 @@ | ||
227 | <span style="display: none">{{ index4 }}</span> | 237 | <span style="display: none">{{ index4 }}</span> |
228 | 238 | ||
229 | <p v-if="!getStepThreeEditStatus" | 239 | <p v-if="!getStepThreeEditStatus" |
230 | - >报警规则条件:{{ | ||
231 | - v4.predicate.operation == 'EQUAL' | ||
232 | - ? v4.key.key + '等于' + v4.predicate.value.defaultValue | ||
233 | - : v4.predicate.operation == 'STARTS_WITH' | ||
234 | - ? v4.key.key + '开始于' + v4.predicate.value.defaultValue | ||
235 | - : v4.predicate.operation == 'ENDS_WITH' | ||
236 | - ? v4.key.key + '结束于' + v4.predicate.value.defaultValue | ||
237 | - : v4.predicate.operation == 'NOT_CONTAINS' | ||
238 | - ? v4.key.key + '不包含' + v4.predicate.value.defaultValue | ||
239 | - : v4.predicate.operation == 'NOT_EQUAL' | ||
240 | - ? v4.key.key + '不等于' + v4.predicate.value.defaultValue | ||
241 | - : v4.predicate.operation == 'GREATER' | ||
242 | - ? v4.key.key + '大于' + v4.predicate.value.defaultValue | ||
243 | - : v4.predicate.operation == 'LESS' | ||
244 | - ? v4.key.key + '小于' + v4.predicate.value.defaultValue | ||
245 | - : v4.predicate.operation == 'GREATER_OR_EQUAL' | ||
246 | - ? v4.key.key + '大于或等于' + v4.predicate.value.defaultValue | ||
247 | - : v4.key.key + '小于或等于' + v4.predicate.value.defaultValue | ||
248 | - }}</p | 240 | + >报警规则条件:{{ formatClearRuleFunc(v4) }}</p |
249 | > | 241 | > |
250 | <p v-if="getStepThreeEditStatus" | 242 | <p v-if="getStepThreeEditStatus" |
251 | >报警规则条件:{{ openClearRuleConditionComp(v4) }}</p | 243 | >报警规则条件:{{ openClearRuleConditionComp(v4) }}</p |
@@ -313,7 +305,11 @@ | @@ -313,7 +305,11 @@ | ||
313 | <div class="flex justify-center" style="display: fixed; bottom: 100px"> | 305 | <div class="flex justify-center" style="display: fixed; bottom: 100px"> |
314 | <a-button class="mr-5" @click="prevStep">上一步</a-button> | 306 | <a-button class="mr-5" @click="prevStep">上一步</a-button> |
315 | <a-button @click="handleFormStep3toStep4Next">下一步</a-button> | 307 | <a-button @click="handleFormStep3toStep4Next">下一步</a-button> |
316 | - <a-button style="margin-left: 20px" type="primary" @click="addAlarmRule" | 308 | + <a-button |
309 | + v-if="isAddRuleStatus" | ||
310 | + style="margin-left: 20px" | ||
311 | + type="primary" | ||
312 | + @click="addAlarmRule" | ||
317 | >添加报警规则</a-button | 313 | >添加报警规则</a-button |
318 | > | 314 | > |
319 | </div> | 315 | </div> |
@@ -354,6 +350,7 @@ | @@ -354,6 +350,7 @@ | ||
354 | emits: ['prev', 'next', 'redo', 'handleFormStep3toStep4Next'], | 350 | emits: ['prev', 'next', 'redo', 'handleFormStep3toStep4Next'], |
355 | props: ['getAllStepThreeData', 'isAddOrEdit', 'isShowAddRule'], | 351 | props: ['getAllStepThreeData', 'isAddOrEdit', 'isShowAddRule'], |
356 | setup(props, { emit }) { | 352 | setup(props, { emit }) { |
353 | + const isAddRuleStatus = ref(true); | ||
357 | const { proxy } = getCurrentInstance(); | 354 | const { proxy } = getCurrentInstance(); |
358 | const changeGetDetailValue = ref({}); | 355 | const changeGetDetailValue = ref({}); |
359 | const changeGetClearDetailValue = ref({}); | 356 | const changeGetClearDetailValue = ref({}); |
@@ -462,9 +459,7 @@ | @@ -462,9 +459,7 @@ | ||
462 | schedule: {}, | 459 | schedule: {}, |
463 | }); | 460 | }); |
464 | let kongRuleConditionObj = reactive({ | 461 | let kongRuleConditionObj = reactive({ |
465 | - condition: { | ||
466 | - condition: {}, | ||
467 | - }, | 462 | + condition: {}, |
468 | }); | 463 | }); |
469 | let fliterTempRuleConditionTempArr = ref<[]>([]); | 464 | let fliterTempRuleConditionTempArr = ref<[]>([]); |
470 | let fliterTempOpenRuleTempArr = ref<[]>([]); | 465 | let fliterTempOpenRuleTempArr = ref<[]>([]); |
@@ -476,6 +471,10 @@ | @@ -476,6 +471,10 @@ | ||
476 | const getFilterStepThreeEditClearArr = ref<[]>([]); | 471 | const getFilterStepThreeEditClearArr = ref<[]>([]); |
477 | const getFilterStepThreeClearDetailEditArr = ref<[]>([]); | 472 | const getFilterStepThreeClearDetailEditArr = ref<[]>([]); |
478 | let getIsShowAddRule = true; | 473 | let getIsShowAddRule = true; |
474 | + | ||
475 | + const detailDetailModelArray = ref<[]>([]); | ||
476 | + const createAlarmArray = ref<[]>([]); | ||
477 | + | ||
479 | // getIsShowAddRule.value = props.isShowAddRule; | 478 | // getIsShowAddRule.value = props.isShowAddRule; |
480 | // console.log(getIsShowAddRule.value); | 479 | // console.log(getIsShowAddRule.value); |
481 | setTimeout(() => { | 480 | setTimeout(() => { |
@@ -485,6 +484,9 @@ | @@ -485,6 +484,9 @@ | ||
485 | const log = (e) => { | 484 | const log = (e) => { |
486 | console.log(e); | 485 | console.log(e); |
487 | }; | 486 | }; |
487 | + const isAddRuleStatusFunc = (v) => { | ||
488 | + isAddRuleStatus.value = v; | ||
489 | + }; | ||
488 | //编辑清空操作 | 490 | //编辑清空操作 |
489 | const clearProfileDataFunc = () => { | 491 | const clearProfileDataFunc = () => { |
490 | profileData.value.splice(0, 1); | 492 | profileData.value.splice(0, 1); |
@@ -550,8 +552,8 @@ | @@ -550,8 +552,8 @@ | ||
550 | registerFormChangeDetail, | 552 | registerFormChangeDetail, |
551 | { | 553 | { |
552 | getFieldsValue: getRegisterFormChangeDetail, | 554 | getFieldsValue: getRegisterFormChangeDetail, |
553 | - setFieldsValue: setRegisterFormChangeDetail, | ||
554 | resetFields: resetRegisterFormChangeDetail, | 555 | resetFields: resetRegisterFormChangeDetail, |
556 | + // setFieldsValue: setCreateRegisterFormChangeDetail, | ||
555 | }, | 557 | }, |
556 | ] = useForm({ | 558 | ] = useForm({ |
557 | labelWidth: 120, | 559 | labelWidth: 120, |
@@ -626,6 +628,8 @@ | @@ -626,6 +628,8 @@ | ||
626 | getFilterStepThreeEditArr.value = []; | 628 | getFilterStepThreeEditArr.value = []; |
627 | getFilterStepThreeEditClearArr.value = []; | 629 | getFilterStepThreeEditClearArr.value = []; |
628 | getStepThreeEditStatus.value = false; | 630 | getStepThreeEditStatus.value = false; |
631 | + detailDetailModelArray.value = []; | ||
632 | + createAlarmArray.value = []; | ||
629 | }; | 633 | }; |
630 | const initClearCreateRuleFunc = () => { | 634 | const initClearCreateRuleFunc = () => { |
631 | profileData.value.forEach((f) => { | 635 | profileData.value.forEach((f) => { |
@@ -655,7 +659,7 @@ | @@ -655,7 +659,7 @@ | ||
655 | const setRegisterFormCreateAlarmFunc = (v) => { | 659 | const setRegisterFormCreateAlarmFunc = (v) => { |
656 | setRegisterFormCreateAlarm(v); | 660 | setRegisterFormCreateAlarm(v); |
657 | }; | 661 | }; |
658 | - // | 662 | + |
659 | const optionsAlaram = [ | 663 | const optionsAlaram = [ |
660 | { | 664 | { |
661 | value: 'CRITICAL', | 665 | value: 'CRITICAL', |
@@ -702,40 +706,29 @@ | @@ -702,40 +706,29 @@ | ||
702 | ? '定时启用' | 706 | ? '定时启用' |
703 | : '自定义启用'; | 707 | : '自定义启用'; |
704 | }; | 708 | }; |
705 | - const optionsOperation = [ | ||
706 | - { label: '等于', value: 'EQUAL' }, | ||
707 | - { label: '不等于', value: 'NOT_EQUAL' }, | ||
708 | - { label: '开始于', value: 'STARTS_WITH' }, | ||
709 | - { label: '结束于', value: 'ENDS_WITH' }, | ||
710 | - { label: '包含', value: 'CONTAINS' }, | ||
711 | - { label: '不包含', value: 'NOT_CONTAINS' }, | ||
712 | - { label: '大于', value: 'GREATER' }, | ||
713 | - { label: '小于', value: 'LESS' }, | ||
714 | - { label: '大于或等于', value: 'GREATER_OR_EQUAL' }, | ||
715 | - { label: '小于或等于', value: 'LESS_OR_EQUAL' }, | ||
716 | - ]; | ||
717 | //清除报警规则 | 709 | //清除报警规则 |
718 | const openClearRuleConditionComp = (v4) => { | 710 | const openClearRuleConditionComp = (v4) => { |
719 | try { | 711 | try { |
720 | - let clearRuleObj = {}; | ||
721 | - v4.condition.condition?.forEach((f) => { | ||
722 | - clearRuleObj = f; | 712 | + let formatMap = v4.condition.condition.map((f) => { |
713 | + return f.predicate.operation == 'EQUAL' | ||
714 | + ? f.key.key + '等于' + f.predicate.value.defaultValue | ||
715 | + : f.predicate.operation == 'STARTS_WITH' | ||
716 | + ? f.key.key + '开始于' + f.predicate.value.defaultValue | ||
717 | + : f.predicate.operation == 'ENDS_WITH' | ||
718 | + ? f.key.key + '结束于' + f.predicate.value.defaultValue | ||
719 | + : f.predicate.operation == 'NOT_CONTAINS' | ||
720 | + ? f.key.key + '不包含' + f.predicate.value.defaultValue | ||
721 | + : f.predicate.operation == 'NOT_EQUAL' | ||
722 | + ? f.key.key + '不等于' + f.predicate.value.defaultValue | ||
723 | + : f.predicate.operation == 'GREATER' | ||
724 | + ? f.key.key + '大于' + f.predicate.value.defaultValue | ||
725 | + : f.predicate.operation == 'LESS' | ||
726 | + ? f.key.key + '小于' + f.predicate.value.defaultValue | ||
727 | + : f.predicate.operation == 'GREATER_OR_EQUAL' | ||
728 | + ? f.key.key + '大于或等于' + f.predicate.value.defaultValue | ||
729 | + : f.key.key + '小于或等于' + f.predicate.value.defaultValue; | ||
723 | }); | 730 | }); |
724 | - return clearRuleObj?.predicate?.operation == 'LESS_OR_EQUAL' | ||
725 | - ? clearRuleObj?.key?.key + '小于或等于' + clearRuleObj?.predicate?.value?.defaultValue | ||
726 | - : clearRuleObj?.predicate?.operation == 'EQUAL' | ||
727 | - ? clearRuleObj?.key?.key + '等于' + clearRuleObj?.predicate?.value?.defaultValue | ||
728 | - : clearRuleObj?.predicate?.operation == 'NOT_EQUAL' | ||
729 | - ? clearRuleObj?.key?.key + '不等于' + clearRuleObj?.predicate?.value?.defaultValue | ||
730 | - : clearRuleObj?.predicate?.operation == 'ENDS_WITH' | ||
731 | - ? clearRuleObj?.key?.key + '结束于' + clearRuleObj?.predicate?.value?.defaultValue | ||
732 | - : clearRuleObj?.predicate?.operation == 'CONTAINS' | ||
733 | - ? clearRuleObj?.key?.key + '包含' + clearRuleObj?.predicate?.value?.defaultValue | ||
734 | - : clearRuleObj?.predicate?.operation == 'GREATER' | ||
735 | - ? clearRuleObj?.key?.key + '大于' + clearRuleObj?.predicate?.value?.defaultValue | ||
736 | - : clearRuleObj?.predicate?.operation == 'LESS' | ||
737 | - ? clearRuleObj?.key?.key + '小于' + clearRuleObj?.predicate?.value?.defaultValue | ||
738 | - : clearRuleObj?.key?.key + '小于或等于' + clearRuleObj?.predicate?.value?.defaultValue; | 731 | + return formatMap; |
739 | } catch (e) { | 732 | } catch (e) { |
740 | return e; | 733 | return e; |
741 | } | 734 | } |
@@ -757,27 +750,26 @@ | @@ -757,27 +750,26 @@ | ||
757 | openRuleConditObj = v2[i]; | 750 | openRuleConditObj = v2[i]; |
758 | } | 751 | } |
759 | } | 752 | } |
760 | - let createRuleObj = {}; | ||
761 | - openRuleConditObj?.condition?.condition?.forEach((f) => { | ||
762 | - createRuleObj = f; | 753 | + let formatMap = openRuleConditObj?.condition?.condition.map((f) => { |
754 | + return f.predicate.operation == 'EQUAL' | ||
755 | + ? f.key.key + '等于' + f.predicate.value.defaultValue | ||
756 | + : f.predicate.operation == 'STARTS_WITH' | ||
757 | + ? f.key.key + '开始于' + f.predicate.value.defaultValue | ||
758 | + : f.predicate.operation == 'ENDS_WITH' | ||
759 | + ? f.key.key + '结束于' + f.predicate.value.defaultValue | ||
760 | + : f.predicate.operation == 'NOT_CONTAINS' | ||
761 | + ? f.key.key + '不包含' + f.predicate.value.defaultValue | ||
762 | + : f.predicate.operation == 'NOT_EQUAL' | ||
763 | + ? f.key.key + '不等于' + f.predicate.value.defaultValue | ||
764 | + : f.predicate.operation == 'GREATER' | ||
765 | + ? f.key.key + '大于' + f.predicate.value.defaultValue | ||
766 | + : f.predicate.operation == 'LESS' | ||
767 | + ? f.key.key + '小于' + f.predicate.value.defaultValue | ||
768 | + : f.predicate.operation == 'GREATER_OR_EQUAL' | ||
769 | + ? f.key.key + '大于或等于' + f.predicate.value.defaultValue | ||
770 | + : f.key.key + '小于或等于' + f.predicate.value.defaultValue; | ||
763 | }); | 771 | }); |
764 | - return createRuleObj?.predicate?.operation == 'LESS_OR_EQUAL' | ||
765 | - ? createRuleObj?.key?.key + '小于或等于' + createRuleObj?.predicate?.value?.defaultValue | ||
766 | - : createRuleObj?.predicate?.operation == 'EQUAL' | ||
767 | - ? createRuleObj?.key?.key + '等于' + createRuleObj?.predicate?.value?.defaultValue | ||
768 | - : createRuleObj?.predicate?.operation == 'NOT_EQUAL' | ||
769 | - ? createRuleObj?.key?.key + '不等于' + createRuleObj?.predicate?.value?.defaultValue | ||
770 | - : createRuleObj?.predicate?.operation == 'ENDS_WITH' | ||
771 | - ? createRuleObj?.key?.key + '结束于' + createRuleObj?.predicate?.value?.defaultValue | ||
772 | - : createRuleObj?.predicate?.operation == 'CONTAINS' | ||
773 | - ? createRuleObj?.key?.key + '包含' + createRuleObj?.predicate?.value?.defaultValue | ||
774 | - : createRuleObj?.predicate?.operation == 'GREATER' | ||
775 | - ? createRuleObj?.key?.key + '大于' + createRuleObj?.predicate?.value?.defaultValue | ||
776 | - : createRuleObj?.predicate?.operation == 'LESS' | ||
777 | - ? createRuleObj?.key?.key + '小于' + createRuleObj?.predicate?.value?.defaultValue | ||
778 | - : createRuleObj?.key?.key + | ||
779 | - '小于或等于' + | ||
780 | - createRuleObj?.predicate?.value?.defaultValue; | 772 | + return formatMap; |
781 | } catch (e) { | 773 | } catch (e) { |
782 | return e; | 774 | return e; |
783 | } | 775 | } |
@@ -798,13 +790,25 @@ | @@ -798,13 +790,25 @@ | ||
798 | o[v] = getStepThreeEditArr.value[v]; | 790 | o[v] = getStepThreeEditArr.value[v]; |
799 | getFilterStepThreeEditArr.value.push(o as never); | 791 | getFilterStepThreeEditArr.value.push(o as never); |
800 | }); | 792 | }); |
801 | - console.log(getFilterStepThreeEditArr.value); | ||
802 | - | ||
803 | - // setRegisterFormChangeDetail({ | ||
804 | - // alarmDetails: v.stepThreeData[0].createRules['MAJOR'].alarmDetails, | ||
805 | - // }); | ||
806 | } | 793 | } |
807 | }; | 794 | }; |
795 | + const setCreateRegisterFormChangeDetailFunc = (v) => { | ||
796 | + for (let i in v) { | ||
797 | + detailDetailModelArray.value.push(v[i].alarmDetails as never); | ||
798 | + createAlarmArray.value.push(i as never); | ||
799 | + } | ||
800 | + }; | ||
801 | + const formatAlarmFunc = (v) => { | ||
802 | + return v == 'CRITICAL' | ||
803 | + ? '危险' | ||
804 | + : v == 'MAJOR' | ||
805 | + ? '重要' | ||
806 | + : v == 'MINOR' | ||
807 | + ? '次要' | ||
808 | + : v == 'WARNING' | ||
809 | + ? '警告' | ||
810 | + : '不确定'; | ||
811 | + }; | ||
808 | 812 | ||
809 | //清除修改详情模板 | 813 | //清除修改详情模板 |
810 | const setRegisterFormClearChangeDetailFunc = (v) => { | 814 | const setRegisterFormClearChangeDetailFunc = (v) => { |
@@ -829,7 +833,9 @@ | @@ -829,7 +833,9 @@ | ||
829 | addNewOpenRule.schedule = enableObj.value as never; | 833 | addNewOpenRule.schedule = enableObj.value as never; |
830 | addNewRuleTem.condition.condition = ruleObj.value as never; | 834 | addNewRuleTem.condition.condition = ruleObj.value as never; |
831 | tempOpenRuleTempArr.value.push(addNewOpenRule.schedule as never); | 835 | tempOpenRuleTempArr.value.push(addNewOpenRule.schedule as never); |
832 | - tempRuleConditionTempArr.value.push(addNewRuleTem.condition.condition as never); | 836 | + tempRuleConditionTempArr.value.push({ |
837 | + condition: addNewRuleTem.condition.condition, | ||
838 | + }); | ||
833 | }; | 839 | }; |
834 | 840 | ||
835 | const getClearOpenRuleAndRuleCondition = () => { | 841 | const getClearOpenRuleAndRuleCondition = () => { |
@@ -867,7 +873,7 @@ | @@ -867,7 +873,7 @@ | ||
867 | }); | 873 | }); |
868 | 874 | ||
869 | tempRuleConditionTempArr.value.forEach((f3) => { | 875 | tempRuleConditionTempArr.value.forEach((f3) => { |
870 | - kongRuleConditionObj.condition.condition = f3; | 876 | + kongRuleConditionObj.condition = f3; |
871 | }); | 877 | }); |
872 | 878 | ||
873 | createRulesObj.value[addChangeSeverity.value?.default] = { | 879 | createRulesObj.value[addChangeSeverity.value?.default] = { |
@@ -920,11 +926,33 @@ | @@ -920,11 +926,33 @@ | ||
920 | //规则条件 | 926 | //规则条件 |
921 | const getAllFieldsRuleFunc = (v) => { | 927 | const getAllFieldsRuleFunc = (v) => { |
922 | ruleObj.value = v; | 928 | ruleObj.value = v; |
923 | - let splitRuleObj = {}; | ||
924 | - ruleObj.value.forEach((f) => { | ||
925 | - splitRuleObj = f; | 929 | + addNewRuleTem.condition.condition = ruleObj.value as never; |
930 | + fliterTempRuleConditionTempArr.value.push({ | ||
931 | + condition: addNewRuleTem.condition.condition, | ||
932 | + }); | ||
933 | + }; | ||
934 | + //格式化新增 | ||
935 | + const formatAddRuleFunc = (v) => { | ||
936 | + let formatMap = v.condition.map((f) => { | ||
937 | + return f.predicate.operation == 'EQUAL' | ||
938 | + ? f.key.key + '等于' + f.predicate.value.defaultValue | ||
939 | + : f.predicate.operation == 'STARTS_WITH' | ||
940 | + ? f.key.key + '开始于' + f.predicate.value.defaultValue | ||
941 | + : f.predicate.operation == 'ENDS_WITH' | ||
942 | + ? f.key.key + '结束于' + f.predicate.value.defaultValue | ||
943 | + : f.predicate.operation == 'NOT_CONTAINS' | ||
944 | + ? f.key.key + '不包含' + f.predicate.value.defaultValue | ||
945 | + : f.predicate.operation == 'NOT_EQUAL' | ||
946 | + ? f.key.key + '不等于' + f.predicate.value.defaultValue | ||
947 | + : f.predicate.operation == 'GREATER' | ||
948 | + ? f.key.key + '大于' + f.predicate.value.defaultValue | ||
949 | + : f.predicate.operation == 'LESS' | ||
950 | + ? f.key.key + '小于' + f.predicate.value.defaultValue | ||
951 | + : f.predicate.operation == 'GREATER_OR_EQUAL' | ||
952 | + ? f.key.key + '大于或等于' + f.predicate.value.defaultValue | ||
953 | + : f.key.key + '小于或等于' + f.predicate.value.defaultValue; | ||
926 | }); | 954 | }); |
927 | - fliterTempRuleConditionTempArr.value.push(splitRuleObj as never); | 955 | + return formatMap; |
928 | }; | 956 | }; |
929 | //清除报警规则 | 957 | //清除报警规则 |
930 | //启用规则 | 958 | //启用规则 |
@@ -935,14 +963,33 @@ | @@ -935,14 +963,33 @@ | ||
935 | //规则条件 | 963 | //规则条件 |
936 | const getAllClearFieldsRuleFunc = (v) => { | 964 | const getAllClearFieldsRuleFunc = (v) => { |
937 | ruleLastObj.value = v; | 965 | ruleLastObj.value = v; |
938 | - let splitRuleObj = {}; | ||
939 | - ruleLastObj.value.forEach((f) => { | ||
940 | - splitRuleObj = f; | 966 | + addNewRuleTem.condition.condition = ruleLastObj.value as never; |
967 | + fliterClearTempRuleConditionTempArr.value.push({ | ||
968 | + condition: addNewRuleTem.condition.condition, | ||
941 | }); | 969 | }); |
942 | - fliterClearTempRuleConditionTempArr.value.push(splitRuleObj as never); | ||
943 | - // if (fliterClearTempRuleConditionTempArr.value.length == 0) { | ||
944 | - // fliterClearTempRuleConditionTempArr.value = ruleLastObj.value; | ||
945 | - // } | 970 | + }; |
971 | + | ||
972 | + const formatClearRuleFunc = (v) => { | ||
973 | + let formatMap = v.condition.map((f) => { | ||
974 | + return f.predicate.operation == 'EQUAL' | ||
975 | + ? f.key.key + '等于' + f.predicate.value.defaultValue | ||
976 | + : f.predicate.operation == 'STARTS_WITH' | ||
977 | + ? f.key.key + '开始于' + f.predicate.value.defaultValue | ||
978 | + : f.predicate.operation == 'ENDS_WITH' | ||
979 | + ? f.key.key + '结束于' + f.predicate.value.defaultValue | ||
980 | + : f.predicate.operation == 'NOT_CONTAINS' | ||
981 | + ? f.key.key + '不包含' + f.predicate.value.defaultValue | ||
982 | + : f.predicate.operation == 'NOT_EQUAL' | ||
983 | + ? f.key.key + '不等于' + f.predicate.value.defaultValue | ||
984 | + : f.predicate.operation == 'GREATER' | ||
985 | + ? f.key.key + '大于' + f.predicate.value.defaultValue | ||
986 | + : f.predicate.operation == 'LESS' | ||
987 | + ? f.key.key + '小于' + f.predicate.value.defaultValue | ||
988 | + : f.predicate.operation == 'GREATER_OR_EQUAL' | ||
989 | + ? f.key.key + '大于或等于' + f.predicate.value.defaultValue | ||
990 | + : f.key.key + '小于或等于' + f.predicate.value.defaultValue; | ||
991 | + }); | ||
992 | + return formatMap; | ||
946 | }; | 993 | }; |
947 | 994 | ||
948 | //生成uuid | 995 | //生成uuid |
@@ -1057,6 +1104,12 @@ | @@ -1057,6 +1104,12 @@ | ||
1057 | }; | 1104 | }; |
1058 | 1105 | ||
1059 | return { | 1106 | return { |
1107 | + isAddRuleStatusFunc, | ||
1108 | + isAddRuleStatus, | ||
1109 | + formatAlarmFunc, | ||
1110 | + createAlarmArray, | ||
1111 | + formatClearRuleFunc, | ||
1112 | + formatAddRuleFunc, | ||
1060 | getFilterStepThreeClearDetailEditArr, | 1113 | getFilterStepThreeClearDetailEditArr, |
1061 | getIsShowAddRule, | 1114 | getIsShowAddRule, |
1062 | openRuleConditionComp, | 1115 | openRuleConditionComp, |
@@ -1127,6 +1180,8 @@ | @@ -1127,6 +1180,8 @@ | ||
1127 | registerFormCreateAlarm, | 1180 | registerFormCreateAlarm, |
1128 | addCreateRole, | 1181 | addCreateRole, |
1129 | deleteCondition, | 1182 | deleteCondition, |
1183 | + setCreateRegisterFormChangeDetailFunc, | ||
1184 | + detailDetailModelArray, | ||
1130 | }; | 1185 | }; |
1131 | }, | 1186 | }, |
1132 | }); | 1187 | }); |
@@ -9,6 +9,12 @@ import { alarmContactGetPage } from '/@/api/device/deviceConfigApi'; | @@ -9,6 +9,12 @@ import { alarmContactGetPage } from '/@/api/device/deviceConfigApi'; | ||
9 | export const step1Schemas: FormSchema[] = [ | 9 | export const step1Schemas: FormSchema[] = [ |
10 | { | 10 | { |
11 | field: 'name', | 11 | field: 'name', |
12 | + label: '上传图片', | ||
13 | + component: 'Input', | ||
14 | + slot: 'imageSelect', | ||
15 | + }, | ||
16 | + { | ||
17 | + field: 'name', | ||
12 | label: '配置名称', | 18 | label: '配置名称', |
13 | required: true, | 19 | required: true, |
14 | component: 'Input', | 20 | component: 'Input', |
@@ -12,16 +12,16 @@ | @@ -12,16 +12,16 @@ | ||
12 | </CollapseContainer> | 12 | </CollapseContainer> |
13 | </template> | 13 | </template> |
14 | <script lang="ts"> | 14 | <script lang="ts"> |
15 | - import { defineComponent, ref, watch } from 'vue'; | 15 | + import { defineComponent, ref } from 'vue'; |
16 | import { CollapseContainer } from '/@/components/Container/index'; | 16 | import { CollapseContainer } from '/@/components/Container/index'; |
17 | import { BasicForm, useForm } from '/@/components/Form/index'; | 17 | import { BasicForm, useForm } from '/@/components/Form/index'; |
18 | import { Input } from 'ant-design-vue'; | 18 | import { Input } from 'ant-design-vue'; |
19 | import { useConditionDrawerSchema } from '../config'; | 19 | import { useConditionDrawerSchema } from '../config'; |
20 | - import { screenLinkPageByDeptIdGetDevice } from '/@/api/ruleengine/ruleengineApi'; | 20 | + // import { screenLinkPageByDeptIdGetDevice } from '/@/api/ruleengine/ruleengineApi'; |
21 | 21 | ||
22 | export default defineComponent({ | 22 | export default defineComponent({ |
23 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, | 23 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, |
24 | - props: ['deviceInfo1', 'editconditionFather', 'newConditionMapFather'], | 24 | + props: ['deviceInfo1', 'editConditionFather', 'newConditionMapFather'], |
25 | 25 | ||
26 | setup(props) { | 26 | setup(props) { |
27 | const fieldValue: any = ref({}); | 27 | const fieldValue: any = ref({}); |
@@ -38,27 +38,37 @@ | @@ -38,27 +38,37 @@ | ||
38 | const resetFieldsValueFunc = () => { | 38 | const resetFieldsValueFunc = () => { |
39 | resetFields(); | 39 | resetFields(); |
40 | }; | 40 | }; |
41 | - watch( | ||
42 | - () => props.deviceInfo1, | ||
43 | - async (newV) => { | ||
44 | - const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); | ||
45 | - options.items.forEach((v) => { | ||
46 | - return (v.value = v.id), (v.label = v.name); | ||
47 | - }); | 41 | + // watch( |
42 | + // () => props.deviceInfo1, | ||
43 | + // async (newV) => { | ||
44 | + // const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); | ||
45 | + // options.items.forEach((v) => { | ||
46 | + // return (v.value = v.id), (v.label = v.name); | ||
47 | + // }); | ||
48 | + // updateSchema({ | ||
49 | + // field: 'entityId', | ||
50 | + // componentProps: { | ||
51 | + // options: options.items, | ||
52 | + // }, | ||
53 | + // }); | ||
54 | + // } | ||
55 | + // ); | ||
56 | + const updateFieldDeviceId = (v) => { | ||
57 | + setTimeout(() => { | ||
48 | updateSchema({ | 58 | updateSchema({ |
49 | - field: 'deviceId', | 59 | + field: 'entityId', |
50 | componentProps: { | 60 | componentProps: { |
51 | - options: options.items, | 61 | + options: v, |
52 | }, | 62 | }, |
53 | }); | 63 | }); |
54 | - } | ||
55 | - ); | 64 | + }, 10); |
65 | + }; | ||
56 | 66 | ||
57 | //回显数据 | 67 | //回显数据 |
58 | const setFieldsFormValueFun = () => { | 68 | const setFieldsFormValueFun = () => { |
59 | - if (props.editconditionFather !== 1) { | 69 | + if (props.editConditionFather !== 1) { |
60 | setTimeout(() => { | 70 | setTimeout(() => { |
61 | - setFieldsValue(props.editconditionFather); | 71 | + setFieldsValue(props.editConditionFather); |
62 | }, 100); | 72 | }, 100); |
63 | } | 73 | } |
64 | }; | 74 | }; |
@@ -67,7 +77,7 @@ | @@ -67,7 +77,7 @@ | ||
67 | if (props.newConditionMapFather !== 1) { | 77 | if (props.newConditionMapFather !== 1) { |
68 | setTimeout(() => { | 78 | setTimeout(() => { |
69 | updateSchema({ | 79 | updateSchema({ |
70 | - field: 'deviceId', | 80 | + field: 'entityId', |
71 | componentProps: { | 81 | componentProps: { |
72 | options: props.newConditionMapFather, | 82 | options: props.newConditionMapFather, |
73 | }, | 83 | }, |
@@ -79,7 +89,7 @@ | @@ -79,7 +89,7 @@ | ||
79 | //新增清空设备选择 | 89 | //新增清空设备选择 |
80 | const clearSelectDevice = () => { | 90 | const clearSelectDevice = () => { |
81 | updateSchema({ | 91 | updateSchema({ |
82 | - field: 'deviceId', | 92 | + field: 'entityId', |
83 | componentProps: { | 93 | componentProps: { |
84 | options: [], | 94 | options: [], |
85 | }, | 95 | }, |
@@ -87,13 +97,14 @@ | @@ -87,13 +97,14 @@ | ||
87 | }; | 97 | }; |
88 | // const editSelectDevice = (v) => { | 98 | // const editSelectDevice = (v) => { |
89 | // updateSchema({ | 99 | // updateSchema({ |
90 | - // field: 'deviceId', | 100 | + // field: 'entityId', |
91 | // componentProps: { | 101 | // componentProps: { |
92 | // options: v, | 102 | // options: v, |
93 | // }, | 103 | // }, |
94 | // }); | 104 | // }); |
95 | // }; | 105 | // }; |
96 | return { | 106 | return { |
107 | + updateFieldDeviceId, | ||
97 | resetFieldsValueFunc, | 108 | resetFieldsValueFunc, |
98 | clearSelectDevice, | 109 | clearSelectDevice, |
99 | editSelectDevice, | 110 | editSelectDevice, |
@@ -12,12 +12,12 @@ | @@ -12,12 +12,12 @@ | ||
12 | </CollapseContainer> | 12 | </CollapseContainer> |
13 | </template> | 13 | </template> |
14 | <script lang="ts"> | 14 | <script lang="ts"> |
15 | - import { defineComponent, ref, watch } from 'vue'; | 15 | + import { defineComponent, ref } from 'vue'; |
16 | import { CollapseContainer } from '/@/components/Container/index'; | 16 | import { CollapseContainer } from '/@/components/Container/index'; |
17 | import { BasicForm, useForm } from '/@/components/Form/index'; | 17 | import { BasicForm, useForm } from '/@/components/Form/index'; |
18 | import { Input } from 'ant-design-vue'; | 18 | import { Input } from 'ant-design-vue'; |
19 | import { useActionDrawerSchema } from '../config'; | 19 | import { useActionDrawerSchema } from '../config'; |
20 | - import { screenLinkPageByDeptIdGetDevice } from '/@/api/ruleengine/ruleengineApi'; | 20 | + // import { screenLinkPageByDeptIdGetDevice } from '/@/api/ruleengine/ruleengineApi'; |
21 | 21 | ||
22 | export default defineComponent({ | 22 | export default defineComponent({ |
23 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, | 23 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, |
@@ -34,25 +34,38 @@ | @@ -34,25 +34,38 @@ | ||
34 | const getFieldsValueFunc = () => { | 34 | const getFieldsValueFunc = () => { |
35 | fieldValue.value = getFieldsValue(); | 35 | fieldValue.value = getFieldsValue(); |
36 | return fieldValue.value; | 36 | return fieldValue.value; |
37 | + // return new Promise((resolve) => { | ||
38 | + // resolve(fieldValue.value); | ||
39 | + // }); | ||
37 | }; | 40 | }; |
38 | const resetFieldsValueFunc = () => { | 41 | const resetFieldsValueFunc = () => { |
39 | resetFields(); | 42 | resetFields(); |
40 | }; | 43 | }; |
41 | - watch( | ||
42 | - () => props.deviceInfo2, | ||
43 | - async (newV) => { | ||
44 | - const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); | ||
45 | - options.items.forEach((v) => { | ||
46 | - return (v.value = v.id), (v.label = v.name); | ||
47 | - }); | 44 | + // watch( |
45 | + // () => props.deviceInfo2, | ||
46 | + // async (newV) => { | ||
47 | + // const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); | ||
48 | + // options.items.forEach((v) => { | ||
49 | + // return (v.value = v.id), (v.label = v.name); | ||
50 | + // }); | ||
51 | + // updateSchema({ | ||
52 | + // field: 'entityId', | ||
53 | + // componentProps: { | ||
54 | + // options: options.items, | ||
55 | + // }, | ||
56 | + // }); | ||
57 | + // } | ||
58 | + // ); | ||
59 | + const updateFieldDeviceId = (v) => { | ||
60 | + setTimeout(() => { | ||
48 | updateSchema({ | 61 | updateSchema({ |
49 | - field: 'deviceId', | 62 | + field: 'entityId', |
50 | componentProps: { | 63 | componentProps: { |
51 | - options: options.items, | 64 | + options: v, |
52 | }, | 65 | }, |
53 | }); | 66 | }); |
54 | - } | ||
55 | - ); | 67 | + }, 10); |
68 | + }; | ||
56 | 69 | ||
57 | //回显数据 | 70 | //回显数据 |
58 | const setFieldsFormValueFun = () => { | 71 | const setFieldsFormValueFun = () => { |
@@ -67,7 +80,7 @@ | @@ -67,7 +80,7 @@ | ||
67 | if (props.newActionMapFather !== 1) { | 80 | if (props.newActionMapFather !== 1) { |
68 | setTimeout(() => { | 81 | setTimeout(() => { |
69 | updateSchema({ | 82 | updateSchema({ |
70 | - field: 'deviceId', | 83 | + field: 'entityId', |
71 | componentProps: { | 84 | componentProps: { |
72 | options: props.newActionMapFather, | 85 | options: props.newActionMapFather, |
73 | }, | 86 | }, |
@@ -79,7 +92,7 @@ | @@ -79,7 +92,7 @@ | ||
79 | //新增清空设备选择 | 92 | //新增清空设备选择 |
80 | const clearSelectDevice = () => { | 93 | const clearSelectDevice = () => { |
81 | updateSchema({ | 94 | updateSchema({ |
82 | - field: 'deviceId', | 95 | + field: 'entityId', |
83 | componentProps: { | 96 | componentProps: { |
84 | options: [], | 97 | options: [], |
85 | }, | 98 | }, |
@@ -87,13 +100,14 @@ | @@ -87,13 +100,14 @@ | ||
87 | }; | 100 | }; |
88 | // const editSelectDevice = (v) => { | 101 | // const editSelectDevice = (v) => { |
89 | // updateSchema({ | 102 | // updateSchema({ |
90 | - // field: 'deviceId', | 103 | + // field: 'entityId', |
91 | // componentProps: { | 104 | // componentProps: { |
92 | // options: v, | 105 | // options: v, |
93 | // }, | 106 | // }, |
94 | // }); | 107 | // }); |
95 | // }; | 108 | // }; |
96 | return { | 109 | return { |
110 | + updateFieldDeviceId, | ||
97 | clearSelectDevice, | 111 | clearSelectDevice, |
98 | editSelectDevice, | 112 | editSelectDevice, |
99 | resetFieldsValueFunc, | 113 | resetFieldsValueFunc, |
@@ -111,7 +125,7 @@ | @@ -111,7 +125,7 @@ | ||
111 | vertical-align: middle; | 125 | vertical-align: middle; |
112 | display: inline-block; | 126 | display: inline-block; |
113 | position: relative; | 127 | position: relative; |
114 | - top: 25px; | 128 | + top: 20px; |
115 | left: 5px; | 129 | left: 5px; |
116 | } | 130 | } |
117 | </style> | 131 | </style> |
@@ -14,12 +14,12 @@ | @@ -14,12 +14,12 @@ | ||
14 | </div> | 14 | </div> |
15 | </template> | 15 | </template> |
16 | <script lang="ts"> | 16 | <script lang="ts"> |
17 | - import { defineComponent, ref, watch } from 'vue'; | 17 | + import { defineComponent, ref } from 'vue'; |
18 | import { CollapseContainer } from '/@/components/Container/index'; | 18 | import { CollapseContainer } from '/@/components/Container/index'; |
19 | import { BasicForm, useForm } from '/@/components/Form/index'; | 19 | import { BasicForm, useForm } from '/@/components/Form/index'; |
20 | import { Input } from 'ant-design-vue'; | 20 | import { Input } from 'ant-design-vue'; |
21 | import { useTriggerDrawerSchema } from '../config'; | 21 | import { useTriggerDrawerSchema } from '../config'; |
22 | - import { screenLinkPageByDeptIdGetDevice } from '/@/api/ruleengine/ruleengineApi'; | 22 | + // import { screenLinkPageByDeptIdGetDevice } from '/@/api/ruleengine/ruleengineApi'; |
23 | 23 | ||
24 | export default defineComponent({ | 24 | export default defineComponent({ |
25 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, | 25 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, |
@@ -36,20 +36,20 @@ | @@ -36,20 +36,20 @@ | ||
36 | fieldValue.value = getFieldsValue(); | 36 | fieldValue.value = getFieldsValue(); |
37 | return fieldValue.value; | 37 | return fieldValue.value; |
38 | }; | 38 | }; |
39 | - watch( | ||
40 | - () => props.deviceInfo, | ||
41 | - async (newV) => { | ||
42 | - const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); | ||
43 | - options.items.forEach((v) => { | ||
44 | - return (v.value = v.id), (v.label = v.name); | ||
45 | - }); | ||
46 | - updateFieldDeviceId(options.items); | ||
47 | - } | ||
48 | - ); | 39 | + // watch( |
40 | + // () => props.deviceInfo | ||
41 | + // // async (newV) => { | ||
42 | + // // const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); | ||
43 | + // // options.items.forEach((v) => { | ||
44 | + // // return (v.value = v.id), (v.label = v.name); | ||
45 | + // // }); | ||
46 | + // // updateFieldDeviceId(options.items); | ||
47 | + // // } | ||
48 | + // ); | ||
49 | const updateFieldDeviceId = (v) => { | 49 | const updateFieldDeviceId = (v) => { |
50 | setTimeout(() => { | 50 | setTimeout(() => { |
51 | updateSchema({ | 51 | updateSchema({ |
52 | - field: 'deviceId', | 52 | + field: 'entityId', |
53 | componentProps: { | 53 | componentProps: { |
54 | options: v, | 54 | options: v, |
55 | }, | 55 | }, |
@@ -57,9 +57,7 @@ | @@ -57,9 +57,7 @@ | ||
57 | }, 10); | 57 | }, 10); |
58 | }; | 58 | }; |
59 | const resetFieldsValueFunc = () => { | 59 | const resetFieldsValueFunc = () => { |
60 | - setTimeout(() => { | ||
61 | - resetFields(); | ||
62 | - }, 100); | 60 | + resetFields(); |
63 | }; | 61 | }; |
64 | 62 | ||
65 | //回显数据 | 63 | //回显数据 |
@@ -67,7 +65,7 @@ | @@ -67,7 +65,7 @@ | ||
67 | if (props.editTriggerFather != 1) { | 65 | if (props.editTriggerFather != 1) { |
68 | setTimeout(() => { | 66 | setTimeout(() => { |
69 | setFieldsValue(props.editTriggerFather); | 67 | setFieldsValue(props.editTriggerFather); |
70 | - }, 100); | 68 | + }, 10); |
71 | } | 69 | } |
72 | }; | 70 | }; |
73 | 71 | ||
@@ -75,7 +73,7 @@ | @@ -75,7 +73,7 @@ | ||
75 | //新增清空设备选择 | 73 | //新增清空设备选择 |
76 | const clearSelectDevice = () => { | 74 | const clearSelectDevice = () => { |
77 | updateSchema({ | 75 | updateSchema({ |
78 | - field: 'deviceId', | 76 | + field: 'entityId', |
79 | componentProps: { | 77 | componentProps: { |
80 | options: [], | 78 | options: [], |
81 | }, | 79 | }, |
@@ -85,7 +83,7 @@ | @@ -85,7 +83,7 @@ | ||
85 | if (props.newFilterMapFather != 1) { | 83 | if (props.newFilterMapFather != 1) { |
86 | setTimeout(() => { | 84 | setTimeout(() => { |
87 | updateSchema({ | 85 | updateSchema({ |
88 | - field: 'deviceId', | 86 | + field: 'entityId', |
89 | componentProps: { | 87 | componentProps: { |
90 | options: props.newFilterMapFather, | 88 | options: props.newFilterMapFather, |
91 | }, | 89 | }, |
@@ -14,13 +14,13 @@ import { copyTransFun } from '/@/utils/fnUtils'; | @@ -14,13 +14,13 @@ import { copyTransFun } from '/@/utils/fnUtils'; | ||
14 | */ | 14 | */ |
15 | 15 | ||
16 | export enum TriggerEnum { | 16 | export enum TriggerEnum { |
17 | - IS_DEVICE_ACT = 'DEVICE_ACT', | ||
18 | - IS_TIME_ACT = 'TIME_ACT', | ||
19 | - IS_SCENE_ACT = 'SCENE_ACT', | 17 | + IS_DEVICE_ACT = 'DEVICE_TRIGGER', |
18 | + IS_TIME_ACT = 'SCHEDULE_TRIGGER', | ||
19 | + IS_SCENE_ACT = 'SCENE_TRIGGER', | ||
20 | IS_HAND_ACT = 'HAND_ACT', | 20 | IS_HAND_ACT = 'HAND_ACT', |
21 | IS_MSG_NOTIFY = 'MSG_NOTIFY', | 21 | IS_MSG_NOTIFY = 'MSG_NOTIFY', |
22 | IS_DEVICE_STATUS = 'DEVICE_STATUS', | 22 | IS_DEVICE_STATUS = 'DEVICE_STATUS', |
23 | - IS_TIME_ALL = 'TIME_ALL', | 23 | + IS_TIME_ALL = 'SCHEDULE_TRIGGER', |
24 | } | 24 | } |
25 | 25 | ||
26 | export enum AttributeActionEnum { | 26 | export enum AttributeActionEnum { |
@@ -37,6 +37,7 @@ export enum AttrAndWenDuEnum { | @@ -37,6 +37,7 @@ export enum AttrAndWenDuEnum { | ||
37 | export const isShiDu = (type: string) => { | 37 | export const isShiDu = (type: string) => { |
38 | return type === AttrAndWenDuEnum.IS_SHIDU; | 38 | return type === AttrAndWenDuEnum.IS_SHIDU; |
39 | }; | 39 | }; |
40 | + | ||
40 | export const isWenDu = (type: string) => { | 41 | export const isWenDu = (type: string) => { |
41 | return type === AttrAndWenDuEnum.IS_WENDU_ACT; | 42 | return type === AttrAndWenDuEnum.IS_WENDU_ACT; |
42 | }; | 43 | }; |
@@ -77,13 +78,13 @@ export const columns: BasicColumn[] = [ | @@ -77,13 +78,13 @@ export const columns: BasicColumn[] = [ | ||
77 | }, | 78 | }, |
78 | { | 79 | { |
79 | title: '触发方式', | 80 | title: '触发方式', |
80 | - dataIndex: 'triggerEvent', | 81 | + dataIndex: 'triggerType', |
81 | format: (text: string, record: Recordable) => { | 82 | format: (text: string, record: Recordable) => { |
82 | - return record.triggers[0]?.triggerEvent == 'DEVICE_ACT' | 83 | + return record.triggers[0]?.triggerType == 'DEVICE_TRIGGER' |
83 | ? '设备触发' | 84 | ? '设备触发' |
84 | - : record.triggers[0]?.triggerEvent == 'TIME_ACT' | 85 | + : record.triggers[0]?.triggerType == 'SCHEDULE_TRIGGER' |
85 | ? '定时触发' | 86 | ? '定时触发' |
86 | - : record.triggers[0]?.triggerEvent == 'SCENE_ACT' | 87 | + : record.triggers[0]?.triggerType == 'SCENE_TRIGGER' |
87 | ? '场景触发' | 88 | ? '场景触发' |
88 | : '手动触发'; | 89 | : '手动触发'; |
89 | }, | 90 | }, |
@@ -166,10 +167,10 @@ export const formSchema: FormSchema[] = [ | @@ -166,10 +167,10 @@ export const formSchema: FormSchema[] = [ | ||
166 | }, | 167 | }, |
167 | onChange: async (v) => { | 168 | onChange: async (v) => { |
168 | if (v == undefined) { | 169 | if (v == undefined) { |
169 | - formModel.deviceId = undefined; | 170 | + formModel.entityId = undefined; |
170 | const { updateSchema } = formActionType; | 171 | const { updateSchema } = formActionType; |
171 | updateSchema({ | 172 | updateSchema({ |
172 | - field: 'deviceId', | 173 | + field: 'entityId', |
173 | componentProps: { | 174 | componentProps: { |
174 | options: undefined, | 175 | options: undefined, |
175 | }, | 176 | }, |
@@ -190,19 +191,6 @@ export const formSchema: FormSchema[] = [ | @@ -190,19 +191,6 @@ export const formSchema: FormSchema[] = [ | ||
190 | maxLength: 255, | 191 | maxLength: 255, |
191 | placeholder: '请输入描述', | 192 | placeholder: '请输入描述', |
192 | }, | 193 | }, |
193 | - dynamicRules: () => { | ||
194 | - return [ | ||
195 | - { | ||
196 | - required: false, | ||
197 | - validator: (_, value) => { | ||
198 | - if (String(value).length > 255) { | ||
199 | - return Promise.reject('字数不超过255个字'); | ||
200 | - } | ||
201 | - return Promise.resolve(); | ||
202 | - }, | ||
203 | - }, | ||
204 | - ]; | ||
205 | - }, | ||
206 | }, | 194 | }, |
207 | ]; | 195 | ]; |
208 | 196 | ||
@@ -210,7 +198,7 @@ export const searchFormSchema: FormSchema[] = [ | @@ -210,7 +198,7 @@ export const searchFormSchema: FormSchema[] = [ | ||
210 | { | 198 | { |
211 | field: 'organizationId', | 199 | field: 'organizationId', |
212 | label: '所属组织', | 200 | label: '所属组织', |
213 | - colProps: { span: 8 }, | 201 | + colProps: { span: 6 }, |
214 | component: 'ApiTreeSelect', | 202 | component: 'ApiTreeSelect', |
215 | componentProps: { | 203 | componentProps: { |
216 | api: async () => { | 204 | api: async () => { |
@@ -224,24 +212,11 @@ export const searchFormSchema: FormSchema[] = [ | @@ -224,24 +212,11 @@ export const searchFormSchema: FormSchema[] = [ | ||
224 | field: 'name', | 212 | field: 'name', |
225 | label: '名称', | 213 | label: '名称', |
226 | component: 'Input', | 214 | component: 'Input', |
227 | - colProps: { span: 8 }, | 215 | + colProps: { span: 6 }, |
228 | componentProps: { | 216 | componentProps: { |
229 | maxLength: 36, | 217 | maxLength: 36, |
230 | placeholder: '请输入名称', | 218 | placeholder: '请输入名称', |
231 | }, | 219 | }, |
232 | - dynamicRules: () => { | ||
233 | - return [ | ||
234 | - { | ||
235 | - required: false, | ||
236 | - validator: (_, value) => { | ||
237 | - if (String(value).length > 36) { | ||
238 | - return Promise.reject('字数不超过36个字'); | ||
239 | - } | ||
240 | - return Promise.resolve(); | ||
241 | - }, | ||
242 | - }, | ||
243 | - ]; | ||
244 | - }, | ||
245 | }, | 220 | }, |
246 | { | 221 | { |
247 | field: 'status', | 222 | field: 'status', |
@@ -254,37 +229,37 @@ export const searchFormSchema: FormSchema[] = [ | @@ -254,37 +229,37 @@ export const searchFormSchema: FormSchema[] = [ | ||
254 | { label: '未启用', value: '0' }, | 229 | { label: '未启用', value: '0' }, |
255 | ], | 230 | ], |
256 | }, | 231 | }, |
257 | - colProps: { span: 4 }, | 232 | + colProps: { span: 6 }, |
258 | }, | 233 | }, |
259 | ]; | 234 | ]; |
260 | 235 | ||
261 | export const useTriggerDrawerSchema: FormSchema[] = [ | 236 | export const useTriggerDrawerSchema: FormSchema[] = [ |
262 | { | 237 | { |
263 | - field: 'triggerEvent', | 238 | + field: 'triggerType', |
264 | label: '', | 239 | label: '', |
265 | component: 'Select', | 240 | component: 'Select', |
266 | componentProps: { | 241 | componentProps: { |
267 | placeholder: '设备触发', | 242 | placeholder: '设备触发', |
268 | options: [ | 243 | options: [ |
269 | - { label: '设备触发', value: 'DEVICE_ACT' }, | ||
270 | - { label: '定时触发', value: 'TIME_ACT' }, | ||
271 | - { label: '场景触发', value: 'SCENE_ACT' }, | 244 | + { label: '设备触发', value: 'DEVICE_TRIGGER' }, |
245 | + { label: '定时触发', value: 'SCHEDULE_TRIGGER' }, | ||
246 | + { label: '场景触发', value: 'SCENE_TRIGGER' }, | ||
272 | { label: '手动触发', value: 'HAND_ACT' }, | 247 | { label: '手动触发', value: 'HAND_ACT' }, |
273 | ], | 248 | ], |
274 | }, | 249 | }, |
275 | colProps: { span: 12 }, | 250 | colProps: { span: 12 }, |
276 | }, | 251 | }, |
277 | { | 252 | { |
278 | - field: 'deviceId', | 253 | + field: 'entityId', |
279 | label: '', | 254 | label: '', |
280 | component: 'Select', | 255 | component: 'Select', |
281 | componentProps: { | 256 | componentProps: { |
282 | placeholder: '请选择设备', | 257 | placeholder: '请选择设备', |
283 | }, | 258 | }, |
284 | ifShow: ({ values }) => | 259 | ifShow: ({ values }) => |
285 | - !isTime(Reflect.get(values, 'triggerEvent')) && | ||
286 | - !isScene(Reflect.get(values, 'triggerEvent')) && | ||
287 | - !isHand(Reflect.get(values, 'triggerEvent')), | 260 | + !isTime(Reflect.get(values, 'triggerType')) && |
261 | + !isScene(Reflect.get(values, 'triggerType')) && | ||
262 | + !isHand(Reflect.get(values, 'triggerType')), | ||
288 | colProps: { | 263 | colProps: { |
289 | span: 12, | 264 | span: 12, |
290 | }, | 265 | }, |
@@ -300,7 +275,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -300,7 +275,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
300 | colProps: { | 275 | colProps: { |
301 | span: 12, | 276 | span: 12, |
302 | }, | 277 | }, |
303 | - ifShow: ({ values }) => isTime(Reflect.get(values, 'triggerEvent')), | 278 | + ifShow: ({ values }) => isTime(Reflect.get(values, 'triggerType')), |
304 | }, | 279 | }, |
305 | { | 280 | { |
306 | field: 'touchWay', | 281 | field: 'touchWay', |
@@ -314,9 +289,9 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -314,9 +289,9 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
314 | ], | 289 | ], |
315 | }, | 290 | }, |
316 | ifShow: ({ values }) => | 291 | ifShow: ({ values }) => |
317 | - !isTime(Reflect.get(values, 'triggerEvent')) && | ||
318 | - !isScene(Reflect.get(values, 'triggerEvent')) && | ||
319 | - !isHand(Reflect.get(values, 'triggerEvent')), | 292 | + !isTime(Reflect.get(values, 'triggerType')) && |
293 | + !isScene(Reflect.get(values, 'triggerType')) && | ||
294 | + !isHand(Reflect.get(values, 'triggerType')), | ||
320 | colProps: { span: 12 }, | 295 | colProps: { span: 12 }, |
321 | }, | 296 | }, |
322 | { | 297 | { |
@@ -334,9 +309,9 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -334,9 +309,9 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
334 | colProps: { span: 12 }, | 309 | colProps: { span: 12 }, |
335 | ifShow: ({ values }) => | 310 | ifShow: ({ values }) => |
336 | isUpAndDown(Reflect.get(values, 'touchWay')) && | 311 | isUpAndDown(Reflect.get(values, 'touchWay')) && |
337 | - !isTime(Reflect.get(values, 'triggerEvent')) && | ||
338 | - !isScene(Reflect.get(values, 'triggerEvent')) && | ||
339 | - !isHand(Reflect.get(values, 'triggerEvent')), | 312 | + !isTime(Reflect.get(values, 'triggerType')) && |
313 | + !isScene(Reflect.get(values, 'triggerType')) && | ||
314 | + !isHand(Reflect.get(values, 'triggerType')), | ||
340 | }, | 315 | }, |
341 | { | 316 | { |
342 | field: 'attributeChoose', | 317 | field: 'attributeChoose', |
@@ -350,9 +325,9 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -350,9 +325,9 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
350 | ], | 325 | ], |
351 | }, | 326 | }, |
352 | ifShow: ({ values }) => | 327 | ifShow: ({ values }) => |
353 | - !isTime(Reflect.get(values, 'triggerEvent')) && | ||
354 | - !isScene(Reflect.get(values, 'triggerEvent')) && | ||
355 | - !isHand(Reflect.get(values, 'triggerEvent')) && | 328 | + !isTime(Reflect.get(values, 'triggerType')) && |
329 | + !isScene(Reflect.get(values, 'triggerType')) && | ||
330 | + !isHand(Reflect.get(values, 'triggerType')) && | ||
356 | !isUpAndDown(Reflect.get(values, 'touchWay')), | 331 | !isUpAndDown(Reflect.get(values, 'touchWay')), |
357 | colProps: { span: 12 }, | 332 | colProps: { span: 12 }, |
358 | }, | 333 | }, |
@@ -373,9 +348,9 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -373,9 +348,9 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
373 | ifShow: ({ values }) => | 348 | ifShow: ({ values }) => |
374 | isWenDu(Reflect.get(values, 'attributeChoose')) && | 349 | isWenDu(Reflect.get(values, 'attributeChoose')) && |
375 | !isUpAndDown(Reflect.get(values, 'touchWay')) && | 350 | !isUpAndDown(Reflect.get(values, 'touchWay')) && |
376 | - !isTime(Reflect.get(values, 'triggerEvent')) && | ||
377 | - !isScene(Reflect.get(values, 'triggerEvent')) && | ||
378 | - !isHand(Reflect.get(values, 'triggerEvent')), | 351 | + !isTime(Reflect.get(values, 'triggerType')) && |
352 | + !isScene(Reflect.get(values, 'triggerType')) && | ||
353 | + !isHand(Reflect.get(values, 'triggerType')), | ||
379 | colProps: { span: 12 }, | 354 | colProps: { span: 12 }, |
380 | }, | 355 | }, |
381 | { | 356 | { |
@@ -390,9 +365,9 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -390,9 +365,9 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
390 | ifShow: ({ values }) => | 365 | ifShow: ({ values }) => |
391 | isWenDu(Reflect.get(values, 'attributeChoose')) && | 366 | isWenDu(Reflect.get(values, 'attributeChoose')) && |
392 | !isUpAndDown(Reflect.get(values, 'touchWay')) && | 367 | !isUpAndDown(Reflect.get(values, 'touchWay')) && |
393 | - !isTime(Reflect.get(values, 'triggerEvent')) && | ||
394 | - !isScene(Reflect.get(values, 'triggerEvent')) && | ||
395 | - !isHand(Reflect.get(values, 'triggerEvent')), | 368 | + !isTime(Reflect.get(values, 'triggerType')) && |
369 | + !isScene(Reflect.get(values, 'triggerType')) && | ||
370 | + !isHand(Reflect.get(values, 'triggerType')), | ||
396 | colProps: { | 371 | colProps: { |
397 | span: 12, | 372 | span: 12, |
398 | }, | 373 | }, |
@@ -413,7 +388,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -413,7 +388,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
413 | { label: '场景触发器3', value: '3' }, | 388 | { label: '场景触发器3', value: '3' }, |
414 | ], | 389 | ], |
415 | }, | 390 | }, |
416 | - ifShow: ({ values }) => isScene(Reflect.get(values, 'triggerEvent')), | 391 | + ifShow: ({ values }) => isScene(Reflect.get(values, 'triggerType')), |
417 | }, | 392 | }, |
418 | 393 | ||
419 | { | 394 | { |
@@ -426,41 +401,32 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -426,41 +401,32 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
426 | componentProps: { | 401 | componentProps: { |
427 | placeholder: '暂不实现', | 402 | placeholder: '暂不实现', |
428 | }, | 403 | }, |
429 | - ifShow: ({ values }) => isHand(Reflect.get(values, 'triggerEvent')), | ||
430 | - }, | ||
431 | - { | ||
432 | - field: '0', | ||
433 | - component: 'Input', | ||
434 | - label: ' ', | ||
435 | - colProps: { | ||
436 | - span: 12, | ||
437 | - }, | ||
438 | - slot: 'add', | 404 | + ifShow: ({ values }) => isHand(Reflect.get(values, 'triggerType')), |
439 | }, | 405 | }, |
440 | ]; | 406 | ]; |
441 | 407 | ||
442 | export const useConditionDrawerSchema: FormSchema[] = [ | 408 | export const useConditionDrawerSchema: FormSchema[] = [ |
443 | { | 409 | { |
444 | - field: 'status', | 410 | + field: 'triggerType', |
445 | label: '', | 411 | label: '', |
446 | component: 'Select', | 412 | component: 'Select', |
447 | componentProps: { | 413 | componentProps: { |
448 | placeholder: '设备状态', | 414 | placeholder: '设备状态', |
449 | options: [ | 415 | options: [ |
450 | - { label: '设备触发', value: 'DEVICE_STATUS' }, | ||
451 | - { label: '时间范围', value: 'TIME_ALL' }, | 416 | + { label: '设备触发', value: 'DEVICE_TRIGGER' }, |
417 | + { label: '时间范围', value: 'SCHEDULE_TRIGGER' }, | ||
452 | ], | 418 | ], |
453 | }, | 419 | }, |
454 | colProps: { span: 12 }, | 420 | colProps: { span: 12 }, |
455 | }, | 421 | }, |
456 | { | 422 | { |
457 | - field: 'deviceId', | 423 | + field: 'entityId', |
458 | label: '', | 424 | label: '', |
459 | component: 'Select', | 425 | component: 'Select', |
460 | componentProps: { | 426 | componentProps: { |
461 | placeholder: '请选择设备', | 427 | placeholder: '请选择设备', |
462 | }, | 428 | }, |
463 | - ifShow: ({ values }) => !isTimeAll(Reflect.get(values, 'status')), | 429 | + ifShow: ({ values }) => !isTimeAll(Reflect.get(values, 'triggerType')), |
464 | colProps: { | 430 | colProps: { |
465 | span: 12, | 431 | span: 12, |
466 | }, | 432 | }, |
@@ -475,7 +441,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | @@ -475,7 +441,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | ||
475 | colProps: { | 441 | colProps: { |
476 | span: 12, | 442 | span: 12, |
477 | }, | 443 | }, |
478 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'status')), | 444 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'triggerType')), |
479 | }, | 445 | }, |
480 | { | 446 | { |
481 | field: 'updateTime', | 447 | field: 'updateTime', |
@@ -487,7 +453,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | @@ -487,7 +453,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | ||
487 | colProps: { | 453 | colProps: { |
488 | span: 12, | 454 | span: 12, |
489 | }, | 455 | }, |
490 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'status')), | 456 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'triggerType')), |
491 | }, | 457 | }, |
492 | { | 458 | { |
493 | field: 'property', | 459 | field: 'property', |
@@ -500,19 +466,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | @@ -500,19 +466,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | ||
500 | { label: 'wendu', value: 'WENDU' }, | 466 | { label: 'wendu', value: 'WENDU' }, |
501 | ], | 467 | ], |
502 | }, | 468 | }, |
503 | - ifShow: ({ values }) => !isTimeAll(Reflect.get(values, 'status')), | ||
504 | - colProps: { span: 12 }, | ||
505 | - }, | ||
506 | - { | ||
507 | - field: 'wu', | ||
508 | - label: '', | ||
509 | - component: 'Input', | ||
510 | - componentProps: { | ||
511 | - placeholder: '无', | ||
512 | - style: { | ||
513 | - visibility: 'hidden', | ||
514 | - }, | ||
515 | - }, | 469 | + ifShow: ({ values }) => !isTimeAll(Reflect.get(values, 'triggerType')), |
516 | colProps: { span: 12 }, | 470 | colProps: { span: 12 }, |
517 | }, | 471 | }, |
518 | { | 472 | { |
@@ -530,7 +484,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | @@ -530,7 +484,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | ||
530 | ], | 484 | ], |
531 | }, | 485 | }, |
532 | ifShow: ({ values }) => | 486 | ifShow: ({ values }) => |
533 | - isShiDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'status')), | 487 | + isShiDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'triggerType')), |
534 | colProps: { span: 12 }, | 488 | colProps: { span: 12 }, |
535 | }, | 489 | }, |
536 | { | 490 | { |
@@ -543,7 +497,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | @@ -543,7 +497,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | ||
543 | }, | 497 | }, |
544 | 498 | ||
545 | ifShow: ({ values }) => | 499 | ifShow: ({ values }) => |
546 | - isShiDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'status')), | 500 | + isShiDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'triggerType')), |
547 | colProps: { | 501 | colProps: { |
548 | span: 12, | 502 | span: 12, |
549 | }, | 503 | }, |
@@ -564,7 +518,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | @@ -564,7 +518,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | ||
564 | ], | 518 | ], |
565 | }, | 519 | }, |
566 | ifShow: ({ values }) => | 520 | ifShow: ({ values }) => |
567 | - isWenDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'status')), | 521 | + isWenDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'triggerType')), |
568 | colProps: { span: 12 }, | 522 | colProps: { span: 12 }, |
569 | }, | 523 | }, |
570 | { | 524 | { |
@@ -576,20 +530,11 @@ export const useConditionDrawerSchema: FormSchema[] = [ | @@ -576,20 +530,11 @@ export const useConditionDrawerSchema: FormSchema[] = [ | ||
576 | placeholder: '请输入比较值', | 530 | placeholder: '请输入比较值', |
577 | }, | 531 | }, |
578 | ifShow: ({ values }) => | 532 | ifShow: ({ values }) => |
579 | - isWenDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'status')), | 533 | + isWenDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'triggerType')), |
580 | colProps: { | 534 | colProps: { |
581 | span: 12, | 535 | span: 12, |
582 | }, | 536 | }, |
583 | }, | 537 | }, |
584 | - { | ||
585 | - field: '0', | ||
586 | - component: 'Input', | ||
587 | - label: ' ', | ||
588 | - colProps: { | ||
589 | - span: 12, | ||
590 | - }, | ||
591 | - slot: 'add', | ||
592 | - }, | ||
593 | ]; | 538 | ]; |
594 | 539 | ||
595 | export const useActionDrawerSchema: FormSchema[] = [ | 540 | export const useActionDrawerSchema: FormSchema[] = [ |
@@ -599,20 +544,19 @@ export const useActionDrawerSchema: FormSchema[] = [ | @@ -599,20 +544,19 @@ export const useActionDrawerSchema: FormSchema[] = [ | ||
599 | component: 'Select', | 544 | component: 'Select', |
600 | required: true, | 545 | required: true, |
601 | componentProps: { | 546 | componentProps: { |
602 | - placeholder: '设备输出', | 547 | + placeholder: '请选择设备输出', |
603 | options: [ | 548 | options: [ |
604 | { label: '设备输出', value: 'DEVICE_OUT' }, | 549 | { label: '设备输出', value: 'DEVICE_OUT' }, |
605 | { label: '消息通知', value: 'MSG_NOTIFY' }, | 550 | { label: '消息通知', value: 'MSG_NOTIFY' }, |
606 | - { label: '场景联动', value: 'SCENE_ACT' }, | 551 | + { label: '场景联动', value: 'SCENE_TRIGGER' }, |
607 | ], | 552 | ], |
608 | }, | 553 | }, |
609 | colProps: { span: 12 }, | 554 | colProps: { span: 12 }, |
610 | }, | 555 | }, |
611 | { | 556 | { |
612 | - field: 'deviceId', | 557 | + field: 'entityId', |
613 | label: '', | 558 | label: '', |
614 | component: 'Select', | 559 | component: 'Select', |
615 | - required: true, | ||
616 | componentProps: { | 560 | componentProps: { |
617 | placeholder: '请选择设备', | 561 | placeholder: '请选择设备', |
618 | }, | 562 | }, |
@@ -623,11 +567,9 @@ export const useActionDrawerSchema: FormSchema[] = [ | @@ -623,11 +567,9 @@ export const useActionDrawerSchema: FormSchema[] = [ | ||
623 | }, | 567 | }, |
624 | }, | 568 | }, |
625 | { | 569 | { |
626 | - field: 'command', | 570 | + field: 'doContext', |
627 | component: 'Input', | 571 | component: 'Input', |
628 | label: '', | 572 | label: '', |
629 | - required: true, | ||
630 | - | ||
631 | componentProps: { | 573 | componentProps: { |
632 | maxLength: 255, | 574 | maxLength: 255, |
633 | placeholder: '请输入下发指定', | 575 | placeholder: '请输入下发指定', |
@@ -639,18 +581,6 @@ export const useActionDrawerSchema: FormSchema[] = [ | @@ -639,18 +581,6 @@ export const useActionDrawerSchema: FormSchema[] = [ | ||
639 | }, | 581 | }, |
640 | }, | 582 | }, |
641 | { | 583 | { |
642 | - field: 'wu1', | ||
643 | - label: '', | ||
644 | - component: 'Input', | ||
645 | - componentProps: { | ||
646 | - placeholder: '无', | ||
647 | - style: { | ||
648 | - visibility: 'hidden', | ||
649 | - }, | ||
650 | - }, | ||
651 | - colProps: { span: 12 }, | ||
652 | - }, | ||
653 | - { | ||
654 | field: 'wu2', | 584 | field: 'wu2', |
655 | component: 'Input', | 585 | component: 'Input', |
656 | label: '', | 586 | label: '', |
@@ -706,13 +636,4 @@ export const useActionDrawerSchema: FormSchema[] = [ | @@ -706,13 +636,4 @@ export const useActionDrawerSchema: FormSchema[] = [ | ||
706 | colProps: { span: 12 }, | 636 | colProps: { span: 12 }, |
707 | ifShow: ({ values }) => isScene(Reflect.get(values, 'outTarget')), | 637 | ifShow: ({ values }) => isScene(Reflect.get(values, 'outTarget')), |
708 | }, | 638 | }, |
709 | - { | ||
710 | - field: '0', | ||
711 | - component: 'Input', | ||
712 | - label: ' ', | ||
713 | - colProps: { | ||
714 | - span: 12, | ||
715 | - }, | ||
716 | - slot: 'add', | ||
717 | - }, | ||
718 | ]; | 639 | ]; |
1 | export interface IAddTrigger { | 1 | export interface IAddTrigger { |
2 | - id: string; | ||
3 | - triggerEvent: string; | 2 | + triggerType: string; |
4 | deviceId: string; | 3 | deviceId: string; |
5 | touchWay: string; | 4 | touchWay: string; |
6 | attributeChoose: string; | 5 | attributeChoose: string; |
@@ -9,18 +8,15 @@ export interface IAddTrigger { | @@ -9,18 +8,15 @@ export interface IAddTrigger { | ||
9 | } | 8 | } |
10 | 9 | ||
11 | export interface IAddCondition { | 10 | export interface IAddCondition { |
12 | - id: string; | ||
13 | - status: string; | 11 | + triggerType: string; |
14 | deviceId: string; | 12 | deviceId: string; |
15 | createTime: string; | 13 | createTime: string; |
16 | updateTime: string; | 14 | updateTime: string; |
17 | - property: string; | ||
18 | compare: string; | 15 | compare: string; |
19 | value: string; | 16 | value: string; |
20 | } | 17 | } |
21 | 18 | ||
22 | export interface IAddAction { | 19 | export interface IAddAction { |
23 | - id: string; | ||
24 | outTarget: string; | 20 | outTarget: string; |
25 | deviceId: string; | 21 | deviceId: string; |
26 | command: string; | 22 | command: string; |
@@ -33,7 +33,6 @@ | @@ -33,7 +33,6 @@ | ||
33 | </template> | 33 | </template> |
34 | </BasicTable> | 34 | </BasicTable> |
35 | <SceneLinkAgeDrawer | 35 | <SceneLinkAgeDrawer |
36 | - :getChildrenData="echoEditData" | ||
37 | @register="registerDrawer" | 36 | @register="registerDrawer" |
38 | @success="handleSuccess" | 37 | @success="handleSuccess" |
39 | ref="sceneLinkAgeDrawerRef" | 38 | ref="sceneLinkAgeDrawerRef" |
@@ -41,7 +40,7 @@ | @@ -41,7 +40,7 @@ | ||
41 | </div> | 40 | </div> |
42 | </template> | 41 | </template> |
43 | <script lang="ts"> | 42 | <script lang="ts"> |
44 | - import { defineComponent, reactive, getCurrentInstance, ref } from 'vue'; | 43 | + import { defineComponent, getCurrentInstance, ref } from 'vue'; |
45 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 44 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
46 | import { useDrawer } from '/@/components/Drawer'; | 45 | import { useDrawer } from '/@/components/Drawer'; |
47 | import SceneLinkAgeDrawer from './useDrawer.vue'; | 46 | import SceneLinkAgeDrawer from './useDrawer.vue'; |
@@ -62,7 +61,6 @@ | @@ -62,7 +61,6 @@ | ||
62 | handleSuccess | 61 | handleSuccess |
63 | ); | 62 | ); |
64 | let selectedRowKeys: Array<string> = []; | 63 | let selectedRowKeys: Array<string> = []; |
65 | - let echoEditData = reactive({}); | ||
66 | const [registerDrawer, { openDrawer }] = useDrawer(); | 64 | const [registerDrawer, { openDrawer }] = useDrawer(); |
67 | const { createMessage } = useMessage(); | 65 | const { createMessage } = useMessage(); |
68 | const [registerTable, { reload, getSelectRowKeys }] = useTable({ | 66 | const [registerTable, { reload, getSelectRowKeys }] = useTable({ |
@@ -88,21 +86,18 @@ | @@ -88,21 +86,18 @@ | ||
88 | }); | 86 | }); |
89 | 87 | ||
90 | function handleAdd() { | 88 | function handleAdd() { |
89 | + openDrawer(true, { | ||
90 | + isUpdate: false, | ||
91 | + }); | ||
91 | try { | 92 | try { |
92 | - proxy.$refs.sceneLinkAgeDrawerRef.clearAllArrayFunc(); | ||
93 | setTimeout(() => { | 93 | setTimeout(() => { |
94 | - proxy.$refs.sceneLinkAgeDrawerRef.defaultAddTrigger(); | ||
95 | - }, 10); | ||
96 | - proxy.$refs.sceneLinkAgeDrawerRef.defaultAddCondition(); | ||
97 | - proxy.$refs.sceneLinkAgeDrawerRef.defaultAddAction(); | ||
98 | - proxy.$refs.sceneLinkAgeDrawerRef.resetActionsAllArrayFunc(); | ||
99 | - proxy.$refs.sceneLinkAgeDrawerRef.clearActionsAllDevice(); | 94 | + // proxy.$refs.sceneLinkAgeDrawerRef.defaultAddTrigger(); |
95 | + // proxy.$refs.sceneLinkAgeDrawerRef.defaultAddCondition(); | ||
96 | + proxy.$refs.sceneLinkAgeDrawerRef.defaultAddAction(); | ||
97 | + }, 50); | ||
100 | } catch (e) { | 98 | } catch (e) { |
101 | return e; | 99 | return e; |
102 | } | 100 | } |
103 | - openDrawer(true, { | ||
104 | - isUpdate: false, | ||
105 | - }); | ||
106 | } | 101 | } |
107 | 102 | ||
108 | const useSelectionChange = () => { | 103 | const useSelectionChange = () => { |
@@ -120,7 +115,6 @@ | @@ -120,7 +115,6 @@ | ||
120 | record, | 115 | record, |
121 | isUpdate: true, | 116 | isUpdate: true, |
122 | }); | 117 | }); |
123 | - echoEditData = record; | ||
124 | } | 118 | } |
125 | async function handleDelete(record: Recordable) { | 119 | async function handleDelete(record: Recordable) { |
126 | try { | 120 | try { |
@@ -138,7 +132,6 @@ | @@ -138,7 +132,6 @@ | ||
138 | return { | 132 | return { |
139 | sceneLinkAgeDrawerRef, | 133 | sceneLinkAgeDrawerRef, |
140 | useSelectionChange, | 134 | useSelectionChange, |
141 | - echoEditData, | ||
142 | registerTable, | 135 | registerTable, |
143 | registerDrawer, | 136 | registerDrawer, |
144 | handleAdd, | 137 | handleAdd, |
@@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
6 | :title="getTitle" | 6 | :title="getTitle" |
7 | width="1000px" | 7 | width="1000px" |
8 | @ok="handleSubmit" | 8 | @ok="handleSubmit" |
9 | + @close="handleClose" | ||
9 | > | 10 | > |
10 | <div> | 11 | <div> |
11 | <BasicForm @register="registerForm" /> | 12 | <BasicForm @register="registerForm" /> |
@@ -16,13 +17,13 @@ | @@ -16,13 +17,13 @@ | ||
16 | :key="index" | 17 | :key="index" |
17 | > | 18 | > |
18 | <span style="display: none">{{ item + index }}</span> | 19 | <span style="display: none">{{ item + index }}</span> |
19 | - <span style="position: relative; top: 3.2vh; left: 0.3vw">触发器 {{ index + 1 }}</span> | 20 | + <span style="position: relative; top: 3.2vh; left: 0.5vw">触发器 {{ index + 1 }}</span> |
20 | <div style="display: block"> | 21 | <div style="display: block"> |
21 | <AddTriggerForm | 22 | <AddTriggerForm |
23 | + ref="refTriggerChild" | ||
22 | :editTriggerFather="isUpdate == false ? 1 : item" | 24 | :editTriggerFather="isUpdate == false ? 1 : item" |
23 | :newFilterMapFather="isUpdate == false ? 1 : newFilterMap" | 25 | :newFilterMapFather="isUpdate == false ? 1 : newFilterMap" |
24 | :deviceInfo="getDeviceInfo" | 26 | :deviceInfo="getDeviceInfo" |
25 | - ref="refTriggerChild" | ||
26 | /> | 27 | /> |
27 | </div> | 28 | </div> |
28 | <div style="height: 3vh"></div> | 29 | <div style="height: 3vh"></div> |
@@ -56,13 +57,13 @@ | @@ -56,13 +57,13 @@ | ||
56 | </div> | 57 | </div> |
57 | <div style="height: 5vh"></div> | 58 | <div style="height: 5vh"></div> |
58 | <!-- 执行条件 --> | 59 | <!-- 执行条件 --> |
59 | - <div> | 60 | + <div class="condition-style"> |
60 | <template | 61 | <template |
61 | v-for="(item, index) in isUpdate == false ? addConditionPushData : editConditionPushData" | 62 | v-for="(item, index) in isUpdate == false ? addConditionPushData : editConditionPushData" |
62 | :key="index" | 63 | :key="index" |
63 | > | 64 | > |
64 | <span style="display: none">{{ item + index }}</span> | 65 | <span style="display: none">{{ item + index }}</span> |
65 | - <span style="position: relative; top: 3.2vh; left: 0.3vw">执行条件 {{ index + 1 }}</span> | 66 | + <span style="position: relative; top: 3.2vh; left: 0.5vw">执行条件 {{ index + 1 }}</span> |
66 | 67 | ||
67 | <div> | 68 | <div> |
68 | <AddConditiForm | 69 | <AddConditiForm |
@@ -90,7 +91,7 @@ | @@ -90,7 +91,7 @@ | ||
90 | </div> | 91 | </div> |
91 | <div style="display: flex; width: 4vw; height: 4vh"> | 92 | <div style="display: flex; width: 4vw; height: 4vh"> |
92 | <Button | 93 | <Button |
93 | - v-if="addConditionPushData.length != 0 || addConditionPushData.length != 0" | 94 | + v-if="addConditionPushData.length != 0 || editConditionPushData.length != 0" |
94 | style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)" | 95 | style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)" |
95 | type="default" | 96 | type="default" |
96 | class="mt-5" | 97 | class="mt-5" |
@@ -137,7 +138,7 @@ | @@ -137,7 +138,7 @@ | ||
137 | </div> | 138 | </div> |
138 | <div style="display: flex; width: 4vw; height: 4vh"> | 139 | <div style="display: flex; width: 4vw; height: 4vh"> |
139 | <Button | 140 | <Button |
140 | - v-if="addActionPushData.length > 0 || addActionPushData.length > 0" | 141 | + v-if="addActionPushData.length !== 0 || editActionPushData.length !== 0" |
141 | style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)" | 142 | style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)" |
142 | type="default" | 143 | type="default" |
143 | class="mt-5" | 144 | class="mt-5" |
@@ -182,44 +183,59 @@ | @@ -182,44 +183,59 @@ | ||
182 | emits: ['success', 'register', 'registerForm'], | 183 | emits: ['success', 'register', 'registerForm'], |
183 | setup(_, { emit }) { | 184 | setup(_, { emit }) { |
184 | const { proxy } = getCurrentInstance(); | 185 | const { proxy } = getCurrentInstance(); |
185 | - const lastRefTriggerChildDataArray = ref<[]>([]); | ||
186 | const lastEditRefTriggerChildDataArray = ref<[]>([]); | 186 | const lastEditRefTriggerChildDataArray = ref<[]>([]); |
187 | const lastEditRefConditionChildDataArray = ref<[]>([]); | 187 | const lastEditRefConditionChildDataArray = ref<[]>([]); |
188 | const lastEditRefActionChildDataArray = ref<[]>([]); | 188 | const lastEditRefActionChildDataArray = ref<[]>([]); |
189 | + const lastRefTriggerChildDataArray = ref<[]>([]); | ||
189 | const lastRefConditionChildDataArray = ref<[]>([]); | 190 | const lastRefConditionChildDataArray = ref<[]>([]); |
190 | const lastRefActionChildDataArray = ref<[]>([]); | 191 | const lastRefActionChildDataArray = ref<[]>([]); |
191 | - const lastRefTriggerChildData: any = ref({}); | ||
192 | - const lastRefConditionChildData: any = ref({}); | ||
193 | - const lastRefActionChildData: any = ref({}); | ||
194 | - const refTriggerChildData: any = ref({}); | ||
195 | - const refConditionChildData: any = ref({}); | ||
196 | - const refActionChildData: any = ref({}); | 192 | + let refTriggerChildData: any = reactive({}); |
193 | + let refConditionChildData: any = reactive({}); | ||
194 | + let refActionChildData: any = reactive({}); | ||
197 | const addTriggerData = reactive<IAddTrigger>({ | 195 | const addTriggerData = reactive<IAddTrigger>({ |
198 | - id: Date.now() + Math.random() + '', | ||
199 | - triggerEvent: '', | ||
200 | - deviceId: '', | 196 | + triggerType: '', |
197 | + entityId: '', | ||
201 | touchWay: '', | 198 | touchWay: '', |
202 | attributeChoose: '', | 199 | attributeChoose: '', |
203 | compare: '', | 200 | compare: '', |
204 | value: '', | 201 | value: '', |
205 | }); | 202 | }); |
203 | + const editTriggerData = reactive<IAddTrigger>({ | ||
204 | + triggerType: '', | ||
205 | + entityId: '请选择设备', | ||
206 | + touchWay: '请选择触发方式', | ||
207 | + attributeChoose: '请选择属性', | ||
208 | + compare: '', | ||
209 | + value: '', | ||
210 | + }); | ||
206 | const addConditionData = reactive<IAddCondition>({ | 211 | const addConditionData = reactive<IAddCondition>({ |
207 | - id: Date.now() + Math.random() + '', | ||
208 | - status: '', | ||
209 | - deviceId: '', | 212 | + triggerType: '', |
213 | + entityId: '', | ||
210 | createTime: '', | 214 | createTime: '', |
211 | updateTime: '', | 215 | updateTime: '', |
212 | - property: '', | 216 | + compare: '', |
217 | + value: '', | ||
218 | + }); | ||
219 | + const editConditionData = reactive<IAddCondition>({ | ||
220 | + entityId: '请选择设备', | ||
221 | + createTime: '', | ||
222 | + updateTime: '', | ||
223 | + triggerType: '', | ||
213 | compare: '', | 224 | compare: '', |
214 | value: '', | 225 | value: '', |
215 | }); | 226 | }); |
216 | const addActionData = reactive<IAddAction>({ | 227 | const addActionData = reactive<IAddAction>({ |
217 | - id: Date.now() + Math.random() + '', | ||
218 | outTarget: '', | 228 | outTarget: '', |
219 | - deviceId: '', | 229 | + entityId: '', |
220 | command: '', | 230 | command: '', |
221 | sceneLinkageId: '', | 231 | sceneLinkageId: '', |
222 | }); | 232 | }); |
233 | + const editActionData = reactive<IAddAction>({ | ||
234 | + outTarget: '', | ||
235 | + entityId: '请选择设备', | ||
236 | + command: '请输入执行命令', | ||
237 | + sceneLinkageId: '', | ||
238 | + }); | ||
223 | const addTriggerPushData = ref<[]>([]); | 239 | const addTriggerPushData = ref<[]>([]); |
224 | const addConditionPushData = ref<[]>([]); | 240 | const addConditionPushData = ref<[]>([]); |
225 | const addActionPushData = ref<[]>([]); | 241 | const addActionPushData = ref<[]>([]); |
@@ -234,7 +250,7 @@ | @@ -234,7 +250,7 @@ | ||
234 | const getConditionChildData = ref(null); | 250 | const getConditionChildData = ref(null); |
235 | const { createMessage } = useMessage(); | 251 | const { createMessage } = useMessage(); |
236 | const isUpdate = ref(true); | 252 | const isUpdate = ref(true); |
237 | - const getAllFormData: any = reactive({}); | 253 | + let getAllFormData: any = reactive({}); |
238 | let getValuesFormData: any = reactive({}); | 254 | let getValuesFormData: any = reactive({}); |
239 | const getId = ref(''); | 255 | const getId = ref(''); |
240 | const getTenantId = ref(''); | 256 | const getTenantId = ref(''); |
@@ -244,6 +260,26 @@ | @@ -244,6 +260,26 @@ | ||
244 | const newFilterMap = ref<[]>([]); | 260 | const newFilterMap = ref<[]>([]); |
245 | const newConditionFilterMap = ref<[]>([]); | 261 | const newConditionFilterMap = ref<[]>([]); |
246 | const newActionFilterMap = ref<[]>([]); | 262 | const newActionFilterMap = ref<[]>([]); |
263 | + let filterNewConditionArr = []; | ||
264 | + let filterNewActionArr = []; | ||
265 | + const pushEditArray = []; | ||
266 | + const pushEditConditionArray = []; | ||
267 | + const pushEditActionArray = []; | ||
268 | + let filterArrayTrigger = []; | ||
269 | + const filterArrayCondition = ref<[]>([]); | ||
270 | + const filterArrayAction = ref<[]>([]); | ||
271 | + let filterNewTriggerArr = []; | ||
272 | + | ||
273 | + let triggersObj = { | ||
274 | + triggers: [], | ||
275 | + }; | ||
276 | + let conditionsObj = { | ||
277 | + doConditions: [], | ||
278 | + }; | ||
279 | + let actionsObj = { | ||
280 | + doActions: [], | ||
281 | + }; | ||
282 | + let optionsItemArray = ref<[]>([]); | ||
247 | 283 | ||
248 | const [registerForm, { resetFields, setFieldsValue, validateFields }] = useForm({ | 284 | const [registerForm, { resetFields, setFieldsValue, validateFields }] = useForm({ |
249 | labelWidth: 120, | 285 | labelWidth: 120, |
@@ -256,14 +292,47 @@ | @@ -256,14 +292,47 @@ | ||
256 | setDrawerProps({ confirmLoading: false }); | 292 | setDrawerProps({ confirmLoading: false }); |
257 | isUpdate.value = !!data?.isUpdate; | 293 | isUpdate.value = !!data?.isUpdate; |
258 | if (!unref(isUpdate)) { | 294 | if (!unref(isUpdate)) { |
259 | - editTriggerPushData.value = []; | ||
260 | - editTriggerPushData.value.length = 0; | ||
261 | try { | 295 | try { |
262 | - setTimeout(() => { | ||
263 | - // proxy.$refs.refTriggerChild.resetFieldsValueFunc(); | ||
264 | - proxy.$refs.refConditionChild.resetFieldsValueFunc(); | ||
265 | - proxy.$refs.refActionChild.resetFieldsValueFunc(); | ||
266 | - }, 50); | 296 | + refTriggerChildData = {}; |
297 | + refConditionChildData = {}; | ||
298 | + refActionChildData = {}; | ||
299 | + getAllFormData = {}; | ||
300 | + triggersObj = { | ||
301 | + triggers: [], | ||
302 | + }; | ||
303 | + conditionsObj = { | ||
304 | + doConditions: [], | ||
305 | + }; | ||
306 | + actionsObj = { | ||
307 | + doActions: [], | ||
308 | + }; | ||
309 | + filterNewTriggerArr.length = 0; | ||
310 | + filterNewConditionArr.length = 0; | ||
311 | + lastRefTriggerChildDataArray.value.length = 0; | ||
312 | + lastRefConditionChildDataArray.value.length = 0; | ||
313 | + lastRefActionChildDataArray.value.length = 0; | ||
314 | + editTriggerPushData.value.length = 0; | ||
315 | + editConditionPushData.value.length = 0; | ||
316 | + editActionPushData.value.length = 0; | ||
317 | + addTriggerPushData.value.length = 0; | ||
318 | + addConditionPushData.value.length = 0; | ||
319 | + addActionPushData.value.length = 0; | ||
320 | + handleClose(); | ||
321 | + optionsItemArray.value.length = 0; | ||
322 | + try { | ||
323 | + setTimeout(() => { | ||
324 | + proxy.$refs.refTriggerChild.resetFieldsValueFunc(); | ||
325 | + proxy.$refs.refTriggerChild.clearSelectDevice(); | ||
326 | + proxy.$refs.refConditionChild.resetFieldsValueFunc(); | ||
327 | + proxy.$refs.refConditionChild.clearSelectDevice(); | ||
328 | + proxy.$refs.refActionChild.resetFieldsValueFunc(); | ||
329 | + proxy.$refs.refActionChild.clearSelectDevice(); | ||
330 | + clearActionsAllDevice(); | ||
331 | + resetActionsAllArrayFunc(); | ||
332 | + }, 200); | ||
333 | + } catch (e) { | ||
334 | + return e; | ||
335 | + } | ||
267 | } catch (e) { | 336 | } catch (e) { |
268 | return e; | 337 | return e; |
269 | } | 338 | } |
@@ -275,7 +344,9 @@ | @@ -275,7 +344,9 @@ | ||
275 | editTriggerPushData.value = []; | 344 | editTriggerPushData.value = []; |
276 | editTriggerPushData.value.length = 0; | 345 | editTriggerPushData.value.length = 0; |
277 | editConditionPushData.value = []; | 346 | editConditionPushData.value = []; |
347 | + editConditionPushData.value.length = 0; | ||
278 | editActionPushData.value = []; | 348 | editActionPushData.value = []; |
349 | + editActionPushData.value.length = 0; | ||
279 | lastEditRefTriggerChildDataArray.value = []; | 350 | lastEditRefTriggerChildDataArray.value = []; |
280 | getId.value = data.record.id; | 351 | getId.value = data.record.id; |
281 | getTenantId.value = data.record.tenantId; | 352 | getTenantId.value = data.record.tenantId; |
@@ -283,14 +354,6 @@ | @@ -283,14 +354,6 @@ | ||
283 | ...data.record, | 354 | ...data.record, |
284 | }); | 355 | }); |
285 | editTriggerPushData.value = data.record.triggers; | 356 | editTriggerPushData.value = data.record.triggers; |
286 | - editTriggerPushData.value.forEach((f) => { | ||
287 | - if (f?.id.length == 18) { | ||
288 | - editTriggerPushData.value.pop(); | ||
289 | - if (editTriggerPushData.value.length) { | ||
290 | - editTriggerPushData.value.length = editTriggerPushData.value.length; | ||
291 | - } | ||
292 | - } | ||
293 | - }); | ||
294 | editConditionPushData.value = data.record.doConditions; | 357 | editConditionPushData.value = data.record.doConditions; |
295 | editActionPushData.value = data.record.doActions; | 358 | editActionPushData.value = data.record.doActions; |
296 | const options = await screenLinkPageByDeptIdGetDevice({ | 359 | const options = await screenLinkPageByDeptIdGetDevice({ |
@@ -299,7 +362,7 @@ | @@ -299,7 +362,7 @@ | ||
299 | try { | 362 | try { |
300 | data.record.triggers.forEach((f1) => { | 363 | data.record.triggers.forEach((f1) => { |
301 | options.items?.forEach((f2) => { | 364 | options.items?.forEach((f2) => { |
302 | - if (f2.id == f1.deviceId) { | 365 | + if (f2.id == f1.entityId) { |
303 | newFilterMap.value.push({ | 366 | newFilterMap.value.push({ |
304 | value: f2.id, | 367 | value: f2.id, |
305 | label: f2.name, | 368 | label: f2.name, |
@@ -310,7 +373,7 @@ | @@ -310,7 +373,7 @@ | ||
310 | 373 | ||
311 | data.record.doConditions.forEach((f1) => { | 374 | data.record.doConditions.forEach((f1) => { |
312 | options.items?.forEach((f2) => { | 375 | options.items?.forEach((f2) => { |
313 | - if (f2.id == f1.deviceId) { | 376 | + if (f2.id == f1.entityId) { |
314 | newConditionFilterMap.value.push({ | 377 | newConditionFilterMap.value.push({ |
315 | value: f2.id, | 378 | value: f2.id, |
316 | label: f2.name, | 379 | label: f2.name, |
@@ -320,7 +383,7 @@ | @@ -320,7 +383,7 @@ | ||
320 | }); | 383 | }); |
321 | data.record.doActions.forEach((f1) => { | 384 | data.record.doActions.forEach((f1) => { |
322 | options.items?.forEach((f2) => { | 385 | options.items?.forEach((f2) => { |
323 | - if (f2.id == f1.deviceId) { | 386 | + if (f2.id == f1.entityId) { |
324 | newActionFilterMap.value.push({ | 387 | newActionFilterMap.value.push({ |
325 | value: f2.id, | 388 | value: f2.id, |
326 | label: f2.name, | 389 | label: f2.name, |
@@ -332,6 +395,17 @@ | @@ -332,6 +395,17 @@ | ||
332 | } | 395 | } |
333 | }); | 396 | }); |
334 | const getTitle = computed(() => (!unref(isUpdate) ? '新增场景联动' : '编辑场景联动')); | 397 | const getTitle = computed(() => (!unref(isUpdate) ? '新增场景联动' : '编辑场景联动')); |
398 | + const handleClose = () => { | ||
399 | + pushEditArray.length = 0; | ||
400 | + lastRefTriggerChildDataArray.value.length = 0; | ||
401 | + lastRefTriggerChildDataArray.value = []; | ||
402 | + lastRefConditionChildDataArray.value.length = 0; | ||
403 | + lastRefActionChildDataArray.value.length = 0; | ||
404 | + lastRefActionChildDataArray.value = []; | ||
405 | + filterArrayTrigger.length = 0; | ||
406 | + filterArrayCondition.value.length = 0; | ||
407 | + filterArrayAction.value.length = 0; | ||
408 | + }; | ||
335 | 409 | ||
336 | const clearAllArrayFunc = () => { | 410 | const clearAllArrayFunc = () => { |
337 | unref(addTriggerPushData).length = 0; | 411 | unref(addTriggerPushData).length = 0; |
@@ -356,16 +430,37 @@ | @@ -356,16 +430,37 @@ | ||
356 | return e; | 430 | return e; |
357 | } | 431 | } |
358 | }; | 432 | }; |
359 | - watch(getData, (newV) => { | ||
360 | - getDeviceInfo.value = newV; | ||
361 | - getDeviceInfo1.value = newV; | ||
362 | - getDeviceInfo2.value = newV; | 433 | + watch(getData, async (newV) => { |
434 | + // getDeviceInfo.value = newV; | ||
435 | + // getDeviceInfo1.value = newV; | ||
436 | + // getDeviceInfo2.value = newV; | ||
437 | + const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); | ||
438 | + options.items.forEach((v) => { | ||
439 | + return (v.value = v.id), (v.label = v.name); | ||
440 | + }); | ||
441 | + optionsItemArray.value = options.items; | ||
442 | + updateDeviceIdFunc(optionsItemArray.value); | ||
443 | + try { | ||
444 | + proxy.$refs.refActionChild.updateFieldDeviceId(optionsItemArray.value); | ||
445 | + } catch (e) { | ||
446 | + return e; | ||
447 | + } | ||
363 | }); | 448 | }); |
364 | 449 | ||
450 | + const updateDeviceIdFunc = (v) => { | ||
451 | + try { | ||
452 | + proxy.$refs.refTriggerChild.updateFieldDeviceId(v); | ||
453 | + proxy.$refs.refConditionChild.updateFieldDeviceId(v); | ||
454 | + proxy.$refs.refActionChild.updateFieldDeviceId(v); | ||
455 | + } catch (e) { | ||
456 | + return e; | ||
457 | + } | ||
458 | + }; | ||
459 | + | ||
365 | //触发器方法 | 460 | //触发器方法 |
366 | const refTriggerChildDataFunc = () => { | 461 | const refTriggerChildDataFunc = () => { |
367 | try { | 462 | try { |
368 | - refTriggerChildData.value = proxy.$refs.refTriggerChild.getFieldsValueFunc(); | 463 | + refTriggerChildData = proxy.$refs.refTriggerChild.getFieldsValueFunc(); |
369 | } catch (e) { | 464 | } catch (e) { |
370 | return e; | 465 | return e; |
371 | } | 466 | } |
@@ -373,7 +468,7 @@ | @@ -373,7 +468,7 @@ | ||
373 | //执行条件方法 | 468 | //执行条件方法 |
374 | const refConditionChildDataFunc = () => { | 469 | const refConditionChildDataFunc = () => { |
375 | try { | 470 | try { |
376 | - refConditionChildData.value = proxy.$refs.refConditionChild.getFieldsValueFunc(); | 471 | + refConditionChildData = proxy.$refs.refConditionChild.getFieldsValueFunc(); |
377 | } catch (e) { | 472 | } catch (e) { |
378 | return e; | 473 | return e; |
379 | } | 474 | } |
@@ -381,7 +476,7 @@ | @@ -381,7 +476,7 @@ | ||
381 | //执行动作方法 | 476 | //执行动作方法 |
382 | const refActionChildDataFunc = () => { | 477 | const refActionChildDataFunc = () => { |
383 | try { | 478 | try { |
384 | - refActionChildData.value = proxy.$refs.refActionChild.getFieldsValueFunc(); | 479 | + refActionChildData = proxy.$refs.refActionChild.getFieldsValueFunc(); |
385 | } catch (e) { | 480 | } catch (e) { |
386 | return e; | 481 | return e; |
387 | } | 482 | } |
@@ -394,20 +489,16 @@ | @@ -394,20 +489,16 @@ | ||
394 | refTriggerChildDataFunc(); | 489 | refTriggerChildDataFunc(); |
395 | refConditionChildDataFunc(); | 490 | refConditionChildDataFunc(); |
396 | refActionChildDataFunc(); | 491 | refActionChildDataFunc(); |
397 | - lastRefTriggerChildDataArray.value.push(refTriggerChildData.value as never); | ||
398 | - lastRefConditionChildDataArray.value.push(refConditionChildData.value as never); | ||
399 | - lastRefActionChildDataArray.value.push(refActionChildData.value as never); | ||
400 | - //删除第一个 | ||
401 | - lastRefTriggerChildDataArray.value.shift(); | ||
402 | - lastRefConditionChildDataArray.value.shift(); | ||
403 | - lastRefActionChildDataArray.value.shift(); | ||
404 | - const triggersObj = { | 492 | + lastRefTriggerChildDataArray.value.push(refTriggerChildData as never); |
493 | + lastRefConditionChildDataArray.value.push(refConditionChildData as never); | ||
494 | + lastRefActionChildDataArray.value.push(refActionChildData as never); | ||
495 | + triggersObj = { | ||
405 | triggers: lastRefTriggerChildDataArray.value, | 496 | triggers: lastRefTriggerChildDataArray.value, |
406 | }; | 497 | }; |
407 | - const conditionsObj = { | 498 | + conditionsObj = { |
408 | doConditions: lastRefConditionChildDataArray.value, | 499 | doConditions: lastRefConditionChildDataArray.value, |
409 | }; | 500 | }; |
410 | - const actionsObj = { | 501 | + actionsObj = { |
411 | doActions: lastRefActionChildDataArray.value, | 502 | doActions: lastRefActionChildDataArray.value, |
412 | }; | 503 | }; |
413 | Object.assign(getAllFormData, triggersObj, conditionsObj, actionsObj); | 504 | Object.assign(getAllFormData, triggersObj, conditionsObj, actionsObj); |
@@ -415,30 +506,82 @@ | @@ -415,30 +506,82 @@ | ||
415 | refTriggerChildDataFunc(); | 506 | refTriggerChildDataFunc(); |
416 | refConditionChildDataFunc(); | 507 | refConditionChildDataFunc(); |
417 | refActionChildDataFunc(); | 508 | refActionChildDataFunc(); |
418 | - lastEditRefTriggerChildDataArray.value.push(refTriggerChildData.value as never); | ||
419 | - lastEditRefConditionChildDataArray.value.push(refConditionChildData.value as never); | ||
420 | - lastEditRefActionChildDataArray.value.push(refActionChildData.value as never); | ||
421 | - lastRefConditionChildDataArray.value.push(refConditionChildData.value as never); | ||
422 | - lastRefActionChildDataArray.value.push(refActionChildData.value as never); | ||
423 | - const triggersObj = { | ||
424 | - triggers: lastEditRefTriggerChildDataArray.value, | 509 | + pushEditArray.push(refTriggerChildData as never); |
510 | + pushEditConditionArray.push(refConditionChildData as never); | ||
511 | + pushEditActionArray.push(refActionChildData as never); | ||
512 | + pushEditArray.forEach((f) => { | ||
513 | + editTriggerPushData.value.push(f as never); | ||
514 | + }); | ||
515 | + pushEditConditionArray.forEach((f) => { | ||
516 | + editConditionPushData.value.push(f as never); | ||
517 | + }); | ||
518 | + pushEditActionArray.forEach((f) => { | ||
519 | + editActionPushData.value.push(f as never); | ||
520 | + }); | ||
521 | + const filterTwoArrayTrigger = editTriggerPushData.value.filter((f) => | ||
522 | + f?.hasOwnProperty('id') | ||
523 | + ); | ||
524 | + | ||
525 | + const filterTwoArrayCondition = editConditionPushData.value.filter((f) => | ||
526 | + f?.hasOwnProperty('id') | ||
527 | + ); | ||
528 | + | ||
529 | + const filterTwoArrayAction = editActionPushData.value.filter((f) => | ||
530 | + f?.hasOwnProperty('id') | ||
531 | + ); | ||
532 | + | ||
533 | + const filterThreeArrayTrigger = editTriggerPushData.value.filter( | ||
534 | + (f) => f?.entityId == '' | ||
535 | + ); | ||
536 | + const filterThreeArrayCondition = editConditionPushData.value.filter( | ||
537 | + (f) => f?.entityId == '' | ||
538 | + ); | ||
539 | + const filterThreeArrayAction = editActionPushData.value.filter((f) => f?.entityId == ''); | ||
540 | + const filterFourArrayTrigger = filterThreeArrayTrigger.filter( | ||
541 | + (f) => f?.triggerType !== '' | ||
542 | + ); | ||
543 | + const filterFourArrayCondition = filterThreeArrayCondition.filter( | ||
544 | + (f) => f?.triggerType !== '' | ||
545 | + ); | ||
546 | + | ||
547 | + const filterFourArrayAction = filterThreeArrayAction.filter((f) => f?.outTarget !== ''); | ||
548 | + | ||
549 | + filterFourArrayTrigger.forEach((f) => { | ||
550 | + filterTwoArrayTrigger.push(f); | ||
551 | + }); | ||
552 | + filterFourArrayCondition.forEach((f) => { | ||
553 | + filterTwoArrayCondition.push(f); | ||
554 | + }); | ||
555 | + filterFourArrayAction.forEach((f) => { | ||
556 | + filterTwoArrayAction.push(f); | ||
557 | + }); | ||
558 | + | ||
559 | + let editTriggersObj = { | ||
560 | + triggers: filterTwoArrayTrigger, | ||
425 | }; | 561 | }; |
426 | - const conditionsObj = { | ||
427 | - doConditions: lastRefConditionChildDataArray.value, | 562 | + let editConditionsObj = { |
563 | + doConditions: filterTwoArrayCondition, | ||
428 | }; | 564 | }; |
429 | - const actionsObj = { | ||
430 | - doActions: lastRefActionChildDataArray.value, | 565 | + let editActionsObj = { |
566 | + doActions: filterTwoArrayAction, | ||
431 | }; | 567 | }; |
432 | - Object.assign(getAllFormData, triggersObj, conditionsObj, actionsObj); | 568 | + Object.assign(getAllFormData, editTriggersObj, editConditionsObj, editActionsObj); |
433 | } | 569 | } |
434 | }; | 570 | }; |
435 | 571 | ||
436 | const handleSubmit = async () => { | 572 | const handleSubmit = async () => { |
437 | if (!unref(isUpdate)) { | 573 | if (!unref(isUpdate)) { |
574 | + let kongObj = true; | ||
438 | getDefaultValue(); | 575 | getDefaultValue(); |
439 | getValuesFormData = await validateFields(); | 576 | getValuesFormData = await validateFields(); |
440 | if (!getValuesFormData) return; | 577 | if (!getValuesFormData) return; |
441 | Object.assign(getAllFormData, getValuesFormData); | 578 | Object.assign(getAllFormData, getValuesFormData); |
579 | + lastRefActionChildDataArray.value.forEach((f) => { | ||
580 | + if (Object.keys(f).length == 0) { | ||
581 | + kongObj = false; | ||
582 | + } | ||
583 | + }); | ||
584 | + if (!kongObj) return createMessage.error('请填写执行动作'); | ||
442 | await screenLinkPageAddApi(getAllFormData); | 585 | await screenLinkPageAddApi(getAllFormData); |
443 | createMessage.success('场景联动新增成功'); | 586 | createMessage.success('场景联动新增成功'); |
444 | closeDrawer(); | 587 | closeDrawer(); |
@@ -455,6 +598,8 @@ | @@ -455,6 +598,8 @@ | ||
455 | emit('success'); | 598 | emit('success'); |
456 | } | 599 | } |
457 | }; | 600 | }; |
601 | + | ||
602 | + //默认添加触发器 | ||
458 | const defaultAddTrigger = () => { | 603 | const defaultAddTrigger = () => { |
459 | if (unref(addTriggerPushData).length == 0) { | 604 | if (unref(addTriggerPushData).length == 0) { |
460 | setTimeout(() => { | 605 | setTimeout(() => { |
@@ -462,19 +607,27 @@ | @@ -462,19 +607,27 @@ | ||
462 | }, 10); | 607 | }, 10); |
463 | } | 608 | } |
464 | }; | 609 | }; |
465 | - | ||
466 | //新增触发器 | 610 | //新增触发器 |
467 | const addTrigger = () => { | 611 | const addTrigger = () => { |
468 | if (!unref(isUpdate)) { | 612 | if (!unref(isUpdate)) { |
469 | unref(addTriggerPushData).push(addTriggerData as never); | 613 | unref(addTriggerPushData).push(addTriggerData as never); |
470 | refTriggerChildDataFunc(); | 614 | refTriggerChildDataFunc(); |
471 | - lastRefTriggerChildData.value = refTriggerChildData.value; | ||
472 | - lastRefTriggerChildDataArray.value.push(lastRefTriggerChildData.value as never); | 615 | + // refTriggerChildData; |
616 | + filterNewTriggerArr.push(refTriggerChildData as never); | ||
617 | + (lastRefTriggerChildDataArray.value as never[]) = filterNewTriggerArr.filter( | ||
618 | + (v) => Object.keys(v).length !== 0 | ||
619 | + ); | ||
620 | + try { | ||
621 | + setTimeout(() => { | ||
622 | + proxy.$refs.refTriggerChild.updateFieldDeviceId(optionsItemArray.value); | ||
623 | + }, 150); | ||
624 | + } catch (e) { | ||
625 | + return e; | ||
626 | + } | ||
473 | } else { | 627 | } else { |
474 | - unref(editTriggerPushData).push(addTriggerData as never); | ||
475 | refTriggerChildDataFunc(); | 628 | refTriggerChildDataFunc(); |
476 | - lastRefTriggerChildData.value = refTriggerChildData.value; | ||
477 | - lastEditRefTriggerChildDataArray.value.push(lastRefTriggerChildData.value as never); | 629 | + pushEditArray.push(refTriggerChildData as never); |
630 | + unref(editTriggerPushData).push(addTriggerData as never); | ||
478 | } | 631 | } |
479 | }; | 632 | }; |
480 | const removeTrigger = () => { | 633 | const removeTrigger = () => { |
@@ -488,83 +641,108 @@ | @@ -488,83 +641,108 @@ | ||
488 | } else { | 641 | } else { |
489 | try { | 642 | try { |
490 | unref(editTriggerPushData).splice(0, 1); | 643 | unref(editTriggerPushData).splice(0, 1); |
491 | - lastEditRefTriggerChildDataArray.value.splice(0, 1); | 644 | + lastEditRefTriggerChildDataArray.value.pop(); |
492 | } catch (e) { | 645 | } catch (e) { |
493 | return e; | 646 | return e; |
494 | } | 647 | } |
495 | } | 648 | } |
496 | }; | 649 | }; |
497 | 650 | ||
651 | + //默认添加执行条件 | ||
652 | + const defaultAddCondition = () => { | ||
653 | + if (unref(addConditionPushData).length == 0) { | ||
654 | + addCondition(); | ||
655 | + } | ||
656 | + }; | ||
498 | //新增执行条件 | 657 | //新增执行条件 |
499 | const addCondition = () => { | 658 | const addCondition = () => { |
500 | - // if (!unref(isUpdate)) { | ||
501 | - // console.log('add'); | ||
502 | - // unref(addConditionPushData).push(addConditionData as never); | ||
503 | - // refConditionChildDataFunc(); | ||
504 | - // lastRefConditionChildData.value = refConditionChildData.value; | ||
505 | - // lastRefConditionChildDataArray.value.push(lastRefConditionChildData.value as never); | ||
506 | - // } else { | ||
507 | - // console.log('edit'); | ||
508 | - | ||
509 | - // unref(editConditionPushData).push(addConditionData as never); | ||
510 | - // console.log(unref(editConditionPushData)); | ||
511 | - // refConditionChildDataFunc(); | ||
512 | - // lastRefConditionChildData.value = refConditionChildData.value; | ||
513 | - // lastEditRefConditionChildDataArray.value.push(lastRefConditionChildData.value as never); | ||
514 | - // } | ||
515 | - unref(addConditionPushData).push(addConditionData as never); | ||
516 | - refConditionChildDataFunc(); | ||
517 | - lastRefConditionChildData.value = refConditionChildData.value; | ||
518 | - lastRefConditionChildDataArray.value.push(lastRefConditionChildData.value as never); | 659 | + if (!unref(isUpdate)) { |
660 | + unref(addConditionPushData).push(addConditionData as never); | ||
661 | + refConditionChildDataFunc(); | ||
662 | + filterNewConditionArr.push(refConditionChildData as never); | ||
663 | + (lastRefConditionChildDataArray.value as never[]) = filterNewConditionArr.filter( | ||
664 | + (v) => Object.keys(v).length !== 0 | ||
665 | + ); | ||
666 | + try { | ||
667 | + setTimeout(() => { | ||
668 | + proxy.$refs.refConditionChild.updateFieldDeviceId(optionsItemArray.value); | ||
669 | + }, 150); | ||
670 | + } catch (e) { | ||
671 | + return e; | ||
672 | + } | ||
673 | + } else { | ||
674 | + refConditionChildDataFunc(); | ||
675 | + pushEditConditionArray.push(refConditionChildData as never); | ||
676 | + unref(editConditionPushData).push(addConditionData as never); | ||
677 | + } | ||
519 | }; | 678 | }; |
520 | const removeCondition = () => { | 679 | const removeCondition = () => { |
521 | - try { | ||
522 | - unref(addConditionPushData).splice(0, 1); | ||
523 | - lastRefConditionChildDataArray.value.splice(0, 1); | ||
524 | - } catch (e) { | ||
525 | - return e; | 680 | + if (!unref(isUpdate)) { |
681 | + try { | ||
682 | + unref(addConditionPushData).splice(0, 1); | ||
683 | + lastRefConditionChildDataArray.value.pop(); | ||
684 | + } catch (e) { | ||
685 | + return e; | ||
686 | + } | ||
687 | + } else { | ||
688 | + try { | ||
689 | + unref(editConditionPushData).splice(0, 1); | ||
690 | + lastEditRefConditionChildDataArray.value.pop(); | ||
691 | + } catch (e) { | ||
692 | + return e; | ||
693 | + } | ||
526 | } | 694 | } |
527 | }; | 695 | }; |
528 | 696 | ||
529 | - //新增执行动作 | 697 | + //默认新增执行动作 |
530 | const defaultAddAction = () => { | 698 | const defaultAddAction = () => { |
531 | if (unref(addActionPushData).length == 0) { | 699 | if (unref(addActionPushData).length == 0) { |
532 | addAction(); | 700 | addAction(); |
533 | } | 701 | } |
534 | }; | 702 | }; |
535 | - | ||
536 | - const defaultAddCondition = () => { | ||
537 | - if (unref(addConditionPushData).length == 0) { | ||
538 | - addCondition(); | ||
539 | - } | ||
540 | - }; | 703 | + //新增执行动作 |
541 | const addAction = () => { | 704 | const addAction = () => { |
542 | - // if (!unref(isUpdate)) { | ||
543 | - // unref(addActionPushData).push(addActionData as never); | ||
544 | - // refActionChildDataFunc(); | ||
545 | - // lastRefActionChildData.value = refActionChildData.value; | ||
546 | - // lastRefActionChildDataArray.value.push(lastRefActionChildData.value as never); | ||
547 | - // } else { | ||
548 | - // unref(editActionPushData).push(addActionData as never); | ||
549 | - // refActionChildDataFunc(); | ||
550 | - // lastRefActionChildData.value = refActionChildData.value; | ||
551 | - // lastEditRefActionChildDataArray.value.push(lastRefActionChildData.value as never); | ||
552 | - // } | ||
553 | - unref(addActionPushData).push(addActionData as never); | ||
554 | - refActionChildDataFunc(); | ||
555 | - lastRefActionChildData.value = refActionChildData.value; | ||
556 | - lastRefActionChildDataArray.value.push(lastRefActionChildData.value as never); | 705 | + if (!unref(isUpdate)) { |
706 | + unref(addActionPushData).push(addActionData as never); | ||
707 | + refActionChildDataFunc(); | ||
708 | + filterNewActionArr.push(refActionChildData as never); | ||
709 | + (lastRefActionChildDataArray.value as never[]) = filterNewActionArr.filter( | ||
710 | + (v) => Object.keys(v).length !== 0 | ||
711 | + ); | ||
712 | + try { | ||
713 | + setTimeout(() => { | ||
714 | + proxy.$refs.refActionChild.updateFieldDeviceId(optionsItemArray.value); | ||
715 | + }, 150); | ||
716 | + } catch (e) { | ||
717 | + return e; | ||
718 | + } | ||
719 | + } else { | ||
720 | + refActionChildDataFunc(); | ||
721 | + pushEditActionArray.push(refActionChildData as never); | ||
722 | + unref(editActionPushData).push(addActionData as never); | ||
723 | + } | ||
557 | }; | 724 | }; |
558 | const removeAction = () => { | 725 | const removeAction = () => { |
559 | - try { | ||
560 | - unref(addActionPushData).splice(0, 1); | ||
561 | - lastRefActionChildDataArray.value.splice(0, 1); | ||
562 | - } catch (e) { | ||
563 | - return e; | 726 | + if (!unref(isUpdate)) { |
727 | + try { | ||
728 | + unref(addActionPushData).splice(0, 1); | ||
729 | + lastRefActionChildDataArray.value.pop(); | ||
730 | + } catch (e) { | ||
731 | + return e; | ||
732 | + } | ||
733 | + } else { | ||
734 | + try { | ||
735 | + unref(editActionPushData).splice(0, 1); | ||
736 | + lastEditRefActionChildDataArray.value.pop(); | ||
737 | + } catch (e) { | ||
738 | + return e; | ||
739 | + } | ||
564 | } | 740 | } |
565 | }; | 741 | }; |
566 | 742 | ||
567 | return { | 743 | return { |
744 | + updateDeviceIdFunc, | ||
745 | + handleClose, | ||
568 | defaultAddTrigger, | 746 | defaultAddTrigger, |
569 | defaultAddCondition, | 747 | defaultAddCondition, |
570 | newFilterMap, | 748 | newFilterMap, |
@@ -605,3 +783,11 @@ | @@ -605,3 +783,11 @@ | ||
605 | }, | 783 | }, |
606 | }); | 784 | }); |
607 | </script> | 785 | </script> |
786 | + | ||
787 | +<style lang="less" scoped> | ||
788 | + .condition-style { | ||
789 | + :deep .ant-calendar-picker { | ||
790 | + width: 24.9vw !important; | ||
791 | + } | ||
792 | + } | ||
793 | +</style> |
@@ -7,6 +7,7 @@ export const formSchema: FormSchema[] = [ | @@ -7,6 +7,7 @@ export const formSchema: FormSchema[] = [ | ||
7 | field: 'type', | 7 | field: 'type', |
8 | label: '类型', | 8 | label: '类型', |
9 | component: 'Select', | 9 | component: 'Select', |
10 | + defaultValue: '默认', | ||
10 | colProps: { span: 24 }, | 11 | colProps: { span: 24 }, |
11 | componentProps: { | 12 | componentProps: { |
12 | placeholder: '请选择类型', | 13 | placeholder: '请选择类型', |
@@ -7,7 +7,9 @@ | @@ -7,7 +7,9 @@ | ||
7 | > | 7 | > |
8 | <template #toolbar> | 8 | <template #toolbar> |
9 | <a-button type="primary" @click="handleAdd"> 新增租户配置 </a-button> | 9 | <a-button type="primary" @click="handleAdd"> 新增租户配置 </a-button> |
10 | - <a-button color="error" @click="handleMutilteDelete"> 批量删除 </a-button> | 10 | + <a-button color="error" :disabled="disabled" @click="handleMutilteDelete"> |
11 | + 批量删除 | ||
12 | + </a-button> | ||
11 | </template> | 13 | </template> |
12 | <template #action="{ record }"> | 14 | <template #action="{ record }"> |
13 | <TableAction | 15 | <TableAction |
@@ -38,7 +40,7 @@ | @@ -38,7 +40,7 @@ | ||
38 | </div> | 40 | </div> |
39 | </template> | 41 | </template> |
40 | <script lang="ts"> | 42 | <script lang="ts"> |
41 | - import { defineComponent, reactive } from 'vue'; | 43 | + import { defineComponent, reactive, ref } from 'vue'; |
42 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 44 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
43 | import { useDrawer } from '/@/components/Drawer'; | 45 | import { useDrawer } from '/@/components/Drawer'; |
44 | import TenantSettingDrawer from './useDrawer.vue'; | 46 | import TenantSettingDrawer from './useDrawer.vue'; |
@@ -50,6 +52,7 @@ | @@ -50,6 +52,7 @@ | ||
50 | name: 'Index', | 52 | name: 'Index', |
51 | components: { BasicTable, TenantSettingDrawer, TableAction }, | 53 | components: { BasicTable, TenantSettingDrawer, TableAction }, |
52 | setup() { | 54 | setup() { |
55 | + const disabled = ref(true); | ||
53 | let echoEditData = reactive({}); | 56 | let echoEditData = reactive({}); |
54 | let selectedRowKeys: Array<string> = []; | 57 | let selectedRowKeys: Array<string> = []; |
55 | const [registerDrawer, { openDrawer }] = useDrawer(); | 58 | const [registerDrawer, { openDrawer }] = useDrawer(); |
@@ -97,6 +100,11 @@ | @@ -97,6 +100,11 @@ | ||
97 | } | 100 | } |
98 | const useSelectionChange = () => { | 101 | const useSelectionChange = () => { |
99 | selectedRowKeys = getSelectRowKeys(); | 102 | selectedRowKeys = getSelectRowKeys(); |
103 | + if (selectedRowKeys.length !== 0) { | ||
104 | + disabled.value = false; | ||
105 | + } else { | ||
106 | + disabled.value = true; | ||
107 | + } | ||
100 | }; | 108 | }; |
101 | const handleMutilteDelete = async () => { | 109 | const handleMutilteDelete = async () => { |
102 | await deleteTenantProfileApi(selectedRowKeys); | 110 | await deleteTenantProfileApi(selectedRowKeys); |
@@ -107,6 +115,7 @@ | @@ -107,6 +115,7 @@ | ||
107 | reload(); | 115 | reload(); |
108 | } | 116 | } |
109 | return { | 117 | return { |
118 | + disabled, | ||
110 | echoEditData, | 119 | echoEditData, |
111 | registerTable, | 120 | registerTable, |
112 | registerDrawer, | 121 | registerDrawer, |