Kaynağa Gözat

树形筛选表格

sql715 3 ay önce
ebeveyn
işleme
f304cd352c

+ 4 - 4
zkqy-ui/.env.development

@@ -8,15 +8,15 @@ ENV = 'development'
 VUE_APP_BASE_API = '/dev-api'
 
 # 图片路径
-VUE_APP_BASE_IMG_API = 'http://192.168.10.8:1025/dev-api'
-# VUE_APP_BASE_IMG_API = 'http://localhost:1025/dev-api'
+# VUE_APP_BASE_IMG_API = 'http://192.168.10.8:1025/dev-api'
+VUE_APP_BASE_IMG_API = 'http://localhost:1025/dev-api'
 
 # 路由懒加载
 VUE_CLI_BABEL_TRANSPILE_MODULES = true
 
 #本项目地址
-VUE_APP_BASE_API1 = 'http://192.168.10.8:8066/'
-# VUE_APP_BASE_API1 = 'http://localhost:8066/'
+# VUE_APP_BASE_API1 = 'http://192.168.10.8:8066/'
+VUE_APP_BASE_API1 = 'http://localhost:8066/'
 
 # ws地址
 VUE_APP_BASE_WS_API = '//127.0.0.1:8721'

+ 52 - 67
zkqy-ui/src/views/tablelist/commonTable/listTreeInfo.vue

@@ -44,7 +44,7 @@
         </div>
         <!-- 右侧 -->
         <div class='container-right'>
-          <el-table v-if="tableList.length > 0" v-loading="loading" :data="tableList"
+          <el-table v-loading="loading" :data="tableList"
             @selection-change="handleSelectionChange" ref="tableRef" :cell-style="cellStyle" :reserve-selection="true"
             :row-key="getRowKey">
             <el-table-column type="selection" width="55" reserve-selection align="center">
