From c609695d14564f0bf4a2b119718400b2a2be037e Mon Sep 17 00:00:00 2001
From: Surpriseplus <845948745@qq.com>
Date: 星期五, 03 三月 2023 19:02:44 +0800
Subject: [PATCH] 属性查询高级查询修改,数据查询工点表属性查询

---
 src/views/datamanage/SpatialData.vue |  213 ++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 200 insertions(+), 13 deletions(-)

diff --git a/src/views/datamanage/SpatialData.vue b/src/views/datamanage/SpatialData.vue
index d472862..6c7ac4e 100644
--- a/src/views/datamanage/SpatialData.vue
+++ b/src/views/datamanage/SpatialData.vue
@@ -132,12 +132,7 @@
               width="20"
               align="center"
             />
-            <!--            <el-table-column
-              width="60"
-              align="center"
-              type="index"
-              :label="$t('common.index')"
-            />-->
+
             <el-table-column
               min-width="135"
               v-for="(item, index) in attributeData"
@@ -442,13 +437,65 @@
       </div>
     </el-dialog>
     <el-dialog
-      :title="attribute.name"
+      :title="attribute.title"
       :append-to-body="false"
       :visible.sync="AttributedialogVisible"
-      width="70%"
+      width="80%"
       :close-on-click-modal="false"
     >
+      <div class="attributeBox">
+        <div class="attrubuteLeft">
+          <ul>
+            <li
+              v-for="item in attrbuteOption"
+              :class="{active:attributeFlag === item.name}"
+              @click="setChangeAttrubuteData(item)"
+            >
+              {{item.name}}
+            </li>
+          </ul>
+        </div>
+        <div class="attrubuteRight">
+          <el-table
+            ref="refAttributeTable"
+            :data="attributeTable"
+            style="width:100%;"
+            border
+            height="calc(100% - 50px)"
+          >
+            <el-table-column
+              type="selection"
+              align="center"
+            />
 
+            <el-table-column
+              min-width="135"
+              v-for="(item, index) in attributeData"
+              :key="index"
+              :label="item.alias"
+              :prop="item.field"
+              show-overflow-tooltip
+              align="center"
+            ></el-table-column>
+
+          </el-table>
+          <div
+            class="pagination_box"
+            style="margin-top: 10px"
+          >
+            <el-pagination
+              @size-change="attributeSizeChange"
+              @current-change="attributeCurrentChange"
+              :current-page="attribute.pageIndex"
+              :page-sizes="[10, 20, 50, 100]"
+              :page-size="attribute.pageSize"
+              layout="total, sizes, prev, pager, next, jumper"
+              :total="attribute.count"
+            >
+            </el-pagination>
+          </div>
+        </div>
+      </div>
     </el-dialog>
   </div>
 </template>
@@ -574,7 +621,13 @@
         pageIndex: 1,
         pageSize: 10,
         count: 0,
