瀏覽代碼

Merge branch 'liyangzheng' into v3

liyangzheng 2 年之前
父節點
當前提交
117552fe38

+ 38 - 0
src/api/collect/collect.js

@@ -0,0 +1,38 @@
+import request from '../../utils/request'
+// 添加收藏
+function addCollect(data) {
+    return request({
+        url: `/biz/favorite`,
+        method: "post",
+        data
+    })
+}
+//删除收藏
+function delCollect(data) {
+    return request({
+        url: `/biz/favorite/${data}`,
+        method: "delete",
+    })
+}
+// 查询收藏标签
+function getCollect(data) {
+    return request({
+        url: `/biz/label/list`,
+        method: "get",
+        params: data
+    })
+}
+// 新增文件标签收藏
+function addNewTag(data){
+    return request({
+        url:`/biz/label`,
+        method:"post",
+        data
+    })
+}
+export default {
+    addCollect,
+    delCollect,
+    getCollect,
+    addNewTag,
+}

+ 1 - 1
src/api/fileShare/fileShare.js

@@ -9,7 +9,7 @@ function getSharePeople(data) {
 // 新增分享人员
 function addSharePeople(data) {
     return request({
-        url: `/biz/info/share/`,
+        url: `/biz/info/share`,
         method: "post",
         data
     })

+ 21 - 1
src/api/myfile/myfile.js

@@ -40,6 +40,17 @@ function uploadFile(data) {
         },
     })
 }
