|
|
@@ -2,8 +2,8 @@
|
|
|
<div>
|
|
|
<div>
|
|
|
<!-- flex盒子 -->
|
|
|
- <div class="bigBox" style="height: 250px; overflow: auto;" v-if="folderListGrid?.length">
|
|
|
- <template v-for="(item, index) in folderListGrid" :key="index">
|
|
|
+ <div class="bigBox" style="height: 250px; overflow: auto;" v-if="folderList?.length">
|
|
|
+ <template v-for="(item, index) in folderList" :key="index">
|
|
|
<!-- 循环盒子 -->
|
|
|
<div class="flexBox" @contextmenu="rightClick(item, $event)" @click="folderClickGrid(item)">
|
|
|
<!-- 图片 -->
|
|
|
@@ -42,7 +42,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { ref, onMounted } from "vue"
|
|
|
+import { ref, onMounted, toRaw,watch } from "vue"
|
|
|
import { ElMessage } from "element-plus";
|
|
|
import myfile from "../../../api/myfile/myfile";
|
|
|
import documents from "../../../api/document/document";
|
|
|
@@ -52,7 +52,7 @@ export default {
|
|
|
props: {
|
|
|
folderClick: {
|
|
|
type: Function,
|
|
|
- required: true,
|
|
|
+ // required: true,
|
|
|
},
|
|
|
restName: {
|
|
|
type: Function,
|
|
|
@@ -69,6 +69,10 @@ export default {
|
|
|
thisFolder: {
|
|
|
type: Object,
|
|
|
required: true
|
|
|
+ },
|
|
|
+ folderList: {
|
|
|
+ type: Object,
|
|
|
+ required: true
|
|
|
}
|
|
|
},
|
|
|
setup(props, { emit }) {
|
|
|
@@ -88,60 +92,45 @@ export default {
|
|
|
let copySpa = ref(0)
|
|
|
let copyNma = ref("")
|
|
|
let copyFir = ref("")
|
|
|
+ let folderList = ref(toRaw(props.folderList))
|
|
|
// 获取文件夹,中栏,文件
|
|
|
- function getAllTop() {
|
|
|
- documents.getTop(3).then(res => {
|
|
|
- let userMe = [res]
|
|
|
- impDirId.value = userMe[0].dirId//固定
|
|
|
- impSpaceId.value = userMe[0].spaceId//固定
|
|
|
- newSpaceId.value = userMe[0].spaceId//变化
|
|
|
- newDirId.value = userMe[0].dirId//变化
|
|
|
- topPath.value = userMe[0].dirPath
|
|
|
- let obj = {
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10
|
|
|
- }
|
|
|
- const fileId =props.thisFolder.dirId?props.thisFolder.dirId:userMe[0].dirId - 0
|
|
|
- documents.getALLdocument({ parentId:fileId, spaceId: userMe[0].spaceId, pageNum: obj.pageNum, pageSize: obj.pageSize }).then(res => {
|
|
|
- fileMenu.value = res.data
|
|
|
- folderListGrid.value = res.data
|
|
|
- })
|
|
|
- // myfile.getById(userMe[0].dirId - 0, obj).then(res => {
|
|
|
- // if (res.code === 200) {
|
|
|
- // fileList.value = res.rows
|
|
|
- // fileTotal.value = res.total
|
|
|
- // if (fileTotal.value / 10 != 1) {
|
|
|
- // let x = Math.trunc(fileTotal.value / 10) + 1
|
|
|
- // for (var i = 1; i <= x; i++) {
|
|
|
- // obj.pageNum = i
|
|
|
- // myfile.getById(userMe[0].dirId - 0, obj).then(res => {
|
|
|
- // fileList.value = fileList.value.concat(res.rows)
|
|
|
- // const uniqueFileList = Array.from(new Set(fileList.value.map(item => item.docId)))
|
|
|
- // .map(docId => fileList.value.find(item => item.docId === docId));
|
|
|
- // // 合并数组并更新 fileList.value
|
|
|
- // fileList.value = uniqueFileList
|
|
|
- // })
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // })
|
|
|
- })
|
|
|
- }
|
|
|
- // function rightClick(row, num, eve) {
|
|
|
- // console.log('row=====', row,num,eve)
|
|
|
- // eve.preventDefault();
|
|
|
- // eve.stopPropagation();
|
|
|
- // folderleft.value = eve.pageX
|
|
|
- // foldertop.value = eve.pageY
|
|
|
- // copyDir.value = row.dirId
|
|
|
- // copySpa.value = row.spaceId
|
|
|
- // copyNma.value = row.dirName
|
|
|
- // copyFir.value = row.dirName
|
|
|
- // if (folderVisible.value) {
|
|
|
- // folderVisible.value = false
|
|
|
- // } else {
|
|
|
- // folderVisible.value = true
|
|
|
- // }
|
|
|
+ // function getAllTop() {
|
|
|
+ // documents.getTop(3).then(res => {
|
|
|
+ // let userMe = [res]
|
|
|
+ // impDirId.value = userMe[0].dirId//固定
|
|
|
+ // impSpaceId.value = userMe[0].spaceId//固定
|
|
|
+ // newSpaceId.value = userMe[0].spaceId//变化
|
|
|
+ // newDirId.value = userMe[0].dirId//变化
|
|
|
+ // topPath.value = userMe[0].dirPath
|
|
|
+ // let obj = {
|
|
|
+ // pageNum: 1,
|
|
|
+ // pageSize: 10
|
|
|
+ // }
|
|
|
+ // const fileId =props.thisFolder.dirId?props.thisFolder.dirId:userMe[0].dirId - 0
|
|
|
+ // documents.getALLdocument({ parentId:fileId, spaceId: userMe[0].spaceId, pageNum: obj.pageNum, pageSize: obj.pageSize }).then(res => {
|
|
|
+ // fileMenu.value = res.data
|
|
|
+ // folderListGrid.value = res.data
|
|
|
+ // })
|
|
|
+ // // myfile.getById(userMe[0].dirId - 0, obj).then(res => {
|
|
|
+ // // if (res.code === 200) {
|
|
|
+ // // fileList.value = res.rows
|
|
|
+ // // fileTotal.value = res.total
|
|
|
+ // // if (fileTotal.value / 10 != 1) {
|
|
|
+ // // let x = Math.trunc(fileTotal.value / 10) + 1
|
|
|
+ // // for (var i = 1; i <= x; i++) {
|
|
|
+ // // obj.pageNum = i
|
|
|
+ // // myfile.getById(userMe[0].dirId - 0, obj).then(res => {
|
|
|
+ // // fileList.value = fileList.value.concat(res.rows)
|
|
|
+ // // const uniqueFileList = Array.from(new Set(fileList.value.map(item => item.docId)))
|
|
|
+ // // .map(docId => fileList.value.find(item => item.docId === docId));
|
|
|
+ // // // 合并数组并更新 fileList.value
|
|
|
+ // // fileList.value = uniqueFileList
|
|
|
+ // // })
|
|
|
+ // // }
|
|
|
+ // // }
|
|
|
+ // // }
|
|
|
+ // // })
|
|
|
+ // })
|
|
|
// }
|
|
|
const rightClick = (row,e)=>{
|
|
|
emit("folderRClick", row,null,e)
|
|
|
@@ -179,16 +168,25 @@ export default {
|
|
|
emit('folderBack', copyDir.value, copySpa.value, copyNma.value)
|
|
|
}
|
|
|
const folderClickGrid = (item) => {
|
|
|
- getAllTop()
|
|
|
- emit("folderClick", item)
|
|
|
+ // getAllTop()
|
|
|
console.log('item', item)
|
|
|
+ emit("folderClick", item)
|
|
|
}
|
|
|
onMounted(() => {
|
|
|
- getAllTop()
|
|
|
+ // props.getAllTop()
|
|
|
+ // getAllTop()
|
|
|
+ console.log('folderList',folderList);
|
|
|
window.addEventListener("click", mouseClick, true);
|
|
|
})
|
|
|
+ watch(() => props.folderList, (newValue, oldValue) => {
|
|
|
+ console.log('newValue 发生改变了', newValue, oldValue);
|
|
|
+ folderList.value = newValue
|
|
|
+
|
|
|
+ }, {
|
|
|
+ immediate: true,
|
|
|
+ deep: true
|
|
|
+ });
|
|
|
return {
|
|
|
- getAllTop,
|
|
|
impDirId,
|
|
|
impSpaceId,
|
|
|
newDirId,
|
|
|
@@ -209,7 +207,8 @@ export default {
|
|
|
copySpa,
|
|
|
copyNma,
|
|
|
copyFir,
|
|
|
- folderClickGrid
|
|
|
+ folderClickGrid,
|
|
|
+ folderList
|
|
|
}
|
|
|
},
|
|
|
components:{
|