123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572 |
- <template>
- <div>
- <div class="bigBox">
- <div class="settingBox" @click="mouseClick">
- <!-- 设置盒子顶部搜索 -->
- <div class="topSearch">
- <div style="position: relative;">
- <el-input v-model="searchFire" class="searchFire" size="large" placeholder="搜索文件"
- style="width: 15rem;" />
- <el-icon style="color: gray;display: inline-block;position: absolute;top: 8px;right: 5px;">
- <Search />
- </el-icon>
- </div>
- <div>
- <el-icon style="font-size: 24px;" @click="createNewMenu(1)">
- <Plus />
- </el-icon>
- <!-- @click="createNewFile" -->
- </div>
- </div>
- <!-- 方块点击盒子 -->
- <div
- style="display: flex;justify-content: flex-start;align-items: flex-start;flex-wrap: wrap;height: 80vh;align-content: flex-start;overflow-y: auto;">
- <!-- v-for盒子 -->
- <template v-for="(item, index) in fileMenu">
- <div class="setBox" @click="changeFile(item, index)">
- <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>
- <el-dropdown-item @click="delName(item, index)">删除</el-dropdown-item>
- </el-dropdown-menu>
- </template>
- </el-dropdown>
- <img src="../../assets/images/fileStyle.png" style="width: 72px;height: 72px;">
- <p class="ellipsis-text">{{ item.dirName }}</p>
- </div>
- </template>
- </div>
- <div>
- <p>
- <span style="margin-left: 5px;">{{ useSpace ? useSpace + 'G' : '0' }}/{{ allSpace ?
- allSpace
- * 1024 + 'G' : '0' }}</span>
- <span style="margin-left: 5px;font-size: 12px;color: blue;cursor: pointer;"
- @click="askApply">申请扩容</span>
- </p>
- <el-progress style="margin-left: 8px;" :percentage="percent()" />
- </div>
- </div>
- <!-- 右侧大盒子 -->
- <div class="mesBox" v-if="editOnline">
- <!-- 功能盒子 -->
- <div class="useBox">
- <!-- table切换 -->
- <div style="width: 100%;height: 24px;background-color: #7084B4;line-height: 20px;">
- <template v-for="(item, index) in menuList">
- <span @click="tableChange(item, index)"
- :class="['tables', { tableLis: selectedIndex === index }]">
- {{ item.name }}
- <img v-if="selectedIndex === index ? true : false"
- style="position: absolute;top: 4px;right: 4px;" src="../../assets/images/close.png"
- @click="shotdown(item)">
- </span>
- </template>
- </div>
- <!-- 众多功能 -->
- <div class="manyUse">
- <div
- style="display: flex;width: 82px;height: 32px;justify-content: flex-start;align-items: center;">
- <div style="margin-left: 5px;">
- <el-icon
- style="background-color: #7084B4;width: 24px;height: 24px;border-radius: 50%;color: white;"
- @click="createNewMenu(0)">
- <Plus />
- </el-icon>
- </div>
- <div style="margin-left: 5px;" @click="createNewMenu(0)">
- <span style="font-size: 14px;">新建</span>
- </div>
- </div>
- <template v-for="(item, index) in useMenu">
- <div style="display: flex;width: 82px;height: 32px;justify-content: flex-start;align-items: center;line-height: 18px;"
- @click="getMenu(item, index)">
- <div style="margin-left: 5px;">
- <img :src="item.img" style="width: 24px;height: 24px;" alt="">
- </div>
- <div style="margin-left: 5px;">
- <span style="font-size: 14px;">{{ item.name }}</span>
- </div>
- </div>
- </template>
- <div
- style="display: flex;width: 92px;height: 32px;justify-content: flex-start;align-items: center;line-height: 18px;">
- <div style="margin-left: 5px;">
- <img src="../../assets/images/upload.png" style="width: 24px;height: 24px;" alt="">
- </div>
- <div style="margin-left: 5px;">
- <span style="color: black;cursor: pointer;" @click="uploadModal = true">上传
- </span>
- </div>
- </div>
- </div>
- <!-- 面包屑功能栏 -->
- <div class="breadBox">
- <!-- 左侧 -->
- <div style="display: flex;justify-content: space-around;align-items: center;">
- <!-- 前进后退 -->
- <div style="display: flex;justify-content: space-around;align-items: center;">
- <img style="display:block;width: 11px;height: 11px;" :src="blueLeft" alt=""
- @click="getAllTop">
- <img style="display:block;width: 16px;height: 16px;" :src="grayRight" alt="">
- </div>
- <!-- 面包屑 -->
- <div>
- <BreadMenu></BreadMenu>
- </div>
- </div>
- <!-- 右侧 -->
- <div>
- <img :src="sort" alt="">
- <img :src="squre" alt="">
- </div>
- </div>
- </div>
- <!-- 展示文件夹盒子 -->
- <!-- 文件夹 -->
- <div class="detailBox" @click="mouseClick">
- <el-collapse v-model="folder" accordion class="collapseSell">
- <el-collapse-item title="文件夹" name="1" class="custom-collapse-item">
- <el-table :data="folderList" style="width: 100%" @selection-change="handleSelectionChange1"
- :single-select="true" @row-click="folderClick" @row-contextmenu="folderRClick">
- <el-table-column type="selection" width="55" />
- <el-table-column label="名称" width="180">
- <template #default="scope">
- <span>
- <img src="../../assets/images/fileBox.png" style="width: 20px;height: 24px;"
- alt="">
- {{ scope.row.dirName }}
- </span>
- </template>
- </el-table-column>
- <el-table-column prop="createTime" label="时间" width="180" />
- <el-table-column prop="dirType" label="类型">
- <template #default="scope">
- <span>{{ scope.row.dirType === "1" ? "文件夹" : "未知类型" }}</span>
- </template>
- </el-table-column>
- <el-table-column label="大小">
- <template #default="scope">
- <span>
- 10KB
- </span>
- </template>
- </el-table-column>
- </el-table>
- </el-collapse-item>
- </el-collapse>
- <!-- 右键唤出的菜单 -->
- <div class="right_menu" v-if="folderVisible"
- :style="{ left: folderleft + 'px', top: foldertop + 'px' }">
- <div class="menu_item" @click="restName(null, null)">
- <!-- <img src="@/assets/images/textbox.png" alt="" /> -->
- <span>重命名</span>
- </div>
- <div class="menu_item" @click="folderClick(null, null)">
- <!-- <img src="@/assets/images/trash.png" alt="" /> -->
- <span>打开</span>
- </div>
- </div>
- </div>
- <!-- 文件 -->
- <div class="fileTable">
- <el-collapse v-model="files" accordion class="collapse" style="height: 200px;">
- <el-collapse-item title="文件" name="2" class="">
- <el-table :data="fileList" style="width: 100%" @row-contextmenu="handleRowClick"
- @selection-change="handleSelectionChange" @row-click="mouseClick">
- <el-table-column type="selection" width="55" />
- <el-table-column label="名称" width="200">
- <template #default="scope">
- <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="">
- <img :src="getImage(scope.row.fileType)" alt="">
- {{ scope.row.fileName }}
- </span>
- </template>
- </el-table-column>
- <el-table-column prop="createTime" label="时间" width="180" />
- <el-table-column prop="fileType" label="类型" />
- <el-table-column label="大小">
- <template #default="scope">
- <span>
- {{ scope.row.fileSize }}KB
- </span>
- </template>
- </el-table-column>
- </el-table>
- <div class="setCli" v-if="cliCC">
- <template v-for="(item, index) in filterMouseCli()">
- <p @click="chooseSet(item, index)" class="chooseSet">
- <img :src="item.img" alt="">
- {{ item.name }}
- <span v-if="item.name == '在线编辑' || item.name == '协作' ? true : false"
- style="color: #7084B4;float: right;position: relative;" class="arrow">></span>
- </p>
- </template>
- </div>
- <div class="setCli1" v-if="anyP">
- <p @click="chooseSet1(0)" class="">
- <img src="../../assets/images/user.png" alt="">
- 选择人员
- </p>
- <p class="chooseSet">
- <img src="../../assets/images/archiveTray.png" alt="">
- 归档
- </p>
- </div>
- </el-collapse-item>
- </el-collapse>
- </div>
- </div>
- <div v-else>
- <div>
- <el-button @click="editOnline = true">返回</el-button>
- </div>
- <FileEdit :docId="clickRowId" :copyRow="copyRow" :historyPrew="historyPrew"
- :historycopyRow="historycopyRow"></FileEdit>
- </div>
- <!-- 扩容弹窗 -->
- <div>
- <el-dialog v-model="askTo" title="扩容申请" width="30%">
- <el-form>
- <el-form-item label="新容量">
- <el-input-number v-model="askNum" :min="1" :max="10" />
- </el-form-item>
- <el-form-item label="申请理由">
- <el-input v-model="askTalk" maxlength="150" placeholder="请输入申请理由" show-word-limit
- type="textarea" />
- </el-form-item>
- </el-form>
- <template #footer>
- <span class="dialog-footer">
- <el-button @click="askTo = false">取消</el-button>
- <el-button type="primary" @click="sureAsk">
- 确定
- </el-button>
- </span>
- </template>
- </el-dialog>
- </div>
- <!-- 新增文件夹弹窗 -->
- <div>
- <CreateFloder v-if="folderCase" :folderCase="folderCase" @getChildrenC="getChildrenC" :oneOrTwo="oneOrTwo"
- :impDirId="impDirId"
- :impSpaceId="impSpaceId"
- :newDirId="newDirId"
- :newSpaceId="newSpaceId"
- :getAllTop="getAllTop"
- >
- </CreateFloder>
- </div>
- <!-- 废弃的顶层目录新增 -->
- <div>
- <el-dialog v-model="addFile" title="Tips" width="30%">
- <el-form :model="fileForm" label-width="120px">
- <el-form-item label="空间类型">
- <el-select v-model="spaceValue" placeholder="请选择空间类型">
- <el-option v-for="(item, index) in spaceSelect" :key="item.value" :label="item.label"
- :value="item.value" :disabled="item.disabled" />
- </el-select>
- </el-form-item>
- <el-form-item label="空间名称">
- <el-input v-model="fileForm.spaceName" />
- </el-form-item>
- <el-form-item label="备注">
- <el-input v-model="fileForm.remark" />
- </el-form-item>
- </el-form>
- <template #footer>
- <span class="dialog-footer">
- <el-button @click="addFile = false">取消</el-button>
- <el-button type="primary" @click="sureAddFile">
- 确认
- </el-button>
- </span>
- </template>
- </el-dialog>
- </div>
- <!-- 文件上传 -->
- <div>
- <el-dialog v-model="uploadModal" title="文件上传" width="30%">
- <el-upload class="upload-demo" drag :http-request="onSuccess" multiple>
- <el-icon class="el-icon--upload"><upload-filled /></el-icon>
- <div class="el-upload__text">
- 拖入或<em>点击上传</em>
- </div>
- <template #tip>
- <div class="el-upload__tip">
- 请选择或拖入文件
- </div>
- </template>
- </el-upload>
- <template #footer>
- <span class="dialog-footer">
- <el-button @click="uploadModal = false">取消</el-button>
- <el-button type="primary" @click="sureUpload">
- 确认
- </el-button>
- </span>
- </template>
- </el-dialog>
- </div>
- <!-- 文件重命名 -->
- <div>
- <el-dialog v-model="fileNameChange" title="重命名" width="30%">
- <el-form :model="nameForm" label-width="120px">
- <el-form-item label="新名字">
- <el-input v-model="nameForm.name"></el-input>
- </el-form-item>
- </el-form>
- <template #footer>
- <span class="dialog-footer">
- <el-button @click="fileNameChange = false">取消</el-button>
- <el-button type="primary" @click="sureChangeName">
- 确认
- </el-button>
- </span>
- </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>
- <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>
- <ImgPreview :previewData="previewData" :copyFileType="copyFileType" :showPreview="showPreview"
- @closeImgPreview="closeImgPreview"></ImgPreview>
- <div>
- <FileTree v-if="fileTrees" :fileTrees="fileTrees" :newSpaceId="newSpaceId" :fileId="clickRowId"
- @getChildren="getChildren" :copyOrMove="copyOrMove"></FileTree>
- </div>
- <!-- 穿梭框 -->
- <div>
- <TransferModal v-if="thanks" :thanks="thanks" :clickRowId="clickRowId" :workOrEdit="workOrEdit"
- @getCback="getCback"></TransferModal>
- </div>
- </div>
- </div>
- <!-- 图片预览 -->
- <!-- 历史版本 -->
- <historyList :openFile="openForwardFile" :docId="clickRowId" :name="nameForm.name" :copyRow="copyRow"
- @close="openForwardFile = false" :fileUserTreeData="fileUserTreeData.data" @changeMsgClose="changeMsgClose">
- </historyList>
- <!-- 历史版本 -->
- </template>
- <script>
- import { ref, toRaw, onMounted } from 'vue'
- import myfile from '../../api/myfile/myfile'
- import documents from '../../api/document/document'
- import fileSpace from '../../api/filespace/fileSpace'
- import fileShare from '../../api/fileShare/fileShare'
- import collect from '../../api/collect/collect'
- import FileTree from './components/FileTree.vue'
- import BreadMenu from './components/BreadMenu.vue'
- import FileEdit from './components/FileEdit.vue'
- import TransferModal from './modalComponebts/Transfer.vue'
- import CreateFloder from './modalComponebts/CreateFloder.vue'
- import ImgFile from "./jsComponents/ImgFile"
- import { Search } from '@element-plus/icons-vue'
- import blueLeft from '../../assets/images/blueLeft.png'
- import grayRight from "../../assets/images/grayRight.png"
- import sort from '../../assets/images/sort.png'
- import squre from '../../assets/images/squre.png'
- import { ElMessage } from 'element-plus'
- import ImgPreview from '@/components/ImgPreview/ImgPreview.vue'
- import { preview } from "@/api/common/common.js";
- import historyList from "@/components/historyList/index.vue"; //选择文件发送的列表,历史版本
- import { listVersion } from "@/api/biz/version";
- import useUserStore from "@/store/modules/user";
- import { useRouter, useRoute } from "vue-router";
- export default {
- setup() {
- let fileTrees = ref(false)//filetree父传子
- let thanks = ref(false)//transfer父传子
- let folderCase = ref(false)
- let editOnline = ref(true)
- let searchFire = ref('')
- let selectedIndex = ref(0)
- let folder = ref(['1'])
- 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('')
- let cliCC = 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(0)
- let trandata = ref()
- let folderId = ref('')
- let fileId = ref('')
- let tranvalue = ref([])
- let useSpace = ref(0)
- let allSpace = ref(0)
- let fileArr = ref([])
- let copyDirId = ref(0)//需要操作的dirid
- let copySpaceId = ref(0)//需要操作的spaceid
- let copyDocId = ref(0)//需要操作的docid
- let copyFileId = ref(0)//需要操作的fileid
- let copyFileSize = ref(0)//需要操作的filesize
- let copyFileType = ref('')//需要操作的文件类型
- let copyFileName = ref("")//需要操作的文件名
- let directoryId = ref('')
- let impSpaceId = ref("")
- let impDirId = ref("")
- let impNum = ref(0)
- let copyParentId = ref("")//文件夹
- let needBag = ref("")
- let copyOrMove = ref(0)//0代表复制,1代表移动
- let oneOrTwo = ref(0)//0代表二级,1代表一级
- let sortNum = ref(0)
- const openForwardFile = ref(false) //历史版本展示
- const historyPrew = ref(false)
- const fileUserTreeData = reactive({ data: {} });
- let fileForm = ref({
- spaceType: '',
- spaceName: "",
- remark: "",
- })
- let fileList = ref([
- ])
- let menuList = ref([
- ])
- let useMenu = ref([
- {
- img: ImgFile.copy,
- name: "复制"
- },
- {
- img: ImgFile.clipboard,
- name: "粘贴"
- },
- {
- img: ImgFile.share,
- name: "分享给"
- },
- {
- img: ImgFile.trash,
- name: "删除"
- },
- ])
- let arrorMenu = ref([
- {
- img: ImgFile.file,
- name: "文件"
- },
- {
- img: ImgFile.folder,
- name: '文件夹'
- },
- {
- img: ImgFile.image,
- name: "图片"
- },
- {
- img: ImgFile.filmSlate,
- name: "视频"
- },
- {
- img: ImgFile.musicNotes,
- name: "音频"
- }
- ])
- let mouseCli = ref([
- {
- img: ImgFile.previewIcon,
- name: "预览"
- },
- {
- img: ImgFile.addolder,
- name: "移动",
- },
- {
- img: ImgFile.copy,
- name: "复制",
- },
- // {
- // img: ImgFile.clipboard,
- // name: "粘贴"
- // },
- {
- img: ImgFile.collect,
- name: "收藏"
- },
- {
- img: ImgFile.downLoad,
- name: "下载"
- },
- {
- img: ImgFile.textbox,
- name: "重命名"
- },
- // {
- // img: ImgFile.goon,
- // name: "发送"
- // },
- {
- img: ImgFile.share,
- name: "分享"
- },
- {
- img: ImgFile.notePencil,
- name: "在线编辑"
- },
- {
- img: ImgFile.togger,
- name: "协作"
- },
- {
- img: ImgFile.icc,
- name: "文字识别"
- },
- {
- img: ImgFile.history,
- name: "历史版本"
- },
- {
- img: ImgFile.trash,
- name: "删除"
- }
- ])
- let nameForm = ref({
- name: ""
- })
- let collectForm = ref({
- name: "",
- folders: "",
- })
- let fileNameChange = ref(false)
- let fileMenu = ref([])
- let collectList = ref([])
- let copyRow = ref({})
- let spaceValue = ref("")
- let newDirId = ref('')
- let newSpaceId = ref('')
- let spaceSelect = ref([
- {
- label: "个人空间",
- value: 3,
- },
- {
- label: "部门空间",
- value: 2,
- disabled: true
- },
- {
- label: "公共空间",
- value: 1,
- disabled: true
- },
- ])
- let workOrEdit = ref(0)
- const showPreview = ref(false)//控制图片预览组件显示
- const previewData = ref()//需要预览的文件的数据
- const router = useRouter(); //注册路由
- const folderVisible = ref(false); //显示文件夹右键菜单
- const foldertop = ref(0);
- const folderleft = ref(0);
- const thisFolder = ref({}); //当前右键的文件夹
- 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 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//变化
- documents.getALLdocument({ parentId: userMe[0].dirId - 0, spaceId: userMe[0].spaceId }).then(res => {
- fileMenu.value = res.data
- folderList.value = res.data
- })
- myfile.getById(userMe[0].dirId - 0).then(res => {
- if (res.code === 200) {
- fileList.value = res.rows
- }
- })
- })
- }
- function changeFile(row, num) {
- copyParentId.value = row.parentId
- newDirId.value = row.dirId
- newSpaceId.value = row.spaceId
- documents.getALLdocument({ parentId: row.dirId - 0, spaceId: row.spaceId - 0 }).then(res => {
- folderList.value = res.data
- // if (res.code === 200) {
- if (res.data.length === 0) {
- myfile.getById(newDirId.value)
- .then(res => {
- if (res.code === 200) {
- fileList.value = res.rows;
- }
- })
- .catch(error => {
- console.error("myfile.getAllFileMenu 调用失败:", error);
- });
- } else {
- myfile.getById(res.data[0].dirId - 0)
- .then(res => {
- if (res.code === 200) {
- fileList.value = res.rows;
- }
- })
- .catch(error => {
- console.error("myfile.getAllFileMenu 调用失败:", error);
- });
- }
- // }
- })
- this.selectedIndex = num
- const newItem = {
- name: row.dirName,
- choose: row.dirName
- };
- // 检查 newItem 是否已存在于 menuList 中
- const isItemExist = menuList.value.some(item => item.choose === newItem.choose);
- // 如果不存在,则添加它
- if (!isItemExist) {
- menuList.value.push(newItem);
- }
- useSpace.value = row.usedCap
- allSpace.value = row.spaceCap
- }
- // tableMenu切换
- function tableChange(row, num) {
- this.selectedIndex = num
- }
- // x图标事件
- function shotdown(row) {
- this.menuList = this.menuList.filter(item => item.name !== row.name)
- }
- // 文件名表格每一行点击事件
- function handleRowClick(row, col, e) {
- e.preventDefault();
- e.stopPropagation();
- copyRow.value = row
- clickRowId.value = row.docId
- copyDirId.value = row.dirId
- copySpaceId.value = row.spaceId
- copyFileId.value = row.fileId
- copyFileSize.value = row.fileSize
- copyFileType.value = row.fileType
- nameForm.value.name = row.fileName
- if (cliCC.value === true) {
- cliCC.value = false
- } else {
- cliCC.value = true
- }
- }
- // 申请扩容
- function askApply() {
- this.askTo = true
- }
- function sureAsk() {
- this.askTo = false
- }
- //mouse弹框
- async function chooseSet(row, index, num) {
- if (row.name == '在线编辑' || row.name == '协作') {
- cliCC.value = true
- } else {
- cliCC.value = false
- }
- if (row.name == '分享') {
- workOrEdit.value = num
- thanks.value = true
- } else {
- thanks.value = false
- }
- if (row.name == '协作') {
- if (anyP.value) {
- anyP.value = false
- } else {
- anyP.value = true
- }
- } else {
- anyP.value = false
- }
- if (row.name == '删除') {
- myfile.delMenu(clickRowId.value).then(res => {
- if (res.code === 200) {
- ElMessage({
- type: "success",
- message: "删除成功"
- })
- getAllTop()
- }
- })
- }
- if (row.name === '复制') {
- copyOrMove.value = 0
- fileTrees.value = true
- }
- if (row.name === '移动') {
- copyOrMove.value = 1
- fileTrees.value = true
- }
- if (row.name === '重命名') {
- fileNameChange.value = true
- }
- if (row.name === "下载") {
- location.href = `${import.meta.env.VITE_APP_BASE_API}/api/download/${copyFileId.value}`;
- }
- if (row.name === '收藏') {
- collectForm.value.name = nameForm.value.name
- fileCollect.value = true
- }
- if (row.name === '在线编辑') {
- editOnline.value = false
- cliCC.value = false
- }
- if (row.name === '文字识别') {
- router.push({
- path: '/identifyFont',
- query: {
- fileId: copyFileId.value,
- fileType: copyFileType.value
- }
- })
- }
- if (row.name === '预览') {
- // console.log('row=', toRaw(row));
- // console.log('copyFileId',copyFileId.value);//文件id
- // console.log('copyFileType',copyFileType.value);//文件type
- showPreview.value = true
- const res = await preview(copyFileId.value)
- previewData.value = URL.createObjectURL(res)
- // console.log('res',res);
- } else if (row.name === "历史版本") {
- const resHistory = await listVersion({ docId: clickRowId.value })
- fileUserTreeData.data = resHistory.rows;
- openForwardFile.value = true
- }
- }
- function chooseSet1(num) {
- workOrEdit.value = num
- thanks.value = true
- anyP.value = false
- }
- function createNewMenu(num) {
- oneOrTwo.value = num
- folderCase.value = true
- }
- function createNewFile() {
- addFile.value = true
- }
- // 确定新增中栏
- function sureAddFile() {
- fileSpace.addFileSpace(
- {
- "spaceName": fileForm.value.spaceName,
- "spaceType": fileForm.value.spaceType,
- "remark": fileForm.value.remark,//备注
- }
- ).then(res => {
- if (res.code === 200) {
- ElMessage({
- message: "新增成功",
- type: "success"
- })
- getAllTop()
- addFile.value = false
- } else {
- ElMessage({
- message: "请检查错误",
- type: "warning"
- })
- }
- })
- }
- function arrowClick(row, num) {
- if (row.name === '文件') {
- uploadModal.value = true
- } else {
- uploadModal.value = false
- }
- }
- // 确认上传
- function sureUpload() {
- if (fileArr.value.length > 0) {
- for (var i = 1; i <= fileArr.value.length; i++) {
- myfile.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()
- uploadModal.value = false
- fileArr.value = []
- }
- })
- }
- }
- }
- function onSuccess(files, val) {
- fileArr.value.push(files.file)
- }
- // 筛选后缀图片
- function getImage(file) {
- if (file === '.txt') {
- return ImgFile.txt
- } else if (file === '.xlxs' || file === '.docx') {
- return ImgFile.xlxs
- } else if (file === '.pptx') {
- return ImgFile.pptx
- } else if (file === '.word') {
- return ImgFile.word
- } else if (file === '.pdf') {
- return ImgFile.pdf
- }
- }
- // 表格多选框
- function handleSelectionChange(val) {
- if (val.length > 1) {
- // 如果选择了多项,只保留最后一项
- val.shift();
- }
- if (val.length === 1) {
- fileId.value = val[0].docId
- }
- }
- // 文件夹
- function handleSelectionChange1(val) {
- if (val.length > 1) {
- // 如果选择了多项,只保留最后一项
- val.shift();
- }
- if (val.length === 1) {
- folderId.value = val[0].dirId
- }
- }
- // 重命名
- function restName(row, index) {
- // 判断是点击打开还是右键菜单打开
- row = row ? row : thisFolder.value
- newName.value = row.dirName
- folderName.value = true
- selectedBox.value = row.dirId
- }
- function getMenu(row, num) {
- if (row.name === '删除') {
- // 文件夹删除
- documents.delDocument(folderId.value).then(res => {
- if (res.code === 200) {
- ElMessage({
- message: "删除成功",
- type: "success"
- })
- getAllTop()
- } else {
- ElMessage({
- message: "删除失败,目录应不为空",
- type: "error"
- })
- }
- })
- myfile.delMenu(fileId.value).then(res => {
- if (res.code === 200) {
- ElMessage({
- message: "删除成功",
- type: "success"
- })
- getAllTop()
- }
- })
- }
- }
- function delName(row, num) {
- documents.delDocument(row.dirId).then(res => {
- if (res.code === 200) {
- getAllTop()
- ElMessage({
- message: "删除成功",
- type: "success"
- })
- }
- })
- }
- // 计算百分比
- function percent() {
- let numP = 0
- if (useSpace.value) {
- numP = parseInt(useSpace.value / (allSpace.value * 1024) * 100)
- }
- return numP
- }
- // 文件夹每行点击事件
- function folderClick(row, list) {
- // 上一级dirId就是下一级的parentId
- // 判断是点击打开还是右键菜单打开
- row = row ? row : thisFolder.value
- console.log('row', row);
- newDirId.value = row.dirId
- newSpaceId.value = row.spaceId
- documents.getALLdocument({ parentId: row.dirId - 0, spaceId: row.spaceId - 0 }).then(res => {
- folderList.value = res.data
- if (res.data.length === 0) {
- myfile.getById(newDirId.value).then(res => {
- if (res.code === 200) {
- fileList.value = res.rows
- }
- })
- } else {
- myfile.getById(res.data[0].dirId - 0).then(res => {
- if (res.code === 200) {
- fileList.value = res.rows
- }
- })
- }
- })
- }
- // 确认文件重命名
- function sureChangeName() {
- myfile.editNewMenu({
- dirId: copyDirId.value - 0,
- docId: clickRowId.value - 0,
- fileId: copyFileId.value,
- fileName: nameForm.value.name,
- fileSize: copyFileSize.value - 0,
- fileType: copyFileType.value,
- remark: '',
- spaceId: copySpaceId.value - 0,
- }).then(res => {
- if (res.code === 200) {
- ElMessage({
- message: "重命名成功",
- type: "success"
- })
- fileNameChange.value = false
- getAllTop()
- }
- })
- }
- // 确认收藏
- 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) {
- 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
- }
- // 判断id
- function isId() {
- if (directoryId.value === '') {
- directoryId.value = 0
- getAllTop()
- }
- if (folderId.value === '') {
- folderId.value = 0
- getAllTop()
- }
- }
- // 中栏重命名
- 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"
- })
- }
- })
- }
- //关闭图片预览事件
- const closeImgPreview = () => {
- // console.log('close');
- showPreview.value = false
- }
- function getChildren(data) {
- fileTrees.value = data
- }
- function getCback(data) {
- thanks.value = data
- }
- function getChildrenC(data) {
- folderCase.value = data
- }
- //历史版本
- const forwardTreeData = reactive({ data: {} });
- const historycopyRow = ref({})
- function changeMsgClose(val, item) {
- if (val) {
- historycopyRow.value = item
- editOnline.value = false
- cliCC.value = false
- historyPrew.value = true
- }
- openForwardFile.value = val
- }
- //对mouseCli数组进行筛选,实现菜单的区分显示
- const filterMouseCli = () => {
- const typeArr = ['.png', '.jpg', '.jpeg', '.JPG', '.mp3', '.mp4', '.pdf']
- const imgTypeArr = ['.png', '.jpg', '.jpeg', '.JPG']
- let arr = []
- if (!typeArr.includes(copyFileType.value)) {
- arr = mouseCli.value.filter(item => item.name !== "预览")
- } else {
- arr = mouseCli.value.filter(item => item.name !== "在线编辑" && item.name !== "协作" && item.name !== "历史版本")
- }
- if (!imgTypeArr.includes(copyFileType.value)) {
- arr = arr.filter(item => item.name !== "文字识别")
- }
- return arr
- }
- function mouseClick() {
- if (cliCC.value) {
- cliCC.value = false
- }
- if (anyP) {
- anyP.value = false
- }
- }
- // 文件夹右键事件
- const folderRClick = (row, col, e) => {
- e.preventDefault();
- e.stopPropagation();
- let thisRow = toRaw(row)
- // console.log("row", thisRow);
- // console.log("col", toRaw(col));
- // console.log("e", e);
- // console.log("item", toRaw(item));
- thisFolder.value = thisRow;
- // 唤出右键菜单,思路:获取鼠标位置来定位菜单
- folderVisible.value = true;
- foldertop.value = e.pageY;
- folderleft.value = e.pageX;
- };
- // 关闭文件夹右键菜单
- const closeRMenu = () => {
- // console.log("close");
- folderVisible.value = false;
- };
- onMounted(() => {
- getAllTop()
- getAllCollect()
- // 添加监听,点击其他地方关闭文件夹右键菜单
- window.addEventListener("click", closeRMenu, true);
- })
- return {
- folderList,//文件夹的数据
- fileList,//文件夹的数据
- searchFire,//搜索文件的model
- changeFile,//切换右侧视图的file
- menuList,//右侧切换
- tableChange,//改变class点击事件
- selectedIndex,//当前选中下标
- shotdown,//筛选出当前数据
- useMenu,
- arrorMenu,
- blueLeft,//返回
- grayRight,//前进
- squre,//视图切换
- sort,//排序
- folder,
- files,
- handleRowClick,
- askApply,//申请扩容
- askTo,
- sureAsk,
- askNum,
- askTalk,
- cliCC,
- mouseCli,//文件点击弹框
- chooseSet,
- trandata,
- tranvalue,
- anyP,
- chooseSet1,
- fileMenu,
- createNewMenu,
- // delBoser,
- clickRowId,
- addFile,
- createNewFile,
- fileForm,
- sureAddFile,
- // fileUpload,
- getImage,//筛选文件类型
- handleSelectionChange,
- handleSelectionChange1,
- selectedBox,//重命名相关
- restName,//重命名相关
- newName,//重命名相关
- getMenu,
- folderId,
- fileId,
- // getAllMiddle,//拿到所有空间信息
- delName,//删除空间信息
- useSpace,//使用空间
- allSpace,//总空间
- percent,
- arrowClick,
- uploadModal,
- sureUpload,
- onSuccess,
- fileArr,
- directoryId,
- folderClick,
- copyDirId,//复制移动需要的↓
- copyDocId,
- copySpaceId,
- copyFileId,
- copyFileName,
- copyFileSize,
- copyFileType,
- sureChangeName,//文件重命名
- fileNameChange,//文件重命名模态框
- nameForm,
- collectImg,//收藏小星星
- fileCollect,
- collectForm,
- sureCollect,
- getAllCollect,//获取所有收藏文件夹
- collectList,//文件收藏表
- createTag,
- tagCollect,
- tagBlur,
- newTag,
- collectChange,
- sortNum,
- needBag,
- isId,
- editOnline,//在线编辑
- copyParentId,
- folderName,
- sureFolderName,
- copyRow,
- getAllTop,
- spaceValue,
- spaceSelect,
- newDirId,
- newSpaceId,
- showPreview,//控制图片预览
- closeImgPreview,//关闭预览事件
- previewData,//预览文件数据
- router,
- fileTrees,
- getChildren,//子传父
- copyOrMove,
- impDirId,
- impNum,
- impSpaceId,
- //历史版本=========
- openForwardFile,
- forwardTreeData,
- fileUserTreeData,
- filterMouseCli,
- changeMsgClose,
- historyPrew,
- historycopyRow,
- thanks,
- getCback,
- mouseClick,
- folderVisible,
- foldertop,
- folderleft,
- thisFolder,
- folderRClick,
- closeRMenu,
- //历史版本=========
- fileUserTreeData,
- thanks,
- getCback,
- mouseClick,
- workOrEdit,
- folderCase,//新建文件夹传值
- getChildrenC,
- oneOrTwo,//父传子判断
- }
- },
- watch: {
- },
- components: {
- BreadMenu,
- FileEdit,
- ImgPreview,
- FileTree,
- historyList,
- TransferModal,
- CreateFloder,
- },
- }
- </script>
- <style lang="scss" scoped>
- p {
- margin: 0;
- padding: 0;
- }
- .bigBox {
- width: 100%;
- height: 100%;
- display: flex;
- justify-content: flex-start;
- overflow: hidden;
- }
- .settingBox {
- width: 25vw;
- height: 92vh;
- border: 1px solid black;
- border-radius: 4px;
- /* margin: 5px 5px; */
- margin-right: 5px;
- background-color: white;
- }
- .topSearch {
- width: 100%;
- height: 48px;
- background-color: #EBEFF6;
- display: flex;
- justify-content: space-around;
- align-items: center;
- }
- .searchFire {
- width: 248px;
- height: 32px;
- }
- .setBox {
- width: 88px;
- height: 112px;
- text-align: center;
- margin-left: 5px;
- margin-top: 5px;
- position: relative;
- }
- .setBox:hover {
- background-color: #EEF9FF;
- }
- .setBox:hover .selectChe {
- background-color: #EEF9FF;
- display: block;
- }
- .selectChe {
- display: none;
- width: 20px;
- height: 20px;
- background: rgba(255, 255, 255, 0.7);
- border-radius: 4px 4px 4px 4px;
- position: absolute;
- top: 2px;
- right: 2px;
- line-height: 10px;
- }
- .mesBox {
- width: 75vw;
- height: 92vh;
- border-radius: 4px;
- background-color: white;
- }
- .useBox {
- width: 100%;
- height: 96px;
- }
- .tables {
- display: inline-block;
- width: 112px;
- height: 22px;
- border-radius: 4px;
- line-height: 21px;
- text-align: center;
- font-size: 12px;
- margin-left: 5px;
- position: relative;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .tableLis {
- display: inline-block;
- width: 112px;
- height: 22px;
- border-radius: 4px;
- background-color: #EBEFF6;
- line-height: 21px;
- text-align: center;
- font-size: 12px;
- margin-left: 5px;
- position: relative;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- max-width: auto;
- }
- .manyUse {
- width: 100%;
- height: 48px;
- /* background-color: gray; */
- line-height: 48px;
- display: flex;
- justify-content: flex-start;
- align-items: center;
- }
- .el-dropdown-link {
- color: white;
- }
- .breadBox {
- width: 100%;
- height: 24px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- background-color: #D9E0F0;
- }
- :deep(.el-collapse-item__header) {
- height: 24px !important;
- background-color: #EBEFF6 !important;
- }
- .detailBox {
- width: 100%;
- height: 270px;
- }
- :deep(.el-dialog__header) {
- background-color: #ECEFF7;
- margin-right: 0px;
- }
- .fileTable {
- position: relative;
- height: 100%;
- /* overflow-y: auto; */
- }
- .setCli {
- width: 156px;
- max-height: 380px;
- position: absolute;
- top: -70px;
- left: 300px;
- flex-wrap: 400;
- background-color: white;
- border: 1px solid gray;
- border-radius: 4px;
- z-index: 10;
- overflow-y: auto;
- }
- .setCli1 {
- width: 156px;
- height: auto;
- position: absolute;
- top: 185px;
- left: 455px;
- background-color: white;
- border: 1px solid gray;
- border-radius: 4px;
- z-index: 2;
- overflow-y: auto;
- }
- .chooseSet {
- width: 140px;
- height: 30px;
- line-height: 30px;
- margin: 5px auto;
- // display: flex;
- // align-items: center;
- // position: relative;
- img {
- margin-right: 4px;
- vertical-align: middle;
- }
- }
- .chooseSet:hover {
- width: 140px;
- height: 30px;
- line-height: 30px;
- margin: 5px auto;
- background-color: #F5F7F9;
- /* color: white; */
- }
- :deep([data-v-69cdaa40] .el-collapse-item__header) {
- padding-left: 10px;
- }
- :deep(.el-collapse-item__content) {
- // height: 235px;
- overflow-y: auto;
- }
- .ellipsis-text {
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- max-width: auto;
- }
- .right_menu {
- width: 100px;
- position: absolute;
- padding: 8px;
- box-shadow: 0px 2px 10px 1px rgba(199, 203, 216);
- border-radius: 4px 4px 4px 4px;
- border: 1px solid #c1cce3;
- background-color: #fff;
- z-index: 10000;
- .menu_item {
- width: 100%;
- height: 40px;
- border-radius: 4px 4px 4px 4px;
- display: flex;
- align-items: center;
- &:hover {
- background-color: #f5f7f9;
- }
- span {
- margin-left: 4px;
- }
- }
- }
- :deep(.el-tag__content) {
- display: block;
- }
- :deep(.el-icon el-tag__close) {
- display: block;
- }
- :deep(.el-collapse-item__content) {
- height: 100%;
- border-bottom: none;
- }
- :deep(.el-collapse-item__wrap) {
- height: 300px;
- }
- </style>
|