@@ -212,54 +212,7 @@ export default {
   },
   data() {
     return {
-      treeData: [{
-        id: '1',
-        label: '一级 1',
-        children: [{
-          id: '1-1',
-          label: '二级 1-1',
-          children: [{
-            id: '1-1-1',
-            label: '三级 1-1-1'
-          }]
-        }]
-      }, {
-        id: '2',
-        label: '一级 2',
-        children: [{
-          id: '2-1',
-          label: '二级 2-1',
-          children: [{
-            id: '2-1-1',
-            label: '三级 2-1-1'
-          }]
-        }, {
-          id: '2-2',
-          label: '二级 2-2',
-          children: [{
-            id: '2-2-1',
-            label: '三级 2-2-1'
-          }]
-        }]
-      }, {
-        id: '3',
-        label: '一级 3',
-        children: [{
-          id: '3-1',
-          label: '二级 3-1',
-          children: [{
-            id: '3-1-1',
-            label: '三级 3-1-1'
-          }]
-        }, {
-          id: '3-2',
-          label: '二级 3-2',
-          children: [{
-            id: '3-2-1',
-            label: '三级 3-2-1'
-          }]
-        }]
-      }],
+      treeData: [],
       defaultProps: {
         children: 'children',
         label: 'label'
@@ -424,10 +377,11 @@ export default {
       //存放html代码块
       iframeUrl: "",
       FormListDefaultValue: {}, //表单组的默认表单数据
+      treeNode: {},
+      treeSelectKey: '',
     };
   },
   created() {
-    console.log('[123455]')
     // 得到当前展示的table的唯一标识
     // this.treeData = []
     this.tableKey = this.$route.query.tableKey;
@@ -453,29 +407,41 @@ export default {
           if (templateData && data) {
             this.treeData = data
             // this.treeTableCondition = templateData?.TableCondition
-
             // this.defaultProps.label = templateData.treeShowLabel
           }
         }
       })
     },
     handleNodeClick(data) {
-      console.log('--------------------1--------------------------');
       // this.querymap.warehouse_name = '一号仓库'
-      console.log('data', data);
-      console.log('templateData', this.templateData);
-      console.log('----------------------------------------------');
-      console.log('treeTableCondition', this.templateData.treeTableCondition);
-      let columnValue = this.templateData?.treeTableCondition == 'name' ? data.name : data.label
-      let treeQueryMap = {
-        columnName: this.templateData.treeTableJoinTableCondition,
-        columnValue: columnValue
-      }
-      console.log('treeQueryMap', treeQueryMap)
-      console.log('queryParams', this.queryParams)
-      // let 
-      // console.log('[tableList]',this.tableList)
-      // this.queryParams
+      this.treeNode = data,
+        // console.log('data', data);
+        // console.log('templateData', this.templateData);
+        // console.log('treeTableCondition', this.templateData.treeTableCondition);
+        // let columnValue = this.templateData?.treeTableCondition == 'name' ? data.name : data.label
+        // let treeQueryMap = this.templateData?.treeTableJoinTableCondition
+        // // console.log('treeQueryMap',treeQueryMap)
+        // let x = {}
+        // x[treeQueryMap] = columnValue
+        this.queryParams = {
+          pageNum: 1, // 第几页
+          pageSize: 10, // 每页大小
+          orderByColumn: "", // 根据某列排序
+          isAsc: "", // desc(降序)或 asc(升序)
+          // 基本查询参数
+          basicMap: {
+            tableName: "",
+          },
+          // 当前表字段筛选参数
+          queryMap: {
+            // 当前查询基本参数
+            // ... key : value         当前页面的筛选条件
+            // 超级查询的唯一值
+            queryCriteriaValue: "",
+          },
+        },
+        this.getList(this.queryParams);
+
     },
     isUpperCase(char) {
       return char === char.toUpperCase();
@@ -483,7 +449,6 @@ export default {
 
     getList(queryParams) {
       console.log('queryParams', queryParams)
-      // if(queryParams.treeQueryMap){}
       this.loading = true;
       // 序列化当前查询参数列表
       queryParams && (this.queryParams.queryMap = Object.assign({}, queryParams.queryMap));
@@ -494,6 +459,7 @@ export default {
         );
       }
       // 获取当前表单结构信息
+      // console.log('{ queryMap: { tableKey: this.tableKey } }',{ queryMap: { tableKey: this.tableKey } })
       dragTableInfo({ queryMap: { tableKey: this.tableKey } })
         .then((res) => {
           //     // 得到当前模版信息 --- sql columns queryWhere
@@ -537,6 +503,22 @@ export default {
           );
         })
         .finally((fes) => {
+          if (this.treeNode.id) {
+            console.log('[vtreeNode]', this.treeNode)
+            let columnValue = this.templateData?.treeTableCondition == 'name' ? this.treeNode.name : this.treeNode.label
+            let treeQueryMap = this.templateData?.treeTableJoinTableCondition
+            this.queryParams.queryMap[treeQueryMap] = `'${columnValue}'`
+            this.queryParams.queryMap.queryCriteriaValue = ''
+            if (this.$refs.mychild) {
+              this.$refs.mychild.queryParams.queryMap.queryCriteriaValue = ''; // 调用子组件的方法
+            }
+            this.treeSelectKey = treeQueryMap
+          } else {
+            //如果this.treeNode.id不存在就删除this.queryParams.queryMap[this.treeSelectKey]
+            delete this.queryParams.queryMap[this.treeSelectKey]
+            console.log('this.queryParam11111s', this.queryParams)
+            console.log('this.treeNode', this.treeNode)
+          }
           //     // 调用子组件中查询条件顺序处理事件
           this.$refs.mychild.handlerFormVals();
           if (this.templateInfo == {}) return;
@@ -546,6 +528,7 @@ export default {
             this.queryParams.orderByColumn || ""
           );
           // 根据sql语句查询当前表数据 ->得到列表数据
+          console.log('this.queryParams', this.queryParams)
           unionListTableData(this.queryParams).then(async (res) => {
             this.tableList = [];
             res.rows.forEach((item) => this.tableList.push(item.resultMap));
@@ -559,6 +542,8 @@ export default {
             this.tableList = await this.setFieldStyleData(tempTableList);
             this.total = res.total;
             this.loading = false;
+            this.treeNode = {}
+
           });
           //     // 查询统计信息
           getStatisticList({