MyFile.vue 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182
  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 @click="arrowClick(item, index)">
  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. <!-- 文件上传 -->
  336. <div>
  337. <el-dialog v-model="uploadModal" title="文件上传" width="30%">
  338. <el-upload class="upload-demo" drag :http-request="onSuccess" multiple>
  339. <el-icon class="el-icon--upload"><upload-filled /></el-icon>
  340. <div class="el-upload__text">
  341. 拖入或<em>点击上传</em>
  342. </div>
  343. <template #tip>
  344. <div class="el-upload__tip">
  345. 请选择或拖入文件
  346. </div>
  347. </template>
  348. </el-upload>
  349. <template #footer>
  350. <span class="dialog-footer">
  351. <el-button @click="uploadModal = false">取消</el-button>
  352. <el-button type="primary" @click="sureUpload">
  353. 确认
  354. </el-button>
  355. </span>
  356. </template>
  357. </el-dialog>
  358. </div>
  359. </div>
  360. </div>
  361. </template>
  362. <script>
  363. import { ref } from 'vue'
  364. import myfile from '../../api/myfile/myfile'
  365. import space from '../../api/space/space'
  366. import documents from '../../api/document/document'
  367. import fileSpace from '../../api/filespace/fileSpace'
  368. import { Search } from '@element-plus/icons-vue'
  369. import copy from '../../assets/images/copy.png'
  370. import clipboard from '../../assets/images/clipboard.png'
  371. import share from '../../assets/images/share.png'
  372. import trash from '../../assets/images/trash.png'
  373. import file from '../../assets/images/file.png'
  374. import folder from '../../assets/images/folder.png'
  375. import image from '../../assets/images/image.png'
  376. import filmSlate from '../../assets/images/filmSlate.png'
  377. import musicNotes from '../../assets/images/musicNotes.png'
  378. import blueLeft from '../../assets/images/blueLeft.png'
  379. import grayRight from "../../assets/images/grayRight.png"
  380. import sort from '../../assets/images/sort.png'
  381. import squre from '../../assets/images/squre.png'
  382. import addolder from '../../assets/images/addolder.png'
  383. import textbox from '../../assets/images/textbox.png'
  384. import goon from '../../assets/images/goon.png'
  385. import notePencil from '../../assets/images/notePencil.png'
  386. import togger from '../../assets/images/togger.png'
  387. import icc from '../../assets/images/icc.png'
  388. import history from '../../assets/images/history.png'
  389. import fileBox from '../../assets/images/fileBox.png'
  390. import user from '../../assets/images/user.png'
  391. import archiveTray from '../../assets/images/archiveTray.png'
  392. import { ElMessage } from 'element-plus'
  393. import txt from '../../assets/images/txt.png'
  394. import pptx from '../../assets/images/pptx.png'
  395. import word from '../../assets/images/word.png'
  396. import pdf from '../../assets/images/pdf.png'
  397. import xlxs from '../../assets/images/xlxs.png'
  398. export default {
  399. setup() {
  400. let searchFire = ref('')
  401. let selectedIndex = ref(0)
  402. let folder = ref(['1'])
  403. let files = ref(['2'])
  404. let folderList = ref([])
  405. let askTo = ref(false)
  406. let askNum = ref(1)
  407. let askTalk = ref('')
  408. let cliCC = ref(false)
  409. let transferModal = ref(false)
  410. let addBoser = ref(false)
  411. let addFile = ref(false)
  412. let anyP = ref(false)
  413. let uploadModal = ref(false)
  414. let selectedBox = ref(-1)
  415. let newName = ref('')
  416. let clickRowId = ref("")
  417. let trandata = ref(generateData())
  418. let folderId = ref('')
  419. let fileId = ref('')
  420. let tranvalue = ref([])
  421. let useSpace = ref(0)
  422. let allSpace = ref(0)
  423. let fileArr = ref([])
  424. let boserForm = ref({
  425. spaceId: "",//空间id
  426. dirName: "",
  427. dirPower: "",
  428. dirType: "",
  429. parentId: "",
  430. remark: ""//备注
  431. })
  432. let fileForm = ref({
  433. spaceType: '',
  434. spaceName: "",
  435. spaceCap: "",
  436. usedCap: "",
  437. freeCap: "",
  438. remark: "",
  439. })
  440. let fileList = ref([
  441. {
  442. date: '2016-05-03',
  443. name: 'Tom',
  444. address: 'No. 189, Grove St, Los Angeles',
  445. },
  446. {
  447. date: '2016-05-02',
  448. name: 'Tom',
  449. address: 'No. 189, Grove St, Los Angeles',
  450. },
  451. {
  452. date: '2016-05-04',
  453. name: 'Tom',
  454. address: 'No. 189, Grove St, Los Angeles',
  455. },
  456. {
  457. date: '2016-05-01',
  458. name: 'Tom',
  459. address: 'No. 189, Grove St, Los Angeles',
  460. },
  461. ])
  462. let menuList = ref([
  463. ])
  464. let useMenu = ref([
  465. {
  466. img: copy,
  467. name: "复制"
  468. },
  469. {
  470. img: clipboard,
  471. name: "粘贴"
  472. },
  473. {
  474. img: share,
  475. name: "分享给"
  476. },
  477. {
  478. img: trash,
  479. name: "删除"
  480. },
  481. ])
  482. let arrorMenu = ref([
  483. {
  484. img: file,
  485. name: "文件"
  486. },
  487. {
  488. img: folder,
  489. name: '文件夹'
  490. },
  491. {
  492. img: image,
  493. name: "图片"
  494. },
  495. {
  496. img: filmSlate,
  497. name: "视频"
  498. },
  499. {
  500. img: musicNotes,
  501. name: "音频"
  502. }
  503. ])
  504. let mouseCli = ref([
  505. {
  506. img: addolder,
  507. name: "移动",
  508. },
  509. {
  510. img: copy,
  511. name: "复制",
  512. },
  513. {
  514. img: clipboard,
  515. name: "粘贴"
  516. },
  517. {
  518. img: textbox,
  519. name: "重命名"
  520. },
  521. {
  522. img: goon,
  523. name: "发送"
  524. },
  525. {
  526. img: share,
  527. name: "分享"
  528. },
  529. {
  530. img: notePencil,
  531. name: "在线编辑"
  532. },
  533. {
  534. img: togger,
  535. name: "协作"
  536. },
  537. {
  538. img: icc,
  539. name: "文字识别"
  540. },
  541. {
  542. img: history,
  543. name: "历史版本"
  544. },
  545. {
  546. img: share,
  547. name: "删除"
  548. }
  549. ])
  550. let fileMenu = ref([])
  551. // 获取所有文件夹
  552. function getAll() {
  553. myfile.getAllFileMenu({}).then(res => {
  554. if (res.code === 200) {
  555. fileList.value = res.rows
  556. }
  557. })
  558. }
  559. // 获取所有中栏
  560. function getAllMiddle() {
  561. fileSpace.getFileSpace({}).then(res => {
  562. fileMenu.value = res.rows
  563. })
  564. }
  565. function changeFile(row, num) {
  566. this.selectedIndex = num
  567. const newItem = {
  568. name: row.spaceName,
  569. choose: row.spaceId
  570. };
  571. // 检查 newItem 是否已存在于 menuList 中
  572. const isItemExist = menuList.value.some(item => item.choose === newItem.choose);
  573. // 如果不存在,则添加它
  574. if (!isItemExist) {
  575. menuList.value.push(newItem);
  576. }
  577. console.log(row, 'asdasd');
  578. useSpace.value = row.usedCap
  579. allSpace.value = row.spaceCap
  580. }
  581. // tableMenu切换
  582. function tableChange(row, num) {
  583. this.selectedIndex = num
  584. }
  585. // x图标事件
  586. function shotdown(row) {
  587. this.menuList = this.menuList.filter(item => item.name !== row.name)
  588. }
  589. // 文件名表格每一行点击事件
  590. function handleRowClick(row) {
  591. clickRowId.value = row.docId
  592. if (cliCC.value === true) {
  593. cliCC.value = false
  594. } else {
  595. cliCC.value = true
  596. }
  597. }
  598. // 申请扩容
  599. function askApply() {
  600. this.askTo = true
  601. }
  602. function sureAsk() {
  603. this.askTo = false
  604. }
  605. //mouse弹框
  606. function chooseSet(row, num) {
  607. if (row.name == '在线编辑' || row.name == '协作') {
  608. cliCC.value = true
  609. } else {
  610. cliCC.value = false
  611. }
  612. if (row.name == '分享') {
  613. transferModal.value = true
  614. } else {
  615. transferModal.value = false
  616. }
  617. if (row.name == '协作') {
  618. anyP.value = true
  619. } else {
  620. anyP.value = false
  621. }
  622. if (row.name == '删除') {
  623. myfile.delMenu(clickRowId.value).then(res => {
  624. if (res.code === 200) {
  625. ElMessage({
  626. type: "success",
  627. message: "删除成功"
  628. })
  629. getAll()
  630. }
  631. })
  632. }
  633. }
  634. function chooseSet1() {
  635. transferModal.value = true
  636. anyP.value = false
  637. }
  638. function generateData() {
  639. const data = []
  640. const states = [
  641. 'California',
  642. 'Illinois',
  643. 'Maryland',
  644. 'Texas',
  645. 'Florida',
  646. 'Colorado',
  647. 'Connecticut ',
  648. ]
  649. const initials = ['CA', 'IL', 'MD', 'TX', 'FL', 'CO', 'CT']
  650. states.forEach((city, index) => {
  651. data.push({
  652. label: city,
  653. key: index,
  654. initial: initials[index],
  655. })
  656. })
  657. return data
  658. }
  659. function filterMethod(query, item) {
  660. return item.initial.toLowerCase().includes(query.toLowerCase())
  661. }
  662. function getSpace() {
  663. }
  664. function createNewMenu() {
  665. addBoser.value = true
  666. }
  667. // 新增中栏下方数据
  668. function sureAddBoser() {
  669. documents.addDocument({
  670. "dirName": boserForm.value.dirName,
  671. "dirRole": boserForm.value.dirPower,
  672. "dirType": boserForm.value.dirType,
  673. "parentId": boserForm.value.parentId,
  674. "remark": boserForm.value.remark,
  675. "spaceId": boserForm.value.spaceId,
  676. }).then(res => {
  677. if (res.code === 200) {
  678. ElMessage({
  679. message: '添加成功',
  680. type: 'success',
  681. })
  682. }
  683. addBoser.value = false
  684. getAllText()
  685. })
  686. }
  687. function getAllText() {
  688. documents.getALLdocument({}).then(res => {
  689. folderList.value = res.data
  690. })
  691. }
  692. function createNewFile() {
  693. addFile.value = true
  694. }
  695. function sureAddFile() {
  696. fileSpace.addFileSpace(
  697. {
  698. "spaceName": fileForm.value.spaceName,
  699. "spaceType": fileForm.value.spaceType,
  700. "spaceCap": fileForm.value.spaceCap - 0,//空间容量
  701. "usedCap": fileForm.value.usedCap - 0,//已用空间
  702. "freeCap": fileForm.value.freeCap - 0,//剩余空间
  703. "remark": fileForm.value.remark,//备注
  704. }
  705. ).then(res => {
  706. if (res.code === 200) {
  707. ElMessage({
  708. message: "新增成功",
  709. type: "success"
  710. })
  711. getAllMiddle()
  712. addFile.value = false
  713. } else {
  714. ElMessage({
  715. message: "请检查错误",
  716. type: "warning"
  717. })
  718. }
  719. })
  720. }
  721. // function fileUpload() {
  722. // const fileInput = document.getElementById('fileInput');
  723. // const uploadButton = document.getElementById('uploadButton');
  724. // // 监听按钮点击事件
  725. // uploadButton.addEventListener('click', function () {
  726. // // 模拟点击文件上传输入框
  727. // fileInput.click();
  728. // });
  729. // // 监听文件选择事件
  730. // fileInput.addEventListener('change', function () {
  731. // const files = fileInput.files[0]; // 获取选择的文件
  732. // console.log(files, 'file');
  733. // myfile.uploadFile({
  734. // spaceId: 1,
  735. // dirId: 1,
  736. // file: files
  737. // }).then(res => {
  738. // console.log(res, '222');
  739. // if (res.code === 200) {
  740. // ElMessage({
  741. // message: "上传文件成功",
  742. // type: "success"
  743. // })
  744. // getAll()
  745. // }
  746. // })
  747. // })
  748. // }
  749. function arrowClick(row, num) {
  750. if (row.name === '文件') {
  751. uploadModal.value = true
  752. } else {
  753. uploadModal.value = false
  754. }
  755. }
  756. // 确认上传
  757. function sureUpload() {
  758. myfile.uploadFile({
  759. spaceId: 1,
  760. dirId: 1,
  761. file: fileArr.value
  762. }).then(res => {
  763. if (res.code === 200) {
  764. ElMessage({
  765. message: "上传文件成功",
  766. type: "success"
  767. })
  768. getAll()
  769. uploadModal.value = false
  770. }
  771. })
  772. }
  773. function onSuccess(file, val) {
  774. fileArr.value = file.file
  775. }
  776. // 筛选后缀图片
  777. function getImage(file) {
  778. if (file === '.txt') {
  779. return txt
  780. } else if (file === '.xlxs' || file === '.docx') {
  781. return xlxs
  782. } else if (file === '.pptx') {
  783. return pptx
  784. } else if (file === '.word') {
  785. return word
  786. } else if (file === '.pdf') {
  787. return pdf
  788. }
  789. }
  790. // 表格多选框
  791. function handleSelectionChange(val) {
  792. if (val.length > 1) {
  793. // 如果选择了多项,只保留最后一项
  794. val.shift();
  795. }
  796. if (val.length === 1) {
  797. fileId.value = val[0].docId
  798. }
  799. }
  800. // 文件夹
  801. function handleSelectionChange1(val) {
  802. if (val.length > 1) {
  803. // 如果选择了多项,只保留最后一项
  804. val.shift();
  805. }
  806. if (val.length === 1) {
  807. folderId.value = val[0].docIds
  808. }
  809. }
  810. // 重命名
  811. function restName(row, index) {
  812. newName.value = row.spaceName
  813. selectedBox.value = index
  814. }
  815. // 重命名失焦事件
  816. function nameChange(row, index) {
  817. fileSpace.editFileSpace({
  818. "spaceId": row.spaceId,
  819. "spaceName": newName.value,
  820. }).then(res => {
  821. if (res.code === 200) {
  822. getAllMiddle()
  823. selectedBox.value = -1
  824. ElMessage({
  825. message: '重命名成功',
  826. type: "success"
  827. })
  828. }
  829. })
  830. }
  831. function getMenu(row, num) {
  832. if (row.name === '删除') {
  833. // 文件夹删除
  834. documents.delDocument(folderId.value).then(res => {
  835. if (res.code === 200) {
  836. ElMessage({
  837. message: "删除成功",
  838. type: "success"
  839. })
  840. getAllText()
  841. }
  842. })
  843. myfile.delMenu(fileId.value).then(res => {
  844. if (res.code === 200) {
  845. ElMessage({
  846. message: "删除成功",
  847. type: "success"
  848. })
  849. getAll()
  850. }
  851. })
  852. }
  853. }
  854. function delName(row, num) {
  855. fileSpace.delFileSpace(row.spaceId).then(res => {
  856. if (res.code === 200) {
  857. getAllMiddle()
  858. ElMessage({
  859. message: "删除成功",
  860. type: "success"
  861. })
  862. }
  863. })
  864. }
  865. // 计算百分比
  866. function percent() {
  867. let numP = 0
  868. if (useSpace.value) {
  869. numP = parseInt(useSpace.value / (allSpace.value * 1024) * 100)
  870. return numP
  871. }
  872. }
  873. return {
  874. folderList,//文件夹的数据
  875. fileList,//文件夹的数据
  876. getAll,//拿到数据的方法
  877. searchFire,//搜索文件的model
  878. changeFile,//切换右侧视图的file
  879. menuList,//右侧切换
  880. tableChange,//改变class点击事件
  881. selectedIndex,//当前选中下标
  882. shotdown,//筛选出当前数据
  883. useMenu,
  884. arrorMenu,
  885. blueLeft,//返回
  886. grayRight,//前进
  887. squre,//视图切换
  888. sort,//排序
  889. folder,
  890. files,
  891. handleRowClick,
  892. askApply,//申请扩容
  893. askTo,
  894. sureAsk,
  895. askNum,
  896. askTalk,
  897. cliCC,
  898. addolder,//图片↓
  899. textbox,
  900. goon,
  901. notePencil,
  902. togger,
  903. icc,
  904. history,
  905. mouseCli,//文件点击弹框
  906. chooseSet,
  907. fileBox,
  908. transferModal,
  909. generateData,
  910. filterMethod,
  911. trandata,
  912. tranvalue,
  913. archiveTray,//协作图标
  914. user,//用户图标
  915. anyP,
  916. chooseSet1,
  917. getSpace,//获取内存空间
  918. fileMenu,
  919. addBoser,
  920. boserForm,
  921. createNewMenu,
  922. sureAddBoser,
  923. // delBoser,
  924. getAllText,
  925. clickRowId,
  926. addFile,
  927. createNewFile,
  928. fileForm,
  929. sureAddFile,
  930. // fileUpload,
  931. txt,
  932. pptx,
  933. xlxs,
  934. pdf,
  935. word,
  936. getImage,//筛选文件类型
  937. handleSelectionChange,
  938. handleSelectionChange1,
  939. selectedBox,//重命名相关
  940. restName,//重命名相关
  941. newName,//重命名相关
  942. nameChange,
  943. getMenu,
  944. folderId,
  945. fileId,
  946. getAllMiddle,//拿到所有空间信息
  947. delName,//删除空间信息
  948. useSpace,//使用空间
  949. allSpace,//总空间
  950. percent,
  951. arrowClick,
  952. uploadModal,
  953. sureUpload,
  954. onSuccess,
  955. fileArr,
  956. }
  957. },
  958. created() {
  959. this.getAll();
  960. this.getSpace()
  961. this.getAllText()
  962. this.getAllMiddle()
  963. },
  964. watch: {
  965. },
  966. }
  967. </script>
  968. <style scoped>
  969. p {
  970. margin: 0;
  971. padding: 0;
  972. }
  973. .bigBox {
  974. display: flex;
  975. justify-content: flex-start;
  976. }
  977. .settingBox {
  978. width: 342px;
  979. height: 666px;
  980. border: 2px solid black;
  981. border-radius: 4px;
  982. /* margin: 5px 5px; */
  983. margin-right: 15px;
  984. background-color: white;
  985. }
  986. .topSearch {
  987. width: 100%;
  988. height: 48px;
  989. background-color: #EBEFF6;
  990. display: flex;
  991. justify-content: space-around;
  992. align-items: center;
  993. }
  994. .searchFire {
  995. width: 248px;
  996. height: 32px;
  997. }
  998. .setBox {
  999. width: 88px;
  1000. height: 112px;
  1001. text-align: center;
  1002. margin-left: 12px;
  1003. margin-top: 5px;
  1004. position: relative;
  1005. }
  1006. .setBox:hover {
  1007. background-color: #EEF9FF;
  1008. }
  1009. .setBox:hover .selectChe {
  1010. background-color: #EEF9FF;
  1011. display: block;
  1012. }
  1013. .selectChe {
  1014. display: none;
  1015. width: 20px;
  1016. height: 20px;
  1017. background: rgba(255, 255, 255, 0.7);
  1018. border-radius: 4px 4px 4px 4px;
  1019. position: absolute;
  1020. top: 2px;
  1021. right: 2px;
  1022. line-height: 10px;
  1023. }
  1024. .mesBox {
  1025. width: 70vw;
  1026. height: 666px;
  1027. /* margin: 5px 5px; */
  1028. border-radius: 4px;
  1029. background-color: white;
  1030. }
  1031. .useBox {
  1032. width: 100%;
  1033. height: 96px;
  1034. }
  1035. .tables {
  1036. display: inline-block;
  1037. width: 112px;
  1038. height: 22px;
  1039. border-radius: 4px;
  1040. line-height: 21px;
  1041. text-align: center;
  1042. font-size: 12px;
  1043. margin-left: 5px;
  1044. position: relative;
  1045. white-space: nowrap;
  1046. overflow: hidden;
  1047. text-overflow: ellipsis;
  1048. }
  1049. .tableLis {
  1050. display: inline-block;
  1051. width: 112px;
  1052. height: 22px;
  1053. border-radius: 4px;
  1054. background-color: #EBEFF6;
  1055. line-height: 21px;
  1056. text-align: center;
  1057. font-size: 12px;
  1058. margin-left: 5px;
  1059. position: relative;
  1060. white-space: nowrap;
  1061. overflow: hidden;
  1062. text-overflow: ellipsis;
  1063. max-width: auto;
  1064. }
  1065. .manyUse {
  1066. width: 100%;
  1067. height: 48px;
  1068. /* background-color: gray; */
  1069. line-height: 48px;
  1070. display: flex;
  1071. justify-content: flex-start;
  1072. align-items: center;
  1073. }
  1074. .el-dropdown-link {
  1075. color: white;
  1076. }
  1077. .breadBox {
  1078. width: 100%;
  1079. height: 24px;
  1080. display: flex;
  1081. justify-content: space-between;
  1082. align-items: center;
  1083. background-color: #D9E0F0;
  1084. }
  1085. ::v-deep .el-collapse-item__header {
  1086. height: 24px !important;
  1087. background-color: #EBEFF6 !important;
  1088. }
  1089. .detailBox {
  1090. width: 100%;
  1091. height: 270px;
  1092. }
  1093. ::v-deep .el-dialog__header {
  1094. background-color: #ECEFF7;
  1095. margin-right: 0px;
  1096. }
  1097. .fileTable {
  1098. position: relative;
  1099. height: 300px;
  1100. /* overflow-y: auto; */
  1101. }
  1102. .setCli {
  1103. width: 156px;
  1104. height: auto;
  1105. position: absolute;
  1106. top: -70px;
  1107. left: 300px;
  1108. background-color: white;
  1109. border: 1px solid gray;
  1110. border-radius: 4px;
  1111. z-index: 2;
  1112. }
  1113. .setCli1 {
  1114. width: 156px;
  1115. height: auto;
  1116. position: absolute;
  1117. top: 185px;
  1118. left: 155px;
  1119. background-color: white;
  1120. border: 1px solid gray;
  1121. border-radius: 4px;
  1122. z-index: 2;
  1123. }
  1124. .chooseSet {
  1125. width: 100%;
  1126. height: 30px;
  1127. line-height: 30px;
  1128. }
  1129. .chooseSet:hover {
  1130. width: 100%;
  1131. height: 30px;
  1132. line-height: 30px;
  1133. background-color: #8693b2;
  1134. color: white;
  1135. }
  1136. ::v-deep [data-v-69cdaa40] .el-collapse-item__header {
  1137. padding-left: 10px;
  1138. }
  1139. ::v-deep .el-collapse-item__content {
  1140. height: 260px;
  1141. overflow-y: auto;
  1142. }
  1143. .ellipsis-text {
  1144. white-space: nowrap;
  1145. overflow: hidden;
  1146. text-overflow: ellipsis;
  1147. max-width: auto;
  1148. }
  1149. </style>