YaolongHan 5 лет назад
Родитель
Сommit
e828ac1bf9
2 измененных файлов с 86 добавлено и 39 удалено
  1. 70 33
      src/components/model/file/floorTable.vue
  2. 16 6
      src/views/model/file/index.vue

+ 70 - 33
src/components/model/file/floorTable.vue

@@ -3,8 +3,9 @@
     ref="filterTable"
     :data="tableData"
     style="width: 100%"
+    :height="maxHeight"
+    max-height="800px"
     :header-cell-style="{background:'#ccc',color:'#000'}"
-     height="600"
   >
     <el-table-column prop="FloorName" label="模型文件" width="180">
       <template slot-scope="scope">
@@ -21,26 +22,45 @@
         <div class="operate" v-show="!scope.row.isDown">
           <el-button
             type="primary"
-            size="mini" 
+            size="mini"
             class="iconfont icon-download"
             @click="downloadModel(scope.row)"
           ></el-button>
-          <el-button type="primary" size="mini"  class="iconfont icon-replace" @click="repliaceModel(scope.row)"></el-button>
-          <el-button type="primary" size="mini"  class="iconfont icon-Log" @click="queryModelLog(scope.row)"></el-button>
+          <el-button
+            type="primary"
+            size="mini"
+            class="iconfont icon-replace"
+            @click="repliaceModel(scope.row)"
+          ></el-button>
+          <el-button
+            type="primary"
+            size="mini"
+            class="iconfont icon-Log"
+            @click="queryModelLog(scope.row)"
+          ></el-button>
         </div>
-        <div :class="[scope.row.Status == 1 ||scope.row.Status == 2 ? 'upLoad-loading':'','upLoad']" v-show="scope.row.isDown">
+        <div
+          :class="[scope.row.Status == 1 ||scope.row.Status == 2 ? 'upLoad-loading':'','upLoad']"
+          v-show="scope.row.isDown"
+        >
           <div class="progress">
-          <el-progress
-            :text-inside="scope.row.Status == 1 || scope.row.Status == 2 ?false:true"
-            :stroke-width="20"
-            :percentage="scope.row.precent"
-            :status="scope.row.Status == 1 || scope.row.Status == 2 ?'warning':'success'"
-          ></el-progress>
+            <el-progress
+              :text-inside="scope.row.Status == 1 || scope.row.Status == 2 ?false:true"
+              :stroke-width="20"
+              :percentage="scope.row.precent"
+              :status="scope.row.Status == 1 || scope.row.Status == 2 ?'warning':'success'"
+            ></el-progress>
           </div>
           <div class="progress-right">
-          <el-button v-show="!scope.row.Status" type="danger" icon="el-icon-delete" @click="closeUpdate(scope.row)" circle></el-button>
-          <span v-show="scope.row.Status == 1">等待检查...</span>
-          <span v-show="scope.row.Status == 2">模型检查中</span>
+            <el-button
+              v-show="!scope.row.Status"
+              type="danger"
+              icon="el-icon-delete"
+              @click="closeUpdate(scope.row)"
+              circle
+            ></el-button>
+            <span v-show="scope.row.Status == 1">等待检查...</span>
+            <span v-show="scope.row.Status == 2">模型检查中</span>
           </div>
         </div>
       </template>
@@ -48,13 +68,19 @@
   </el-table>
 </template>
 <script>