-      }
+        title: null
+      },
+      attrbuteOption: [],
+      attributeFlag: null,
+      attributeTable: [],
+      attributeLayer: null,
+      attributeFild: null,
     };
   },
   created() {
@@ -590,10 +643,111 @@
   },
 
   methods: {
-    getAttributeTable(idnex, row) {
-      this.attribute.name = row.workname;
-      this.AttributedialogVisible = true;
+    //鍒嗛〉鐐瑰嚮浜嬩欢
+    attributeSizeChange(val) {
+      this.attribute.pageSize = val;
+      this.attribute.pageIndex = 1;
+      //鑾峰彇table淇℃伅
+      this.setAttributeTableData(this.attributeLayer);
     },
+    attributeCurrentChange(val) {
+      this.attribute.pageIndex = val;
+      //鑾峰彇table淇℃伅
+      this.setAttributeTableData(this.attributeLayer);
+    },
+    getAttributeTable(idnex, row) {
+      this.attribute.title = row.workname;
+      this.attrbuteOption = workSite;
+
+      this.AttributedialogVisible = true;
+      this.setChangeAttrubuteData(this.attrbuteOption[0])
+    },
+    setChangeAttrubuteData(res) {
+      this.attributeFlag = res.name;
+      this.attribute.pageIndex = 1;
+      this.attribute.pageSize = 10;
+      this.attribute.count = 0;
+      this.attributeLayer = res;
+      this.setAttributeTableData(res)
+    },
+    setAttributeTableData(res) {
+      var name = res.table.replaceAll("_", "");
+      this.attribute.name = name;
+      var value = this.getAttributeDomFiled(name)
+      this.getAttributeTableData(value, res)
+    },
+
+    //鑾峰彇姣忎釜琛ㄥ瓧娈靛悕绉板強闃堝��
+    async getAttributeDomFiled(res) {
+      //鏌ヨ瀛楁淇℃伅;
+      const fileds = await dataQuery_selectFields({
+        name: res,
+      });
+      if (fileds.code != 200) {
+        this.$message.error("璋冪敤鍒楄〃澶辫触,璇疯仈绯诲伐浣滀汉鍛�!");
+        return;
+      }
+
+      //鏌ヨ闃堝�间俊鎭紱
+      const domains = await dataQuery_selectDomains({
+        name: res,
+      });
+      if (domains.code != 200) {
+        this.$message.error("璋冪敤鍒楄〃澶辫触,璇疯仈绯诲伐浣滀汉鍛�!");
+        return;
+      }
+      var data1 = fileds.result;
+      var data2 = domains.result;
+      var std = [];
+      this.filedsOption = [];
+      for (var i in data1) {
+        if (data1[i].type != 'geometry' && data1[i].type) {
+
+          this.filedsOption.push(data1[i]);
+        }
+        if (data1[i].showtype == 1) {
+          if (data1[i].domainNa != null) {
+            data1[i].domainNa = this.getDomainNaFild(data1[i].domainNa, data2);
+          }
+          std.push(data1[i]);
+        }
+      }
+      return std;
+    },
+
+    //鑾峰彇琛ㄦ牸淇℃伅
+    async getAttributeTableData(res, result) {
+      res.then((val) => {
+        this.attributeFild = val;
+      });
+
+      this.attribute.filter = "workname = " + "'" + this.attribute.title + "'";
+
+
+      const data = await dataQuery_selectByPage(this.attribute);
+      if (data.code != 200) {
+        this.$message.error("璋冪敤鍒楄〃澶辫触,璇疯仈绯诲伐浣滀汉鍛�!");
+        return;
+      }
+      this.attributeTable = []
+      var res_val = this.attributeFild;
+      this.attribute.count = data.count;
+      for (var i in data.result) {
+        let val_Data = data.result[i];
+
+        for (var j in res_val) {
+          if (res_val[j].domainNa != null && res_val[j].domainNa != undefined) {
+            val_Data[res_val[j].field] = res_val[j].domainNa;
+          }
+        }
+      }
+
+      this.attributeTable = data.result;
+
+    },
+
+
+
     matchState1(state = "", reg) {
       var row = state.row;
       if (
@@ -800,7 +954,7 @@
           this.tree.push(
             {
               val: item.bak,
-              label: item.tabDesc,
+              label: item.bak,
               children: [],
             }
           )
@@ -815,6 +969,7 @@
           }
         })
       })
+
       this.handleNodeClick(this.tree[0].children[0]);
     },
     //鎺堟潈绠$悊
@@ -1318,6 +1473,38 @@
     width: 100%;
     position: relative;
   }
+  .attributeBox {
+    height: 63vh;
+    width: 100%;
+    position: relative;
+    display: flex;
+    justify-content: space-between;
+    .attrubuteLeft {
+      width: calc(20% - 20px);
+      height: calc(100% - 20px);
+      border: 1px solid #dcdfe6;
+      border-radius: 5px;
+      padding: 10px;
+      li {
+        border-bottom: 1px solid #dcdfe6;
+        line-height: 30px;
+        text-align: center;
+      }
+      li:hover {
+        background: rgba(255, 255, 255, 0.3);
+        color: #409eff;
+      }
+      .active {
+        color: #409eff;
+      }
+    }
+    .attrubuteRight {
+      width: 79%;
+      height: 100%;
+      border: 1px solid #dcdfe6;
+      border-radius: 5px;
+    }
+  }
 }
 
 .table_box2 {

--
Gitblit v1.9.3