From b6c8e7c61f0270598ba7fdbc44f79512e010d0fe Mon Sep 17 00:00:00 2001
From: TreeWish <1131093754@qq.com>
Date: 星期五, 03 三月 2023 22:03:13 +0800
Subject: [PATCH] 合并国际化配置

---
 src/views/datamanage/SpatialData.vue |  504 ++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 402 insertions(+), 102 deletions(-)

diff --git a/src/views/datamanage/SpatialData.vue b/src/views/datamanage/SpatialData.vue
index 51325bf..6c7ac4e 100644
--- a/src/views/datamanage/SpatialData.vue
+++ b/src/views/datamanage/SpatialData.vue
@@ -112,7 +112,7 @@
         <div class="dividing-line"></div>
         <div
           class="table_box"
-          style="height:calc(100% - 130px)"
+          style="height:calc(100% - 130px); "
         >
           <!--          border-->
           <!--          ref="filterTable"-->
@@ -125,19 +125,14 @@
             :data="tableData"
             style="width: 100% ;"
             border
-            height="100% "
+            height="100%"
           >
             <el-table-column
               type="selection"
               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"
@@ -148,7 +143,7 @@
               align="center"
             ></el-table-column>
             <el-table-column
-              min-width="180"
+              min-width="240"
               :label="$t('common.operate')"
             >
               <template slot-scope="scope">
@@ -162,8 +157,14 @@
                   plain
                   size="small"
                   @click="getAttachTable(scope.$index, scope.row)"
-                  style="margin-left: 20px;  "
                 >{{$t('common.enclosure')}}</el-button>
+                <el-button
+                  plain
+                  size="small"
+                  type="info"
+                  v-if="matchState1(scope, /[]/)"
+                  @click="getAttributeTable(scope.$index, scope.row)"
+                >{{$t('common.attribute')}}</el-button>
               </template>
             </el-table-column>
           </el-table>
@@ -227,7 +228,7 @@
       :title="$t('common.attachinform')"
       :visible.sync="dialogFormVisible"
     >
-      <div style="height: 500px; overflow: auto">
+      <div style="height:68vh">
         <el-form
           :model="formInline"
           class="demo-form-inline"
@@ -274,57 +275,49 @@
               <!-- <el-col :span="3">  <el-link  class="elLink" :underline="false" >{{$t('common.reset')}}</i></el-link></el-col> -->
             </el-row>
           </el-form-item>
-          <el-form-item>
-            <el-table
-              :data="tableAttach"
-              ref="filterTable"
-              height="calc(100% - 100px)"
-              border
-              style="width: 100%"
-              @selection-change="handleAttatchChange"
-            >
-              <el-table-column
-                type="selection"
-                width="55"
-              />
-              <el-table-column
-                width="60"
-                type="index"
-                :label="$t('common.index')"
-              />
-              <el-table-column
-                prop="date"
-                :label="$t('common.fileNme')"
-              />
-
-              <el-table-column
-                prop="name"
-                :label="$t('common.filePath')"
-              />
-
-            </el-table>
-          </el-form-item>
-          <!-- <el-form-item>
-
-          <el-row :gutter="20">
-            <el-col
-              :span="12"
-              :offset="8"
-            >
-              <el-button
-                type="primary"
-                size="small"
-                @click="dialogFormVisible = false"
-              >纭</el-button>
-              <el-button
-                type="info"
-                size="small"
-                @click="dialogFormVisible = false"
-              >鍙栨秷</el-button>
-            </el-col>
-          </el-row>
-        </el-form-item> -->
         </el-form>
