1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-531cb9a4"],{"0e8f":function(e,t,a){"use strict";a.d(t,"a",(function(){return r})),a.d(t,"b",(function(){return i})),a.d(t,"e",(function(){return o})),a.d(t,"c",(function(){return l})),a.d(t,"d",(function(){return s}));var n=a("b775");function r(e){return Object(n["a"])({url:"/department/addDepartment",method:"post",data:e})}function i(e){return Object(n["a"])({url:"/department/deleteDepartment/"+e,method:"delete"})}function o(e){return Object(n["a"])({url:"/department/updateDepartment",method:"post",data:e})}function l(e){return Object(n["a"])({url:"/department/getDepartment/",method:"get",params:e})}function s(e){return Object(n["a"])({url:"/department/getDepartmentList",method:"post",data:e})}},"12f1":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:"app-container"},[a("el-input",{staticClass:"filter-item",staticStyle:{width:"150px"},attrs:{placeholder:"部门名..."},model:{value:e.filterQuery.departmentName,callback:function(t){e.$set(e.filterQuery,"departmentName",t)},expression:"filterQuery.departmentName"}}),a("el-input",{staticClass:"filter-item",staticStyle:{width:"150px"},attrs:{placeholder:"部门电话..."},model:{value:e.filterQuery.departmentPhone,callback:function(t){e.$set(e.filterQuery,"departmentPhone",t)},expression:"filterQuery.departmentPhone"}}),a("el-input",{staticClass:"filter-item",staticStyle:{width:"150px"},attrs:{placeholder:"部门备注信息..."},model:{value:e.filterQuery.departmentDescript,callback:function(t){e.$set(e.filterQuery,"departmentDescript",t)},expression:"filterQuery.departmentDescript"}}),a("el-button",{staticClass:"filter-item",attrs:{type:"primary",icon:"el-icon-search"},on:{click:e.handleFilter}},[e._v("搜索")]),a("el-button",{directives:[{name:"show",rawName:"v-show",value:e.isShow,expression:"isShow"}],staticClass:"filter-item",attrs:{type:"success",icon:"el-icon-edit"},on:{click:e.handleCreate}},[e._v("添加部门")]),a("el-button",{staticClass:"filter-item",attrs:{type:"success",icon:"el-icon-edit"},on:{click:e.handleDowmExcel}},[e._v("导出Excel")]),a("el-button",{staticClass:"filter-item",attrs:{type:"success",icon:"el-icon-edit"},on:{click:e.handleDowmDemoExcel}},[e._v("导出样表")]),a("el-upload",{staticClass:"inline-block",attrs:{action:"","on-change":e.handleChange,"on-remove":e.handleRemove,"on-exceed":e.handleExceed,limit:e.limitUpload,accept:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel","auto-upload":!1}},[a("el-button",{directives:[{name:"show",rawName:"v-show",value:e.isShow,expression:"isShow"}],staticClass:"filter-item",attrs:{type:"warning",icon:"el-icon-edit"}},[e._v("导入Excel")])],1),a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.listLoading,expression:"listLoading"}],attrs:{data:e.list,"element-loading-text":"Loading",border:"",fit:"","highlight-current-row":""}},[a("el-table-column",{attrs:{align:"center",label:"ID",width:"70",type:"index"}}),a("el-table-column",{attrs:{label:"部门名称",width:"150"},scopedSlots:e._u([{key:"default",fn:function(t){return[null==t.row.departmentName||""==t.row.departmentName?a("span",[e._v("暂无信息")]):a("span",[e._v(e._s(t.row.departmentName))])]}}])}),a("el-table-column",{attrs:{label:"部门电话",width:"200",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[null==t.row.departmentPhone||""==t.row.departmentPhone?a("span",[e._v("暂无信息")]):a("span",[e._v(e._s(t.row.departmentPhone))])]}}])}),a("el-table-column",{attrs:{label:"部门备注",width:"200",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[null==t.row.departmentDescript||""==t.row.departmentDescript?a("span",[e._v("暂无信息")]):a("span",[e._v(e._s(t.row.departmentDescript))])]}}])}),a("el-table-column",{attrs:{"class-name":"status-col",label:"部门创建时间",width:"250",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[null==t.row.departmentCreateTime||""==t.row.departmentCreateTime?a("span",[e._v("暂无信息")]):a("span",[e._v(e._s(t.row.departmentCreateTime))])]}}])}),a("el-table-column",{attrs:{align:"center",prop:"created_at",label:"部门最近修改时间",width:"250"},scopedSlots:e._u([{key:"default",fn:function(t){return[null==t.row.departmentLastTime||""==t.row.departmentLastTime?a("span",[e._v("暂无信息")]):a("span",[e._v(e._s(t.row.departmentLastTime))])]}}])}),a("el-table-column",{attrs:{align:"center",prop:"created_at",label:"操作"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-button",{directives:[{name:"show",rawName:"v-show",value:e.isShow,expression:"isShow"}],attrs:{type:"primary",size:"small"},on:{click:function(a){return e.handleUpdate(t.row)}}},[e._v("编辑")]),a("el-button",{directives:[{name:"show",rawName:"v-show",value:e.isShow,expression:"isShow"}],attrs:{type:"danger",size:"small"},on:{click:function(a){return e.deleteDate(t.row)}}},[e._v("删除")]),a("el-button",{directives:[{name:"show",rawName:"v-show",value:!e.isShow,expression:"!isShow"}],attrs:{type:"danger",size:"small"}},[e._v("暂无操作")])]}}])})],1),a("div",{staticStyle:{float:"right","margin-top":"30px"}},[a("el-pagination",{attrs:{background:"","current-page":e.currentPage,"page-sizes":[10,20,30,40],"page-size":10,layout:"total, sizes, prev, pager, next, jumper",total:e.total},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}})],1),a("el-dialog",{attrs:{title:e.textMap[e.dialogStatus],visible:e.dialogFormVisible},on:{"update:visible":function(t){e.dialogFormVisible=t}}},[a("el-form",{ref:"dataForm",attrs:{model:e.form,rules:e.rules}},[a("el-form-item",{staticClass:"dialogShow",attrs:{label:"部门名称:","label-width":e.formLabelWidth,prop:"departmentName"}},[a("el-input",{attrs:{placeholder:"请输入部门名称",autocomplete:"off"},model:{value:e.form.departmentName,callback:function(t){e.$set(e.form,"departmentName",t)},expression:"form.departmentName"}})],1),a("el-form-item",{staticClass:"dialogShow",attrs:{label:"部门电话:","label-width":e.formLabelWidth,prop:"departmentPhone",placeholder:"部门电话"}},[a("el-input",{attrs:{type:"number",placeholder:"请输入部门电话",autocomplete:"off"},model:{value:e.form.departmentPhone,callback:function(t){e.$set(e.form,"departmentPhone",t)},expression:"form.departmentPhone"}})],1),a("el-form-item",{staticClass:"dialogShow",attrs:{label:"部门备注","label-width":e.formLabelWidth}},[a("el-input",{attrs:{placeholder:"请输入部门备注",autocomplete:"off"},model:{value:e.form.departmentDescript,callback:function(t){e.$set(e.form,"departmentDescript",t)},expression:"form.departmentDescript"}})],1)],1),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:e.handleCancle}},[e._v("取 消")]),a("el-button",{attrs:{type:"primary"},on:{click:function(t){"create"==e.dialogStatus?e.createData():e.updateData()}}},[e._v("确 定")])],1)],1)],1)},r=[],i=(a("5ab2"),a("6d57"),a("e10e"),a("47e7"),a("88d6")),o=a("0e8f"),l=a("52c1");function s(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function c(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?s(Object(a),!0).forEach((function(t){Object(i["a"])(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):s(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}var d={data:function(){return{list:null,tempData:{},param:{},tempIndex:0,isShow:!0,listLoading:!0,dialogFormVisible:!1,dialogStatus:"",textMap:{create:"添加部门信息",update:"修改部门信息"},form:{name:"",phone:"",descript:""},formLabelWidth:"120px",total:0,currentPage:1,filterQuery:{pageNum:1,pageSize:10},downTime:"",limitUpload:1,excelQuery:{},excelList:{},rules:{departmentName:[{required:!0,message:"部门名称不能为空",trigger:"blur"}],departmentPhone:[{required:!0,message:"部门电话不能为空",trigger:"blur"},{min:11,max:11,message:"请输入正确的手机号码"},{pattern:/^1[3|4|5|7|8][0-9]\d{8}$/,message:"请输入正确的手机号码"}]}}},computed:c({},Object(l["b"])(["orgId"])),created:function(){this.getList(),this.isShow=!(null===this.orgId)},methods:{getList:function(){var e=this;this.listLoading=!0,this.clearDialogData(),this.listLoading=!1,this.filterQuery.orgId=this.orgId,Object(o["d"])(this.filterQuery).then((function(t){e.list=t.data.list,e.total=t.data.total,e.listLoading=!1}))},handleCreate:function(){this.dialogFormVisible=!0,this.dialogStatus="create"},handleUpdate:function(e){var t=this;this.dialogStatus="update",Object(o["c"])({departmentId:e.departmentId}).then((function(e){t.form=e.data})),this.dialogFormVisible=!0},handleFilter:function(){this.getList()},handleCancle:function(){var e=this;this.clearDialogData(),this.dialogFormVisible=!1,this.$nextTick((function(){e.$refs["dataForm"].clearValidate()}))},clearDialogData:function(){this.form={}},createData:function(){var e=this;this.$refs["dataForm"].validate((function(t){t&&(e.form.orgId=e.orgId,Object(o["a"])(e.form).then((function(t){e.dialogFormVisible=!1,e.$notify({title:"部门添加",message:t.msg,type:"success",duration:2e3}),e.getList()})))}))},deleteDate:function(e){var t=this;this.$confirm("此操作将永久删除该文件, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){Object(o["b"])(e.departmentId).then((function(e){t.$notify({title:"删除部门",message:e.msg,type:200===e.status?"success":"error",duration:2e3}),200===e.status&&t.getList()}))})).catch((function(){t.$message({type:"info",message:"已取消删除"})}))},updateData:function(){var e=this;this.$refs["dataForm"].validate((function(t){t&&Object(o["e"])(e.form).then((function(t){e.dialogFormVisible=!1,e.clearDialogData(),e.$notify({title:"更新部门",message:t.msg,type:200===t.status?"success":"error",duration:2e3}),e.getList()}))}))},handleDowmExcel:function(){var e=this;this.$confirm("此操作将导出excel文件, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){e.downloadLoading=!0,e.excelQuery.departmentName=e.filterQuery.departmentName,e.excelQuery.departmentPhone=e.filterQuery.departmentPhone,e.excelQuery.departmentDescript=e.filterQuery.departmentDescript,e.excelQuery.departmentType=-1,e.excelQuery.orgId=e.filterQuery.orgId,Object(o["d"])(e.excelQuery).then((function(t){e.excelList=t.data.list,Promise.resolve().then(a.bind(null,"39a0")).then((function(t){var a=["部门名称","部门电话","部门备注信息","部门创建时间","部门最近一次修改时间"],n=["departmentName","departmentPhone","departmentDescript","departmentCreateTime","departmentLastTime"],r=e.formatJson(n,e.excelList);e.downTime=e.moment(new Date).format("YYYY年MM月DD日 HH时mm分ss秒"),t.export_json_to_excel({header:a,data:r,filename:"部门信息表_"+e.downTime}),e.downloadLoading=!1}))})).catch((function(){}))}))},formatJson:function(e,t){return t.map((function(t){return e.map((function(e){return t[e]}))}))},handleDowmDemoExcel:function(){var e=this;this.$confirm("此操作将导出excel模板文件, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){e.downloadLoading=!0,e.downTime=e.moment(new Date).format("YYYY年MM月DD日 HH时mm分ss秒"),Promise.resolve().then(a.bind(null,"39a0")).then((function(t){var a=["部门名称","部门电话","部门备注信息"],n="";t.export_json_to_excel({header:a,data:n,filename:"部门信息模板"+e.downTime}),e.downloadLoading=!1}))})).catch((function(){}))},handleSizeChange:function(e){this.filterQuery.pageSize=e,this.getList()},handleCurrentChange:function(e){this.filterQuery.pageNum=e,this.getList()},handleChange:function(e,t){this.fileTemp=e.raw,this.fileTemp?"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"===this.fileTemp.type||"application/vnd.ms-excel"===this.fileTemp.type?this.importfxx(this.fileTemp):this.$message({type:"warning",message:"附件格式错误,请删除后重新上传!"}):this.$message({type:"warning",message:"请上传附件!"})},handleExceed:function(){this.$message({type:"warning",message:"一次最多只能上传一个附件!"})},handleRemove:function(e,t){this.fileTemp=null},importfxx:function(e){var t=this;this.file=event.currentTarget.files[0];var n=!1,r=this.file,i=new FileReader;FileReader.prototype.readAsBinaryString=function(e){var n,r,i="",l=!1,s=new FileReader;s.onload=function(e){for(var c=new Uint8Array(s.result),d=c.byteLength,m=0;m<d;m++)i+=String.fromCharCode(c[m]);var u=a("f16e");n=l?u.read(btoa(fixdata(i)),{type:"base64"}):u.read(i,{type:"binary"}),r=u.utils.sheet_to_json(n.Sheets[n.SheetNames[0]]);var p=[];return r.map((function(e){var t={};t.departmentName=e["部门名称"],t.departmentPhone=e["部门电话"],t.departmentDescript=e["部门备注信息"],p.push(t)})),t.da=p,t.dalen=p.length,p.forEach((function(e){e.orgId=t.filterQuery.orgId,Object(o["a"])(e).then((function(e){200===e.status&&(t.$message({type:"success",message:"导入成功"}),t.getList())}))})),p},s.readAsArrayBuffer(e)},n?i.readAsArrayBuffer(r):i.readAsBinaryString(r)}}},m=d,u=(a("8d52"),a("4023")),p=Object(u["a"])(m,n,r,!1,null,null,null);t["default"]=p.exports},"4e29":function(e,t,a){},"8d52":function(e,t,a){"use strict";var n=a("4e29"),r=a.n(n);r.a}}]);
|