Commit 382d2039ab5e56a681b29254a40ad9e28d60e075

Authored by xp.Huang
2 parents bb196132 9b359aa5

Merge branch 'sqy_dev' into 'main'

'fix:添加场景联动表单校验,修复不能打包问题'

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