瀏覽代碼

合并冲突

liyangzheng 2 年之前
父節點
當前提交
4cc2416075
共有 1 個文件被更改,包括 37 次插入16 次删除
  1. 37 16
      src/views/myfile/MyFile.vue

+ 37 - 16
src/views/myfile/MyFile.vue

@@ -179,9 +179,9 @@
                 <div class="fileTable">
                     <el-collapse v-model="files" accordion class="collapse" style="height: 200px;">
                         <el-collapse-item title="文件" name="2" class="">
-                            <el-table :data="fileList" style="width: 100%" @row-contextmenu="handleRowClick"
-                                @selection-change="handleSelectionChange" @row-click="mouseClick"
-                                :default-sort="{ prop: 'createTime', order: 'descending' }">
+                            <el-table :data="fileList" style="width: 100%;position: relative;"
+                                @row-contextmenu="handleRowClick" @selection-change="handleSelectionChange"
+                                @row-click="mouseClick" :default-sort="{ prop: 'createTime', order: 'descending' }">
                                 <el-table-column type="selection" width="55" />
                                 <el-table-column label="名称" width="200">
                                     <template #default="scope">
@@ -200,14 +200,14 @@
                                 <el-table-column label="大小">
                                     <template #default="scope">
                                         <span>
-                                            {{ scope.row.fileSize }}KB
+                                            {{ formatFileSize(scope.row.fileSize) }}
                                         </span>
                                     </template>
                                 </el-table-column>
                             </el-table>
                         </el-collapse-item>
                     </el-collapse>
-                    <div class="setCli" v-if="cliCC">
+                    <div class="setCli" v-if="cliCC" :style="{ left: xz + 'px', top: yz - 260 + 'px' }">
                         <template v-for="(item, index) in filterMouseCli()">
                             <p @click="chooseSet(item, index)" class="chooseSet">
                                 <img :src="item.img" alt="">
@@ -232,10 +232,10 @@
             </div>
             <div v-else>
                 <div>
-                    <el-button @click="editOnline = true;historyPrew=false">返回</el-button>
+                    <el-button @click="editOnline = true; historyPrew = false">返回</el-button>
                 </div>
-                <FileEdit :docId="clickRowId" :copyRow="copyRow" :historyPrew="historyPrew"
-                    :historycopyRow="historycopyRow" :onlyView="onlyView" @cancleHistoryPrew="cancleHistoryPrew"></FileEdit>
+                <FileEdit :docId="clickRowId" :copyRow="copyRow" :historyPrew="historyPrew" :historycopyRow="historycopyRow"
+                    :onlyView="onlyView" @cancleHistoryPrew="cancleHistoryPrew"></FileEdit>
             </div>
             <!-- 扩容弹窗 -->
             <div>
@@ -420,6 +420,8 @@ export default {
         const delMoreFile=ref([])  //删除多个文件夹
         const historyTotal=ref(0)
         const historyPrew = ref(false)
+        let xz = ref(0)
+        let yz = ref(0)
         const fileUserTreeData = reactive({ data: {} });
         let fileList = ref([
         ])
@@ -600,7 +602,7 @@ export default {
                             console.error("myfile.getAllFileMenu 调用失败:", error);
                         });
                 } else {
-                    myfile.getById(res.data[0].dirId - 0)
+                    myfile.getById(row.dirId - 0)
                         .then(res => {
                             if (res.code === 200) {
                                 fileList.value = res.rows;
@@ -641,6 +643,8 @@ export default {
             e.preventDefault();
             e.stopPropagation();
             console.log(e, 'xxyy');
+            xz.value = e.pageX
+            yz.value = e.pageY
             copyRow.value = row
             clickRowId.value = row.docId
             copyDirId.value = row.dirId
@@ -759,8 +763,8 @@ export default {
             oneOrTwo.value = num
             folderCase.value = true
         }
-        function cancleHistoryPrew(val){
-            historyPrew.value=false
+        function cancleHistoryPrew(val) {
+            historyPrew.value = false
         }
         function createNewFile() {
             addFile.value = true
@@ -1084,6 +1088,21 @@ export default {
                 }
             })
         }
+        function formatFileSize(fileSize) {
+            if (fileSize >= 1024 * 1024 * 1024) {
+                // 大于等于1GB,显示GB
+                return (fileSize / (1024 * 1024 * 1024)).toFixed(2) + 'GB';
+            } else if (fileSize >= 1024 * 1024) {
+                // 大于等于1MB,显示MB
+                return (fileSize / (1024 * 1024)).toFixed(2) + 'MB';
+            } else if (fileSize >= 1024) {
+                // 大于等于1KB,显示KB
+                return (fileSize / 1024).toFixed(2) + 'KB';
+            } else {
+                // 小于1KB,显示字节
+                return fileSize + 'B';
+            }
+        }
         onMounted(() => {
             getAllTop()
             // 添加监听,点击其他地方关闭文件夹右键菜单
@@ -1216,7 +1235,10 @@ export default {
             folderTotal,
             fileTotal,
             delMoreFile,//删除多个文件夹
-            topPath
+            topPath,
+            xz,
+            yz,
+            formatFileSize,
         }
     },
     watch: {
@@ -1390,14 +1412,13 @@ p {
 }
 
 .fileTable {
-    position: relative;
     height: 100%;
-    /* overflow-y: auto; */
+    overflow-y: hidden;
 }
 
 .setCli {
     width: 156px;
-    max-height: 380px;
+    max-height: auto;
     position: absolute;
     top: -70px;
     left: 300px;
@@ -1405,7 +1426,7 @@ p {
     background-color: white;
     border: 1px solid gray;
     border-radius: 4px;
-    z-index: 10;
+    z-index: 3;
     overflow-y: auto;
     // font-size: 16px;
 }