Prechádzať zdrojové kódy

feat:共通表格按钮查询相关逻辑

韩帛霖 1 rok pred
rodič
commit
17076c0967

+ 33 - 26
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/service/impl/CommonServiceImpl.java

@@ -274,41 +274,48 @@ public class CommonServiceImpl implements ICommonService {
         //前端传递过来的参数
         Map<String, Object> queryMap = commonEntity.getQueryMap();
         //是否存在
-        AtomicReference<Boolean> isExist = new AtomicReference<>(true);
+//        AtomicReference<Boolean> isExist = new AtomicReference<>(true);
         //循环前端传过来的参数 跳过 sqlkey
         AtomicReference<String> replaceSql = new AtomicReference<>(tableSql.getTableCondition());
-        queryMap.forEach((k, v) -> {
-            if (!k.equals("sqlkey") && !k.equals("queryCriteriaValue")) { //查询第一个表的数据是不会进行任何替换的
-                int isExistIndex = tableSql.getTableCondition().indexOf(k);
-                replaceSql.set(tableSql.getTableCondition().replace(k, v.toString()));
-                if (isExistIndex < 0) {
-                    isExist.set(false);
-                }
-            }
-        });
-        //证明条件不对应不能让他进行查询
-        if (!isExist.get()) {
-            List<CommonEntity> commonEntityList = new ArrayList<>();
-            CommonEntity common = new CommonEntity();
-            HashMap<String, Object> hashMap = new HashMap();
-            hashMap.put("err", "查询条件不匹配查询失败");
-            common.setResultMap(hashMap);
-            commonEntityList.add(common);
-            return commonEntityList;
-        }
+//        queryMap.forEach((k, v) -> {
+//            if (!k.equals("sqlkey") && !k.equals("queryCriteriaValue")) { //查询第一个表的数据是不会进行任何替换的
+//                int isExistIndex = tableSql.getTableCondition().indexOf(k);
+//                replaceSql.set(tableSql.getTableCondition().replace(k, v.toString()));
+//                if (isExistIndex < 0) {
+//                    isExist.set(false);
+//                }
+//            }
+//        });
+//        //证明条件不对应不能让他进行查询
+//        if (!isExist.get()) {
+//            List<CommonEntity> commonEntityList = new ArrayList<>();
+//            CommonEntity common = new CommonEntity();
+//            HashMap<String, Object> hashMap = new HashMap();
+//            hashMap.put("err", "查询条件不匹配查询失败");
+//            common.setResultMap(hashMap);
+//            commonEntityList.add(common);
+//            return commonEntityList;
+//        }
+
+
         Map<String, Object> conditions = JSONObject.parseObject(JSON.toJSONString(commonEntity.getQueryMap()));
         //正常的查询
-        String queryCriteriaValue =
-                conditions.containsKey("queryCriteriaValue") == true
-                        ? conditions.get("queryCriteriaValue").toString() : "";
+        String queryCriteriaValue = conditions.containsKey("queryCriteriaValue") ? conditions.get("queryCriteriaValue").toString() : "";
         String endSQL = replaceSql.get().replace("#{val}", queryCriteriaValue);
-        String sqlString = tableSql.getTableSql() + " where " + endSQL;
+        queryMap.remove("sqlkey");
+        queryMap.remove("queryCriteriaValue");
+        AtomicReference<String> equivalent = new AtomicReference<>("");
+        queryMap.forEach((k, v) -> {
+            String querySqlWhere = equivalent.get() + " and " + k + " = " + v;
+            equivalent.set(querySqlWhere);
+        });
+        String sqlString = tableSql.getTableSql() + " where " + endSQL + equivalent.get();
         List<CommonEntity> commonEntities = commonMapper.queryTableList(sqlString);
         //根据sqlKey查询表格数据
         commonEntities.forEach(item -> {
             Map<String, Object> resultMap = item.getResultMap();
             resultMap.forEach((k, v) -> {
-                if (StringUtils.isNotNull(v) && !v.toString().isEmpty()) {
+                if (isNotNull(v) && !v.toString().isEmpty()) {
                     //正则匹配成功
                     boolean validDateTimeFormat = isValidDateTimeFormat(v.toString());
                     if (validDateTimeFormat) {
@@ -374,7 +381,7 @@ public class CommonServiceImpl implements ICommonService {
         commonEntities.forEach(item -> {
             Map<String, Object> resultMap = item.getResultMap();
             resultMap.forEach((k, v) -> {
-                if (StringUtils.isNotNull(v) && !v.toString().isEmpty()) {
+                if (isNotNull(v) && !v.toString().isEmpty()) {
                     //正则匹配成功
                     boolean validDateTimeFormat = isValidDateTimeFormat(v.toString());
                     if (validDateTimeFormat) {

+ 84 - 84
zkqy-ui/src/views/tablelist/commonTable/listInfo.vue

@@ -41,7 +41,7 @@
             :underline="false"
             style="font-size: 12px; vertical-align: baseline"
             @click="importTemplate"
-            >下载模板
+          >下载模板
           </el-link>
         </div>
       </el-upload>
@@ -66,7 +66,7 @@
           icon="el-icon-plus"
           size="mini"
           @click="handleAdd"
-          >新增
+        >新增
         </el-button>
       </el-col>
       <el-col :span="1.5" v-if="false">
@@ -77,7 +77,7 @@
           size="mini"
           :disabled="single"
           @click="handleUpdate"
-          >修改
+        >修改
         </el-button>
       </el-col>
       <el-col :span="1.5">
@@ -88,7 +88,7 @@
           size="mini"
           :disabled="multiple"
           @click="handleBatchDelete"
-          >删除
+        >删除
         </el-button>
       </el-col>
       <el-col :span="1.5">
@@ -97,7 +97,7 @@
           icon="el-icon-upload2"
           size="mini"
           @click="upload.open = true"
-          >导入
+        >导入
         </el-button>
       </el-col>
       <el-col :span="1.5">
@@ -107,7 +107,7 @@
           icon="el-icon-download"
           size="mini"
           @click="handleExport"
-          >导出
+        >导出
         </el-button>
       </el-col>
       <right-toolbar
@@ -161,7 +161,7 @@
                   :style="`color:${
                     scope.row.styleFieldObj[item.key].fontColor
                   }`"
-                  >{{ scope.row[item.key] }}</span
+                >{{ scope.row[item.key] }}</span
                 >
               </template>
               <!-- 标签字体样式 -->
@@ -191,7 +191,7 @@
                   scope.row.styleFieldObj[item.key].listClass == '' ||
                   scope.row.styleFieldObj[item.key].listClass == 'default'
                 "
-                >{{ scope.row.styleFieldObj[item.key].dictLabel }}</span
+              >{{ scope.row.styleFieldObj[item.key].dictLabel }}</span
               >
               <el-tag
                 v-else
@@ -200,7 +200,8 @@
                     ? ''
                     : scope.row.styleFieldObj[item.key].listClass
                 "
-                >{{ scope.row.styleFieldObj[item.key].dictLabel }}</el-tag
+              >{{ scope.row.styleFieldObj[item.key].dictLabel }}
+              </el-tag
               >
             </template>
           </template>
@@ -329,20 +330,20 @@ import {
   batchEdit,
   getStatisticList,
 } from "@/api/tablelist/commonTable";
-import { listData } from "@/api/system/tenant/data";
-import { getToken } from "@/utils/auth";
+import {listData} from "@/api/system/tenant/data";
+import {getToken} from "@/utils/auth";
 import Queryfrom from "@/views/tablelist/commonTable/queryfrom.vue";
-import { camelCase, toUnderline } from "@/utils";
-import { inputDisableComplete } from "@/utils/other";
+import {camelCase, toUnderline} from "@/utils";
+import {inputDisableComplete} from "@/utils/other";
 import Menu from "./BtnMenu.vue";
-import { checkRole } from "@/utils/permission";
+import {checkRole} from "@/utils/permission";
 import DialogTemplate from "@/views/dialogTemplate/components/index.vue";
 import FormList from "@/components/FormGroup/formList.vue";
-import { v4 as uuidv4 } from "uuid";
+import {v4 as uuidv4} from "uuid";
 
 export default {
   name: "listInfo",
-  components: { Queryfrom, Menu, DialogTemplate, FormList },
+  components: {Queryfrom, Menu, DialogTemplate, FormList},
   data() {
     return {
       // 绑定按钮dialog
@@ -385,7 +386,7 @@ export default {
         // 是否更新已经存在的数据
         updateSupport: 0,
         // 设置上传的请求头部
-        headers: { Authorization: "Bearer " + getToken() },
+        headers: {Authorization: "Bearer " + getToken()},
         // 上传的地址
         url: process.env.VUE_APP_BASE_API1 + "common/uploadData",
       },
@@ -472,7 +473,7 @@ export default {
     //     res = !this.excuteBtnArr?.every((arr) => arr.children.length == 0);
     //   }
     //   this.$nextTick(() => {
-    //     console.log(res);
+    //     // console.log(res);
     //     this.$refs.tableRef.doLayout();
     //   });
     //   return res;
@@ -481,7 +482,7 @@ export default {
   methods: {
     // test
     showValue() {
-      console.log(this.$refs.formGroupRef);
+      // console.log(this.$refs.formGroupRef);
       this.$refs.formGroupRef.setDefaultValue();
     },
     // 计算操作列的显示与隐藏
@@ -498,7 +499,7 @@ export default {
     getRowKey(row) {
       return row[
         camelCase(this.tableName + "_" + this.templateInfo.template?.primaryKey)
-      ];
+        ];
     },
     /** 查询列表 */
     getList(queryParams) {
@@ -506,8 +507,9 @@ export default {
       // 序列化当前查询参数列表
       queryParams && (this.queryParams.queryMap = queryParams.queryMap);
       // 获取当前表单结构信息
-      dragTableInfo({ queryMap: { tableKey: this.tableKey } })
+      dragTableInfo({"queryMap": {"tableKey": this.tableKey}})
         .then((res) => {
+          console.log(res);
           // 得到当前模版信息 --- sql columns queryWhere
           this.templateInfo = res.data.resultMap;
           this.styleList = res.data.resultMap.style?.map((item) => {
@@ -557,14 +559,8 @@ export default {
               }
               return kv;
             });
-            // this.setDictStyleData().then(() => {
-            //   this.tableList = this.setFieldStyleData(this.tableList);
-            // });
             this.tableList = await this.setFieldStyleData(tempTableList);
             this.total = res.total;
-            // this.$nextTick(() => {
-            //   this.$refs.tableRef?.clearSelection();
-            // });
             this.loading = false;
           });
 
@@ -646,9 +642,9 @@ export default {
       this.$refs.mychild.pageList(
         row == undefined
           ? {
-              limit: this.queryParams.pageSize,
-              page: this.queryParams.pageNum,
-            }
+            limit: this.queryParams.pageSize,
+            page: this.queryParams.pageNum,
+          }
           : row
       );
     },
@@ -660,7 +656,7 @@ export default {
             camelCase(
               this.tableName + "_" + this.templateInfo.template?.primaryKey
             )
-          ]
+            ]
       );
       this.single = selection.length != 1;
       this.multiple = !selection.length;
@@ -684,7 +680,7 @@ export default {
       // this.reset();
       this.defaultValue = {};
       this.formType = "dragForm";
-      getInfoBySqlKey(this.templateInfo.template.sqlKey).then(({ data }) => {
+      getInfoBySqlKey(this.templateInfo.template.sqlKey).then(({data}) => {
         if (!data || !data.dfVueTemplate) {
           this.jsonData = false;
           this.$message.error("当前表格未绑定表单!");
@@ -736,7 +732,8 @@ export default {
     // 延迟
     sleep(ms) {
       var unixtime_ms = new Date().getTime();
-      while (new Date().getTime() < unixtime_ms + ms) {}
+      while (new Date().getTime() < unixtime_ms + ms) {
+      }
       return "";
     },
     /** 修改按钮操作 */
@@ -763,8 +760,8 @@ export default {
 
       // 新的修改请求
       try {
-        console.log("btnData", btnData);
-        let { btnFormType } = btnData;
+        // console.log("btnData", btnData);
+        let {btnFormType} = btnData;
         this.formType = btnFormType;
         let payLoad = {};
         let primary = camelCase(
@@ -811,14 +808,14 @@ export default {
             if (res.code == 200) {
               if (res.data.mainForm) {
                 //表单组
-                console.log(res.data);
+                // console.log(res.data);
                 this.transformDataFormat(res.data);
                 this.tableName = res.data.mainForm.showTemplate.dfTableName;
               } else {
                 this.formList = res.data;
                 this.tableName = res.data.dfTableName;
               }
-              console.log(this.formList);
+              // console.log(this.formList);
               this.open = true;
               // this.$nextTick(() => {
               //   // this.sleep(1000);
@@ -830,7 +827,7 @@ export default {
           } else {
             //单个表单
             res.data.template.dfFormSql &&
-              (this.dynamicData = JSON.parse(res.data.template.dfFormSql));
+            (this.dynamicData = JSON.parse(res.data.template.dfFormSql));
             this.addRealFieldName(res.data.result.resultMap);
             let resultMap = res.data.result.resultMap;
 
@@ -897,7 +894,7 @@ export default {
         // });
       } catch (error) {
         this.$message.error("网络异常,请稍后再试");
-        console.log(error);
+        // console.log(error);
       }
       return;
       // getInfoBySqlKey(this.templateInfo.template.sqlKey).then(({ data }) => {
@@ -939,7 +936,7 @@ export default {
     // 将表单组数据转换成符合单个表单的数据格式
     transformDataFormat(data) {
       this.FormNameList = [];
-      let { mainForm, subFormList } = data;
+      let {mainForm, subFormList} = data;
       this.formList = [];
       let showValue = mainForm.showValue[0];
       if (showValue) {
@@ -956,7 +953,7 @@ export default {
       });
       if (subFormList && subFormList.length > 0) {
         subFormList.forEach((item) => {
-          console.log(item);
+          // console.log(item);
           let showValue = item.showValue[0];
           if (showValue) {
             item.showTemplate.resultMap = item.showValue;
@@ -1057,7 +1054,8 @@ export default {
           this.$refs.mychild.pageList();
           this.$modal.msgSuccess("删除成功");
         })
-        .catch(() => {});
+        .catch(() => {
+        });
     },
     // 批量删除接口
     handleBatchDelete() {
@@ -1097,7 +1095,8 @@ export default {
           this.$refs.mychild.pageList();
           this.$modal.msgSuccess("删除成功");
         })
-        .catch(() => {});
+        .catch(() => {
+        });
     },
     /** 导出按钮操作 */
     handleExport() {
@@ -1134,7 +1133,7 @@ export default {
     importTemplate() {
       this.download(
         process.env.VUE_APP_BASE_API1 +
-          `common/exportTemplate?tableName=${this.tableName}&sqlkey=${this.templateInfo.template.sqlKey}`,
+        `common/exportTemplate?tableName=${this.tableName}&sqlkey=${this.templateInfo.template.sqlKey}`,
         {},
         `下载模版名称${new Date().getTime()}.xlsx`
       );
@@ -1150,10 +1149,10 @@ export default {
       this.$refs.upload.clearFiles();
       this.$alert(
         "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
-          response.msg +
-          "</div>",
+        response.msg +
+        "</div>",
         "导入结果",
-        { dangerouslyUseHTMLString: true }
+        {dangerouslyUseHTMLString: true}
       );
       this.$refs.mychild.pageList({
         limit: this.queryParams.pageSize,
@@ -1193,7 +1192,7 @@ export default {
       // }
       // // data.addListMap =
       // btnCommonApi(data).then(res => {
-      //   console.log('弹窗确定', res);
+      //   // console.log('弹窗确定', res);
       // })
     },
     // 去掉表名 开头字母小写
@@ -1230,7 +1229,7 @@ export default {
                   item.fieldValue
                     ? item.fieldValue
                     : this.currentRow[
-                        camelCase(item.fieldName.replace(".", "_"))
+                      camelCase(item.fieldName.replace(".", "_"))
                       ];
               });
               conditionData.forEach((item) => {
@@ -1238,7 +1237,7 @@ export default {
                   item.fieldValue
                     ? item.fieldValue
                     : this.currentRow[
-                        camelCase(item.fieldName.replace(".", "_"))
+                      camelCase(item.fieldName.replace(".", "_"))
                       ];
               });
             }
@@ -1262,7 +1261,7 @@ export default {
                 this.$message.error("网络异常,请稍后再试");
               }
             } catch (error) {
-              console.log(error);
+              // console.log(error);
               this.$message.error("网络异常,请稍后再试");
             }
             this.getList();
@@ -1270,12 +1269,12 @@ export default {
             this.open = false;
           })
           .catch((res) => {
-            console.log(res);
+            // console.log(res);
             this.$modal.msgError("表单校验失败,请规范填写数据");
           });
       } else if (this.formType == "dragFormGroup") {
         //表单组
-        // console.log(this.$refs.formGroupRef);
+        // // console.log(this.$refs.formGroupRef);
 
         let promiseArray = this.FormNameList.map((item) => {
           return this.$refs.formGroupRef?.getFormData(item);
@@ -1283,7 +1282,7 @@ export default {
         Promise.all(promiseArray).then(
           async (res) => {
             // 获取到所有表单数据
-            console.log(res);
+            // console.log(res);
             let mainFormData = res[0].data;
             let data = {
               basicMap: {
@@ -1309,7 +1308,7 @@ export default {
                 item.fieldValue
                   ? item.fieldValue
                   : this.currentRow[
-                      camelCase(item.fieldName.replace(".", "_"))
+                    camelCase(item.fieldName.replace(".", "_"))
                     ];
             });
             conditionData.forEach((item) => {
@@ -1318,10 +1317,10 @@ export default {
                 : this.currentRow[camelCase(item.fieldName.replace(".", "_"))];
             });
 
-            // console.log("mainFormData", mainFormData);
-            // console.log("btnParams", btnParams);
-            // console.log("conditionData", conditionData);
-            // console.log("btnType", this.currentBtnData.btnType);
+            // // console.log("mainFormData", mainFormData);
+            // // console.log("btnParams", btnParams);
+            // // console.log("conditionData", conditionData);
+            // // console.log("btnType", this.currentBtnData.btnType);
             data.basicMap.btnType = this.currentBtnData.btnType;
             data.basicMap.visible = true;
             let payLoad = {};
@@ -1347,17 +1346,17 @@ export default {
                       item.fieldValue
                         ? item.fieldValue
                         : this.currentRow[
-                            camelCase(item.fieldName.replace(".", "_"))
+                          camelCase(item.fieldName.replace(".", "_"))
                           ];
                   });
                 } else {
                   // 从表条件
-                  let { formItem, relateFormItem } = item;
+                  let {formItem, relateFormItem} = item;
                   let fieldName = formItem.split(".")[1];
                   let value =
                     this.currentRow[
                       camelCase(relateFormItem.replace(".", "_"))
-                    ];
+                      ];
                   result.conditionMap[fieldName] = value;
                 }
                 return result;
@@ -1365,7 +1364,7 @@ export default {
             } else if (this.currentBtnData.btnType == "INSERT") {
               // 新增
               let uuid = uuidv4();
-              console.log(uuid);
+              // console.log(uuid);
               payLoad.insertCommonEntityList = res.map((item, index) => {
                 let result = {
                   basicMap: {
@@ -1379,8 +1378,8 @@ export default {
                 };
 
                 // 添加新增数据的关联条件
-                let { formItem, relateFormItem } = item;
-                console.log(formItem);
+                let {formItem, relateFormItem} = item;
+                // console.log(formItem);
                 result.addListMap[0][formItem.split(".")[1]] = uuid;
                 return result;
               });
@@ -1455,17 +1454,17 @@ export default {
                       item.fieldValue
                         ? item.fieldValue
                         : this.currentRow[
-                            camelCase(item.fieldName.replace(".", "_"))
+                          camelCase(item.fieldName.replace(".", "_"))
                           ];
                   });
                 } else {
                   // 从表条件
-                  let { formItem, relateFormItem } = item;
+                  let {formItem, relateFormItem} = item;
                   let fieldName = formItem.split(".")[1];
                   let value =
                     this.currentRow[
                       camelCase(relateFormItem.replace(".", "_"))
-                    ];
+                      ];
                   result.conditionMap[fieldName] = value;
                 }
                 return result;
@@ -1484,12 +1483,12 @@ export default {
                 this.$message.error("网络异常,请稍后再试");
               }
             } catch (error) {
-              console.log(error);
+              // console.log(error);
               this.$message.error("网络异常,请稍后再试");
             }
           },
           (err) => {
-            console.log(err);
+            // console.log(err);
           }
         );
       } else {
@@ -1534,7 +1533,7 @@ export default {
             this.$message.error("网络异常,请稍后再试");
           }
         } catch (error) {
-          console.log(error);
+          // console.log(error);
           this.$message.error("网络异常,请稍后再试");
         }
         this.getList();
@@ -1546,14 +1545,14 @@ export default {
     tempSubBtn(getData) {
       getData()
         .then((values) => {
-          console.log("验证通过", values);
+          // console.log("验证通过", values);
         })
         .catch(() => {
-          console.log("验证未通过,获取失败");
+          // console.log("验证未通过,获取失败");
         });
     },
     // 判断是否生效行样式
-    cellStyle({ row, column, rowIndex, columnIndex }) {
+    cellStyle({row, column, rowIndex, columnIndex}) {
       let rowStyleList = this.styleList.filter((item) => item.styleType == 0);
       if (!rowStyleList.length) return "";
       let mainTableName = this.templateInfo.querySql.tableAlias; //主表名
@@ -1595,7 +1594,7 @@ export default {
 
     // 设置表格字段样式
     async setFieldStyleData(tableList) {
-      console.log(JSON.parse(JSON.stringify(tableList)));
+      // console.log(JSON.parse(JSON.stringify(tableList)));
       let fieldConditionList = this.styleList.filter(
         (item) => item.styleType == 1 || item.styleType == 2
       );
@@ -1608,7 +1607,7 @@ export default {
           ...item,
         };
       }, {});
-      // console.log("this.dictStyleObj", this.dictStyleObj);
+      // // console.log("this.dictStyleObj", this.dictStyleObj);
       tableList.forEach((row) => {
         // if (!row.styleFieldObj) row.styleFieldObj = {};
         for (let i = 0; i < fieldConditionList.length; i++) {
@@ -1676,7 +1675,7 @@ export default {
 
     // 内链页面跳转
     routerHandler(btnData, type) {
-      let { url, commonFieldData } = JSON.parse(btnData.btnParams);
+      let {url, commonFieldData} = JSON.parse(btnData.btnParams);
       let tempArr = [];
       if (commonFieldData) {
         let queryArr = JSON.parse(commonFieldData);
@@ -1702,8 +1701,8 @@ export default {
 
     // 操作列回调
     excuteHandler(btnData, row) {
-      console.log("btnData", btnData, row);
-      let { btnType, btnParams, btnFormType } = btnData;
+      // console.log("btnData", btnData, row);
+      let {btnType, btnParams, btnFormType} = btnData;
       this.currentBtnData = btnData;
       this.currentRow = JSON.parse(JSON.stringify(row));
       // 无表单
@@ -1752,7 +1751,7 @@ export default {
             commMap: {},
             btnParametersMap: {},
           };
-          console.log(this.currentBtnData, this.currentRow);
+          // console.log(this.currentBtnData, this.currentRow);
           if (this.currentBtnData.btnParams) {
             let conditionData =
               JSON.parse(this.currentBtnData.btnParams).conditionData || [];
@@ -1770,7 +1769,7 @@ export default {
                 item.fieldValue
                   ? item.fieldValue
                   : this.currentRow[
-                      camelCase(item.fieldName.replace(".", "_"))
+                    camelCase(item.fieldName.replace(".", "_"))
                     ];
             });
           }
@@ -1784,7 +1783,7 @@ export default {
               this.$message.error("网络异常,请稍后再试");
             }
           } catch (error) {
-            console.log(error);
+            // console.log(error);
             this.$message.error("网络异常,请稍后再试");
           }
         })
@@ -1793,12 +1792,13 @@ export default {
           this.$refs.mychild.pageList();
           // this.$modal.msgSuccess("操作成功");
         })
-        .catch(() => {});
+        .catch(() => {
+        });
     },
 
     // k-form-build表单变化回调
     formChangeHandler(value, label) {
-      // console.log(value, label);
+      // // console.log(value, label);
     },
   },
 };

+ 72 - 137
zkqy-ui/src/views/tablelist/commonTable/queryfrom.vue

@@ -1,124 +1,57 @@
 <template>
   <div>
-    <!-- <div class="cardBox" v-show="showCount" >
-      <el-card
-        shadow="hover"
-        :body-style="{ padding: '20px' }"
-        class="card"
-        v-for="(item, index) in statisticList"
-        :key="index"
-      >
-        <el-tooltip
-          class="item"
-          effect="dark"
-          :content="item.statisticTitle ? item.statisticTitle : item.statisticDescription"
-          placement="top-start"
-        >
-          <div class="title">{{ item.statisticTitle ? item.statisticTitle : item.statisticDescription }}</div>
-        </el-tooltip>
-
-        <div class="type">
-          <div class="count">{{ item.result }}</div>
-        </div>
-      </el-card>
-    </div> -->
-    <cardcountpanel :showCount="showCount" :statisticList="statisticList" />
-    <el-form
-      :model="queryParams.queryMap"
-      ref="queryForm"
-      size="small"
-      :inline="true"
-      label-width="68px"
-      @submit.native.prevent
-      v-show="showSearch"
-    >
+    <cardcountpanel :showCount="showCount" :statisticList="statisticList"/>
+    <el-form :model="queryParams.queryMap" ref="queryForm" size="small" :inline="true" label-width="68px"
+             @submit.native.prevent v-show="showSearch"  class="demo-form-inline">
       <el-form-item label="超级查询">
-        <el-input
-          v-model="queryParams.queryMap.queryCriteriaValue"
-          placeholder="请输入"
-          @keyup.enter.native="handleQuery"
-          clearable
-        />
+        <el-input v-model="queryParams.queryMap.queryCriteriaValue" placeholder="请输入"
+                  @keyup.enter.native="handleQuery" clearable/>
       </el-form-item>
-
       <el-form-item>
-        <el-button
-          type="primary"
-          icon="el-icon-search"
-          size="mini"
-          @click="handleQuery"
-          >搜索</el-button
-        >
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
-          >重置</el-button
-        >
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
       </el-form-item>
 
       <!--   不加载初始数据   -->
-      <div v-if="false">
+      <div v-if="true" class="btn-wrap">
         <!--      条件循环-->
-        <span v-for="(item, index) in formVals" :key="index">
+        <span v-for="(item, index) in formVals" :key="index" >
           <!--      input框循环-->
           <span
             v-if="item.conditionType == 'input'"
-            style="width: 500px; height: 500px"
-          >
-            <el-form-item
-              :label="item.conditionName"
-              :prop="item.conditionField"
-            >
-              <el-input
-                v-model="queryParams.queryMap[item.conditionField]"
-                :placeholder="
-                  item.conditionNotes == null ? '请输入' : item.conditionNotes
-                "
-                @keyup.enter.native="handleQuery"
-                clearable
-              />
+            style="width: 500px; height: 500px">
+            <el-form-item :label="item.conditionName"
+                          :prop="item.conditionField">
+              <el-input v-model="queryParams.queryMap[item.conditionField]"
+                        :placeholder="item.conditionNotes == null ? '请输入' : item.conditionNotes"
+                        @keyup.enter.native="handleQuery" clearable/>
             </el-form-item>
           </span>
+
           <!--      button按钮循环-->
-          <span
-            v-if="item.conditionType == 'button'"
-            style="width: 500px; height: 500px"
-          >
-            <el-form-item
-              :label="item.conditionName"
-              :prop="item.conditionField"
-            >
-              {{
-                (queryParams.queryMap[item.conditionField] =
-                  item.conditionDefaultValue)
-              }}
-              <el-button @keyup.enter.native="handleQuery" @click="handleQuery">
+          <span v-if="item.conditionType == 'button'" >
+            <el-form-item :label="item.conditionName">
+              <!--              {{-->
+              <!--                (queryParams.queryMap[item.conditionField] =-->
+              <!--                  item.conditionDefaultValue)-->
+              <!--              }}-->
+              <el-button @keyup.enter.native="btnClick"
+                         @click="btnClick(item.conditionField ,item.conditionDefaultValue)">
                 {{ item.conditionNotes == null ? "按钮" : item.conditionNotes }}
               </el-button>
             </el-form-item>
+            <div style="clear: both;"/>
           </span>
+          <div style="clear: both;"/>
+
           <!--      select下拉框循环-->
-          <span
-            v-if="item.conditionType == 'select'"
-            style="width: 500px; height: 500px"
-          >
-            <el-form-item
-              :label="item.conditionName"
-              :prop="item.conditionField"
-            >
-              <el-select
-                v-model="queryParams.queryMap[item.conditionField]"
-                :placeholder="
-                  item.conditionNotes == null ? '请选择' : item.conditionNotes
-                "
-                clearable
-                filterable
-              >
-                <el-option
-                  v-for="(i, index) in item.dropDownList"
-                  :key="index"
-                  :label="i.fieldName"
-                  :value="i.fieldKey"
-                >
-                </el-option>
+          <span v-if="item.conditionType == 'select'" style="width: 500px; height: 500px">
+            <el-form-item :label="item.conditionName" :prop="item.conditionField">
+              <el-select v-model="queryParams.queryMap[item.conditionField]"
+                         :placeholder="item.conditionNotes == null ? '请选择' : item.conditionNotes" clearable
+                         filterable>
+                <el-option v-for="(i, index) in item.dropDownList" :key="index" :label="i.fieldName"
+                           :value="i.fieldKey"></el-option>
               </el-select>
 
               <!-- <el-option
@@ -130,41 +63,21 @@
             </el-form-item>
           </span>
           <!--      radio单选框循环-->
-          <span
-            v-if="item.conditionType == 'radio'"
-            style="width: 500px; height: 500px"
-          >
+          <span v-if="item.conditionType == 'radio'" style="width: 500px; height: 500px">
             <el-form-item :prop="item.conditionField">
-              <el-button
-                :type="item.componentType"
-                :icon="item.componentIcon"
-                :size="item.componentSize"
-                @click="buttonClick(item)"
-              >
-                {{ item.conditionName }}</el-button
-              >
+              <el-button :type="item.componentType" :icon="item.componentIcon" :size="item.componentSize"
+                         @click="buttonClick(item)">
+                {{ item.conditionName }}</el-button>
             </el-form-item>
           </span>
           <!--      time时间范围  -->
-          <span
-            v-if="item.conditionType == 'between'"
-            style="width: 500px; height: 500px"
-          >
-            <el-form-item
-              :label="item.conditionName"
-              :prop="item.conditionField"
-            >
+          <span v-if="item.conditionType == 'between'" style="width: 500px; height: 500px">
+            <el-form-item :label="item.conditionName" :prop="item.conditionField">
               <!--  item.componentType 使用某种组件
         year/month/date/dates/months/years week/datetime/datetimerange/ daterange/monthrange-->
-              <el-date-picker
-                v-model="queryParams.queryMap[item.conditionField]"
-                :type="item.componentType"
-                range-separator="至"
-                start-placeholder="开始日期"
-                end-placeholder="结束日期"
-                value-format="yyyy-MM-DD HH:mm:ss"
-                :default-time="['12:00:00']"
-              >
+              <el-date-picker v-model="queryParams.queryMap[item.conditionField]" :type="item.componentType"
+                              range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
+                              value-format="yyyy-MM-DD HH:mm:ss" :default-time="['12:00:00']">
               </el-date-picker>
             </el-form-item>
           </span>
@@ -176,6 +89,7 @@
 
 <script>
 import cardcountpanel from "../components/cardCountPanel.vue";
+
 export default {
   name: "queryfrom",
   props: {
@@ -193,7 +107,7 @@ export default {
       type: Array,
     },
   },
-  components: { cardcountpanel },
+  components: {cardcountpanel},
   data() {
     return {
       // 时间范围临时存储
@@ -232,14 +146,14 @@ export default {
     formVals: {
       handler: function () {
         return;
-        console.log(this.formVals);
+        // console.log(this.formVals);
         this.formVals.forEach((item) => {
-          console.log(item.conditionType);
+          // console.log(item.conditionType);
           if (item.conditionType == "input") {
             this.inputs.push(item);
           } else if (item.conditionType == "between") {
             // 判断使用某种时间范围组件  YYYY 表示年范围之间的组件 MM 表示月等。。。
-            // console.log(item.componentType);
+            // // console.log(item.componentType);
             this.betweens.push(item);
           } else if (item.conditionType == "select") {
             this.selects.push(item);
@@ -251,7 +165,11 @@ export default {
     },
   },
   created() {
+    console.log("formVals", this.queryParams)
     this.$emit("getList", this.queryParams);
+    // console.log("showCount", this.showCount)
+    // console.log("showSearch", this.showSearch)
+    // console.log("statisticList", this.statisticList)
   },
   methods: {
     // radio 点击事件调用getList
@@ -259,7 +177,7 @@ export default {
       // 调用父组件中的getlist    待处理
       // 当前按钮绑定的默认值以及列
       this.queryParams.queryMap[tem.conditionField] = tem.conditionDefaultValue;
-      console.log(this.queryParams);
+      // console.log(this.queryParams);
       // 处理完成后调用getlist
       this.handleQuery();
     },
@@ -269,9 +187,16 @@ export default {
       this.queryParams.pageNum = 1;
       console.log(this.queryParams);
       // 调用父组件中的查询函数
-      this.$emit("getList", this.queryParams);
+      return new Promise((resolve) => {
+        this.$emit("getList", this.queryParams);
+        resolve();
+      })
+    },
+    async btnClick(field, val) {
+      this.queryParams.queryMap[field] = val;
+      await this.handleQuery();
+      delete this.queryParams.queryMap[field];
     },
-
     /**分页查询操作*/
     pageList(row) {
       // 调用查询方法
@@ -299,12 +224,14 @@ export default {
   flex-wrap: wrap;
   align-content: flex-start;
 }
+
 .card {
   /* width:15%; */
   flex-basis: 15%;
   margin-bottom: 10px;
   margin-right: 15px;
   min-width: 130px;
+
   .title {
     /* width:20%; */
     font-size: 18px;
@@ -313,6 +240,7 @@ export default {
     overflow: hidden;
     text-overflow: ellipsis;
   }
+
   .description {
     width: 70%;
     font-size: 13px;
@@ -325,12 +253,19 @@ export default {
     word-break: break-all;
     float: left;
   }
+
   .type {
     float: right;
     margin-top: 10px;
   }
+
   .count {
     font-size: 30px;
   }
+
+}
+.btn-wrap{
+  display: flex;
+  flex-direction: row-reverse;
 }
 </style>