lepu-test-platform-web/dist/static/js/12.4e216121bc61cd43b7cc.js

2 lines
11 KiB
JavaScript
Raw Normal View History

webpackJsonp([12],{"1/AB":function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=a("mvHQ"),o=a.n(i),l={data:function(){return{loading:!1,queryInfo:{documentName:"",pageNum:1,pageSize:10},fileList:[],documentlist:[],currpage:1,total:0,addDialogVisible:!1,editDialogVisible:!1,detailDialogVisible:!1,addForm:{documentName:"",comments:""},fileIsChange:!1,editForm:{},detailForm:{},addFormRules:{documentName:[{required:!0,message:"请选择文件"}],comments:[{required:!1,message:"请输入密码",trigger:"blur"},{min:0,max:200,message:"长度在 0 到 200 个字符",trigger:"blur"}]}}},mounted:function(){},created:function(){this.getDocumentList()},methods:{downloadDocument:function(e){this.$common.downloadFiles(e.documentRealName)},addDialogClose:function(){this.addDialogVisible=!1,this.$refs.addFormRef.resetFields(),this.fileList=[]},addDocument:function(){var e=this;this.$refs.addFormRef.validate(function(t){if(t){var a=e.fileList[0],i=new FormData,l=a.name,n="";i.append("file",a.raw),i.append("filename",a.name),e.$api.comm.uploadFile(i).then(function(t){if(200==t.data.code){n=t.data.data.fileName;var a={documentName:l,uploadPerson:JSON.parse(localStorage.getItem("userInfo")).nick,createTime:(new Date).getTime(),comments:e.addForm.comments,documentRealName:n};e.$api.asset.addDocument(o()(a)).then(function(t){e.$notify({type:"success",message:t.data.msg}),e.addDialogVisible=!1,e.getDocumentList(),e.$refs.addFormRef.resetFields()}).catch(function(){e.$api.comm.deleteFile(n)})}else e.$notify({type:"error",message:"上传失败"})}).catch(function(){}),e.fileList=[]}})},showDetailDialog:function(e){var t=this;this.detailDialogVisible=!0,this.$api.asset.queryDocumentById(e).then(function(e){t.detailForm=e.data.data}).catch(function(){})},editDialogClose:function(){this.editDialogVisible=!1,this.$refs.editFormRef.resetFields()},showEditDialog:function(e){var t=this;this.editDialogVisible=!0,this.cacheFileIsChange=this.fileIsChange,this.$api.asset.queryDocumentById(e).then(function(e){t.editForm=e.data.data}).catch(function(){})},editDocument:function(){var e=this;this.$refs.editFormRef.validate(function(t){if(t){var a="",i="",o="",l=JSON.parse(localStorage.getItem("userInfo")).nick;if(e.fileIsChange){var n=e.fileList[0],s=new FormData;a=n.name,o=l,s.append("file",n.raw),s.append("filename",n.name),e.$api.comm.uploadFile(s).then(function(t){i=t.data.data.fileName,e.editDocumentBody(a,i,o,l)}).catch(function(){}),e.fileList=[]}else e.editDocumentBody(a,i,o,l)}})},editDocumentBody:function(e,t,a,i){var l=this,n={id:this.editForm.id,updateTime:(new Date).getTime(),comments:this.editForm.comments,documentName:""==e?this.editForm.documentName:e,documentRealName:t,uploadPerson:a,updatePerson:i};this.$api.asset.editDocument(o()(n)).then(function(e){l.editDialogVisible=!1,l.$notify({type:"success",message:e.data.msg}),l.getDocumentList()}).catch(function(){}),this.$refs.editFormRef.resetFields()},delDocument:function(e){var t=this;this.$confirm("确定删除该文档吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){t.$api.asset.delDocumentById(e).then(function(e){t.$notify({message:e.data.msg,type:"success"}),t.getDocumentList()}).catch(function(){})}).catch(function(){})},selectDocumentList:function(){this.queryInfo.pageNum=1,this.total=0,this.getDocumentList()},getDocumentList:function(){var e=this;this.loading=!0,this.$api.asset.queryAllDocument(o()(this.queryInfo)).then(function(t){e.loading=!1,e.documentlist=t.data.data,e.total=t.data.count,e.queryInfo.pageNum=1}).catch(function(t){e.loading=!1})},handleSizeChange:function(e){this.queryInfo.pageSize=e,this.getDocumentList()},handleCurrentChange:function(e){this.queryInfo.pageNum=e,this.getDocumentList()},addHandleChange:function(e,t){this.addForm.documentName=e.name,this.fileList=t,this.fileList.length>1&&(this.fileList=[],this.fileList.push(e))},editHandleChange:function(e,t){this.fileIsChange=!0,this.editForm.documentName=e.name,this.fileList=t,this.fileList.length>1&&(this.fileList=[],this.fileList.p
//# sourceMappingURL=12.4e216121bc61cd43b7cc.js.map