Browse Source

下载模型文件、下载BIMID模型文件 时,优先使用接口返回的FetchUrl字段,该字段的值为文件的下载地址

niuheng 3 years ago
parent
commit
c1797e1839
1 changed files with 127 additions and 39 deletions
  1. 127 39
      src/components/model/file/floorTable.vue

+ 127 - 39
src/components/model/file/floorTable.vue

@@ -1,40 +1,110 @@
 <template>
   <div class="filterTable-container">
-    <el-table ref="filterTable" :data="tableData" style="width: 100%" height="100%" :header-cell-style="{background:'#d9d9d9',color:'#2b2b2b'}">
+    <el-table
+      ref="filterTable"
+      :data="tableData"
+      style="width: 100%"
+      height="100%"
+      :header-cell-style="{ background: '#d9d9d9', color: '#2b2b2b' }"
+    >
       <el-table-column prop="FloorName" label="模型文件" width="180">
         <template slot-scope="scope">
-          <i v-if="scope.row.Status == 4" class="iconfont icon-yun--tianchong" style="color:#67C23A;cursor:pointer;fontSize:18px;" title="模型校验完成..."
-            @click="toPathControl(scope.row)"></i>
-          <i v-else-if="scope.row.Status == 31" class="iconfont icon-yun--tianchong1" style="color:#F56C6C;cursor:pointer;fontSize:18px;"
-            title="同步到数据中心出问题..." @click="toPathControl(scope.row)"></i>
-          <i v-else-if="scope.row.Status == 21" class="iconfont icon-yun--tianchong1" style="color:#F56C6C;cursor:pointer;fontSize:18px;"
-            title="模型数据导出出问题..." @click="toPathControl(scope.row)"></i>
-          <i v-else class="iconfont icon-yun--tianchong2" style="color:#E6A23C;cursor:pointer;fontSize:18px;" title="模型校验进行中..."
-            @click="toPathControl(scope.row)"></i>
+          <i
+            v-if="scope.row.Status == 4"
+            class="iconfont icon-yun--tianchong"
+            style="color: #67c23a; cursor: pointer; fontsize: 18px"
+            title="模型校验完成..."
+            @click="toPathControl(scope.row)"
+          ></i>
+          <i
+            v-else-if="scope.row.Status == 31"
+            class="iconfont icon-yun--tianchong1"
+            style="color: #f56c6c; cursor: pointer; fontsize: 18px"
+            title="同步到数据中心出问题..."
+            @click="toPathControl(scope.row)"
+          ></i>
+          <i
+            v-else-if="scope.row.Status == 21"
+            class="iconfont icon-yun--tianchong1"
+            style="color: #f56c6c; cursor: pointer; fontsize: 18px"
+            title="模型数据导出出问题..."
+            @click="toPathControl(scope.row)"
+          ></i>
+          <i
+            v-else
+            class="iconfont icon-yun--tianchong2"
+            style="color: #e6a23c; cursor: pointer; fontsize: 18px"
+            title="模型校验进行中..."
+            @click="toPathControl(scope.row)"
+          ></i>
           <span style="margin-left: 10px">{{ scope.row.FloorName }}</span>
         </template>
       </el-table-column>
-      <el-table-column prop="Note" label="备注" :show-overflow-tooltip="true" width="240"></el-table-column>
+      <el-table-column
+        prop="Note"
+        label="备注"
+        :show-overflow-tooltip="true"
+        width="240"
+      ></el-table-column>
       <el-table-column label="版本号">
         <template slot-scope="scope">
           <span style="margin-right: 5px">{{ scope.row.Version }}</span>
-          <i v-show="scope.row.Version && scope.row.Status == 4" class="iconfont icon-warn" style="cursor:pointer;position:relative;top:1px;" title="查看版本更新信息" @click="handleClickVersion(scope.row)"></i>
+          <i
+            v-show="scope.row.Version && scope.row.Status == 4"
+            class="iconfont icon-warn"
+            style="cursor: pointer; position: relative; top: 1px"
+            title="查看版本更新信息"
+            @click="handleClickVersion(scope.row)"
+          ></i>
         </template>
       </el-table-column>
       <el-table-column prop="RevitVersion" label="revit版本"></el-table-column>
-      <el-table-column prop="AcceptTime" label="上传时间" width="200"></el-table-column>
+      <el-table-column
+        prop="AcceptTime"
+        label="上传时间"
+        width="200"
+      ></el-table-column>
       <el-table-column prop="UserName" label="上传人"></el-table-column>
       <el-table-column prop="address" align="center" label="操作" width="240">
         <template slot-scope="scope">
           <div class="operate" v-show="scope.row.Status == 4">
-            <el-button title="下载模型" type="primary" size="mini" class="iconfont icon-download" @click="downloadModel(scope.row)"></el-button>
-            <el-button title="替换模型" type="primary" size="mini" class="iconfont icon-replace" @click="repliaceModel(scope.row)"></el-button>
-            <el-button title="查看版本日志" type="primary" size="mini" class="iconfont icon-Log" @click="queryModelLog(scope.row)"></el-button>
-            <el-button title="下载BIMID模型" type="primary" size="mini" class="el-icon-download" @click="downloadModelBIMID(scope.row)"></el-button>
+            <el-button
+              title="下载模型"
+              type="primary"
+              size="mini"
+              class="iconfont icon-download"
+              @click="downloadModel(scope.row)"
+            ></el-button>
+            <el-button
+              title="替换模型"
+              type="primary"
+              size="mini"
+              class="iconfont icon-replace"
+              @click="repliaceModel(scope.row)"
+            ></el-button>
+            <el-button
+              title="查看版本日志"
+              type="primary"
+              size="mini"
+              class="iconfont icon-Log"
+              @click="queryModelLog(scope.row)"
+            ></el-button>
+            <el-button
+              title="下载BIMID模型"
+              type="primary"
+              size="mini"
+              class="el-icon-download"
+              @click="downloadModelBIMID(scope.row)"
+            ></el-button>
           </div>
           <div :class="['upLoad-loading']" v-show="scope.row.Status != 4">
             <div class="progress">
