Browse Source

优化部分功能

liling 1 year ago
parent
commit
a692d598ba

+ 3 - 0
index.html

@@ -23,6 +23,9 @@
 				margin: 0px;
 				padding: 0px;
 			}
+			.disable-select {
+				user-select: none;
+			}
 
 			.chromeframe {
 				margin: 0.2em 0;

BIN
public/logo.png


BIN
public/w_logo.png


BIN
public/zwp_logo.png


+ 4 - 1
src/components/LeftList/LeftList.vue

@@ -199,7 +199,10 @@ watch(
       if (props.searchFolderTree !== "") {
         folderTreeRef.value?.filter(props.searchFolderTree);
       } else {
-        expandedNodes.forEach((key) => (nodesMap[key].expanded = true));
+        expandedNodes.forEach((key) => {
+            if(key != null) nodesMap[key].expanded = true
+          }
+        );
       }
       folderTreeRef.value?.setCurrentKey(curNode.value);
     }, 0);

+ 3 - 3
src/components/ListShow/ListShow.vue

@@ -52,7 +52,6 @@
         :data="tableData"
         style="width: 100%; height: calc(93vh - 48px)"
         ref="container"
-        class="hand"
         @row-contextmenu="rightClick"
         @selection-change="SelectionChange"
       >
@@ -80,7 +79,7 @@
                 alt=""
                 style=""
               />
-              <span style="cursor: pointer;" title="点击文件名称可直接打开文件" @dblclick="openFile(scope.row)">{{ scope.row.fileName }}</span>
+              <span class="hand disable-select" title="双击文件名称可直接打开文件" @dblclick="openFile(scope.row)">{{ scope.row.fileName }}</span>
             </div>
           </template>
         </el-table-column>
