1 |
- webpackJsonp([91],{YuOW:function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});a("XmAh");var i=a("il3B"),n=a("NzR9");a("7+uW").a.use(i.a);var o={data:function(){return{title:"新增部门",formdata:{},employee_formdata:{id:"",name:"",img_url:""},selecte_employee_name:"",company_info:this.$userInfo().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/pro/department/create",selected:{employee:[],dept:[]},employee_list:{employee:[],dept:[]},depts:[]}},components:{DeptSelectorCell:n.a},watch:{depts:function(t){t.length>0?this.formdata.pid=t[0].dept_id:this.formdata.pid="0"}},methods:{routeBack:function(){this.formdata={},this.$route_back()},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};this.$axiosUser("post",this.save_url,e,"v2").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,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}),this.$axiosUser("get","/api/pro/department/info",{id:this.$route.query.id},"v2").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;this.$axiosUser("get","/api/pro/department/info",{id:this.$route.query.parent_id},"v2").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;i.a.confirm({title:"提示",message:"确认删除该部门?"}).then(function(e){t.$axiosUser("POST","/api/pro/department/delete",{id:t.$route.query.id},"v2").then(function(e){1==e.data.code?(t.$toast(e.data.msg),setTimeout(function(){t.$route_back()},300)):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})})}},activated:function(){"edit"==this.$route.query.type?(this.save_url="/api/pro/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}]},created:function(){"edit"==this.$route.query.type?(this.save_url="/api/pro/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}]}},d={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:t.title,"left-text":"返回","left-arrow":""},on:{"click-left":function(e){return t.routeBack()}}},[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:t.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,isShowDepts:!0},model:{value:t.depts,callback:function(e){t.depts=e},expression:"depts"}})],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 s=a("VU/8")(o,d,!1,function(t){a("y/aS")},"data-v-7029254f",null);e.default=s.exports},"y/aS":function(t,e){}});
|