12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619 |
- <template>
- <div class="f_box" @dragover.prevent @drop="handleDrop">
- <div class="f_box_top">
- <div class="f_box_top_left">
- <el-breadcrumb separator="/">
- <el-breadcrumb-item style="color: #000;font-weight: 600;"><span @click="goBackPage">{{lang.rootDirectory}}</span></el-breadcrumb-item>
- <el-breadcrumb-item>{{ data.name }}</el-breadcrumb-item>
- </el-breadcrumb>
- <!-- <div class="f_box_top_title">文件</div> -->
- </div>
- <div class="f_box_top_center">
- <span :class="{active: fileType == 1}" @click="checkType(1)">{{lang.fileData}}</span>
- <span :class="{active: fileType == 2}" @click="checkType(2)">{{lang.backTest}}</span>
- </div>
- </div>
- <div class="f_box_container">
- <div class="f_box_top_right" v-if="fileType == 1">
- <div class="input">
- <input
- type="text"
- v-model="fileName"
- :placeholder=lang.selectFileName
- @input="debouncedSearch"
- />
- <div class="serch"></div>
- </div>
- <el-button type="primary" size="small" @click="serchFile"
- >
- <img style="vertical-align: middle;transform: scale(1.1);padding-bottom: 2px;box-sizing: border-box;" src="../../../assets/shuax.svg" alt="">
- {{lang.flushed}}</el-button
- >
- <el-button v-if="userid == data.userid" type="primary" icon="el-icon-plus" size="small" @click="addImg($event)"
- >{{ lang.uploadFile }}
- <input
- type="file"
- accept="*"
- style="display: none"
- multiple="multiple"
- @change="beforeUpload($event)"
- /></el-button>
- <el-button
- type="primary"
- size="small"
- @click="openG"
- v-if="userid == data.userid && data.isMo == '2'"
- >
- <img style="vertical-align: middle;" src="../../../assets/ETL.svg" alt="">
- {{lang.associatedFiles}}</el-button
- >
- <el-button type="primary" v-if="checkArray.length && userid == data.userid " size="small" @click="batchRemove"
- >
- <img style="vertical-align: middle;padding-bottom: 3px;" src="../../../assets/yichuBtn.svg" alt="">
- {{lang.remove}}</el-button
- >
- <el-button type="danger" style="background: #F56C6C;" v-if="checkArray.length && userid == data.userid " size="small" @click="batchDelete"
- >
- <img style="vertical-align: middle;padding-bottom: 3px;" src="../../../assets/delBtn.svg" alt="">
- {{lang.delete}}</el-button
- >
- <div v-if="checkArray.length" style="margin-left: 12px;color: #b0b0b0;font-size: 14px;flex-shrink: 0;line-height: 35px;">{{lang.selectedFiles}} {{checkArray.length}} {{lang.piece}}</div>
- <!-- <div class="btn" @click="serchFile">刷新</div>
- <div class="btn" @click="addImg($event)">
- 上传文件
- <input
- type="file"
- accept="*"
- style="display: none"
- multiple="multiple"
- @change="beforeUpload($event)"
- />
- </div> -->
- <!-- <div class="btn" @click="openG" v-if="userid == data.userid && data.isMo == '2'">关联文件</div>
- <div class="btn" @click="batchRemove">移除</div>
- <div class="btn delBtn" @click="batchDelete">删除</div> -->
- </div>
- <!-- <div class="f_box_top">
- <div class="f_box_top_left"></div>
- <div class="f_box_top_right">
-
- </div>
- </div> -->
- <!-- <div class="none_box" v-if="fileArray.length == 0">暂无上传文件</div> -->
- <!-- v-else-if="stype == '2' && fileArray.length" -->
- <div
- v-show="fileType == 1"
- class="f_box_file_list"
- v-loading.body="isLoading"
- >
- <div class="list_file_box">
- <el-table
- :data="fileArray"
- border
- style="width: 100%; cursor: pointer;"
- @selection-change="handleSelectionChange"
- ref="myTable"
- :row-key="row => row.id"
- @row-click="checkFile"
- >
- <template #empty>
- <div class="customC">
- <div style="height: 50px;line-height: 50px;width: 47.4px;">
- <img style="width: 100%;" src="../../../assets/flieKong.svg" alt="">
- </div>
- <div style="height: 50px;line-height: 40px;">{{lang.noDataContent}}</div>
- </div>
- </template>
- <el-table-column
- type="selection"
- width="50px"
- :reserve-selection="true"
- ></el-table-column>
- <el-table-column
- prop="name"
- :label=lang.fileName
- show-overflow-tooltip
- min-width="15"
- ></el-table-column>
- <el-table-column
- prop="folderName"
- :label=lang.folderBelongs
- show-overflow-tooltip
- min-width="20"
- ></el-table-column>
- <el-table-column
- prop="username"
- :label=lang.owner
- show-overflow-tooltip
- width="120"
- ></el-table-column>
-
- <el-table-column :label=lang.sliceClassification width="120px">
- <template slot-scope="scope">
- {{ getState(scope.row.ingestionStatus) }}
- </template>
- </el-table-column>
- <el-table-column :label=lang.graphExtraction width="120px">
- <template slot-scope="scope">
- {{ getState2(scope.row.extractionStatus) }}
- </template>
- </el-table-column>
- <el-table-column
- :label=lang.fileType
- show-overflow-tooltip
- width="120"
- >
- <template slot-scope="scope">
- {{ scope.row.documentType ? scope.row.documentType : "-" }}
- </template>
- </el-table-column>
- <!-- <el-table-column label="公开状态" show-overflow-tooltip width="80px"></el-table-column> -->
- <el-table-column
- prop="time"
- :label=lang.uploadTime
- show-overflow-tooltip
- min-width="20"
- ></el-table-column>
- <el-table-column :label=lang.operate width="100px">
- <template slot-scope="scope">
- <el-popover
- placement="bottom-end"
- trigger="hover"
- visible-arrow
- popper-class="custom-popover"
- width="100px"
- >
- <div class="BtnHP">
- <div class="BtnHPDel1">
- <!-- <el-button
- type="primary"
- size="small"
- @click="extractFile(scope.row)"
- v-if="userid == data.userid "
- :disabled="scope.row.ingestionStatus == 'failed'"
- >提取</el-button
- > -->
- <div class="btnBh"
- @click="extractFile(scope.row)"
- @mouseover="isHover = true"
- v-if="userid == data.userid "
- :disabled="scope.row.ingestionStatus == 'failed'"
- @mouseleave="isHover = false">
- <img
- style="width: 14px;"
- :src="isHover ? tqList2 : tqList"
- alt="">
- <span :class="isHover ? 'lookHp2' : 'lookHp1'">{{lang.extract}}</span>
- </div>
- <!-- <el-button
- type="primary"
- size="small"
- @click="checkFile(scope.row)"
- :disabled="scope.row.ingestionStatus == 'failed'"
- >查看</el-button
- > -->
- <div class="btnBh"
- @click="checkFile(scope.row)"
- @mouseover="isHover2 = true"
- :disabled="scope.row.ingestionStatus == 'failed'"
- @mouseleave="isHover2 = false">
- <img
- :src="isHover2 ? look2 : look1"
- alt="">
- <span :class="isHover2 ? 'lookHp2' : 'lookHp1'">{{lang.view}}</span>
- </div>
- </div>
- <div class="btnBh"
- @click="removeFile(scope.row.id, scope.row.documentid)"
- @mouseover="isHover3 = true"
- v-if="userid == data.userid && data.isMo == '2'"
- @mouseleave="isHover3 = false">
- <img
- style="width: 14px;"
- :src="isHover3 ? yichu2 : yichu"
- alt="">
- <span :class="isHover3 ? 'lookHp2' : 'lookHp1'">{{lang.remove}}</span>
- </div>
- <div class="btnBh"
- @click="downloadFile(scope.row)"
- @mouseover="isHover4 = true"
- :disabled="scope.row.ingestionStatus == 'failed'"
- @mouseleave="isHover4 = false">
- <img
- :src="isHover4 ? download2 : download"
- alt="">
- <span :class="isHover4 ? 'lookHp2' : 'lookHp1'">{{lang.download}}</span>
- </div>
- <!-- <el-button
- type="primary"
- size="small"
- v-if="userid == data.userid && data.isMo == '2'"
- @click="removeFile(scope.row.id, scope.row.documentid)"
- >移除</el-button
- > -->
- <!-- <el-button
- type="danger"
- size="small"
- v-if="userid == scope.row.userid"
- @click="deleteFile(scope.row.id, scope.row.documentid)"
- >删除</el-button
- > -->
- <div style="background-color: #e7e7e7;width: 100%;height: .5px;margin: 5px 0;"></div>
- <div class="BtnHPDel">
- <div class="btnBh2"
- @click="deleteFile(scope.row.id, scope.row.documentid)"
- v-if="scope.row.userid == userid">
- <img src="../../../assets/listdel.svg" alt="">
- <span style="color: #DE4C41;">{{lang.delete}}</span>
- </div>
- </div>
- </div>
- <el-button slot="reference" class="BtnH" style="border: none;padding: 5px;" @click.stop="">
- <i class="el-icon-more"></i>
- </el-button>
- </el-popover>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <el-pagination
- class="pageBox"
- style="margin-top: 10px"
- layout="total, prev, pager, next"
- :page-size="limit"
- :total="total"
- @current-change="handleCurrentChange"
- >
- </el-pagination>
- <div v-if="proVisible" class="mask">
- <div class="progressBox">
- <div class="lbox">
- {{lang.uploadWait}}<img src="../../../assets/KekeLoading.gif" />
- </div>
- <div class="lbox_count">{{ pcount }} / {{ ptotal }}</div>
- </div>
- </div>
- <testBox v-if="fileType == 2" :userid="userid" :folderid="folderid"></testBox>
- <wpdf :dialogVisiblePdf.sync="dialogVisiblePdf" :url="wurl"></wpdf>
- <wVideo :dialogVisibleVideo.sync="dialogVisibleVideo" :url="wurl"></wVideo>
- <wOffice
- :dialogVisibleOffice.sync="dialogVisibleOffice"
- :url="wurl"
- ></wOffice>
- <relateFiles ref="relateFiles"></relateFiles>
- <checkDialog ref="checkDialog"></checkDialog>
- </div>
- </template>
- <script>
- import officeImg from "../../../assets/icon/sourceFile/office.png";
- import pdfImg from "../../../assets/icon/sourceFile/pdf.png";
- import videoImg from "../../../assets/icon/sourceFile/video.png";
- import otherImg from "../../../assets/icon/sourceFile/other.png";
- import checkImg from "../../../assets/icon/sourceFile/check.png";
- import checkIsImg from "../../../assets/icon/sourceFile/check_is.png";
- // 导入SVG组件
- import look1 from '../../../assets/look1.svg';
- import look2 from '../../../assets/look2.svg';
- import tqList2 from '../../../assets/tqList2.svg';
- import tqList from '../../../assets/tqList.svg';
- import yichu from '../../../assets/yichu.svg';
- import yichu2 from '../../../assets/yichu2.svg';
- import download from '../../../assets/download.svg';
- import download2 from '../../../assets/download2.svg';
- import wVideo from "../test/file/wVideo.vue";
- import wpdf from "../test/file/wPdf2.vue";
- import wOffice from "../test/file/wOffice.vue";
- import { v4 as uuidv4 } from "uuid";
- import relateFiles from "./components/relateFiles";
- import checkDialog from "./components/checkDialog";
- import testBox from "./components/testBox";
- export default {
- components: {
- wVideo,
- wpdf,
- wOffice,
- relateFiles,
- checkDialog,
- testBox
- },
- props: {
- userid: {
- type: String
- },
- typeArray: {
- type: Array
- },
- pid: {
- type: String
- },
- folderid: {
- type: String
- },
- moFolderid: {
- type: String
- },
- data: {
- type: Object
- }
- },
- watch: {
- pid: {
- immediate: true,
- deep: true,
- handler(newValue, oldValue) {
- this.fileArray = [];
- this.checkArray = [];
- this.fileName = "";
- this.proVisible = false;
- this.page = 1;
- this.getData();
- }
- }
- },
- data() {
- return {
- look1:look1,
- look2:look2,
- tqList2:tqList2,
- tqList:tqList,
- yichu:yichu,
- yichu2:yichu2,
- download: download,
- download2: download2,
- isHover:false,
- isHover2:false,
- isHover3:false,
- isHover4:false,
-
- isLoading: false,
- proVisible: false,
- stype: 2,
- fileArray: [],
- officeImg: officeImg,
- pdfImg: pdfImg,
- videoImg: videoImg,
- otherImg: otherImg,
- checkImg: checkImg,
- checkIsImg: checkIsImg,
- checkArray: [],
- checkArray2: [],
- dialogVisiblePdf: false,
- dialogVisibleVideo: false,
- dialogVisibleOffice: false,
- wurl: "",
- moveBox: false,
- checkTypeArray: [],
- moveChild: "",
- fileName: "",
- limit: 10,
- total: 0,
- page: 1,
- debounceTimeout: null,
- pcount: 0,
- ptotal: 0,
- fileType: 1
- };
- },
- computed: {
- getState() {
- return function(item) {
- if (item == "success") {
- return this.lang.success;
- } else if (item == "failed") {
- return this.lang.fail;
- } else if (item == "augmenting") {
- return this.lang.sliced;
- } else if (item == "pending") {
- return this.lang.pending;
- } else if (item == "enriched") {
- return "enriched";
- } else if (!item) {
- return this.lang.sliced;
- } else {
- return item;
- }
- };
- },
- getState2() {
- return function(item) {
- if (item == "success") {
- return this.lang.success;
- } else if (item == "failed") {
- return this.lang.fail;
- } else if (item == "pending") {
- return this.lang.pending;
- } else if (item == "processing") {
- return this.lang.processing;
- } else if (item == "enriched") {
- return "enriched";
- } else if (!item) {
- return this.lang.uploading;
- } else {
- return item;
- }
- };
- }
- },
- methods: {
- goBackPage(){
- this.$emit("goCheckType", this.pid.split("/")[0]);
- },
- handleCurrentChange(val) {
- this.page = val;
- this.getData();
- },
- getData() {
- this.isLoading = true;
- let params = {
- uid: this.userid,
- folderid: this.folderid,
- n: this.fileName.trim(),
- page: this.page,
- num: this.limit
- };
- this.ajax
- .post(this.$store.state.fileApi + "getFileD", [params])
- .then(res => {
- this.isLoading = false;
- console.log(res.data);
- this.total = res.data.result.length ? res.data.result[0].num : 0;
- this.fileArray = res.data.result;
- })
- .catch(err => {
- this.isLoading = false;
- console.error(err);
- });
- },
- handleSelectionChange(selectedRows) {
- this.checkArray = selectedRows.map(row => row.id);
- this.checkArray2 = selectedRows.map(row => ({
- id: row.id,
- documentid: row.documentid
- }));
- },
- addImg(e) {
- var el = e.currentTarget;
- el.getElementsByTagName("input")[0].click();
- e.target.value = "";
- },
- handleDrop(event) {
- event.preventDefault(); // 阻止默认的浏览器下载行为
- const files = event.dataTransfer.files;
- if (files.length) {
- this.beforeUpload({ target: { files } });
- }
- },
- debouncedSearch() {
- clearTimeout(this.debounceTimeout);
- this.debounceTimeout = setTimeout(() => {
- this.serchFile();
- }, 300);
- },
- serchFile() {
- this.page = 1;
- this.getData();
- },
- async beforeUpload(event) {
- let file = "";
- let cfindex2 = 0;
- this.proVisible = true;
- const allowedExtensions = [
- "csv",
- "xls",
- "xlsx",
- "md",
- "pdf",
- "txt",
- "ppt",
- "pptx",
- "docx",
- "jpg",
- "jpeg",
- "png",
- "gif",
- "bmp"
- ];
- // let uuid = uuidv4();
- // let res = window.uploadFile({ file: event.target.files[0], uuid, userid:this.userid, folderid:this.folderid, moFolderid: this.moFolderid })
- // console.log(res);
- // return
- const uploadFiles = async files => {
- this.pcount = 0
- this.ptotal = files.length
- for (let cfindex = 0; cfindex < files.length; cfindex++) {
- file = files[cfindex];
- const fileExtension = file.name
- .split(".")
- .pop()
- .toLowerCase();
- if (!allowedExtensions.includes(fileExtension)) {
- this.$message.error(`${this.lang.unsupFileformats}: ${file.name}`);
- await new Promise(resolve => setTimeout(resolve, 1000)); // 延迟1秒再跳过
- continue; // 跳过不支持的文件
- }
- let uuid = uuidv4();
- let formData = new FormData();
- const timestamp = Date.now();
- const baseName = file.name.slice(0, -(fileExtension.length + 1));
- let string = [this.folderid, this.moFolderid].filter(id => id);
- formData.append(
- "file",
- new File([file], `${baseName}${timestamp}.${fileExtension}`)
- );
- formData.append("collection_ids", JSON.stringify(string));
- formData.append("id", uuid);
- formData.append(
- "metadata",
- JSON.stringify({ title: file.name, collection_ids: string })
- );
- formData.append("ingestion_mode", "fast");
- formData.append("run_with_orchestration", "false");
- // 使用同步方式上传文件
- await this.uploadFile(formData, file.name, uuid);
- this.pcount = cfindex + 1
- // 每5秒上传一次
- if (cfindex < files.length - 1) {
- await new Promise(resolve => setTimeout(resolve, 5000));
- }
- }
- setTimeout(() => {
- this.proVisible = false;
- this.$message.success(this.lang.operComplete);
- this.getData(); // 在上传完所有文件后再调用getData
- }, 1000);
- };
- await uploadFiles(event.target.files);
- },
- async uploadFile(formData, name, uuid) {
- try {
- this.ajax.post("https://r2rserver.cocorobo.cn/v3/documents", formData, {
- headers: {
- "Content-Type": "multipart/form-data"
- }
- }).then(res => {
- console.log(res, formData);
- const message = res.data.results && res.data.results.message;
- const status = message === 'Document created and ingested successfully.' ? 'success' : 'failed';
- const msg = message === 'Document created and ingested successfully.' ? '切片成功' : '切片失败';
- this.$message({
- message: msg,
- type: status == 'success' ? status : 'error'
- })
- // setTimeout(() => {
- this.getData()
- // }, 1000)
- setTimeout(() => {
- this.fileArray.forEach(e => {
- if (e.documentid === uuid) {
- e.ingestionStatus = status;
- }
- });
- }, 1000);
- }).catch(err => {
- this.$message.error(this.lang.uploadFail)
- this.fileArray.forEach(e => {
- if (e.documentid === uuid) {
- e.ingestionStatus = 'failed';
- }
- });
- console.error(err);
- });
- let docid = uuid;
- let params = {
- n: name,
- did: docid,
- uid: this.userid,
- fid: this.folderid,
- mofid: this.moFolderid != this.folderid ? this.moFolderid : ""
- };
- const res2 = await this.ajax.post(this.$store.state.api + "addFile", [
- params
- ]);
- console.log(res2);
- } catch (err) {
- console.error(err);
- this.$message.error(this.lang.uploadFail);
- }
- },
- formatFileSize(bytes) {
- if (bytes < 1024) {
- return bytes + "B";
- } else if (bytes < 1048576) {
- return (bytes / 1024).toFixed(2) + "KB";
- } else if (bytes < 1073741824) {
- return (bytes / 1048576).toFixed(2) + "MB";
- } else {
- return (bytes / 1073741824).toFixed(2) + "GB";
- }
- },
- deleteFile(fileid, documentid) {
- this.$confirm(this.lang.deleteFile, this.lang.prompt, {
- confirmButtonText:this.lang.confirm,
- cancelButtonText: this.lang.cancel,
- type: "warning"
- })
- .then(() => {
- let params = [
- {
- ids: fileid,
- documentids: documentid
- }
- ];
- this.ajax //deleteFileByFilter
- .post(this.$store.state.fileApi + "deleteFile", params)
- .then(res => {
- this.$message({
- message: this.lang.deleteSuccess,
- type: "success"
- });
- this.checkArray = [];
- this.checkArray2 = [];
- this.$refs.myTable.clearSelection();
- this.getData();
- })
- .catch(err => {
- this.$message.error(this.lang.deleteFail);
- console.error(err);
- });
- })
- .catch(() => {});
- },
- batchDelete() {
- if (!this.checkArray.length) {
- this.$message.warning(this.lang.selectDeFile);
- return;
- }
- let array = this.checkArray2.map(item => item.id);
- let array2 = this.checkArray2.map(item => item.documentid);
- this.deleteFile(array.join(","), array2.join(","));
- },
- removeFile(fileid, documentid) {
- this.$confirm(this.lang.sureRemove, this.lang.prompt, {
- confirmButtonText: this.lang.confirm,
- cancelButtonText: this.lang.cancel,
- type: "warning"
- })
- .then(() => {
- let params = [
- {
- ids: fileid,
- documentids: documentid,
- folderid: this.folderid
- }
- ];
- this.ajax
- .post(this.$store.state.fileApi + "removeFile", params)
- .then(res => {
- this.$message({
- message: this.lang.removeSuccess,
- type: "success"
- });
- this.checkArray = [];
- this.checkArray2 = [];
- this.$refs.myTable.clearSelection();
- this.getData();
- })
- .catch(err => {
- this.$message.error(this.lang.removeFail);
- console.error(err);
- });
- })
- .catch(() => {});
- },
- batchRemove() {
- if (!this.checkArray.length) {
- this.$message.warning(this.lang.seReFile);
- return;
- }
- let array = this.checkArray2.map(item => item.id);
- let array2 = this.checkArray2.map(item => item.documentid);
- this.removeFile(array.join(","), array2.join(","));
- },
- isSelectable(row) {
- return row.isMo !== "2";
- },
- openG() {
- this.$refs.relateFiles.openG(this.userid, this.folderid, this.moFolderid);
- },
- checkFile(row) {
- if (row.ingestionStatus != "success") return this.$message.info(this.lang.fileUploadFail)
- this.$refs.checkDialog.openG(row.documentid);
- },
- downloadFile(row) {
- let params = {
- documentid: row.documentid,
- filename: row.name,
- };
- // 使用axios发送GET请求下载文件
- this.ajax.post(`${this.$store.state.fileApi}downloadFile2`, [params],{responseType: 'blob'}).then(response => {
- const url = window.URL.createObjectURL(new Blob([response.data]));
- const link = document.createElement('a');
- link.href = url;
- link.setAttribute('download', row.name); // 设置下载文件名
- document.body.appendChild(link);
- link.click();
- link.remove();
- this.$message({
- message: this.lang.downloadSuccess,
- type: "success"
- });
- }).catch(err => {
- this.$message.error(this.lang.downloadFail);
- console.error(err);
- });
- },
- extractFile(row) {
- if (row.ingestionStatus != "success") return this.$message.info(this.lang.fileUploadFail)
- let params = {
- documentid: row.documentid
- };
- // 获取切片
- try {
- const res = this.ajax.post(this.$store.state.fileApi + "extractFile2", [
- params
- ]).then(res => {
- console.log(res, row);
- const message = res.data.result && res.data.result.message;
- // const status = message === 'Document entities and relationships extracted successfully.' ? 'success' : 'failed';
- // const msg = message === 'Document entities and relationships extracted successfully.' ? '提取成功' : '提取失败';
- // this.$message({
- // message: msg,
- // type: status == 'success' ? status : 'error'
- // })
- // this.fileArray.forEach(e => {
- // if (e.documentid === row.documentid) {
- // e.extractionStatus = status;
- // }
- // });
- setTimeout(() => {
- this.getData();
- }, 1000)
- }).catch(err => {
- this.$message.error(this.lang.extrFailed)
- this.fileArray.forEach(e => {
- if (e.documentid === row.documentid) {
- e.extractionStatus = 'failed';
- }
- });
- console.error(err);
- });;
- console.log(res.data);
- this.$message.success(this.lang.extractingFile);
- } catch (err) {
- console.error(err);
- }
- },
- checkType(type){
- this.fileType = type
- }
- },
- mounted() {
- // this.getData();
- // const script = document.createElement('script');
- // script.src = 'https://beta.cloud.cocorobo.cn/js/Common/uploadR2R.js';
- // script.type = 'text/javascript';
- // script.defer = true; // 或者 async,根据需要
- // script.onload = () => {
- // console.log('上传脚本加载成功');
- // // 你可以在这里使用上传文件的功能了
- // };
- // script.onerror = () => {
- // console.error('上传脚本加载失败');
- // };
- // document.head.appendChild(script);
- }
- };
- </script>
- <style scoped>
- .f_box {
- width: 100%;
- /* height: 100%; */
- position: relative;
- min-height: 400px;
- display: flex;
- flex-direction: column;
- }
- .f_box_top {
- display: flex;
- align-items: center;
- padding: 10px 0 0;
- padding-top: 0px;
- width: 100%;
- box-sizing: border-box;
- position: relative;
- height: 50px;
- min-height: 50px;
- border-bottom: 1px solid #E8EBF0;
- padding: 0 24px;
- }
- .f_box_top_left {
- display: flex;
- align-items: center;
- }
- .f_box_top_title {
- font-size: 16px;
- color: rgba(8, 13, 30, .9);
- /* font-weight: bold; */
- }
- .btn {
- display: flex;
- cursor: pointer;
- align-items: center;
- height: 30px;
- padding: 0 8px;
- background: rgb(0, 97, 255);
- color: #fff;
- box-sizing: border-box;
- border-radius: 4px;
- font-size: 14px;
- align-items: center;
- }
- .btn2 {
- display: flex;
- cursor: pointer;
- align-items: center;
- height: 30px;
- padding: 0 8px;
- background: #fff;
- color: rgb(0, 97, 255);
- border: 1px solid rgb(0, 97, 255);
- box-sizing: border-box;
- border-radius: 4px;
- font-size: 14px;
- align-items: center;
- }
- .f_box_top .delBtn {
- background: rgb(255, 0, 13);
- }
- .btn + .btn2,
- .btn + .btn,
- .btn2 + .btn2,
- .btn2 + .delBtn {
- margin-left: 15px;
- }
- .f_box_container{
- display: flex;
- flex-direction: column;
- gap: 16px;
- height: 100%;
- overflow: auto;
- }
- .f_box_top_right {
- margin-left: auto;
- /* max-width: calc(100% - 280px); */
- overflow: hidden;
- display: flex;
- /* align-items: center; */
- padding: 0 24px;
- min-height: fit-content;
- }
- .f_box_top_right > .input {
- position: relative;
- /* height: 40px; */
- }
- .f_box_top_right >>> .el-button{
- height: 35px !important;
- font-size: 12.8px;
- background-color: #3370FF;
- border-radius: 6px;
- margin-left: 12px;
- }
- .f_box_top_right >>>.el-button--primary:focus,.f_box_top_right>>> .el-button--primary:hover{
- filter: brightness(120%);
- }
- .f_box_top_right >>> .el-icon-plus:before {
- font-size: 14px;
- font-weight: 600;
- /* vertical-align: middle; */
- }
- .f_box_top_right > .input > input {
- width: 100%;
- height: 100%;
- border: 1px solid #dcdfe6;
- border-radius: 5px;
- padding: 0 15px 0 45px;
- box-sizing: border-box;
- font-size: 14px;
- width: 250px;
- height: 36px;
- font-size: 12.8px;
- border-radius: 6px;
- outline: none;
- }
- .f_box_top_right > .input > .serch {
- content: "";
- display: block;
- width: 20px;
- height: 20px;
- background-image: url("../../../assets/icon/sourceFile/search.png");
- background-size: 100% 100%;
- position: absolute;
- left: 13px;
- top: 50%;
- transform: translateY(-50%);
- cursor: pointer;
- }
- .f_box_top_right > .tab {
- height: 30px;
- width: 80px;
- margin-left: 15px;
- background: #e7e7e7;
- border: 2px solid #d9d9d9;
- border-radius: 5px;
- box-sizing: border-box;
- overflow: hidden;
- display: flex;
- align-items: center;
- }
- .f_box_top_right > .tab > .table,
- .f_box_top_right > .tab > .list {
- width: 50%;
- height: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- cursor: pointer;
- }
- .f_box_top_right > .tab > .list::before {
- content: "";
- display: block;
- width: 20px;
- height: 20px;
- background-image: url("../../../assets/icon/sourceFile/list.png");
- background-size: 100% 100%;
- }
- .f_box_top_right > .tab > .list.active,
- .f_box_top_right > .tab > .table.active {
- background: #fff;
- }
- .f_box_top_right > .tab > .table::before {
- content: "";
- display: block;
- width: 20px;
- height: 20px;
- background-image: url("../../../assets/icon/sourceFile/table.png");
- background-size: 100% 100%;
- }
- .mask {
- /* background-color: rgb(0 0 0 / 30%); */
- /* position: fixed; */
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- z-index: 90;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .progressBox {
- width: 300px;
- height: 100px;
- background: #fff;
- border-radius: 5px;
- box-shadow: 0 0 6px 1px #bfbfbf;
- display: flex;
- align-items: center;
- justify-content: center;
- flex-direction: column;
- position: relative;
- color: #6c6c6c;
- }
- .progressBox >>> .el-progress-bar__outer {
- background-color: #d1dfff !important;
- }
- .progressBox .lbox {
- height: 50px;
- font-size: 16px;
- display: flex;
- align-items: center;
- color: #747474;
- }
- .progressBox .lbox img {
- width: 50px;
- margin-right: 0px;
- }
- .closeCss {
- position: absolute;
- top: 8px;
- right: 8px;
- cursor: pointer;
- width: 20px;
- height: 20px;
- }
- .closeCss > img {
- width: 100%;
- height: 100%;
- }
- .f_box_file_square {
- height: calc(100% - 55px);
- overflow: auto;
- width: 100%;
- padding: 55px;
- box-sizing: border-box;
- display: flex;
- flex-wrap: wrap;
- align-content: flex-start;
- position: relative;
- }
- .f_box_file_square > .f_box_file {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- width: 160px;
- height: 160px;
- cursor: pointer;
- margin: 0 36px 36px 0;
- border-radius: 20px;
- position: relative;
- }
- .f_box_file_square > .f_box_file:hover {
- background: #f0f2f5;
- }
- .f_box_file_square > .f_box_file:hover > .check {
- display: block;
- }
- .f_box_file_square > .f_box_file.check {
- background: #e0eafb;
- }
- .f_box_file_square > .f_box_file.check > .check {
- display: block;
- }
- .f_box_file_square > .f_box_file > .check {
- position: absolute;
- left: 15px;
- top: 15px;
- width: 16px;
- height: 16px;
- background-size: 100%;
- display: none;
- }
- .f_box_file_square > .f_box_file > .check > img {
- width: 100%;
- height: 100%;
- object-fit: cover;
- }
- .f_box_file_square > .f_box_file > img {
- width: 90px;
- height: 90px;
- object-fit: cover;
- }
- .f_box_file_square > .f_box_file > .name {
- white-space: nowrap;
- font-size: 14px;
- max-width: 80%;
- overflow: hidden;
- margin: 4px auto 0;
- text-overflow: ellipsis;
- text-align: center;
- }
- .f_box_file_list {
- /* height: calc(100% - 55px); */
- /* overflow: auto; */
- width: 100%;
- /* padding: 10px 0; */
- padding-top: 0;
- box-sizing: border-box;
- position: relative;
- padding: 0 24px;
- }
- .f_box_file_list > .f_box_file {
- }
- .f_box_file_list >>> .el-table-column--selection .cell{
- display: flex !important;
- align-items: center !important;
- }
- .f_box_file_allCheck {
- display: flex;
- align-items: center;
- position: absolute;
- font-size: 14px;
- top: 20px;
- left: 10px;
- cursor: pointer;
- }
- .f_box_file_allCheck > img {
- width: 16px;
- height: 16px;
- object-fit: cover;
- margin-right: 5px;
- }
- .el-dialogClass>>>.el-dialog{
- border-radius: 8px;
- }
- .dialog >>> .el-dialog__body {
- padding: 10px 20px;
- }
- .type_nav_box {
- }
- .type_nav_box > .nav {
- height: 40px;
- border-radius: 5px;
- cursor: pointer;
- display: flex;
- align-items: center;
- width: 100%;
- padding: 0 10px;
- box-sizing: border-box;
- margin-bottom: 10px;
- font-size: 16px;
- color: #000;
- }
- .type_nav_box > .nav > .down {
- min-width: 14px;
- height: 14px;
- background-image: url("../../../assets/icon/sourceFile/icon_arrow.png");
- background-size: 100% 100%;
- margin-right: 10px;
- transition: all 0.3s;
- transform: rotate(-90deg);
- }
- .type_nav_box > .nav.active > .down {
- transform: rotate(0deg);
- }
- .type_nav_box > .nav > .file {
- min-width: 18px;
- height: 18px;
- background-image: url("../../../assets/icon/sourceFile/file.png");
- background-size: 100% 100%;
- margin-right: 10px;
- }
- .type_nav_box > .nav > .name {
- max-width: 100%;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .type_nav_box > .child {
- }
- .type_nav_box > .child > .nav {
- height: 40px;
- border-radius: 5px;
- cursor: pointer;
- display: flex;
- align-items: center;
- width: 100%;
- padding: 0 10px 0 50px;
- box-sizing: border-box;
- margin-bottom: 10px;
- font-size: 16px;
- color: #000;
- }
- .type_nav_box > .child > .nav.active {
- background: #e0eafb;
- }
- .type_nav_box > .child > .nav > .file {
- min-width: 18px;
- height: 18px;
- background-image: url("../../../assets/icon/sourceFile/file.png");
- background-size: 100% 100%;
- margin-right: 10px;
- }
- .type_nav_box > .child > .nav > .name {
- max-width: 100%;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .none_box {
- height: calc(100% - 55px);
- overflow: auto;
- width: 100%;
- padding: 10px;
- box-sizing: border-box;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .list_file_box {
- width: 100%;
- }
- .list_file_box >>> .el-table__empty-block{
- height: 300px !important;
- display: flex;
- align-items: center;
- }
- .list_file_box >>> .el-table__empty-block div{
- display: flex;
- flex-direction: column;
- align-items: center;
- /* justify-content: center; */
- }
- .customC{
- /* height: 300px; */
- /* width: 100px; */
- /* height: 400px;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- flex-wrap: wrap;
- font-size: 14px;
- margin-top: .5rem;
- color: #667085; */
- }
- .list_file_box >>>table th{
- border:none !important;
- background-color: #F0F2F5 !important; /* 浅灰色背景 */
- color: #00000099 !important;
- }
- .list_file_box >>>table tr td{
- border:none !important;
- border-bottom: 1px solid #EBEEF5 !important;
- }
- .list_file_box >>>table tr {
- border:1px #000 solid !important;
- }
- .list_file_box >>> .el-table__header-wrapper{
- margin-bottom: 10px !important;
- }
- .list_file_box >>> .el-table__row{
- border: 1px #ccc solid;
- }
- .list_file_box >>>table tr td:nth-child(1){
- border-radius: 10px 0 0 10px !important;
- }
- .list_file_box >>>table tr td:nth-last-child(1){
- border-radius: 0 10px 10px 0 !important;
- }
- .list_file_box >>>table tr th:nth-child(1){
- border-radius: 10px 0 0 10px;
- }
- .list_file_box >>>table tr th:nth-last-child(2){
- border-radius: 0 10px 10px 0 !important;
- }
- .list_file_box >>>.el-table::before{
- background-color: #fff;
- }
- .list_file_box >>>.el-table--border::after{
- background-color: #fff;
- }
- .list_file_box >>> .el-table--border{
- border: none;
- border-bottom: 1px solid #EBEEF5;
- }
- .BtnH >>> .el-button{
- padding: 5px !important;
- width: 30px !important;
- color: #4C5567;
- }
- .BtnH >>> .el-button:focus,.BtnH >>> .el-button:hover{
- background: #E8EBF0 !important;
- color: #487FFF !important;
- }
- .BtnH >>> .el-button--small, .el-button--small.is-round{
- border: none;
- padding: 0;
- }
- .BtnHP{
- display: flex;
- flex-direction: column;
- justify-content: center;
- }
- .BtnHP >>>.el-popper .popper__arrow, .el-popper .popper__arrow::after{
- display: none;
- }
- .BtnHP >>> .el-button--text{
- color: #667095;
- }
- .BtnHP img{
- width: 16px;
- }
- .BtnHPDel{
- display: flex;
- flex-direction: column;
- flex-wrap: wrap;
- justify-content: center;
- }
- .BtnHPDel >>> .el-button+.el-button{
- padding: 0;
- }
- .BtnHPDel >>> .el-button:focus,.BtnHPDel >>> .el-button:hover{
- background: #E8EBF0 !important;
- }
- /* .BtnHPDel >>> .el-button:hover .lookHp{
- } */
- .lookHp2{
- color: #6c6c6c;
- }
- .lookHp2{
- color: #487FFF;
- }
- /* .btnBh{
- display: flex;
- align-items: center;
- justify-content: center;
- cursor: pointer;
- height: 28px;
- border-radius: 5px;
- }
- .btnBh:hover{
- background: #F0F4FF;
- }
- .btnBh img{
- margin-right: 5px;
- } */
- .btnBh2 img{
- width: 17px;
- margin-right: 5px;
- padding: 1.5px;
- box-sizing: border-box;
- }
- .btnBh2:hover{
- background: #FBEAE8;
- }
- .list_file_name {
- display: flex;
- align-items: center;
- }
- .list_file_name > img {
- width: 24px;
- height: 24px;
- object-fit: cover;
- margin-right: 5px;
- }
- .list_file_name > div {
- max-width: 100%;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- .pageBox{
- display: flex;
- }
- .pageBox >>> .el-pagination__total{
- margin-right: auto;
- }
- .btnBh2{
- display: flex;
- align-items: center;
- cursor: pointer;
- padding: 5px 8px;
- border-radius: 6px;
- box-sizing: border-box;
- }
- .btnBh{
- display: flex;
- cursor: pointer;
- border-radius: 6px;
- padding: 5px 8px;
- }
- </style>
- <style>
- .custom-popover {
- min-width: 70px !important;
- width: auto !important;
- padding: 8px 10px;
- border-radius: 8px;
- }
- /* .custom-popover2 {
- min-width: 88px !important;
- width: auto !important;
- padding: 8px;
- top: 414px !important;
- text-align: center;
- } */
- .BtnH >>> .el-button{
- padding: 5px !important;
- width: 30px !important;
- color: #4C5567;
- }
- .BtnH >>> .el-button:focus,.BtnH >>> .el-button:hover{
- background: #E8EBF0 !important;
- color: #487FFF !important;
- }
- .BtnHPDel1 >>> .el-button:focus, .BtnHPDel1 >>> .el-button:hover{
- background: #F0F4FF ;
- color: #082e86 !important;
- }
- .BtnHPDel >>> .el-button:focus,.BtnHPDel >>> .el-button:hover{
- background: #FBEAE8 !important;
- color: #DE4C41 !important;
- }
- .BtnH >>> .el-button--small, .el-button--small.is-round{
- border: none;
- padding: 0;
- }
- .BtnHP{
- display: flex;
- flex-direction: column;
- justify-content: center;
- }
- .BtnHPDel{
- display: flex;
- flex-direction: column;
- justify-content: center;
- }
- .BtnHPDel1{
- display: flex;
- flex-direction: column;
- justify-content: center;
- }
- .BtnHP >>> .el-button{
- color: #4C5567;
- margin-left: 0 !important;
- }
- .BtnHP >>>.el-popper .popper__arrow, .el-popper .popper__arrow::after{
- display: none;
- }
- .btnBh{
- display: flex;
- /* align-items: center; */
- justify-content: center;
- cursor: pointer;
- /* height: 28px; */
- border-radius: 6px;
- padding: 6px 9px;
- }
- .btnBh:hover{
- background: #F0F4FF;
- }
- .btnBh img{
- margin-right: 5px;
- width: 17px;
- }
- .btnBh2{
- display: flex;
- align-items: center;
- justify-content: center;
- cursor: pointer;
- height: 28px;
- padding: 0 10px;
- border-radius: 5px;
- }
- .btnBh2 img{
- width: 14px;
- margin-right: 5px;
- }
- .btnBh2:hover{
- background: #FBEAE8;
- }
- .lookHp2{
- color: #6c6c6c;
- }
- .lookHp2{
- color: #487FFF;
- }
- .list_file_box >>> .el-table__empty-text{
- display: flex;
- justify-content: center;
- line-height: 22px !important;
- }
- .list_file_box >>> .el-table-column--selection .cell{
- display: flex !important;
- align-items: center !important;
- }
- .f_box_top_center{
- margin: auto;
- display: flex;
- align-items: center;
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- }
- .f_box_top_center > span{
- font-size: 16px;
- cursor: pointer;
- padding: 6px 8px;
- color: #1A202C;
- }
- .f_box_top_center > span:hover{
- background: rgb(242, 243, 243);
- border-radius: 5px;
- }
- .f_box_top_center > span.active{
- color: #2B5FD9;
- }
- </style>
|