HomePage.vue 15 KB

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