Browse Source

fix: 修复改变表单字段类型的bug

liuc 3 months ago
parent
commit
9ccfcd6847

+ 1 - 1
src/views/flow/setting/queryService.vue

@@ -53,7 +53,7 @@
           <a-textarea v-model:value="record.querySql" :rows="8"></a-textarea>
         </a-col>
         <a-col v-show="record.queryType=='1'" :span="22">
-          <a-input v-model:value="record.querySql"  placeholder="示例(全局搜索后端“/queryTest”):/setting/engine/queryTest" ></a-input>
+          <a-input v-model:value="record.querySql"  placeholder="示例(全局搜索后端“/queryTest”):/demo/engine/queryTest" ></a-input>
         </a-col>
       </a-row>
       <a-button class="addBtn" @click="addChild">新增子项</a-button>

+ 2 - 2
src/views/flow/stFormDesign/packages/StFormDesign/module/formComponentPanel.vue

@@ -272,8 +272,7 @@ export default defineComponent({
             const model = element.model
             const event = element.event
             const id = element.id
-            const key = element.key
-            const selectLabel = basicsList.filter(item => item.type === formNodeSelectType)[0]
+            const selectLabel = JSON.parse(JSON.stringify(basicsList.filter(item => item.type === formNodeSelectType)[0]))
             for (const key in element) {
               if (element.hasOwnProperty(key)) {
                 delete element[key];
@@ -287,6 +286,7 @@ export default defineComponent({
             element.event = event
             element.id = id
             element.key = element.type + '_' + new Date().getTime();
+            console.log(element, 'element')
             this.handleSelectItem(element);
           }
         }

+ 10 - 9
src/views/flow/stFormDesign/packages/StFormDesign/module/formNode.vue

@@ -8,7 +8,8 @@
       :class="{ active: record.key === selectItem.key }"
   >
     <div class="form-item-box">
-      <StFormItem :formConfig="config" :formData='{}' :record="record" :childTableFieldRecord='childTableFieldRecord' :isDesign="true"/>
+      <StFormItem :formConfig="config" :formData='{}' :record="record" :childTableFieldRecord='childTableFieldRecord'
+                  :isDesign="true"/>
     </div>
     <div
         v-if="!hideModel"
@@ -138,11 +139,11 @@ export default {
       if (newVal == "input") {
         //短文本输入框
         const types = ['STRING'];
-        mayBeSelects = ['input', 'select', 'radio', 'treeSelect', 'popUpSelect','checkbox','deptAndPersonSelect']
+        mayBeSelects = ['input', 'select', 'radio', 'treeSelect', 'popUpSelect', 'checkbox', 'deptAndPersonSelect']
       } else if (newVal == "select") {
         //下拉选择
         const types = ['STRING', 'MULTI'];
-        mayBeSelects = ['input', 'select', 'radio', 'treeSelect', 'popUpSelect', 'checkbox','deptAndPersonSelect']
+        mayBeSelects = ['input', 'select', 'radio', 'treeSelect', 'popUpSelect', 'checkbox', 'deptAndPersonSelect']
       } else if (newVal == "textarea") {
         //多行输入框
         const types = ['TEXT'];
@@ -190,15 +191,15 @@ export default {
       } else if (newVal == "deptAndPersonSelect") {
         //人,组织
         const types = ['SINGLE', 'MULTI'];
-        mayBeSelects = ['input', 'select', 'radio', 'treeSelect', 'popUpSelect', 'checkbox','deptAndPersonSelect']
+        mayBeSelects = ['input', 'select', 'radio', 'treeSelect', 'popUpSelect', 'checkbox', 'deptAndPersonSelect']
       } else if (newVal == "popUpSelect") {
         //弹出选择框
         const types = ['STRING', 'MULTI'];
-        mayBeSelects = ['input', 'select', 'radio', 'treeSelect', 'popUpSelect', 'checkbox','cascader']
+        mayBeSelects = ['input', 'select', 'radio', 'treeSelect', 'popUpSelect', 'checkbox', 'cascader']
       } else if (newVal == "cascader") {
         //级联选择
-        const types = [ 'MULTI'];
-        mayBeSelects = [ 'select',  'treeSelect', 'popUpSelect', 'checkbox','cascader']
+        const types = ['MULTI'];
+        mayBeSelects = ['select', 'treeSelect', 'popUpSelect', 'checkbox', 'cascader']
       } else if (newVal == "batch") {
         //子表
         const types = ['CHILDREN'];
@@ -210,14 +211,14 @@ export default {
       } else {
         mayBeSelects = this.validType
       }
-
-      this.formNodeSelectItems = basicsList.filter(item => {
+      const items = basicsList.filter(item => {
         if (this.validType.includes(item.type) && mayBeSelects.includes(item.type)) {
           return true;
         } else {
           return false;
         }
       })
+      this.formNodeSelectItems = JSON.parse(JSON.stringify(items))
       this.selectItemValue = this.selectItem.type
     },
   }

+ 0 - 3
src/views/flow/stFormSetting/index.vue

@@ -51,9 +51,6 @@
         );
         getFormTemplate({ flowCode: this.currentFlowModal.flowCode }).then(
           (res) => {
-            console.log(res.data,'res.data')
-            console.log(initJsonContent,'initJsonContent')
-
             if (res.data !== null) {
               //如果有数据则直接加载
               self.$refs.formDesign.data = JSON.parse(res.data.content);