webpackJsonp([15],{"35em":function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a("mvHQ"),o=a.n(r),s=(a("ftAF"),{created:function(){var e=this;this.$route.query.id&&this.$http.get({url:"/userInfo/getOne",data:{id:this.$route.query.id}}).then(function(t){t.success&&(t.data.roleId=t.data.roleId?t.data.roleId.split(",").map(function(e){return Number(e)}):[],t.data.departId=t.data.departId?t.data.departId.split(","):[],e.formData=t.data)}),this.$http.get({url:"/sysRole/all"}).then(function(t){t.success&&(e.roles=t.data)}),this.$http.get({url:"/departInfo/departTree"}).then(function(t){if(t.success){e.departs=function e(t){return t.sort(function(e,t){return e.extra.sort-t.extra.sort}),t.map(function(t){var a={value:t.id,label:t.name,parentId:t.parentId,extra:t.extra};return t.children instanceof Array&&(a.children=e(t.children)),a})}(t.data)}})},data:function(){return{saving:!1,formData:{departId:[]},rules:{icon:[{required:!0,message:"请上传头像",trigger:"blur"}],username:[{required:!0,message:"请输入昵称",trigger:"blur"}],phone:[{required:!0,message:"请输入手机号",trigger:"blur"},{validator:function(e,t,a){t?/^1[3-9]\d{9}$/.test(t)?a():a(new Error("请输入正确的手机号")):a(new Error("请输入手机号"))},trigger:"blur"}],password:[{required:!0,message:"请输入密码",trigger:"blur"}],roleId:[{required:!0,message:"请选择角色",trigger:"blur"}]},roles:[],departs:[]}},methods:{onSave:function(){var e=this;this.$refs.form.validate(function(t){if(!t)return!1;e.submit()})},submit:function(){var e=this,t=JSON.parse(o()(this.formData));this.$http.post({url:this.formData.id?"/userInfo/update":"/userInfo/save",data:t}).then(function(t){t.success?(e.$message.success("成功"),e.$router.go(-1)):e.$message.warning("失败")})}}}),l={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",[a("el-form",{ref:"form",staticStyle:{"max-width":"500px"},attrs:{model:e.formData,rules:e.rules,"label-width":"80px","label-position":"right",size:"small"}},[a("el-form-item",{attrs:{prop:"icon",label:"头像"}},[a("single-upload",{model:{value:e.formData.icon,callback:function(t){e.$set(e.formData,"icon",t)},expression:"formData.icon"}})],1),e._v(" "),a("el-form-item",{attrs:{prop:"username",label:"用户名"}},[a("el-input",{model:{value:e.formData.username,callback:function(t){e.$set(e.formData,"username",t)},expression:"formData.username"}})],1),e._v(" "),a("el-form-item",{attrs:{prop:"phone",label:"手机"}},[a("el-input",{model:{value:e.formData.phone,callback:function(t){e.$set(e.formData,"phone",t)},expression:"formData.phone"}})],1),e._v(" "),e.$route.query.id?e._e():a("el-form-item",{attrs:{prop:"phone",label:"密码"}},[a("el-input",{model:{value:e.formData.password,callback:function(t){e.$set(e.formData,"password",t)},expression:"formData.password"}})],1),e._v(" "),a("el-form-item",{attrs:{prop:"roleId",label:"角色"}},[a("el-select",{staticStyle:{width:"100%"},attrs:{multiple:"",placeholder:"请选择"},model:{value:e.formData.roleId,callback:function(t){e.$set(e.formData,"roleId",t)},expression:"formData.roleId"}},e._l(e.roles,function(e){return a("el-option",{key:e.id,attrs:{label:e.name,value:e.id}})}))],1),e._v(" "),a("el-form-item",{attrs:{prop:"departId",label:"部门"}},[a("el-cascader",{attrs:{options:e.departs},model:{value:e.formData.departId,callback:function(t){e.$set(e.formData,"departId",t)},expression:"formData.departId"}})],1),e._v(" "),a("el-form-item",{attrs:{prop:"birthday",label:"生日"}},[a("el-date-picker",{attrs:{format:"yyyy-MM-dd","value-format":"timestamp"},model:{value:e.formData.birthday,callback:function(t){e.$set(e.formData,"birthday",t)},expression:"formData.birthday"}})],1),e._v(" "),a("el-form-item",{attrs:{prop:"createTime",label:"创建时间"}},[a("el-date-picker",{attrs:{type:"datetime",format:"yyyy-MM-dd HH:mm:ss","value-format":"timestamp"},model:{value:e.formData.createTime,callback:function(t){e.$set(e.formData,"createTime",t)},expression:"formData.createTime"}})],1),e._v(" "),a("el-form-item",[a("el-button",{attrs:{loading:e.$store.state.fetchingData,type:"primary"},on:{click:e.onSave}},[e._v("保存")]),e._v(" "),a("el-button",{on:{click:function(t){e.$router.go(-1)}}},[e._v("取消")])],1)],1)],1)},staticRenderFns:[]};var i=a("VU/8")(s,l,!1,function(e){a("Rb2O")},"data-v-e8acf966",null);t.default=i.exports},Rb2O:function(e,t){}});
//# sourceMappingURL=15.fb7498512a5115fae2b4.js.map