liyangzheng 1 년 전
부모
커밋
d4bf4898da
4개의 변경된 파일148개의 추가작업 그리고 81개의 파일을 삭제
  1. 3 2
      src/views/department/MyFile.vue
  2. 92 36
      src/views/department/modalComponebts/Transfer.vue
  3. 52 42
      src/views/myfile/MyFile.vue
  4. 1 1
      src/views/search/index.vue

+ 3 - 2
src/views/department/MyFile.vue

@@ -24,7 +24,7 @@
                     <!-- v-for盒子 -->
                     <div style="display: flex;justify-content: flex-start;align-items: flex-start;flex-wrap: wrap;align-content: flex-start;overflow-y: auto;">
                         <template v-for="(item, index) in fileMenu" :key="index">
-                            <div class="setBox" @click="changeFile(item, index)">
+                            <div class="setBox" >
                                 <el-dropdown trigger="click" class="selectChe">
                                     <span class="el-dropdown-link">
                                         ...
@@ -37,7 +37,7 @@
                                         </el-dropdown-menu>
                                     </template>
                                 </el-dropdown>
-                            <div class="left_fileBox">
+                            <div class="left_fileBox" @click="changeFile(item, index)">
                                 <el-tooltip
                                     class="box-item tool-tip"
                                     effect="dark"
