MyFile.vue 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123
  1. <template>
  2. <div>
  3. <div class="bigBox">
  4. <div class="settingBox">
  5. <!-- 设置盒子顶部搜索 -->
  6. <div class="topSearch">
  7. <div style="position: relative;">
  8. <el-input v-model="searchFire" class="searchFire" size="large" placeholder="搜索文件" />
  9. <el-icon style="color: gray;display: inline-block;position: absolute;top: 8px;right: 5px;">
  10. <Search />
  11. </el-icon>
  12. </div>
  13. <div>
  14. <el-icon style="font-size: 24px;" @click="createNewFile">
  15. <Plus />
  16. </el-icon>
  17. </div>
  18. </div>
  19. <!-- 方块点击盒子 -->
  20. <div
  21. style="display: flex;justify-content: flex-start;align-items: flex-start;flex-wrap: wrap;height: 540px;align-content: flex-start;">
  22. <!-- v-for盒子 -->
  23. <template v-for="(item, index) in fileMenu">
  24. <div class="setBox" @click="changeFile(item, index)">
  25. <el-dropdown trigger="click" class="selectChe">
  26. <span class="el-dropdown-link">
  27. ...
  28. </span>
  29. <template #dropdown>
  30. <el-dropdown-menu>
  31. <el-dropdown-item @click="restName(item, index)">重命名</el-dropdown-item>
  32. <el-dropdown-item @click="delName(item, index)">删除</el-dropdown-item>
  33. </el-dropdown-menu>
  34. </template>
  35. </el-dropdown>
  36. <img src="../../assets/images/fileStyle.png" style="width: 72px;height: 72px;">
  37. <p class="ellipsis-text" v-if="selectedBox !== index">{{ item.spaceName }}</p>
  38. <el-input v-else v-model="newName" @blur="nameChange(item, index)"></el-input>
  39. </div>
  40. </template>
  41. </div>
  42. <div>
  43. <p>
  44. <span style="margin-left: 10px;">{{ useSpace }}G/{{ allSpace * 1024 }}G</span>
  45. <span style="margin-left: 10rem;font-size: 12px;color: blue;cursor: pointer;"
  46. @click="askApply">申请扩容</span>
  47. </p>
  48. <el-progress style="margin-left: 8px;" :percentage="percent()" />
  49. </div>
  50. </div>
  51. <!-- 右侧大盒子 -->
  52. <div class="mesBox">
  53. <!-- 功能盒子 -->
  54. <div class="useBox">
  55. <!-- table切换 -->
  56. <div style="width: 100%;height: 24px;background-color: #7084B4;line-height: 20px;">
  57. <template v-for="(item, index) in menuList">
  58. <span @click="tableChange(item, index)"
  59. :class="['tables', { tableLis: selectedIndex === index }]">
  60. {{ item.name }}
  61. <img v-if="selectedIndex === index ? true : false"
  62. style="position: absolute;top: 4px;right: 4px;" src="../../assets/images/close.png"
  63. @click="shotdown(item)">
  64. </span>
  65. </template>
  66. </div>
  67. <!-- 众多功能 -->
  68. <div class="manyUse">
  69. <div
  70. style="display: flex;width: 82px;height: 32px;justify-content: flex-start;align-items: center;">
  71. <div style="margin-left: 5px;">
  72. <el-icon
  73. style="background-color: #7084B4;width: 24px;height: 24px;border-radius: 50%;color: white;">
  74. <Plus />
  75. </el-icon>
  76. </div>
  77. <div style="margin-left: 5px;" @click="createNewMenu">
  78. <span style="font-size: 14px;">新建</span>
  79. </div>
  80. </div>
  81. <template v-for="(item, index) in useMenu">
  82. <div style="display: flex;width: 82px;height: 32px;justify-content: flex-start;align-items: center;line-height: 18px;"
  83. @click="getMenu(item, index)">
  84. <div style="margin-left: 5px;">
  85. <img :src="item.img" style="width: 24px;height: 24px;" alt="">
  86. </div>
  87. <div style="margin-left: 5px;">
  88. <span style="font-size: 14px;">{{ item.name }}</span>
  89. </div>
  90. </div>
  91. </template>
  92. <div
  93. style="display: flex;width: 92px;height: 32px;justify-content: flex-start;align-items: center;line-height: 18px;">
  94. <div style="margin-left: 5px;">
  95. <img src="../../assets/images/upload.png" style="width: 24px;height: 24px;" alt="">
  96. </div>
  97. <div style="margin-left: 5px;">
  98. <el-dropdown trigger="click">
  99. <span style="color: black;cursor: pointer;">上传
  100. <el-icon>
  101. <arrow-down />
  102. </el-icon>
  103. </span>
  104. <template #dropdown>
  105. <el-dropdown-menu>
  106. <el-dropdown-item @click="fileUpload">
  107. <img src="../../assets/images/file.png" alt="">
  108. <span id="uploadButton">上传</span>
  109. <input id="fileInput" type="file" style="display: none;">
  110. </el-dropdown-item>
  111. <template v-for="(item, index) in arrorMenu">
  112. <el-dropdown-item>
  113. <img :src="item.img" alt="">
  114. <span>{{ item.name }}</span>
  115. </el-dropdown-item>
  116. </template>
  117. </el-dropdown-menu>
  118. </template>
  119. </el-dropdown>
  120. </div>
  121. </div>
  122. </div>
  123. <!-- 面包屑功能栏 -->
  124. <div class="breadBox">
  125. <!-- 左侧 -->
  126. <div style="display: flex;justify-content: space-around;align-items: center;">
  127. <!-- 前进后退 -->
  128. <div style="display: flex;justify-content: space-around;align-items: center;">
  129. <img style="display:block;width: 11px;height: 11px;" :src="blueLeft" alt="">
  130. <img style="display:block;width: 16px;height: 16px;" :src="grayRight" alt="">
  131. </div>
  132. <!-- 面包屑 -->
  133. <div>
  134. <el-breadcrumb separator="/">
  135. <el-breadcrumb-item style="font-size: 12px;">homepage</el-breadcrumb-item>
  136. <el-breadcrumb-item style="font-size: 12px;">promotion management</el-breadcrumb-item>
  137. <el-breadcrumb-item style="font-size: 12px;">promotion detail</el-breadcrumb-item>
  138. </el-breadcrumb>
  139. </div>
  140. </div>
  141. <!-- 右侧 -->
  142. <div>
  143. <img :src="sort" alt="">
  144. <img :src="squre" alt="">
  145. </div>
  146. </div>
  147. </div>
  148. <!-- 展示文件夹盒子 -->
  149. <div>
  150. <!-- 文件夹 -->
  151. <div class="detailBox">
  152. <el-collapse v-model="folder" accordion class="collapseSell">
  153. <el-collapse-item title="文件夹" name="1" class="custom-collapse-item">
  154. <el-table :data="folderList" style="width: 100%" @selection-change="handleSelectionChange1"
  155. :single-select="true">
  156. <el-table-column type="selection" width="55" />
  157. <el-table-column label="名称" width="180">
  158. <template #default="scope">
  159. <span>
  160. <img src="../../assets/images/fileBox.png" style="width: 20px;height: 24px;"
  161. alt="">
  162. {{ scope.row.dirName }}
  163. </span>
  164. </template>
  165. </el-table-column>
  166. <el-table-column prop="createTime" label="时间" width="180" />
  167. <el-table-column prop="dirType" label="类型">
  168. <template #default="scope">
  169. <span>{{ scope.row.dirType === "1" ? "文件夹" : "未知类型" }}</span>
  170. </template>
  171. </el-table-column>
  172. <el-table-column label="大小">
  173. <template #default="scope">
  174. <span>
  175. 10KB
  176. </span>
  177. </template>
  178. </el-table-column>
  179. </el-table>
  180. </el-collapse-item>
  181. </el-collapse>
  182. </div>
  183. <!-- 文件 -->
  184. <div class="fileTable">
  185. <el-collapse v-model="files" accordion class="collapse" style="height: 200px;">
  186. <el-collapse-item title="文件" name="2" class="">
  187. <el-table :data="fileList" style="width: 100%" @row-click="handleRowClick"
  188. @selection-change="handleSelectionChange">
  189. <el-table-column type="selection" width="55" />
  190. <el-table-column label="名称" width="180">
  191. <template #default="scope">
  192. <span>
  193. <img :src="getImage(scope.row.fileType)" alt="">
  194. {{ scope.row.fileName }}
  195. </span>
  196. </template>
  197. </el-table-column>
  198. <el-table-column prop="createTime" label="时间" width="180" />
  199. <el-table-column prop="fileType" label="类型" />
  200. <el-table-column label="大小">
  201. <template #default="scope">
  202. <span>
  203. {{ scope.row.fileSize }}KB
  204. </span>
  205. </template>
  206. </el-table-column>
  207. </el-table>
  208. <div class="setCli" v-if="cliCC">
  209. <template v-for="(item, index) in mouseCli">
  210. <p @click="chooseSet(item, index)" class="chooseSet">
  211. <img :src="item.img" alt="">
  212. {{ item.name }}
  213. <span v-if="item.name == '在线编辑' || item.name == '协作' ? true : false"
  214. style="color: #7084B4;float: right;position: relative;">></span>
  215. </p>
  216. </template>
  217. <div class="setCli1" v-if="anyP">
  218. <p @click="chooseSet1()" class="chooseSet">
  219. <img :src="user" alt="">
  220. 选择人员
  221. </p>
  222. <p class="chooseSet">
  223. <img :src="archiveTray" alt="">
  224. 归档
  225. </p>
  226. </div>
  227. </div>
  228. </el-collapse-item>
  229. </el-collapse>
  230. </div>
  231. <!-- 穿梭框 -->
  232. <div>
  233. <el-dialog v-model="transferModal" title="分享" width="40%">
  234. <el-transfer v-model="tranvalue" filterable :filter-method="filterMethod"
  235. filter-placeholder="State Abbreviations" :data="trandata" />
  236. <template #footer>
  237. <span class="dialog-footer">
  238. <el-button @click="transferModal = false">取消</el-button>
  239. <el-button type="primary" @click="transferSure">
  240. 确定
  241. </el-button>
  242. </span>
  243. </template>
  244. </el-dialog>
  245. </div>
  246. </div>
  247. </div>
  248. <!-- 扩容弹窗 -->
  249. <div>
  250. <el-dialog v-model="askTo" title="扩容申请" width="30%">
  251. <el-form>
  252. <el-form-item label="新容量">
  253. <el-input-number v-model="askNum" :min="1" :max="10" />
  254. </el-form-item>
  255. <el-form-item label="申请理由">
  256. <el-input v-model="askTalk" maxlength="150" placeholder="请输入申请理由" show-word-limit
  257. type="textarea" />
  258. </el-form-item>
  259. </el-form>
  260. <template #footer>
  261. <span class="dialog-footer">
  262. <el-button @click="askTo = false">取消</el-button>
  263. <el-button type="primary" @click="sureAsk">
  264. 确定
  265. </el-button>
  266. </span>
  267. </template>
  268. </el-dialog>
  269. </div>
  270. <!-- 新增文件夹弹窗 -->
  271. <div>
  272. <el-dialog v-model="addBoser" title="Tips" width="30%">
  273. <el-form :model="boserForm" label-width="120px">
  274. <el-form-item label="空间id">
  275. <el-input v-model="boserForm.spaceId" />
  276. </el-form-item>
  277. <el-form-item label="目录类型">
  278. <el-input v-model="boserForm.dirType" />
  279. </el-form-item>
  280. <el-form-item label="目录权限">
  281. <el-input v-model="boserForm.dirPower" />
  282. </el-form-item>
  283. <el-form-item label="目录名称">
  284. <el-input v-model="boserForm.dirName" />
  285. </el-form-item>
  286. <el-form-item label="父目录id">
  287. <el-input v-model="boserForm.parentId" />
  288. </el-form-item>
  289. <el-form-item label="备注">
  290. <el-input v-model="boserForm.remark" />
  291. </el-form-item>
  292. </el-form>
  293. <template #footer>
  294. <span class="dialog-footer">
  295. <el-button @click="addBoser = false">取消</el-button>
  296. <el-button type="primary" @click="sureAddBoser">
  297. 确认
  298. </el-button>
  299. </span>
  300. </template>
  301. </el-dialog>
  302. </div>
  303. <div>
  304. <el-dialog v-model="addFile" title="Tips" width="30%">
  305. <el-form :model="fileForm" label-width="120px">
  306. <el-form-item label="空间类型">
  307. <el-input v-model="fileForm.spaceType" />
  308. </el-form-item>
  309. <el-form-item label="空间名称">
  310. <el-input v-model="fileForm.spaceName" />
  311. </el-form-item>
  312. <el-form-item label="空间容量">
  313. <el-input v-model="fileForm.spaceCap" />
  314. </el-form-item>
  315. <el-form-item label="已使用空间">
  316. <el-input v-model="fileForm.usedCap" />
  317. </el-form-item>
  318. <el-form-item label="剩余空间">
  319. <el-input v-model="fileForm.freeCap" />
  320. </el-form-item>
  321. <el-form-item label="备注">
  322. <el-input v-model="fileForm.remark" />
  323. </el-form-item>
  324. </el-form>
  325. <template #footer>
  326. <span class="dialog-footer">
  327. <el-button @click="addFile = false">取消</el-button>
  328. <el-button type="primary" @click="sureAddFile">
  329. 确认
  330. </el-button>
  331. </span>
  332. </template>
  333. </el-dialog>
  334. </div>
  335. </div>
  336. </div>
  337. </template>
  338. <script>
  339. import { ref } from 'vue'
  340. import myfile from '../../api/myfile/myfile'
  341. import space from '../../api/space/space'
  342. import documents from '../../api/document/document'
  343. import fileSpace from '../../api/filespace/fileSpace'
  344. import { Search } from '@element-plus/icons-vue'
  345. import copy from '../../assets/images/copy.png'
  346. import clipboard from '../../assets/images/clipboard.png'
  347. import share from '../../assets/images/share.png'
  348. import trash from '../../assets/images/trash.png'
  349. import file from '../../assets/images/file.png'
  350. import folder from '../../assets/images/folder.png'
  351. import image from '../../assets/images/image.png'
  352. import filmSlate from '../../assets/images/filmSlate.png'
  353. import musicNotes from '../../assets/images/musicNotes.png'
  354. import blueLeft from '../../assets/images/blueLeft.png'
  355. import grayRight from "../../assets/images/grayRight.png"
  356. import sort from '../../assets/images/sort.png'
  357. import squre from '../../assets/images/squre.png'
  358. import addolder from '../../assets/images/addolder.png'
  359. import textbox from '../../assets/images/textbox.png'
  360. import goon from '../../assets/images/goon.png'
  361. import notePencil from '../../assets/images/notePencil.png'
  362. import togger from '../../assets/images/togger.png'
  363. import icc from '../../assets/images/icc.png'
  364. import history from '../../assets/images/history.png'
  365. import fileBox from '../../assets/images/fileBox.png'
  366. import user from '../../assets/images/user.png'
  367. import archiveTray from '../../assets/images/archiveTray.png'
  368. import { ElMessage } from 'element-plus'
  369. import txt from '../../assets/images/txt.png'
  370. import pptx from '../../assets/images/pptx.png'
  371. import word from '../../assets/images/word.png'
  372. import pdf from '../../assets/images/pdf.png'
  373. import xlxs from '../../assets/images/xlxs.png'
  374. export default {
  375. setup() {
  376. let searchFire = ref('')
  377. let selectedIndex = ref(0)
  378. let folder = ref(['1'])
  379. let files = ref(['2'])
  380. let folderList = ref([])
  381. let askTo = ref(false)
  382. let askNum = ref(1)
  383. let askTalk = ref('')
  384. let cliCC = ref(false)
  385. let transferModal = ref(false)
  386. let addBoser = ref(false)
  387. let addFile = ref(false)
  388. let anyP = ref(false)
  389. let selectedBox = ref(-1)
  390. let newName = ref('')
  391. let clickRowId = ref("")
  392. let trandata = ref(generateData())
  393. let folderId = ref('')
  394. let fileId = ref('')
  395. let tranvalue = ref([])
  396. let useSpace = ref(0)
  397. let allSpace = ref(0)
  398. let boserForm = ref({
  399. spaceId: "",//空间id
  400. dirName: "",
  401. dirPower: "",
  402. dirType: "",
  403. parentId: "",
  404. remark: ""//备注
  405. })
  406. let fileForm = ref({
  407. spaceType: '',
  408. spaceName: "",
  409. spaceCap: "",
  410. usedCap: "",
  411. freeCap: "",
  412. remark: "",
  413. })
  414. let fileList = ref([
  415. {
  416. date: '2016-05-03',
  417. name: 'Tom',
  418. address: 'No. 189, Grove St, Los Angeles',
  419. },
  420. {
  421. date: '2016-05-02',
  422. name: 'Tom',
  423. address: 'No. 189, Grove St, Los Angeles',
  424. },
  425. {
  426. date: '2016-05-04',
  427. name: 'Tom',
  428. address: 'No. 189, Grove St, Los Angeles',
  429. },
  430. {
  431. date: '2016-05-01',
  432. name: 'Tom',
  433. address: 'No. 189, Grove St, Los Angeles',
  434. },
  435. ])
  436. let menuList = ref([
  437. ])
  438. let useMenu = ref([
  439. {
  440. img: copy,
  441. name: "复制"
  442. },
  443. {
  444. img: clipboard,
  445. name: "粘贴"
  446. },
  447. {
  448. img: share,
  449. name: "分享给"
  450. },
  451. {
  452. img: trash,
  453. name: "删除"
  454. },
  455. ])
  456. let arrorMenu = ref([
  457. // {
  458. // img: file,
  459. // name: "文件"
  460. // },
  461. {
  462. img: folder,
  463. name: '文件夹'
  464. },
  465. {
  466. img: image,
  467. name: "图片"
  468. },
  469. {
  470. img: filmSlate,
  471. name: "视频"
  472. },
  473. {
  474. img: musicNotes,
  475. name: "音频"
  476. }
  477. ])
  478. let mouseCli = ref([
  479. {
  480. img: addolder,
  481. name: "移动",
  482. },
  483. {
  484. img: copy,
  485. name: "复制",
  486. },
  487. {
  488. img: clipboard,
  489. name: "粘贴"
  490. },
  491. {
  492. img: textbox,
  493. name: "重命名"
  494. },
  495. {
  496. img: goon,
  497. name: "发送"
  498. },
  499. {
  500. img: share,
  501. name: "分享"
  502. },
  503. {
  504. img: notePencil,
  505. name: "在线编辑"
  506. },
  507. {
  508. img: togger,
  509. name: "协作"
  510. },
  511. {
  512. img: icc,
  513. name: "文字识别"
  514. },
  515. {
  516. img: history,
  517. name: "历史版本"
  518. },
  519. {
  520. img: share,
  521. name: "删除"
  522. }
  523. ])
  524. let fileMenu = ref([])
  525. // 获取所有文件夹
  526. function getAll() {
  527. myfile.getAllFileMenu({}).then(res => {
  528. if (res.code === 200) {
  529. fileList.value = res.rows
  530. }
  531. })
  532. }
  533. // 获取所有中栏
  534. function getAllMiddle() {
  535. fileSpace.getFileSpace({}).then(res => {
  536. fileMenu.value = res.rows
  537. })
  538. }
  539. function changeFile(row, num) {
  540. this.selectedIndex = num
  541. const newItem = {
  542. name: row.spaceName,
  543. choose: row.spaceId
  544. };
  545. // 检查 newItem 是否已存在于 menuList 中
  546. const isItemExist = menuList.value.some(item => item.choose === newItem.choose);
  547. // 如果不存在,则添加它
  548. if (!isItemExist) {
  549. menuList.value.push(newItem);
  550. }
  551. console.log(row, 'asdasd');
  552. useSpace.value = row.usedCap
  553. allSpace.value = row.spaceCap
  554. }
  555. // tableMenu切换
  556. function tableChange(row, num) {
  557. this.selectedIndex = num
  558. }
  559. // x图标事件
  560. function shotdown(row) {
  561. this.menuList = this.menuList.filter(item => item.name !== row.name)
  562. }
  563. // 文件名表格每一行点击事件
  564. function handleRowClick(row) {
  565. clickRowId.value = row.docId
  566. if (cliCC.value === true) {
  567. cliCC.value = false
  568. } else {
  569. cliCC.value = true
  570. }
  571. }
  572. // 申请扩容
  573. function askApply() {
  574. this.askTo = true
  575. }
  576. function sureAsk() {
  577. this.askTo = false
  578. }
  579. //mouse弹框
  580. function chooseSet(row, num) {
  581. if (row.name == '在线编辑' || row.name == '协作') {
  582. cliCC.value = true
  583. } else {
  584. cliCC.value = false
  585. }
  586. if (row.name == '分享') {
  587. transferModal.value = true
  588. } else {
  589. transferModal.value = false
  590. }
  591. if (row.name == '协作') {
  592. anyP.value = true
  593. } else {
  594. anyP.value = false
  595. }
  596. if (row.name == '删除') {
  597. myfile.delMenu(clickRowId.value).then(res => {
  598. if (res.code === 200) {
  599. ElMessage({
  600. type: "success",
  601. message: "删除成功"
  602. })
  603. getAll()
  604. }
  605. })
  606. }
  607. }
  608. function chooseSet1() {
  609. transferModal.value = true
  610. anyP.value = false
  611. }
  612. function generateData() {
  613. const data = []
  614. const states = [
  615. 'California',
  616. 'Illinois',
  617. 'Maryland',
  618. 'Texas',
  619. 'Florida',
  620. 'Colorado',
  621. 'Connecticut ',
  622. ]
  623. const initials = ['CA', 'IL', 'MD', 'TX', 'FL', 'CO', 'CT']
  624. states.forEach((city, index) => {
  625. data.push({
  626. label: city,
  627. key: index,
  628. initial: initials[index],
  629. })
  630. })
  631. return data
  632. }
  633. function filterMethod(query, item) {
  634. return item.initial.toLowerCase().includes(query.toLowerCase())
  635. }
  636. function getSpace() {
  637. }
  638. function createNewMenu() {
  639. addBoser.value = true
  640. }
  641. // 新增中栏下方数据
  642. function sureAddBoser() {
  643. documents.addDocument({
  644. "dirName": boserForm.value.dirName,
  645. "dirRole": boserForm.value.dirPower,
  646. "dirType": boserForm.value.dirType,
  647. "parentId": boserForm.value.parentId,
  648. "remark": boserForm.value.remark,
  649. "spaceId": boserForm.value.spaceId,
  650. }).then(res => {
  651. if (res.code === 200) {
  652. ElMessage({
  653. message: '添加成功',
  654. type: 'success',
  655. })
  656. }
  657. addBoser.value = false
  658. getAllText()
  659. })
  660. }
  661. function getAllText() {
  662. documents.getALLdocument({}).then(res => {
  663. folderList.value = res.data
  664. })
  665. }
  666. function createNewFile() {
  667. addFile.value = true
  668. }
  669. function sureAddFile() {
  670. fileSpace.addFileSpace(
  671. {
  672. "spaceName": fileForm.value.spaceName,
  673. "spaceType": fileForm.value.spaceType,
  674. "spaceCap": fileForm.value.spaceCap - 0,//空间容量
  675. "usedCap": fileForm.value.usedCap - 0,//已用空间
  676. "freeCap": fileForm.value.freeCap - 0,//剩余空间
  677. "remark": fileForm.value.remark,//备注
  678. }
  679. ).then(res => {
  680. if (res.code === 200) {
  681. ElMessage({
  682. message: "新增成功",
  683. type: "success"
  684. })
  685. getAllMiddle()
  686. addFile.value = false
  687. } else {
  688. ElMessage({
  689. message: "请检查错误",
  690. type: "warning"
  691. })
  692. }
  693. })
  694. }
  695. function fileUpload() {
  696. const fileInput = document.getElementById('fileInput');
  697. const uploadButton = document.getElementById('uploadButton');
  698. // 监听按钮点击事件
  699. uploadButton.addEventListener('click', function () {
  700. // 模拟点击文件上传输入框
  701. fileInput.click();
  702. });
  703. // 监听文件选择事件
  704. fileInput.addEventListener('change', function () {
  705. const files = fileInput.files[0]; // 获取选择的文件
  706. myfile.uploadFile({
  707. spaceId: 1,
  708. dirId: 1,
  709. file: files
  710. }).then(res => {
  711. console.log(res, '222');
  712. if (res.code === 200) {
  713. ElMessage({
  714. message: "上传文件成功",
  715. type: "success"
  716. })
  717. getAll()
  718. }
  719. })
  720. });
  721. }
  722. // 筛选后缀图片
  723. function getImage(file) {
  724. if (file === '.txt') {
  725. return txt
  726. } else if (file === '.xlxs' || file === '.docx') {
  727. return xlxs
  728. } else if (file === '.pptx') {
  729. return pptx
  730. } else if (file === '.word') {
  731. return word
  732. } else if (file === '.pdf') {
  733. return pdf
  734. }
  735. }
  736. // 表格多选框
  737. function handleSelectionChange(val) {
  738. if (val.length > 1) {
  739. // 如果选择了多项,只保留最后一项
  740. val.shift();
  741. }
  742. if (val.length === 1) {
  743. fileId.value = val[0].docId
  744. }
  745. }
  746. // 文件夹
  747. function handleSelectionChange1(val) {
  748. if (val.length > 1) {
  749. // 如果选择了多项,只保留最后一项
  750. val.shift();
  751. }
  752. if (val.length === 1) {
  753. folderId.value = val[0].docIds
  754. }
  755. }
  756. // 重命名
  757. function restName(row, index) {
  758. newName.value = row.spaceName
  759. selectedBox.value = index
  760. }
  761. // 重命名失焦事件
  762. function nameChange(row, index) {
  763. fileSpace.editFileSpace({
  764. "spaceId": row.spaceId,
  765. "spaceName": newName.value,
  766. }).then(res => {
  767. if (res.code === 200) {
  768. getAllMiddle()
  769. selectedBox.value = -1
  770. ElMessage({
  771. message: '重命名成功',
  772. type: "success"
  773. })
  774. }
  775. })
  776. }
  777. function getMenu(row, num) {
  778. if (row.name === '删除') {
  779. // 文件夹删除
  780. documents.delDocument(folderId.value).then(res => {
  781. if (res.code === 200) {
  782. ElMessage({
  783. message: "删除成功",
  784. type: "success"
  785. })
  786. getAllText()
  787. }
  788. })
  789. myfile.delMenu(fileId.value).then(res => {
  790. if (res.code === 200) {
  791. ElMessage({
  792. message: "删除成功",
  793. type: "success"
  794. })
  795. getAll()
  796. }
  797. })
  798. }
  799. }
  800. function delName(row, num) {
  801. fileSpace.delFileSpace(row.spaceId).then(res => {
  802. if (res.code === 200) {
  803. getAllMiddle()
  804. ElMessage({
  805. message: "删除成功",
  806. type: "success"
  807. })
  808. }
  809. })
  810. }
  811. // 计算百分比
  812. function percent() {
  813. let numP = 0
  814. if (useSpace.value) {
  815. numP = parseInt(useSpace.value / (allSpace.value * 1024) * 100)
  816. return numP
  817. }
  818. }
  819. return {
  820. folderList,//文件夹的数据
  821. fileList,//文件夹的数据
  822. getAll,//拿到数据的方法
  823. searchFire,//搜索文件的model
  824. changeFile,//切换右侧视图的file
  825. menuList,//右侧切换
  826. tableChange,//改变class点击事件
  827. selectedIndex,//当前选中下标
  828. shotdown,//筛选出当前数据
  829. useMenu,
  830. arrorMenu,
  831. blueLeft,//返回
  832. grayRight,//前进
  833. squre,//视图切换
  834. sort,//排序
  835. folder,
  836. files,
  837. handleRowClick,
  838. askApply,//申请扩容
  839. askTo,
  840. sureAsk,
  841. askNum,
  842. askTalk,
  843. cliCC,
  844. addolder,//图片↓
  845. textbox,
  846. goon,
  847. notePencil,
  848. togger,
  849. icc,
  850. history,
  851. mouseCli,//文件点击弹框
  852. chooseSet,
  853. fileBox,
  854. transferModal,
  855. generateData,
  856. filterMethod,
  857. trandata,
  858. tranvalue,
  859. archiveTray,//协作图标
  860. user,//用户图标
  861. anyP,
  862. chooseSet1,
  863. getSpace,//获取内存空间
  864. fileMenu,
  865. addBoser,
  866. boserForm,
  867. createNewMenu,
  868. sureAddBoser,
  869. // delBoser,
  870. getAllText,
  871. clickRowId,
  872. addFile,
  873. createNewFile,
  874. fileForm,
  875. sureAddFile,
  876. fileUpload,
  877. txt,
  878. pptx,
  879. xlxs,
  880. pdf,
  881. word,
  882. getImage,//筛选文件类型
  883. handleSelectionChange,
  884. handleSelectionChange1,
  885. selectedBox,//重命名相关
  886. restName,//重命名相关
  887. newName,//重命名相关
  888. nameChange,
  889. getMenu,
  890. folderId,
  891. fileId,
  892. getAllMiddle,//拿到所有空间信息
  893. delName,//删除空间信息
  894. useSpace,//使用空间
  895. allSpace,//总空间
  896. percent,
  897. }
  898. },
  899. created() {
  900. this.getAll();
  901. this.getSpace()
  902. this.getAllText()
  903. this.getAllMiddle()
  904. },
  905. watch: {
  906. },
  907. }
  908. </script>
  909. <style scoped>
  910. p {
  911. margin: 0;
  912. padding: 0;
  913. }
  914. .bigBox {
  915. display: flex;
  916. justify-content: flex-start;
  917. }
  918. .settingBox {
  919. width: 342px;
  920. height: 666px;
  921. border: 2px solid black;
  922. border-radius: 4px;
  923. /* margin: 5px 5px; */
  924. margin-right: 15px;
  925. background-color: white;
  926. }
  927. .topSearch {
  928. width: 100%;
  929. height: 48px;
  930. background-color: #EBEFF6;
  931. display: flex;
  932. justify-content: space-around;
  933. align-items: center;
  934. }
  935. .searchFire {
  936. width: 248px;
  937. height: 32px;
  938. }
  939. .setBox {
  940. width: 88px;
  941. height: 112px;
  942. text-align: center;
  943. margin-left: 12px;
  944. margin-top: 5px;
  945. position: relative;
  946. }
  947. .setBox:hover {
  948. background-color: #EEF9FF;
  949. }
  950. .setBox:hover .selectChe {
  951. background-color: #EEF9FF;
  952. display: block;
  953. }
  954. .selectChe {
  955. display: none;
  956. width: 20px;
  957. height: 20px;
  958. background: rgba(255, 255, 255, 0.7);
  959. border-radius: 4px 4px 4px 4px;
  960. position: absolute;
  961. top: 2px;
  962. right: 2px;
  963. line-height: 10px;
  964. }
  965. .mesBox {
  966. width: 70vw;
  967. height: 666px;
  968. /* margin: 5px 5px; */
  969. border-radius: 4px;
  970. background-color: white;
  971. }
  972. .useBox {
  973. width: 100%;
  974. height: 96px;
  975. }
  976. .tables {
  977. display: inline-block;
  978. width: 112px;
  979. height: 22px;
  980. border-radius: 4px;
  981. line-height: 21px;
  982. text-align: center;
  983. font-size: 12px;
  984. margin-left: 5px;
  985. position: relative;
  986. white-space: nowrap;
  987. overflow: hidden;
  988. text-overflow: ellipsis;
  989. }
  990. .tableLis {
  991. display: inline-block;
  992. width: 112px;
  993. height: 22px;
  994. border-radius: 4px;
  995. background-color: #EBEFF6;
  996. line-height: 21px;
  997. text-align: center;
  998. font-size: 12px;
  999. margin-left: 5px;
  1000. position: relative;
  1001. white-space: nowrap;
  1002. overflow: hidden;
  1003. text-overflow: ellipsis;
  1004. max-width: auto;
  1005. }
  1006. .manyUse {
  1007. width: 100%;
  1008. height: 48px;
  1009. /* background-color: gray; */
  1010. line-height: 48px;
  1011. display: flex;
  1012. justify-content: flex-start;
  1013. align-items: center;
  1014. }
  1015. .el-dropdown-link {
  1016. color: white;
  1017. }
  1018. .breadBox {
  1019. width: 100%;
  1020. height: 24px;
  1021. display: flex;
  1022. justify-content: space-between;
  1023. align-items: center;
  1024. background-color: #D9E0F0;
  1025. }
  1026. ::v-deep .el-collapse-item__header {
  1027. height: 24px !important;
  1028. background-color: #EBEFF6 !important;
  1029. }
  1030. .detailBox {
  1031. width: 100%;
  1032. height: 270px;
  1033. }
  1034. ::v-deep .el-dialog__header {
  1035. background-color: #ECEFF7;
  1036. margin-right: 0px;
  1037. }
  1038. .fileTable {
  1039. position: relative;
  1040. height: 300px;
  1041. /* overflow-y: auto; */
  1042. }
  1043. .setCli {
  1044. width: 156px;
  1045. height: auto;
  1046. position: absolute;
  1047. top: -70px;
  1048. left: 300px;
  1049. background-color: white;
  1050. border: 1px solid gray;
  1051. border-radius: 4px;
  1052. z-index: 2;
  1053. }
  1054. .setCli1 {
  1055. width: 156px;
  1056. height: auto;
  1057. position: absolute;
  1058. top: 185px;
  1059. left: 155px;
  1060. background-color: white;
  1061. border: 1px solid gray;
  1062. border-radius: 4px;
  1063. z-index: 2;
  1064. }
  1065. .chooseSet {
  1066. width: 100%;
  1067. height: 30px;
  1068. line-height: 30px;
  1069. }
  1070. .chooseSet:hover {
  1071. width: 100%;
  1072. height: 30px;
  1073. line-height: 30px;
  1074. background-color: #8693b2;
  1075. color: white;
  1076. }
  1077. ::v-deep [data-v-69cdaa40] .el-collapse-item__header {
  1078. padding-left: 10px;
  1079. }
  1080. ::v-deep .el-collapse-item__content {
  1081. height: 260px;
  1082. overflow-y: auto;
  1083. }
  1084. .ellipsis-text {
  1085. white-space: nowrap;
  1086. overflow: hidden;
  1087. text-overflow: ellipsis;
  1088. max-width: auto;
  1089. }
  1090. </style>