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

---
 src/components/MapView/mapMenuTop.vue  |   30 +---
 src/assets/css/configure.css           |    4 
 src/components/MapView/mapSpacePop.vue |   54 +++++++-
 src/views/datamanage/SpatialData.vue   |  213 +++++++++++++++++++++++++++++++++--
 4 files changed, 258 insertions(+), 43 deletions(-)

diff --git a/src/assets/css/configure.css b/src/assets/css/configure.css
index c8ce190..e58a01b 100644
--- a/src/assets/css/configure.css
+++ b/src/assets/css/configure.css
@@ -393,4 +393,8 @@
 
 .el-table .el-table__body-wrapper {
     flex: 1;
+}
+
+.el-table th.gutter {
+    display: table-cell !important;
 }
\ No newline at end of file
diff --git a/src/components/MapView/mapMenuTop.vue b/src/components/MapView/mapMenuTop.vue
index b5d17dc..2355a02 100644
--- a/src/components/MapView/mapMenuTop.vue
+++ b/src/components/MapView/mapMenuTop.vue
@@ -294,13 +294,13 @@
       if (data.code != 200) {
         this.$message.error("鍒楄〃璋冪敤澶辫触")
       }
-
-      var val = data.result.filter(res => {
-        if (res.rows != 0) {
-          return res
-        }
-      })
-
+      debugger
+      // var val = data.result.filter(res => {
+      //   if (res.rows != 0) {
+      //     return res
+      //   }
+      // })
+      var val = data.result
       var std = [];
       val.filter((item) => {
         if (std.indexOf(item.bak) == -1) {
@@ -308,7 +308,7 @@
           this.layerData.push(
             {
               val: item.bak,
-              label: item.tabDesc,
+              label: item.bak,
               children: [],
             }
           )
@@ -324,20 +324,6 @@
         })
       })
 
-
-
-
-
-      // for (var i in option) {
-      //   var val_Data = option[i]
-      //   val_Data.id = "1" + i
-      //   val_Data.label = val_Data.tabDesc
-      //   if (option[i].ns == "bd") {
-      //     this.layerData[0].children.push(val_Data)
-      //   } else {
-      //     this.layerData[1].children.push(val_Data)
-      //   }
-      // }
     },
     //鑾峰彇閫夋嫨鏍戠殑鑺傜偣
     getCheckedNodes() {
diff --git a/src/components/MapView/mapSpacePop.vue b/src/components/MapView/mapSpacePop.vue
index f00e178..9a6f285 100644
--- a/src/components/MapView/mapSpacePop.vue
+++ b/src/components/MapView/mapSpacePop.vue
@@ -194,6 +194,7 @@
       spaceLayer: '',
       imagePoint: null,
       domainsLayer: null,
+      querytype: null,
     };
   },
   watch: {
@@ -243,7 +244,7 @@
       this.options = [];
 
       var std = [];
-
+      this.querytype = obj.type
       if (obj.type == "text" || obj.type == "blob") {
         std = this.conditions[0];
       } else if (obj.type == "date" || obj.type == "datetime") {
@@ -271,6 +272,7 @@
       this.formInline.name = val_date.field;
       this.options = [];
       var std = [];
+      this.querytype = val_date.type
       if (val_date.type == "text" || val_date.type == "blob") {
         std = this.conditions[0];
       } else if (val_date.type == "date" || val_date.type == "datetime") {
@@ -337,13 +339,41 @@
       if (this.formInline.input == undefined || this.formInline.input == null) {
         this.listdata.filter = null;
       } else {
+
+        var val;
+        var value = this.formInline.input
+        if (this.querytype == "long" || this.querytype == "integer") {
+
+          val = parseInt(value);
+        } else if (this.querytype == 'double') {
+
+          if (this.formSql.value.indexOf(".") != -1) {
+            val = value;
+          } else {
+            val = parseFloat(value).toFixed(1)
+          }
+        } else if (querytype == "date" || querytype == "datetime") {
+          var time = new Date(value);
+          var m = time.getMonth() + 1;
+          var d = time.getDate();
+          var y = time.getFullYear();
+          val = "'" + y +
+            '-' +
+            this.add0(m) +
+            '-' +
+            this.add0(d) + "'";
+        } else {
+          val = "'" + value + "'";
+        }
+
+
+
+
         this.listdata.filter =
-          this.formInline.name +
-          ' ' +
-          this.formInline.region +
-          ' ' +
-          this.formInline.input;
+          this.formInline.name + " " + this.formInline.region + " " + val
+
       }
+      debugger
       const data = await dataQuerySelectByPage(this.listdata);
       if (data.code != 200) {
         this.$message.error('鍒楄〃璋冪敤澶辫触');
@@ -383,6 +413,7 @@
           this.$store.state.primitLayer = null;
         }
         var wkt = this.$wkt.parse(val1);
+
         this.setMapLoaction(wkt, row);
       }
     },
@@ -402,6 +433,7 @@
         this.$store.state.primitLayer = null;
       }
       var coord = res.coordinates;
+      debugger
       if (res.type == 'Point') {
         var val = Cesium.Cartesian3.fromDegrees(
           res.coordinates[0],
@@ -457,12 +489,16 @@
         }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
 
       } else if (res.type == 'MultiPolygon' || res.type == 'LineString') {
+
         var val = res.coordinates[0][0];
         var std = [];
         for (var i in val) {
 
-          std.push({ x: val[i][0], y: val[i][1] })
+          std.push(val[i][0])
+
+          std.push(val[i][1])
         }
+
         this.$store.state.primitLayer = Viewer.entities.add({
           polyline: {
             positions: Cesium.Cartesian3.fromDegreesArray(std),
@@ -506,7 +542,6 @@
   border: 1px solid gray;
   float: left;
   .centTable {
-    margin-top: 1%;
     position: absolute;
     height: 66%;
     width: 98%;
@@ -524,5 +559,8 @@
     position: absolute;
     bottom: 3%;
   }
+  /dep/.el-form-item {
+    margin-bottom: 0px;
+  }
 }
 </style>
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