1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-55bb6aee"],{"13f0":function(e,t,a){"use strict";a("a551")},1859:function(e,t,a){"use strict";a("4821")},4821:function(e,t,a){},"6dd3":function(e,t,a){"use strict";a("af7b")},a551:function(e,t,a){},af7b:function(e,t,a){},db6a:function(e,t,a){"use strict";a.d(t,"d",(function(){return o})),a.d(t,"a",(function(){return i})),a.d(t,"c",(function(){return r})),a.d(t,"b",(function(){return l})),a.d(t,"e",(function(){return c})),a.d(t,"f",(function(){return s})),a.d(t,"g",(function(){return u}));var n=a("b775");function o(e){return Object(n["a"])({url:"/minio/listBuckets",method:"post",data:e})}function i(e){return Object(n["a"])({url:"/minio/createBucket",method:"post",data:e})}function r(e){return Object(n["a"])({url:"/minio/getBucketContents",method:"post",data:e})}function l(e){return Object(n["a"])({url:"/minio/deleteFile",method:"post",data:e})}function c(e){return Object(n["a"])({url:"/minio/nameGetUrl",method:"post",data:e})}function s(e){return Object(n["a"])({url:"/minio/post",method:"post",data:e})}function u(e){return Object(n["a"])({url:"/minio/renameFile",method:"post",data:e})}},ed61:function(e,t,a){"use strict";a.r(t);var n=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"project-search"},[a("dataSearch",{on:{bindSetQuery:e.setQuery}}),a("dataList",{attrs:{queryForm:e.queryForm,allowEdit:e.checkAuth("/document/update"),allowDelete:e.checkAuth("/document/delete")}})],1)},o=[],i=a("5530"),r=a("2f62"),l=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",[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-popover",{attrs:{placement:"bottom",trigger:"click"}},[a("el-button",{on:{click:e.addDocument}},[e._v("本地文件")]),a("el-button",{on:{click:e.newFile}},[e._v("新建空文件")]),a("el-button",{staticClass:"el-icon-circle-plus-outline",attrs:{slot:"reference",type:"primary"},slot:"reference"},[e._v(" 新增文件")])],1)],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",[a("el-upload",{staticClass:"upload-demo",attrs:{drag:"",action:e.url+"/minio/post",data:{bucket_name:e.queryForm.bucket_name},multiple:"","on-change":e.handleFileChange,"file-list":e.fileList,"on-success":e.handleAvatarSuccess}},[a("i",{staticClass:"el-icon-upload"}),a("div",{staticClass:"el-upload__text"},[e._v(" 将文件拖到此处,或"),a("em",[e._v("点击上传")])]),a("div",{staticClass:"el-upload__tip",attrs:{slot:"tip"},slot:"tip"},[e._v(" 只能上传jpg/png文件,且不超过500kb ")])])],1)],1)],1)],1)},c=[],s=a("ade3"),u=(a("d81d"),a("ac1f"),a("00b4"),a("db6a")),d={props:{queryForm:{type:Object,default:function(){return{page:1,pageSize:10,bucket_name:"",object_name:""}}}},data:function(){var e=function(e,t,a){var n=/^[a-z0-9-]{3,63}$/;n.test(t)?a():a(new Error("名称必须在 3-63 个字符之间,只能包含小写字母、数字和连字符"))};return{statusOptions:[{value:"",label:"请选择状态"},{value:5,label:"启用"},{value:6,label:"停用"}],dialogVisible:!1,categoryList:[],creatForm:{bucket_name:""},creatRules:{bucket_name:[{required:!0,message:"请输入知识库名称",trigger:"blur"},{validator:e,trigger:"blur"}]},uploadVisible:!1,uploadRules:{},uploadForm:{},fileList:[],url:""}},mounted:function(){this.url="http://120.46.190.49:8000",this.queryForm.bucket_name=this.$route.query.bucket_name},methods:Object(s["a"])(Object(s["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){console.log(e),this.fileList=t.map((function(e){return e.raw}))},handleRemove:function(e,t){this.fileList=t},handleAvatarSuccess:function(e,t){this.$emit("bindSetQuery",this.$props.queryForm)},submitUpload:function(){console.log("Files to upload:",this.fileList),this.uploadVisible=!1,this.fileList=[]}},"handleUploadClose",(function(){this.uploadVisible=!1,this.fileList=[]})),"submitUpload",(function(){var e=this;this.fileList.map((function(t){Object(u["f"])({bucket_name:e.queryForm.bucket_name,file:t}).then((function(e){console.log(e)}))}))}))},m=d,b=(a("13f0"),a("2877")),f=Object(b["a"])(m,l,c,!1,null,null,null),p=f.exports,h=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("el-table",{staticStyle:{width:"100%"},attrs:{data:e.dataList,"header-row-class-name":"headerBg","empty-text":"没有模板信息"}},[a("el-table-column",{attrs:{prop:"id",label:"ID",align:"center",width:"80"}}),a("el-table-column",{attrs:{prop:"object_name",label:"文件名称",align:"center"}}),a("el-table-column",{attrs:{prop:"size",label:"分块数",align:"center"}}),a("el-table-column",{attrs:{prop:"last_modified",label:"上传时间",align:"center"}}),a("el-table-column",{attrs:{prop:"",label:"解析方法",align:"center"}}),a("el-table-column",{attrs:{prop:"createTime",label:"启用",align:"center"}}),a("el-table-column",{attrs:{prop:"status",label:"解析状态",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[5==t.row.status?a("div",[e._v("启用")]):e._e(),6==t.row.status?a("div",[e._v("停用")]):e._e()]}}])}),a("el-table-column",{attrs:{label:"操作",align:"center",width:"300"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("div",{staticClass:"btns"},[e.allowEdit?a("el-button",{attrs:{type:"primary",size:"small"},on:{click:function(a){return e.btnEdit(t.row.object_name)}}},[a("svg-icon",{attrs:{"icon-class":"edit"}}),e._v("修改文件名")],1):e._e(),e.allowEdit?a("el-button",{attrs:{type:"primary",size:"small"},on:{click:function(a){return e.btnDown(t.row.object_name)}}},[a("svg-icon",{attrs:{"icon-class":"edit"}}),e._v("下载")],1):e._e(),e.allowDelete?a("el-button",{attrs:{type:"danger",size:"small"},on:{click:function(a){return e.btnDelete(t.row.object_name)}}},[a("svg-icon",{attrs:{"icon-class":"delete"}}),e._v("删除")],1):e._e()],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,background:"",layout:"prev, pager, next"},on:{"current-change":e.ChangePage}})],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)],1)},g=[],_=(a("d3b7"),a("3ca3"),a("841c"),a("ddb0"),a("2b3d"),a("bf19"),a("9861"),{props:{queryForm:{type:Object,default:function(){return{page:1,pageSize:10,bucket_name:""}}},allowEdit:{type:Boolean,default:!1},allowDelete:{type:Boolean,default:!1}},watch:{queryForm:{handler:function(e){this.search()},deep:!0}},data:function(){var e=function(e,t,a){var n=/^[a-z0-9-]{3,63}$/;n.test(t)?a():a(new Error("名称必须在 3-63 个字符之间,只能包含小写字母、数字和连字符"))};return Object(s["a"])(Object(s["a"])(Object(s["a"])({loading:!1,dialogVisible:!1,currentDataId:0,recordCount:0,pageTotal:1,dataList:[],currentData:{}},"dialogVisible",!1),"wordForm",{bucket_name:this.$route.query.bucket_name,object_name:"",new_name:""}),"wordRules",{new_name:[{required:!0,message:"请输入文件名称",trigger:"blur"},{validator:e,trigger:"blur"}]})},mounted:function(){this.search()},methods:Object(s["a"])(Object(s["a"])(Object(s["a"])({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={bucket_name:this.$route.query.bucket_name,object_name:e};t.$confirm("您是否确认删除该记录?","提示",{confirmButtonText:"确认",cancelButtonText:"取消",type:"warning"}).then((function(e){Object(u["b"])(a).then((function(e){t.search()}))})).catch((function(){}))},searchData:function(){var e=this;e.dialogVisible=!1,e.search()},handleClose:function(e){e()},btnEdit:function(e){this.wordForm.object_name=e,this.dialogVisible=!0},submitBuck:function(){var e=this;this.$refs.wordRef.validate((function(t){t?Object(u["g"])(e.wordForm).then((function(t){200===t.status&&(e.search(),e.dialogVisible=!1,e.wordForm={})})):e.$message.error("请填写文档名称")}))},btnDown:function(e){var t=this;Object(u["e"])({bucket_name:this.$route.query.bucket_name,object_name:e}).then((function(a){200===a.status?fetch(a.data.url).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,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("下载失败,请稍后重试")})):t.$message.error("获取下载链接失败")})).catch((function(e){console.error("获取下载链接出错:",e),t.$message.error("获取下载链接失败,请稍后重试")}))}},"handleClose",(function(){var e=this;e.currentData={},e.dialogVisible=!1})),"search",(function(){var e=this;e.loading=!0,Object(u["c"])(e.queryForm).then((function(t){200===t.status&&(e.dataList=t.data.files,e.pageTotal=t.data.total_count,e.loading=!1)})).catch((function(){e.loading=!1}))})),"ChangePage",(function(e){var t=this;t.queryForm.page=e,t.search()}))}),v=_,w=(a("1859"),Object(b["a"])(v,h,g,!1,null,null,null)),k=w.exports,y={components:{dataSearch:p,dataList:k},computed:Object(i["a"])({},Object(r["b"])(["roleInfo","authList"])),data:function(){return{queryForm:{page:1,pageSize:10,bucket_name:""}}},mounted:function(){this.queryForm.bucket_name=this.$route.query.bucket_name},methods:{checkAuth:function(e){return this.roleInfo.is_admin,!0},setQuery:function(e){this.queryForm=e}}},F=y,j=(a("6dd3"),Object(b["a"])(F,n,o,!1,null,null,null));t["default"]=j.exports}}]);
|