HomePage.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. <template>
  2. <div class="homePage">
  3. <div class="bg_box">
  4. <!-- 动态背景 -->
  5. <video autoplay="autoplay" loop class="fillWidth" muted="muted">
  6. <source src="@/assets/images/home/bg.mp4" type="video/mp4" />
  7. </video>
  8. <div class="bigC_box">
  9. <!-- 中间的大圆 -->
  10. <div class="bigImg_box">
  11. <img src="@/assets/images/home/bigC.jpg" class="bigC" alt="" />
  12. <div class="bidCText">
  13. <span class="percentage">{{ percent() }}%</span>
  14. <span>已使用空间</span>
  15. </div>
  16. </div>
  17. <div class="ORC_box" @click="toidentifyFont">
  18. <span class="text">OCR工具</span>
  19. </div>
  20. <div class="sacn_box" @click="scannerFile">
  21. <span class="text">扫描工具</span>
  22. </div>
  23. <div class="p2w_box" @click="pdf2word">
  24. <span class="text">PDF转Word</span>
  25. </div>
  26. </div>
  27. </div>
  28. <div class="list_box">
  29. <div class="top">
  30. <div class="left">快捷访问</div>
  31. <div class="right">最近文件</div>
  32. </div>
  33. <div class="btm">
  34. <div class="left_box">
  35. <div class="big_box">
  36. <div
  37. class="one_box"
  38. @click="openFolder(item)"
  39. v-for="item in colllectArr"
  40. :key="item"
  41. >
  42. <div class="left">
  43. <img
  44. v-if="item.docDir.dirType === '1'"
  45. src="@/assets/images/fileBox.png"
  46. alt=""
  47. />
  48. <img v-else src="@/assets/images/ordinary.png" alt="" />
  49. </div>
  50. <div class="right">
  51. <span class="title">{{ item.docDir.dirName }}</span>
  52. <span class="path">{{ item.docDir.dirPath }}</span>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. <div class="right_box">
  58. <div class="big_box">
  59. <el-table
  60. :data="tableFileData"
  61. style="width: 100%"
  62. height="29vh"
  63. :scrollbar-always-on="false"
  64. @row-click="toFile"
  65. >
  66. <el-table-column fixed prop="date" label="名称" width="500">
  67. <template #default="scope">
  68. <div class="title_row">
  69. <img
  70. class="table_icon"
  71. :src="setImg(scope.row == null ? '' : scope.row.fileType)"
  72. alt=""
  73. style=""
  74. />
  75. <span class="shouzhi">
  76. {{ scope.row == null ? "" : scope.row.fileName }}</span
  77. >
  78. </div>
  79. </template>
  80. </el-table-column>
  81. <el-table-column prop="createTime" label="时间" width="180" />
  82. <el-table-column prop="fileType" label="类型" width="230" />
  83. </el-table>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. <!-- 扫描文档 -->
  90. <ScanFile
  91. v-if="openScan"
  92. :openScan="openScan"
  93. :scannerFiles="scannerFiles"
  94. @saveScanFile="saveScanFile"
  95. @closeOpen="closeOpen"
  96. ></ScanFile>
  97. <!-- 可用扫描仪信息 -->
  98. <div>
  99. <el-dialog v-model="checkScanner" title="扫描仪" width="30%">
  100. <div
  101. v-for="item in scannerList"
  102. :key="item.scannerId"
  103. @click="checkScanFn(item)"
  104. id="Onescan"
  105. :class="{ checkScan: item.scannerId == checkScanId }"
  106. >
  107. <img src="@/assets/images/scanImg.png" alt="" />
  108. {{ item.scannerName }}
  109. </div>
  110. <template #footer>
  111. <span class="dialog-footer">
  112. <el-button @click="closeCheckScanner">取消</el-button>
  113. <el-button type="primary" @click="sureScaner">确认</el-button>
  114. </span>
  115. </template>
  116. </el-dialog>
  117. </div>
  118. <!-- 扫描文件移动到 -->
  119. <MoveTo
  120. v-if="openScanMove"
  121. :spaceType="3"
  122. :scanFileArr="scanFileArr"
  123. :thisFolder="thisFolder"
  124. :openScanMove="openScanMove"
  125. :spaceId="spaceId"
  126. @closeOpenScanMove="closeOpenScanMove"
  127. ></MoveTo>
  128. <ImgPreview
  129. :previewData="previewData"
  130. :copyFileType="copyFileType"
  131. :showPreview="showPreview"
  132. @closeImgPreview="closeImgPreview"
  133. ></ImgPreview>
  134. <div
  135. v-loading.fullscreen="loadingPreview"
  136. v-if="loadingPreview"
  137. class="lodingBox"
  138. ></div>
  139. </template>
  140. <script setup>
  141. import { onMounted, ref, toRaw, inject } from "vue";
  142. import { listRecent, getRecent } from "@/api/biz/recent";
  143. import { getInfo, getInfoByDirId } from "@/api/biz/info";
  144. import { canPreviewFile, rightMenuRole, setIcon } from "@/utils/index.js";
  145. import { getDir } from "@/api/biz/dir";
  146. import myfile from "@/api/myfile/myfile";
  147. import ScanFile from "@/components/ScanFile/ScanFile.vue";
  148. import MoveTo from "@/components/MoveTo/MoveTo.vue";
  149. import { listInfo, selectInfo, getFileByScanerId } from "@/api/scanner/info.js";
  150. import { listFavoriteById } from "@/api/biz/favorite.js";
  151. import { preview } from "@/api/common/common.js";
  152. import ImgPreview from '@/components/ImgPreview/ImgPreview.vue'
  153. const tableFileData = ref([]);
  154. const tableFolderData = ref([]);
  155. const useSpace = ref();
  156. const allSpace = ref();
  157. const spaceId = ref();
  158. const addFolderAdd = inject("addFolderAdd");
  159. const scannerList = ref(); // 扫描仪数据
  160. const checkScanId = ref(); // 选中的scan的id
  161. const checkScanner = ref(false); //显示扫描仪选择框
  162. const scannerFiles = ref([]); //选择的扫描仪的文件
  163. const openScanMove = ref(false);
  164. const openScan = ref(false); //控制扫描文档显示
  165. const scanFileArr = ref([]); //认领的扫描文件数组
  166. const colllectArr = ref([]); // 收藏文件夹
  167. const addFileTab = inject("addFileTab");
  168. const previewData = ref();
  169. const showPreview = ref(false);
  170. const loadingPreview = ref(false);
  171. const copyFileType = ref();
  172. const folersArr = ref([]); //路劲上的文件夹
  173. const openFolderTop = ref(); // 所在的空间
  174. const firstFolderData = ref(); // 第一层目录
  175. const getList = async () => {
  176. const resY = await listRecent({ isFolder: "Y" });
  177. const resN = await listRecent({ isFolder: "N" });
  178. // console.log("resY", resY);
  179. // console.log("resN", resN);
  180. if (resY.code === 200) {
  181. var arr = [];
  182. resY.rows.map(async (item) => {
  183. const detail = await getDir(item.relaId);
  184. if (detail.data != null)
  185. tableFolderData.value.push(JSON.parse(JSON.stringify(detail.data)));
  186. });
  187. }
  188. if (resN.code === 200) {
  189. var arr = [];
  190. resN.rows.map(async (item) => {
  191. const detail = await getInfo(item.relaId);
  192. tableFileData.value.push(detail.data);
  193. });
  194. }
  195. };
  196. const setImg = (type) => {
  197. return setIcon(type);
  198. };
  199. // 计算百分比
  200. function percent() {
  201. let numP = 0;
  202. if (useSpace.value && allSpace.value) {
  203. numP = (useSpace.value / allSpace.value) * 100;
  204. }
  205. // console.log("numP", numP);
  206. return numP.toFixed(2) - 0; // 将结果保留两位小数
  207. }
  208. function getSpaceList() {
  209. myfile.fileType(3).then((res) => {
  210. // console.log('Spaceres',res);
  211. useSpace.value = res.data.usedCap;
  212. allSpace.value = res.data.spaceCap;
  213. spaceId.value = res.data.spaceId;
  214. });
  215. }
  216. //去文字识别
  217. const toidentifyFont = () => {
  218. const itemData = {
  219. name: "文字识别",
  220. path: "identifyFont",
  221. clickRowId: "N",
  222. };
  223. addFolderAdd(itemData);
  224. };
  225. //去pdf2word
  226. const pdf2word = () => {
  227. const itemData = {
  228. name: "Pdf转Word",
  229. path: "pdf2word",
  230. clickRowId: "N",
  231. };
  232. addFolderAdd(itemData);
  233. };
  234. //获取扫描仪列表
  235. const scannerFile = async () => {
  236. const res = await selectInfo();
  237. scannerList.value = res.rows;
  238. checkScanner.value = true;
  239. checkScanId.value = null;
  240. // console.log('scanner',res);
  241. };
  242. // 选择扫描仪
  243. const checkScanFn = (item) => {
  244. checkScanId.value = item.scannerId;
  245. };
  246. // 确认选择扫描仪 获取扫描仪下文件列表
  247. const sureScaner = async () => {
  248. if (!checkScanId.value) return;
  249. const res = await getFileByScanerId(checkScanId.value);
  250. // console.log("sureScanerres", res);
  251. scannerFiles.value = res.data;
  252. checkScanner.value = false;
  253. openScan.value = true;
  254. };
  255. // 关闭窗口
  256. const closeCheckScanner = () => {
  257. checkScanner.value = false;
  258. };
  259. const closeOpen = () => {
  260. openScan.value = false;
  261. };
  262. // 移动到事件
  263. const saveScanFile = (arr) => {
  264. // console.log("arr", arr);
  265. openScan.value = false;
  266. scanFileArr.value = arr;
  267. openScanMove.value = true;
  268. };
  269. // 关闭窗口
  270. const closeOpenScanMove = () => {
  271. openScanMove.value = false;
  272. // refreshFile();
  273. };
  274. // 获取收藏数据
  275. const getCollectFolder = async () => {
  276. const query = {
  277. isAsc: "desc",
  278. orderByColumn: "createTime",
  279. };
  280. const res = await listFavoriteById(-1, query);
  281. // console.log("res", res);
  282. // console.log("----res", res);
  283. colllectArr.value = res.rows.filter((item) => item.isFolder === "Y");
  284. // console.log('colllectArr.value',colllectArr.value);
  285. };
  286. // 打开文件
  287. const toFile = async (row) => {
  288. copyFileType.value = row.fileType;
  289. loadingPreview.value = true;
  290. const filePreview = canPreviewFile(row.fileType);
  291. if (filePreview) {
  292. loadingPreview.value = false;
  293. addFileTab(row, 0, 0);
  294. } else {
  295. const res = await preview(row.docId);
  296. showPreview.value = true;
  297. previewData.value = URL.createObjectURL(res);
  298. loadingPreview.value = false;
  299. }
  300. };
  301. // 打开文件夹
  302. const openFolder =async (row)=>{
  303. folersArr.value = []
  304. openFolderTop.value = null
  305. firstFolderData.value = null
  306. // console.log("thisFolder.value", thisFolder.value);
  307. const thisFolderD = toRaw(row); //打开的收藏文件
  308. async function getFoldersData(info) {
  309. if (info.parentId) {
  310. folersArr.value.push(JSON.parse(JSON.stringify(info)));
  311. const res = await getDir(info.parentId);
  312. // console.log('res====',res);
  313. await getFoldersData(res.data);
  314. } else {
  315. openFolderTop.value = info;
  316. return;
  317. }
  318. }
  319. await getFoldersData(thisFolderD.docDir);
  320. // folersArr = JSON.parse(JSON.stringify(folersArr))
  321. folersArr.value.reverse();
  322. firstFolderData.value = folersArr.value[0];
  323. // console.log("folersArr", folersArr.value);
  324. // console.log("openFolderTop", openFolderTop.value);
  325. sessionStorage.setItem('folderArr',JSON.stringify(folersArr.value))
  326. // 判断空间
  327. if (openFolderTop.value.dirName.includes("个人空间")) {
  328. // 创建标签
  329. const addData = {
  330. path: "/myfile" + firstFolderData.value.dirId,
  331. name: firstFolderData.value.dirName,
  332. clickRowId:firstFolderData.value,
  333. };
  334. addFolderAdd(addData);
  335. } else if (openFolderTop.value.dirName.includes("部门空间")) {
  336. // 创建标签
  337. const addData = {
  338. path: "/department" + firstFolderData.value.dirId,
  339. name: firstFolderData.value.dirName,
  340. clickRowId:firstFolderData.value,
  341. };
  342. addFolderAdd(addData);
  343. } else {
  344. // 创建标签
  345. const addData = {
  346. path: "/publicment" + firstFolderData.value.dirId,
  347. name: firstFolderData.value.dirName,
  348. clickRowId:firstFolderData.value,
  349. };
  350. addFolderAdd(addData);
  351. }
  352. }
  353. //关闭图片预览事件
  354. const closeImgPreview = () => {
  355. // console.log('close');
  356. showPreview.value = false;
  357. };
  358. onMounted(() => {
  359. getList();
  360. getCollectFolder();
  361. getSpaceList();
  362. });
  363. </script>
  364. <style lang="scss" scoped>
  365. .homePage {
  366. width: 100%;
  367. height: 88vh;
  368. // background-color: #fff;
  369. }
  370. .bg_box {
  371. width: 100%;
  372. height: 600px;
  373. position: relative;
  374. // background-image: url("@/assets/images/home/backImg.png");
  375. // background-repeat: no-repeat;
  376. // background-size: contain;
  377. .fillWidth {
  378. width: 100%;
  379. height: 100%;
  380. object-fit: fill;
  381. }
  382. .bigC_box {
  383. width: 382px;
  384. height: 382px;
  385. position: absolute;
  386. top: calc(40% - 191px);
  387. left: calc(50% - 191px);
  388. .bidCText {
  389. position: absolute;
  390. width: 108px;
  391. height: 58px;
  392. left: calc(50% - 54px);
  393. top: calc(50% - 29px);
  394. display: flex;
  395. flex-direction: column;
  396. color: #fff;
  397. align-items: center;
  398. z-index: 15;
  399. .percentage {
  400. font-weight: 800;
  401. font-size: 40px;
  402. line-height: 52px;
  403. }
  404. }
  405. .ORC_box {
  406. width: 118px;
  407. height: 118px;
  408. position: absolute;
  409. top: 15%;
  410. left: -10%;
  411. background-image: url("@/assets/images/home/ORC.jpg");
  412. background-repeat: no-repeat;
  413. background-size: contain;
  414. z-index: 15;
  415. .text {
  416. width: 100px;
  417. text-align: center;
  418. position: absolute;
  419. bottom: -15%;
  420. left: calc(50% - 50px);
  421. font-size: 16px;
  422. color: #fff;
  423. }
  424. &:hover {
  425. background-image: url("@/assets/images/home/ORC_hover.jpg");
  426. }
  427. }
  428. .sacn_box {
  429. width: 118px;
  430. height: 118px;
  431. position: absolute;
  432. top: 15%;
  433. right: -10%;
  434. background-image: url("@/assets/images/home/scan.jpg");
  435. background-repeat: no-repeat;
  436. background-size: contain;
  437. z-index: 15;
  438. .text {
  439. width: 100px;
  440. text-align: center;
  441. position: absolute;
  442. bottom: -15%;
  443. left: calc(50% - 50px);
  444. font-size: 16px;
  445. color: #fff;
  446. }
  447. &:hover {
  448. background-image: url("@/assets/images/home/scan_hover.jpg");
  449. }
  450. }
  451. .p2w_box {
  452. width: 118px;
  453. height: 118px;
  454. position: absolute;
  455. bottom: -59px;
  456. left: calc(50% - 59px);
  457. background-image: url("@/assets/images/home/p2w.jpg");
  458. background-repeat: no-repeat;
  459. background-size: contain;
  460. z-index: 15;
  461. .text {
  462. width: 100px;
  463. text-align: center;
  464. position: absolute;
  465. bottom: -15%;
  466. left: calc(50% - 50px);
  467. font-size: 16px;
  468. color: #fff;
  469. }
  470. &:hover {
  471. background-image: url("@/assets/images/home/p2w_hover.jpg");
  472. }
  473. }
  474. }
  475. .bigC {
  476. width: 382px;
  477. height: 382px;
  478. z-index: 10;
  479. position: absolute;
  480. top: calc(50% - 191px);
  481. left: calc(50% - 191px);
  482. }
  483. }
  484. .list_box {
  485. margin-top: -70px;
  486. box-sizing: border-box;
  487. position: relative;
  488. z-index: 105;
  489. width: 100%;
  490. height: calc(88vh - 600px + 70px);
  491. // background-image: url("@/assets/images/home/Rectangle.webp");
  492. // background-repeat: no-repeat;
  493. // background-size: cover;
  494. // display: flex;
  495. .top {
  496. width: 100%;
  497. height: 40px;
  498. color: #f4f5ff;
  499. display: flex;
  500. background-image: url("@/assets/images/home/up.png");
  501. background-repeat: no-repeat;
  502. background-size: cover;
  503. text-align: center;
  504. line-height: 40px;
  505. .left {
  506. width: 50%;
  507. height: 100%;
  508. }
  509. .right {
  510. width: 50%;
  511. height: 100%;
  512. }
  513. }
  514. .btm {
  515. background-image: url("@/assets/images/home/btm.png");
  516. background-repeat: no-repeat;
  517. background-size: cover;
  518. display: flex;
  519. .left_box {
  520. width: 50%;
  521. // height: 100%;
  522. // overflow-y: auto;
  523. // border-right: 1px solid #000;
  524. .big_box {
  525. width: 100%;
  526. height: 29vh;
  527. padding-left: 24px;
  528. display: flex;
  529. flex-wrap: wrap;
  530. overflow-y: auto;
  531. .one_box {
  532. width: 214px;
  533. height: 77px;
  534. display: flex;
  535. align-items: center;
  536. cursor: pointer;
  537. .left {
  538. width: 64px;
  539. height: 64px;
  540. img {
  541. width: 100%;
  542. height: 100%;
  543. }
  544. }
  545. .right {
  546. width: 124px;
  547. height: 46px;
  548. display: flex;
  549. flex-direction: column;
  550. align-items: flex-start;
  551. // text-align: left;
  552. .title {
  553. width: 120px;
  554. color: #f4f5ff;
  555. /*第一步: 溢出隐藏 */
  556. overflow: hidden;
  557. /* 第二步:让文本不会换行, 在同一行继续 */
  558. white-space: nowrap;
  559. /* 第三步:用省略号来代表未显示完的文本 */
  560. text-overflow: ellipsis;
  561. }
  562. .path {
  563. font-size: 14px;
  564. color: #7a89ba;
  565. width: 120px;
  566. /*第一步: 溢出隐藏 */
  567. overflow: hidden;
  568. /* 第二步:让文本不会换行, 在同一行继续 */
  569. white-space: nowrap;
  570. /* 第三步:用省略号来代表未显示完的文本 */
  571. text-overflow: ellipsis;
  572. }
  573. }
  574. }
  575. .add_box {
  576. width: 214px;
  577. height: 77px;
  578. background-image: url("@/assets/images/home/addBox.png");
  579. background-repeat: no-repeat;
  580. background-size: cover;
  581. }
  582. }
  583. &::-webkit-scrollbar-track {
  584. background-color: rgba(0, 0, 0, 0) !important;
  585. }
  586. }
  587. .right_box {
  588. width: 50%;
  589. // height: 100%;
  590. .title_row {
  591. display: flex;
  592. align-items: center;
  593. // vertical-align: middle;
  594. }
  595. .table_icon {
  596. width: 32px;
  597. height: 32px;
  598. }
  599. .shouzhi {
  600. cursor: pointer;
  601. }
  602. }
  603. }
  604. }
  605. .checkScan {
  606. background-color: #f5f7f9;
  607. }
  608. #Onescan {
  609. height: 48px;
  610. line-height: 48px;
  611. font-size: 14px;
  612. display: flex;
  613. align-items: center;
  614. }
  615. :deep(.el-table) {
  616. background-color: rgba(0, 0, 0, 0) !important;
  617. }
  618. :deep(.el-table__header) {
  619. background-color: rgba(0, 0, 0, 0) !important;
  620. }
  621. :deep(.el-table tr) {
  622. background-color: rgba(0, 0, 0, 0) !important;
  623. // color: #F4F5FF !important;
  624. }
  625. :deep(.el-table__header-wrapper) {
  626. background-color: rgba(0, 0, 0, 0) !important;
  627. }
  628. :deep(.el-table td.el-table__cell) {
  629. border: none;
  630. font-size: 14px !important;
  631. font-weight: 400 !important;
  632. background-color: rgba(0, 0, 0, 0) !important;
  633. color: #f4f5ff !important;
  634. }
  635. :deep(.el-table__row) {
  636. height: 32px !important;
  637. vertical-align: middle;
  638. // border-bottom: 1px solid #c1cce3;
  639. }
  640. :deep(.el-table .el-table__header-wrapper tr) {
  641. background-color: rgba(50, 79, 153, 0) !important;
  642. }
  643. :deep(.el-table .el-table__header-wrapper th) {
  644. // border-right: 1px solid #c1cce3;
  645. border-bottom: 1px solid #324f99;
  646. background-color: rgba(50, 79, 153, 0.3) !important;
  647. color: #7a89ba;
  648. font-size: 14px;
  649. }
  650. ::-webkit-scrollbar-track {
  651. background-color: rgba(0, 0, 0, 0) !important;
  652. }
  653. </style>