From 4c634c5542c4d61f33c98bc4756aca6e195ac6d2 Mon Sep 17 00:00:00 2001
From: Surpriseplus <845948745@qq.com>
Date: 星期六, 18 三月 2023 11:49:02 +0800
Subject: [PATCH] 发布管理接口对接添加预览页面

---
 src/views/datamanage/uploadmanage.vue |  157 +++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 136 insertions(+), 21 deletions(-)

diff --git a/src/views/datamanage/uploadmanage.vue b/src/views/datamanage/uploadmanage.vue
index 3a5edd0..19436aa 100644
--- a/src/views/datamanage/uploadmanage.vue
+++ b/src/views/datamanage/uploadmanage.vue
@@ -122,6 +122,13 @@
             ></i></el-input>
         </el-form-item>
         <el-form-item style="float:right">
+          <!-- 鍙戝竷 -->
+          <el-button
+            type="success"
+            size="small"
+            icon="el-icon-s-promotion"
+          >{{$t('common.publish')}}</el-button>
+          <!-- 閲嶇疆 -->
           <el-button
             type="info"
             size="small"
@@ -184,16 +191,37 @@
             align="center"
           />
           <el-table-column
+            prop="layer"
+            :label="$t('common.publishAddress')"
+            align="center"
+          />
+          <el-table-column
             prop="uname"
-            :label="$t('dataManage.vmobj.createonuser')"
+            :label="$t('common.releaseTime')"
             align="center"
           />
           <el-table-column
             prop="createTime"
-            :label="$t('dataManage.vmobj.createontime')"
+            :label="$t('common.rublisher')"
             :formatter="formatData"
             align="center"
           />
+          <el-table-column
+            min-width="150"
+            :label="$t('common.operate')"
+          >
+            <template slot-scope="scope">
+              <el-button
+                v-if="scope.row.layer"
+                size="small"
+                type="success"
+                plain
+                @click="setPreviewLayer(scope.row)"
+              >{{$t('common.preview')}}
+
+              </el-button>
+            </template>
+          </el-table-column>
         </el-table>
       </div>
       <div
@@ -204,7 +232,7 @@
           @size-change="handleSizeChange"
           @current-change="handleCurrentChange"
           :current-page="listData.pageIndex"
-          :page-sizes="[10, 20, 50, 100]"
+          :page-sizes="[100, 200, 500, 1000]"
           :page-size="listData.pageSize"
           layout="total, sizes, prev, pager, next, jumper"
           :total="listData.count"
@@ -212,15 +240,29 @@
         </el-pagination>
       </div>
     </div>
+    <!-- 鍦板潃棰勮 -->
+    <el-dialog
+      :title="$t('common.preview')"
+      :visible.sync="dialogVisible"
+      width="70%"
+      :before-close="handleClose"
+      top="13vh"
+    >
+      <div style="width:100%;height:65vh">
+        <mapview v-if="showMapView"></mapview>
+      </div>
+    </el-dialog>
+
   </div>
 </template>
 
 <script>
-
+import mapview from '../../components/preview_map.vue'
 import MyBread from "../../components/MyBread.vue"
