folderFileBox.vue 35 KB

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