فهرست منبع

处理表格联动添加数据缺失问题

lph 1 سال پیش
والد
کامیت
ea84669523

+ 18 - 2
ruoyi-ui/src/views/relateTable/components/RelateTableCard.vue

@@ -98,6 +98,7 @@ import {
 import { inputDisableComplete } from "@/utils/other";
 
 import { camelCase } from "@/utils";
+import { CloudFog } from "lucide-vue";
 export default {
   name: "RelateTableCard",
   props: ["cardData", "index", "tableKey", "sort"],
@@ -198,6 +199,7 @@ export default {
     // 根据tablekey请求数据表头数据
     async gettableListHandler(tableKey, paramsContion = [], defaultVal = {}) {
       const res = await dragTableInfo({ queryMap: { tableKey: tableKey } });
+
       this.getTableHandle(res, (paramsContion = []), (defaultVal = {}));
     },
     // 处理表格表头
@@ -212,7 +214,6 @@ export default {
       this.queryParams.isAsc = this.sortOrder ? "DESC" : "ASC";
       this.tableName = this.templateInfo.template.dtTableName;
       this.dtName = this.templateInfo.template.dtName;
-
       // 得到查询条件
       this.queryFromWhere = res.data.resultMap.where;
       //  得到当前列表表头信息
@@ -401,7 +402,10 @@ export default {
             }
           } else {
             // data;
-            console.log(this.myContion);
+            let defaultData = this.getDefaultData();
+            data.addListMap.forEach((item) => {
+              Object.assign(item, defaultData);
+            });
             let res = await addTableData(data);
             if (res.code == 200) {
               this.$modal.msgSuccess("添加成功");
@@ -424,9 +428,21 @@ export default {
           this.open = false;
         })
         .catch((res) => {
+          console.log(res);
           this.$modal.msgError("表单校验失败,请规范填写数据");
         });
     },
+    getDefaultData() {
+      console.log(this.queryFromWhere);
+      console.log(this.preRow);
+      let res = {};
+      this.queryFromWhere.forEach((item) => {
+        let { conditionDefaultValue, conditionField } = item;
+        res[camelCase(conditionField.split(".")[1])] =
+          this.preRow[conditionDefaultValue.split(".")[1]];
+      });
+      return res;
+    },
     // 取消按钮
     cancel() {
       this.open = false;

+ 4 - 0
ruoyi-ui/src/views/system/bpmnPro/components/Panel/components/ElementExecuteForm.vue

@@ -96,6 +96,10 @@ export default {
             label: "定制表单",
             value: "1",
           },
+          {
+            label: "空白表单",
+            value: "2",
+          },
         ],
       });
       try {