(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-2d0e1da0"],{"7bcb":function(e,t,n){"use strict";n.r(t);var a=(n("b0c0"),n("d3b7"),n("2b0e")).a.extend({components:{"main-page":function(){return n.e("chunk-6119f298").then(n.bind(null,"4c9e"))},"input-cell":function(){return Promise.all([n.e("chunk-14b38b7c"),n.e("chunk-2d0d5ff1")]).then(n.bind(null,"82bc"))},"c-cell":function(){return n.e("chunk-fc1d43b8").then(n.bind(null,"4420"))},"c-button":function(){return n.e("chunk-2d0df078").then(n.bind(null,"87be"))},"group-cell":function(){return n.e("chunk-40efd966").then(n.bind(null,"b799"))},"member-selector":function(){return n.e("chunk-2c55c385").then(n.bind(null,"ba3a"))},"dep-selector":function(){return n.e("chunk-2796f9e0").then(n.bind(null,"1661"))},"switch-cell":function(){return n.e("chunk-16315759").then(n.bind(null,"233c"))}},name:"AddDepartment",beforeRouteEnter:function(e,t,n){var a=t.path;n((function(e){e.fromManagement="/team/team-management"===a}))},data:function(){return{name:"",check:!1,enterpriseInfoObj:{data:null,loading:!0,error:null},hasGroup:!1,addDep:{entId:"",leaderId:"",name:"",parentId:"",hasGroup:!1},parentDep:{},leader:{},selectedLeaderId:[],showMemberSelector:!1,entId:"",depTree:{},selectedDepId:"",contacts:{},loading:!1,showDepSelector:!1,fromManagement:!1}},created:function(){var e,t=JSON.parse(localStorage.getItem("ENT_INFO"));this.entId=t.id;var n=null===(e=JSON.parse(localStorage.getItem("USR_INFO")))||void 0===e?void 0:e.id;this.selectedLeaderId=[n],this.getStaffInfo(this.selectedLeaderId[0]);var a=this.$route.query.id||t.rootDepId;this.selectedDepId=a,this.getDepInfo(a)},methods:{goBack:function(){this.fromManagement?this.$router.push("/team/team-management"):this.$router.push("/team/team-frame")},addDepConfirm:function(){var e=this;if(""!==this.name){var t={entId:this.entId,leaderId:this.leader.id,name:this.name,parentId:this.parentDep.id,hasGroup:this.hasGroup};this.$service.department.addDep(t).then((function(t){var n=t.data;n.code===e.$global.success?(e.$toast("添加成功"),e.goBack()):e.$toast(n.msg)}))}else this.$toast("请输入部门名称")},selectCharger:function(){this.showMemberSelector=!0},getStaffInfo:function(e){var t=this;this.loading=!0,this.$service.staff.getInfo({id:e}).then((function(e){var n=e.data;t.loading=!1,n.code===t.$global.success?t.leader=n.data:t.$toast(n.msg)}))},getDepInfo:function(e){var t=this;this.loading=!0,this.$service.department.getDep({entId:this.entId,id:e}).then((function(e){t.loading=!1;var n=e.data;n.code===t.$global.success?t.parentDep=n.data:t.$toast(n.msg)}))},getSub:function(e){var t=this;this.loading=!0,this.$service.department.getSub({entId:this.entId,parentId:e}).then((function(e){var n=e.data;t.loading=!1,n.code===t.$global.success?(t.depTree=n.data.dep,t.depTree.children=n.data.subDepList):t.$toast(n.msg)}))},selectDep:function(){var e=JSON.parse(localStorage.getItem("ENT_INFO")).rootDepId;this.getSub(e),this.showDepSelector=!0}},watch:{selectedLeaderId:function(e){var t=e[0];this.getStaffInfo(t)},selectedDepId:function(e){this.getDepInfo(e)}}}),c=n("2877"),r=Object(c.a)(a,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("main-page",{attrs:{"left-arrow":"",loading:e.loading},on:{"click-left":e.goBack}},[n("member-selector",{attrs:{show:e.showMemberSelector,"show-team":!0,"checked-member-id":e.selectedLeaderId},on:{"update:show":function(t){e.showMemberSelector=t},"update:checkedMemberId":function(t){e.selectedLeaderId=t},"update:checked-member-id":function(t){e.selectedLeaderId=t}}}),n("dep-selector",{attrs:{"ent-id":e.entId,show:e.showDepSelector,selected:e.selectedDepId},on:{"update:show":function(t){e.showDepSelector=t},"update:selected":function(t){e.selectedDepId=t}}}),n("div",{staticClass:"pt-14 px-4"},[n("input-cell",{attrs:{required:"",limit:20,label:"部门名称",placeholder:"请输入部门名称","error-msg":"名称不能为空"},model:{value:e.name,callback:function(t){e.name=t},expression:"name"}}),n("group-cell",{staticClass:"mt-4",attrs:{title:"部门主管"}},[n("c-cell",{attrs:{dot:"",title:e.leader.name||"选择主管"},on:{click:e.selectCharger}})],1),n("group-cell",{staticClass:"mt-4",attrs:{title:"上级部门"}},[n("c-cell",{attrs:{dot:"",title:e.parentDep.name},on:{click:e.selectDep}})],1),n("switch-cell",{staticClass:"mt-4",attrs:{title:"创建部门群",checked:e.hasGroup},on:{"update:checked":function(t){e.hasGroup=t}}}),n("c-button",{staticClass:"mt-10",attrs:{round:""},on:{click:e.addDepConfirm}},[e._v("\n      确定\n    ")])],1)],1)}),[],!1,null,null,null);t.default=r.exports}}]);
//# sourceMappingURL=chunk-2d0e1da0.d87decaa.js.map