-              <el-progress :text-inside="false" :stroke-width="20" :percentage="100" :color="scope.row.Status?'#909399':'#67C23A'"></el-progress>
+              <el-progress
+                :text-inside="false"
+                :stroke-width="20"
+                :percentage="100"
+                :color="scope.row.Status ? '#909399' : '#67C23A'"
+              ></el-progress>
             </div>
             <div class="progress-right">
               <span v-if="!scope.row.Status">上传中...</span>
@@ -54,7 +124,11 @@
         </template>
       </el-table-column>
     </el-table>
-    <version-dialog :dialogVisible.sync="dialogVisible" :modelFile="modelFile" ref="addSpaceDialog"></version-dialog>
+    <version-dialog
+      :dialogVisible.sync="dialogVisible"
+      :modelFile="modelFile"
+      ref="addSpaceDialog"
+    ></version-dialog>
   </div>
 </template>
 <script>
@@ -62,22 +136,22 @@ import { mapGetters } from "vuex";
 import versionDialog from "@/components/model/file/versionDialog";
 export default {
   components: {
-    versionDialog
+    versionDialog,
   },
   props: {
     tableData: Array,
     persentList: Array,
-    modelFolderName: String
+    modelFolderName: String,
   },
   data() {
     return {
       maxHeight: 0,
       dialogVisible: false,
-      modelFile: null
+      modelFile: null,
     };
   },
   computed: {
-    ...mapGetters("layout", ["projectId", "userInfo", "userId", "secret"])
+    ...mapGetters("layout", ["projectId", "userInfo", "userId", "secret"]),
   },
   methods: {
     // 查看日志
@@ -94,15 +168,14 @@ export default {
       if (item.Status != 4) {
         this.$alert("正在识别模型对象,请稍后再替换。", "替换模型", {
           confirmButtonText: "确定",
-          callback: action => {
-          }
+          callback: (action) => {},
         });
       } else {
         this.$emit("replaceModel", item);
       }
     },
     filterTag(Id, precent) {
-      this.$refs.filterTable.data.map(item => {
+      this.$refs.filterTable.data.map((item) => {
         if (item.Id == Id) {
           if (precent >= 100) {
             // 如过precent == 100 不能关闭进度条,
@@ -122,7 +195,11 @@ export default {
     },
     // 下载模型文件
     downloadModel(item) {
-      let url = item.Url.match(/(\/image-service\S*)$/g) ? item.Url.match(/(\/image-service\S*)$/g)[0] : ''
+      let url =
+        item.FetchUrl ||
+        (item.Url.match(/(\/image-service\S*)$/g)
+          ? item.Url.match(/(\/image-service\S*)$/g)[0]
+          : "");
       if (url) {
         let a = document.createElement("a");
         a.href = url;
@@ -133,13 +210,17 @@ export default {
       } else {
         this.$message({
           message: "该文件夹下没有资源",
-          type: "error"
+          type: "error",
         });
       }
     },
     // 下载BIMID模型文件
     downloadModelBIMID(item) {
-      let url = item.Url.match(/(\/image-service\S*)$/g) ? item.Url.match(/(\/image-service\S*)$/g)[0] : ''
+      let url =
+        item.FetchUrl ||
+        (item.Url.match(/(\/image-service\S*)$/g)
+          ? item.Url.match(/(\/image-service\S*)$/g)[0]
+          : "");
       if (url) {
         let a = document.createElement("a");
         a.href = url;
@@ -150,7 +231,7 @@ export default {
       } else {
         this.$message({
           message: "该文件夹下没有资源",
-          type: "error"
+          type: "error",
         });
       }
     },
@@ -161,21 +242,21 @@ export default {
       } else {
         this.$message({
           message: "您不是该文件的上传者,不能停止该文件上传!",
-          type: "error"
+          type: "error",
         });
       }
     },
     // 跳转至模型流程处理监控
     toPathControl(row) {
       this.$router.push({
-        path: '/model/path',
+        path: "/model/path",
         query: {
           Id: row.CurrentModelId,
           Size: row.Size,
-          OriginalName: row.OriginalName
-        }
-      })
-    }
+          OriginalName: row.OriginalName,
+        },
+      });
+    },
   },
   watch: {
     persentList: {
@@ -183,15 +264,15 @@ export default {
       deep: true,
       handler: function (val, oldVal) {
         if (val.length != 0) {
-          val.map(item => {
+          val.map((item) => {
             if (item.precent != 0) {
               this.filterTag(item.Id, item.precent);
             }
           });
         }
-      }
-    }
-  }
+      },
+    },
+  },
 };
 </script>
 <style scoped lang="less">
@@ -260,4 +341,11 @@ export default {
 /deep/ .el-progress-bar__inner {
   text-align: center;
 }
+
+
+
+
+
+
+
 </style>