liuc 3 mesi fa
parent
commit
787f262442

+ 5 - 5
src/views/flow/stFormDesign/packages/PopUpQuery/index.vue

@@ -1,19 +1,19 @@
 <template>
   <div>
     <a-form-item :class="{ 'red-label': record?.options?.requiredFirst ||record?.rules?.find(f=>f.required)}"
-        :label-col="
+                 :label-col="
         formConfig.layout === 'horizontal'
           ? formConfig.labelLayout === 'flex'
             ? { style: `width:${formConfig.labelWidth}px` }
             : formConfig.labelCol
           : {}
       "
-        :wrapper-col="
+                 :wrapper-col="
         formConfig.layout === 'horizontal' ? (formConfig.labelLayout === 'flex' ? { style: 'width:auto;flex:1' } : formConfig.wrapperCol) : {}
       "
-        :style="formConfig.layout === 'horizontal' && formConfig.labelLayout === 'flex' ? { display: 'flex' } : {}"
-        :name="record.model"
-        :rules="record.rules"
+                 :style="formConfig.layout === 'horizontal' && formConfig.labelLayout === 'flex' ? { display: 'flex' } : {}"
+                 :name="record.model"
+                 :rules="record.rules"
     >
       <template #label>
         <a-tooltip>

+ 0 - 1
src/views/flow/stFormDesign/packages/StChangeOption/index.vue

@@ -161,7 +161,6 @@ export default {
             eventKey
           },
         ];
-        console.log(addData,'add')
         this.$emit('update:value', addData);
       }
     },

+ 7 - 6
src/views/flow/stFormDesign/packages/StFormDesign/module/jsModal.vue

@@ -343,12 +343,13 @@ export default {
             } else if (type == '2') {
               this.editorJsCode = `
 //固定写法
-((bizObj) => {
-  const  {rule, value, resolve, reject} = bizObj;
-  console.log("bizObj", bizObj);
-  resolve();
-  // reject("错误信息")
-})(bizObj)
+const { rule, value } = bizObj;
+rule.message = '错误信息'
+if (value == '1') {
+    return true//通过校验
+} else {
+    return false//没有通过校验
+}
 
 `
             }

+ 29 - 18
src/views/flow/stFormDesign/packages/StFormItem/index.vue

