(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2c239172"],{"4b51":function(t,e,a){},"4f08":function(t,e,a){"use strict";a("8293")},"7b53":function(t,e,a){"use strict";a.r(e);var i=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"tableTitle"},[a("span",{staticClass:"tableFloatLine"}),t._v(" "+t._s(t.name)+" ")])},n=[],s={props:{name:{type:String,required:!0}},data:function(){return{someData:""}}},r=s,o=(a("4f08"),a("2877")),l=Object(o["a"])(r,i,n,!1,null,"cbda3f4e",null);e["default"]=l.exports},8293:function(t,e,a){},b2c8:function(t,e,a){"use strict";a("e2df")},cfec:function(t,e,a){"use strict";a.r(e);var i=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"mainBox"},[a("div",{staticClass:"layerBoxNoBg"},[a("div",[a("el-button",{attrs:{type:"primary"},on:{click:function(e){return t.openWindow()}}},[t._v("添加职能部门")])],1)]),a("div",{staticClass:"layerBox"},[a("tableTitle",{attrs:{name:t.tableDivTitle}}),a("el-row",[[a("el-table",{staticStyle:{width:"100%"},attrs:{data:t.tableData}},[a("el-table-column",{attrs:{fixed:"",prop:"id",label:"编号"}}),a("el-table-column",{attrs:{prop:"name",label:"职能部门"}}),a("el-table-column",{attrs:{fixed:"right",label:"操作",width:"200","header-align":"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"listBtnBox"},[a("div",{staticClass:"listDeleteBtn",on:{click:function(a){return t.deleteRow(e.row.id)}}},[a("i",{staticClass:"el-icon-edit-outline"}),t._v("删除")]),a("div",{staticClass:"listEditBtn",on:{click:function(a){return t.editRow(e.row.id)}}},[a("i",{staticClass:"el-icon-edit-outline"}),t._v("编辑")])])]}}])})],1)]],2)],1),a("div",{staticClass:"alignBox"},[a("el-row",[a("el-col",{attrs:{span:24}},[a("el-pagination",{attrs:{"current-page":t.getApiData.page,"page-size":10,layout:"total, prev, pager, next, jumper",total:t.allCount},on:{"size-change":t.handleSizeChange,"current-change":t.handleCurrentChange}})],1)],1)],1),a("el-dialog",{attrs:{title:t.editId?"编辑职能部门":"添加职能部门",visible:t.windowStatus,"close-on-click-modal":!1},on:{"update:visible":function(e){t.windowStatus=e}}},[a("el-form",{ref:"form",attrs:{model:t.form,rules:t.formRules,autocomplete:"off","label-position":"left"}},[a("div",{staticClass:"formDiv"},[a("el-form-item",{staticClass:"custom-align-right",attrs:{label:"选择上级部门","label-width":t.formLabelWidth,prop:"pid"}},[a("el-cascader",{key:t.searchDepartmentKey,attrs:{placeholder:"请选择上级部门",props:t.searchDepartmentData,filterable:"",clearable:""},model:{value:t.form.pid,callback:function(e){t.$set(t.form,"pid",e)},expression:"form.pid"}})],1)],1),a("div",{staticClass:"formDiv"},[a("el-form-item",{staticClass:"custom-align-right",attrs:{label:"部门名称:","label-width":t.formLabelWidth,prop:"name"}},[a("el-input",{attrs:{autocomplete:"off",placeholder:"请输入职能部门名称"},model:{value:t.form.name,callback:function(e){t.$set(t.form,"name",e)},expression:"form.name"}})],1)],1)]),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("div",[a("el-button",{on:{click:t.closeWindow}},[t._v("取 消")]),0==t.editId?a("el-button",{attrs:{type:"primary"},on:{click:t.addData}},[t._v("提交")]):a("el-button",{attrs:{type:"primary"},on:{click:t.editData}},[t._v("修改")])],1)])],1)],1)},n=[],s=a("c7eb"),r=a("1da1"),o=(a("d81d"),a("b0c0"),a("b64b"),a("3ca3"),a("498a"),a("a573"),a("ddb0"),a("4b51"),a("7b53")),l={components:{tableTitle:o["default"]},data:function(){var t=function(t,e,a){e&&""!==e.trim()?a():a(new Error("该项不能为空!"))},e=function(t,e,a){0==e.length?a(new Error("该项不能为空!")):a()},a=this;return{tableDivTitle:"职能部门管理",tableData:[],allCount:0,editId:0,getApiData:{search:"",page:1,pageSize:10},searchDepartmentKey:0,searchDepartmentData:{checkStrictly:!0,lazy:!0,lazyLoad:function(t,e){return Object(r["a"])(Object(s["a"])().mark((function i(){var n,r,o,l;return Object(s["a"])().wrap((function(i){while(1)switch(i.prev=i.next){case 0:if(n=t.level,r=t.data,!r||!r.children||0===r.children.length){i.next=3;break}return i.abrupt("return",e(t));case 3:console.log(n),o=0==n?0:r.value,l={pid:o},a.$store.dispatch("public/getAllDepartment",l).then((function(t){if(t.data){var a=t.data.map((function(t){return{value:t.id,label:t.name,leaf:n>=3,children:[]}}));e(a)}}));case 7:case"end":return i.stop()}}),i)})))()}},windowStatus:!1,formLabelWidth:"120px",form:{pid:"",name:""},formRules:{pid:[{required:!0,trigger:"blur",validator:e}],name:[{required:!0,trigger:"blur",validator:t}]}}},methods:{getData:function(){var t=this;this.$store.dispatch("public/getDepartmentList",this.getApiData).then((function(e){console.log(e),t.tableData=e.data.rows,t.allCount=e.data.count})).catch((function(){t.$message({type:"warning",message:"网络错误,请重试!"})}))},handleSizeChange:function(t){this.getApiData.page=t,this.getData()},handleCurrentChange:function(t){this.getApiData.page=t,this.getData()},deleteRow:function(t){var e=this;this.$confirm("此操作将永久删除该条数据, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){console.log("当前删除:"+t),e.$store.dispatch("public/delDepartment",{id:t}).then((function(t){e.getData(),e.$message({type:"success",message:"删除成功!"})})).catch((function(){e.$message({type:"warning",message:"网络错误,请重试!"})}))})).catch((function(){e.$message({type:"warning",message:"已取消删除"})}))},openWindow:function(){this.clearToServe(),this.windowStatus=!0},closeWindow:function(){this.windowStatus=!1,this.clearToServe(),this.$refs.form.clearValidate()},clearToServe:function(){this.editId=0,this.form.pid=[],this.form.name=""},addData:function(){var t=this;if(0!=this.form.pid.length){var e=this.form.pid[this.form.pid.length-1];this.form.pid=String(e)}this.$refs.form.validate((function(e){e&&t.$store.dispatch("public/addDepartment",t.form).then((function(e){200==e.code?(t.$message({type:"success",message:"已成功添加职能部门!"}),console.log(e),t.closeWindow(),t.getData()):(t.$message({type:"warning",message:e.message}),console.log(e),t.closeWindow(),t.getData())})).catch((function(){t.$message({type:"info",message:"网络错误,请重试!"})}))}))},editRow:function(t){var e=this;this.openWindow(),this.editId=t,this.$store.dispatch("public/getDepartmentMain",{id:t}).then((function(t){console.log(t),e.form.name=t.data.name,e.form.pid=t.data.pid,"number"===typeof t.data.pid?e.form.pid=[t.data.pid]:e.form.pid=JSON.parse(t.data.pid),e.searchDepartmentKey+=1,e.loadCascaderPath(e.form.pid),console.log(e.form.pid),console.log(e.searchDepartmentKey)})).catch((function(){e.$message({type:"warning",message:"网络错误,请重试!"})}))},loadCascaderPath:function(t,e){var a=this;return Object(r["a"])(Object(s["a"])().mark((function e(){var i,n;return Object(s["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:i=Object(s["a"])().mark((function e(){var i,r;return Object(s["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return i=t[n-1]||0,r=n,e.next=4,a.$store.dispatch("public/getDepartmentMain",{pid:i}).then((function(e){e.data.map((function(t){return{value:t.id,label:t.name,leaf:r>=3}}));r===t.length-1&&(a.form.pid=t)}));case 4:case"end":return e.stop()}}),e)})),n=0;case 2:if(!(n