@@ -130,6 +129,7 @@ const emit = defineEmits([
   "collectByStar",
   "changeListSort",
   "handleSelectionChange",
+  "handleDblClickFileName",
 ]);
 // 排序
 const changeSort = async () => {
@@ -202,7 +202,7 @@ const dCollect = (row, bool) => {
 };
 //双击直接打开文件。需要根据文件类型做不同的打开动作
 const openFile=(item) =>{
-  console.log(item)
+  emit("handleDblClickFileName",item)
 }
 
 //工具函数

+ 44 - 17
src/layout/components/DefaultPage/DefaultPage.vue

@@ -5,12 +5,13 @@
         <el-upload
           class="upload-show"
           :file-list="fileArr"
-          :limit="1"
+          :limit="50"
           :on-change="upBefore"
           :show-file-list="false"
           drag
           :http-request="onSuccess"
           multiple
+          :on-exceed="handleExceed"
           element-loading-text="上传中..."
           element-loading-background="rgba(255, 255, 255, 0.8)"
           v-loading="loadingUpload"
@@ -59,7 +60,7 @@
               <span
                 class="fileName hand"
                 @click="toFile(item.content.docInfo)"
-                >{{ item.content.docInfo.fileName }}</span
+                >{{ item.content.docInfo==null ? '' : item.content.docInfo.fileName }}</span
               >
               <div class="flieTime">
                 <span>创建时间:</span>
@@ -105,7 +106,7 @@
                     alt=""
                     style=""
                   />
-                  <span v-html="scope.row.fileName"></span>
+                  <span v-html="scope.row==null? '' :scope.row.fileName"></span>
                 </div>
               </template>
             </el-table-column>
@@ -122,16 +123,17 @@
       </div>
     </div>
     <div v-else class="btmBox">
-      <div class="upFile" @paste="copyFile">
+      <div class="upFile" @paste.native="copyFile">
         <el-upload
           class="upload-demo"
           :file-list="fileArr"
-          :limit="1"
+          :limit="50"
           :on-change="upBefore"
           :show-file-list="false"
           drag
           :http-request="onSuccess"
           multiple
+          :on-exceed="handleExceed"
           element-loading-text="上传中..."
           element-loading-background="rgba(255, 255, 255, 0.8)"
           v-loading="loadingUpload"
@@ -431,12 +433,24 @@ const getDirId = () => {
   });
 };
 function onSuccess(files, val) {
-  // console.log('suFiles',files);
-  const maxSize = (maxFileSize.value - 0) * 1024 * 1024;
-  if (files.file.size < maxSize) {
-    fileArr.value.push(files.file);
+  if(!loadingUpload.value){
+    const maxSize = (maxFileSize.value - 0) * 1024 * 1024;
+    if (files.file.size < maxSize) {
+      fileArr.value.push(files.file);
+    }
+    sureUpload(); //没有文件在上传,立即上传
+  }else{
+    //当前有文件正在上传,排队等待上传
+    setTimeout(() => {
+      onSuccess(files,val)
+    }, 1000);
   }
-  sureUpload();
+}
+const handleExceed = (files, fileList)=> {
+  ElMessage({
+        message: "同时上传文件数超过文件最大数量50",
+        type: "error",
+  });
 }
 // 确认上传
 function sureUpload() {
@@ -446,17 +460,20 @@ function sureUpload() {
     allSpace.value * 1024 * 1024
   ) {
     ElMessage({
-      message: "超过最大容量,请联系管理员扩容",
+      message: "当前文件空间占用已超过最大容量,请联系管理员扩容",
       type: "error",
     });
     loadingUpload.value = false;
+    fileArr.value = []
     return;
   } else {
     if (fileArr.value.length > 0) {
       // console.log('fileArr',fileArr.value);
       let form = new FormData();
+      let filename = ""
       for (var i = 0; i < fileArr.value.length; i++) {
         form.append("files", fileArr.value[i]);
+        filename = fileArr.value[i].name
       }
       form.append("spaceId", topSpaceId.value);
       form.append("dirId", topDirId.value);
@@ -466,20 +483,20 @@ function sureUpload() {
         .then((res) => {
           if (res.code === 200) {
             ElMessage({
-              message: "上传文件成功",
+              message: filename+"上传成功",
               type: "success",
             });
             loadingUpload.value = false;
             fileArr.value = [];
             fileBig.value = 0;
             const storage = sessionStorage.getItem("tagList");
-            if (storage) {
+            if (storage != null) {
               const oldStorage = JSON.parse(storage);
               // 判断是否存在myfile
               const myfileTag = oldStorage.find((item) =>
                 item.path.includes("myfile")
               );
-              if (myfileTag.id) {
+              if (myfileTag !=null && myfileTag.id) {
                 const tagIfarme = document.querySelector(
                   `#${myfileTag.id} iframe`
                 );
@@ -489,15 +506,26 @@ function sureUpload() {
                 return;
               }
             }
+          }else{
+            loadingUpload.value = false;
+            fileArr.value = [];
+            ElMessage({
+              message: filename+"上传失败:"+res.msg,
+              type: "error",
+            });
           }
         })
         .catch((err) => {
           loadingUpload.value = false;
           fileArr.value = [];
+          ElMessage({
+            message: filename+"上传失败:"+err.message,
+            type: "error",
+          });
         });
     } else {
       loadingUpload.value = false;
-      return ElMessage({ message: "请选择文件", type: "error" });
+      //return ElMessage({ message: "请选择文件", type: "error" });
     }
   }
 }
@@ -544,7 +572,7 @@ const closeOpenScanMove = () => {
 //粘贴文件上传
 const copyFile = (event) => {
   const items = (event.clipboardData || window.clipboardData).items;
-  // console.log("event", event);
+   console.log("files:", event.clipboardData);
   let file = null;
   if (!items || items.length === 0) {
     ElMessage({
@@ -653,7 +681,6 @@ watch(
   }
 );
 onMounted(() => {
-  console.log('mounted');
   getSpaceList();
   getDirId();
   getConfigKey("file.size.limit").then((response) => {

+ 15 - 3
src/layout/components/Sidebar/Logo.vue

@@ -3,11 +3,11 @@
   <div class="sidebar-logo-container" :class="{ 'collapse': collapse }" :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground }">
     <transition name="sidebarLogoFade">
       <router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
-        <img v-if="logo" :src="logo" class="sidebar-logo" />
+        <img v-if="logo" :src="logo2" class="sidebar-logo" />
         <h1 v-else class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }}</h1>
       </router-link>
       <router-link v-else key="expand" class="sidebar-logo-link" to="/">
-        <img v-if="logo" :src="logo" class="sidebar-logo" />
+        <img v-if="logo" :src="logo2" class="sidebar-logo" />
         <h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }}</h1>
       </router-link>
     </transition>
@@ -25,10 +25,22 @@ defineProps({
     required: true
   }
 })
-
+let logo2 = logo
 const title = import.meta.env.VITE_APP_TITLE;
 const settingsStore = useSettingsStore();
 const sideTheme = computed(() => settingsStore.sideTheme);
+onMounted(() => {  
+  const sess = sessionStorage.getItem("sessionObj");
+  if(sess){
+    const s2 = JSON.parse(sess);
+    const user = s2.data.username
+    if(user.indexOf('_')>0) {
+      const c = user.split("_")[0]
+      logo2 = "/public/" + c +"_logo.png"
+      console.log(logo2)
+    }
+  }
+})
 </script>
 
 <style lang="scss" scoped>

+ 6 - 2
src/views/collect/index.vue

@@ -166,7 +166,7 @@
                     alt=""
                     style=""
                   />
-                  <span class="shouzhi">
+                  <span  class="hand disable-select shouzhi" title="双击文件名打开文件" @dblclick="openDbcFile(scope.row)">
                     {{
                       scope.row.fileName
                         ? scope.row.fileName
@@ -267,7 +267,7 @@
                   "
                   placement="top"
                 >
-                  <span>{{
+                  <span class="hand disable-select" title="双击文件名称打开文件"  @dblclick="openDbcFile(scope.row)">{{
                     item.fileName ? item.fileName : item.docInfo.fileName
                   }}</span>
                 </el-tooltip>
@@ -484,6 +484,10 @@ const backTopPath = () => {
   thisFolder.value = null;
   tabchange(clickCollect.value);
 };
+const openDbcFile = (item) => {
+  thisRData.value = item
+  openFile()
+}
 //取消收藏
 const delCollect = async () => {
   let thisFavoriteId;

+ 8 - 1
src/views/department/MyFile.vue

@@ -356,7 +356,7 @@
 
                         </div>
                     </div>
-                     <ListShow @handleSelectionChange="handleSelectionChange" :fileList="fileList" @changeListSort="changeListSort" @delCollect="delCollect" @collectByStar="collectByStar" @handleRowClick="handleRowClick"></ListShow>
+                     <ListShow @handleSelectionChange="handleSelectionChange" :fileList="fileList" @changeListSort="changeListSort" @delCollect="delCollect" @collectByStar="collectByStar" @handleRowClick="handleRowClick" @handleDblClickFileName="handleDblClickFileName"></ListShow>
                 </div>
             </div>
             <div :class="{'setCli':!noMenuItem}" v-if="cliCC" :style="{ left: xz + 'px', top: yz -100 + 'px' }">
@@ -1135,6 +1135,12 @@ export default {
                 cliCC.value = true
             }
         }
+        //双击文件名时,直接打开 文件
+        function handleDblClickFileName(fileinfo){
+            copyFileType.value = fileinfo.fileType
+            copyRow.value = clickRow.value = fileinfo
+            chooseSet({name:"打开"},null,0)
+        }
         // 树节点右键事件
         function treeRClick(row, col, e,Edit) {
             // console.log('row', row);
@@ -2622,6 +2628,7 @@ export default {
             folder,
             files,
             handleRowClick,
+            handleDblClickFileName,
             askApply,//申请扩容
             cliCC,
             mouseCli,//文件点击弹框

+ 7 - 1
src/views/myfile/MyFile.vue

@@ -403,7 +403,7 @@
                             </div>
                         </div>
                     </div>
-                    <ListShow @handleSelectionChange="handleSelectionChange" :fileList="fileList" @changeListSort="changeListSort" @delCollect="delCollect" @collectByStar="collectByStar" @handleRowClick="handleRowClick"></ListShow>
+                    <ListShow @handleSelectionChange="handleSelectionChange" :fileList="fileList" @changeListSort="changeListSort" @delCollect="delCollect" @collectByStar="collectByStar" @handleRowClick="handleRowClick" @handleDblClickFileName="handleDblClickFileName"></ListShow>
 
                 </div>
             </div>
@@ -1235,6 +1235,11 @@ export default {
                 cliCC.value = true
             }
         }
+        function handleDblClickFileName(fileinfo){
+            copyFileType.value = fileinfo.fileType
+            copyRow.value = clickRow.value = fileinfo
+            chooseSet({name:"打开"},null,0)
+        }
         // 树节点右键事件
         function treeRClick(row, col, e) {
             // isFolder.value = "N"
@@ -2897,6 +2902,7 @@ export default {
             folder,
             files,
             handleRowClick,
+            handleDblClickFileName,
             askApply,//申请扩容
             cliCC,
             mouseCli,//文件点击弹框

+ 7 - 1
src/views/publicment/MyFile.vue

@@ -350,7 +350,7 @@
                                 </div>
                         </div>
                     </div>
-                     <ListShow @handleSelectionChange="handleSelectionChange" :fileList="fileList" @changeListSort="changeListSort" @delCollect="delCollect" @collectByStar="collectByStar" @handleRowClick="handleRowClick"></ListShow>
+                     <ListShow @handleSelectionChange="handleSelectionChange" :fileList="fileList" @changeListSort="changeListSort" @delCollect="delCollect" @collectByStar="collectByStar" @handleRowClick="handleRowClick" @handleDblClickFileName="handleDblClickFileName"></ListShow>
                     </div>
             </div>
             <div :class="{'setCli':!noMenuItem}" v-if="cliCC" :style="{ left: xz + 'px', top: yz -100 + 'px' }">
@@ -1115,6 +1115,11 @@ export default {
                 cliCC.value = true
             }
         }
+        function handleDblClickFileName(fileinfo){
+            copyFileType.value = fileinfo.fileType
+            copyRow.value = clickRow.value = fileinfo
+            chooseSet({name:"打开"},null,0)
+        }
         // 树节点右键事件
         function treeRClick(row, col, e,Edit) {
             // console.log('row', row);
@@ -2599,6 +2604,7 @@ export default {
             folder,
             files,
             handleRowClick,
+            handleDblClickFileName,
             askApply,//申请扩容
             cliCC,
             mouseCli,//文件点击弹框

+ 4 - 5
vite.config.js

@@ -48,11 +48,11 @@ export default defineConfig(({
 					// target: 'http://192.168.1.12:8080/',
 					// target: 'http://192.168.1.88:8080/',
 					//target: 'http://192.168.1.88:8080/',
-					//target: 'http://192.168.101.99:8080/',
+					target: 'http://192.168.101.99:8080/',
 					// target: 'http://192.168.1.11:8080/',
 					// target: 'http://localhost:8080/',
 					// target:'http://192.168.1.28:8080/',
-					target:'http://8.142.173.95:19527',
+					//target:'http://8.142.173.95:19527',
 					changeOrigin: true,
 					rewrite: (p) => p.replace(/^\/dev-api/, '')
 				},
@@ -61,9 +61,8 @@ export default defineConfig(({
 					// target:'ws://localhost:8080/websocket',
 					// target:'ws://192.168.1.12:8080/websocket',
 					//target:'ws://192.168.1.88:8080/websocket',
-					target:'ws://8.142.173.95:19527/websocket',
-					//target: 'ws://192.168.101.99:8080/websocket',
-					// target:'ws://8.142.173.95:19527/websocket',
+					//target:'ws://8.142.173.95:19527/websocket',
+					target: 'ws://192.168.101.99:8080/websocket',
 					// target:'ws://192.168.1.11:8080/websocket',
 					changeOrigin: true,
 					rewrite: (p) => p.replace(/^\/websocket/, '')