@@ -1908,6 +1908,7 @@ p {
     position: relative;
     .left_fileBox{
         position: relative;
+        margin-top: 10px;
         .levelImg{
             width: 32px;
             height: 32px;

+ 92 - 36
src/views/department/modalComponebts/Transfer.vue

@@ -2,30 +2,33 @@
     <div>
         <!-- 穿梭框 -->
         <div>
-            <el-dialog v-model="transferModals" title="分享"  :close-on-click-modal="false">
+            <el-dialog v-model="transferModals" title="分享" width="40%" :close-on-click-modal="false">
                 <div class="transBox">
                     <div class="allBag">
-                        <el-input style="width: 220px;margin-left: 18px;margin-top:5px" v-model="allBag"
-                            placeholder="搜索"></el-input>
+                        <div style="position: relative;">
+                            <el-input style="width: 220px;margin-left: 18px;margin-top:5px" v-model="allBag"
+                                 placeholder="搜索"></el-input>
+                        </div>
                         <div class="allLog">
-                            <el-tree ref="treeRef" :data="allTreeData" :props="allTreeProps" show-checkbox node-key="id"
-                                :default-expanded-keys="openTree" @check-change="allTreeChange"
-                                :default-checked-keys="backScreen" :check-strictly="false" />
+                            <el-tree :filter-node-method="filterNode" v-if="have" ref="treeRef" :data="allTreeData"
+                                :props="allTreeProps" show-checkbox node-key="id" :default-expanded-keys="openTree"
+                                @check-change="allTreeChange" :default-checked-keys="backScreen" :check-strictly="false" />
+                            <span v-else>暂无数据</span>
                         </div>
                     </div>
                     <div class="needBag">
                         <div style="border-bottom: 1px solid gray;" class="needBag_top">
                             <span>已选择{{ chooseTagData.length }}人</span>
-                            <span style="color: red;font-size: 14px;float: right;">清空</span>
+                            <span style="color: red;font-size: 14px;float: right;cursor: pointer;"
+                                @click="cleanPeople">清空</span>
                         </div>
                         <div class="needLog">
-                              <el-scrollbar height="349px">
-                                    <el-tag v-for="(item, index) in chooseTagData" :key="index" class="tagtag"
-                                    :closable="lastPeople" @close="handleClose(item)">
+                            <el-scrollbar height="349px">
+                                <el-tag v-for="(item, index) in chooseTagData" :key="index" class="tagtag" :closable="true"
+                                    @close="handleClose(item)">
                                     {{ item.userName ? item.userName : item.name }}
-                                    </el-tag>
-                              </el-scrollbar>
-
+                                </el-tag>
+                            </el-scrollbar>
                         </div>
                     </div>
                 </div>
@@ -43,7 +46,7 @@
 </template>
 
 <script>
-import { ref, onMounted, toRef } from 'vue';
+import { ref, onMounted, toRef, watch } from 'vue';
 import userTree from '../../../api/user/userTree';
 import fileShare from '../../../api/fileShare/fileShare';
 import fileCount from '../../../api/fileCount/fileCount'
@@ -52,15 +55,15 @@ export default {
     props: {
         thanks: {
             type: Boolean,
-            // required: true
+            required: true
         },
         clickRowId: {
             type: Number,
-            // required: true
+            required: true
         },
         workOrEdit: {
             type: Number,
-            // required: true
+            required: true
         },
         isNewMenu: {
             type: Boolean,
@@ -81,12 +84,15 @@ export default {
             disabled: false,
             id: "id"
         }
+        let treeRef = ref(null)
         let openTree = ref([])
         let chooseTagData = ref([])
         let allBag = ref('')
         let needTagData = ref([])
         let backScreen = ref([])
         let lastPeople = ref(false)
+        let allCancel = ref(false)
+        let have = ref(true)
         function allTeam() {
             if (result) {
                 transferModals.value = result
@@ -94,6 +100,7 @@ export default {
         }
         // 分享穿梭框
         function allTreeChange(e) {
+            // console.log('触发了change事件'+ 1++);
             const id = e.id;
             const label = e.label;
             const disabled = e.disabled;
@@ -104,15 +111,15 @@ export default {
                 chooseTagData.value.splice(existingIndex, 1);
             } else {
                 // 选择操作,将数据添加到 needTagData 中
-                chooseTagData.value.push({ userId: id, userName: label ,disabled:disabled});
+                chooseTagData.value.push({ userId: id, userName: label, disabled: disabled });
             }
             if (chooseTagData.value.length === 1) {
                 lastPeople.value = true
             } else {
                 lastPeople.value = false
             }
-            chooseTagData.value = chooseTagData.value.filter(item=>!item.disabled)
-            console.log('chooseTagData',chooseTagData.value);
+            chooseTagData.value = chooseTagData.value.filter(item => !item.disabled)
+            // console.log('chooseTagData初始数组',chooseTagData.value);
         }
         // 确认分享
         function sureShare() {
@@ -166,9 +173,7 @@ export default {
         }
         // 获取用户树
         function getAllUser() {
-            console.log('feeh',feeh);
             userTree.getUserTree({}).then(res => {
-                console.log('userTree',res);
                 allTreeData.value = [res]
                 userTree.getUserTree({}).then(res => {
                     allTreeData.value = [res];
@@ -196,11 +201,8 @@ export default {
                     })
                 })
             }
-            if(feeh === 0){
-                 fileCount.getActor(dees).then(res => {
-                    // 去除数组内部的重复元素
-                    // const uniqueRes = Array.from(new Set(res.map(item => item.userName))).map(id => res.find(item => item.userName === id));
-                    // 现在的 uniqueRes 数组不包含重复元素
+            if (feeh === 0) {
+                fileCount.getActor(dees).then(res => {
                     chooseTagData.value = res;
                     backScreen.value = chooseTagData.value.map(item => {
                         return item.userId
@@ -213,17 +215,57 @@ export default {
             }
 
         }
+        function cleanPeople() {
+            treeRef.value.setCheckedKeys([]);
+            chooseTagData.value = [];
+            setTimeout(() => {
+                antherClean()
+            })
+        }
+        function antherClean() {
+            treeRef.value.setCheckedKeys([]);
+            chooseTagData.value = [];
+        }
+        function searchInTreeData(treeData, searchValue) {
+            const foundItems = [];
+            function traverseTree(node) {
+                if (node.label.includes(searchValue)) {
+                    foundItems.push(node);
+                }
+                if (node.children) {
+                    node.children.forEach(childNode => traverseTree(childNode));
+                }
+            }
+            treeData.forEach(node => traverseTree(node));
+            return foundItems;
+        }
+        watch(()=>allBag.value,(val)=>{
+            treeRef.value?.filter(val)
+        })
+        function filterNode(value, data) {
+            if (!value) return true
+            return data.label.includes(value)
+        }
         function getBack() {
             transferModals.value = false
             emit("getCback", transferModals.value)
         }
         function handleClose(tag) {
             chooseTagData.value.splice(chooseTagData.value.indexOf(tag), 1);
-            // 从标签中获取 userId
-            // const userId = tag.userId;
-            // 从 chooseTagData 中筛选出不包含当前 userId 的标签
-            // chooseTagData.value = chooseTagData.value.filter(item => item.userId !== userId)
-
+            let result = chooseTagData.value.map((item) => {
+                return item.userId
+            })
+            treeRef.value.setCheckedKeys(result);
+            setTimeout(() => {
+                antherClose(tag)
+            }, 10)
+        }
+        function antherClose(tag) {
+            chooseTagData.value.splice(chooseTagData.value.indexOf(tag), 1);
+            let result = chooseTagData.value.map((item) => {
+                return item.userId
+            })
+            treeRef.value.setCheckedKeys(result);
         }
         onMounted(() => {
             allTeam()
@@ -248,6 +290,10 @@ export default {
             lastPeople,
             feeh,
             backToFather: getBack,
+            cleanPeople,
+            treeRef,
+            have,
+            filterNode,
         }
     }
 }
@@ -275,14 +321,16 @@ export default {
 
 .allBag {
     width: 255px;
-    height: 380px;
+    height: 400px;
     border: 1px solid green;
+    overflow-y: auto;
 }
 
 .needBag {
     width: 255px;
-    height: 380px;
+    height: 400px;
     border: 1px solid green;
+    overflow-y: auto;
 }
 
 .allLog {
@@ -291,16 +339,20 @@ export default {
     margin: 5px auto;
     /* border: 1px solid red; */
     overflow-y: auto;
+    text-align: center;
 }
-.needBag_top{
+
+.needBag_top {
     padding: 0 10px;
     height: 30px;
     display: flex;
     align-items: center;
     justify-content: space-between;
 }
-.needLog{
+
+.needLog {
     height: 100%;
+    overflow-y: auto;
 }
 
 :deep(.el-tag__content) {
@@ -310,4 +362,8 @@ export default {
 :deep(.el-icon el-tag__close) {
     display: block;
 }
+
+:deep(.el-scrollbar__wrap .el-scrollbar__wrap--hidden-default) {
+    height: 346px !important;
+}
 </style>

+ 52 - 42
src/views/myfile/MyFile.vue

@@ -26,12 +26,11 @@
                     <div
                         style="display: flex;justify-content: flex-start;align-items: flex-start;flex-wrap: wrap;align-content: flex-start;overflow-y: auto;">
                         <template v-for="(item, index) in fileMenu" :key="index">
-                            <div class="setBox" @click="changeFile(item, index)">
+                            <div class="setBox">
                                 <el-dropdown trigger="click" class="selectChe">
                                     <span class="el-dropdown-link">
                                         ...
                                     </span>
-
                                     <template #dropdown>
                                         <el-dropdown-menu>
                                             <el-dropdown-item @click="restName(item, index)">重命名</el-dropdown-item>
@@ -40,7 +39,7 @@
                                         </el-dropdown-menu>
                                     </template>
                                 </el-dropdown>
-                                <div class="left_fileBox">
+                                <div class="left_fileBox" @click="changeFile(item, index)">
                                     <el-tooltip class="box-item tool-tip" effect="dark" placement="top-start"
                                         v-if="item.encryptLevel">
                                         <template #content><span>安全级别: {{ item.encryptLevel == 'L1' ? '敏感' :
@@ -373,8 +372,8 @@
                     </el-upload>
                     <template #footer>
                         <span class="dialog-footer">
-                            <el-button @click="closeUpload">取消</el-button>
-                            <el-button type="primary" @click="sureUpload">确认</el-button>
+                            <el-button @click="uploadModal = false">取消</el-button>
+                            <el-button type="primary" @click="throttleSureUpload">确认</el-button>
                         </span>
                     </template>
                 </el-dialog>
@@ -543,6 +542,8 @@ export default {
         let newAdd = ref(false)
         const loadingUpload = ref(false);//文件上传加载
         const fileUserTreeData = reactive({ data: {} });
+        // 创建一个 ref 用于标记节流状态
+        const throttled = ref(false);
         let fileList = ref()
         let menuList = ref([
             {
@@ -725,7 +726,6 @@ export default {
         }
         function changeFile(row, num) {
             // 创建标签
-
             const addData = {
                 path: '/myfile' + row.dirId,
                 name: row.dirName,
@@ -733,7 +733,6 @@ export default {
             }
             addFolderAdd(addData)
             thisFolder.value = row
-            console.log('row2', row);
             topPath.value = row.dirPath
             if (row.isEncrypt === "Y") {
                 getLeveldetailFn(row.encryptLevel)
@@ -1075,44 +1074,49 @@ export default {
                 uploadModal.value = false
             }
         }
+        function throttleSureUpload() {
+            if (!throttled.value) {
+                sureUpload();
+                throttled.value = true;
+                setTimeout(() => {
+                    throttled.value = false;
+                }, 5000); // 设置节流的时间间隔为 1000 毫秒(1秒)
+            }
+        }
         // 确认上传
         function sureUpload() {
-          loadingUpload.value =true
-          if(useSpace.value*1024+fileBig.value > allSpace.value*1024*1024){
-            ElMessage({
-                message:"超过最大容量,请联系管理员扩容",
-                type:"wanning",
-            })
-            return
-          }else{
-            if (fileArr.value.length > 0) {
-                for (var i = 1; i <= fileArr.value.length; i++) {
-                    uploadApi.uploadFile({
-                        spaceId: newSpaceId.value - 0,
-                        dirId: newDirId.value - 0,
-                        file: fileArr.value[i - 1]
-                    }).then(res => {
-                        if (res.code === 200) {
-                            ElMessage({
-                                message: "上传文件成功",
-                                type: "success"
-                            })
-                            // getAllTop()
-                            refreshFile()
-                            uploadModal.value = false
-                            loadingUpload.value = false
+            if (useSpace.value * 1024 * 1024 + fileBig.value / 1024 > allSpace.value * 1024 * 1024) {
+                ElMessage({
+                    message: "超过最大容量,请联系管理员扩容",
+                    type: "error",
+                })
+                return
+            } else {
+                if (fileArr.value.length > 0) {
+                    for (var i = 1; i <= fileArr.value.length; i++) {
+                        uploadApi.uploadFile({
+                            spaceId: newSpaceId.value - 0,
+                            dirId: newDirId.value - 0,
+                            file: fileArr.value[i - 1]
+                        }).then(res => {
+                            if (res.code === 200) {
+                                ElMessage({
+                                    message: "上传文件成功",
+                                    type: "success"
+                                })
+                                // getAllTop()
+                                refreshFile()
+                                uploadModal.value = false
+                                fileArr.value = []
+                            }
+                        }).catch(err => {
                             fileArr.value = []
-                        }
-                    }).catch(err => {
-                        fileArr.value = []
-                        loadingUpload.value = false
-                    })
+                        })
+                    }
+                } else {
+                    return ElMessage({ message: "请选择文件", type: "error" })
                 }
-            }else{
-                loadingUpload.value = false
-               return ElMessage({ message: "请选择文件", type: "error"})
             }
-          }
 
         }
         function onSuccess(files, val) {
@@ -1970,7 +1974,9 @@ export default {
             fileBlur,
             fileBig,
             loadingUpload,
-            closeUpload
+            closeUpload,
+            throttled,
+            throttleSureUpload,
         }
     },
     watch: {
@@ -2069,9 +2075,12 @@ p {
     margin-top: 5px;
     position: relative;
 
+    // border: 1px solid salmon;
     .left_fileBox {
+        margin-top: 10px;
         position: relative;
 
+        // border: 1px solid black;
         .levelImg {
             width: 32px;
             height: 32px;
@@ -2089,7 +2098,7 @@ p {
 .setBox:hover .selectChe {
     background-color: #EEF9FF;
     display: block;
-    z-index: 1000;
+    z-index: 1000 !important;
 }
 
 .selectChe {
@@ -2363,3 +2372,4 @@ p {
   right: 97%;
 }
 </style>
+</style>

+ 1 - 1
src/views/search/index.vue

@@ -66,7 +66,7 @@
                 <div>{{ formatFileSize(scope.row.fileSize) }}</div>
               </template>
             </el-table-column>
-            <el-table-column prop="dir.dirPath" label="文件夹" width="auto">
+            <el-table-column prop="dir.dirPath" label="文件夹" width="200">
               <template #default="scope">
                 <div class="folder">
                   {{ scope.row.dir ? scope.row.dir.dirPath : "" }}