Explorar o código

拖拽表格添加保存所有表格字段/按钮管理添加自定义条件数据

lph hai 1 ano
pai
achega
f192f68f7a

+ 174 - 36
zkqy-ui/src/views/system/excuteBtnMange/index.vue

@@ -323,7 +323,11 @@
                 </el-select>
               </el-form-item>
 
-              <el-form-item label="绑定表单" prop="btnFormKey">
+              <el-form-item
+                v-if="this.btnGroupFormData.btnFormType != 'noNeed'"
+                label="绑定表单"
+                prop="btnFormKey"
+              >
                 <el-select
                   v-model="btnGroupFormData.btnFormKey"
                   placeholder="请选择表单"
@@ -470,14 +474,12 @@
                       : "query"
                   }}参数</span
                 > -->
-                <el-divider content-position="center"
-                  >{{
-                    btnGroupFormData.btnType != "OUTLINK" &&
-                    btnGroupFormData.btnType != "INNERLINK"
-                      ? "公共"
-                      : "query"
-                  }}参数</el-divider
-                >
+                <el-divider content-position="center">{{
+                  btnGroupFormData.btnType != "OUTLINK" &&
+                  btnGroupFormData.btnType != "INNERLINK"
+                    ? "默认修改字段"
+                    : "query参数"
+                }}</el-divider>
                 <el-table :data="commonFieldData" style="width: 100%">
                   <el-table-column label="序号" type="index" width="50">
                   </el-table-column>
@@ -493,19 +495,21 @@
                         placeholder="请选择"
                       >
                         <el-option
-                          v-for="item in rootFieldInfo.fieldList"
-                          :key="item.value"
+                          v-for="(item, index) in rootFieldInfo.fieldList"
+                          :key="index"
                           :label="item.value"
-                          :value="item.key"
+                          :value="item.tableName + '.' + item.key"
                         >
-                          <span style="float: left">{{ item.value }}</span>
+                          <span class="descibe" style="float: left">{{
+                            item.value
+                          }}</span>
                           <span
                             style="
                               float: right;
                               color: #8492a6;
                               font-size: 13px;
                             "
-                            >{{ item.key }}</span
+                            >{{ item.tableName + "." + item.key }}</span
                           >
                         </el-option>
                       </el-select>
@@ -571,6 +575,94 @@
               <!-- </el-form-item> -->
             </el-col>
           </template>
+          <!-- 条件参数 -->
+          <div class="filter-table-wrap" style="width: 100%">
+            <el-divider content-position="center">条件参数</el-divider>
+            <el-table :data="conditionData" style="width: 100%">
+              <el-table-column label="序号" type="index" width="50">
+              </el-table-column>
+              <el-table-column
+                prop="fieldName"
+                label="字段名"
+                width="150"
+                align="center"
+              >
+                <template slot-scope="scope">
+                  <el-select v-model="scope.row.fieldName" placeholder="请选择">
+                    <el-option
+                      v-for="(item, index) in rootFieldInfo.fieldList"
+                      :key="index"
+                      :label="item.value"
+                      :value="item.tableName + '.' + item.key"
+                    >
+                      <span class="descibe" style="float: left">{{
+                        item.value
+                      }}</span>
+                      <span
+                        style="float: right; color: #8492a6; font-size: 13px"
+                        >{{ item.tableName + "." + item.key }}</span
+                      >
+                    </el-option>
+                  </el-select>
+                </template>
+              </el-table-column>
+              <el-table-column
+                prop="flagValue"
+                label="默认值"
+                width="150"
+                align="center"
+              >
+                <template slot="header" slot-scope="">
+                  默认值
+                  <el-tooltip
+                    class="item"
+                    effect="dark"
+                    content="不设置默认值时,默认为当前行的该字段"
+                    placement="top-start"
+                  >
+                    <i class="el-icon-info"></i>
+                  </el-tooltip>
+                </template>
+                <template slot-scope="scope">
+                  <!-- <el-button
+                          type="info"
+                          size="small"
+                          icon="el-icon-edit"
+                          @click="editFlagHandler(scope.row, scope.$index)"
+                        >
+                        </el-button> -->
+                  <el-input
+                    v-model="scope.row.fieldValue"
+                    placeholder="请输入默认值"
+                    size="normal"
+                    clearable
+                  >
+                  </el-input>
+                </template>
+              </el-table-column>
+              <el-table-column label="操作" align="center">
+                <template slot-scope="scope">
+                  <el-button
+                    size="mini"
+                    type="danger"
+                    icon="el-icon-delete"
+                    @click="deleteConditionItem(scope.$index)"
+                    >删除
+                  </el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+            <el-button
+              type="primary"
+              class="inline-large-button mb10"
+              icon="el-icon-plus"
+              size="mini"
+              style="width: 100%"
+              @click="addConditionItem"
+            >
+              添加条件
+            </el-button>
+          </div>
           <!-- 按钮隐藏条件 -->
           <div class="filter-table-wrap" style="width: 100%">
             <!-- <span class="title mb10">按钮隐藏条件</span> -->