+        <el-table
+          :data="tableAttach"
+          ref="filterTable"
+          height="calc(100% - 130px)"
+          border
+          style="width: 100%"
+          @selection-change="handleAttatchChange"
+        >
+          <el-table-column
+            type="selection"
+            width="70"
+          />
+          <el-table-column
+            width="60"
+            type="index"
+            :label="$t('common.index')"
+          />
+          <el-table-column
+            prop="name"
+            :label="$t('common.fileNme')"
+          />
+
+          <el-table-column
+            prop="sizes"
+            :label="$t('common.size')"
+            :formatter="statSizeChange"
+          />
+          <el-table-column
+            align="center"
+            :label="$t('common.operate')"
+            min-width="100"
+          >
+            <template slot-scope="scope">
+              <el-link
+                v-if="matchState(scope, /[]/)"
+                @click="setAttatchDetail(scope.$index, scope.row)"
+                class="elLink"
+              >{{ $t('common.see') }}</el-link>
+
+            </template>
+          </el-table-column>
+        </el-table>
       </div>
     </el-dialog>
     <el-dialog
@@ -413,6 +406,97 @@
         <map-sdk v-if='showMapVisible'></map-sdk>
       </div>
     </el-dialog>
+    <el-dialog
+      title="棰勮"
+      :append-to-body="false"
+      :visible.sync="dialog.dialogVisible"
+      width="70%"
+      :close-on-click-modal="false"
+    >
+      <div
+        v-if="dialog.isPdf"
+        class="pdfClass"
+      >
+        <iframe
+          :src="dialog.src"
+          type="application/x-google-chrome-pdf"
+          width="100%"
+          height="100%"
+        >
+        </iframe>
+      </div>
+      <div
+        v-if="dialog.isJpg"
+        class="pdfClass"
+      >
+        <img
+          style="width:100%; height:100%"
+          :src="dialog.src"
+          alt=""
+        />
+      </div>
+    </el-dialog>
+    <el-dialog
+      :title="attribute.title"
+      :append-to-body="false"
+      :visible.sync="AttributedialogVisible"
+      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>
 
@@ -461,30 +545,6 @@
       },
       fromSqlflag: false,
       tree: [
-        {
-          tabDesc: "鍩虹鏁版嵁",
-          label: "鍩虹鏁版嵁",
-          value: "BD",
-          ns: "bd",
-          id: 1,
-          children: [],
-        },
-        {
-          id: 2,
-          tabDesc: "涓氬姟鏁版嵁",
-          label: "涓氬姟鏁版嵁",
-          value: "BS",
-          ns: "bs",
-          children: [],
-        },
-        {
-          id: 3,
-          tabDesc: "鍏冩暟鎹�",
-          label: "鍏冩暟鎹�",
-          value: "MD",
-          ns: "md",
-          children: [],
-        },
       ],
       tableAttach: [],
       filedsOption: [],
@@ -549,6 +609,25 @@
         eventid: null,
       },
       filterText: "",
+      dialog: {
+        dialogVisible: false,
+        isPdf: false,
+        isJpg: false,
+        src: ''
+      },
+      AttributedialogVisible: false,
+      attribute: {
+        name: null,
+        pageIndex: 1,
+        pageSize: 10,
+        count: 0,
+        title: null
+      },
+      attrbuteOption: [],
+      attributeFlag: null,
+      attributeTable: [],
+      attributeLayer: null,
+      attributeFild: null,
     };
   },
   created() {
@@ -564,6 +643,131 @@
   },
 
   methods: {
+    //鍒嗛〉鐐瑰嚮浜嬩欢
+    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 (
+        this.listData.name == "ssurveyworksite"
+      ) {
+        return true;
+      }
+      return false;
+    },
+    statSizeChange(row, column) {
+      return this.stateFormatSizes(row.sizes)
+    },
+    stateFormatSizes(res) {
+      if (res >= 1024) {
+        const val = parseFloat(res / 1024).toFixed(3);
+        return val + ' GB';
+      } else {
+        return res + ' MB';
+      }
+    },
     filterNode(value, data) {
       if (!value) return true;
       return data.label.indexOf(value) !== -1;
@@ -593,6 +797,45 @@
       this.$store.state.mapPopBoolean = false;
       this.$store.state.mapPopBoxFlag = null;
     },
