Showing
7 changed files
with
134 additions
and
125 deletions
... | ... | @@ -21,8 +21,9 @@ |
21 | 21 | /></TabPane> |
22 | 22 | <TabPane key="3" tab="报警规则"> |
23 | 23 | <div style="padding-top: 10px"> |
24 | - <div style="border-radius: 10px; border: 1px solid #f0f0f0"> | |
25 | - <div style="margin-left: 15px"> | |
24 | + <div style="border-radius: 10px"> | |
25 | + <p style="font-weight: 900">报警规则</p> | |
26 | + <div class="input-style" style="margin-left: 15px"> | |
26 | 27 | <BasicForm |
27 | 28 | :showSubmitButton="false" |
28 | 29 | :showResetButton="false" |
... | ... | @@ -60,9 +61,9 @@ |
60 | 61 | /> |
61 | 62 | </div> |
62 | 63 | </div> |
63 | - <div style="border-radius: 10px; border: 1px solid #f0f0f0; margin-top: 15px"> | |
64 | - <p>清除报警规则</p> | |
65 | - <div style="margin-left: 15px"> | |
64 | + <div style="border-radius: 10px; margin-top: 15px"> | |
65 | + <p style="font-weight: 900">清除报警规则</p> | |
66 | + <div class="clear-input-style" style="margin-left: 15px"> | |
66 | 67 | <BasicForm |
67 | 68 | :showSubmitButton="false" |
68 | 69 | :showResetButton="false" |
... | ... | @@ -359,3 +360,35 @@ |
359 | 360 | }, |
360 | 361 | }); |
361 | 362 | </script> |
363 | + | |
364 | +<style scoped lang="less"> | |
365 | + .input-style { | |
366 | + /deep/ .ant-form-item-control-input { | |
367 | + position: relative; | |
368 | + display: flex; | |
369 | + align-items: center; | |
370 | + min-height: 02px; | |
371 | + } | |
372 | + /deep/.ant-col-24 { | |
373 | + display: block; | |
374 | + flex: 0 0 100%; | |
375 | + max-width: 100%; | |
376 | + margin-top: -20px; | |
377 | + } | |
378 | + } | |
379 | + | |
380 | + .clear-input-style { | |
381 | + /deep/ .ant-form-item-control-input { | |
382 | + position: relative; | |
383 | + display: flex; | |
384 | + align-items: center; | |
385 | + min-height: 02px; | |
386 | + } | |
387 | + /deep/.ant-col-24 { | |
388 | + display: block; | |
389 | + flex: 0 0 100%; | |
390 | + max-width: 100%; | |
391 | + margin-top: -20px; | |
392 | + } | |
393 | + } | |
394 | +</style> | ... | ... |
... | ... | @@ -12,7 +12,7 @@ |
12 | 12 | " |
13 | 13 | > |
14 | 14 | <div style="width: 4vw; height: 24vh">请上传图片</div> |
15 | - <div style="width: 8vw; height: 24vh"> | |
15 | + <div class="device-icon-style" style="width: 8vw; height: 24vh"> | |
16 | 16 | <Upload |
17 | 17 | style="width: 20vw" |
18 | 18 | name="avatar" |
... | ... | @@ -23,20 +23,20 @@ |
23 | 23 | :before-upload="beforeUploadqrcodePic" |
24 | 24 | > |
25 | 25 | <img |
26 | - style="text-align: center; border-radius: 50%; width: 10vw; height: 15vh" | |
26 | + style="text-align: center; width: 13vw; height: 15vh" | |
27 | 27 | v-if="peresonalPic" |
28 | 28 | :src="peresonalPic" |
29 | 29 | alt="avatar" |
30 | 30 | /> |
31 | 31 | <div v-else> |
32 | 32 | <div style="margin-top: 30px"> |
33 | - <PlusOutlined style="font-size: 30px" /> | |
33 | + <PlusOutlined style="font-size: 30px; margin-left: -166px" /> | |
34 | 34 | </div> |
35 | 35 | <div |
36 | 36 | class="ant-upload-text flex" |
37 | - style="width: 280px; height: 130px; align-items: center" | |
37 | + style="width: 280px; height: 130px; align-items: center; margin-left: 43px" | |
38 | 38 | > |
39 | - 支持.PNG、.JPG、.JPEG格式,建议大小不超过2M。</div | |
39 | + 请上传图片</div | |
40 | 40 | > |
41 | 41 | </div> |
42 | 42 | </Upload> |
... | ... | @@ -166,6 +166,21 @@ |
166 | 166 | p { |
167 | 167 | color: @text-color; |
168 | 168 | } |
169 | + .device-icon-style { | |
170 | + /deep/ .ant-upload-select-picture-card { | |
171 | + display: inherit; | |
172 | + float: none; | |
173 | + width: 8.6vw; | |
174 | + height: 17vh; | |
175 | + margin-right: 8px; | |
176 | + text-align: center; | |
177 | + vertical-align: top; | |
178 | + background-color: #fafafa; | |
179 | + border: 1px dashed #d9d9d9; | |
180 | + cursor: pointer; | |
181 | + transition: border-color 0.3s ease; | |
182 | + } | |
183 | + } | |
169 | 184 | } |
170 | 185 | |
171 | 186 | .pay-select { | ... | ... |
... | ... | @@ -261,7 +261,7 @@ |
261 | 261 | |
262 | 262 | appendSchemaByField( |
263 | 263 | { |
264 | - field: `compare${n.value}`, | |
264 | + field: `compareWendu${n.value}`, | |
265 | 265 | label: '', |
266 | 266 | component: 'Select', |
267 | 267 | componentProps: { |
... | ... | @@ -282,7 +282,7 @@ |
282 | 282 | ); |
283 | 283 | appendSchemaByField( |
284 | 284 | { |
285 | - field: `value${n.value}`, | |
285 | + field: `valueWendu${n.value}`, | |
286 | 286 | component: 'Input', |
287 | 287 | label: '', |
288 | 288 | componentProps: { |
... | ... | @@ -322,8 +322,8 @@ |
322 | 322 | `wu${field}`, |
323 | 323 | `compare${field}`, |
324 | 324 | `value${field}`, |
325 | - `compare${field}`, | |
326 | - `value${field}`, | |
325 | + `compareWendu${field}`, | |
326 | + `valueWendu${field}`, | |
327 | 327 | `${field}`, |
328 | 328 | ]); |
329 | 329 | n.value--; | ... | ... |
... | ... | @@ -204,6 +204,22 @@ |
204 | 204 | ); |
205 | 205 | appendSchemaByField( |
206 | 206 | { |
207 | + field: 'wu3', | |
208 | + label: '', | |
209 | + component: 'Input', | |
210 | + componentProps: { | |
211 | + placeholder: '无', | |
212 | + style: { | |
213 | + visibility: 'hidden', | |
214 | + }, | |
215 | + }, | |
216 | + colProps: { span: 12 }, | |
217 | + ifShow: ({ values }) => isMsg(Reflect.get(values, 'outTarget')), | |
218 | + }, | |
219 | + '' | |
220 | + ); | |
221 | + appendSchemaByField( | |
222 | + { | |
207 | 223 | field: `sceneLinkageId${n.value}`, |
208 | 224 | label: '', |
209 | 225 | component: 'ApiSelect', |
... | ... | @@ -223,6 +239,22 @@ |
223 | 239 | }, |
224 | 240 | '' |
225 | 241 | ); |
242 | + appendSchemaByField( | |
243 | + { | |
244 | + field: 'wu4', | |
245 | + label: '', | |
246 | + component: 'Input', | |
247 | + componentProps: { | |
248 | + placeholder: '无', | |
249 | + style: { | |
250 | + visibility: 'hidden', | |
251 | + }, | |
252 | + }, | |
253 | + colProps: { span: 12 }, | |
254 | + ifShow: ({ values }) => isScene(Reflect.get(values, 'outTarget')), | |
255 | + }, | |
256 | + '' | |
257 | + ); | |
226 | 258 | |
227 | 259 | appendSchemaByField( |
228 | 260 | { |
... | ... | @@ -247,7 +279,9 @@ |
247 | 279 | `command${field}`, |
248 | 280 | `wu1${field}`, |
249 | 281 | `wu2${field}`, |
282 | + `wu3${field}`, | |
250 | 283 | `sceneLinkageId${field}`, |
284 | + `wu4${field}`, | |
251 | 285 | `${field}`, |
252 | 286 | ]); |
253 | 287 | n.value--; | ... | ... |
... | ... | @@ -12,26 +12,26 @@ |
12 | 12 | <template #add="{ field }"> |
13 | 13 | <Button |
14 | 14 | style="margin-left: -99px; margin-top: 0px; display: inline-block" |
15 | + :style="addHideButton > 1 ? 'display:none' : 'display:inline-block'" | |
15 | 16 | v-if="Number(field) === 0" |
16 | 17 | @click="add" |
17 | 18 | type="primary" |
18 | 19 | >+新增触发器</Button |
19 | 20 | > |
20 | - <!-- <Button | |
21 | - style="margin-left: 20px; margin-top: -60px" | |
22 | - v-if="Number(field) === 0" | |
23 | - type="primary" | |
24 | - @click="del(field)" | |
25 | - >删除</Button | |
26 | - > --> | |
27 | 21 | <Button |
28 | 22 | style="margin-left: 5px; margin-top: 35px" |
29 | - v-if="field > 0" | |
23 | + :style="addHideButton >= 2 ? 'display:inline-block' : 'display:none'" | |
24 | + v-if="Number(field) > 0" | |
30 | 25 | @click="add" |
31 | 26 | type="primary" |
32 | 27 | >+新增触发器</Button |
33 | 28 | > |
34 | - <Button style="margin-left: 10px" v-if="field > 0" @click="del(field)" type="primary" | |
29 | + <Button | |
30 | + style="margin-left: 10px" | |
31 | + :style="addHideButton >= 2 ? 'display:inline-block' : 'display:none'" | |
32 | + v-if="Number(field) > 0" | |
33 | + @click="del(field)" | |
34 | + type="primary" | |
35 | 35 | >删除</Button |
36 | 36 | > |
37 | 37 | </template> |
... | ... | @@ -62,7 +62,8 @@ |
62 | 62 | setup(props) { |
63 | 63 | const getValueData: any = ref({}); |
64 | 64 | const getPushValueData: any = ref([]); |
65 | - // const newMapGetPushValueData: any = ref([]); | |
65 | + const addHideButton = ref(1); | |
66 | + const addHideButtonTemp: any = ref(null); | |
66 | 67 | const [ |
67 | 68 | registerTrigger, |
68 | 69 | { |
... | ... | @@ -118,13 +119,6 @@ |
118 | 119 | }, |
119 | 120 | }); |
120 | 121 | }; |
121 | - // //去除字符串的数字 | |
122 | - // function trimNumber(str) { | |
123 | - // return str.replace(/\d+/g, ''); | |
124 | - // } | |
125 | - // function unique(arr) { | |
126 | - // return Array.from(new Set(arr)); | |
127 | - // } | |
128 | 122 | const clearGetPushValueDataEmpty = () => { |
129 | 123 | getPushValueData.value.length = 0; |
130 | 124 | }; |
... | ... | @@ -143,15 +137,14 @@ |
143 | 137 | |
144 | 138 | const n = ref(1); |
145 | 139 | function add() { |
146 | - // const values = getFieldsValue(); | |
147 | - // getPushValueData.value.push(values); | |
148 | - // newMapGetPushValueData.value = getPushValueData.value.map((m) => { | |
149 | - // const getKeys = Object.keys(m); | |
150 | - // getKeys.map((f) => { | |
151 | - // return unique(trimNumber(f)); | |
152 | - // }); | |
153 | - // }); | |
154 | - // console.log(newMapGetPushValueData.value); | |
140 | + addHideButton.value++; | |
141 | + addHideButtonTemp.value = addHideButton.value; | |
142 | + addHideButtonTemp.value--; | |
143 | + const getS = document.getElementById('1') as HTMLElement; | |
144 | + // getS.setAttribute('style', 'display:none'); | |
145 | + console.log(getS); | |
146 | + getS.hidden = true; | |
147 | + | |
155 | 148 | appendSchemaByField( |
156 | 149 | { |
157 | 150 | field: `kong${n.value}`, |
... | ... | @@ -199,7 +192,7 @@ |
199 | 192 | ); |
200 | 193 | appendSchemaByField( |
201 | 194 | { |
202 | - field: `${n.value}no1`, | |
195 | + field: `no1${n.value}`, | |
203 | 196 | component: 'Input', |
204 | 197 | label: '', |
205 | 198 | componentProps: { |
... | ... | @@ -234,7 +227,7 @@ |
234 | 227 | ); |
235 | 228 | appendSchemaByField( |
236 | 229 | { |
237 | - field: `${n.value}no2`, | |
230 | + field: `no2${n.value}`, | |
238 | 231 | label: '', |
239 | 232 | component: 'Select', |
240 | 233 | componentProps: { |
... | ... | @@ -342,7 +335,7 @@ |
342 | 335 | ); |
343 | 336 | appendSchemaByField( |
344 | 337 | { |
345 | - field: `${n.value}no3`, | |
338 | + field: `no3${n.value}`, | |
346 | 339 | label: '', |
347 | 340 | component: 'ApiSelect', |
348 | 341 | colProps: { |
... | ... | @@ -371,23 +364,26 @@ |
371 | 364 | } |
372 | 365 | |
373 | 366 | function del(field) { |
367 | + addHideButton.value--; | |
374 | 368 | removeSchemaByFiled([ |
375 | 369 | `kong${field}`, |
376 | 370 | `tiggerEvent${field}`, |
377 | 371 | `deviceId${field}`, |
378 | - `${field}no1`, | |
372 | + `no1${field}`, | |
379 | 373 | `touchWay${field}`, |
380 | - `${field}no2`, | |
374 | + `no2${field}`, | |
381 | 375 | `attributeChoose${field}`, |
382 | 376 | `compare${field}`, |
383 | 377 | `value${field}`, |
384 | 378 | `sceneLinkageId${field}`, |
385 | - `${field}no3`, | |
379 | + `no3${field}`, | |
386 | 380 | `${field}`, |
387 | 381 | ]); |
388 | 382 | n.value--; |
389 | 383 | } |
390 | 384 | return { |
385 | + addHideButtonTemp, | |
386 | + addHideButton, | |
391 | 387 | editSelectDevice, |
392 | 388 | clearSelectDevice, |
393 | 389 | clearGetPushValueDataEmpty, | ... | ... |
... | ... | @@ -295,9 +295,6 @@ export const useTriggerDrawerSchema: FormSchema[] = [ |
295 | 295 | componentProps: { |
296 | 296 | placeholder: '请选择设备', |
297 | 297 | }, |
298 | - // componentProps: { | |
299 | - // placeholder: '请选择设备', | |
300 | - // }, | |
301 | 298 | ifShow: ({ values }) => |
302 | 299 | !isTime(Reflect.get(values, 'triggerEvent')) && |
303 | 300 | !isScene(Reflect.get(values, 'triggerEvent')) && |
... | ... | @@ -307,27 +304,13 @@ export const useTriggerDrawerSchema: FormSchema[] = [ |
307 | 304 | }, |
308 | 305 | }, |
309 | 306 | { |
310 | - field: '', | |
307 | + field: 'no1', | |
311 | 308 | component: 'Input', |
312 | 309 | label: '', |
313 | 310 | componentProps: { |
314 | 311 | maxLength: 255, |
315 | 312 | placeholder: '请输入Cron表达式', |
316 | 313 | }, |
317 | - dynamicRules: () => { | |
318 | - return [ | |
319 | - { | |
320 | - required: false, | |
321 | - validator: (_, value) => { | |
322 | - if (String(value).length > 255) { | |
323 | - return Promise.reject('字数不超过255个字'); | |
324 | - } | |
325 | - return Promise.resolve(); | |
326 | - }, | |
327 | - }, | |
328 | - ]; | |
329 | - }, | |
330 | - | |
331 | 314 | colProps: { |
332 | 315 | span: 12, |
333 | 316 | }, |
... | ... | @@ -351,7 +334,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ |
351 | 334 | colProps: { span: 12 }, |
352 | 335 | }, |
353 | 336 | { |
354 | - field: '', | |
337 | + field: 'no2', | |
355 | 338 | label: '', |
356 | 339 | component: 'Select', |
357 | 340 | componentProps: { |
... | ... | @@ -417,19 +400,6 @@ export const useTriggerDrawerSchema: FormSchema[] = [ |
417 | 400 | maxLength: 16, |
418 | 401 | placeholder: '请输入比较值', |
419 | 402 | }, |
420 | - dynamicRules: () => { | |
421 | - return [ | |
422 | - { | |
423 | - required: false, | |
424 | - validator: (_, value) => { | |
425 | - if (String(value).length > 16) { | |
426 | - return Promise.reject('字数不超过16个字'); | |
427 | - } | |
428 | - return Promise.resolve(); | |
429 | - }, | |
430 | - }, | |
431 | - ]; | |
432 | - }, | |
433 | 403 | |
434 | 404 | ifShow: ({ values }) => |
435 | 405 | isWenDu(Reflect.get(values, 'attributeChoose')) && |
... | ... | @@ -546,7 +516,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ |
546 | 516 | colProps: { span: 12 }, |
547 | 517 | }, |
548 | 518 | { |
549 | - field: '', | |
519 | + field: 'wu', | |
550 | 520 | label: '', |
551 | 521 | component: 'Input', |
552 | 522 | componentProps: { |
... | ... | @@ -583,19 +553,6 @@ export const useConditionDrawerSchema: FormSchema[] = [ |
583 | 553 | maxLength: 16, |
584 | 554 | placeholder: '请输入比较值', |
585 | 555 | }, |
586 | - dynamicRules: () => { | |
587 | - return [ | |
588 | - { | |
589 | - required: false, | |
590 | - validator: (_, value) => { | |
591 | - if (String(value).length > 16) { | |
592 | - return Promise.reject('字数不超过16个字'); | |
593 | - } | |
594 | - return Promise.resolve(); | |
595 | - }, | |
596 | - }, | |
597 | - ]; | |
598 | - }, | |
599 | 556 | |
600 | 557 | ifShow: ({ values }) => |
601 | 558 | isShiDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'status')), |
... | ... | @@ -605,7 +562,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ |
605 | 562 | }, |
606 | 563 | |
607 | 564 | { |
608 | - field: 'compare', | |
565 | + field: 'compareWendu', | |
609 | 566 | label: '', |
610 | 567 | component: 'Select', |
611 | 568 | componentProps: { |
... | ... | @@ -623,26 +580,13 @@ export const useConditionDrawerSchema: FormSchema[] = [ |
623 | 580 | colProps: { span: 12 }, |
624 | 581 | }, |
625 | 582 | { |
626 | - field: 'value', | |
583 | + field: 'valueWendu', | |
627 | 584 | component: 'Input', |
628 | 585 | label: '', |
629 | 586 | componentProps: { |
630 | 587 | maxLength: 16, |
631 | 588 | placeholder: '请输入比较值', |
632 | 589 | }, |
633 | - dynamicRules: () => { | |
634 | - return [ | |
635 | - { | |
636 | - required: false, | |
637 | - validator: (_, value) => { | |
638 | - if (String(value).length > 16) { | |
639 | - return Promise.reject('字数不超过16个字'); | |
640 | - } | |
641 | - return Promise.resolve(); | |
642 | - }, | |
643 | - }, | |
644 | - ]; | |
645 | - }, | |
646 | 590 | ifShow: ({ values }) => |
647 | 591 | isWenDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'status')), |
648 | 592 | colProps: { |
... | ... | @@ -696,19 +640,6 @@ export const useActionDrawerSchema: FormSchema[] = [ |
696 | 640 | maxLength: 255, |
697 | 641 | placeholder: '请输入下发指定', |
698 | 642 | }, |
699 | - dynamicRules: () => { | |
700 | - return [ | |
701 | - { | |
702 | - required: false, | |
703 | - validator: (_, value) => { | |
704 | - if (String(value).length > 255) { | |
705 | - return Promise.reject('字数不超过255个字'); | |
706 | - } | |
707 | - return Promise.resolve(); | |
708 | - }, | |
709 | - }, | |
710 | - ]; | |
711 | - }, | |
712 | 643 | ifShow: ({ values }) => |
713 | 644 | !isScene(Reflect.get(values, 'outTarget')) && !isMsg(Reflect.get(values, 'outTarget')), |
714 | 645 | colProps: { |
... | ... | @@ -716,7 +647,7 @@ export const useActionDrawerSchema: FormSchema[] = [ |
716 | 647 | }, |
717 | 648 | }, |
718 | 649 | { |
719 | - field: '', | |
650 | + field: 'wu1', | |
720 | 651 | label: '', |
721 | 652 | component: 'Input', |
722 | 653 | componentProps: { |
... | ... | @@ -728,7 +659,7 @@ export const useActionDrawerSchema: FormSchema[] = [ |
728 | 659 | colProps: { span: 12 }, |
729 | 660 | }, |
730 | 661 | { |
731 | - field: '', | |
662 | + field: 'wu2', | |
732 | 663 | component: 'Input', |
733 | 664 | label: '', |
734 | 665 | componentProps: { |
... | ... | @@ -740,7 +671,7 @@ export const useActionDrawerSchema: FormSchema[] = [ |
740 | 671 | ifShow: ({ values }) => isMsg(Reflect.get(values, 'outTarget')), |
741 | 672 | }, |
742 | 673 | { |
743 | - field: '', | |
674 | + field: 'wu3', | |
744 | 675 | label: '', |
745 | 676 | component: 'Input', |
746 | 677 | componentProps: { |
... | ... | @@ -771,7 +702,7 @@ export const useActionDrawerSchema: FormSchema[] = [ |
771 | 702 | ifShow: ({ values }) => isScene(Reflect.get(values, 'outTarget')), |
772 | 703 | }, |
773 | 704 | { |
774 | - field: '', | |
705 | + field: 'wu4', | |
775 | 706 | label: '', |
776 | 707 | component: 'Input', |
777 | 708 | componentProps: { | ... | ... |
... | ... | @@ -71,6 +71,7 @@ |
71 | 71 | isUpdate.value = !!data?.isUpdate; |
72 | 72 | |
73 | 73 | if (!unref(isUpdate)) { |
74 | + proxy.$refs.getTriggerChildData.clearGetPushValueDataEmpty(); | |
74 | 75 | proxy.$refs.getTriggerChildData.clearSelectDevice(); |
75 | 76 | proxy.$refs.getChildData.clearSelectDevice(); |
76 | 77 | proxy.$refs.getConditionChildData.clearSelectDevice(); |
... | ... | @@ -144,7 +145,6 @@ |
144 | 145 | } |
145 | 146 | } else { |
146 | 147 | await resetFields(); |
147 | - proxy.$refs.getTriggerChildData.clearGetPushValueDataEmpty(); | |
148 | 148 | } |
149 | 149 | }); |
150 | 150 | const getTitle = computed(() => (!unref(isUpdate) ? '新增场景联动' : '编辑场景联动')); | ... | ... |