@@ -587,15 +679,17 @@
                 <template slot-scope="scope">
                   <el-select v-model="scope.row.fieldName" placeholder="请选择">
                     <el-option
-                      v-for="item in rootFieldInfo.fieldList"
-                      :key="item.value"
+                      v-for="(item, index) in rootFieldInfo.fieldList"
+                      :key="index"
                       :label="item.value"
-                      :value="item.key"
+                      :value="item.tableName + '.' + item.key"
                     >
-                      <span style="float: left">{{ item.value }}</span>
+                      <span class="descibe" style="float: left">{{
+                        item.value
+                      }}</span>
                       <span
                         style="float: right; color: #8492a6; font-size: 13px"
-                        >{{ item.key }}</span
+                        >{{ item.tableName + "." + item.key }}</span
                       >
                     </el-option>
                   </el-select>
@@ -768,13 +862,21 @@ export default {
       },
       // 表单类型
       formTypeOptions: [
+        {
+          label: "不需表单",
+          value: "noNeed",
+        },
         {
           label: "单独表单",
-          value: "1",
+          value: "single",
         },
         {
           label: "表单组",
-          value: "2",
+          value: "multiple",
+        },
+        {
+          label: "其它",
+          value: "other",
         },
       ],
       // 按钮组表单数据
@@ -784,7 +886,7 @@ export default {
         btnName: "", //按钮显示的文字
         btnIcon: "", //按钮图标
         btnType: "DIRECTORY", //0:操作按钮,1,其他,2表单,3内链,4流程,5脚本, 6,目录, 7:外链
-        btnFormType: "1", //表单类型  1:单独表单 2:表单组
+        btnFormType: "noNeed", //表单类型
         btnFormKey: null, //表单唯一标识
         btnProcessKey: "", //流程唯一标识
         btnTableKey: "", //表格唯一标识
@@ -879,6 +981,13 @@ export default {
         //   refValue: "", //参考值
         // },
       ],
+      // 条件参数
+      conditionData: [
+        {
+          fieldName: "",
+          fieldValue: "",
+        },
+      ],
       rootFieldInfo: {
         tableName: "",
         fieldList: [],
@@ -938,9 +1047,9 @@ export default {
   },
   computed: {
     formList() {
-      if (this.btnGroupFormData.btnFormType === "1") {
+      if (this.btnGroupFormData.btnFormType === "single") {
         return this.formOptions;
-      } else {
+      } else if (this.btnGroupFormData.btnFormType === "multiple") {
         return this.groupFormOptions;
       }
     },
@@ -986,6 +1095,10 @@ export default {
     deleteQueryItem(index) {
       this.queryTableData.splice(index, 1);
     },
+    // 删除条件参数
+    deleteConditionItem(index) {
+      this.conditionData.splice(index, 1);
+    },
     // 添加公共传参
     addFilterHandler() {
       if (this.rootFieldInfo.fieldList.length == 0) {
@@ -997,6 +1110,16 @@ export default {
         fieldValue: "",
       });
     },
+    addConditionItem() {
+      if (this.rootFieldInfo.fieldList.length == 0) {
+        this.$message.error("请先将按钮组绑定给表格");
+        return;
+      }
+      this.conditionData.push({
+        fieldName: "",
+        fieldValue: "",
+      });
+    },
     // 添加按钮隐藏条件
     addBtnHidenCondition() {
       if (this.rootFieldInfo.fieldList.length == 0) {
@@ -1022,21 +1145,30 @@ export default {
             queryMap: { tableKey: res.rows[0].tableKey },
           });
           this.rootFieldInfo.fieldList = this.columnsHandler(
-            JSON.parse(tableInfo.data.resultMap.template.dtColumnName)
+            JSON.parse(tableInfo.data.resultMap.template.spare)
           );
         }
       }
     },
+
     // 处理列表信息
     columnsHandler(columns) {
       let resArr = [];
       columns.forEach((item) => {
-        for (const key in item) {
-          let tempObj = {};
-          tempObj.key = camelCase(key);
-          tempObj.value = item[key];
-          resArr.push(tempObj);
-        }
+        // for (const key in item) {
+        //   let tempObj = {};
+        //   tempObj.key = camelCase(key);
+        //   tempObj.value = item[key];
+        //   resArr.push(tempObj);
+        // }
+      });
+      resArr = columns.map((item) => {
+        let { fieldName, fieldDescription, tableName } = item;
+        return {
+          key: fieldName,
+          value: fieldDescription,
+          tableName: tableName,
+        };
       });
       return resArr;
     },
@@ -1140,7 +1272,7 @@ export default {
         btnType: "DIRECTORY", //0:操作按钮,1,其他,2表单,3跳转,4流程,5脚本
         btnFormKey: null, //表单唯一标识
         btnProcessKey: "", //流程唯一标识
-        btnFormType: "1",
+        btnFormType: "noNeed",
         btnTableKey: "", //表格唯一标识
         btnScriptKey: "", //脚本唯一标识
         btnShowCondition: "", //按钮显示条件
@@ -1202,7 +1334,11 @@ export default {
           response.data.btnParams = tempObj.url;
           this.commonFieldData = JSON.parse(tempObj.commonFieldData) || [];
         } else {
-          btnParams && (this.commonFieldData = JSON.parse(btnParams) || []);
+          if (btnParams) {
+            this.commonFieldData = JSON.parse(btnParams)?.commonFieldData || [];
+            this.conditionData = JSON.parse(btnParams)?.conditionData || [];
+          }
+          // btnParams && (this.commonFieldData = JSON.parse(btnParams) || []);
         }
         this.btnHidenCondtionData = [];
         if (btnShowCondition) {
@@ -1248,9 +1384,11 @@ export default {
             this.btnGroupFormData.btnType != "OUTLINK" &&
             this.btnGroupFormData.btnType != "INNERLINK"
           ) {
-            this.btnGroupFormData.btnParams = JSON.stringify(
-              this.commonFieldData
-            );
+            let temp = {
+              commonFieldData: this.commonFieldData,
+              conditionData: this.conditionData,
+            };
+            this.btnGroupFormData.btnParams = JSON.stringify(temp);
           } else {
             let tempObj = {};
             tempObj.url = this.btnGroupFormData.btnParams;

+ 17 - 3
zkqy-ui/src/views/tableMange/index.vue

@@ -1414,7 +1414,8 @@ export default {
       tableFieldList,
       columns,
       searchFieldList = [],
-      tableExportField = {}
+      tableExportField = {},
+      allColumns = []
     ) {
       if (!tableFieldList.length) return;
       for (let i = 0; i < tableFieldList.length; i++) {
@@ -1429,6 +1430,14 @@ export default {
           tempFieldName = temp.tableName + "_" + temp.fieldName;
           exportFieldName = temp.tableName + "_" + temp.fieldName;
         }
+        // 保存所有字段
+        let obj = {
+          tableName: temp.tableName,
+          fieldName: temp.fieldName,
+          fieldDescription: temp.fieldDescription,
+        };
+        allColumns.push(obj);
+
         if (temp.isShow) {
           let tempObj = {};
           // if (temp.isChildren) {
@@ -1555,12 +1564,15 @@ export default {
           }
           let columns = [],
             searchFieldList = [],
-            tableExportField = {};
+            tableExportField = {},
+            allColumns = [];
+
           this.getCol(
             this.tableFieldList,
             columns,
             searchFieldList,
-            tableExportField
+            tableExportField,
+            allColumns
           );
 
           let echoData = {
@@ -1688,6 +1700,8 @@ export default {
               tableExportField: tableExportField, //导出字段名及列名
               echoData: JSON.stringify(echoData),
 
+              spare: JSON.stringify(allColumns), //所有字段数据
+
               // 样式相关数据
               dragTableStyleList: this.$refs.styleTableRef.getSaveData(),
             };