whj 11 meses atrás
pai
commit
6284a72a23

+ 10 - 8
src/views/custom/form/CustomForm.vue

@@ -94,17 +94,17 @@ export default {
           dataIndex: 'name',
         },
         {
-          title: '表单类型',
-          dataIndex: 'type',
+          title: '模板分类',
+          dataIndex: 'category',
           customRender: (text, record, index) => {
-            return this.BaseTool.Table.getMapText(this.typeMap, text)
+            return this.BaseTool.Table.getMapText(this.categoryMap, text)
           },
         },
         {
-          title: '模板分类',
-          dataIndex: 'category',
+          title: '表单类型',
+          dataIndex: 'type',
           customRender: (text, record, index) => {
-            return this.BaseTool.Table.getMapText(this.categoryMap, text)
+            return this.childrenMaps[record.category][text]
           },
         },
         {
@@ -164,13 +164,15 @@ export default {
       },
       optionAlertShow: false,
       categoryMap: {},
-      typeMap: {},
+      childrenMaps: [],
     }
   },
   created() {
     // 下拉框map
-    this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CUSTOM_FORM_TYPE)
     this.categoryMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CATEGORY_TYPE)
+    this.DictCache.getChildrenList(this.DictCache.TYPE.CATEGORY_TYPE).forEach((item) => {
+      this.childrenMaps[item.value] = this.DictCache.getLabelByValueMapByType(item.code)
+    })
     this.tableOption()
     getCustomTree().then((res) => {
       this.treeData = this.setTree(res.data)

+ 17 - 4
src/views/custom/form/modules/BaseForm.vue

@@ -99,6 +99,9 @@ export default {
       queryFields: [],
       formComponentConfig: {
         components: [],
+        config: {
+          layout: 2,
+        },
       },
       workFlowList: [],
     }
@@ -142,9 +145,9 @@ export default {
       // 日期处理
       this.formValue = record
       this.queryFields = this.formValue.queryFields.map((item) => item.fieldName)
+      this.formComponentConfig = JSON.parse(record.jsonString)
       this.$nextTick(() => {
         setFieldsValue(Object.assign(pick(record, ['id', 'type', 'name', 'category', 'remark'])))
-        this.$refs.formComponent.base(record.jsonString)
       })
     },
     next() {
@@ -160,12 +163,16 @@ export default {
             }
             // 日期处理
             this.current++
-            this.formValue = values
+            this.formValue = {
+              ...this.formValue,
+              ...values,
+            }
           })
+          this.$refs.formComponent.base(this.formComponentConfig)
           break
         case 1:
           this.formComponentConfig = {
-            components: this.$refs.formComponent.list2,
+            components: this.$refs.formComponent.components,
             config: this.$refs.formComponent.config,
           }
           this.current++
@@ -214,7 +221,13 @@ export default {
       this.confirmLoading = false
       this.type = 0
       this.current = 0
-      this.formValue = { queryFields: [] }
+      this.formValue = { queryFields: [], flowId: '' }
+      this.formComponentConfig = {
+        components: [],
+        config: {
+          layout: 2,
+        },
+      }
       this.form.resetFields()
       if (this.BaseTool.Object.isNotBlank(values)) {
         this.$emit('ok', values)

+ 10 - 11
src/views/custom/form/modules/component/index.vue

@@ -32,8 +32,8 @@
       <a-card>
         <a-form :form="form" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
           <a-row>
-            <VueDraggable v-model="list2" :animation="150" group="people" style="min-height:600px">
-              <MComponent class="hover" v-for="item in list2" :key="item.id" :config="config" :detail="item" @select="handleSelect" @selectInfo="handleInfoSelect" />
+            <VueDraggable v-model="components" :animation="150" group="people" style="min-height:600px">
+              <MComponent class="hover" v-for="item in components" :key="item.id" :config="config" :detail="item" @select="handleSelect" @selectInfo="handleInfoSelect" />
             </VueDraggable>
           </a-row>
         </a-form>
@@ -66,7 +66,7 @@ export default {
       form: this.$form.createForm(this),
       componentBaseList,
       componenHidetList,
-      list2: [],
+      components: [],
       num: 1,
       detail: {},
       config: {
@@ -77,12 +77,12 @@ export default {
   provide() {
     return {
       getFormList: () => {
-        return this.list2
+        return this.components
       },
     }
   },
   watch: {
-    list2: {
+    components: {
       deep: true,
       handler(val) {
         this.num++
@@ -94,10 +94,9 @@ export default {
     this.handleSelect({}, this.config)
   },
   methods: {
-    base(json) {
-      const jsonData = JSON.parse(json)
-      this.list2 = jsonData.components
-      this.config = jsonData.config
+    base(record) {
+      this.components = record.components
+      this.config = record.config
     },
     onClone(element) {
       // 生成随机id
@@ -114,7 +113,7 @@ export default {
     },
     addForm(val) {
       val.forEach((item) => {
-        this.list2.push({
+        this.components.push({
           id: item.bind,
           name: '单行文本',
           type: 'input',
@@ -130,7 +129,7 @@ export default {
       })
     },
     handleDelete(val) {
-      this.list2 = this.list2.filter((v) => v.id !== val.id)
+      this.components = this.components.filter((v) => v.id !== val.id)
     },
     handleSubmit() {
       const {