Commit e37cb6f2ab477958cc55f18d77c1180c72cf797f

Authored by fengwotao
1 parent c2836752

fix:DEFECT-1177 新增点击触发器和执行动作时,如果没选择组织,提示框提示先选择组织

@@ -128,6 +128,7 @@ @@ -128,6 +128,7 @@
128 import { findOperation } from './config/formatData'; 128 import { findOperation } from './config/formatData';
129 import { formatToDateTime } from '/@/utils/dateUtil'; 129 import { formatToDateTime } from '/@/utils/dateUtil';
130 import ObjectModelValidateForm from '/@/components/Form/src/externalCompns/components/ObjectModelValidateForm/ObjectModelValidateForm.vue'; 130 import ObjectModelValidateForm from '/@/components/Form/src/externalCompns/components/ObjectModelValidateForm/ObjectModelValidateForm.vue';
  131 + import { isEmpty } from '/@/utils/is';
131 import { add } from '/@/components/Form/src/componentMap'; 132 import { add } from '/@/components/Form/src/componentMap';
132 133
133 add('ObjectModelValidateForm', ObjectModelValidateForm); 134 add('ObjectModelValidateForm', ObjectModelValidateForm);
@@ -156,7 +157,7 @@ @@ -156,7 +157,7 @@
156 const id = ref(undefined); 157 const id = ref(undefined);
157 const tenantId = ref(undefined); 158 const tenantId = ref(undefined);
158 const isView = ref(true); 159 const isView = ref(true);
159 - const [registerForm, { resetFields, validate, setFieldsValue }] = useForm({ 160 + const [registerForm, { resetFields, validate, setFieldsValue, getFieldsValue }] = useForm({
160 labelWidth: 120, 161 labelWidth: 120,
161 schemas: formSchema, 162 schemas: formSchema,
162 showActionButtonGroup: false, 163 showActionButtonGroup: false,
@@ -617,12 +618,25 @@ @@ -617,12 +618,25 @@
617 // item.updateFieldAlarmConfig(alarmConfigList); 618 // item.updateFieldAlarmConfig(alarmConfigList);
618 // }); 619 // });
619 // } 620 // }
  621 +
  622 + const isEmptyThrowError = (obj) => {
  623 + if (isEmpty(obj)) {
  624 + createMessage.error('请选择组织');
  625 + throw Error('请选择组织');
  626 + }
  627 + if (!Reflect.get(obj, 'organizationId')) {
  628 + createMessage.error('请选择组织');
  629 + throw Error('请选择组织');
  630 + }
  631 + };
  632 +
620 // 添加触发器 633 // 添加触发器
621 const addTrigger = () => { 634 const addTrigger = () => {
622 unref(triggerData).push(Date.now()); 635 unref(triggerData).push(Date.now());
623 nextTick(() => { 636 nextTick(() => {
624 setFields(skipUnwrap.triggerItemRefs); 637 setFields(skipUnwrap.triggerItemRefs);
625 }); 638 });
  639 + isEmptyThrowError(getFieldsValue());
626 }; 640 };
627 // 添加执行条件 641 // 添加执行条件
628 const addCondition = () => { 642 const addCondition = () => {
@@ -630,6 +644,7 @@ @@ -630,6 +644,7 @@
630 nextTick(() => { 644 nextTick(() => {
631 setFields(skipUnwrap.conditionItemRefs); 645 setFields(skipUnwrap.conditionItemRefs);
632 }); 646 });
  647 + isEmptyThrowError(getFieldsValue());
633 }; 648 };
634 // 添加执行动作 649 // 添加执行动作
635 const addAction = () => { 650 const addAction = () => {
@@ -637,6 +652,7 @@ @@ -637,6 +652,7 @@
637 nextTick(() => { 652 nextTick(() => {
638 setFields(skipUnwrap.actionItemRefs); 653 setFields(skipUnwrap.actionItemRefs);
639 }); 654 });
  655 + isEmptyThrowError(getFieldsValue());
640 }; 656 };
641 657
642 /** 658 /**