fileBox.vue 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357
  1. <template>
  2. <div class="f_box" @dragover.prevent @drop="handleDrop">
  3. <!-- <div class="f_box_top">
  4. <div class="f_box_top_left">
  5. <div class="f_box_top_title">所有文件</div>
  6. </div>
  7. </div> -->
  8. <div class="f_box_top">
  9. <div class="f_box_top_left">
  10. <!-- <el-select v-model="checkFolderid" filterable multiple @change="serchFile">
  11. <el-option
  12. v-for="item in myFolderArray"
  13. :key="item.folderid"
  14. :label="item.name"
  15. :value="item.folderid"
  16. >
  17. </el-option>
  18. </el-select> -->
  19. <selectTag
  20. v-if="$parent.barNam == 1"
  21. v-model="checkFolderid"
  22. :options="myFolderArray2"
  23. :placeholder=lang.selectFolder
  24. style="width: 250px;"
  25. @change="serchFile()"
  26. />
  27. <el-select
  28. v-if="pid.split('/')[0] == '1'"
  29. style="width: 120px;margin-left: 10px"
  30. v-loading="!userArray.length"
  31. v-model="user"
  32. :placeholder=lang.owner
  33. clearable
  34. filterable
  35. @change="serchFile2()"
  36. >
  37. <el-option
  38. v-for="(item, index) in userArray"
  39. :key="index"
  40. :label="item.username"
  41. :value="item.userid"
  42. ></el-option>
  43. </el-select>
  44. </div>
  45. <div class="f_box_top_right">
  46. <div class="input">
  47. <div class="serch"></div>
  48. <input
  49. type="text"
  50. v-model="fileName"
  51. :placeholder=lang.selectFileName
  52. @input="debouncedSearch"
  53. />
  54. </div>
  55. <div class="f_box_top_right">
  56. <el-button type="primary" size="small" @click="serchFile"
  57. style="background-color: rgb(51, 112, 255);"
  58. >
  59. <img style="vertical-align: middle;transform: scale(1.1);padding-bottom: 2px;box-sizing: border-box;" src="../../../assets/shuax.svg" alt="">
  60. {{lang.flushed}}</el-button
  61. >
  62. <el-button v-if="pid.split('/')[0] == '0'" type="primary" size="small" @click="addImg($event)"
  63. icon="el-icon-plus"
  64. style="background-color: rgb(51, 112, 255);"
  65. >{{lang.uploadFile}}
  66. <input
  67. type="file"
  68. accept="*"
  69. style="display: none"
  70. multiple="multiple"
  71. @change="beforeUpload($event)"
  72. /></el-button>
  73. <el-button style="background: #F56C6C;" type="danger" size="small" v-if="checkArray.length" @click="batchDelete"
  74. >{{lang.delete}}</el-button
  75. >
  76. <span v-if="checkArray.length" style="margin-left: 12px;color: #b0b0b0;font-size: 14px;flex-shrink:0;line-height: 35px;">{{ lang.x_items_selected.replace("${x}",checkArray.length) }}</span>
  77. </div>
  78. </div>
  79. </div>
  80. <div class="none_box" v-if="fileArray.length == 0">{{lang.nouploadFiles}}</div>
  81. <div
  82. class="f_box_file_list"
  83. v-else-if="stype == '2' && fileArray.length"
  84. v-loading.body="isLoading"
  85. >
  86. <div class="list_file_box">
  87. <el-table
  88. :data="fileArray"
  89. border
  90. style="width: 100%; cursor: pointer;"
  91. @selection-change="handleSelectionChange"
  92. :row-key="row => row.id"
  93. ref="myTable"
  94. max-height="800px"
  95. @row-click="checkFile"
  96. >
  97. <el-table-column
  98. type="selection"
  99. width="50px"
  100. :reserve-selection="true"
  101. :selectable="isSelectable"
  102. ></el-table-column>
  103. <el-table-column
  104. prop="name"
  105. :label=lang.fileName
  106. show-overflow-tooltip
  107. min-width="15"
  108. ></el-table-column>
  109. <el-table-column
  110. prop="folderName"
  111. :label=lang.folderBelongs
  112. show-overflow-tooltip
  113. min-width="20"
  114. ></el-table-column>
  115. <el-table-column
  116. prop="username"
  117. :label=lang.owner
  118. show-overflow-tooltip
  119. width="120"
  120. ></el-table-column>
  121. <el-table-column :label=lang.sliceClassification width="120px">
  122. <template slot-scope="scope">
  123. {{ getState(scope.row.ingestionStatus) }}
  124. </template>
  125. </el-table-column>
  126. <el-table-column :label=lang.graphExtraction width="120px">
  127. <template slot-scope="scope">
  128. {{ getState2(scope.row.extractionStatus) }}
  129. </template>
  130. </el-table-column>
  131. <el-table-column
  132. prop="documentType"
  133. :label=lang.fileType
  134. show-overflow-tooltip
  135. width="120"
  136. ></el-table-column>
  137. <!-- <el-table-column label="公开状态" show-overflow-tooltip width="80px"></el-table-column> -->
  138. <el-table-column
  139. prop="time"
  140. :label=lang.uploadTime
  141. show-overflow-tooltip
  142. min-width="20"
  143. ></el-table-column>
  144. <el-table-column align="center" width="100px">
  145. <template slot-scope="scope">
  146. <el-popover
  147. placement="bottom-end"
  148. trigger="hover"
  149. visible-arrow
  150. popper-class="custom-popover"
  151. width="100px"
  152. >
  153. <div class="BtnHP">
  154. <div class="BtnHPDel1">
  155. <!-- <el-button
  156. type="text"
  157. size="small"
  158. @click="extractFile(scope.row)"
  159. :disabled="scope.row.ingestionStatus == 'failed'"
  160. >提取</el-button
  161. > -->
  162. <div class="btnBh"
  163. @click="extractFile(scope.row)"
  164. @mouseover="isHover = true"
  165. :disabled="scope.row.ingestionStatus == 'failed'"
  166. @mouseleave="isHover = false"
  167. v-if="scope.row.userid == userid">
  168. <img
  169. style="width: 14px;"
  170. :src="isHover ? tqList2 : tqList"
  171. alt="">
  172. <span :class="isHover ? 'lookHp2' : 'lookHp1'">{{lang.extract}}</span>
  173. </div>
  174. <!-- <el-button
  175. type="text"
  176. size="small"
  177. @click="checkFile(scope.row)"
  178. :disabled="scope.row.ingestionStatus == 'failed'"
  179. >查看</el-button
  180. > -->
  181. <div class="btnBh"
  182. @click="checkFile(scope.row)"
  183. @mouseover="isHover2 = true"
  184. :disabled="scope.row.ingestionStatus == 'failed'"
  185. @mouseleave="isHover2 = false">
  186. <img
  187. :src="isHover2 ? look2 : look1"
  188. alt="">
  189. <span :class="isHover2 ? 'lookHp2' : 'lookHp1'">{{lang.view}}</span>
  190. </div>
  191. <div class="btnBh"
  192. @click="downloadFile(scope.row)"
  193. @mouseover="isHover3 = true"
  194. :disabled="scope.row.ingestionStatus == 'failed'"
  195. @mouseleave="isHover3 = false">
  196. <img
  197. :src="isHover3 ? download2 : download"
  198. alt="">
  199. <span :class="isHover3 ? 'lookHp2' : 'lookHp1'">{{lang.download}}</span>
  200. </div>
  201. </div>
  202. <div style="background-color: #e7e7e7;width: 100%;height: .5px;margin: 5px 0;"></div>
  203. <div class="BtnHPDel">
  204. <!-- <el-button
  205. type="text"
  206. size="small"
  207. v-if="scope.row.userid == userid"
  208. @click="deleteFile(scope.row.id, scope.row.documentid)"
  209. >删除</el-button
  210. > -->
  211. <div class="btnBh2"
  212. @click="deleteFile(scope.row.id, scope.row.documentid)"
  213. v-if="scope.row.userid == userid">
  214. <img src="../../../assets/listdel.svg" alt="">
  215. <span style="color: #DE4C41;">{{lang.delete}}</span>
  216. </div>
  217. </div>
  218. </div>
  219. <el-button slot="reference" class="BtnH" style="border: none;padding: 5px;" @click.stop="">
  220. <i class="el-icon-more"></i>
  221. </el-button>
  222. </el-popover>
  223. </template>
  224. </el-table-column>
  225. </el-table>
  226. </div>
  227. <el-pagination
  228. class="pageBox"
  229. style="margin-top: 10px"
  230. layout="total,prev, pager, next, slot"
  231. :page-size="limit"
  232. :total="total"
  233. @current-change="handleCurrentChange"
  234. :page-sizes="[10, 20, 50, 100]"
  235. >
  236. <el-select v-model="limit" @change="handleSizeChange" class="file_mySelect">
  237. <el-option
  238. v-for="item in [10, 20, 50, 100]"
  239. :key="item"
  240. :label="item"
  241. :value="item"
  242. ></el-option>
  243. </el-select>
  244. </el-pagination>
  245. <div v-if="proVisible" class="mask">
  246. <div class="progressBox">
  247. <div class="lbox">
  248. {{lang.uploadWait}}<img src="../../../assets/KekeLoading.gif" />
  249. </div>
  250. <div class="lbox_count">{{ pcount }} / {{ ptotal }}</div>
  251. </div>
  252. </div>
  253. </div>
  254. <wpdf :dialogVisiblePdf.sync="dialogVisiblePdf" :url="wurl"></wpdf>
  255. <wVideo :dialogVisibleVideo.sync="dialogVisibleVideo" :url="wurl"></wVideo>
  256. <wOffice
  257. :dialogVisibleOffice.sync="dialogVisibleOffice"
  258. :url="wurl"
  259. ></wOffice>
  260. <checkDialog ref="checkDialog"></checkDialog>
  261. </div>
  262. </template>
  263. <script>
  264. import officeImg from "../../../assets/icon/sourceFile/office.png";
  265. import pdfImg from "../../../assets/icon/sourceFile/pdf.png";
  266. import videoImg from "../../../assets/icon/sourceFile/video.png";
  267. import otherImg from "../../../assets/icon/sourceFile/other.png";
  268. import checkImg from "../../../assets/icon/sourceFile/check.png";
  269. import checkIsImg from "../../../assets/icon/sourceFile/check_is.png";
  270. import selectTag from "./components/selectTag3.vue";
  271. // 导入SVG组件
  272. import look1 from '../../../assets/look1.svg';
  273. import look2 from '../../../assets/look2.svg';
  274. import tqList2 from '../../../assets/tqList2.svg';
  275. import tqList from '../../../assets/tqList.svg';
  276. import download from '../../../assets/download.svg';
  277. import download2 from '../../../assets/download2.svg';
  278. import wVideo from "../test/file/wVideo.vue";
  279. import wpdf from "../test/file/wPdf2.vue";
  280. import wOffice from "../test/file/wOffice.vue";
  281. import { v4 as uuidv4 } from "uuid";
  282. import checkDialog from "./components/checkDialog";
  283. export default {
  284. components: {
  285. wVideo,
  286. wpdf,
  287. wOffice,
  288. checkDialog,
  289. selectTag
  290. },
  291. props: {
  292. userid: {
  293. type: String
  294. },
  295. typeArray: {
  296. type: Array
  297. },
  298. pid: {
  299. type: String
  300. },
  301. type: {
  302. type: String
  303. },
  304. moFolderid: {
  305. type: String
  306. },
  307. myFolderArray: {
  308. type: Array
  309. }
  310. },
  311. watch: {
  312. pid: {
  313. immediate: true,
  314. deep: true,
  315. handler(newValue, oldValue) {
  316. this.fileArray = [];
  317. this.checkArray = [];
  318. this.fileName = "";
  319. this.checkFolderid = [];
  320. console.log(this.myFolderArray);
  321. this.page = 1
  322. this.getData();
  323. }
  324. },
  325. },
  326. data() {
  327. return {
  328. look1:look1,
  329. look2:look2,
  330. tqList2:tqList2,
  331. tqList:tqList,
  332. download: download,
  333. download2: download2,
  334. isHover:false,
  335. isHover2:false,
  336. isHover3:false,
  337. isLoading: false,
  338. proVisible: false,
  339. stype: 2,
  340. fileArray: [],
  341. officeImg: officeImg,
  342. pdfImg: pdfImg,
  343. videoImg: videoImg,
  344. otherImg: otherImg,
  345. checkImg: checkImg,
  346. checkIsImg: checkIsImg,
  347. checkArray: [],
  348. checkArray2: [],
  349. dialogVisiblePdf: false,
  350. dialogVisibleVideo: false,
  351. dialogVisibleOffice: false,
  352. wurl: "",
  353. moveBox: false,
  354. checkTypeArray: [],
  355. moveChild: "",
  356. fileName: "",
  357. limit: 10,
  358. total: 0,
  359. page: 1,
  360. checkFolderid: [],
  361. user: "",
  362. userArray: [],
  363. pcount: 0,
  364. ptotal: 0
  365. };
  366. },
  367. computed: {
  368. getState() {
  369. return function(item) {
  370. if (item == "success") {
  371. return this.lang.success;
  372. } else if (item == "failed") {
  373. return this.lang.fail;
  374. } else if (item == "augmenting") {
  375. return this.lang.sliced;
  376. } else if (item == "pending") {
  377. return this.lang.pending;
  378. } else if (item == "enriched") {
  379. return "enriched";
  380. } else if (!item) {
  381. return this.lang.sliced;
  382. } else {
  383. return item;
  384. }
  385. };
  386. },
  387. getState2() {
  388. return function(item) {
  389. if (item == "success") {
  390. return this.lang.success;
  391. } else if (item == "failed") {
  392. return this.lang.fail;
  393. } else if (item == "pending") {
  394. return this.lang.pending;
  395. } else if (item == "processing") {
  396. return this.lang.processing;
  397. } else if (item == "enriched") {
  398. return "enriched";
  399. } else if (!item) {
  400. return this.lang.uploading;
  401. } else {
  402. return item;
  403. }
  404. };
  405. },
  406. myFolderArray2() {
  407. if (this.user) {
  408. return this.myFolderArray.filter(e => e.userid == this.user);
  409. } else {
  410. return this.myFolderArray;
  411. }
  412. },
  413. },
  414. methods: {
  415. handleCurrentChange(val) {
  416. this.page = val;
  417. this.getData();
  418. },
  419. handleSizeChange(val){
  420. this.limit = val
  421. this.getData()
  422. },
  423. getData() {
  424. let type = this.pid.split("/");
  425. this.isLoading = true;
  426. let params = {
  427. uid: this.userid,
  428. folderid: this.checkFolderid.join(","),
  429. n: this.fileName.trim(),
  430. page: this.page,
  431. num: this.limit
  432. };
  433. if(type[0] == '1'){
  434. params.userid = this.user
  435. }
  436. this.ajax
  437. .post(this.$store.state.fileApi + (type[0] == '0' ? "getFile" : "getFileOpen"), [params])
  438. .then(res => {
  439. this.isLoading = false;
  440. console.log(res.data);
  441. this.total = res.data.result.length ? res.data.result[0].num : 0;
  442. this.fileArray = res.data.result;
  443. this.userArray = res.data.user
  444. // this.$parent.$refs.folder.getData();
  445. })
  446. .catch(err => {
  447. this.isLoading = false;
  448. console.error(err);
  449. });
  450. },
  451. handleSelectionChange(selectedRows) {
  452. this.checkArray = selectedRows.map(row => row.id);
  453. this.checkArray2 = selectedRows.map(row => ({
  454. id: row.id,
  455. documentid: row.documentid
  456. }));
  457. },
  458. addImg(e) {
  459. var el = e.currentTarget;
  460. el.getElementsByTagName("input")[0].click();
  461. e.target.value = "";
  462. },
  463. handleDrop(event) {
  464. event.preventDefault(); // 阻止默认的浏览器下载行为
  465. const files = event.dataTransfer.files;
  466. if (files.length) {
  467. this.beforeUpload({ target: { files } });
  468. }
  469. },
  470. debouncedSearch() {
  471. clearTimeout(this.debounceTimeout);
  472. this.debounceTimeout = setTimeout(() => {
  473. this.serchFile();
  474. }, 300);
  475. },
  476. serchFile() {
  477. this.page = 1;
  478. this.getData();
  479. },
  480. serchFile2() {
  481. this.checkFolderid = ""
  482. this.page = 1;
  483. this.getData();
  484. },
  485. async beforeUpload(event) {
  486. let file = "";
  487. let cfindex2 = 0;
  488. this.proVisible = true;
  489. const allowedExtensions = [
  490. "csv",
  491. "xls",
  492. "xlsx",
  493. "md",
  494. "pdf",
  495. "txt",
  496. "ppt",
  497. "pptx",
  498. "docx",
  499. "jpg",
  500. "jpeg",
  501. "png",
  502. "gif",
  503. "bmp"
  504. ];
  505. const uploadFiles = async files => {
  506. this.pcount = 0
  507. this.ptotal = files.length
  508. for (let cfindex = 0; cfindex < files.length; cfindex++) {
  509. file = files[cfindex];
  510. const fileExtension = file.name
  511. .split(".")
  512. .pop()
  513. .toLowerCase();
  514. if (!allowedExtensions.includes(fileExtension)) {
  515. this.$message.error(`${this.lang.unsupFileformats}: ${file.name}`);
  516. await new Promise(resolve => setTimeout(resolve, 1000)); // 延迟1秒再跳过
  517. continue; // 跳过不支持的文件
  518. }
  519. let uuid = uuidv4();
  520. let formData = new FormData();
  521. const timestamp = Date.now();
  522. const baseName = file.name.slice(0, -(fileExtension.length + 1));
  523. formData.append(
  524. "file",
  525. new File([file], `${baseName}${timestamp}.${fileExtension}`)
  526. );
  527. formData.append("collection_ids", JSON.stringify([this.moFolderid]));
  528. formData.append("id", uuid);
  529. formData.append("metadata", JSON.stringify({ title: file.name }));
  530. formData.append("ingestion_mode", "fast");
  531. formData.append("run_with_orchestration", "false");
  532. // 使用同步方式上传文件
  533. await this.uploadFile(formData, file.name, uuid);
  534. this.pcount = cfindex + 1
  535. // 每5秒上传一次
  536. if (cfindex < files.length - 1) {
  537. await new Promise(resolve => setTimeout(resolve, 5000));
  538. }
  539. }
  540. setTimeout(() => {
  541. this.proVisible = false;
  542. this.$message.success(this,lang.operComplete);
  543. this.getData(); // 在上传完所有文件后再调用getData
  544. }, 1000);
  545. };
  546. await uploadFiles(event.target.files);
  547. },
  548. async uploadFile(formData, name, uuid, bool) {
  549. try {
  550. // 确保formData是正确的格式
  551. // this.$store.state.fileApi + "upload"
  552. this.ajax.post("https://r2rserver.cocorobo.cn/v3/documents", formData, {
  553. headers: {
  554. "Content-Type": "multipart/form-data"
  555. }
  556. }).then(res => {
  557. console.log(res, formData);
  558. const message = res.data.results && res.data.results.message;
  559. const status = message === 'Document created and ingested successfully.' ? 'success' : 'failed';
  560. const msg = message === 'Document created and ingested successfully.' ? this.lang.sliceSuccess : this.lang.sliceFail;
  561. this.$message({
  562. message: msg,
  563. type: status == 'success' ? status : 'error'
  564. })
  565. // setTimeout(() => {
  566. this.getData()
  567. // }, 1000)
  568. setTimeout(() => {
  569. this.fileArray.forEach(e => {
  570. if (e.documentid === uuid) {
  571. e.ingestionStatus = status;
  572. }
  573. });
  574. }, 1000);
  575. }).catch(err => {
  576. this.$message.error(this.lang.uploadFail)
  577. this.fileArray.forEach(e => {
  578. if (e.documentid === uuid) {
  579. e.ingestionStatus = 'failed';
  580. }
  581. });
  582. console.error(err);
  583. });
  584. let params = {
  585. n: name,
  586. did: uuid,
  587. uid: this.userid,
  588. fid: this.moFolderid,
  589. mofid: ""
  590. };
  591. const res2 = await this.ajax.post(this.$store.state.api + "addFile", [
  592. params
  593. ]);
  594. } catch (err) {
  595. console.error(err);
  596. this.$message.error(this.lang.uploadFail);
  597. }
  598. },
  599. formatFileSize(bytes) {
  600. if (bytes < 1024) {
  601. return bytes + "B";
  602. } else if (bytes < 1048576) {
  603. return (bytes / 1024).toFixed(2) + "KB";
  604. } else if (bytes < 1073741824) {
  605. return (bytes / 1048576).toFixed(2) + "MB";
  606. } else {
  607. return (bytes / 1073741824).toFixed(2) + "GB";
  608. }
  609. },
  610. deleteFile(fileid, documentid) {
  611. this.$confirm(this.lang.deleteFile, this.lang.prompt, {
  612. confirmButtonText: this.lang.confirm,
  613. cancelButtonText: this.lang.cancel,
  614. type: "warning"
  615. })
  616. .then(() => {
  617. let params = [
  618. {
  619. ids: fileid,
  620. documentids: documentid
  621. }
  622. ];
  623. this.ajax
  624. .post(this.$store.state.fileApi + "deleteFile", params)
  625. .then(res => {
  626. this.$message({
  627. message: this.lang.deleteSuccess,
  628. type: "success"
  629. });
  630. this.checkArray = [];
  631. this.checkArray2 = [];
  632. this.$refs.myTable.clearSelection();
  633. this.getData();
  634. })
  635. .catch(err => {
  636. this.$message.error(this.lang.deleteFail);
  637. console.error(err);
  638. });
  639. })
  640. .catch(() => {});
  641. },
  642. batchDelete() {
  643. if (!this.checkArray.length) {
  644. this.$message.warning(this.lang.selectDeFile);
  645. return;
  646. }
  647. let array = this.checkArray2.map(item => item.id);
  648. let array2 = this.checkArray2.map(item => item.documentid);
  649. this.deleteFile(array.join(","), array2.join(","));
  650. },
  651. checkFile(row) {
  652. if (row.ingestionStatus != "success") return this.$message.info(this.lang.fileUploadFail)
  653. this.$refs.checkDialog.openG(row.documentid);
  654. },
  655. downloadFile(row) {
  656. let params = {
  657. documentid: row.documentid,
  658. filename: row.name,
  659. };
  660. // 使用axios发送GET请求下载文件
  661. this.ajax.post(`${this.$store.state.fileApi}downloadFile2`, [params],{responseType: 'blob'}).then(response => {
  662. const url = window.URL.createObjectURL(new Blob([response.data]));
  663. const link = document.createElement('a');
  664. link.href = url;
  665. link.setAttribute('download', row.name); // 设置下载文件名
  666. document.body.appendChild(link);
  667. link.click();
  668. link.remove();
  669. this.$message({
  670. message: this.lang.downloadSuccess,
  671. type: "success"
  672. });
  673. }).catch(err => {
  674. this.$message.error(this.lang.downloadFail);
  675. console.error(err);
  676. });
  677. },
  678. extractFile(row) {
  679. if (row.ingestionStatus != "success") return this.$message.info(this.lang.fileUploadFail)
  680. let params = {
  681. documentid: row.documentid
  682. };
  683. // 获取切片
  684. try {
  685. const res = this.ajax.post(this.$store.state.fileApi + "extractFile2", [
  686. params
  687. ]).then(res => {
  688. console.log(res, row);
  689. const message = res.data.result && res.data.result.message;
  690. // const status = message === 'Document entities and relationships extracted successfully.' ? 'success' : 'failed';
  691. // const msg = message === 'Document entities and relationships extracted successfully.' ? '提取成功' : '提取失败';
  692. // this.$message({
  693. // message: msg,
  694. // type: status == 'success' ? status : 'error'
  695. // })
  696. // this.fileArray.forEach(e => {
  697. // if (e.documentid === row.documentid) {
  698. // e.extractionStatus = status;
  699. // }
  700. // });
  701. setTimeout(() => {
  702. this.getData();
  703. }, 1000)
  704. }).catch(err => {
  705. this.$message.error(this.lang.extrFailed)
  706. this.fileArray.forEach(e => {
  707. if (e.documentid === row.documentid) {
  708. e.extractionStatus = 'failed';
  709. }
  710. });
  711. console.error(err);
  712. });
  713. console.log(res.data);
  714. this.$message.success(this.lang.extractingFile);
  715. this.getData();
  716. } catch (err) {
  717. console.error(err);
  718. }
  719. },
  720. isSelectable(row) {
  721. return row.userid == this.userid;
  722. }
  723. },
  724. mounted() {
  725. this.getData();
  726. }
  727. };
  728. </script>
  729. <style scoped>
  730. .f_box {
  731. width: 100%;
  732. height: calc(100% - 58px);
  733. background-color: #fff;
  734. border-radius: 8px;
  735. position: relative;
  736. min-height: 400px;
  737. margin-top: 16px;
  738. box-shadow: 0px 4px 4px 0px rgba(19, 51, 107, 0.05), 0px 0px 1px 0px rgba(19, 51, 107, 0.08);
  739. }
  740. .f_box_top {
  741. display: flex;
  742. align-items: center;
  743. padding: 10px;
  744. width: 100%;
  745. box-sizing: border-box;
  746. padding-bottom: 0;
  747. }
  748. .f_box_top_left {
  749. display: flex;
  750. align-items: center;
  751. }
  752. .f_box_top_title {
  753. /* font-size: 16px; */
  754. color: rgba(8, 13, 30, .9);
  755. font-size: 20px;
  756. font-style: normal;
  757. font-weight: 500;
  758. /* line-height: 32px; */
  759. /* font-weight: bold; */
  760. }
  761. .f_box_top .btn {
  762. display: flex;
  763. cursor: pointer;
  764. align-items: center;
  765. height: 30px;
  766. padding: 0 8px;
  767. background: rgb(0, 97, 255);
  768. color: #fff;
  769. box-sizing: border-box;
  770. border-radius: 4px;
  771. font-size: 14px;
  772. align-items: center;
  773. }
  774. .f_box_top .btn2 {
  775. display: flex;
  776. cursor: pointer;
  777. align-items: center;
  778. height: 30px;
  779. padding: 0 8px;
  780. background: #fff;
  781. color: rgb(0, 97, 255);
  782. border: 1px solid rgb(0, 97, 255);
  783. box-sizing: border-box;
  784. border-radius: 4px;
  785. font-size: 14px;
  786. align-items: center;
  787. }
  788. .f_box_top .delBtn {
  789. background: rgb(255, 0, 13);
  790. }
  791. .f_box_top .btn + .btn2,
  792. .f_box_top .btn + .btn,
  793. .f_box_top .btn2 + .btn2,
  794. .f_box_top .btn2 + .delBtn {
  795. margin-left: 15px;
  796. }
  797. .f_box_top_right {
  798. margin-left: auto;
  799. /* max-width: calc(100% - 280px); */
  800. overflow: hidden;
  801. display: flex;
  802. /* align-items: center; */
  803. }
  804. .f_box_top_right >>> .el-icon-plus:before {
  805. font-size: 14px;
  806. font-weight: 600;
  807. /* vertical-align: middle; */
  808. }
  809. .f_box_top_right >>>.el-button--primary:focus,.f_box_top_right>>> .el-button--primary:hover{
  810. filter: brightness(120%);
  811. }
  812. .f_box_top_right > .input {
  813. position: relative;
  814. height: 40px;
  815. }
  816. .f_box_top_right > .input > input {
  817. width: 100%;
  818. height: 100%;
  819. border: 1px solid #dcdfe6;
  820. border-radius: 5px;
  821. padding: 0 15px 0 45px;
  822. box-sizing: border-box;
  823. font-size: 14px;
  824. width: 250px;
  825. height: 36px;
  826. font-size: 12.8px;
  827. border-radius: 6px;
  828. outline: none;
  829. }
  830. .f_box_top_right >>> .el-button{
  831. height: 35px !important;
  832. font-size: 12.8px;
  833. background-color: #3370FF;
  834. border-radius: 6px;
  835. margin-left: 12px;
  836. }
  837. .f_box_top_right > .input > .serch {
  838. content: "";
  839. display: block;
  840. width: 20px;
  841. height: 20px;
  842. background-image: url("../../../assets/icon/sourceFile/search.png");
  843. background-size: 100% 100%;
  844. position: absolute;
  845. left: 13px;
  846. top: 50%;
  847. transform: translateY(-50%);
  848. cursor: pointer;
  849. }
  850. .f_box_top_right > .tab {
  851. height: 30px;
  852. width: 80px;
  853. margin-left: 15px;
  854. background: #e7e7e7;
  855. border: 2px solid #d9d9d9;
  856. border-radius: 5px;
  857. box-sizing: border-box;
  858. overflow: hidden;
  859. display: flex;
  860. align-items: center;
  861. }
  862. .f_box_top_right > .tab > .table,
  863. .f_box_top_right > .tab > .list {
  864. width: 50%;
  865. height: 100%;
  866. display: flex;
  867. align-items: center;
  868. justify-content: center;
  869. cursor: pointer;
  870. }
  871. .f_box_top_right > .tab > .list::before {
  872. content: "";
  873. display: block;
  874. width: 20px;
  875. height: 20px;
  876. background-image: url("../../../assets/icon/sourceFile/list.png");
  877. background-size: 100% 100%;
  878. }
  879. .f_box_top_right > .tab > .list.active,
  880. .f_box_top_right > .tab > .table.active {
  881. background: #fff;
  882. }
  883. .f_box_top_right > .tab > .table::before {
  884. content: "";
  885. display: block;
  886. width: 20px;
  887. height: 20px;
  888. background-image: url("../../../assets/icon/sourceFile/table.png");
  889. background-size: 100% 100%;
  890. }
  891. .mask {
  892. /* background-color: rgb(0 0 0 / 30%); */
  893. /* position: fixed; */
  894. position: absolute;
  895. top: 0;
  896. left: 0;
  897. width: 100%;
  898. height: 100%;
  899. z-index: 90;
  900. display: flex;
  901. align-items: center;
  902. justify-content: center;
  903. }
  904. .progressBox {
  905. width: 300px;
  906. height: 100px;
  907. background: #fff;
  908. border-radius: 5px;
  909. box-shadow: 0 0 6px 1px #bfbfbf;
  910. display: flex;
  911. align-items: center;
  912. justify-content: center;
  913. flex-direction: column;
  914. position: relative;
  915. color: #6c6c6c;
  916. }
  917. .progressBox >>> .el-progress-bar__outer {
  918. background-color: #d1dfff !important;
  919. }
  920. .progressBox .lbox {
  921. height: 50px;
  922. font-size: 16px;
  923. display: flex;
  924. align-items: center;
  925. color: #747474;
  926. }
  927. .progressBox .lbox img {
  928. width: 50px;
  929. margin-right: 0px;
  930. }
  931. .closeCss {
  932. position: absolute;
  933. top: 8px;
  934. right: 8px;
  935. cursor: pointer;
  936. width: 20px;
  937. height: 20px;
  938. }
  939. .closeCss > img {
  940. width: 100%;
  941. height: 100%;
  942. }
  943. .f_box_file_square {
  944. height: calc(100% - 55px);
  945. overflow: auto;
  946. width: 100%;
  947. padding: 55px;
  948. box-sizing: border-box;
  949. display: flex;
  950. flex-wrap: wrap;
  951. align-content: flex-start;
  952. position: relative;
  953. }
  954. .f_box_file_square > .f_box_file {
  955. display: flex;
  956. flex-direction: column;
  957. align-items: center;
  958. justify-content: center;
  959. width: 160px;
  960. height: 160px;
  961. cursor: pointer;
  962. margin: 0 36px 36px 0;
  963. border-radius: 20px;
  964. position: relative;
  965. }
  966. .f_box_file_square > .f_box_file:hover {
  967. background: #f0f2f5;
  968. }
  969. .f_box_file_square > .f_box_file:hover > .check {
  970. display: block;
  971. }
  972. .f_box_file_square > .f_box_file.check {
  973. background: #e0eafb;
  974. }
  975. .f_box_file_square > .f_box_file.check > .check {
  976. display: block;
  977. }
  978. .f_box_file_square > .f_box_file > .check {
  979. position: absolute;
  980. left: 15px;
  981. top: 15px;
  982. width: 16px;
  983. height: 16px;
  984. background-size: 100%;
  985. display: none;
  986. }
  987. .f_box_file_square > .f_box_file > .check > img {
  988. width: 100%;
  989. height: 100%;
  990. object-fit: cover;
  991. }
  992. .f_box_file_square > .f_box_file > img {
  993. width: 90px;
  994. height: 90px;
  995. object-fit: cover;
  996. }
  997. .f_box_file_square > .f_box_file > .name {
  998. white-space: nowrap;
  999. font-size: 14px;
  1000. max-width: 80%;
  1001. overflow: hidden;
  1002. margin: 4px auto 0;
  1003. text-overflow: ellipsis;
  1004. text-align: center;
  1005. }
  1006. .f_box_file_list {
  1007. width: 100%;
  1008. padding: 10px;
  1009. box-sizing: border-box;
  1010. position: relative;
  1011. }
  1012. .f_box_file_list >>> .el-table-column--selection .cell{
  1013. display: flex !important;
  1014. align-items: center !important;
  1015. }
  1016. .f_box_file_allCheck {
  1017. display: flex;
  1018. align-items: center;
  1019. position: absolute;
  1020. font-size: 14px;
  1021. top: 20px;
  1022. left: 10px;
  1023. cursor: pointer;
  1024. }
  1025. .f_box_file_allCheck > img {
  1026. width: 16px;
  1027. height: 16px;
  1028. object-fit: cover;
  1029. margin-right: 5px;
  1030. }
  1031. .dialog >>> .el-dialog__body {
  1032. padding: 10px 20px;
  1033. }
  1034. .type_nav_box {
  1035. }
  1036. .type_nav_box > .nav {
  1037. height: 40px;
  1038. border-radius: 5px;
  1039. cursor: pointer;
  1040. display: flex;
  1041. align-items: center;
  1042. width: 100%;
  1043. padding: 0 10px;
  1044. box-sizing: border-box;
  1045. margin-bottom: 10px;
  1046. font-size: 16px;
  1047. color: #000;
  1048. }
  1049. .type_nav_box > .nav > .down {
  1050. min-width: 14px;
  1051. height: 14px;
  1052. background-image: url("../../../assets/icon/sourceFile/icon_arrow.png");
  1053. background-size: 100% 100%;
  1054. margin-right: 10px;
  1055. transition: all 0.3s;
  1056. transform: rotate(-90deg);
  1057. }
  1058. .type_nav_box > .nav.active > .down {
  1059. transform: rotate(0deg);
  1060. }
  1061. .type_nav_box > .nav > .file {
  1062. min-width: 18px;
  1063. height: 18px;
  1064. background-image: url("../../../assets/icon/sourceFile/file.png");
  1065. background-size: 100% 100%;
  1066. margin-right: 10px;
  1067. }
  1068. .type_nav_box > .nav > .name {
  1069. max-width: 100%;
  1070. overflow: hidden;
  1071. text-overflow: ellipsis;
  1072. white-space: nowrap;
  1073. }
  1074. .type_nav_box > .child {
  1075. }
  1076. .type_nav_box > .child > .nav {
  1077. height: 40px;
  1078. border-radius: 5px;
  1079. cursor: pointer;
  1080. display: flex;
  1081. align-items: center;
  1082. width: 100%;
  1083. padding: 0 10px 0 50px;
  1084. box-sizing: border-box;
  1085. margin-bottom: 10px;
  1086. font-size: 16px;
  1087. color: #000;
  1088. }
  1089. .type_nav_box > .child > .nav.active {
  1090. background: #e0eafb;
  1091. }
  1092. .type_nav_box > .child > .nav > .file {
  1093. min-width: 18px;
  1094. height: 18px;
  1095. background-image: url("../../../assets/icon/sourceFile/file.png");
  1096. background-size: 100% 100%;
  1097. margin-right: 10px;
  1098. }
  1099. .type_nav_box > .child > .nav > .name {
  1100. max-width: 100%;
  1101. overflow: hidden;
  1102. text-overflow: ellipsis;
  1103. white-space: nowrap;
  1104. }
  1105. .none_box {
  1106. height: calc(100% - 55px);
  1107. overflow: auto;
  1108. width: 100%;
  1109. padding: 10px;
  1110. box-sizing: border-box;
  1111. display: flex;
  1112. align-items: center;
  1113. justify-content: center;
  1114. }
  1115. .list_file_box {
  1116. width: 100%;
  1117. }
  1118. .list_file_name {
  1119. display: flex;
  1120. align-items: center;
  1121. }
  1122. .list_file_name > img {
  1123. width: 24px;
  1124. height: 24px;
  1125. object-fit: cover;
  1126. margin-right: 5px;
  1127. }
  1128. .list_file_name > div {
  1129. max-width: 100%;
  1130. overflow: hidden;
  1131. white-space: nowrap;
  1132. text-overflow: ellipsis;
  1133. }
  1134. .pageBox{
  1135. display: flex;
  1136. }
  1137. .pageBox >>> .el-pagination__total{
  1138. margin-right: auto;
  1139. }
  1140. .list_file_box >>>table th{
  1141. border:none !important;
  1142. background-color: #F0F2F5 !important; /* 浅灰色背景 */
  1143. color: #00000099 !important;
  1144. }
  1145. .list_file_box >>>table tr td{
  1146. border:none !important;
  1147. border-bottom: 1px solid #EBEEF5 !important;
  1148. }
  1149. .list_file_box >>>table tr {
  1150. border:1px #000 solid !important;
  1151. }
  1152. .list_file_box >>> .el-table__header-wrapper{
  1153. margin-bottom: 10px !important;
  1154. }
  1155. .list_file_box >>> .el-table__row{
  1156. border: 1px #ccc solid;
  1157. }
  1158. .list_file_box >>>table tr td:nth-child(1){
  1159. border-radius: 10px 0 0 10px !important;
  1160. }
  1161. .list_file_box >>>table tr td:nth-last-child(1){
  1162. border-radius: 0 10px 10px 0 !important;
  1163. }
  1164. .list_file_box >>>table tr th:nth-child(1){
  1165. border-radius: 10px 0 0 10px;
  1166. }
  1167. .list_file_box >>>table tr th:nth-last-child(2){
  1168. border-radius: 0 10px 10px 0 !important;
  1169. }
  1170. .list_file_box >>>.el-table::before{
  1171. background-color: #fff;
  1172. }
  1173. .list_file_box >>>.el-table--border::after{
  1174. background-color: #fff;
  1175. }
  1176. .list_file_box >>> .el-table--border{
  1177. border: none;
  1178. border-bottom: 1px solid #EBEEF5;
  1179. }
  1180. .BtnH >>> .el-button{
  1181. padding: 5px !important;
  1182. width: 30px !important;
  1183. color: #4C5567;
  1184. }
  1185. .BtnH >>> .el-button:focus,.BtnH >>> .el-button:hover{
  1186. background: #E8EBF0 !important;
  1187. color: #487FFF !important;
  1188. }
  1189. .BtnHPDel1 >>> .el-button:focus, .BtnHPDel1 >>> .el-button:hover{
  1190. background: #F0F4FF ;
  1191. color: #082e86 !important;
  1192. }
  1193. .BtnHPDel >>> .el-button:focus,.BtnHPDel >>> .el-button:hover{
  1194. background: #FBEAE8 !important;
  1195. color: #DE4C41 !important;
  1196. }
  1197. .BtnH >>> .el-button--small, .el-button--small.is-round{
  1198. border: none;
  1199. padding: 0;
  1200. }
  1201. .BtnHP{
  1202. display: flex;
  1203. flex-direction: column;
  1204. justify-content: center;
  1205. }
  1206. .BtnHPDel{
  1207. display: flex;
  1208. flex-direction: column;
  1209. justify-content: center;
  1210. }
  1211. .BtnHPDel1{
  1212. display: flex;
  1213. flex-direction: column;
  1214. justify-content: center;
  1215. }
  1216. .BtnHP >>> .el-button{
  1217. color: #4C5567;
  1218. margin-left: 0 !important;
  1219. }
  1220. .BtnHP >>>.el-popper .popper__arrow, .el-popper .popper__arrow::after{
  1221. display: none;
  1222. }
  1223. .btnBh:hover{
  1224. background: #F0F4FF;
  1225. }
  1226. .btnBh img{
  1227. margin-right: 5px;
  1228. width: 17px;
  1229. }
  1230. .btnBh2 img{
  1231. width: 17px;
  1232. margin-right: 5px;
  1233. padding: 1.5px;
  1234. box-sizing: border-box;
  1235. }
  1236. .btnBh2:hover{
  1237. background: #FBEAE8;
  1238. }
  1239. .lookHp2{
  1240. color: #6c6c6c;
  1241. }
  1242. .lookHp2{
  1243. color: #487FFF;
  1244. }
  1245. .btnBh2{
  1246. display: flex;
  1247. align-items: center;
  1248. cursor: pointer;
  1249. padding: 5px 8px;
  1250. border-radius: 5px;
  1251. box-sizing: border-box;
  1252. }
  1253. .btnBh{
  1254. display: flex;
  1255. cursor: pointer;
  1256. border-radius: 6px;
  1257. padding: 5px 8px;
  1258. align-items: center;
  1259. }
  1260. </style>
  1261. <style>
  1262. .custom-popover {
  1263. min-width: 70px !important;
  1264. width: auto !important;
  1265. padding: 8px 6px;
  1266. border-radius: 8px;
  1267. }
  1268. </style>