Commit 382d2039ab5e56a681b29254a40ad9e28d60e075
Merge branch 'sqy_dev' into 'main'
'fix:添加场景联动表单校验,修复不能打包问题' See merge request huang/yun-teng-iot-front!172
Showing
5 changed files
with
21 additions
and
14 deletions
| ... | ... | @@ -436,7 +436,7 @@ export function isType(operationType) { | 
| 436 | 436 | field: 'operation', | 
| 437 | 437 | label: '执行操作', | 
| 438 | 438 | component: 'Select', | 
| 439 | - require: true, | |
| 439 | + required: true, | |
| 440 | 440 | componentProps: { | 
| 441 | 441 | options: [ | 
| 442 | 442 | { label: '等于', value: Number_Operation.EQUAL }, | 
| ... | ... | @@ -454,7 +454,7 @@ export function isType(operationType) { | 
| 454 | 454 | { | 
| 455 | 455 | field: 'value', | 
| 456 | 456 | label: '操作值', | 
| 457 | - require: true, | |
| 457 | + required: true, | |
| 458 | 458 | component: 'InputNumber', | 
| 459 | 459 | colProps: { | 
| 460 | 460 | span: 8, | 
| ... | ... | @@ -476,7 +476,7 @@ export function isType(operationType) { | 
| 476 | 476 | field: 'operation', | 
| 477 | 477 | label: '执行操作', | 
| 478 | 478 | component: 'Select', | 
| 479 | - require: true, | |
| 479 | + required: true, | |
| 480 | 480 | componentProps: { | 
| 481 | 481 | options: [ | 
| 482 | 482 | { label: '等于', value: String_Operation.EQUAL }, | 
| ... | ... | @@ -494,7 +494,7 @@ export function isType(operationType) { | 
| 494 | 494 | { | 
| 495 | 495 | field: 'value', | 
| 496 | 496 | label: '操作值', | 
| 497 | - require: true, | |
| 497 | + required: true, | |
| 498 | 498 | component: 'Input', | 
| 499 | 499 | colProps: { | 
| 500 | 500 | span: 7, | 
| ... | ... | @@ -507,7 +507,7 @@ export function isType(operationType) { | 
| 507 | 507 | field: 'operation', | 
| 508 | 508 | label: '执行操作', | 
| 509 | 509 | component: 'Select', | 
| 510 | - require: true, | |
| 510 | + required: true, | |
| 511 | 511 | componentProps: { | 
| 512 | 512 | options: [ | 
| 513 | 513 | { label: '等于', value: Boolean_Operation.EQUAL }, | 
| ... | ... | @@ -522,7 +522,7 @@ export function isType(operationType) { | 
| 522 | 522 | field: 'value', | 
| 523 | 523 | label: '操作值', | 
| 524 | 524 | component: 'Select', | 
| 525 | - require: true, | |
| 525 | + required: true, | |
| 526 | 526 | componentProps: { | 
| 527 | 527 | options: [ | 
| 528 | 528 | { | 
| ... | ... | @@ -545,7 +545,7 @@ export function isType(operationType) { | 
| 545 | 545 | { | 
| 546 | 546 | field: 'operation', | 
| 547 | 547 | label: '执行操作', | 
| 548 | - require: true, | |
| 548 | + required: true, | |
| 549 | 549 | component: 'Select', | 
| 550 | 550 | componentProps: { | 
| 551 | 551 | options: [ | 
| ... | ... | @@ -564,7 +564,7 @@ export function isType(operationType) { | 
| 564 | 564 | { | 
| 565 | 565 | field: 'value', | 
| 566 | 566 | label: '操作值', | 
| 567 | - require: true, | |
| 567 | + required: true, | |
| 568 | 568 | component: 'DatePicker', | 
| 569 | 569 | componentProps: { | 
| 570 | 570 | showTime: true, | ... | ... | 
| ... | ... | @@ -31,11 +31,13 @@ | 
| 31 | 31 | import { ref, provide } from 'vue'; | 
| 32 | 32 | import { CollapseContainer } from '/@/components/Container/index'; | 
| 33 | 33 | import { BasicForm, useForm } from '/@/components/Form/index'; | 
| 34 | - import { RadioGroup, Card, Select } from 'ant-design-vue'; | |
| 34 | + import { Radio, Card, Select } from 'ant-design-vue'; | |
| 35 | 35 | import { trigger_condition_schema } from '../config'; | 
| 36 | 36 | import { getAttribute } from '/@/api/ruleengine/ruleengineApi'; | 
| 37 | 37 | import ConditionScreening from './ConditionScreening.vue'; | 
| 38 | 38 | |
| 39 | + const RadioGroup = Radio.Group; | |
| 40 | + | |
| 39 | 41 | const [registerForm, { resetFields, getFieldsValue, updateSchema, setFieldsValue }] = useForm({ | 
| 40 | 42 | schemas: trigger_condition_schema, | 
| 41 | 43 | showActionButtonGroup: false, | ... | ... | 
| ... | ... | @@ -62,9 +62,6 @@ | 
| 62 | 62 | const attributes = []; | 
| 63 | 63 | const fieldsValue = props.childGetFieldsValue(); | 
| 64 | 64 | for (let i = 0; i < unref(refItem.conditionScreeningRefs).length; i++) { | 
| 65 | - // const valid = await unref(refItem.conditionScreeningRefs)[i].validate(); | |
| 66 | - console.log(unref(refItem.conditionScreeningRefs)[i]); | |
| 67 | - // if (!valid) return; | |
| 68 | 65 | if (i === 0) { | 
| 69 | 66 | const attr = conditionPreView( | 
| 70 | 67 | [ | 
| ... | ... | @@ -76,14 +73,19 @@ | 
| 76 | 73 | fieldsValue.operationType | 
| 77 | 74 | ); | 
| 78 | 75 | firstAttribute.value = attr[0]; | 
| 76 | + await unref(refItem.conditionScreeningRefs)[i].validate(); | |
| 79 | 77 | continue; | 
| 80 | 78 | } | 
| 79 | + const valid = await unref(refItem.conditionScreeningRefs)[i].validate(); | |
| 80 | + if (!valid) return; | |
| 81 | + | |
| 81 | 82 | attributes.push({ | 
| 82 | 83 | ...unref(refItem.conditionScreeningRefs)[i].getFieldsValue(), | 
| 83 | 84 | attribute: fieldsValue.type2, | 
| 84 | 85 | }); | 
| 85 | 86 | } | 
| 86 | 87 | otherAttribute.value = conditionPreView(attributes, fieldsValue.operationType); | 
| 88 | + | |
| 87 | 89 | collapseContainerRef.value.handleExpand(); | 
| 88 | 90 | }; | 
| 89 | 91 | ... | ... | 
| ... | ... | @@ -36,12 +36,13 @@ | 
| 36 | 36 | import { ref, provide } from 'vue'; | 
| 37 | 37 | import { CollapseContainer } from '/@/components/Container/index'; | 
| 38 | 38 | import { BasicForm, useForm } from '/@/components/Form/index'; | 
| 39 | - import { Tooltip, RadioGroup, Card, Select } from 'ant-design-vue'; | |
| 39 | + import { Tooltip, Radio, Card, Select } from 'ant-design-vue'; | |
| 40 | 40 | |
| 41 | 41 | import { trigger_condition_schema } from '../config'; | 
| 42 | 42 | import { getAttribute } from '/@/api/ruleengine/ruleengineApi'; | 
| 43 | 43 | import { Icon } from '/@/components/Icon'; | 
| 44 | 44 | import ConditionScreening from './ConditionScreening.vue'; | 
| 45 | + const RadioGroup = Radio.Group; | |
| 45 | 46 | |
| 46 | 47 | defineProps({ | 
| 47 | 48 | conditionIndex: { | ... | ... | 
| ... | ... | @@ -42,10 +42,12 @@ | 
| 42 | 42 | import { CollapseContainer } from '/@/components/Container/index'; | 
| 43 | 43 | import { BasicForm, useForm } from '/@/components/Form/index'; | 
| 44 | 44 | import { Icon } from '/@/components/Icon'; | 
| 45 | - import { Tooltip, RadioGroup, Card, Select } from 'ant-design-vue'; | |
| 45 | + import { Tooltip, Radio, Card, Select } from 'ant-design-vue'; | |
| 46 | 46 | import { trigger_condition_schema } from '../config'; | 
| 47 | 47 | import { getAttribute } from '/@/api/ruleengine/ruleengineApi'; | 
| 48 | 48 | import ConditionScreening from './ConditionScreening.vue'; | 
| 49 | + const RadioGroup = Radio.Group; | |
| 50 | + | |
| 49 | 51 | defineProps({ | 
| 50 | 52 | triggerIndex: { | 
| 51 | 53 | type: Number, | ... | ... |