+import { mapGetters } from "vuex";
 export default {
   props: {
     tableData: Array,
     persentList: Array
   },
   data() {
-    return {};
+    return {
+      maxHeight: 0
+    };
+  },
+  computed: {
+    ...mapGetters("layout", ["projectId", "userInfo", "userId", "secret"])
   },
   methods: {
     // 查看日志
@@ -70,13 +96,13 @@ export default {
         if (item.Id == Id) {
           if (precent >= 100) {
             // 如过precent == 100 不能关闭进度条,
-            if(precent == 100){
+            if (precent == 100) {
               item.precent = 99;
-            }else if(precent == 101){
-               // 如过precent == 101 则返回结果为suceess 不能关闭进度条,
-                   item.precent = 100;
-                   item.isDown = false;
-                   this.$emit('percentFinish')
+            } else if (precent == 101) {
+              // 如过precent == 101 则返回结果为suceess 不能关闭进度条,
+              item.precent = 100;
+              item.isDown = false;
+              this.$emit("percentFinish");
             }
             return;
           } else {
@@ -98,7 +124,14 @@ export default {
     },
     // 停止上传
     closeUpdate(item) {
-      this.$emit("closeUpdateFile", item);
+      if (this.userInfo.username ==item.UserName ) {
+        this.$emit("closeUpdateFile", item);
+      } else {
+        this.$message({
+          message:"您不是该文件的上传者,不能停止该文件上传!",
+          type: "error"
+        });
+      }
     }
   },
   watch: {
@@ -116,32 +149,36 @@ export default {
       }
     }
   },
-  mounted() {}
+  mounted() {
+    this.$nextTick(function() {
+      this.maxHeight = $("#file_moddle_manage").height() - 60; // 获取最外层的高度
+    });
+  }
 };
 </script>
 <style scoped lang="less">
 .box-card {
-  min-height: 800px;
-  .upLoad{
+  height: 100%;
+  .upLoad {
     display: flex;
     justify-content: flex-start;
     align-items: center;
-    .progress{
+    .progress {
       width: 160px;
       height: 20px;
     }
   }
-  .upLoad-loading{
+  .upLoad-loading {
     position: relative;
-     justify-content: center;
-     .progress{
-       width: 200px
-     }
-    .progress-right{
+    justify-content: center;
+    .progress {
+      width: 200px;
+    }
+    .progress-right {
       position: absolute;
       left: 40%;
       top: 50%;
-      transform: translate(-50%,-50%);
+      transform: translate(-50%, -50%);
       color: #909399;
     }
   }

+ 16 - 6
src/views/model/file/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div id="file_moddle_manage" v-loading="loading">
     <!-- 左边模型文件夹列表 -->
-    <el-col :span="5">
+    <el-col class="col_left" :span="5">
       <div class="grid-content grid-left">
         <el-card class="box-card" :body-style="{ padding: '0px' }">
           <div class="top_hand left_top_hand">
@@ -41,7 +41,7 @@
       </div>
     </el-col>
     <!-- 右边文件表格 -->
-    <el-col :span="19">
+    <el-col class="col_left" :span="19">
       <el-card class="box-card" :body-style="{ padding: '0px' }">
         <!-- 顶部操作栏 -->
         <div class="top_hand right_top_hand">
@@ -156,7 +156,7 @@ export default {
         model: {}
       },
       persentList: [], //请求进度列表
-      uploadClassList: [] //请求list 用与缓存多个请求问题
+      uploadClassList: [], //请求list 用与缓存多个请求问题
     };
   },
   methods: {
@@ -234,11 +234,11 @@ export default {
       return new Promise((resolve, reject) => {
         request.queryFloorList(data, res => {
           res.Content.map(item => {
-            // 显示进度条
+            // 显示进度条:Status == 0 || null 正在上传 ;:Status == 1:等待检查;Status == 2:模型检查中; Status == 3 文件上传完成
             if (item.Status == 3) {
               Object.assign(item, { isDown: false, precent: 0 });
             } else {
-               Object.assign(item, { isDown: true, precent: 0 });
+               Object.assign(item, { isDown: true, precent: 100 });
               if (this.persentList.length != 0) {
                 this.persentList.forEach(pItem => {
                   if (item.Id == pItem.Id) {
@@ -495,8 +495,16 @@ export default {
 <style lang="less" scoped>
 #file_moddle_manage {
   width: 100%;
+  height: 100%;
+  overflow: hidden !important;
+  .col_left{
+    height:  100%;
+  }
+  .grid-content{
+    height:100%;
+  }
   .box-card {
-    min-height: 700px;
+    height:100%;
   }
   .grid-left {
     padding-right: 10px;
@@ -546,6 +554,8 @@ export default {
     .lists {
       width: 100%;
       margin-top: 10px;
+      height: 100%;
+      overflow-y:scroll
       li {
         height: 42px;
         display: flex;