100.90a3157bc89c3098048a.js 4.5 KB

1
  1. webpackJsonp([100],{JjLf:function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});a("XmAh");var d=a("il3B"),i=a("vLgD"),n=a("CC1l"),o=a("EUN7"),r=a("rZyd");a("7+uW").a.use(d.a);var s={data:function(){return{title:"新增部门",formdata:{},employee_formdata:{id:"",name:"",img_url:""},selecte_employee_name:"",user_info:this.$store.getters.user_info,company_info:this.$store.getters.user_info.company_info,select_name:"",select_dept:"",show_dept_selector:!1,show_employee_selector:!1,dept_name_placeholder:"输入部门名称(15个字以内)",dept_info:[],parent_dept_info:[],save_url:"/api/department/create",selected:{employee:[],dept:[]},employee_list:{employee:[],dept:[]},depts:[]}},components:{EmployeeSelector:n.a,EmployeeSelectorCell:o.a,DeptSelectorCell:r.a},watch:{depts:function(t){t.length>0?this.formdata.pid=t[0].dept_id:this.formdata.pid="0"},"formdata.manager":function(t){t.length>0?this.formdata.manage_dept_ids=t[0].id:this.formdata.manage_dept_ids=0}},methods:{edit_dept_list:function(){var t=this;this.$toast.loading({message:"正在保存...",forbidClick:!0});var e={id:this.formdata.id,name:this.formdata.name,pid:this.formdata.pid,manage_dept_ids:this.formdata.manage_dept_ids};Object(i.a)({url:this.save_url,method:"post",data:e}).then(function(a){1==a.data.code?(t.$toast.clear(),t.$toast(a.data.msg),e.selecte_employee_name=t.selecte_employee_name,e.type=t.$route.query.type,t.$keep_alive_update("update_dept_list",e),setTimeout(function(){t.$route_back()},500)):t.$toast(a.data.msg)}).catch(function(t){})},get_dept_info:function(){var t=this;this.$toast.loading({message:"加载中...",forbidClick:!0}),Object(i.a)({url:"/api/department/info",method:"GET",params:{id:this.$route.query.id}}).then(function(e){1==e.data.code?(t.formdata=e.data.data,null==e.data.data.super_department?t.depts=[]:t.depts=[{dept_name:e.data.data.super_department.name,dept_id:e.data.data.super_department.id}],t.$toast.clear()):t.$toast(e.data.msg)}).catch(function(t){})},get_parent_dept_info:function(){var t=this;Object(i.a)({url:"/api/department/info",method:"GET",params:{id:this.$route.query.parent_id}}).then(function(e){1==e.data.code?t.depts=[{dept_name:e.data.data.name,dept_id:e.data.data.id}]:t.$toast(e.data.msg)}).catch(function(t){})},del_dept:function(){var t=this;d.a.confirm({title:"提示",message:"确认删除该部门?"}).then(function(e){Object(i.a)({url:"/api/department/delete",method:"POST",params:{id:t.$route.query.id}}).then(function(e){1==e.data.code?(t.$toast(e.data.msg),t.$keep_alive_update("del_dept_info",{}),setTimeout(function(){t.$route_back()},300)):t.$toast(e.data.msg)}).catch(function(e){t.$toast(e.data.msg)})})},save_btn:function(){var t=this;t.$validator.validate().then(function(e){e?t.edit_dept_list():t.$notify({type:"danger",message:t.$validator.errors.items[0].msg})})}},created:function(){"edit"==this.$route.query.type?(this.save_url="/api/department/update",this.title="编辑部门",this.get_dept_info()):this.$route.query.parent_id?this.get_parent_dept_info():this.depts=[{dept_name:this.company_info.name}]},mounted:function(){}},l={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"dept_box",staticStyle:{"background-color":"rgb(245, 245, 245)",height:"100%"}},[a("van-nav-bar",{attrs:{title:this.title,"left-text":"返回","left-arrow":""},on:{"click-left":t.$route_back}},[a("template",{slot:"right"},[t.formdata.name?a("span",{staticClass:"van-nav-bar__text",on:{click:t.save_btn}},[t._v("保存")]):t._e()])],2),t._v(" "),a("div",{staticClass:"body_com has_header"},[a("scroller",[a("van-cell-group",{staticStyle:{"margin-bottom":"0.4rem"}},[a("van-field",{directives:[{name:"validate",rawName:"v-validate",value:"required|max:15",expression:"'required|max:15'"}],attrs:{label:"部门名称",required:"",name:"部门名称",placeholder:this.dept_name_placeholder},model:{value:t.formdata.name,callback:function(e){t.$set(t.formdata,"name",e)},expression:"formdata.name"}}),t._v(" "),a("DeptSelectorCell",{attrs:{title:"选择部门",multi:!1},model:{value:t.depts,callback:function(e){t.depts=e},expression:"depts"}}),t._v(" "),a("EmployeeSelectorCell",{attrs:{title:"部门主管",multi:!1},model:{value:t.formdata.manager,callback:function(e){t.$set(t.formdata,"manager",e)},expression:"formdata.manager"}})],1),t._v(" "),"edit"==this.$route.query.type?a("van-button",{attrs:{type:"danger",block:""},on:{click:t.del_dept}},[t._v("删除部门")]):t._e()],1)],1)],1)},staticRenderFns:[]};var m=a("VU/8")(s,l,!1,function(t){a("jVuM")},"data-v-2aadc69c",null);e.default=m.exports},jVuM:function(t,e){}});