-import { selectdepTab, selectdirTab, meta_selectVerByDirid } from '../../api/api.js'
+import { selectdepTab, selectdirTab, meta_selectVerByDirid, publish_selectMetasByPage } from '../../api/api.js'
+
 export default {
-  components: { MyBread },
+  components: { MyBread, mapview },
   data() {
     return {
       active: 'first',
@@ -235,7 +277,7 @@
       },
       listData: {
         pageIndex: 1,
-        pageSize: 10,
+        pageSize: 100,
         count: 0
       },
       multipleSelection: [],
@@ -244,19 +286,16 @@
       dirOption: [],
       verOption: [],
       typeOption: [{
-        value: 't1',
-        label: '鍏ㄩ儴'
-      }, {
-        value: 't2',
+        value: 'DOM',
         label: '褰卞儚鏁版嵁(.tif, .img)'
       }, {
-        value: 't3',
+        value: 'MPT',
         label: '鍦烘櫙鏁版嵁(.mpt)'
       }, {
-        value: 't4',
+        value: '3DML',
         label: '涓夌淮妯″瀷(.3dml)'
       }, {
-        value: 't5',
+        value: 'BIM',
         label: '涓夌淮妯″瀷(.fbx, .ifc, .rvt)'
       }],
       defaultProps: {
@@ -266,9 +305,27 @@
         checkStrictly: true,
         emitPath: false,
       },
+      dialogVisible: false,
+      showMapView: false,
+
     }
   },
   methods: {
+    //棰勮寮圭獥鎵撳紑
+    setPreviewLayer(res) {
+      this.$store.state.previewLayer = res;
+      this.dialogVisible = true;
+      this.showMapView = true;
+
+    },
+
+    //棰勮寮圭獥鍏抽棴
+    handleClose() {
+      this.dialogVisible = false;
+      this.showMapView = false;
+
+
+    },
     // 鑾峰彇澶氶�夐�変腑鐨勫璞�
     handleSelectionChange(val) {
       this.multipleSelection = val
@@ -281,6 +338,15 @@
       } else {
         return row.sizes + " MB"
       }
+    },
+    //鏍煎紡鍖栧湴鍧�
+    formatLayer(row, column) {
+      let data = row.layer
+      if (data == null) {
+        return data
+      }
+
+      return data.replace("{host}", iisHost)
     },
     //鏍煎紡鍖栨椂闂�
     formatData(row, column) {
@@ -328,7 +394,7 @@
       }
       this.listData = {
         pageIndex: 1,
-        pageSize: 10,
+        pageSize: 100,
         count: 0
       }
       this.formInline.type = this.typeOption[0].value;
@@ -343,7 +409,7 @@
         return
       }
       this.dirOption = this.treeData(data.result);
-      this.formInline.dirid = this.dirOption[0].id;
+      this.formInline.dirid = this.dirOption[0].code;
       this.formInline.dirName = this.dirOption[0].name;
       this.getVerList()
     },
@@ -370,19 +436,68 @@
     },
     //鍗曚綅鍒楄〃鍒囨崲
     handleDepChange(data, node, nodeData) {
-      this.formInline.depid = data.id
+      this.formInline.depid = data.code
       this.formInline.depName = data.name
       this.getTableData();
     },
-    //鍗曚綅鍒楄〃鍒囨崲
+    //鐩綍鍒楄〃鍒囨崲
     handleDirChange(data, node, nodeData) {
-      this.formInline.dirid = data.id
+
+      this.formInline.dirid = data.code
       this.formInline.dirName = data.name
       this.getVerList()
     },
     //鑾峰彇Table琛ㄦ牸鏁版嵁
-    getTableData() {
+    async getTableData() {
+      this.listData.depcode = this.formInline.depid;
+      this.listData.dircode = this.formInline.dirid;
+      this.listData.name = this.formInline.name;
+      this.listData.type = this.formInline.type;
+      this.listData.verid = this.formInline.verid;
+      const data = await publish_selectMetasByPage(this.listData)
+      if (data.code != 200) {
 
+      }
+      var that = this
+      var val = data.result.filter((res) => {
+        if (res.createTime) {
+          res.createTime = that.format(res.createTime);
+        }
+        if (res.layer) {
+          res.layer = res.layer.replace("{host}", iisHost);
+        }
+        return res
+      })
+      this.tableData = val;
+      this.listData.count = data.count;
+    },
+    //鏍煎紡鍖栨椂闂�
+    format(shijianchuo) {
+      //shijianchuo鏄暣鏁帮紝鍚﹀垯瑕乸arseInt杞崲
+      var time = new Date(shijianchuo);
+      var y = time.getFullYear();
+      var m = time.getMonth() + 1;
+      var d = time.getDate();
+      var h = time.getHours();
+      var mm = time.getMinutes();
+      var s = time.getSeconds();
+      return (
+        y +
+        '-' +
+        this.add0(m) +
+        '-' +
+        this.add0(d) +
+        ' ' +
+        h +
+        ':' +
+        mm +
+        ':' +
+        s
+      );
+    },
+    //鏍煎紡鍖栨椂闂�
+    add0(m) {
+      return m < 10 ? '0' + m : m;
     },
     //鑾峰彇鍗曚綅鍒楄〃
     async getDepTreeList() {
@@ -392,7 +507,7 @@
         return
       }
       this.depOption = this.treeData(data.result);
-      this.formInline.depid = this.depOption[0].id
+      this.formInline.depid = this.depOption[0].code
       this.formInline.depName = this.depOption[0].name
     },
     //鏍戝垪琛ㄧ敓鎴�

--
Gitblit v1.9.3