1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-3777bfcd"],{"07ac":function(e,t,a){var n=a("23e7"),o=a("6f53").values;n({target:"Object",stat:!0},{values:function(e){return o(e)}})},2251:function(e,t,a){},"4ec9":function(e,t,a){"use strict";var n=a("6d61"),o=a("6566");e.exports=n("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),o)},"56a0":function(e,t,a){"use strict";a("5c28")},"5c28":function(e,t,a){},"6f53":function(e,t,a){var n=a("83ab"),o=a("df75"),i=a("fc6a"),r=a("d1e7").f,s=function(e){return function(t){var a,s=i(t),l=o(s),c=l.length,u=0,d=[];while(c>u)a=l[u++],n&&!r.call(s,a)||d.push(e?[a,s[a]]:s[a]);return d}};e.exports={entries:s(!0),values:s(!1)}},"93e2":function(e,t,a){"use strict";a("b026")},b026:function(e,t,a){},e715:function(e,t,a){"use strict";a("2251")},ed61:function(e,t,a){"use strict";a.r(t);var n,o=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"project-search"},[a("div",{staticClass:"file-categories"},[a("el-button",{attrs:{type:"primary"},on:{click:e.createNewFolder}},[a("i",{staticClass:"el-icon-plus"}),e._v(" 新建目录 ")]),a("p",[e._v(e._s(e.$route.query.name))]),a("el-tree",{ref:"folderTree",attrs:{data:e.folders,props:e.defaultProps,"default-expanded-keys":["0"],"node-key":"id","highlight-current":""},on:{"node-click":e.handleNodeClick},scopedSlots:e._u([{key:"default",fn:function(t){var n=t.node,o=t.data;return a("span",{staticClass:"custom-tree-node"},[a("span",{staticClass:"tree_title"},[a("i",{staticClass:"el-icon-folder"}),a("span",{staticClass:"folder-name",attrs:{title:n.label}},[e._v(e._s(n.label))])]),"001"!==o.id?a("span",{class:e.getFileCountClass(o.id)},[e._v(e._s(o.document_count)+" files")]):e._e(),0!==o.id&&"001"!==o.id?a("span",{staticClass:"folder-actions"},[a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"编辑",placement:"top"}},[a("i",{staticClass:"el-icon-edit",on:{click:function(t){return t.stopPropagation(),e.editFolder(o)}}})]),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"删除",placement:"top"}},[a("i",{staticClass:"el-icon-delete",on:{click:function(t){return t.stopPropagation(),e.deleteFolder(o.id)}}})])],1):e._e()])}}])})],1),a("div",{staticClass:"right"},[a("dataSearch",{attrs:{currentFolderId:e.queryForm.doc_type_id},on:{bindSetQuery:e.setQuery,refreshFolders:e.typeList}}),a("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],staticClass:"data-list",attrs:{"element-loading-text":"加载中..."}},[a("div",{staticClass:"batch-actions",staticStyle:{margin:"10px 0"}},[a("el-dropdown",{attrs:{disabled:!e.selectedRows.length},on:{command:e.handleBatchCommand}},[a("el-button",{staticStyle:{color:"#fff"},attrs:{type:"primary"}},[e._v(" 批量操作 "),a("i",{staticClass:"el-icon--right icons",attrs:{"data-feather":"chevron-down"}})]),a("el-dropdown-menu",{attrs:{slot:"dropdown"},slot:"dropdown"},[a("el-dropdown-item",{attrs:{command:"analysis"}},[a("i",{staticClass:"icons",attrs:{"data-feather":"play"}}),e._v(" 批量解析 ")]),a("el-dropdown-item",{attrs:{command:"modifyFolder"}},[a("i",{staticClass:"icons",attrs:{"data-feather":"folder"}}),e._v(" 批量修改目录 ")]),a("el-dropdown-item",{attrs:{command:"delete"}},[a("i",{staticClass:"icons",attrs:{"data-feather":"trash-2"}}),e._v(" 批量删除 ")])],1)],1),a("el-button",{attrs:{type:"danger"},on:{click:function(t){return e.endAnalysis()}}},[a("i",{staticClass:"icons",attrs:{"data-feather":"stop-circle"}}),e._v(" 终止所有任务 ")])],1),e.selectedRows.length>0?a("div",{staticClass:"selection-control"},[a("el-alert",{staticStyle:{"margin-bottom":"10px"},attrs:{type:"info","show-icon":"",closable:!1}},[e.isAllDataSelected?[a("span",[e._v("已选择全部"+e._s(e.recordCount)+"条数据")]),a("span",{staticStyle:{cursor:"pointer",color:"#409eff","margin-left":"10px"},attrs:{type:"text"},on:{click:e.handleCancelAllSelection}},[e._v(" 取消全选 ")])]:[a("span",{staticStyle:{cursor:"pointer",color:"#409eff","margin-left":"10px"},attrs:{type:"text"},on:{click:e.handleSelectAllData}},[e._v(" 选择全部"+e._s(e.recordCount)+"条数据 ")])]],2)],1):e._e(),a("el-table",{ref:"dataTable",staticStyle:{width:"100%","font-size":"12px"},attrs:{data:e.dataList,"header-row-class-name":"headerBg","empty-text":"暂无数据","row-key":e.getRowKey},on:{"selection-change":e.handleSelectionChange,"sort-change":e.handleSortChange}},[a("el-table-column",{attrs:{type:"selection",width:"55","reserve-selection":!0}}),a("el-table-column",{attrs:{prop:"id",label:"ID",align:"center",width:"80"}}),a("el-table-column",{attrs:{prop:"name",label:"文件名称",sortable:"",width:"350"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("span",[e._v(e._s(t.row.name))])]}}])}),a("el-table-column",{attrs:{prop:"type",label:"文件类型",align:"center"}}),a("el-table-column",{attrs:{prop:"chunk_num",label:"分块数",align:"center"}}),a("el-table-column",{attrs:{prop:"create_time",label:"上传时间",align:"center",sortable:"",width:"140"}}),a("el-table-column",{attrs:{prop:"run",label:"解析状态",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-tooltip",{attrs:{effect:"dark",placement:"top",disabled:1!==Number(t.row.run)&&4!==Number(t.row.run)},scopedSlots:e._u([{key:"content",fn:function(){return[a("div",{staticStyle:{padding:"5px"}},[a("div",{staticStyle:{"margin-top":"5px","font-size":"12px"}},[e._v(" "+e._s(t.row.progress_msg||"正在解析中...")+" ")])])]},proxy:!0}],null,!0)},[a("div",{staticClass:"status-wrapper"},[1===Number(t.row.run)?[a("div",{staticClass:"progress-wrapper"},[a("el-progress",{attrs:{type:"circle",percentage:Math.floor(t.row.progress)||0,width:30,"stroke-width":2,format:e.percentFormat}})],1)]:[a("el-tag",{attrs:{type:e.getStatusType(t.row.run),size:"small"}},[e._v(" "+e._s(e.getStatusText(t.row.run))+" ")])]],2)])]}}])}),a("el-table-column",{attrs:{label:"操作",align:"center",fixed:"right",width:"180"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("div",{staticClass:"operations-container"},[a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"预览",placement:"top"}},[e.checkAuth("/document/update")?a("el-button",{staticStyle:{"font-size":"15px"},attrs:{type:"text",size:"small",circle:"",icon:"el-icon-view"},on:{click:function(a){return e.getName(t.row)}}}):e._e()],1),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"修改文件名",placement:"top"}},[e.checkAuth("/document/update")?a("el-button",{staticStyle:{"font-size":"15px"},attrs:{type:"text",size:"small",circle:"",icon:"el-icon-edit"},on:{click:function(a){return e.btnEdit(t.row)}}}):e._e()],1),a("el-popover",{attrs:{placement:"bottom",trigger:"click","popper-class":"operations-popover"},scopedSlots:e._u([{key:"reference",fn:function(){return[a("el-button",{staticClass:"operation-button",staticStyle:{"font-size":"15px","margin-left":"10px"},attrs:{type:"text",size:"small",circle:"",icon:"el-icon-more"}})]},proxy:!0}],null,!0)},[a("div",{staticClass:"additional-operations"},[a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:1==t.row.run||5==t.row.run?"解析中":"解析",placement:"top"}},[1!=t.row.run&&5!=t.row.run?a("el-button",{staticStyle:{"font-size":"15px"},attrs:{type:"text",icon:"el-icon-caret-right",circle:""},on:{click:function(a){return e.analysis(t.row)}}}):a("el-button",{staticStyle:{"font-size":"15px"},attrs:{type:"text",icon:"el-icon-loading",circle:"",disabled:!0}})],1),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"解析方法",placement:"top"}},[e.checkAuth("/document/update")?a("el-button",{staticStyle:{"font-size":"15px"},attrs:{type:"text",size:"small",circle:"",icon:"el-icon-tickets"},on:{click:function(a){return e.Analytical(t.row)}}}):e._e()],1),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"下载",placement:"top"}},[a("el-button",{staticStyle:{"font-size":"15px"},attrs:{type:"text",size:"small",circle:"",icon:"el-icon-download",loading:t.row.downloading},on:{click:function(a){return e.btnDown(t.row)}}})],1),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"删除",placement:"top"}},[e.checkAuth("/document/delete")?a("el-button",{staticStyle:{"font-size":"15px"},attrs:{type:"text",size:"small",circle:"",icon:"el-icon-delete"},on:{click:function(a){return e.btnDelete(t.row.id)}}}):e._e()],1)],1)])],1)]}}])})],1),a("div",{staticClass:"page-info"},[a("el-pagination",{attrs:{currentPage:e.queryForm.page,"page-size":e.queryForm.pageSize,total:e.recordCount,"page-count":e.pageTotal,"page-sizes":[10,20,50,100],background:"",layout:"total,sizes, prev, pager, next"},on:{"current-change":e.ChangePage,"size-change":e.handleSizeChange}})],1),a("el-dialog",{attrs:{title:"修改名称",visible:e.dialogVisible,width:"30%","before-close":e.handleClose},on:{"update:visible":function(t){e.dialogVisible=t}}},[a("el-form",{ref:"wordRef",attrs:{model:e.wordForm,rules:e.wordRules}},[a("el-form-item",{attrs:{label:"文件名称:",prop:"new_name"}},[a("el-input",{attrs:{placeholder:"请输入文件名称"},model:{value:e.wordForm.new_name,callback:function(t){e.$set(e.wordForm,"new_name",t)},expression:"wordForm.new_name"}})],1)],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:e.handleClose}},[e._v("取 消")]),a("el-button",{attrs:{type:"primary"},on:{click:e.submitBuck}},[e._v("确 定")])],1)],1),a("el-dialog",{attrs:{title:"解析方法",visible:e.anaDialogVisible,width:"30%","before-close":e.handleAnalClose},on:{"update:visible":function(t){e.anaDialogVisible=t}}},[a("el-form",{ref:"analRef",attrs:{model:e.analForm,"label-position":"top",rules:e.analRules}},[a("el-form-item",{attrs:{label:"语言选择:",prop:"language"}},[a("el-radio-group",{model:{value:e.analForm.language,callback:function(t){e.$set(e.analForm,"language",t)},expression:"analForm.language"}},[a("el-radio",{attrs:{label:"zh"}},[e._v("中文")]),a("el-radio",{attrs:{label:"en"}},[e._v("英文")])],1)],1),a("el-form-item",{attrs:{label:"页码范围:",prop:"new_name"}},[a("el-input-number",{attrs:{"controls-position":"right",min:1},model:{value:e.analForm.start_page,callback:function(t){e.$set(e.analForm,"start_page",t)},expression:"analForm.start_page"}}),a("el-input-number",{staticStyle:{"margin-left":"10px"},attrs:{"controls-position":"right",min:1},model:{value:e.analForm.end_page,callback:function(t){e.$set(e.analForm,"end_page",t)},expression:"analForm.end_page"}})],1),a("el-form-item",{attrs:{label:"块token数"}},[a("div",{staticClass:"block"},[a("el-slider",{attrs:{max:2048,"show-input":""},model:{value:e.analForm.token_num,callback:function(t){e.$set(e.analForm,"token_num",t)},expression:"analForm.token_num"}})],1)])],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{type:"primary"},on:{click:e.handleAnalClose}},[e._v("取 消")]),a("el-button",{attrs:{type:"primary"},on:{click:e.submitAnal}},[e._v("确 定")])],1)],1),a("el-dialog",{attrs:{title:"新建目录",visible:e.newFolderDialogVisible,width:"30%"},on:{"update:visible":function(t){e.newFolderDialogVisible=t}}},[a("el-form",{ref:"newFolderFormRef",attrs:{model:e.newFolderForm,rules:e.newFolderRules}},[a("el-form-item",{attrs:{label:"文件夹名称",prop:"name"}},[a("el-input",{model:{value:e.newFolderForm.name,callback:function(t){e.$set(e.newFolderForm,"name",t)},expression:"newFolderForm.name"}})],1)],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{type:"primary"},on:{click:function(t){e.newFolderDialogVisible=!1}}},[e._v("取 消")]),a("el-button",{attrs:{type:"primary"},on:{click:e.submitNewFolder}},[e._v("确 定")])],1)],1),a("el-dialog",{attrs:{title:"批量修改目录",visible:e.batchModifyFolderDialogVisible,width:"30%"},on:{"update:visible":function(t){e.batchModifyFolderDialogVisible=t}}},[a("el-form",{ref:"batchModifyFolderFormRef",attrs:{model:e.batchModifyFolderForm,rules:e.batchModifyFolderRules}},[a("el-form-item",{attrs:{label:"选择目录",prop:"folderId"}},[a("el-select",{attrs:{placeholder:"请选择目录"},model:{value:e.batchModifyFolderForm.folderId,callback:function(t){e.$set(e.batchModifyFolderForm,"folderId",t)},expression:"batchModifyFolderForm.folderId"}},e._l(e.folders.filter((function(e){return 0!==e.id})),(function(e){return a("el-option",{key:e.id,attrs:{label:e.name,value:e.id}})})),1)],1)],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{type:"primary"},on:{click:function(t){e.batchModifyFolderDialogVisible=!1}}},[e._v("取 消")]),a("el-button",{attrs:{type:"primary"},on:{click:e.submitBatchModifyFolder}},[e._v("确 定")])],1)],1)],1)],1)])},i=[],r=a("c7eb"),s=a("1da1"),l=a("2909"),c=a("3835"),u=a("ade3"),d=a("5530"),m=(a("99af"),a("4de4"),a("7db0"),a("c740"),a("a630"),a("caad"),a("d81d"),a("13d5"),a("4e82"),a("b0c0"),a("e9c4"),a("4ec9"),a("a9e3"),a("d3b7"),a("07ac"),a("ac1f"),a("25f0"),a("2532"),a("3ca3"),a("841c"),a("159b"),a("ddb0"),a("2b3d"),a("bf19"),a("9861"),a("2f62")),f=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"data-search"},[a("el-form",{staticClass:"demo-form-inline",attrs:{inline:!0,model:e.queryForm}},[a("el-form-item",{attrs:{label:"文件名:"}},[a("el-input",{attrs:{placeholder:"请填写文件名"},model:{value:e.queryForm.object_name,callback:function(t){e.$set(e.queryForm,"object_name",t)},expression:"queryForm.object_name"}})],1),a("el-form-item",{attrs:{label:"解析状态:"}},[a("el-select",{staticClass:"m-2",attrs:{clearable:"",placeholder:"请选择状态",size:"large"},model:{value:e.queryForm.run,callback:function(t){e.$set(e.queryForm,"run",t)},expression:"queryForm.run"}},e._l(e.categoryList,(function(e){return a("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1),a("el-form-item",{attrs:{label:"文件类型:"}},[a("el-select",{staticClass:"m-2",attrs:{clearable:"",placeholder:"请选择文件类型",size:"large"},model:{value:e.queryForm.type,callback:function(t){e.$set(e.queryForm,"type",t)},expression:"queryForm.type"}},e._l(e.typeList,(function(e){return a("el-option",{key:e,attrs:{label:e,value:e}})})),1)],1),a("el-form-item",[a("el-button",{attrs:{type:"primary"},on:{click:e.onSubmit}},[a("svg-icon",{attrs:{"icon-class":"search"}}),e._v(" 搜索")],1)],1),a("el-form-item",[a("el-button",{staticClass:"el-icon-circle-plus-outline",attrs:{type:"primary"},on:{click:e.addDocument}},[e._v("新增文件")])],1)],1),a("el-dialog",{attrs:{title:"创建知识库",visible:e.dialogVisible,width:"30%","before-close":e.handleClose},on:{"update:visible":function(t){e.dialogVisible=t}}},[a("el-form",{ref:"creatRef",attrs:{model:e.creatForm,rules:e.creatRules}},[a("el-form-item",{attrs:{label:"文件名称:",prop:"bucket_name"}},[a("el-input",{attrs:{placeholder:"请输入文件名称"},model:{value:e.creatForm.bucket_name,callback:function(t){e.$set(e.creatForm,"bucket_name",t)},expression:"creatForm.bucket_name"}})],1)],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:e.handleClose}},[e._v("取 消")]),a("el-button",{attrs:{type:"primary"},on:{click:e.submitBuck}},[e._v("确 定")])],1)],1),a("el-dialog",{attrs:{title:"上传文件",visible:e.uploadVisible,width:"30%","before-close":e.handleUploadClose},on:{"update:visible":function(t){e.uploadVisible=t}}},[a("el-form",{ref:"uploadRef",attrs:{model:e.uploadForm,rules:e.uploadRules}},[a("el-form-item",{attrs:{label:"选择目录:",prop:"doc_type_id"}},[a("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择目录",clearable:"",filterable:""},model:{value:e.uploadForm.doc_type_id,callback:function(t){e.$set(e.uploadForm,"doc_type_id",t)},expression:"uploadForm.doc_type_id"}},[e._l(e.folderList,(function(e){return a("el-option",{key:e.id,attrs:{label:e.name,value:e.id}})})),a("el-option",{attrs:{label:"其他",value:"0"}})],2)],1),a("el-form-item",[a("el-upload",{staticClass:"upload-demo custom-upload",attrs:{drag:"",action:e.url+"/minio/post",data:{bucket_id:e.queryForm.bucket_id,user_id:e.queryForm.user_id,doc_type_id:e.uploadForm.doc_type_id},multiple:"","on-change":e.handleFileChange,"file-list":e.fileList,"on-success":e.handleAvatarSuccess,"on-error":e.handleUploadError,disabled:!e.uploadForm.doc_type_id}},[a("i",{staticClass:"el-icon-upload"}),a("div",{staticClass:"el-upload__text"},[e._v(" 将文件拖到此处,或"),a("em",[e._v("点击上传")])])])],1)],1)],1)],1)},p=[],h=(a("00b4"),a("db6a")),b={props:{queryForm:{type:Object,default:function(){return{page:1,pageSize:10,bucket_id:"",user_id:""}}},currentFolderId:{type:[String,Number],default:""}},data:function(){return Object(u["a"])(Object(u["a"])(Object(u["a"])({statusOptions:[{value:"",label:"请选择状态"},{value:5,label:"启用"},{value:6,label:"停用"}],dialogVisible:!1,categoryList:[{value:"0",label:"未解析"},{value:"1",label:"解析中"},{value:"3",label:"成功"},{value:"4",label:"失败"},{value:"5",label:"待处理"}],creatForm:{bucket_name:""},creatRules:{bucket_name:[{required:!0,message:"请输入知识库名称",trigger:"blur"}]},uploadVisible:!1,uploadRules:{},uploadForm:{},fileList:[],url:"",typeList:[],typeForm:{page:1,pageSize:9999,kb_id:this.$route.query.id}},"uploadForm",{doc_type_id:""}),"uploadRules",{doc_type_id:[{required:!0,message:"请选择目录",trigger:"change"}]}),"folderList",[])},watch:{currentFolderId:{handler:function(e){this.uploadForm.doc_type_id="001"===e||""===e?"":Number(e)||""},immediate:!0}},mounted:function(){this.url="http://58.246.234.210:8084",this.queryForm.bucket_id=this.$route.query.id,this.queryForm.user_id=this.$store.state.user.id,this.getType()},methods:Object(u["a"])(Object(u["a"])({onCreate:function(e){this.dialogVisible=!0},onSubmit:function(){this.$emit("bindSetQuery",this.$props.queryForm)},addDocument:function(){this.uploadVisible=!0},newFile:function(){},handleClose:function(e){e()},submitBuck:function(){var e=this;this.$refs.creatRef.validate((function(t){t?createBucket(e.creatForm).then((function(t){200===t.status&&(e.dialogVisible=!1,e.onSubmit(),e.creatForm={})})):e.$message.error("请填写知识库名称")}))},handleUploadClose:function(e){e()},handleFileChange:function(e,t){var a=this;this.fileList=t.map((function(e){return e.uid||(e.uid=Date.now()+a.randomString()),e}))},randomString:function(){return Math.random().toString(36).substring(2,15)},handleRemove:function(e,t){this.fileList=t},handleAvatarSuccess:function(e,t,a){200==e.status?(this.$emit("bindSetQuery",this.$props.queryForm),this.$emit("refreshFolders"),this.$message.success("添加成功!"),this.uploadVisible=!1):(this.$message.warning(e.message),this.removeFile(a))},handleUploadError:function(e,t,a){this.$message.error("上传失败: "+e.message),this.removeFile(t)},removeFile:function(e){this.$refs.upload.handleRemove(e)}},"handleUploadClose",(function(){this.uploadVisible=!1,this.fileList=[]})),"getType",(function(){var e=this;Object(h["r"])().then((function(t){e.typeList=t.data})),Object(h["E"])(this.typeForm).then((function(t){200===t.status&&(e.folderList=t.data.dataList)}))}))},g=b,y=(a("56a0"),a("2877")),_=Object(y["a"])(g,f,p,!1,null,null,null),w=_.exports,v=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],staticClass:"data-list",attrs:{"element-loading-text":"加载中..."}},[a("div",{staticClass:"batch-actions",staticStyle:{margin:"10px 0"}},[a("el-button",{attrs:{type:"primary",disabled:!e.selectedRows.length},on:{click:e.batchAnalysis}},[e._v("批量解析")])],1),a("el-table",{ref:"dataTable",staticStyle:{width:"100%"},attrs:{data:e.dataList,"header-row-class-name":"headerBg","empty-text":"没有模板信息"},on:{"selection-change":e.handleSelectionChange,"sort-change":e.handleSortChange}},[a("el-table-column",{attrs:{type:"selection",width:"55"}}),a("el-table-column",{attrs:{prop:"id",label:"ID",align:"center",width:"80"}}),a("el-table-column",{attrs:{prop:"name",label:"文件名称",align:"center",sortable:""},scopedSlots:e._u([{key:"default",fn:function(t){return[a("span",[e._v(e._s(t.row.name))])]}}])}),a("el-table-column",{attrs:{prop:"type",label:"文件类型",align:"center"}}),a("el-table-column",{attrs:{prop:"chunk_num",label:"分块数",align:"center"}}),a("el-table-column",{attrs:{prop:"create_time",label:"上传时间",align:"center",sortable:""}}),a("el-table-column",{attrs:{prop:"run",label:"解析状态",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[0==t.row.run?a("div",[e._v("未解析")]):e._e(),1==t.row.run?a("div",[e._v("解析中")]):e._e(),3==t.row.run?a("div",[e._v("成功")]):e._e(),4==t.row.run?a("div",[e._v("失败")]):e._e(),5==t.row.run?a("div",[e._v("待处理")]):e._e(),6==t.row.run?a("div",[e._v("文件异常")]):e._e()]}}])}),a("el-table-column",{attrs:{label:"操作",align:"center",width:"330"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("div",{staticClass:"btns"},[a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"预览",placement:"top"}},[e.allowEdit?a("el-button",{staticStyle:{"font-size":"20px"},attrs:{type:"text",size:"small",circle:"",icon:"el-icon-view"},on:{click:function(a){return e.getName(t.row)}}}):e._e()],1),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"1"===t.row.run||"5"===t.row.run?"解析中":"解析",placement:"top"}},["1"!==t.row.run||"5"!==t.row.run?a("el-button",{staticStyle:{"font-size":"20px"},attrs:{type:"text",icon:"el-icon-caret-right",circle:""},on:{click:function(a){return e.analysis(t.row)}}}):a("el-button",{staticStyle:{"font-size":"20px"},attrs:{type:"text",icon:"el-icon-loading",circle:"",disabled:!0}})],1),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"解析方法",placement:"top"}},[e.allowEdit?a("el-button",{staticStyle:{"font-size":"20px"},attrs:{type:"text",size:"small",circle:"",icon:"el-icon-tickets"},on:{click:function(a){return e.Analytical(t.row)}}}):e._e()],1),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"修改文件名",placement:"top"}},[e.allowEdit?a("el-button",{staticStyle:{"font-size":"20px"},attrs:{type:"text",size:"small",circle:"",icon:"el-icon-edit"},on:{click:function(a){return e.btnEdit(t.row)}}}):e._e()],1),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"下载",placement:"top"}},[e.allowEdit?a("el-button",{staticStyle:{"font-size":"20px"},attrs:{type:"text",size:"small",circle:"",icon:"el-icon-download",loading:t.row.downloading},on:{click:function(a){return e.btnDown(t.row)}}}):e._e()],1),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"删除",placement:"top"}},[e.allowDelete?a("el-button",{staticStyle:{"font-size":"20px"},attrs:{type:"text",size:"small",circle:"",icon:"el-icon-delete"},on:{click:function(a){return e.btnDelete(t.row.id)}}}):e._e()],1)],1)]}}])})],1),a("div",{staticClass:"page-info"},[a("el-pagination",{attrs:{currentPage:e.queryForm.page,"page-size":e.queryForm.pageSize,total:e.recordCount,"page-count":e.pageTotal,"page-sizes":[10,20,50,100],background:"",layout:"sizes, prev, pager, next"},on:{"current-change":e.ChangePage,"size-change":e.handleSizeChange}})],1),a("el-dialog",{attrs:{title:"修改名称",visible:e.dialogVisible,width:"30%","before-close":e.handleClose},on:{"update:visible":function(t){e.dialogVisible=t}}},[a("el-form",{ref:"wordRef",attrs:{model:e.wordForm,rules:e.wordRules}},[a("el-form-item",{attrs:{label:"文件名称:",prop:"new_name"}},[a("el-input",{attrs:{placeholder:"请输入文件名称"},model:{value:e.wordForm.new_name,callback:function(t){e.$set(e.wordForm,"new_name",t)},expression:"wordForm.new_name"}})],1)],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:e.handleClose}},[e._v("取 消")]),a("el-button",{attrs:{type:"primary"},on:{click:e.submitBuck}},[e._v("确 定")])],1)],1),a("el-dialog",{attrs:{title:"解析方法",visible:e.anaDialogVisible,width:"30%","before-close":e.handleAnalClose},on:{"update:visible":function(t){e.anaDialogVisible=t}}},[a("el-form",{ref:"analRef",attrs:{model:e.analForm,"label-position":"top",rules:e.analRules}},[a("el-form-item",{attrs:{label:"页码范围:",prop:"new_name"}},[a("el-input-number",{attrs:{"controls-position":"right",min:1},model:{value:e.analForm.start_page,callback:function(t){e.$set(e.analForm,"start_page",t)},expression:"analForm.start_page"}}),a("el-input-number",{staticStyle:{"margin-left":"10px"},attrs:{"controls-position":"right",min:1},model:{value:e.analForm.end_page,callback:function(t){e.$set(e.analForm,"end_page",t)},expression:"analForm.end_page"}})],1),a("el-form-item",{attrs:{label:"块token数"}},[a("div",{staticClass:"block"},[a("el-slider",{attrs:{max:2048,"show-input":""},model:{value:e.analForm.token_num,callback:function(t){e.$set(e.analForm,"token_num",t)},expression:"analForm.token_num"}})],1)])],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:e.handleAnalClose}},[e._v("取 消")]),a("el-button",{attrs:{type:"primary"},on:{click:e.submitAnal}},[e._v("确 定")])],1)],1)],1)},F=[],k={props:{queryForm:{type:Object,default:function(){return{page:1,pageSize:10,id:""}}},allowEdit:{type:Boolean,default:!1},allowDelete:{type:Boolean,default:!1}},watch:{queryForm:{handler:function(e){this.search()},deep:!0}},data:function(){return Object(u["a"])(Object(u["a"])(Object(u["a"])(Object(u["a"])(Object(u["a"])(Object(u["a"])(Object(u["a"])(Object(u["a"])(Object(u["a"])(Object(u["a"])({loading:!1,dialogVisible:!1,currentDataId:0,recordCount:0,pageTotal:1,dataList:[],currentData:{}},"dialogVisible",!1),"wordForm",{document_id:"",new_name:""}),"wordRules",{new_name:[{required:!0,message:"请输入文件名称",trigger:"blur"}]}),"anaDialogVisible",!1),"analForm",{start_page:1,end_page:1e4,token_num:0}),"analRules",{}),"selectedRows",[]),"sortColumn",""),"sortOrder",""),"analysisStatusCheckers",{})},mounted:function(){this.search()},beforeDestroy:function(){Object.values(this.analysisStatusCheckers).forEach(clearTimeout)},methods:Object(u["a"])(Object(u["a"])(Object(u["a"])(Object(u["a"])({handleSortChange:function(e){var t=e.prop,a=e.order;this.sortColumn=t,this.sortOrder=a,this.sortData()},sortData:function(){var e=this.sortColumn,t=this.sortOrder;e&&t?this.dataList.sort((function(a,n){var o=0;return"name"===e?o=a.name.localeCompare(n.name,"zh-CN"):"create_time"===e&&(o=new Date(a.create_time)-new Date(n.create_time)),"ascending"===t?o:-o})):this.search()},handleSelectionChange:function(e){this.selectedRows=e},batchAnalysis:function(){var e=this,t=this.selectedRows.map((function(e){return e.id}));0!==t.length?this.$confirm("确定要批量解析选中的文件吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){e.loading=!0,Object(h["d"])({ids:JSON.stringify(t)}).then((function(a){200===a.status?(e.$message.success("批量解析任务已提交"),e.updateAnalysisStatus(t),e.clearSelection()):e.$message.error("批量解析请求失败")})).catch((function(t){console.error("批量解析错误:",t),e.$message.error("批量解析过程中出现错误")})).finally((function(){e.loading=!1}))})).catch((function(){})):this.$message.warning("请选择要解析的文件")},updateAnalysisStatus:function(e){var t=this;this.dataList.forEach((function(a){e.includes(a.id)&&(a.run=1,t.startAnalysisStatusChecker(a))}))},clearSelection:function(){this.$refs.dataTable.clearSelection(),this.selectedRows=[]},getName:function(e){var t=document.createElement("a");t.href="#/infoList?id=".concat(e.id,"&type=").concat(e.type),t.target="_blank",t.click()},analysis:function(e){var t=this;1!==e.run&&5!==e.run&&(this.$set(e,"run",1),Object(h["a"])({document_id:e.id,start_page:e.start_page||0,end_page:e.end_page||1e3,max_tokens:e.token_num}).then((function(a){200===a.status?t.startAnalysisStatusChecker(e):(t.$message.error("解析请求失败"),t.$set(e,"run",0))})).catch((function(a){console.error("解析错误:",a),t.$message.error("解析过程中出现错误"),t.$set(e,"run",0)})))},startAnalysisStatusChecker:function(e){var t=this;this.analysisStatusCheckers[e.id]&&clearTimeout(this.analysisStatusCheckers[e.id]);var a=function a(){Object(h["q"])({document_id:e.id}).then((function(n){if(200===n.status){var o=Number(n.data.run);t.$set(e,"run",o),3===o?(t.$message.success("解析成功"),delete t.analysisStatusCheckers[e.id]):4===o?(t.$message.error("解析失败"),delete t.analysisStatusCheckers[e.id]):1!==o&&5!==o||(t.analysisStatusCheckers[e.id]=setTimeout(a,5e3+5e3*Math.random()))}else t.$message.error("获取解析状态失败"),t.$set(e,"run",0),delete t.analysisStatusCheckers[e.id]})).catch((function(a){console.error("获取解析状态错误:",a),t.$message.error("获取解析状态时出现错误"),t.$set(e,"run",0),delete t.analysisStatusCheckers[e.id]}))};a()},handleAnalClose:function(){this.anaDialogVisible=!1},submitAnal:function(){var e=this;this.dataList.map((function(t){e.analForm.id==t.id&&(t.start_page=e.analForm.start_page,t.end_page=e.analForm.end_page,t.token_num=e.analForm.token_num)})),this.anaDialogVisible=!1},Analytical:function(e){this.analForm.id=e.id,this.analForm.token_num=e.token_num,this.anaDialogVisible=!0},editWidth:function(){return this.allowDelete&&this.allowEdit?200:this.allowDelete||this.allowEdit?120:100},onFocusVal:function(e){var t=this;t.currentDataId=e.target.dataset.id},onChangeVal:function(e){var t=this;t.currentDataId},btnDelete:function(e){var t=this,a={document_id:e};t.$confirm("您是否确认删除该记录?","提示",{confirmButtonText:"确认",cancelButtonText:"取消",type:"warning"}).then((function(e){Object(h["l"])(a).then((function(e){200===e.status&&(t.$message.success(e.data),t.search())}))})).catch((function(){}))},searchData:function(){var e=this;e.dialogVisible=!1,e.search()},handleClose:function(e){e()},btnEdit:function(e){this.wordForm.new_name=e.name,this.wordForm.document_id=e.id,this.dialogVisible=!0},submitBuck:function(){var e=this;this.$refs.wordRef.validate((function(t){t?Object(h["y"])(e.wordForm).then((function(t){200===t.status&&(e.search(),e.dialogVisible=!1,e.wordForm={new_name:"",document_id:""})})):e.$message.error("请填写文档名称")}))},btnDown:function(e){var t=this;this.$set(e,"downloading",!0),Object(h["x"])({document_id:e.id}).then((function(e){if(200===e.status)return fetch(e.data.url);t.$message.error("获取下载链接失败")})).then((function(e){return e.blob()})).then((function(t){var a=window.URL.createObjectURL(t),n=document.createElement("a");n.href=a,n.download=e.name,document.body.appendChild(n),n.click(),setTimeout((function(){document.body.removeChild(n),window.URL.revokeObjectURL(a)}),100)})).catch((function(e){console.error("下载出错:",e),t.$message.error("下载失败,请稍后重试")})).finally((function(){t.$set(e,"downloading",!1)}))}},"handleClose",(function(){var e=this;e.currentData={},e.dialogVisible=!1})),"search",(function(){var e=this;e.loading=!0,Object(h["p"])(e.queryForm).then((function(t){200===t.status&&(e.dataList=t.data.documents.map((function(t){return Object(d["a"])(Object(d["a"])({},t),{},{token_num:256,start_page:e.analForm.start_page,end_page:e.analForm.end_page})})),e.pageTotal=t.data.pagination.total_count,e.recordCount=t.data.pagination.total_count,e.queryForm.pageSize=t.data.pagination.total_size,e.loading=!1,e.dataList.forEach((function(t){console.log(t.run),"1"!==t.run&&"5"!==t.run||e.startAnalysisStatusChecker(t)})))})).catch((function(){e.loading=!1}))})),"ChangePage",(function(e){var t=this;t.queryForm.page=e,t.search()})),"handleSizeChange",(function(e){this.queryForm.pageSize=e,this.queryForm.page=1,this.search()}))},C=k,S=(a("e715"),Object(y["a"])(C,v,F,!1,null,null,null)),$=S.exports,O={components:{dataSearch:w,dataList:$},computed:Object(d["a"])({},Object(m["b"])(["roleInfo","authList"])),data:function(){return Object(u["a"])(Object(u["a"])(Object(u["a"])({queryForm:{page:1,pageSize:10,bucket_id:"",doc_type_id:0},typeForm:{page:1,pageSize:9999,kb_id:""},folders:[{id:"001",name:"全部",document_count:0}],defaultProps:{children:"children",label:"name"},loading:!1,dialogVisible:!1,currentDataId:0,recordCount:0,pageTotal:1,dataList:[],currentData:{},wordForm:{document_id:"",new_name:""},wordRules:{new_name:[{required:!0,message:"请输文件名称",trigger:"blur"}]},anaDialogVisible:!1,analForm:{start_page:1,end_page:1e4,token_num:512,language:"en"},analRules:{},selectedRows:[],sortColumn:"",sortOrder:"",analysisStatusCheckers:{},newFolderDialogVisible:!1,newFolderForm:{name:"",kb_id:"",status:5},newFolderRules:{name:[{required:!0,message:"请输入文件夹名称",trigger:"blur"}]},batchModifyFolderDialogVisible:!1,batchModifyFolderForm:{folderId:null},batchModifyFolderRules:{folderId:[{required:!0,message:"请选择目标目录",trigger:"change"}]}},"selectedRows",[]),"allSelectedRows",new Map),"isAllDataSelected",!1)},mounted:function(){this.queryForm.bucket_id=this.$route.query.id,this.typeForm.kb_id=this.$route.query.id,this.typeList()},beforeDestroy:function(){Object.values(this.analysisStatusCheckers).forEach(clearTimeout)},methods:(n={getRowKey:function(e){return e.id},handleBatchCommand:function(e){switch(e){case"analysis":this.batchAnalysis();break;case"modifyFolder":this.batchModifyFolder();break;case"delete":this.batchDelect();break}},getProgressStatus:function(e){if(e>=100)return"success"},handleCommand:function(e,t){switch(e){case"analysis":this.analysis(t);break;case"analyticalMethod":this.Analytical(t);break;case"download":this.btnDown(t);break;case"delete":this.btnDelete(t.id);break}},getStatusType:function(e){var t={0:"info",1:"warning",3:"success",4:"danger",5:"info",6:"danger"};return t[e]||"info"},getStatusText:function(e){var t={0:"未解析",1:"解析中",3:"解析成功",4:"解析失败",5:"待解析",6:"文件异常"};return t[e]||"未知状态"},getFileCountClass:function(e){var t=0===e||"001"===e;return console.log("ID: ".concat(e,", Class: ").concat(t?"file-counts":"file-count")),t?"file-counts":"file-count"},batchModifyFolder:function(){0!==this.selectedRows.length?this.batchModifyFolderDialogVisible=!0:this.$message.warning("请选择要修改目录的文件")},submitBatchModifyFolder:function(){var e=this;this.$refs.batchModifyFolderFormRef.validate((function(t){if(t){var a=e.selectedRows.map((function(e){return e.id}));console.log(a),Object(h["e"])({ids:JSON.stringify(a),doc_type_id:e.batchModifyFolderForm.folderId}).then((function(t){200===t.status?(e.$message.success("批量修改目录成功"),e.batchModifyFolderDialogVisible=!1,e.search(),e.typeList(),e.clearSelection()):e.$message.error("批量修改目录失败")})).catch((function(t){console.error("批量修改目录时出错:",t),e.$message.error("批量修改目录时出错")}))}}))},editFolder:function(e){var t=this;this.$prompt("请输入新的文件夹名称","编辑文件夹",{confirmButtonText:"确定",cancelButtonText:"取消",inputValue:e.name,inputValidator:function(e){return!!e||"文件夹名称不能为空"}}).then((function(a){var n=a.value;if(n!==e.name){var o=Object(d["a"])(Object(d["a"])({},e),{},{name:n});Object(h["J"])(o).then((function(e){200===e.status?(t.$message.success("更新文件夹成功"),t.typeList()):t.$message.error("更新文件夹失败")})).catch((function(e){console.error("更新文件夹时出错:",e),t.$message.error("更新文件夹时出错")}))}})).catch((function(){}))},deleteFolder:function(e){var t=this;this.$confirm("确定要删除该文件夹吗?删除后无法恢复。","警告",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){Object(h["m"])({id:e}).then((function(e){200===e.status?(t.$message.success("删除文件夹成功"),t.typeList()):t.$message.error("删除文件夹失败")})).catch((function(e){console.error("删除文件夹时出错:",e),t.$message.error("删除文件夹时出错")}))})).catch((function(){}))},typeList:function(){var e=this;this.loading=!0,Promise.all([Object(h["E"])(this.typeForm),Object(h["D"])({kb_id:this.typeForm.kb_id,type_id:0})]).then((function(t){var a=Object(c["a"])(t,2),n=a[0],o=a[1];if(200===n.status&&200===o.status){var i=n.data.dataList.map((function(e){return Object(d["a"])(Object(d["a"])({},e),{},{id:0===e.id?"001":e.id.toString(),document_count:e.document_count||0})})),r=i.reduce((function(e,t){return e+t.document_count}),0),s=o.data||0;e.folders=[{id:"001",name:"全部",document_count:r+s}].concat(Object(l["a"])(i.filter((function(e){return"001"!==e.id&&0!==e.id}))),[{id:0,name:"其他",document_count:s}]),e.$nextTick((function(){e.$refs.folderTree&&(e.$refs.folderTree.setCurrentKey("001"),e.queryForm.doc_type_id="",e.search())}))}else e.$message.error("获取文件夹列表败")})).catch((function(t){console.error("获取文件夹列表时出错:",t),e.$message.error("获取文件夹列表时出错")})).finally((function(){e.loading=!1}))},createNewFolder:function(){this.newFolderDialogVisible=!0},submitNewFolder:function(){var e=this;this.$refs.newFolderFormRef.validate((function(t){t&&(e.newFolderForm.kb_id=e.$route.query.id,Object(h["t"])(e.newFolderForm).then((function(t){200===t.status?(e.$message.success("创建文件夹成功"),e.newFolderDialogVisible=!1,e.$refs.newFolderFormRef.resetFields(),e.typeList()):e.$message.error("创建文件夹失败")})))}))},initializeTree:function(){var e=this;this.$nextTick((function(){e.$refs.folderTree&&e.$refs.folderTree.setCurrentKey("001")}))},checkAuth:function(e){return 1===this.roleInfo.is_admin||this.authList.some((function(t){return 999===t.type&&t.path===e}))},setQuery:function(e){this.queryForm=Object(d["a"])(Object(d["a"])({},this.queryForm),e),this.search()},handleNodeClick:function(e){this.queryForm.doc_type_id="001"===e.id?"":e.id,this.queryForm.page=1,this.search()},handleSortChange:function(e){var t=e.prop,a=e.order;this.sortColumn=t,this.sortOrder=a,this.sortData()},sortData:function(){var e=this.sortColumn,t=this.sortOrder;e&&t?this.dataList.sort((function(a,n){var o=0;return"name"===e?o=a.name.localeCompare(n.name,"zh-CN"):"create_time"===e&&(o=new Date(a.create_time)-new Date(n.create_time)),"ascending"===t?o:-o})):this.search()},handleSelectionChange:function(e){var t=this;this.isAllDataSelected||(this.dataList.forEach((function(a){e.find((function(e){return e.id===a.id}))?t.allSelectedRows.set(a.id,a):t.allSelectedRows.delete(a.id)})),this.selectedRows=Array.from(this.allSelectedRows.values()))},handleSelectAllData:function(){var e=this;return Object(s["a"])(Object(r["a"])().mark((function t(){var a,n,o;return Object(r["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,a=Object(d["a"])(Object(d["a"])({},e.queryForm),{},{page:1,page_size:e.recordCount}),t.next=4,Object(h["p"])(a);case 4:n=t.sent,200===n.status&&(o=n.data.documents,e.allSelectedRows.clear(),o.forEach((function(t){e.allSelectedRows.set(t.id,t)})),e.isAllDataSelected=!0,e.selectedRows=o,e.$nextTick((function(){e.$refs.dataTable&&e.dataList.forEach((function(t){e.$refs.dataTable.toggleRowSelection(t,!0)}))})),e.$message.success("已选中全部".concat(e.recordCount,"条数据"))),t.next=12;break;case 8:t.prev=8,t.t0=t["catch"](0),console.error("获取全部数据失败:",t.t0),e.$message.error("选择全部数据失败");case 12:case"end":return t.stop()}}),t,null,[[0,8]])})))()},handleCancelAllSelection:function(){this.clearSelection(),this.isAllDataSelected=!1,this.$message.info("已取消全部选择")},clearSelection:function(){this.$refs.dataTable&&this.$refs.dataTable.clearSelection(),this.selectedRows=[],this.allSelectedRows.clear(),this.isAllDataSelected=!1},ChangePage:function(e){var t=this;this.queryForm.page=e,this.search().then((function(){t.$nextTick((function(){t.$refs.dataTable&&t.dataList.forEach((function(e){(t.isAllDataSelected||t.allSelectedRows.has(e.id))&&t.$refs.dataTable.toggleRowSelection(e,!0)}))}))}))},batchAnalysis:function(){var e=this,t=this.selectedRows.map((function(e){return e.id}));0!==t.length?this.$confirm("确定要批量解析选中的文件吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){e.loading=!0,Object(h["b"])({document_ids:JSON.stringify(t),ocr_params:{language:e.analForm.language,max_retries:3,timeout:[10,180]}}).then((function(a){200===a.status?(e.$message.success("批量解析任务已提交"),setTimeout((function(){e.updateAnalysisStatus(t)}),5e3),e.clearSelection()):e.$message.error("批量解析请求失败")})).catch((function(t){console.error("批量解析错误:",t),e.$message.error("批量解析过程中出错误")})).finally((function(){e.loading=!1}))})).catch((function(){})):this.$message.warning("请选择要解析的文件")},batchDelect:function(){var e=this,t=this.selectedRows.map((function(e){return e.id}));0!==t.length?this.$confirm("确定要批量删除选中的文件吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){e.loading=!0,Object(h["i"])({document_ids:JSON.stringify(t)}).then((function(t){200===t.status?(e.$message.success("批量删除已完成"),e.search()):e.$message.error("批量删除请求失败")})).catch((function(e){})).finally((function(){e.loading=!1}))})).catch((function(){})):this.$message.warning("请选择要删除的文件")},updateAnalysisStatus:function(e){var t=this;this.dataList.forEach((function(a){e.includes(a.id)&&(a.run=1,t.startAnalysisStatusChecker(a))}))}},Object(u["a"])(Object(u["a"])(Object(u["a"])(Object(u["a"])(Object(u["a"])(Object(u["a"])(Object(u["a"])(Object(u["a"])(Object(u["a"])(Object(u["a"])(n,"clearSelection",(function(){this.$refs.dataTable.clearSelection(),this.selectedRows=[]})),"getName",(function(e){var t=document.createElement("a");t.href="#/infoList?id=".concat(e.id,"&type=").concat(e.type.toLowerCase()),t.target="_blank",t.click()})),"endAnalysis",(function(){var e=this;Object(h["o"])().then((function(t){200===t.status&&e.search()}))})),"analysis",(function(e){var t,a,n=this;if(1!=e.run&&5!=e.run){this.$set(e,"run",1);var o={document_ids:JSON.stringify([e.id]),start_page:null!==(t=e.start_page)&&void 0!==t?t:0,end_page:null!==(a=e.end_page)&&void 0!==a?a:1e3,max_tokens:e.token_num,ocr_params:{language:this.analForm.language,max_retries:3,timeout:[10,180]}};Object(h["b"])(o).then((function(t){200===t.status?(n.$set(e,"progress",0),setTimeout((function(){n.startAnalysisStatusChecker(e)}),5e3)):(n.$message.error("解析请求失败"),n.$set(e,"run",0))})).catch((function(t){console.error("解析错误:",t),n.$message.error("解析过程中出现错误"),n.$set(e,"run",0)}))}})),"startAnalysisStatusChecker",(function(e){var t=this;this.analysisStatusCheckers[e.id]&&clearTimeout(this.analysisStatusCheckers[e.id]);var a=function a(){Object(h["A"])(e.id).then((function(n){if(200===n.status){var o=Number(n.data.document_status),i=100==Number(n.data.progress)?0:Number(n.data.progress),r=n.data.progress_msg;t.$set(e,"run",o),t.$set(e,"progress",i),t.$set(e,"progress_msg",r),3===o?(t.$message.success("解析成功"),delete t.analysisStatusCheckers[e.id],t.refreshCurrentList()):4===o?(t.$message.error("解析失败"),delete t.analysisStatusCheckers[e.id]):1!==o&&5!==o||(t.analysisStatusCheckers[e.id]=setTimeout(a,15e3))}else t.$message.error("获取解析状态失败"),delete t.analysisStatusCheckers[e.id]})).catch((function(a){console.error("获取解析状态错误:",a),t.$message.error("获取解析状态时出现错误"),delete t.analysisStatusCheckers[e.id]}))};a()})),"refreshCurrentList",(function(){var e=this,t=this.queryForm.page,a=this.queryForm.pageSize;return this.search().then((function(){e.queryForm.page=t,e.queryForm.pageSize=a})).catch((function(t){console.error("刷新列表时出错:",t),e.$message.error("刷新列表失败,请稍后重试")}))})),"handleAnalClose",(function(){this.anaDialogVisible=!1})),"submitAnal",(function(){var e=this;this.dataList.map((function(t){e.analForm.id==t.id&&(t.language=e.analForm.language,t.start_page=e.analForm.start_page,t.end_page=e.analForm.end_page,t.token_num=e.analForm.token_num)})),this.anaDialogVisible=!1})),"Analytical",(function(e){this.analForm.id=e.id,this.analForm.token_num=e.token_num,this.anaDialogVisible=!0})),"editWidth",(function(){return this.allowDelete&&this.allowEdit?200:this.allowDelete||this.allowEdit?120:100})),Object(u["a"])(Object(u["a"])(Object(u["a"])(Object(u["a"])(Object(u["a"])(Object(u["a"])(Object(u["a"])(Object(u["a"])(Object(u["a"])(Object(u["a"])(n,"onFocusVal",(function(e){var t=this;t.currentDataId=e.target.dataset.id})),"onChangeVal",(function(e){var t=this;t.currentDataId})),"btnDelete",(function(e){var t=this,a={document_id:e};t.$confirm("您是否确认删除该记录?","提示",{confirmButtonText:"确认",cancelButtonText:"取消",type:"warning"}).then((function(e){Object(h["l"])(a).then((function(e){200===e.status&&(t.$message.success(e.data),t.search())}))})).catch((function(){}))})),"searchData",(function(){var e=this;e.dialogVisible=!1,e.search()})),"handleClose",(function(e){e()})),"btnEdit",(function(e){this.wordForm.new_name=e.name,this.wordForm.document_id=e.id,this.dialogVisible=!0})),"submitBuck",(function(){var e=this;this.$refs.wordRef.validate((function(t){t?Object(h["y"])(e.wordForm).then((function(t){200===t.status&&(e.search(),e.dialogVisible=!1,e.wordForm={new_name:"",document_id:""})})):e.$message.error("请填写文档名称")}))})),"btnDown",(function(e){var t=this;this.$set(e,"downloading",!0),Object(h["x"])({document_id:e.id}).then((function(e){if(200===e.status)return fetch(e.data.url);t.$message.error("获取下载链接失败")})).then((function(e){return e.blob()})).then((function(t){var a=window.URL.createObjectURL(t),n=document.createElement("a");n.href=a,n.download=e.name,document.body.appendChild(n),n.click(),setTimeout((function(){document.body.removeChild(n),window.URL.revokeObjectURL(a)}),100)})).catch((function(e){console.error("下载出错:",e),t.$message.error("下载失败,请稍后重试")})).finally((function(){t.$set(e,"downloading",!1)}))})),"handleClose",(function(){var e=this;e.currentData={},e.dialogVisible=!1})),"search",(function(){var e=this;return e.loading=!0,new Promise((function(t,a){Object(h["p"])(e.queryForm).then((function(n){if(200===n.status){e.dataList=n.data.documents.map((function(t){return Object(d["a"])(Object(d["a"])({},t),{},{token_num:512,start_page:e.analForm.start_page,end_page:e.analForm.end_page})}));var o=e.dataList.filter((function(e){return 4===Number(e.run)}));o.length>0&&Promise.all(o.map((function(t){return Object(h["A"])(t.id).then((function(a){if(200===a.status){var n=e.dataList.findIndex((function(e){return e.id===t.id}));-1!==n&&e.$set(e.dataList[n],"progress_msg",a.data.progress_msg)}})).catch((function(e){console.error("获取文档 ".concat(t.id," 的失败原因时出错:"),e)}))}))),e.pageTotal=n.data.pagination.total_count,e.recordCount=n.data.pagination.total_count,e.queryForm.pageSize=n.data.pagination.total_size,e.loading=!1,e.dataList.forEach((function(t){1!=t.run&&5!=t.run||e.startAnalysisStatusChecker(t)})),t()}else a(new Error("Invalid response status"))})).catch((function(t){e.loading=!1,a(t)}))}))})),Object(u["a"])(Object(u["a"])(n,"handleSizeChange",(function(e){var t=this;this.queryForm.pageSize=e,this.queryForm.page=1,this.search().then((function(){t.$nextTick((function(){t.dataList.forEach((function(e){t.pageSelected.has(e.id)&&t.$refs.dataTable.toggleRowSelection(e,!0)}))}))}))})),"percentFormat",(function(e){return"".concat(e,"%")})))},x=O,j=(a("93e2"),Object(y["a"])(x,o,i,!1,null,"d07b60a4",null));t["default"]=j.exports}}]);
|