Commit 52675b253ab52ee37d54038ab19a517255faf141
1 parent
abb6f5a8
style:修改设备配置上传图片样式,feat:新增数据转换名字重复功能,style:修改数据转换样式问题和按钮样式问题,fix:修复数据转换点击新增时数据没清空问题,fix:修复场景联动编辑回显问题
Showing
19 changed files
with
725 additions
and
479 deletions
... | ... | @@ -40,10 +40,10 @@ export const deleteConvertApi = (ids: string[]) => { |
40 | 40 | }; |
41 | 41 | |
42 | 42 | // 查询配置名称是否存在 |
43 | -export const isExistDataManagerNameApi = (params?: TDataManagerModelQuery) => { | |
44 | - return defHttp.get({ | |
43 | +export const isExistDataManagerNameApi = (check: {}) => { | |
44 | + return defHttp.post({ | |
45 | 45 | url: DataManagerApi.DATA_MANAGER_CONVERT_POST_CHECK_NAME, |
46 | - params, | |
46 | + data: check, | |
47 | 47 | }); |
48 | 48 | }; |
49 | 49 | ... | ... |
... | ... | @@ -57,6 +57,7 @@ |
57 | 57 | }); |
58 | 58 | const getTypeObj = reactive({ |
59 | 59 | type: '', |
60 | + remark: '', | |
60 | 61 | }); |
61 | 62 | const additionalInfoV = { |
62 | 63 | additionalInfo: { |
... | ... | @@ -150,24 +151,28 @@ |
150 | 151 | getSonFormValue.value = await proxy.$refs.refTransferConfigParams.getSonValueDataFunc(); |
151 | 152 | if (getModeSonFormValue.value?.type == 'org.thingsboard.rule.engine.kafka.TbKafkaNode') { |
152 | 153 | getTypeObj.type = 'org.thingsboard.rule.engine.kafka.TbKafkaNode'; |
154 | + getTypeObj.remark = getModeSonFormValue.value.remark; | |
153 | 155 | getNameObj.name = getSonFormValue.value?.configuration?.name; |
154 | 156 | commonFunc(); |
155 | 157 | } else if ( |
156 | 158 | getModeSonFormValue.value?.type == 'org.thingsboard.rule.engine.mqtt.TbMqttNode' |
157 | 159 | ) { |
158 | 160 | getTypeObj.type = 'org.thingsboard.rule.engine.mqtt.TbMqttNode'; |
161 | + getTypeObj.remark = getModeSonFormValue.value.remark; | |
159 | 162 | getNameObj.name = getSonFormValue.value?.configuration?.name; |
160 | 163 | commonFunc(); |
161 | 164 | } else if ( |
162 | 165 | getModeSonFormValue.value?.type == 'org.thingsboard.rule.engine.rabbitmq.TbRabbitMqNode' |
163 | 166 | ) { |
164 | 167 | getTypeObj.type = 'org.thingsboard.rule.engine.rabbitmq.TbRabbitMqNode'; |
168 | + getTypeObj.remark = getModeSonFormValue.value.remark; | |
165 | 169 | getNameObj.name = getSonFormValue.value?.configuration?.name; |
166 | 170 | commonFunc(); |
167 | 171 | } else if ( |
168 | 172 | getModeSonFormValue.value?.type == 'org.thingsboard.rule.engine.rest.TbRestApiCallNode' |
169 | 173 | ) { |
170 | 174 | getTypeObj.type = 'org.thingsboard.rule.engine.rest.TbRestApiCallNode'; |
175 | + getTypeObj.remark = getModeSonFormValue.value.remark; | |
171 | 176 | getNameObj.name = getSonFormValue.value?.configuration?.name; |
172 | 177 | commonFunc(); |
173 | 178 | } |
... | ... | @@ -192,12 +197,14 @@ |
192 | 197 | await postAddConvertApi(allPostForm); |
193 | 198 | createMessage.success('数据转换新增成功'); |
194 | 199 | emit('success'); |
200 | + defineClearFunc(); | |
195 | 201 | closeModal(); |
196 | 202 | } else { |
197 | 203 | await addOrEditFunc(); |
198 | 204 | await postAddConvertApi(allPostForm); |
199 | 205 | createMessage.success('数据转换编辑成功'); |
200 | 206 | emit('success'); |
207 | + defineClearFunc(); | |
201 | 208 | closeModal(); |
202 | 209 | } |
203 | 210 | }; | ... | ... |
... | ... | @@ -24,12 +24,12 @@ export const columns: BasicColumn[] = [ |
24 | 24 | : 'Api'; |
25 | 25 | const color = |
26 | 26 | enable == 'KafKa' |
27 | - ? '#0960cb' | |
27 | + ? '#0099FF' | |
28 | 28 | : enable == 'MQTT' |
29 | - ? '#ed6f6f' | |
29 | + ? '#7C7CC9' | |
30 | 30 | : enable == 'RabbitMq' |
31 | - ? '#efbd47' | |
32 | - : '#55d187'; | |
31 | + ? '#E8A15E' | |
32 | + : '#81B1AB'; | |
33 | 33 | const text = |
34 | 34 | enable == 'KafKa' |
35 | 35 | ? 'KafKa' |
... | ... | @@ -58,14 +58,14 @@ export const columns: BasicColumn[] = [ |
58 | 58 | customRender: ({ record }) => { |
59 | 59 | const status = record.status; |
60 | 60 | const enable = ~~status === 1; |
61 | - const color = enable ? '#55d187' : '#efbd47'; | |
61 | + const color = enable ? '#2aae67' : '#eb846f'; | |
62 | 62 | const text = enable ? '启用' : '禁用'; |
63 | 63 | return h(Tag, { color: color }, () => text); |
64 | 64 | }, |
65 | 65 | }, |
66 | 66 | { |
67 | 67 | title: '描述', |
68 | - dataIndex: 'configuration.description', | |
68 | + dataIndex: 'remark', | |
69 | 69 | width: 200, |
70 | 70 | }, |
71 | 71 | { |
... | ... | @@ -80,7 +80,7 @@ export const searchFormSchema: FormSchema[] = [ |
80 | 80 | field: 'name', |
81 | 81 | label: '名称', |
82 | 82 | component: 'Input', |
83 | - colProps: { span: 8 }, | |
83 | + colProps: { span: 6 }, | |
84 | 84 | componentProps: { |
85 | 85 | maxLength: 36, |
86 | 86 | placeholder: '请输入名称', | ... | ... |
1 | 1 | import { FormSchema } from '/@/components/Form'; |
2 | 2 | import { findDictItemByCode } from '/@/api/system/dict'; |
3 | +import { isExistDataManagerNameApi } from '/@/api/datamanager/dataManagerApi'; | |
4 | +import { ref } from 'vue'; | |
5 | + | |
6 | +const typeValue = ref(''); | |
3 | 7 | |
4 | 8 | export enum CredentialsEnum { |
5 | 9 | IS_ANONYMOUS = 'anonymous', |
... | ... | @@ -23,13 +27,28 @@ export const modeForm: FormSchema[] = [ |
23 | 27 | colProps: { |
24 | 28 | span: 13, |
25 | 29 | }, |
30 | + componentProps({}) { | |
31 | + return { | |
32 | + api: findDictItemByCode, | |
33 | + params: { | |
34 | + dictCode: 'convert_data_to', | |
35 | + }, | |
36 | + labelField: 'itemText', | |
37 | + valueField: 'itemValue', | |
38 | + onChange(value) { | |
39 | + typeValue.value = value; | |
40 | + }, | |
41 | + }; | |
42 | + }, | |
43 | + }, | |
44 | + { | |
45 | + field: 'remark', | |
46 | + label: '描述', | |
47 | + colProps: { span: 13 }, | |
48 | + component: 'Input', | |
26 | 49 | componentProps: { |
27 | - api: findDictItemByCode, | |
28 | - params: { | |
29 | - dictCode: 'convert_data_to', | |
30 | - }, | |
31 | - labelField: 'itemText', | |
32 | - valueField: 'itemValue', | |
50 | + maxLength: 255, | |
51 | + placeholder: '请输入描述', | |
33 | 52 | }, |
34 | 53 | }, |
35 | 54 | ]; |
... | ... | @@ -95,6 +114,32 @@ export const modeKafkaForm: FormSchema[] = [ |
95 | 114 | maxLength: 255, |
96 | 115 | placeholder: '请输入名称', |
97 | 116 | }, |
117 | + dynamicRules: ({ values }) => { | |
118 | + return [ | |
119 | + { | |
120 | + required: true, | |
121 | + validator(_, value) { | |
122 | + return new Promise((resolve, reject) => { | |
123 | + if (value == '') { | |
124 | + reject('请输入名称'); | |
125 | + } else { | |
126 | + if (values.name != undefined) { | |
127 | + isExistDataManagerNameApi({ name: value, type: typeValue.value }).then((data) => { | |
128 | + if (data == true) { | |
129 | + reject('名称已存在'); | |
130 | + } else { | |
131 | + resolve(); | |
132 | + } | |
133 | + }); | |
134 | + } else { | |
135 | + resolve(); | |
136 | + } | |
137 | + } | |
138 | + }); | |
139 | + }, | |
140 | + }, | |
141 | + ]; | |
142 | + }, | |
98 | 143 | }, |
99 | 144 | { |
100 | 145 | field: 'topicPattern', |
... | ... | @@ -264,6 +309,32 @@ export const modeMqttForm: FormSchema[] = [ |
264 | 309 | maxLength: 255, |
265 | 310 | placeholder: '请输入名称', |
266 | 311 | }, |
312 | + dynamicRules: ({ values }) => { | |
313 | + return [ | |
314 | + { | |
315 | + required: true, | |
316 | + validator(_, value) { | |
317 | + return new Promise((resolve, reject) => { | |
318 | + if (value == '') { | |
319 | + reject('请输入名称'); | |
320 | + } else { | |
321 | + if (values.name != undefined) { | |
322 | + isExistDataManagerNameApi({ name: value, type: typeValue.value }).then((data) => { | |
323 | + if (data == true) { | |
324 | + reject('名称已存在'); | |
325 | + } else { | |
326 | + resolve(); | |
327 | + } | |
328 | + }); | |
329 | + } else { | |
330 | + resolve(); | |
331 | + } | |
332 | + } | |
333 | + }); | |
334 | + }, | |
335 | + }, | |
336 | + ]; | |
337 | + }, | |
267 | 338 | }, |
268 | 339 | { |
269 | 340 | field: 'topicPattern', |
... | ... | @@ -431,6 +502,32 @@ export const modeRabbitMqForm: FormSchema[] = [ |
431 | 502 | maxLength: 255, |
432 | 503 | placeholder: '请输入名称', |
433 | 504 | }, |
505 | + dynamicRules: ({ values }) => { | |
506 | + return [ | |
507 | + { | |
508 | + required: true, | |
509 | + validator(_, value) { | |
510 | + return new Promise((resolve, reject) => { | |
511 | + if (value == '') { | |
512 | + reject('请输入名称'); | |
513 | + } else { | |
514 | + if (values.name != undefined) { | |
515 | + isExistDataManagerNameApi({ name: value, type: typeValue.value }).then((data) => { | |
516 | + if (data == true) { | |
517 | + reject('名称已存在'); | |
518 | + } else { | |
519 | + resolve(); | |
520 | + } | |
521 | + }); | |
522 | + } else { | |
523 | + resolve(); | |
524 | + } | |
525 | + } | |
526 | + }); | |
527 | + }, | |
528 | + }, | |
529 | + ]; | |
530 | + }, | |
434 | 531 | }, |
435 | 532 | { |
436 | 533 | field: 'exchangeNamePattern', |
... | ... | @@ -586,6 +683,32 @@ export const modeApiForm: FormSchema[] = [ |
586 | 683 | maxLength: 255, |
587 | 684 | placeholder: '请输入名称', |
588 | 685 | }, |
686 | + dynamicRules: ({ values }) => { | |
687 | + return [ | |
688 | + { | |
689 | + required: true, | |
690 | + validator(_, value) { | |
691 | + return new Promise((resolve, reject) => { | |
692 | + if (value == '') { | |
693 | + reject('请输入名称'); | |
694 | + } else { | |
695 | + if (values.name != undefined) { | |
696 | + isExistDataManagerNameApi({ name: value, type: typeValue.value }).then((data) => { | |
697 | + if (data == true) { | |
698 | + reject('名称已存在'); | |
699 | + } else { | |
700 | + resolve(); | |
701 | + } | |
702 | + }); | |
703 | + } else { | |
704 | + resolve(); | |
705 | + } | |
706 | + } | |
707 | + }); | |
708 | + }, | |
709 | + }, | |
710 | + ]; | |
711 | + }, | |
589 | 712 | }, |
590 | 713 | { |
591 | 714 | field: 'restEndpointUrlPattern', | ... | ... |
... | ... | @@ -30,7 +30,7 @@ |
30 | 30 | width: 2.9vw; |
31 | 31 | height: 3.3vh; |
32 | 32 | background-color: #0960bd; |
33 | - border-radius: 1px; | |
33 | + border-radius: 2px; | |
34 | 34 | cursor: pointer; |
35 | 35 | text-align: center; |
36 | 36 | line-height: 3.1vh; |
... | ... | @@ -44,7 +44,7 @@ |
44 | 44 | height: 3.3vh; |
45 | 45 | margin-left: 1vw; |
46 | 46 | background-color: #ed6f6f; |
47 | - border-radius: 1px; | |
47 | + border-radius: 2px; | |
48 | 48 | cursor: pointer; |
49 | 49 | text-align: center; |
50 | 50 | line-height: 3.1vh; |
... | ... | @@ -59,60 +59,66 @@ |
59 | 59 | </template> |
60 | 60 | <template #uploadAdd1="{ field }"> |
61 | 61 | <span style="display: none">{{ field }}</span> |
62 | - <UploadDragger | |
63 | - v-model:fileList="fileList" | |
64 | - name="file" | |
65 | - :multiple="true" | |
66 | - action="https://www.mocky.io/v2/5cc8019d300000980a055e76" | |
67 | - @change="handleChange" | |
68 | - > | |
69 | - <p class="ant-upload-drag-icon"> | |
70 | - <InboxOutlined /> | |
71 | - </p> | |
72 | - <p class="ant-upload-text">Click or drag file to this area to upload</p> | |
73 | - <p class="ant-upload-hint"> | |
74 | - Support for a single or bulk upload. Strictly prohibit from uploading company data or | |
75 | - other band files | |
76 | - </p> | |
77 | - </UploadDragger> | |
62 | + <Upload> | |
63 | + <UploadDragger | |
64 | + v-model:fileList="fileList" | |
65 | + name="file" | |
66 | + :multiple="true" | |
67 | + action="https://www.mocky.io/v2/5cc8019d300000980a055e76" | |
68 | + @change="handleChange" | |
69 | + > | |
70 | + <p class="ant-upload-drag-icon"> | |
71 | + <InboxOutlined /> | |
72 | + </p> | |
73 | + <p class="ant-upload-text">Click or drag file to this area to upload</p> | |
74 | + <p class="ant-upload-hint"> | |
75 | + Support for a single or bulk upload. Strictly prohibit from uploading company data | |
76 | + or other band files | |
77 | + </p> | |
78 | + </UploadDragger> | |
79 | + </Upload> | |
78 | 80 | </template> |
79 | 81 | <template #uploadAdd2="{ field }"> |
80 | 82 | <span style="display: none">{{ field }}</span> |
81 | - <UploadDragger | |
82 | - v-model:fileList="fileList" | |
83 | - name="file" | |
84 | - :multiple="true" | |
85 | - action="https://www.mocky.io/v2/5cc8019d300000980a055e76" | |
86 | - @change="handleChange" | |
87 | - > | |
88 | - <p class="ant-upload-drag-icon"> | |
89 | - <InboxOutlined /> | |
90 | - </p> | |
91 | - <p class="ant-upload-text">Click or drag file to this area to upload</p> | |
92 | - <p class="ant-upload-hint"> | |
93 | - Support for a single or bulk upload. Strictly prohibit from uploading company data or | |
94 | - other band files | |
95 | - </p> | |
96 | - </UploadDragger> | |
83 | + <Upload> | |
84 | + <UploadDragger | |
85 | + v-model:fileList="fileList" | |
86 | + name="file" | |
87 | + :multiple="true" | |
88 | + action="https://www.mocky.io/v2/5cc8019d300000980a055e76" | |
89 | + @change="handleChange" | |
90 | + > | |
91 | + <p class="ant-upload-drag-icon"> | |
92 | + <InboxOutlined /> | |
93 | + </p> | |
94 | + <p class="ant-upload-text">Click or drag file to this area to upload</p> | |
95 | + <p class="ant-upload-hint"> | |
96 | + Support for a single or bulk upload. Strictly prohibit from uploading company data | |
97 | + or other band files | |
98 | + </p> | |
99 | + </UploadDragger> | |
100 | + </Upload> | |
97 | 101 | </template> |
98 | 102 | <template #uploadAdd3="{ field }"> |
99 | 103 | <span style="display: none">{{ field }}</span> |
100 | - <UploadDragger | |
101 | - v-model:fileList="fileList" | |
102 | - name="file" | |
103 | - :multiple="true" | |
104 | - action="https://www.mocky.io/v2/5cc8019d300000980a055e76" | |
105 | - @change="handleChange" | |
106 | - > | |
107 | - <p class="ant-upload-drag-icon"> | |
108 | - <InboxOutlined /> | |
109 | - </p> | |
110 | - <p class="ant-upload-text">Click or drag file to this area to upload</p> | |
111 | - <p class="ant-upload-hint"> | |
112 | - Support for a single or bulk upload. Strictly prohibit from uploading company data or | |
113 | - other band files | |
114 | - </p> | |
115 | - </UploadDragger> | |
104 | + <Upload> | |
105 | + <UploadDragger | |
106 | + v-model:fileList="fileList" | |
107 | + name="file" | |
108 | + :multiple="true" | |
109 | + action="https://www.mocky.io/v2/5cc8019d300000980a055e76" | |
110 | + @change="handleChange" | |
111 | + > | |
112 | + <p class="ant-upload-drag-icon"> | |
113 | + <InboxOutlined /> | |
114 | + </p> | |
115 | + <p class="ant-upload-text">Click or drag file to this area to upload</p> | |
116 | + <p class="ant-upload-hint"> | |
117 | + Support for a single or bulk upload. Strictly prohibit from uploading company data | |
118 | + or other band files | |
119 | + </p> | |
120 | + </UploadDragger> | |
121 | + </Upload> | |
116 | 122 | </template> |
117 | 123 | </BasicForm> |
118 | 124 | </div> |
... | ... | @@ -136,8 +142,8 @@ |
136 | 142 | [Descriptions.name]: Descriptions, |
137 | 143 | [Descriptions.Item.name]: Descriptions.Item, |
138 | 144 | InboxOutlined, |
139 | - | |
140 | - [Upload.UploadDragger]: Upload.UploadDragger, | |
145 | + Upload: Upload, | |
146 | + UploadDragger: Upload.UploadDragger, | |
141 | 147 | }, |
142 | 148 | emits: ['next', 'prev', 'register'], |
143 | 149 | setup(_, { emit }) { |
... | ... | @@ -280,7 +286,7 @@ |
280 | 286 | position: absolute; |
281 | 287 | right: 1vw; |
282 | 288 | background-color: #0960bd; |
283 | - border-radius: 1px; | |
289 | + border-radius: 2px; | |
284 | 290 | span { |
285 | 291 | color: white; |
286 | 292 | } | ... | ... |
... | ... | @@ -32,7 +32,7 @@ |
32 | 32 | width: 2.9vw; |
33 | 33 | height: 3.3vh; |
34 | 34 | background-color: #0960bd; |
35 | - border-radius: 1px; | |
35 | + border-radius: 2px; | |
36 | 36 | cursor: pointer; |
37 | 37 | text-align: center; |
38 | 38 | line-height: 3.1vh; |
... | ... | @@ -46,7 +46,7 @@ |
46 | 46 | height: 3.3vh; |
47 | 47 | margin-left: 1vw; |
48 | 48 | background-color: #ed6f6f; |
49 | - border-radius: 1px; | |
49 | + border-radius: 2px; | |
50 | 50 | cursor: pointer; |
51 | 51 | text-align: center; |
52 | 52 | line-height: 3.1vh; |
... | ... | @@ -67,7 +67,7 @@ |
67 | 67 | margin-left: 22vw; |
68 | 68 | margin-top: 2vh; |
69 | 69 | background-color: #0960bd; |
70 | - border-radius: 1px; | |
70 | + border-radius: 2px; | |
71 | 71 | cursor: pointer; |
72 | 72 | text-align: center; |
73 | 73 | line-height: 3.1vh; | ... | ... |
... | ... | @@ -4,60 +4,66 @@ |
4 | 4 | <BasicForm :showSubmitButton="false" @register="register"> |
5 | 5 | <template #uploadAdd1="{ field }"> |
6 | 6 | <span style="display: none">{{ field }}</span> |
7 | - <UploadDragger | |
8 | - v-model:fileList="fileList" | |
9 | - name="file" | |
10 | - :multiple="true" | |
11 | - action="https://www.mocky.io/v2/5cc8019d300000980a055e76" | |
12 | - @change="handleChange" | |
13 | - > | |
14 | - <p class="ant-upload-drag-icon"> | |
15 | - <InboxOutlined /> | |
16 | - </p> | |
17 | - <p class="ant-upload-text">Click or drag file to this area to upload</p> | |
18 | - <p class="ant-upload-hint"> | |
19 | - Support for a single or bulk upload. Strictly prohibit from uploading company data or | |
20 | - other band files | |
21 | - </p> | |
22 | - </UploadDragger> | |
7 | + <Upload> | |
8 | + <UploadDragger | |
9 | + v-model:fileList="fileList" | |
10 | + name="file" | |
11 | + :multiple="true" | |
12 | + action="https://www.mocky.io/v2/5cc8019d300000980a055e76" | |
13 | + @change="handleChange" | |
14 | + > | |
15 | + <p class="ant-upload-drag-icon"> | |
16 | + <InboxOutlined /> | |
17 | + </p> | |
18 | + <p class="ant-upload-text">Click or drag file to this area to upload</p> | |
19 | + <p class="ant-upload-hint"> | |
20 | + Support for a single or bulk upload. Strictly prohibit from uploading company data | |
21 | + or other band files | |
22 | + </p> | |
23 | + </UploadDragger> | |
24 | + </Upload> | |
23 | 25 | </template> |
24 | 26 | <template #uploadAdd2="{ field }"> |
25 | 27 | <span style="display: none">{{ field }}</span> |
26 | - <UploadDragger | |
27 | - v-model:fileList="fileList" | |
28 | - name="file" | |
29 | - :multiple="true" | |
30 | - action="https://www.mocky.io/v2/5cc8019d300000980a055e76" | |
31 | - @change="handleChange" | |
32 | - > | |
33 | - <p class="ant-upload-drag-icon"> | |
34 | - <InboxOutlined /> | |
35 | - </p> | |
36 | - <p class="ant-upload-text">Click or drag file to this area to upload</p> | |
37 | - <p class="ant-upload-hint"> | |
38 | - Support for a single or bulk upload. Strictly prohibit from uploading company data or | |
39 | - other band files | |
40 | - </p> | |
41 | - </UploadDragger> | |
28 | + <Upload> | |
29 | + <UploadDragger | |
30 | + v-model:fileList="fileList" | |
31 | + name="file" | |
32 | + :multiple="true" | |
33 | + action="https://www.mocky.io/v2/5cc8019d300000980a055e76" | |
34 | + @change="handleChange" | |
35 | + > | |
36 | + <p class="ant-upload-drag-icon"> | |
37 | + <InboxOutlined /> | |
38 | + </p> | |
39 | + <p class="ant-upload-text">Click or drag file to this area to upload</p> | |
40 | + <p class="ant-upload-hint"> | |
41 | + Support for a single or bulk upload. Strictly prohibit from uploading company data | |
42 | + or other band files | |
43 | + </p> | |
44 | + </UploadDragger> | |
45 | + </Upload> | |
42 | 46 | </template> |
43 | 47 | <template #uploadAdd3="{ field }"> |
44 | 48 | <span style="display: none">{{ field }}</span> |
45 | - <UploadDragger | |
46 | - v-model:fileList="fileList" | |
47 | - name="file" | |
48 | - :multiple="true" | |
49 | - action="https://www.mocky.io/v2/5cc8019d300000980a055e76" | |
50 | - @change="handleChange" | |
51 | - > | |
52 | - <p class="ant-upload-drag-icon"> | |
53 | - <InboxOutlined /> | |
54 | - </p> | |
55 | - <p class="ant-upload-text">Click or drag file to this area to upload</p> | |
56 | - <p class="ant-upload-hint"> | |
57 | - Support for a single or bulk upload. Strictly prohibit from uploading company data or | |
58 | - other band files | |
59 | - </p> | |
60 | - </UploadDragger> | |
49 | + <Upload> | |
50 | + <UploadDragger | |
51 | + v-model:fileList="fileList" | |
52 | + name="file" | |
53 | + :multiple="true" | |
54 | + action="https://www.mocky.io/v2/5cc8019d300000980a055e76" | |
55 | + @change="handleChange" | |
56 | + > | |
57 | + <p class="ant-upload-drag-icon"> | |
58 | + <InboxOutlined /> | |
59 | + </p> | |
60 | + <p class="ant-upload-text">Click or drag file to this area to upload</p> | |
61 | + <p class="ant-upload-hint"> | |
62 | + Support for a single or bulk upload. Strictly prohibit from uploading company data | |
63 | + or other band files | |
64 | + </p> | |
65 | + </UploadDragger> | |
66 | + </Upload> | |
61 | 67 | </template> |
62 | 68 | </BasicForm> |
63 | 69 | </div> |
... | ... | @@ -78,8 +84,8 @@ |
78 | 84 | [Descriptions.name]: Descriptions, |
79 | 85 | [Descriptions.Item.name]: Descriptions.Item, |
80 | 86 | InboxOutlined, |
81 | - | |
82 | - [Upload.UploadDragger]: Upload.UploadDragger, | |
87 | + Upload: Upload, | |
88 | + UploadDragger: Upload.UploadDragger, | |
83 | 89 | }, |
84 | 90 | emits: ['next', 'prev', 'register'], |
85 | 91 | setup(_, { emit }) { |
... | ... | @@ -161,7 +167,7 @@ |
161 | 167 | position: absolute; |
162 | 168 | right: 1vw; |
163 | 169 | background-color: #0960bd; |
164 | - border-radius: 1px; | |
170 | + border-radius: 2px; | |
165 | 171 | span { |
166 | 172 | color: white; |
167 | 173 | } | ... | ... |
... | ... | @@ -11,26 +11,23 @@ |
11 | 11 | <a-button |
12 | 12 | :disabled="disabledStatus1" |
13 | 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 | 17 | </a-button> |
19 | 18 | <a-button |
20 | 19 | :disabled="disabledStatus2" |
21 | 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 | 24 | </a-button> |
27 | 25 | <a-button |
28 | 26 | :disabled="disabledStatus3" |
29 | 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 | 31 | </a-button> |
35 | 32 | </template> |
36 | 33 | <template #action="{ record }"> |
... | ... | @@ -71,8 +68,7 @@ |
71 | 68 | }, |
72 | 69 | { |
73 | 70 | label: '禁用', |
74 | - icon: 'ant-design:close-outlined', | |
75 | - color: 'warning', | |
71 | + icon: 'ant-design:close-circle-outlined', | |
76 | 72 | popConfirm: { |
77 | 73 | title: '是否禁用?', |
78 | 74 | confirm: handleDisable.bind(null, record), |
... | ... | @@ -168,9 +164,9 @@ |
168 | 164 | }; |
169 | 165 | |
170 | 166 | const handleEnableOrDisable = async (record: Recordable) => { |
167 | + setLoading(true); | |
168 | + enableObj.convertIds.length = 0; | |
171 | 169 | try { |
172 | - setLoading(true); | |
173 | - enableObj.convertIds.length = 0; | |
174 | 170 | enableObj.status = record.status; |
175 | 171 | enableObj.convertIds.push(record.id as never); |
176 | 172 | if (enableObj.status == 0) { |
... | ... | @@ -191,9 +187,9 @@ |
191 | 187 | } |
192 | 188 | }; |
193 | 189 | const handleDisable = async (record: Recordable) => { |
190 | + setLoading(true); | |
191 | + enableObj.convertIds.length = 0; | |
194 | 192 | try { |
195 | - setLoading(true); | |
196 | - enableObj.convertIds.length = 0; | |
197 | 193 | enableObj.status = record.status; |
198 | 194 | enableObj.convertIds.push(record.id as never); |
199 | 195 | if (enableObj.status == 1) { |
... | ... | @@ -228,6 +224,11 @@ |
228 | 224 | const hasDisableStatus = isJudgeSelectRowsArr.value.map((m) => { |
229 | 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 | 232 | hasDisableStatus.every((e) => { |
232 | 233 | if (e == 1) { |
233 | 234 | disabledStatus3.value = true; |
... | ... | @@ -251,12 +252,25 @@ |
251 | 252 | }; |
252 | 253 | |
253 | 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 | 272 | const handleMutiuteDisable = async () => { |
273 | + enableObj.convertIds.length = 0; | |
260 | 274 | try { |
261 | 275 | setLoading(true); |
262 | 276 | getSelectRowsArr.value = getSelectRows(); |
... | ... | @@ -283,6 +297,7 @@ |
283 | 297 | }; |
284 | 298 | |
285 | 299 | const handleMutiuteEnable = async () => { |
300 | + enableObj.convertIds.length = 0; | |
286 | 301 | try { |
287 | 302 | setLoading(true); |
288 | 303 | getSelectRowsArr.value = getSelectRows(); | ... | ... |
... | ... | @@ -125,6 +125,7 @@ |
125 | 125 | current.value = 0; |
126 | 126 | isStatus.value = !data.isUpdate; |
127 | 127 | //清空第一步数据 |
128 | + proxy.$refs.DeviceProfileStep1Ref.resetIconFunc(); | |
128 | 129 | proxy.$refs.DeviceProfileStep1Ref.customResetStepOneFunc(); |
129 | 130 | proxy.$refs.DeviceProfileStep3Ref.clearAllRegisterFormFunc(); |
130 | 131 | //报警详细信息 | ... | ... |
... | ... | @@ -12,7 +12,9 @@ |
12 | 12 | <ImpExcel @success="loadDataSuccess" dateFormat="YYYY-MM-DD"> |
13 | 13 | <a-button @click="handleImport"> 导入设备配置 </a-button> |
14 | 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 | 18 | </template> |
17 | 19 | <template #action="{ record }"> |
18 | 20 | <TableAction |
... | ... | @@ -75,10 +77,11 @@ |
75 | 77 | let selectedRowKeys: string[] = reactive([]); |
76 | 78 | const getPathUrl = ref(''); |
77 | 79 | const getPathUrlName = ref(''); |
80 | + const disabled = ref(true); | |
78 | 81 | |
79 | 82 | const { createMessage } = useMessage(); |
80 | 83 | const [registerModal, { openModal }] = useModal(); |
81 | - const [registerModalDetail, { openModal: openModalDetail }] = useModal(); | |
84 | + const [registerModalDetail] = useModal(); | |
82 | 85 | const [registerTable, { reload, getSelectRowKeys }] = useTable({ |
83 | 86 | title: '设备配置列表', |
84 | 87 | pagination: true, |
... | ... | @@ -179,6 +182,11 @@ |
179 | 182 | } |
180 | 183 | const useSelectionChange = () => { |
181 | 184 | selectedRowKeys = getSelectRowKeys(); |
185 | + if (selectedRowKeys.length > 0) { | |
186 | + disabled.value = false; | |
187 | + } else { | |
188 | + disabled.value = true; | |
189 | + } | |
182 | 190 | }; |
183 | 191 | async function handleTableDel() { |
184 | 192 | await deviceConfigDelete(selectedRowKeys); |
... | ... | @@ -219,6 +227,7 @@ |
219 | 227 | reload(); |
220 | 228 | } |
221 | 229 | return { |
230 | + disabled, | |
222 | 231 | deviceDetailRef, |
223 | 232 | setRowClassName, |
224 | 233 | registerModalDetail, | ... | ... |
1 | 1 | <template> |
2 | 2 | <div class="step1"> |
3 | 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 | 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 | 29 | </div> |
48 | 30 | </div> |
49 | 31 | </div> |
... | ... | @@ -173,8 +155,8 @@ |
173 | 155 | :deep .ant-upload-select-picture-card { |
174 | 156 | display: inherit; |
175 | 157 | float: none; |
176 | - width: 8.6vw; | |
177 | - height: 17vh; | |
158 | + width: 4.9vw; | |
159 | + height: 9.5vh; | |
178 | 160 | margin-right: 8px; |
179 | 161 | text-align: center; |
180 | 162 | vertical-align: top; | ... | ... |
... | ... | @@ -9,6 +9,12 @@ import { alarmContactGetPage } from '/@/api/device/deviceConfigApi'; |
9 | 9 | export const step1Schemas: FormSchema[] = [ |
10 | 10 | { |
11 | 11 | field: 'name', |
12 | + label: '上传图片', | |
13 | + component: 'Input', | |
14 | + slot: 'imageSelect', | |
15 | + }, | |
16 | + { | |
17 | + field: 'name', | |
12 | 18 | label: '配置名称', |
13 | 19 | required: true, |
14 | 20 | component: 'Input', | ... | ... |
... | ... | @@ -21,7 +21,7 @@ |
21 | 21 | |
22 | 22 | export default defineComponent({ |
23 | 23 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, |
24 | - props: ['deviceInfo1', 'editconditionFather', 'newConditionMapFather'], | |
24 | + props: ['deviceInfo1', 'editConditionFather', 'newConditionMapFather'], | |
25 | 25 | |
26 | 26 | setup(props) { |
27 | 27 | const fieldValue: any = ref({}); |
... | ... | @@ -56,9 +56,9 @@ |
56 | 56 | |
57 | 57 | //回显数据 |
58 | 58 | const setFieldsFormValueFun = () => { |
59 | - if (props.editconditionFather !== 1) { | |
59 | + if (props.editConditionFather !== 1) { | |
60 | 60 | setTimeout(() => { |
61 | - setFieldsValue(props.editconditionFather); | |
61 | + setFieldsValue(props.editConditionFather); | |
62 | 62 | }, 100); |
63 | 63 | } |
64 | 64 | }; | ... | ... |
... | ... | @@ -210,7 +210,7 @@ export const searchFormSchema: FormSchema[] = [ |
210 | 210 | { |
211 | 211 | field: 'organizationId', |
212 | 212 | label: '所属组织', |
213 | - colProps: { span: 8 }, | |
213 | + colProps: { span: 6 }, | |
214 | 214 | component: 'ApiTreeSelect', |
215 | 215 | componentProps: { |
216 | 216 | api: async () => { |
... | ... | @@ -224,7 +224,7 @@ export const searchFormSchema: FormSchema[] = [ |
224 | 224 | field: 'name', |
225 | 225 | label: '名称', |
226 | 226 | component: 'Input', |
227 | - colProps: { span: 8 }, | |
227 | + colProps: { span: 6 }, | |
228 | 228 | componentProps: { |
229 | 229 | maxLength: 36, |
230 | 230 | placeholder: '请输入名称', |
... | ... | @@ -254,7 +254,7 @@ export const searchFormSchema: FormSchema[] = [ |
254 | 254 | { label: '未启用', value: '0' }, |
255 | 255 | ], |
256 | 256 | }, |
257 | - colProps: { span: 4 }, | |
257 | + colProps: { span: 6 }, | |
258 | 258 | }, |
259 | 259 | ]; |
260 | 260 | |
... | ... | @@ -716,3 +716,104 @@ export const useActionDrawerSchema: FormSchema[] = [ |
716 | 716 | slot: 'add', |
717 | 717 | }, |
718 | 718 | ]; |
719 | + | |
720 | +export const mockData = { | |
721 | + id: 'f90f3cc9-e6ab-41cd-86b8-bb3a8f71ae28', | |
722 | + creator: 'b75f1c80-0f94-4a06-84ef-253962bbfe9e', | |
723 | + createTime: '2022-02-21 15:03:44', | |
724 | + name: '测试3', | |
725 | + enabled: false, | |
726 | + description: '测试3', | |
727 | + tenantId: 'de10f9e0-8892-11ec-ac19-e398562c8b61', | |
728 | + organizationId: '0454b838-411b-425b-81c1-7cdcf9ef4816', | |
729 | + triggers: [ | |
730 | + { | |
731 | + enabled: false, | |
732 | + tenantId: 'de10f9e0-8892-11ec-ac19-e398562c8b61', | |
733 | + deviceId: '38bbb9e6-7769-4c32-ad4d-f81df4e37044', | |
734 | + triggerEvent: 'DEVICE_ACT', | |
735 | + sceneLinkageId: 'f90f3cc9-e6ab-41cd-86b8-bb3a8f71ae28', | |
736 | + }, | |
737 | + { | |
738 | + enabled: false, | |
739 | + tenantId: 'de10f9e0-8892-11ec-ac19-e398562c8b61', | |
740 | + deviceId: '242ffd69-fea8-4929-8815-9bd6f6b6d8bd', | |
741 | + triggerEvent: 'DEVICE_ACT', | |
742 | + sceneLinkageId: 'f90f3cc9-e6ab-41cd-86b8-bb3a8f71ae28', | |
743 | + }, | |
744 | + { | |
745 | + enabled: false, | |
746 | + tenantId: 'de10f9e0-8892-11ec-ac19-e398562c8b61', | |
747 | + deviceId: 'ddb672d8-32ed-4f62-9a97-95af3d7a3c35', | |
748 | + triggerEvent: 'DEVICE_ACT', | |
749 | + sceneLinkageId: 'f90f3cc9-e6ab-41cd-86b8-bb3a8f71ae28', | |
750 | + }, | |
751 | + { | |
752 | + enabled: false, | |
753 | + tenantId: 'de10f9e0-8892-11ec-ac19-e398562c8b61', | |
754 | + deviceId: 'ee10b318-1bb9-4e78-997b-726b184cc6be', | |
755 | + triggerEvent: 'DEVICE_ACT', | |
756 | + sceneLinkageId: 'f90f3cc9-e6ab-41cd-86b8-bb3a8f71ae28', | |
757 | + }, | |
758 | + ], | |
759 | + doActions: [ | |
760 | + { | |
761 | + enabled: false, | |
762 | + tenantId: 'de10f9e0-8892-11ec-ac19-e398562c8b61', | |
763 | + deviceId: '38bbb9e6-7769-4c32-ad4d-f81df4e37044', | |
764 | + outTarget: 'DEVICE_OUT', | |
765 | + sceneLinkageId: 'f90f3cc9-e6ab-41cd-86b8-bb3a8f71ae28', | |
766 | + }, | |
767 | + { | |
768 | + enabled: false, | |
769 | + tenantId: 'de10f9e0-8892-11ec-ac19-e398562c8b61', | |
770 | + deviceId: '242ffd69-fea8-4929-8815-9bd6f6b6d8bd', | |
771 | + outTarget: 'DEVICE_OUT', | |
772 | + sceneLinkageId: 'f90f3cc9-e6ab-41cd-86b8-bb3a8f71ae28', | |
773 | + }, | |
774 | + { | |
775 | + enabled: false, | |
776 | + tenantId: 'de10f9e0-8892-11ec-ac19-e398562c8b61', | |
777 | + deviceId: 'ddb672d8-32ed-4f62-9a97-95af3d7a3c35', | |
778 | + outTarget: 'DEVICE_OUT', | |
779 | + sceneLinkageId: 'f90f3cc9-e6ab-41cd-86b8-bb3a8f71ae28', | |
780 | + }, | |
781 | + { | |
782 | + enabled: false, | |
783 | + tenantId: 'de10f9e0-8892-11ec-ac19-e398562c8b61', | |
784 | + deviceId: 'ee10b318-1bb9-4e78-997b-726b184cc6be', | |
785 | + outTarget: 'DEVICE_OUT', | |
786 | + sceneLinkageId: 'f90f3cc9-e6ab-41cd-86b8-bb3a8f71ae28', | |
787 | + }, | |
788 | + ], | |
789 | + doConditions: [ | |
790 | + { | |
791 | + enabled: false, | |
792 | + tenantId: 'de10f9e0-8892-11ec-ac19-e398562c8b61', | |
793 | + deviceId: '38bbb9e6-7769-4c32-ad4d-f81df4e37044', | |
794 | + status: 'DEVICE_STATUS', | |
795 | + sceneLinkageId: 'f90f3cc9-e6ab-41cd-86b8-bb3a8f71ae28', | |
796 | + }, | |
797 | + { | |
798 | + enabled: false, | |
799 | + tenantId: 'de10f9e0-8892-11ec-ac19-e398562c8b61', | |
800 | + deviceId: '242ffd69-fea8-4929-8815-9bd6f6b6d8bd', | |
801 | + status: 'DEVICE_STATUS', | |
802 | + sceneLinkageId: 'f90f3cc9-e6ab-41cd-86b8-bb3a8f71ae28', | |
803 | + }, | |
804 | + { | |
805 | + enabled: false, | |
806 | + tenantId: 'de10f9e0-8892-11ec-ac19-e398562c8b61', | |
807 | + deviceId: 'ddb672d8-32ed-4f62-9a97-95af3d7a3c35', | |
808 | + status: 'DEVICE_STATUS', | |
809 | + sceneLinkageId: 'f90f3cc9-e6ab-41cd-86b8-bb3a8f71ae28', | |
810 | + }, | |
811 | + { | |
812 | + enabled: false, | |
813 | + tenantId: 'de10f9e0-8892-11ec-ac19-e398562c8b61', | |
814 | + deviceId: 'ee10b318-1bb9-4e78-997b-726b184cc6be', | |
815 | + status: 'DEVICE_STATUS', | |
816 | + sceneLinkageId: 'f90f3cc9-e6ab-41cd-86b8-bb3a8f71ae28', | |
817 | + }, | |
818 | + ], | |
819 | +}; | ... | ... |
... | ... | @@ -33,7 +33,6 @@ |
33 | 33 | </template> |
34 | 34 | </BasicTable> |
35 | 35 | <SceneLinkAgeDrawer |
36 | - :getChildrenData="echoEditData" | |
37 | 36 | @register="registerDrawer" |
38 | 37 | @success="handleSuccess" |
39 | 38 | ref="sceneLinkAgeDrawerRef" |
... | ... | @@ -41,7 +40,7 @@ |
41 | 40 | </div> |
42 | 41 | </template> |
43 | 42 | <script lang="ts"> |
44 | - import { defineComponent, reactive, getCurrentInstance, ref } from 'vue'; | |
43 | + import { defineComponent, getCurrentInstance, ref } from 'vue'; | |
45 | 44 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
46 | 45 | import { useDrawer } from '/@/components/Drawer'; |
47 | 46 | import SceneLinkAgeDrawer from './useDrawer.vue'; |
... | ... | @@ -62,7 +61,6 @@ |
62 | 61 | handleSuccess |
63 | 62 | ); |
64 | 63 | let selectedRowKeys: Array<string> = []; |
65 | - let echoEditData = reactive({}); | |
66 | 64 | const [registerDrawer, { openDrawer }] = useDrawer(); |
67 | 65 | const { createMessage } = useMessage(); |
68 | 66 | const [registerTable, { reload, getSelectRowKeys }] = useTable({ |
... | ... | @@ -88,21 +86,18 @@ |
88 | 86 | }); |
89 | 87 | |
90 | 88 | function handleAdd() { |
89 | + openDrawer(true, { | |
90 | + isUpdate: false, | |
91 | + }); | |
91 | 92 | try { |
92 | - proxy.$refs.sceneLinkAgeDrawerRef.clearAllArrayFunc(); | |
93 | 93 | setTimeout(() => { |
94 | 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(); | |
95 | + proxy.$refs.sceneLinkAgeDrawerRef.defaultAddCondition(); | |
96 | + proxy.$refs.sceneLinkAgeDrawerRef.defaultAddAction(); | |
97 | + }, 100); | |
100 | 98 | } catch (e) { |
101 | 99 | return e; |
102 | 100 | } |
103 | - openDrawer(true, { | |
104 | - isUpdate: false, | |
105 | - }); | |
106 | 101 | } |
107 | 102 | |
108 | 103 | const useSelectionChange = () => { |
... | ... | @@ -120,7 +115,6 @@ |
120 | 115 | record, |
121 | 116 | isUpdate: true, |
122 | 117 | }); |
123 | - echoEditData = record; | |
124 | 118 | } |
125 | 119 | async function handleDelete(record: Recordable) { |
126 | 120 | try { |
... | ... | @@ -138,7 +132,6 @@ |
138 | 132 | return { |
139 | 133 | sceneLinkAgeDrawerRef, |
140 | 134 | useSelectionChange, |
141 | - echoEditData, | |
142 | 135 | registerTable, |
143 | 136 | registerDrawer, |
144 | 137 | handleAdd, | ... | ... |
1 | 1 | <template> |
2 | - <BasicDrawer | |
3 | - v-bind="$attrs" | |
4 | - @register="registerDrawer" | |
5 | - showFooter | |
6 | - :title="getTitle" | |
7 | - width="1000px" | |
8 | - @ok="handleSubmit" | |
9 | - > | |
10 | - <div> | |
11 | - <BasicForm @register="registerForm" /> | |
12 | - <!-- 触发器 --> | |
2 | + <div> | |
3 | + <BasicDrawer | |
4 | + v-bind="$attrs" | |
5 | + @register="registerDrawer" | |
6 | + showFooter | |
7 | + :title="getTitle" | |
8 | + width="1000px" | |
9 | + @ok="handleSubmit" | |
10 | + @close="handleCancel" | |
11 | + > | |
13 | 12 | <div> |
14 | - <template | |
15 | - v-for="(item, index) in isUpdate == false ? addTriggerPushData : editTriggerPushData" | |
16 | - :key="index" | |
17 | - > | |
18 | - <span style="display: none">{{ item + index }}</span> | |
19 | - <span style="position: relative; top: 3.2vh; left: 0.3vw">触发器 {{ index + 1 }}</span> | |
20 | - <div style="display: block"> | |
21 | - <AddTriggerForm | |
22 | - :editTriggerFather="isUpdate == false ? 1 : item" | |
23 | - :newFilterMapFather="isUpdate == false ? 1 : newFilterMap" | |
24 | - :deviceInfo="getDeviceInfo" | |
25 | - ref="refTriggerChild" | |
26 | - /> | |
27 | - </div> | |
28 | - <div style="height: 3vh"></div> | |
29 | - </template> | |
30 | - <div | |
31 | - style=" | |
32 | - display: flex; | |
33 | - width: 11vw; | |
34 | - height: 4vh; | |
35 | - flex-direction: row; | |
36 | - justify-content: space-between; | |
37 | - " | |
38 | - > | |
39 | - <div style="display: flex; width: 4vw; height: 4vh"> | |
40 | - <Button type="primary" style="border-radius: 10px" class="mt-5" @click="addTrigger" | |
41 | - >新增触发器</Button | |
42 | - > | |
43 | - </div> | |
44 | - <div style="display: flex; width: 4vw; height: 4vh"> | |
45 | - <Button | |
46 | - v-if="addTriggerPushData.length != 0 || editTriggerPushData.length != 0" | |
47 | - type="default" | |
48 | - style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)" | |
49 | - class="mt-5" | |
50 | - @click="removeTrigger" | |
51 | - > | |
52 | - <span style="color: white">删除</span></Button | |
53 | - > | |
13 | + <BasicForm @register="registerForm" /> | |
14 | + <!-- 触发器 --> | |
15 | + <div> | |
16 | + <template | |
17 | + v-for="(item, index) in isUpdate == false ? addTriggerPushData : editTriggerPushData" | |
18 | + :key="index" | |
19 | + > | |
20 | + <span style="display: none">{{ item + index }}</span> | |
21 | + <span style="position: relative; top: 3.2vh; left: 0.3vw">触发器 {{ index + 1 }}</span> | |
22 | + <div style="display: block"> | |
23 | + <AddTriggerForm | |
24 | + :editTriggerFather="isUpdate == false ? 1 : item" | |
25 | + :newFilterMapFather="isUpdate == false ? 1 : newFilterMap" | |
26 | + :deviceInfo="getDeviceInfo" | |
27 | + ref="refTriggerChild" | |
28 | + /> | |
29 | + </div> | |
30 | + <div style="height: 3vh"></div> | |
31 | + </template> | |
32 | + <div | |
33 | + style=" | |
34 | + display: flex; | |
35 | + width: 11vw; | |
36 | + height: 4vh; | |
37 | + flex-direction: row; | |
38 | + justify-content: space-between; | |
39 | + " | |
40 | + > | |
41 | + <div style="display: flex; width: 4vw; height: 4vh"> | |
42 | + <Button type="primary" style="border-radius: 10px" class="mt-5" @click="addTrigger" | |
43 | + >新增触发器</Button | |
44 | + > | |
45 | + </div> | |
46 | + <div style="display: flex; width: 4vw; height: 4vh"> | |
47 | + <Button | |
48 | + v-if="addTriggerPushData.length != 0 || editTriggerPushData.length != 0" | |
49 | + type="default" | |
50 | + style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)" | |
51 | + class="mt-5" | |
52 | + @click="removeTrigger" | |
53 | + > | |
54 | + <span style="color: white">删除</span></Button | |
55 | + > | |
56 | + </div> | |
54 | 57 | </div> |
55 | 58 | </div> |
56 | - </div> | |
57 | - <div style="height: 5vh"></div> | |
58 | - <!-- 执行条件 --> | |
59 | - <div> | |
60 | - <template | |
61 | - v-for="(item, index) in isUpdate == false ? addConditionPushData : editConditionPushData" | |
62 | - :key="index" | |
63 | - > | |
64 | - <span style="display: none">{{ item + index }}</span> | |
65 | - <span style="position: relative; top: 3.2vh; left: 0.3vw">执行条件 {{ index + 1 }}</span> | |
66 | - | |
67 | - <div> | |
68 | - <AddConditiForm | |
69 | - :editConditionFather="isUpdate == false ? 1 : item" | |
70 | - :newConditionMapFather="isUpdate == false ? 1 : newConditionFilterMap" | |
71 | - :deviceInfo1="getDeviceInfo1" | |
72 | - ref="refConditionChild" | |
73 | - /> | |
74 | - </div> | |
75 | - <div style="height: 3vh"></div> | |
76 | - </template> | |
77 | - <div | |
78 | - style=" | |
79 | - display: flex; | |
80 | - width: 11vw; | |
81 | - height: 4vh; | |
82 | - flex-direction: row; | |
83 | - justify-content: space-between; | |
84 | - " | |
85 | - > | |
86 | - <div style="display: flex; width: 4vw; height: 4vh"> | |
87 | - <Button type="primary" style="border-radius: 10px" class="mt-5" @click="addCondition" | |
88 | - >新增执行条件</Button | |
89 | - > | |
90 | - </div> | |
91 | - <div style="display: flex; width: 4vw; height: 4vh"> | |
92 | - <Button | |
93 | - v-if="addConditionPushData.length != 0 || addConditionPushData.length != 0" | |
94 | - style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)" | |
95 | - type="default" | |
96 | - class="mt-5" | |
97 | - @click="removeCondition" | |
98 | - > | |
99 | - <span style="color: white">删除</span></Button | |
59 | + <div style="height: 5vh"></div> | |
60 | + <!-- 执行条件 --> | |
61 | + <div> | |
62 | + <template | |
63 | + v-for="(item, index) in isUpdate == false | |
64 | + ? addConditionPushData | |
65 | + : editConditionPushData" | |
66 | + :key="index" | |
67 | + > | |
68 | + <span style="display: none">{{ item + index }}</span> | |
69 | + <span style="position: relative; top: 3.2vh; left: 0.3vw" | |
70 | + >执行条件 {{ index + 1 }}</span | |
100 | 71 | > |
101 | - </div> | |
102 | - </div> | |
103 | - </div> | |
104 | - <!-- 执行动作 --> | |
105 | - <div style="height: 5vh"></div> | |
106 | - <div> | |
107 | - <template | |
108 | - v-for="(item, index) in isUpdate == false ? addActionPushData : editActionPushData" | |
109 | - :key="index" | |
110 | - > | |
111 | - <span style="display: none">{{ item + index }}</span> | |
112 | - <span style="position: relative; top: 4.2vh; left: 0.65vw">执行动作 {{ index + 1 }}</span> | |
113 | 72 | |
114 | - <div> | |
115 | - <AddActionForm | |
116 | - :editActionFather="isUpdate == false ? 1 : item" | |
117 | - :newActionMapFather="isUpdate == false ? 1 : newActionFilterMap" | |
118 | - :deviceInfo2="getDeviceInfo2" | |
119 | - ref="refActionChild" | |
120 | - /> | |
121 | - </div> | |
122 | - <div style="height: 3vh"></div> | |
123 | - </template> | |
124 | - <div | |
125 | - style=" | |
126 | - display: flex; | |
127 | - width: 11vw; | |
128 | - height: 4vh; | |
129 | - flex-direction: row; | |
130 | - justify-content: space-between; | |
131 | - " | |
132 | - > | |
133 | - <div style="display: flex; width: 4vw; height: 4vh"> | |
134 | - <Button type="primary" style="border-radius: 10px" class="mt-5" @click="addAction" | |
135 | - >新增执行动作</Button | |
136 | - > | |
73 | + <div> | |
74 | + <AddConditiForm | |
75 | + :editConditionFather="isUpdate == false ? 1 : item" | |
76 | + :newConditionMapFather="isUpdate == false ? 1 : newConditionFilterMap" | |
77 | + :deviceInfo1="getDeviceInfo1" | |
78 | + ref="refConditionChild" | |
79 | + /> | |
80 | + </div> | |
81 | + <div style="height: 3vh"></div> | |
82 | + </template> | |
83 | + <div | |
84 | + style=" | |
85 | + display: flex; | |
86 | + width: 11vw; | |
87 | + height: 4vh; | |
88 | + flex-direction: row; | |
89 | + justify-content: space-between; | |
90 | + " | |
91 | + > | |
92 | + <div style="display: flex; width: 4vw; height: 4vh"> | |
93 | + <Button type="primary" style="border-radius: 10px" class="mt-5" @click="addCondition" | |
94 | + >新增执行条件</Button | |
95 | + > | |
96 | + </div> | |
97 | + <div style="display: flex; width: 4vw; height: 4vh"> | |
98 | + <Button | |
99 | + v-if="addConditionPushData.length != 0 || editConditionPushData.length != 0" | |
100 | + style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)" | |
101 | + type="default" | |
102 | + class="mt-5" | |
103 | + @click="removeCondition" | |
104 | + > | |
105 | + <span style="color: white">删除</span></Button | |
106 | + > | |
107 | + </div> | |
137 | 108 | </div> |
138 | - <div style="display: flex; width: 4vw; height: 4vh"> | |
139 | - <Button | |
140 | - v-if="addActionPushData.length > 0 || addActionPushData.length > 0" | |
141 | - style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)" | |
142 | - type="default" | |
143 | - class="mt-5" | |
144 | - @click="removeAction" | |
145 | - > | |
146 | - <span style="color: white">删除</span></Button | |
109 | + </div> | |
110 | + <!-- 执行动作 --> | |
111 | + <div style="height: 5vh"></div> | |
112 | + <div> | |
113 | + <template | |
114 | + v-for="(item, index) in isUpdate == false ? addActionPushData : editActionPushData" | |
115 | + :key="index" | |
116 | + > | |
117 | + <span style="display: none">{{ item + index }}</span> | |
118 | + <span style="position: relative; top: 4.2vh; left: 0.65vw" | |
119 | + >执行动作 {{ index + 1 }}</span | |
147 | 120 | > |
121 | + | |
122 | + <div> | |
123 | + <AddActionForm | |
124 | + :editActionFather="isUpdate == false ? 1 : item" | |
125 | + :newActionMapFather="isUpdate == false ? 1 : newActionFilterMap" | |
126 | + :deviceInfo2="getDeviceInfo2" | |
127 | + ref="refActionChild" | |
128 | + /> | |
129 | + </div> | |
130 | + <div style="height: 3vh"></div> | |
131 | + </template> | |
132 | + <div | |
133 | + style=" | |
134 | + display: flex; | |
135 | + width: 11vw; | |
136 | + height: 4vh; | |
137 | + flex-direction: row; | |
138 | + justify-content: space-between; | |
139 | + " | |
140 | + > | |
141 | + <div style="display: flex; width: 4vw; height: 4vh"> | |
142 | + <Button type="primary" style="border-radius: 10px" class="mt-5" @click="addAction" | |
143 | + >新增执行动作</Button | |
144 | + > | |
145 | + </div> | |
146 | + <div style="display: flex; width: 4vw; height: 4vh"> | |
147 | + <Button | |
148 | + v-if="addActionPushData.length != 0 || editActionPushData.length != 0" | |
149 | + style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)" | |
150 | + type="default" | |
151 | + class="mt-5" | |
152 | + @click="removeAction" | |
153 | + > | |
154 | + <span style="color: white">删除</span></Button | |
155 | + > | |
156 | + </div> | |
148 | 157 | </div> |
158 | + <div style="height: 5vh"></div> | |
149 | 159 | </div> |
150 | - <div style="height: 5vh"></div> | |
151 | 160 | </div> |
152 | - </div> | |
153 | - </BasicDrawer> | |
161 | + </BasicDrawer> | |
162 | + </div> | |
154 | 163 | </template> |
155 | 164 | <script lang="ts"> |
156 | 165 | import { defineComponent, ref, computed, unref, reactive, getCurrentInstance, watch } from 'vue'; |
157 | 166 | import { BasicForm, useForm } from '/@/components/Form'; |
158 | - import { formSchema, getData } from './config'; | |
167 | + import { formSchema, getData, mockData } from './config'; | |
159 | 168 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
160 | 169 | import { |
161 | 170 | screenLinkPageAddApi, |
... | ... | @@ -254,50 +263,31 @@ |
254 | 263 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { |
255 | 264 | await resetFields(); |
256 | 265 | setDrawerProps({ confirmLoading: false }); |
257 | - isUpdate.value = !!data?.isUpdate; | |
258 | - if (!unref(isUpdate)) { | |
259 | - editTriggerPushData.value = []; | |
260 | - editTriggerPushData.value.length = 0; | |
261 | - try { | |
262 | - setTimeout(() => { | |
263 | - // proxy.$refs.refTriggerChild.resetFieldsValueFunc(); | |
264 | - proxy.$refs.refConditionChild.resetFieldsValueFunc(); | |
265 | - proxy.$refs.refActionChild.resetFieldsValueFunc(); | |
266 | - }, 50); | |
267 | - } catch (e) { | |
268 | - return e; | |
269 | - } | |
270 | - } else { | |
271 | - newFilterMap.value = []; | |
272 | - newConditionFilterMap.value = []; | |
273 | - newActionFilterMap.value = []; | |
274 | - clearAllArrayFunc(); | |
275 | - editTriggerPushData.value = []; | |
276 | - editTriggerPushData.value.length = 0; | |
277 | - editConditionPushData.value = []; | |
278 | - editActionPushData.value = []; | |
279 | - lastEditRefTriggerChildDataArray.value = []; | |
280 | - getId.value = data.record.id; | |
281 | - getTenantId.value = data.record.tenantId; | |
282 | - await setFieldsValue({ | |
283 | - ...data.record, | |
284 | - }); | |
285 | - 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; | |
295 | - editActionPushData.value = data.record.doActions; | |
296 | - const options = await screenLinkPageByDeptIdGetDevice({ | |
297 | - organizationId: data.record.organizationId, | |
298 | - }); | |
266 | + isUpdate.value = data?.isUpdate; | |
267 | + if (isUpdate.value) { | |
299 | 268 | try { |
300 | - data.record.triggers.forEach((f1) => { | |
269 | + getId.value = mockData.id; | |
270 | + getTenantId.value = mockData.tenantId; | |
271 | + await setFieldsValue({ | |
272 | + ...data.record, | |
273 | + }); | |
274 | + editTriggerPushData.value = mockData.triggers; | |
275 | + editConditionPushData.value = mockData.doConditions; | |
276 | + editActionPushData.value = mockData.doActions; | |
277 | + // editTriggerPushData.value.forEach((f) => { | |
278 | + // if (f?.id.length == 18) { | |
279 | + // editTriggerPushData.value.pop(); | |
280 | + // if (editTriggerPushData.value.length) { | |
281 | + // editTriggerPushData.value.length = editTriggerPushData.value.length; | |
282 | + // } | |
283 | + // } | |
284 | + // }); | |
285 | + | |
286 | + const options = await screenLinkPageByDeptIdGetDevice({ | |
287 | + organizationId: mockData.organizationId, | |
288 | + }); | |
289 | + | |
290 | + mockData.triggers.forEach((f1) => { | |
301 | 291 | options.items?.forEach((f2) => { |
302 | 292 | if (f2.id == f1.deviceId) { |
303 | 293 | newFilterMap.value.push({ |
... | ... | @@ -308,7 +298,7 @@ |
308 | 298 | }); |
309 | 299 | }); |
310 | 300 | |
311 | - data.record.doConditions.forEach((f1) => { | |
301 | + mockData.doConditions.forEach((f1) => { | |
312 | 302 | options.items?.forEach((f2) => { |
313 | 303 | if (f2.id == f1.deviceId) { |
314 | 304 | newConditionFilterMap.value.push({ |
... | ... | @@ -318,7 +308,7 @@ |
318 | 308 | } |
319 | 309 | }); |
320 | 310 | }); |
321 | - data.record.doActions.forEach((f1) => { | |
311 | + mockData.doActions.forEach((f1) => { | |
322 | 312 | options.items?.forEach((f2) => { |
323 | 313 | if (f2.id == f1.deviceId) { |
324 | 314 | newActionFilterMap.value.push({ |
... | ... | @@ -328,34 +318,41 @@ |
328 | 318 | } |
329 | 319 | }); |
330 | 320 | }); |
331 | - } catch (e) {} | |
321 | + } catch (e) { | |
322 | + return e; | |
323 | + } | |
332 | 324 | } |
333 | 325 | }); |
334 | - const getTitle = computed(() => (!unref(isUpdate) ? '新增场景联动' : '编辑场景联动')); | |
326 | + const getTitle = computed(() => (isUpdate.value == false ? '新增场景联动' : '编辑场景联动')); | |
335 | 327 | |
336 | - const clearAllArrayFunc = () => { | |
337 | - unref(addTriggerPushData).length = 0; | |
338 | - unref(addConditionPushData).length = 0; | |
339 | - unref(addActionPushData).length = 0; | |
340 | - lastRefTriggerChildDataArray.value.length = 0; | |
341 | - lastRefConditionChildDataArray.value.length = 0; | |
342 | - lastRefActionChildDataArray.value.length = 0; | |
343 | - lastEditRefTriggerChildDataArray.value.length = 0; | |
344 | - }; | |
345 | - const resetActionsAllArrayFunc = () => { | |
328 | + const clearPushArrayFunc = () => { | |
346 | 329 | try { |
330 | + proxy.$refs.refConditionChild.resetFieldsValueFunc(); | |
331 | + proxy.$refs.refActionChild.resetFieldsValueFunc(); | |
347 | 332 | proxy.$refs.refActionChild.resetFieldsValueFunc(); |
348 | - } catch (e) { | |
349 | - return e; | |
350 | - } | |
351 | - }; | |
352 | - const clearActionsAllDevice = () => { | |
353 | - try { | |
354 | 333 | proxy.$refs.refActionChild.clearSelectDevice(); |
334 | + newFilterMap.value.length = 0; | |
335 | + newConditionFilterMap.value.length = 0; | |
336 | + newActionFilterMap.value.length = 0; | |
337 | + editTriggerPushData.value.length = 0; | |
338 | + editConditionPushData.value.length = 0; | |
339 | + editActionPushData.value.length = 0; | |
340 | + lastEditRefTriggerChildDataArray.value.length = 0; | |
341 | + addTriggerPushData.value.length = 0; | |
342 | + addConditionPushData.value.length = 0; | |
343 | + addActionPushData.value.length = 0; | |
344 | + lastRefTriggerChildDataArray.value.length = 0; | |
345 | + lastRefConditionChildDataArray.value.length = 0; | |
346 | + lastRefActionChildDataArray.value.length = 0; | |
347 | + lastEditRefTriggerChildDataArray.value.length = 0; | |
355 | 348 | } catch (e) { |
356 | 349 | return e; |
357 | 350 | } |
358 | 351 | }; |
352 | + const handleCancel = () => { | |
353 | + clearPushArrayFunc(); | |
354 | + }; | |
355 | + | |
359 | 356 | watch(getData, (newV) => { |
360 | 357 | getDeviceInfo.value = newV; |
361 | 358 | getDeviceInfo1.value = newV; |
... | ... | @@ -388,7 +385,7 @@ |
388 | 385 | }; |
389 | 386 | |
390 | 387 | const getDefaultValue = () => { |
391 | - if (!unref(isUpdate)) { | |
388 | + if (!isUpdate.value) { | |
392 | 389 | delete getAllFormData.id; |
393 | 390 | delete getAllFormData.getTenantId; |
394 | 391 | refTriggerChildDataFunc(); |
... | ... | @@ -434,7 +431,7 @@ |
434 | 431 | }; |
435 | 432 | |
436 | 433 | const handleSubmit = async () => { |
437 | - if (!unref(isUpdate)) { | |
434 | + if (!isUpdate.value) { | |
438 | 435 | getDefaultValue(); |
439 | 436 | getValuesFormData = await validateFields(); |
440 | 437 | if (!getValuesFormData) return; |
... | ... | @@ -442,6 +439,7 @@ |
442 | 439 | await screenLinkPageAddApi(getAllFormData); |
443 | 440 | createMessage.success('场景联动新增成功'); |
444 | 441 | closeDrawer(); |
442 | + handleCancel(); | |
445 | 443 | emit('success'); |
446 | 444 | } else { |
447 | 445 | getDefaultValue(); |
... | ... | @@ -457,15 +455,12 @@ |
457 | 455 | }; |
458 | 456 | const defaultAddTrigger = () => { |
459 | 457 | if (unref(addTriggerPushData).length == 0) { |
460 | - setTimeout(() => { | |
461 | - addTrigger(); | |
462 | - }, 10); | |
458 | + addTrigger(); | |
463 | 459 | } |
464 | 460 | }; |
465 | - | |
466 | 461 | //新增触发器 |
467 | 462 | const addTrigger = () => { |
468 | - if (!unref(isUpdate)) { | |
463 | + if (isUpdate.value == false) { | |
469 | 464 | unref(addTriggerPushData).push(addTriggerData as never); |
470 | 465 | refTriggerChildDataFunc(); |
471 | 466 | lastRefTriggerChildData.value = refTriggerChildData.value; |
... | ... | @@ -478,7 +473,7 @@ |
478 | 473 | } |
479 | 474 | }; |
480 | 475 | const removeTrigger = () => { |
481 | - if (!unref(isUpdate)) { | |
476 | + if (!isUpdate.value) { | |
482 | 477 | try { |
483 | 478 | unref(addTriggerPushData).splice(0, 1); |
484 | 479 | lastRefTriggerChildDataArray.value.splice(0, 1); |
... | ... | @@ -494,42 +489,42 @@ |
494 | 489 | } |
495 | 490 | } |
496 | 491 | }; |
492 | + //默认新增执行动作 | |
493 | + const defaultAddAction = () => { | |
494 | + if (unref(addActionPushData).length == 0) { | |
495 | + addAction(); | |
496 | + } | |
497 | + }; | |
497 | 498 | |
498 | 499 | //新增执行条件 |
499 | 500 | 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); | |
519 | - }; | |
520 | - const removeCondition = () => { | |
521 | - try { | |
522 | - unref(addConditionPushData).splice(0, 1); | |
523 | - lastRefConditionChildDataArray.value.splice(0, 1); | |
524 | - } catch (e) { | |
525 | - return e; | |
501 | + if (!isUpdate.value) { | |
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 | + unref(editConditionPushData).push(addConditionData as never); | |
508 | + refConditionChildDataFunc(); | |
509 | + lastRefConditionChildData.value = refConditionChildData.value; | |
510 | + lastEditRefConditionChildDataArray.value.push(lastRefConditionChildData.value as never); | |
526 | 511 | } |
527 | 512 | }; |
528 | - | |
529 | - //新增执行动作 | |
530 | - const defaultAddAction = () => { | |
531 | - if (unref(addActionPushData).length == 0) { | |
532 | - addAction(); | |
513 | + const removeCondition = () => { | |
514 | + if (!isUpdate.value) { | |
515 | + try { | |
516 | + unref(addConditionPushData).splice(0, 1); | |
517 | + lastRefConditionChildDataArray.value.splice(0, 1); | |
518 | + } catch (e) { | |
519 | + return e; | |
520 | + } | |
521 | + } else { | |
522 | + try { | |
523 | + unref(editConditionPushData).splice(0, 1); | |
524 | + lastEditRefConditionChildDataArray.value.splice(0, 1); | |
525 | + } catch (e) { | |
526 | + return e; | |
527 | + } | |
533 | 528 | } |
534 | 529 | }; |
535 | 530 | |
... | ... | @@ -539,32 +534,38 @@ |
539 | 534 | } |
540 | 535 | }; |
541 | 536 | 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); | |
537 | + if (!isUpdate.value) { | |
538 | + unref(addActionPushData).push(addActionData as never); | |
539 | + refActionChildDataFunc(); | |
540 | + lastRefActionChildData.value = refActionChildData.value; | |
541 | + lastRefActionChildDataArray.value.push(lastRefActionChildData.value as never); | |
542 | + } else { | |
543 | + unref(editActionPushData).push(addActionData as never); | |
544 | + refActionChildDataFunc(); | |
545 | + lastRefActionChildData.value = refActionChildData.value; | |
546 | + lastEditRefActionChildDataArray.value.push(lastRefActionChildData.value as never); | |
547 | + } | |
557 | 548 | }; |
558 | 549 | const removeAction = () => { |
559 | - try { | |
560 | - unref(addActionPushData).splice(0, 1); | |
561 | - lastRefActionChildDataArray.value.splice(0, 1); | |
562 | - } catch (e) { | |
563 | - return e; | |
550 | + if (!isUpdate.value) { | |
551 | + try { | |
552 | + unref(addActionPushData).splice(0, 1); | |
553 | + lastRefActionChildDataArray.value.splice(0, 1); | |
554 | + } catch (e) { | |
555 | + return e; | |
556 | + } | |
557 | + } else { | |
558 | + try { | |
559 | + unref(editActionPushData).splice(0, 1); | |
560 | + lastEditRefActionChildDataArray.value.splice(0, 1); | |
561 | + } catch (e) { | |
562 | + return e; | |
563 | + } | |
564 | 564 | } |
565 | 565 | }; |
566 | 566 | |
567 | 567 | return { |
568 | + handleCancel, | |
568 | 569 | defaultAddTrigger, |
569 | 570 | defaultAddCondition, |
570 | 571 | newFilterMap, |
... | ... | @@ -574,11 +575,9 @@ |
574 | 575 | editConditionPushData, |
575 | 576 | editActionPushData, |
576 | 577 | isUpdate, |
577 | - clearActionsAllDevice, | |
578 | 578 | getDeviceInfo, |
579 | 579 | getDeviceInfo1, |
580 | 580 | getDeviceInfo2, |
581 | - resetActionsAllArrayFunc, | |
582 | 581 | addActionPushData, |
583 | 582 | defaultAddAction, |
584 | 583 | refActionChild, |
... | ... | @@ -588,7 +587,6 @@ |
588 | 587 | refConditionChild, |
589 | 588 | addCondition, |
590 | 589 | removeCondition, |
591 | - clearAllArrayFunc, | |
592 | 590 | removeTrigger, |
593 | 591 | addTriggerPushData, |
594 | 592 | addTriggerData, | ... | ... |