Forráskód Böngészése

Merge branch 'liyangzheng' into v3

liyangzheng 2 éve
szülő
commit
489eafe22e

+ 11 - 4
src/api/document/document.js

@@ -1,4 +1,10 @@
 import request from '../../utils/request'
+function getTop(data){
+    return request({
+        url:`/biz/dir/top-dir/${data}`,
+        method:"get",
+    })
+}
 // 获取所有文件夹列表
 function getALLdocument(data) {
     return request({
@@ -18,9 +24,9 @@ function addDocument(data) {
 // 修改
 function editDocument(data) {
     return request({
-        url: `/biz/dir`,
-        method: "put",
-        data,
+        url: `/biz/dir/rename`,
+        method: "get",
+        params:data,
     })
 }
 // 删除
@@ -34,5 +40,6 @@ export default {
     getALLdocument,
     addDocument,
     delDocument,
-    editDocument
+    editDocument,
+    getTop,
 }

+ 67 - 50
src/views/myfile/MyFile.vue

@@ -34,16 +34,15 @@
                                 </template>
                             </el-dropdown>
                             <img src="../../assets/images/fileStyle.png" style="width: 72px;height: 72px;">
-                            <p class="ellipsis-text" v-if="selectedBox !== index">{{ item.dirName }}</p>
-                            <el-input v-else v-model="newName" @blur="nameChange(item, index)"></el-input>
+                            <p class="ellipsis-text">{{ item.dirName }}</p>
                         </div>
                     </template>
                 </div>
                 <div>
                     <p>
-                        <span style="margin-left: 5px;">{{ useSpace ? useSpace + 'G' : '未能找到已使用空间' }}/{{ allSpace ?
+                        <span style="margin-left: 5px;">{{ useSpace ? useSpace + 'G' : '0' }}/{{ allSpace ?
                             allSpace
-                            * 1024 + 'G' : '未能找到总空间' }}</span>
+                            * 1024 + 'G' : '0' }}</span>
                         <span style="margin-left: 5px;font-size: 12px;color: blue;cursor: pointer;"
                             @click="askApply">申请扩容</span>
                     </p>
@@ -249,7 +248,7 @@
                         </el-dialog>
                     </div>
                 </div>
-                <FileEdit v-else></FileEdit>
+                <FileEdit v-else :docId="clickRowId" :copyRow="copyRow"></FileEdit>
             </div>
             <!-- 扩容弹窗 -->
             <div>
@@ -409,6 +408,18 @@
                     </template>
                 </el-dialog>
             </div>
+            <!-- 中栏重命名 -->
+            <div>
+                <el-dialog v-model="folderName" title="重命名" width="30%">
+                    <el-input v-model="newName"></el-input>
+                    <template #footer>
+                        <span class="dialog-footer">
+                            <el-button @click="folderName = false">取消</el-button>
+                            <el-button type="primary" @click="sureFolderName">确认</el-button>
+                        </span>
+                    </template>
+                </el-dialog>
+            </div>
         </div>
     </div>
     <!-- 图片预览 -->
@@ -426,7 +437,7 @@ import fileShare from '../../api/fileShare/fileShare'
 import collect from '../../api/collect/collect'
 import fileCount from '../../api/fileCount/fileCount'
 import BreadMenu from './components/BreadMenu.vue'
-import FileEdit from './components/FileEdit.vue'
+import FileEdit from './components/fileedit.vue'
 import ImgFile from "./jsComponents/ImgFile"
 import { Search } from '@element-plus/icons-vue'
 import blueLeft from '../../assets/images/blueLeft.png'
@@ -443,6 +454,7 @@ export default {
         let files = ref(['2'])
         let folderList = ref([])
         let askTo = ref(false)
+        let folderName = ref(false)
         let askNum = ref(1)
         let askTalk = ref('')
         let newTag = ref('')
@@ -611,13 +623,10 @@ export default {
         let fileNameChange = ref(false)
         let fileMenu = ref([])
         let collectList = ref([])
+        let copyRow = ref({})
         // 获取所有文件
         function getAll() {
-            myfile.getAllFileMenu({ dirId: folderId.value }).then(res => {
-                if (res.code === 200) {
-                    fileList.value = res.rows
-                }
-            })
+            
         }
         // 获取用户树
         function getAllUser() {
@@ -652,25 +661,23 @@ export default {
                 })
             })
         }
-        // 中栏
-        function getAllText() {
-            documents.getALLdocument({ spaceId: directoryId.value }).then(res => {
-                folderList.value = res.data
-                fileMenu.value = res.data
+        // 获取文件夹,中栏,文件
+        function getAllTop() {
+            documents.getTop(3).then(res => {
+                fileMenu.value = [res]
+                documents.getALLdocument({ parentId: fileMenu.value[0].parentId - 0, spaceId: fileMenu.value[0].spaceId - 0 }).then(res => {
+                    folderList.value = res.data
+                })
+                myfile.getAllFileMenu({ dirId: fileMenu.value[0].dirId - 0 }).then(res => {
+                if (res.code === 200) {
+                    fileList.value = res.rows
+                }
+            })
             })
         }
         // 获取所有文件夹
         function getAllFolder() {
-            if (copyParentId.value === '') {
-                copyParentId.value = 0
-                documents.getALLdocument({ parentId: copyParentId.value - 0 }).then(res => {
-                    folderList.value = res.data
-                })
-            } else {
-                documents.getALLdocument({ parentId: copyParentId.value - 0 }).then(res => {
-                    folderList.value = res.data
-                })
-            }
+
         }
         function changeFile(row, num) {
             copyParentId.value = row.parentId
@@ -700,6 +707,7 @@ export default {
         }
         // 文件名表格每一行点击事件
         function handleRowClick(row) {
+            copyRow.value = row
             clickRowId.value = row.docId
             copyDirId.value = row.dirId
             copySpaceId.value = row.spaceId
@@ -804,9 +812,9 @@ export default {
                 "dirName": boserForm.value.dirName,
                 // "dirRole": boserForm.value.dirPower,
                 // "dirType": boserForm.value.dirType,
-                "parentId": copyParentId.value-0,
+                "parentId": copyParentId.value - 0,
                 // "remark": boserForm.value.remark,
-                "spaceId": directoryId.value,
+                "spaceId": fileMenu.value[0].spaceId-0,
             }).then(res => {
                 if (res.code === 200) {
                     ElMessage({
@@ -815,7 +823,7 @@ export default {
                     })
                 }
                 addBoser.value = false
-                getAllText()
+                getAllTop()
             })
         }
 
@@ -861,8 +869,8 @@ export default {
             if (fileArr.value.length > 0) {
                 for (var i = 0; i <= fileArr.value.length; i++) {
                     myfile.uploadFile({
-                        spaceId: 1,
-                        dirId: 1,
+                        spaceId: fileMenu.value[0].spaceId-0,
+                        dirId: fileMenu.value[0].dirId-0,
                         file: fileArr.value[i]
                     }).then(res => {
                         if (res.code === 200) {
@@ -870,7 +878,7 @@ export default {
                                 message: "上传文件成功",
                                 type: "success"
                             })
-                            getAll()
+                            getAllTop()
                             uploadModal.value = false
                             fileArr.value = []
                         }
@@ -918,23 +926,12 @@ export default {
         // 重命名
         function restName(row, index) {
             newName.value = row.dirName
-            selectedBox.value = index
+            folderName.value = true
+            selectedBox.value = row.dirId
         }
         // 重命名失焦事件
         function nameChange(row, index) {
-            document.editDocument({
-                "spaceId": row.spaceId,
-                "spaceName": newName.value,
-            }).then(res => {
-                if (res.code === 200) {
-                    getAllFolder()
-                    selectedBox.value = -1
-                    ElMessage({
-                        message: '重命名成功',
-                        type: "success"
-                    })
-                }
-            })
+
         }
         function getMenu(row, num) {
             if (row.name === '删除') {
@@ -945,7 +942,7 @@ export default {
                             message: "删除成功",
                             type: "success"
                         })
-                        getAllText()
+                        getAllTop()
                     } else {
                         ElMessage({
                             message: "删除失败,目录应不为空",
@@ -1082,13 +1079,29 @@ export default {
         function isId() {
             if (this.directoryId === '') {
                 this.directoryId = 0
-                this.getAllText()
+                this.getAllTop()
             }
             if (this.folderId === '') {
                 this.folderId = 0
                 this.getAll()
             }
         }
+        // 中栏重命名
+        function sureFolderName() {
+            documents.editDocument({
+                dirId: selectedBox.value - 0,
+                name: newName.value,
+            }).then(res => {
+                if (res.code === 200) {
+                    getAllTop()
+                    folderName.value = false
+                    ElMessage({
+                        message: '重命名成功',
+                        type: "success"
+                    })
+                }
+            })
+        }
         return {
             allBag,
             folderList,//文件夹的数据
@@ -1129,7 +1142,6 @@ export default {
             createNewMenu,
             sureAddBoser,
             // delBoser,
-            getAllText,
             clickRowId,
             addFile,
             createNewFile,
@@ -1193,17 +1205,22 @@ export default {
             editOnline,//在线编辑
             copyParentId,
             getAllFolder,
+            folderName,
+            sureFolderName,
+            copyRow,
+            getAllTop,
         }
     },
     created() {
+        this.getAllTop()
         this.getAll();
         this.getSpace()
-        this.getAllText()
         // this.getAllMiddle()
         this.getAllUser()
         this.getAllCollect()
         this.isId()
         this.getAllFolder()
+
     },
     watch: {
     },

+ 78 - 27
src/views/myfile/components/FileEdit.vue

@@ -1,41 +1,92 @@
 <template>
     <div>
-        <div>
-            <!-- 工具栏 -->
-            <!-- <div class="settingBox">
-
-            </div> -->
-            <div>
-                <ckeditor :editor="editor" v-model="editorData" :config="editorConfig"></ckeditor>
-            </div>
+        <div class='qualityManual-container-office'>
+            <jjtOnlyOffice :option='option' />
         </div>
+        <p>222</p>
     </div>
 </template>
 
 <script>
-import { ref } from 'vue'
-import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
+import { ref, onMounted, } from 'vue'
+import jjtOnlyOffice from '@/components/OnlyOffice/index.vue'
+import useUserStore from '@/store/modules/user'
+// import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
+import {
+    listInfo,
+    getInfo,
+    delInfo,
+    addInfo,
+    updateInfo
+} from "@/api/biz/info";
 export default {
-    setup() {
-        let editor = ref(ClassicEditor)
-        let editorData = ref("<p>Content of the editor.</p>")
-        let editorConfig = ref({
-
+    props: {
+        docId: {
+            type: Number, // 这里的类型应该匹配你要传递的数据类型
+            required: true, // 如果这个属性是必须的,请添加此项
+        },
+        copyRow: {
+            type: Object,
+            required: true
+        }
+    },
+    setup(props) {
+        let docId = props.docId;
+        let copyRow = props.copyRow
+        let option = ref({
+            key: '',
+            url: '', //在线文档地址
+            isEdit: '', //是否允许编辑
+            fileType: '', //文件扩展名
+            title: '', //文件标题
+            user: {
+                id: null, //用户ID
+                name: '' //用户姓名
+            },
+            userdata: "",
+            editUrl: '' //回调地址
+        })
+        let show = ref(true)
+        let newObj = ref({})
+        function oo(docId, isEdit) {
+            getInfo(docId).then(response => {
+                const obj = response.data;
+                obj.isEdit = isEdit;
+                newObj.value = obj
+                option.value.isEdit = obj.isEdit
+                option.value.url = `${window.location.origin}${import.meta.env.VITE_APP_BASE_API}/api/access/${obj.fileId}`;
+                option.value.title = obj.fileName;
+                option.value.key = obj.fileId;
+                option.value.fileType = obj.fileType.replace(".", "");
+                option.value.editUrl = `${window.location.origin}${import.meta.env.VITE_APP_BASE_API}/only-office/callback/${obj.docId}?name=${useUserStore().uname}`;
+                option.value.user = {
+				id: useUserStore().uid, //用户ID
+				name: useUserStore().uname //用户姓名
+			};
+            });
+        }
+        /** 修改按钮操作 */
+        function edit() {
+            oo(docId, true);
+        }
+        onMounted(() => {
+            // console.log(docId, 'doc');
+            // console.log(copyRow, 'row');
+            edit()
+            // let row = JSON.parse(newObj.value)
+            // console.log(row, '852');
         })
         return {
-            editor,
-            editorData,
-            editorConfig,
+            option,
+            show,
+            newObj,
         }
-    }
+
+    },
+    components: {
+        jjtOnlyOffice,
+    },
 }
 </script>
 
-<style scoped>
-:deep(.ck-rounded-corners .ck.ck-editor__main>.ck-editor__editable, .ck.ck-editor__main>.ck-editor__editable.ck-rounded-corners){
-    height: 34.5rem;
-}
-:deep(.ck.ck-toolbar>.ck-toolbar__items){
-    background-color: #F5F7F9;
-}
-</style>
+<style scoped></style>