+
+    refreshAttatchDetail() {
+      this.dialog.src = "";
+      this.dialog.dialogVisible = false;
+      this.dialog.isPdf = false;
+      this.dialog.isJpg = false;
+    },
+    //闄勪欢鏌ョ湅
+    setAttatchDetail(index, row) {
+
+      this.refreshAttatchDetail()
+      var name = row.name;
+      if (name.indexOf('.pdf') != -1) {
+        this.dialog.dialogVisible = true;
+        this.dialog.isPdf = true;
+        var url = BASE_URL + "/res/downloadForView?guid=" + row.guid + "&token=" + getToken();
+        this.dialog.src = url
+      } else if (name.indexOf('.jpg') != -1 || name.indexOf('.gif') != -1 || name.indexOf('.png') != -1 || name.indexOf('.jpeg') != -1) {
+        this.dialog.dialogVisible = true;
+        this.dialog.isJpg = true;
+        var url = BASE_URL + "/res/downloadForView?guid=" + row.guid + "&token=" + getToken();
+        this.dialog.src = url
+      }
+    },
+
+    matchState(state = "", reg) {
+      var row = state.row;
+      var name = row.name;
+
+      if (name) {
+        if (name.indexOf('.pdf') != -1 || name.indexOf('.jpg') != -1 || name.indexOf('.gif') != -1 || name.indexOf('.png') != -1 || name.indexOf('.jpeg') != -1) {
+          return true;
+        }
+      }
+
+      return false;
+    },
+
+
     async setAttachDel() {
       var std = [];
       for (var i in this.attacgSelection) {
@@ -689,26 +932,44 @@
       if (data.code != 200) {
         this.$message.error("鍒楄〃璋冪敤澶辫触");
       }
-      var option = data.result;
+      var val = data.result;
 
-      for (var i in option) {
-        var val_Data = option[i];
-        val_Data.id = "1" + i;
-        // val_Data.label = val_Data.tabDesc + "(" + val_Data.tab + ")"
-        val_Data.label = val_Data.tabDesc;
-        option[i].id = parseInt(option[i].id);
-        for (var j in this.tree) {
-          if (this.tree[j].ns == option[i].ns) {
-            this.tree[j].children.push(val_Data);
-          }
+      // for (var i in option) {
+      //   var val_Data = option[i];
+      //   val_Data.id = "1" + i;
+      //   // val_Data.label = val_Data.tabDesc + "(" + val_Data.tab + ")"
+      //   val_Data.label = val_Data.tabDesc;
+      //   option[i].id = parseInt(option[i].id);
+      //   for (var j in this.tree) {
+      //     if (this.tree[j].ns == option[i].ns) {
+      //       this.tree[j].children.push(val_Data);
+      //     }
+      //   }
+
+      // }
+      var std = [];
+      val.filter((item) => {
+        if (std.indexOf(item.bak) == -1) {
+          std.push(item.bak);
+          this.tree.push(
+            {
+              val: item.bak,
+              label: item.bak,
+              children: [],
+            }
+          )
         }
-        // if (option[i].ns == 'bd') {
+      });
 
-        //   this.tree[0].children.push(val_Data);
-        // } else {
-        //   this.tree[1].children.push(val_Data);
-        // }
-      }
+      this.tree.filter((item) => {
+        val.filter((res) => {
+          if (item.val === res.bak) {
+            res.label = res.tabDesc
+            item.children.push(res)
+          }
+        })
+      })
+
       this.handleNodeClick(this.tree[0].children[0]);
     },
     //鎺堟潈绠$悊
@@ -725,10 +986,12 @@
     handleNodeClick(data) {
       //鍒ゆ柇鐐瑰嚮鏄惁涓哄瓙鑺傜偣
       if (data.children != null) return;
+
       this.listData.name = data.entity; //瑕佹煡璇㈣〃鏍肩被鍨嬶紱
       this.getClickTable = data;
       this.listData.pageIndex = 1;
       this.listData.pageSize = 10;
+
       this.count = 0;
       this.upAttach.tabName = data.ns + "." + data.tab;
       this.filedsLayer = this.getCollapseDomFiled(); //鑾峰彇姣忎釜琛ㄥ瓧娈靛悕绉板強闃堝��
@@ -1205,6 +1468,43 @@
       border: 1px solid #dcdfe6;
     }
   }
+  .pdfClass {
+    height: 70vh;
+    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