+// 上传多文件
+function uploadFileMany(data) {
+    return request({
+        url: `/biz/info/uploadFiles`,
+        method: "post",
+        data,
+        headers: {
+            'Content-Type': 'multipart/form-data'
+        },
+    })
+}
 // 复制
 function fileCopy(data) {
     return request({
@@ -64,6 +75,13 @@ function fileChangeName(data) {
         params: data
     })
 }
+// 文件下载
+function fileDown(data){
+    return request({
+        url:`/biz/info/download/${data}`,
+        method:"get"
+    })
+}
 export default {
     getAllFileMenu,
     addNewMenu,
@@ -72,5 +90,7 @@ export default {
     fileCopy,
     fileMove,
     fileChangeName,
-    editNewMenu
+    editNewMenu,
+    fileDown,
+    uploadFileMany
 }

二進制
src/assets/images/collect.png


二進制
src/assets/images/download.png


二進制
src/assets/images/yellowstar.png


+ 170 - 10
src/views/myfile/MyFile.vue

@@ -181,11 +181,15 @@
                                 <el-table :data="fileList" style="width: 100%" @row-click="handleRowClick"
                                     @selection-change="handleSelectionChange">
                                     <el-table-column type="selection" width="55" />
-                                    <el-table-column label="名称" width="180">
+                                    <el-table-column label="名称" width="200">
                                         <template #default="scope">
-                                            <span>
-                                                <img :src="getImage(scope.row.fileType)" alt="">
+                                            <span style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
+                                                <el-icon v-if="collectImg">
+                                                    <Star />
+                                                </el-icon>
+                                                <img v-else src="../../assets/images/yellowstar.png" alt="">
                                                 {{ scope.row.fileName }}
+                                                <img :src="getImage(scope.row.fileType)" alt="">
                                             </span>
                                         </template>
                                     </el-table-column>
@@ -242,7 +246,10 @@
                                     <el-input style="width: 220px;margin-left: 18px;margin-top:5px" v-model="needBag"
                                         placeholder="搜索"></el-input>
                                     <div class="needLog">
-
+                                        <el-tag v-for="(item, index) in chooseTagData" :key="index" class="tagtag" closable
+                                            @close="handleClose(item)">
+                                            {{ item.userName }}
+                                        </el-tag>
                                     </div>
                                 </div>
                             </div>
@@ -387,6 +394,35 @@
                     </template>
                 </el-dialog>
             </div>
+            <!-- 文件收藏 -->
+            <div>
+                <el-dialog v-model="fileCollect" title="重命名" width="30%">
+                    <el-form :model="collectForm" label-width="120px">
+                        <el-form-item label="名称">
+                            <el-input v-model="collectForm.name" />
+                        </el-form-item>
+                        <el-form-item label="收藏标签">
+                            <div class="newTag" v-if="tagCollect">
+                                <el-input v-model="newTag" placeholder="请输入新标签" @blur="tagBlur"></el-input>
+                            </div>
+                            <el-select v-model="collectForm.folders" class="m-2" placeholder="请选择" size="large"
+                                @change="collectChange">
+                                <el-option v-for="(item, index) in collectList" :key="item.labelId" :label="item.label"
+                                    :value="item.labelId" />
+                            </el-select>
+                        </el-form-item>
+                    </el-form>
+                    <el-button @click="createTag">新建标签</el-button>
+                    <template #footer>
+                        <span class="dialog-footer">
+                            <el-button @click="fileCollect = false">取消</el-button>
+                            <el-button type="primary" @click="sureCollect">
+                                确认
+                            </el-button>
+                        </span>
+                    </template>
+                </el-dialog>
+            </div>
         </div>
     </div>
 </template>
@@ -399,6 +435,7 @@ import documents from '../../api/document/document'
 import fileSpace from '../../api/filespace/fileSpace'
 import userTree from '../../api/user/userTree'
 import fileShare from '../../api/fileShare/fileShare'
+import collect from '../../api/collect/collect'
 import BreadMenu from './components/BreadMenu.vue'
 import ImgFile from "./jsComponents/ImgFile"
 import { Search } from '@element-plus/icons-vue'
@@ -422,12 +459,16 @@ export default {
         let askTo = ref(false)
         let askNum = ref(1)
         let askTalk = ref('')
+        let newTag = ref('')
         let cliCC = ref(false)
         let transferModal = ref(false)
         let addBoser = ref(false)
         let addFile = ref(false)
         let anyP = ref(false)
         let uploadModal = ref(false)
+        let collectImg = ref(true)
+        let fileCollect = ref(false)
+        let tagCollect = ref(false)//添加收藏标签时显示
         let selectedBox = ref(-1)
         let newName = ref('')
         let clickRowId = ref("")
@@ -446,6 +487,7 @@ export default {
         let copyFileType = ref('')//需要操作的文件类型
         let copyFileName = ref("")//需要操作的文件名
         let directoryId = ref('')
+        let sortNum = ref(0)
         let boserForm = ref({
             spaceId: "",//空间id
             dirName: "",
@@ -520,6 +562,14 @@ export default {
                 name: "粘贴"
             },
             {
+                img: ImgFile.collect,
+                name: "收藏"
+            },
+            {
+                img: ImgFile.downLoad,
+                name: "下载"
+            },
+            {
                 img: ImgFile.textbox,
                 name: "重命名"
             },
@@ -561,11 +611,17 @@ export default {
             disabled: false,
             id: "id"
         }
+        let collectForm = ref({
+            name: "",
+            folders: "",
+        })
         let allTreeData = ref([])
         let needTagData = ref([])
+        let chooseTagData = ref([])
         let openTree = ref([])
         let fileNameChange = ref(false)
         let fileMenu = ref([])
+        let collectList = ref([])
         // 获取所有文件夹
         function getAll() {
             myfile.getAllFileMenu({ dirId: folderId.value }).then(res => {
@@ -600,6 +656,19 @@ export default {
                 });
             })
         }
+        function getAllCollect() {
+            collect.getCollect({}).then(res => {
+                const maxAge = res.rows.reduce((max, obj) => (obj.orderNum > max ? obj.orderNum : max), res.rows[0].orderNum)
+                sortNum.value = maxAge
+                collectList.value = res.rows.map(item => {
+                    return {
+                        label: item.labelName,
+                        labelId: item.labelId,
+                        order: item.orderNum
+                    }
+                })
+            })
+        }
         function changeFile(row, num) {
             directoryId.value = row.spaceId
             getAllText()
@@ -699,6 +768,20 @@ export default {
             if (row.name === '重命名') {
                 fileNameChange.value = true
             }
+            if (row.name === "下载") {
+                myfile.fileDown(copyFileId.value).then(res => {
+                    if (res) {
+                        ElMessage({
+                            message: "正在下载",
+                            type: "info"
+                        })
+                    }
+                })
+            }
+            if (row.name === '收藏') {
+                collectForm.value.name = nameForm.value.name
+                fileCollect.value = true
+            }
         }
         function chooseSet1() {
             transferModal.value = true
@@ -936,15 +1019,59 @@ export default {
                 console.log(`数据已存在: ${existingData.userName}`);
             } else {
                 // 选择操作,将数据添加到 needTagData 中
-                needTagData.value.push({ userId: id, userName: label });
+                needTagData.value.push({ userId: id, userName: label, docId: copyDocId.value });
             }
+            chooseTagData.value = needTagData.value
         }
 
         // 确认分享
         function sureShare() {
+
             fileShare.addSharePeople({ docId: needTagData.value }).then(res => {
                 console.log(res, 'sss');
             })
+
+        }
+        function handleClose(tag) {
+            chooseTagData.value.splice(chooseTagData.value.indexOf(tag), 1)
+        }
+        // 确认收藏
+        function sureCollect() {
+            collect.addCollect({
+                "docInfo": {
+                    "fileId": copyFileId.value - 0,
+                    "labelId": collectForm.value.folders - 0,
+                },
+            }).then(res => {
+                if (res.code === 200) {
+                    ElMessage({
+                        message: "收藏成功",
+                        type: "success"
+                    })
+                }
+            })
+            fileCollect.value = false
+        }
+        function collectChange(e) {
+            console.log(e, 'eee');
+            collectForm.value.folders = e
+        }
+        // 新建收藏标签
+        function createTag() {
+            newTag.value = ''
+            tagCollect.value = true
+        }
+        function tagBlur() {
+            collect.addNewTag({ labelName: newTag.value, orderNum: sortNum.value+1 }).then(res => {
+                if (res.code === 200) {
+                    ElMessage({
+                        message: "新建标签成功",
+                        type: "success"
+                    })
+                    getAllCollect()
+                }
+            })
+            tagCollect.value = false
         }
         return {
             folderList,//文件夹的数据
@@ -1035,13 +1162,23 @@ export default {
             allTreeChange,
             sureShare,
             openTree,
+            chooseTagData,
+            handleClose,
+            collectImg,//收藏小星星
+            fileCollect,
+            collectForm,
+            sureCollect,
+            getAllCollect,//获取所有收藏文件夹
+            collectList,//文件收藏表
+            createTag,
+            tagCollect,
+            tagBlur,
+            newTag,
+            collectChange,
+            sortNum,
         }
     },
     created() {
-        this.getAll();
-        this.getSpace()
-        this.getAllText()
-        this.getAllMiddle()
         if (this.directoryId === '') {
             this.directoryId = 0
             this.getAllText()
@@ -1050,7 +1187,12 @@ export default {
             this.folderId = 0
             this.getAll()
         }
+        this.getAll();
+        this.getSpace()
+        this.getAllText()
+        this.getAllMiddle()
         this.getAllUser()
+        this.getAllCollect()
     },
     watch: {
     },
@@ -1257,7 +1399,7 @@ p {
 }
 
 :deep(.el-collapse-item__content) {
-    height: 260px;
+    height: 235px;
     overflow-y: auto;
 }
 
@@ -1304,5 +1446,23 @@ p {
     margin: 5px auto;
     border: 1px solid red;
     overflow-y: auto;
+    text-align: center;
+}
+
+.tagtag {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    text-align: start;
+    width: 230px;
+    margin: 0 auto;
+}
+
+:deep(.el-tag__content) {
+    display: block;
+}
+
+:deep(.el-icon el-tag__close) {
+    display: block;
 }
 </style>

+ 5 - 0
src/views/myfile/jsComponents/ImgFile.js

@@ -26,6 +26,9 @@ import pptx from '../../../assets/images/pptx.png'
 import word from '../../../assets/images/word.png'
 import pdf from '../../../assets/images/pdf.png'
 import xlxs from '../../../assets/images/xlxs.png'
+import collect from '../../../assets/images/collect.png'
+import downLoad from '../../../assets/images/download.png'
+import yellowStar from '../../../assets/images/yellowstar.png'
 export default {
     copy,
     clipboard,
@@ -55,4 +58,6 @@ export default {
     word,
     pdf,
     xlxs,
+    collect,
+    downLoad,
 }