@@ -102,12 +102,14 @@
           " :formatter="value => record.options.thousandth == true && value != '' ?
             `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',') : value" :allowClear="record.options.clearable"
                  tree-node-filter-prop="label" :dynamicData="dynamicData" :treeData="computedOptions"
-                 :options="computedOptions" :mode="record.options.multiple ? 'multiple' : ''" @change="handleChange($event, record.model, record)"
+                 :options="computedOptions" :mode="record.options.multiple ? 'multiple' : ''"
+                 @change="handleChange($event, record.model, record)"
                  :is="componentItem" v-model:value="formData[record.model]"
                  :placeholder="(disabled || record.options.disabled) ? '' : record.options.placeholder"></component>
     </a-form-item>
     <!-- 可隐藏label -->
-    <a-form-item :class="{ 'red-label': record?.options?.requiredFirst ||record?.rules?.find(f=>f.required)}" v-else-if="['batch', 'selectInputList'].includes(record.type)"
+    <a-form-item :class="{ 'red-label': record?.options?.requiredFirst ||record?.rules?.find(f=>f.required)}"
+                 v-else-if="['batch', 'selectInputList'].includes(record.type)"
                  :label="!record.options.showLabel ? '' : record.label" :label-col="formConfig.layout === 'horizontal' && record.options.showLabel
         ? formConfig.labelLayout === 'flex'
           ? { style: `width:${formConfig.labelWidth}px` }
@@ -161,7 +163,8 @@
     <!-- html -->
     <div :id="record.key" v-else-if="record.type === 'html'" v-html="record.options.defaultValue"></div>
     <!-- 弹出框 -->
-    <PopUpQuery v-else-if="record.type === 'popUpSelect'" :options="computedOptions" :dynamicData="dynamicData" :disabled="disabled || record.options.disabled" :readonly="record.options.readonly"
+    <PopUpQuery v-else-if="record.type === 'popUpSelect'" :options="computedOptions" :dynamicData="dynamicData"
+                :disabled="disabled || record.options.disabled" :readonly="record.options.readonly"
                 :placeholder="(disabled || record.options.disabled) ? '' : record.options.placeholder"
                 @change="handleChange"
                 :formConfig="formConfig" :record="record" :formData="formData"
@@ -197,7 +200,8 @@ import {getDynamicData} from "/@/api/flow/formApi.js";
 
 import {getRulesFunc} from "../../packages/core/contant";
 import {useFlowStore} from '/@/store/modules/flow';
-import { PROVINCE_CITY_DISTRICT } from '/@/views/flow/stFormDesign/province-city-district.js';
+import {PROVINCE_CITY_DISTRICT} from '/@/views/flow/stFormDesign/province-city-district.js';
+
 export default {
   name: "StFormItem",
   props: {
@@ -254,9 +258,9 @@ export default {
   },
   computed: {
     computedOptions() {
-      if (this.record.options.area==true){
+      if (this.record.options.area == true) {
         return PROVINCE_CITY_DISTRICT
-      }      else if (!this.record.options.dynamic) {
+      } else if (!this.record.options.dynamic) {
         return this.record.options.options || [];
       } else if (this.record.options.dynamicOptions) {
         return this.record.options.dynamicOptions;
@@ -292,11 +296,14 @@ export default {
               if (rule.keyCode == 'custom') {
                 if (stScriptCodeList != null) {
                   const ruleCode = stScriptCodeList.find(v => v.objectid == rule.eventKey);
-                  rule.validator = (rule, value) => {
-                    return new Promise((resolve, reject) => {
-                      new Function('bizObj', ruleCode.scriptValue).call({}, {rule, value, resolve, reject})
-                    })
-                  }
+                  const fn = new Function('bizObj', ruleCode.scriptValue);
+                  rule.validator = async (rule, value, callback) => {
+                    const result = fn({rule, value});
+                    if (!result) {
+                      return Promise.reject(callback(new Error('')));
+                    }
+                    return Promise.resolve(callback());
+                  };
                 }
               } else {
                 const {validator} = getRulesFunc(rule.keyCode);
@@ -305,19 +312,22 @@ export default {
             }
           });
         }
-        if (this.$refs.StBatch){
+        if (this.$refs.StBatch) {
           this.$refs.StBatch.record.list.forEach((item, index) => {
-            item.rules.forEach((rule,i)=>{
+            item.rules.forEach((rule, i) => {
               if (rule.flag == "Internal") {
                 if (rule.keyCode) {
                   if (rule.keyCode == 'custom') {
                     if (stScriptCodeList != null) {
                       const ruleCode = stScriptCodeList.find(v => v.objectid == rule.eventKey);
-                      rule.validator = (rule, value) => {
-                        return new Promise((resolve, reject) => {
-                          new Function('bizObj', ruleCode.scriptValue).call({}, {rule, value, resolve, reject})
-                        })
-                      }
+                      const fn = new Function('bizObj', ruleCode.scriptValue);
+                      rule.validator = async (rule, value, callback) => {
+                        const result = fn({rule, value});
+                        if (!result) {
+                          return Promise.reject(callback(new Error('')));
+                        }
+                        return Promise.resolve(callback());
+                      };
                     }
                   } else {
                     const {validator} = getRulesFunc(rule.keyCode);
@@ -413,6 +423,7 @@ export default {
 .anticon.anticon-question-circle-o {
   margin-left: 5px;
 }
+
 ::v-deep(.red-label .ant-form-item-label > label) {
   color: red;
 }

+ 5 - 4
src/views/flow/stFormWork/components/headerInfo/mobileIndex.vue

@@ -73,6 +73,7 @@ const imgStates = ref([{
   border-bottom-left-radius: 8px;
   border-bottom-right-radius: 8px;
   padding-left: 58px;
+  margin-top:-10px;
 
 
   .dx-label {
@@ -93,10 +94,10 @@ const imgStates = ref([{
 
   .mvc-state {
     position: absolute;
-    margin-left: 280px;
-    margin-top: 90px;
-    width: 80px;
-    height: 80px;
+    margin-left: 290px;
+    margin-top: 100px;
+    width: 70px;
+    height: 70px;
     z-index: 999;
 
     img {