fileBox.vue 34 KB

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