chunk-e8a4.2e729b32.js 19 KB

1
  1. (window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-e8a4"],{"3nid":function(t,e,a){},ChWx:function(t,e,a){"use strict";var i=a("QbLZ"),n=a.n(i),r=a("RCcY"),s=a("L2JU"),o={data:function(){return{router_list:[{category_id:"1",category_title:"部门管理",routers:[]}]}},components:{sideItem:r.a},computed:n()({},Object(s.b)(["permission_routers","userInfo"])),watch:{permission_routers:function(t,e){this.signRouters(t)}},mounted:function(){this.signRouters()},methods:{signRouters:function(t){var e=(t||this.permission_routers).filter(function(t){return"department"===t.name});e[0]&&this.router_list.map(function(t){e[0].children.map(function(e){e.class_id==t.category_id&&t.routers.push(e)})})}}},c=(a("uePT"),a("KHd+")),d=Object(c.a)(o,function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"second-side-box"},[e("div",{staticStyle:{width:"150px"}}),this._v(" "),e("div",{staticClass:"second-side-box-fixed"},[e("el-menu",{staticClass:"el-menu-vertical-demo",attrs:{"default-active":"1"}},this._l(this.router_list,function(t){return e("side-item",{key:t.category_id,attrs:{item:t}})}))],1)])},[],!1,null,"5618431a",null);d.options.__file="department_side.vue";e.a=d.exports},EMT4:function(t,e,a){"use strict";var i=a("i/mf");a.n(i).a},ImUg:function(t,e,a){"use strict";var i=a("MXsD");a.n(i).a},LQDQ:function(t,e,a){"use strict";var i=a("3nid");a.n(i).a},MXsD:function(t,e,a){},"i/mf":function(t,e,a){},uTjN:function(t,e,a){"use strict";a.r(e);var i=a("ChWx"),n=a("14Xm"),r=a.n(n),s=a("D3Ub"),o=a.n(s),c=null,d={components:{staff_item:a("PdEq").a},props:{multiple:{type:Boolean,default:!1},search_name:{type:String,default:""},choice_obj:{type:Array,default:[]}},data:function(){return{staffArr:[],checkboxIds:{}}},created:function(){var t=this;return o()(r.a.mark(function e(){return r.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}},e,t)}))()},watch:{search_name:function(t,e){var a=this;c&&clearTimeout(c),""!=t?c=setTimeout(function(){a.search()},500):this.staffArr=[]}},methods:{choiceData:function(t){0==this.multiple&&(this.checkboxIds={}),this.$set(this.checkboxIds,t.id,t),this.$emit("choiceData",this.checkboxIds)},delChoiceData:function(t){this.$delete(this.checkboxIds,t),this.$emit("choiceData",this.checkboxIds)},delChoiceAll:function(){this.checkboxIds={},this.$emit("choiceData",this.checkboxIds)},setChoiceData:function(t){this.checkboxIds=t,this.$emit("choiceData",this.checkboxIds)},search:function(){var t=this,e=[];this.choice_obj.forEach(function(a){a.name.indexOf(t.search_name)>=0&&e.push(a)}),this.staffArr=e}}},l=(a("LQDQ"),a("KHd+")),m=Object(l.a)(d,function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"department"},[""==t.search_name?[t._l(t.choice_obj,function(e,i){return[a("staff_item",{key:i,attrs:{root:e,paddingLeft:12,checkboxIds:t.checkboxIds,multiple:t.multiple},on:{choiceDepartment:t.choiceData}})]})]:t._e(),t._v(" "),""!=t.search_name?[t._l(t.staffArr,function(e,i){return[a("staff_item",{key:i,attrs:{root:e,paddingLeft:12,checkboxIds:t.checkboxIds,multiple:t.multiple},on:{choiceDepartment:t.choiceData}})]})]:t._e()],2)},[],!1,null,"74d83dac",null);m.options.__file="choice_staff.vue";var p=m.exports,h=[],_=[],f="";var u={components:{department_side:i.a,choice_staff:p},data:function(){return{syncDepartmentTipsShow:!1,delDepartmentTipsShow:!1,addDepartmentShow:!1,editDepartmentShow:!1,addDepartmentDirectorShow:!1,checkboxArr:[],add_department_form:{name:"",order:"",parent_arr:[]},department_list:[],tableData:[],search_text:"",rules:{name:[{required:!0,message:"请项为必填项",trigger:"blur"}],order:[{required:!0,message:"请项为必填项",trigger:"blur"}],parent_arr:[{required:!0,message:"请项为必填项",trigger:"blur"}]},edit_department_form:{name:"",order:"",id:""},edit_department_item:{},staff_list:[],department_id:0,del_department_item:{},add_parent_department_item:{}}},created:function(){f="",this.getDepartmentList()},methods:{changeDepartment:function(t){console.log(t)},delDepartment:function(t){this.del_department_item=t,this.delDepartmentTipsShow=!0},confirmDelDepartment:function(){var t=this;this.delDepartmentTipsShow=!1,$http.pc_get("admin/deleteDepartment",{id:this.del_department_item.id},"loading").then(function(e){1===e.result?(e.msg&&t.$message.success(e.msg),t.getDepartmentList()):e.msg&&t.$message.error(e.msg)}).catch(function(t){console.error(t)})},gotoDepartmentPermission:function(t){this.$router.push(this.fun.getUrl("departmentPermission",{},{id:t}))},gotoSettingConfig:function(){this.syncDepartmentTipsShow=!1,this.$router.push(this.fun.getUrl("settingConfig"))},editDepartmentName:function(t){this.edit_department_item=t,this.edit_department_form.name=t.name,this.edit_department_form.order=t.order,this.edit_department_form.id=t.id,this.editDepartmentShow=!0},addChildDepartment:function(t){console.log(t),this.add_parent_department_item=t,this.addDepartmentShow=!0},openAddDepartment:function(){this.add_parent_department_item={},this.addDepartmentShow=!0},choiceData:function(t){var e=[];for(var a in t)e.push(t[a]);this.checkboxArr=e},delChoice:function(t){this.$refs.choice_staff.delChoiceData(t)},checkForm:function(t){var e=this;this.$refs[t].validate(function(a){if(!a)return!1;"edit_department_form"==t?e.editDepartmentData():"add_department_form"==t&&e.addDepartmentData()})},editDepartmentData:function(){var t=this;this.editDepartmentShow=!1,$http.pc_post("admin/updateDepartment",this.edit_department_form,"loading").then(function(e){1===e.result?(t.$message.success(e.msg),t.$set(t.edit_department_item,"name",t.edit_department_form.name),t.$set(t.edit_department_item,"order",t.edit_department_form.order)):e.msg&&t.$message.error(e.msg)}).catch(function(t){console.error(t)})},addDepartmentData:function(){var t=this;this.addDepartmentShow=!1;var e={};e.name=this.add_department_form.name,e.order=this.add_department_form.order,this.add_parent_department_item&&this.add_parent_department_item.id?e.parent_id=this.add_parent_department_item.id:e.parent_id=this.add_department_form.parent_arr[this.add_department_form.parent_arr.length-1],console.log(e),$http.pc_post("admin/createDepartment",e,"loading").then(function(e){1===e.result?(t.$message.success(e.msg),t.add_department_form={name:"",order:"",parent_arr:[]},t.getDepartmentList()):e.msg&&t.$message.error(e.msg)}).catch(function(t){console.error(t)})},syncWechatDepartment:function(){var t=this;$http.pc_get("admin/refreshDepartmentList",{},"loading").then(function(e){1===e.result?(t.$message.success(e.msg),t.getDepartmentList()):e.data&&e.data.is_set&&1==e.data.is_set?t.syncDepartmentTipsShow=!0:e.msg&&t.$message.error(e.msg)}).catch(function(t){console.error(t)})},pushWechatDepartment:function(){var t=this;$http.pc_get("admin/pushDepartment",{},"loading").then(function(e){1===e.result?t.$message.success(e.msg):e.msg&&t.$message.error(e.msg)}).catch(function(t){console.error(t)})},getDepartmentList:function(){var t=this;$http.pc_get("admin/getDepatmemtList",{},"loading").then(function(e){1===e.result?(t.department_list=t.tableData=h=e.data.list,console.log(h)):e.msg&&t.$message.error(e.msg)}).catch(function(t){console.error(t)})},openDepartmentDirector:function(t){this.department_id!=t?(this.$refs.choice_staff&&this.$refs.choice_staff.delChoiceAll(),this.department_id=t,this.getStaffList()):this.addDepartmentDirectorShow=!0},setDepartmentDirector:function(){var t=this;this.addDepartmentDirectorShow=!1;var e=this.checkboxArr.map(function(t){return t.id});$http.pc_post("admin/setDepartmentLeader",{department_id:this.department_id,staff_id:e},"loading").then(function(e){1===e.result?e.msg&&t.$message.success(e.msg):e.msg&&(t.department_id=0,t.$message.error(e.msg))}).catch(function(t){console.error(t)})},getStaffList:function(){var t=this;$http.pc_get("admin/getStaffList",{department_id:this.department_id,sub_page:1,get_leader:1},"loading").then(function(e){1===e.result?(console.log(e.data.data),t.staff_list=e.data.data,t.addDepartmentDirectorShow=!0,t.$nextTick(function(){t.$refs.choice_staff&&t.$refs.choice_staff.setChoiceData(e.data.leader_list)})):e.msg&&t.$message.error(e.msg)}).catch(function(t){console.error(t)})},onSearch:function(){var t=this;this.search_text!=f&&(f=this.search_text,this.tableData=[],this.$nextTick(function(){""==f?t.tableData=h:(_=[],function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:h;for(var a=0;a<e.length;a++)e[a].name.indexOf(f)>=0&&_.push(e[a]),e[a].has_one_sub_department.length>0&&t(e[a].has_one_sub_department)}(),t.tableData=_,t.$refs.tableData.doLayout(),console.log(t.tableData,_))}))}}},v=(a("EMT4"),a("ImUg"),Object(l.a)(u,function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"staff"},[a("department_side"),t._v(" "),a("div",{staticClass:"staff-right-box"},[a("div",{staticClass:"staff-right-container"},[a("div",{staticClass:"header"},[t._m(0),t._v(" "),a("div",{staticClass:"header-operation"},[a("div",{staticClass:"header-operation-item"},[a("el-input",{attrs:{placeholder:"部门名称"},model:{value:t.search_text,callback:function(e){t.search_text=e},expression:"search_text"}})],1),t._v(" "),a("div",{staticClass:"header-button"},[a("div",{staticClass:"button",on:{click:t.onSearch}},[t._v("搜索")])])])]),t._v(" "),a("div",{staticClass:"main"},[a("div",{staticClass:"main-right"},[a("div",{staticClass:"main-right-header"},[t._m(1),t._v(" "),a("div",{staticClass:"header-button"},[a("div",{staticClass:"button",on:{click:t.openAddDepartment}},[t._v("\n 添加部门\n ")]),t._v(" "),a("div",{staticClass:"button",on:{click:t.syncWechatDepartment}},[t._v("\n 同步企业微信部门\n ")]),t._v(" "),a("div",{staticClass:"button",on:{click:t.pushWechatDepartment}},[t._v("\n 推送到企业微信\n ")])])]),t._v(" "),a("div",{staticClass:"table-list"},[a("el-table",{ref:"tableData",staticStyle:{width:"100%"},attrs:{data:t.tableData,"row-key":"id",height:"calc(100vh - 28vh)","tree-props":{children:"has_one_sub_department"}}},[a("el-table-column",{attrs:{type:"",fixed:"",prop:"id",label:"ID",width:"150"}}),t._v(" "),a("el-table-column",{attrs:{type:"",prop:"order",label:"排序",width:"120"}}),t._v(" "),a("el-table-column",{attrs:{prop:"name",label:"部门名称",width:"200"}}),t._v(" "),a("el-table-column",{attrs:{prop:"parent_name",label:"上级部门",width:"200"}}),t._v(" "),a("el-table-column",{attrs:{prop:"parent_name",label:"是否管理企业微信",width:"200",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("span",[t._v(t._s(0==e.row.wechat_department_id?"否":"是"))])]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"staff_count",label:"员工数量",width:"200",align:"center"}}),t._v(" "),a("el-table-column",{attrs:{label:"操作",width:"300"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"operation"},[0!=e.row.parent_id&&1==e.row.premission.setDepartmentLeader?a("i",{staticClass:"iconfont icon-fontclass-mima",attrs:{title:"权限设置"},on:{click:function(a){t.gotoDepartmentPermission(e.row.id)}}}):t._e(),t._v(" "),0!=e.row.createDepartment?a("i",{staticClass:"iconfont icon-jiahao",attrs:{title:"添加子部门"},on:{click:function(a){t.addChildDepartment(e.row)}}}):t._e(),t._v(" "),1==e.row.premission.updateDepartment?a("i",{staticClass:"iconfont icon-ht_list_line_apply",attrs:{title:"编辑部门名称"},on:{click:function(a){t.editDepartmentName(e.row)}}}):t._e(),t._v(" "),1==e.row.premission.setDepartmentLeader?a("i",{staticClass:"iconfont icon-massage_client",attrs:{title:"设置部门管理员"},on:{click:function(a){t.openDepartmentDirector(e.row.id)}}}):t._e(),t._v(" "),1==e.row.premission.deleteDepartment?a("i",{staticClass:"iconfont icon-ht_operation_delete",on:{click:function(a){t.delDepartment(e.row)}}}):t._e()])]}}])})],1)],1)])])])]),t._v(" "),a("el-dialog",{attrs:{title:"操作提示",visible:t.syncDepartmentTipsShow,width:"30%",center:""},on:{"update:visible":function(e){t.syncDepartmentTipsShow=e}}},[a("span",[t._v("您未开启企业微信,请先在设置--企业微信配置中正确开启企业微信信息!")]),t._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("div",{staticClass:"button theme-button",staticStyle:{width:"80px",height:"30px","margin-right":"10px"},on:{click:function(e){t.syncDepartmentTipsShow=!1}}},[t._v("\n 确定\n ")]),t._v(" "),a("div",{staticClass:"button theme-button",staticStyle:{width:"80px",height:"30px"},on:{click:t.gotoSettingConfig}},[t._v("\n 去配置\n ")])])]),t._v(" "),a("el-dialog",{attrs:{title:"操作提示",visible:t.delDepartmentTipsShow,width:"30%",center:""},on:{"update:visible":function(e){t.delDepartmentTipsShow=e}}},[a("span",[t._v("您确定要删除当前部门嘛!!!")]),t._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("div",{staticClass:"button theme-button",staticStyle:{width:"80px",height:"30px","margin-right":"10px"},on:{click:t.confirmDelDepartment}},[t._v("\n 确定\n ")]),t._v(" "),a("div",{staticClass:"button gray-button",staticStyle:{width:"80px",height:"30px"},on:{click:function(e){t.delDepartmentTipsShow=!1}}},[t._v("\n 取消\n ")])])]),t._v(" "),a("el-dialog",{attrs:{title:"添加部门",visible:t.addDepartmentShow,width:"40%",center:""},on:{"update:visible":function(e){t.addDepartmentShow=e}}},[a("el-form",{ref:"add_department_form",attrs:{model:t.add_department_form,rules:t.rules,"label-width":"100px"}},[a("el-form-item",{attrs:{label:"部门名称",prop:"name"}},[a("el-input",{staticStyle:{width:"70%"},attrs:{placeholder:""},model:{value:t.add_department_form.name,callback:function(e){t.$set(t.add_department_form,"name",e)},expression:"add_department_form.name"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"排序",prop:"order"}},[a("el-input",{staticStyle:{width:"70%"},attrs:{placeholder:""},model:{value:t.add_department_form.order,callback:function(e){t.$set(t.add_department_form,"order",e)},expression:"add_department_form.order"}})],1),t._v(" "),t.add_parent_department_item.id?t._e():a("el-form-item",{attrs:{label:"所属部门"}},[a("el-cascader",{ref:"depCascader",staticStyle:{width:"80%"},attrs:{options:t.department_list,props:{checkStrictly:!0,label:"name",value:"id",children:"has_one_sub_department",disabled:"create_department_disabled"},clearable:""},on:{change:t.changeDepartment},model:{value:t.add_department_form.parent_arr,callback:function(e){t.$set(t.add_department_form,"parent_arr",e)},expression:"add_department_form.parent_arr"}})],1),t._v(" "),t.add_parent_department_item.id?a("el-form-item",{attrs:{label:"所属部门"}},[a("el-input",{staticStyle:{width:"70%"},attrs:{disabled:!0,placeholder:""},model:{value:t.add_parent_department_item.name,callback:function(e){t.$set(t.add_parent_department_item,"name",e)},expression:"add_parent_department_item.name"}})],1):t._e()],1),t._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("div",{staticClass:"button theme-button",staticStyle:{width:"80px",height:"30px","margin-right":"10px"},on:{click:function(e){t.checkForm("add_department_form")}}},[t._v("\n 确定\n ")]),t._v(" "),a("div",{staticClass:"button gray-button",staticStyle:{width:"80px",height:"30px"},on:{click:function(e){t.addDepartmentShow=!1}}},[t._v("\n 取消\n ")])])],1),t._v(" "),a("el-dialog",{attrs:{title:"修改名称",visible:t.editDepartmentShow,width:"30%",center:""},on:{"update:visible":function(e){t.editDepartmentShow=e}}},[a("el-form",{ref:"edit_department_form",attrs:{rules:t.rules,model:t.edit_department_form,"label-width":"100px"}},[a("el-form-item",{attrs:{label:"部门名称",prop:"name"}},[a("el-input",{staticStyle:{width:"70%"},attrs:{placeholder:""},model:{value:t.edit_department_form.name,callback:function(e){t.$set(t.edit_department_form,"name",e)},expression:"edit_department_form.name"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"排序",prop:"order"}},[a("el-input",{staticStyle:{width:"70%"},attrs:{type:"number",placeholder:""},model:{value:t.edit_department_form.order,callback:function(e){t.$set(t.edit_department_form,"order",e)},expression:"edit_department_form.order"}})],1)],1),t._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("div",{staticClass:"button theme-button",staticStyle:{width:"80px",height:"30px","margin-right":"10px"},on:{click:function(e){t.checkForm("edit_department_form")}}},[t._v("\n 确定\n ")]),t._v(" "),a("div",{staticClass:"button gray-button",staticStyle:{width:"80px",height:"30px"},on:{click:function(e){t.editDepartmentShow=!1}}},[t._v("\n 取消\n ")])])],1),t._v(" "),a("el-dialog",{attrs:{title:"设置部门主管",visible:t.addDepartmentDirectorShow,width:"835px",center:""},on:{"update:visible":function(e){t.addDepartmentDirectorShow=e}}},[a("div",{staticClass:"visibleRange"},[a("div",{staticClass:"visibleRange-left"},[a("div",{staticClass:"search-container"},[a("el-input",{attrs:{placeholder:"输入关键词搜索"},model:{value:t.search_text,callback:function(e){t.search_text=e},expression:"search_text"}}),t._v(" "),a("div",{staticClass:"button theme-button",staticStyle:{width:"80px",height:"36px","margin-left":"20px","flex-shrink":"0"}},[t._v("\n 搜索\n ")])],1),t._v(" "),a("div",{staticClass:"department-container"},[a("choice_staff",{ref:"choice_staff",attrs:{multiple:!0,search_name:t.search_text,choice_obj:t.staff_list},on:{choiceData:t.choiceData}})],1)]),t._v(" "),a("div",{staticStyle:{width:"50px"}}),t._v(" "),a("div",{staticClass:"visibleRange-right"},[a("div",{staticClass:"department-checkbox-container"},t._l(t.checkboxArr,function(e){return a("div",{key:e.id,staticClass:"staff_item"},[a("i",{staticClass:"iconfont icon-fontclass-daili"}),t._v(" "),a("div",{staticClass:"text"},[t._v(t._s(e.name))]),t._v(" "),a("i",{staticClass:"iconfont icon-close11",on:{click:function(a){t.delChoice(e.id)}}})])}))])]),t._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("div",{staticClass:"button gray-button",staticStyle:{width:"80px",height:"30px"},on:{click:function(e){t.addDepartmentDirectorShow=!1}}},[t._v("\n 取消\n ")]),t._v(" "),a("div",{staticClass:"button theme-button",staticStyle:{width:"80px",height:"30px","margin-left":"10px"},on:{click:t.setDepartmentDirector}},[t._v("\n 确定\n ")])])])],1)},[function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"header-title"},[e("span"),e("b",[this._v("部门管理")])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"header-title"},[e("span"),e("b",[this._v("部门管理")])])}],!1,null,"5d2257c4",null));v.options.__file="department_list.vue";e.default=v.exports},uePT:function(t,e,a){"use strict";var i=a("whDD");a.n(i).a},whDD:function(t,e,a){}}]);