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

2 lines
11 KiB
JavaScript

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.push(e))}}},n={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"document-box"},[a("el-form",{staticClass:"document-form-inline",attrs:{inline:!0}},[a("el-form-item",{attrs:{label:"文档名称"}},[a("el-input",{staticClass:"input-with-select",attrs:{placeholder:"请输入文档名称",clearable:""},model:{value:e.queryInfo.documentName,callback:function(t){e.$set(e.queryInfo,"documentName",t)},expression:"queryInfo.documentName"}})],1),e._v(" "),a("el-form-item",[a("el-button",{attrs:{type:"primary"},on:{click:e.selectDocumentList}},[e._v("查询")])],1)],1),e._v(" "),a("el-row",{staticClass:"add_button"},[a("el-col",{attrs:{span:2}},[a("el-button",{attrs:{type:"primary"},on:{click:function(t){e.addDialogVisible=!0}}},[e._v("添加")])],1)],1),e._v(" "),a("el-table",{attrs:{data:e.documentlist.slice((e.currpage-1)*e.queryInfo.pageSize,e.currpage*e.queryInfo.pageSize),border:"",fit:!0}},[a("el-table-column",{attrs:{type:"index",align:"center"}}),e._v(" "),a("el-table-column",{attrs:{label:"文档名称",prop:"documentName"}}),e._v(" "),a("el-table-column",{attrs:{label:"上传人员",prop:"uploadPerson"}}),e._v(" "),a("el-table-column",{attrs:{label:"修改人员",prop:"updatePerson"}}),e._v(" "),a("el-table-column",{attrs:{label:"上传时间",prop:"createTime"}}),e._v(" "),a("el-table-column",{attrs:{label:"修改时间",prop:"updateTime"}}),e._v(" "),e._e(),e._v(" "),a("el-table-column",{attrs:{label:"备注",prop:"comments"}}),e._v(" "),a("el-table-column",{attrs:{label:"操作",fixed:"right",width:"180px"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return e.showDetailDialog(t.row.id)}}},[e._v("查看")]),e._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return e.showEditDialog(t.row.id)}}},[e._v("编辑")]),e._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return e.downloadDocument(t.row)}}},[e._v("下载")]),e._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return e.delDocument(t.row.id)}}},[e._v("删除")])]}}])})],1),e._v(" "),a("el-pagination",{attrs:{"current-page":e.currpage,"page-sizes":[5,10,20,30],"page-size":e.queryInfo.pageSize,layout:"total, prev, pager, next, sizes, jumper",total:e.total},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}}),e._v(" "),a("el-dialog",{attrs:{title:"添加",loadling:e.loading,visible:e.addDialogVisible,"close-on-click-modal":!1,width:"30%"},on:{"update:visible":function(t){e.addDialogVisible=t},close:e.addDialogClose}},[a("el-form",{ref:"addFormRef",attrs:{model:e.addForm,rules:e.addFormRules,"label-width":"100px"}},[a("el-form-item",{attrs:{label:"文档名称",prop:"documentName"}},[a("el-upload",{ref:"upload",staticClass:"inline",attrs:{"show-file-list":!1,action:"","on-change":e.addHandleChange,"auto-upload":!1,"file-list":e.fileList}},[a("el-input",{attrs:{placeholder:"请选择文件"},model:{value:e.addForm.documentName,callback:function(t){e.$set(e.addForm,"documentName",t)},expression:"addForm.documentName"}})],1)],1),e._v(" "),a("el-form-item",{attrs:{label:"备注",prop:"comments"}},[a("el-input",{attrs:{type:"textarea",placeholder:"请输入备注信息"},model:{value:e.addForm.comments,callback:function(t){e.$set(e.addForm,"comments",t)},expression:"addForm.comments"}})],1)],1),e._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:e.addDialogClose}},[e._v("取 消")]),e._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:e.addDocument}},[e._v("确 定")])],1)],1),e._v(" "),a("el-dialog",{attrs:{title:"修改",visible:e.editDialogVisible,"close-on-click-modal":!1,width:"30%"},on:{"update:visible":function(t){e.editDialogVisible=t},close:e.editDialogClose}},[a("el-form",{ref:"editFormRef",attrs:{model:e.editForm,rules:e.addFormRules,"label-width":"100px"}},[a("el-form-item",{attrs:{label:"文档名称",prop:"documentName"}},[a("el-upload",{ref:"upload",staticClass:"inline",attrs:{"show-file-list":!1,action:"","on-change":e.editHandleChange,"auto-upload":!1,"file-list":e.fileList}},[a("el-input",{attrs:{placeholder:"请选择文件"},model:{value:e.editForm.documentName,callback:function(t){e.$set(e.editForm,"documentName",t)},expression:"editForm.documentName"}})],1)],1),e._v(" "),a("el-form-item",{attrs:{label:"备注",prop:"comments"}},[a("el-input",{attrs:{type:"textarea",placeholder:"请输入备注信息"},model:{value:e.editForm.comments,callback:function(t){e.$set(e.editForm,"comments",t)},expression:"editForm.comments"}})],1)],1),e._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:e.editDialogClose}},[e._v("取 消")]),e._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:e.editDocument}},[e._v("确 定")])],1)],1),e._v(" "),a("el-dialog",{attrs:{title:"查看",visible:e.detailDialogVisible,"close-on-click-modal":!1,width:"30%"},on:{"update:visible":function(t){e.detailDialogVisible=t}}},[a("el-form",{attrs:{model:e.detailForm,"label-width":"100px"}},[a("el-form-item",{attrs:{label:"文档名称",prop:"documentName"}},[a("el-input",{attrs:{disabled:""},model:{value:e.detailForm.documentName,callback:function(t){e.$set(e.detailForm,"documentName",t)},expression:"detailForm.documentName"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"上传人员",prop:"uploadPerson"}},[a("el-input",{attrs:{disabled:""},model:{value:e.detailForm.uploadPerson,callback:function(t){e.$set(e.detailForm,"uploadPerson",t)},expression:"detailForm.uploadPerson"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"上传时间",prop:"createTime"}},[a("el-input",{attrs:{disabled:""},model:{value:e.detailForm.createTime,callback:function(t){e.$set(e.detailForm,"createTime",t)},expression:"detailForm.createTime"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"修改人员",prop:"updatePerson"}},[a("el-input",{attrs:{disabled:""},model:{value:e.detailForm.updatePerson,callback:function(t){e.$set(e.detailForm,"updatePerson",t)},expression:"detailForm.updatePerson"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"修改时间",prop:"updateTime"}},[a("el-input",{attrs:{disabled:""},model:{value:e.detailForm.updateTime,callback:function(t){e.$set(e.detailForm,"updateTime",t)},expression:"detailForm.updateTime"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"备注",prop:"comments"}},[a("el-input",{attrs:{type:"textarea",disabled:""},model:{value:e.detailForm.comments,callback:function(t){e.$set(e.detailForm,"comments",t)},expression:"detailForm.comments"}})],1)],1),e._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(t){e.detailDialogVisible=!1}}},[e._v("取 消")])],1)],1)],1)},staticRenderFns:[]};var s=a("VU/8")(l,n,!1,function(e){a("cx5B")},"data-v-dfbddbba",null);t.default=s.exports},cx5B:function(e,t){}});
//# sourceMappingURL=12.4e216121bc61cd43b7cc.js.map