1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2a8c4ce9"],{"0020":function(t,e,i){"use strict";i("01d6")},"01d6":function(t,e,i){},d823:function(t,e,i){"use strict";i.r(e);var a=function(){var t=this,e=t.$createElement,i=t._self._c||e;return"xls"!==t.type?i("div",{staticClass:"project-search"},[0!==t.dataList.length?i("div",{ref:"scrollContainer",staticStyle:{width:"50%",height:"calc(100vh - 30px)",overflow:"auto",position:"relative"},on:{scroll:t.handleScroll}},[t._l(t.dataList,(function(e){return i("div",{key:e.id,staticClass:"listClass"},[i("span",{staticStyle:{padding:"0px 10px 10px 0",cursor:"pointer"}},[t._v(t._s(e.page_number))]),i("div",{staticStyle:{"margin-bottom":"20px"},on:{click:function(i){return t.scrollToPage(e.page_number,e.coordinate)}}},[""==e.url||null==e.url?i("span",[t._v(t._s(e.content))]):i("img",{attrs:{src:e.url,alt:""}})])])})),i("el-dialog",{attrs:{visible:t.imagePreviewVisible,"append-to-body":"",modal:!1,"close-on-click-modal":!1,"custom-class":"movable-dialog",title:"图片预览"},on:{"update:visible":function(e){t.imagePreviewVisible=e}}},[i("img",{staticStyle:{width:"100%"},attrs:{src:t.previewImageUrl,alt:"Preview"}})]),t.loading?i("div",{staticClass:"loading-more"},[t._v("加载中...")]):t._e()],2):i("div",{staticStyle:{width:"50%","font-size":"25px",margin:"300px auto",color:"#909399","text-align":"center"}},[t._v(" 暂无解析数据 ")]),i("div",{staticStyle:{width:"50%"}},[i("file-preview",{ref:"filePreview",attrs:{"file-url":t.documentUrl,"file-type":t.type,type:t.type,pageNum:t.pdfPageNum,coordinate:t.pdfCoordinate}})],1)]):i("div",[t.excelDataList.length>0?i("div",{staticClass:"excel-table"},t._l(t.excelDataList,(function(e,a){return i("div",{key:a},[i("table",[i("thead",[i("tr",t._l(e.data[0],(function(e,a){return i("th",{key:a},[t._v(" "+t._s(e)+" ")])})),0)]),i("tbody",t._l(e.data.slice(1),(function(e,a){return i("tr",{key:a},t._l(e,(function(e,a){return i("td",{key:a},[t._v(" "+t._s(e)+" ")])})),0)})),0)])])})),0):i("div",{staticClass:"no-data"},[t._v("暂无数据")])])},n=[],o=i("2909"),r=i("5530"),l=(i("99af"),i("4de4"),i("caad"),i("d81d"),i("fb6a"),i("d3b7"),i("ac1f"),i("2532"),i("466d"),i("5319"),i("841c"),i("2ca0"),i("498a"),i("2f62")),s=i("db6a"),c=(i("f7e6"),i("3be9")),u={components:{FilePreview:c["default"]},computed:Object(r["a"])(Object(r["a"])({},Object(l["b"])(["roleInfo","authList"])),{},{paginatedDataList:function(){var t=(this.queryForm.page-1)*this.queryForm.page_size,e=t+this.queryForm.page_size;return this.dataList.slice(t,e)}}),data:function(){return{queryForm:{page:1,page_size:30,document_id:""},dataList:[],conten:"",documentUrl:"",type:"",excelDataList:[],isFileViewable:!1,supportedFileTypes:["pdf","doc","docx","xls","xlsx","ppt","pptx","txt","jpg","jpeg","png","gif"],total:0,imagePreviewVisible:!1,previewImageUrl:"",pdfPageNum:"",pdfCoordinate:"",loading:!1,hasMore:!0,totalPages:0}},mounted:function(){this.queryForm.document_id=this.$route.query.id,this.type=this.$route.query.type,this.checkFileType(),this.search(),this.$nextTick(this.makeDialogDraggable)},methods:{makeDialogDraggable:function(){this.$nextTick((function(){var t=document.querySelector(".movable-dialog .el-dialog__header"),e=document.querySelector(".movable-dialog");if(t&&e){t.style.cursor="move",e.style.position="absolute";var i=e.currentStyle||window.getComputedStyle(e,null);t.onmousedown=function(a){var n,o,r=a.clientX-t.offsetLeft,l=a.clientY-t.offsetTop;i.left.includes("%")?(n=+document.body.clientWidth*(+i.left.replace(/\%/g,"")/100),o=+document.body.clientHeight*(+i.top.replace(/\%/g,"")/100)):(n=+i.left.replace(/\px/g,""),o=+i.top.replace(/\px/g,"")),document.onmousemove=function(t){var i=t.clientX-r,a=t.clientY-l;e.style.left="".concat(i+n,"px"),e.style.top="".concat(a+o,"px")},document.onmouseup=function(t){document.onmousemove=null,document.onmouseup=null}}}}))},openImagePreview:function(t){var e=this;this.previewImageUrl=t,this.imagePreviewVisible=!0,this.$nextTick((function(){setTimeout(e.makeDialogDraggable,100)}))},handleCurrentChange:function(t){this.queryForm.page=t,this.search()},checkAuth:function(t){return this.roleInfo.is_admin,!0},checkFileType:function(){this.isFileViewable=this.supportedFileTypes.includes(this.type)},search:function(){var t=this;this.loading=!0,this.queryForm.page=1,this.hasMore=!0,this.dataList=[],this.totalPages=0,Object(s["db"])(this.queryForm).then((function(e){t.dataList=e.data.tasks,t.total=e.data.pagination.total_count,t.totalPages=e.data.pagination.num_pages,t.totalPages<=1&&(t.hasMore=!1),t.isFileViewable&&(t.documentUrl=e.data.documentUrl)})).catch((function(t){console.error("获取数据时出错:",t)})).finally((function(){t.loading=!1}))},parseExcelData:function(t){return t.filter((function(t){return t.content})).map((function(t,e){var i=t.content;if("string"!==typeof i)return null;var a=i.match(/^#.*?\n/);a&&(i=i.slice(a[0].length));var n=i.split("\n").map((function(t){return t.trim()})).filter((function(t){return""!==t})).filter((function(t){return!t.match(/^\|[-:]+\|[-:]+\|$/)})).map((function(t){return t.split("|").map((function(t){return t.trim()})).filter((function(t){return""!==t}))}));return n.length>0&&n[0].some((function(t){return t.startsWith("Unnamed:")}))&&n.shift(),{title:t.title||"Sheet ".concat(e+1),data:n}})).filter((function(t){return null!==t&&t.data.length>0}))},scrollToPage:function(t,e){if(t){this.pdfPageNum=t,this.pdfCoordinate=e;var i=this.$refs.filePreview;i&&i.scrollToPage(t)}},handleScroll:function(){var t=this.$refs.scrollContainer;if(t){var e=100,i=t.scrollHeight-t.scrollTop-t.clientHeight;i<e&&!this.loading&&this.hasMore&&this.loadMore()}},loadMore:function(){var t=this;!this.loading&&this.hasMore&&(this.totalPages&&this.queryForm.page>=this.totalPages?this.hasMore=!1:(this.loading=!0,this.queryForm.page+=1,Object(s["db"])(this.queryForm).then((function(e){var i=e.data.tasks;t.totalPages=e.data.pagination.num_pages,i&&i.length>0&&(t.dataList=[].concat(Object(o["a"])(t.dataList),Object(o["a"])(i))),t.queryForm.page>=t.totalPages&&(t.hasMore=!1),t.total=e.data.pagination.total_count})).catch((function(e){console.error("加载更多数据时出错:",e),t.queryForm.page-=1})).finally((function(){t.loading=!1}))))}}},d=u,p=(i("0020"),i("2877")),h=Object(p["a"])(d,a,n,!1,null,"18fcfc78",null);e["default"]=h.exports}}]);
|