webpackJsonp([39],{"35em":function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a("mvHQ"),o=a.n(r),i=(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?String(t.data.roleId):"5",e.formData=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"}],roleId:[{required:!0,message:"请选择角色",trigger:"blur"}]},roles:[{id:"5",name:"管理员"},{id:"7",name:"用户"},{id:"8",name:"总经理"},{id:"9",name:"片区经理"},{id:"10",name:"业务员"}],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));delete t.roleInfoList,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("失败")})},onDelete:function(){var e=this;this.$alert("删除将无法恢复，确认要删除么？","警告",{type:"error"}).then(function(){return e.$http.post({url:"/userInfo/del",data:{id:e.formData.id}})}).then(function(){e.$message.success("删除成功"),e.$router.go(-1)}).catch(function(t){"cancel"===t?e.$message.info("删除取消"):e.$message.error("删除失败")})}}}),n={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(" "),a("el-form-item",{attrs:{prop:"roleId",label:"角色"}},[a("el-select",{staticStyle:{width:"100%"},attrs:{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:"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(" "),e.formData.id?a("el-button",{attrs:{type:"danger"},on:{click:e.onDelete}},[e._v("删除")]):e._e(),e._v(" "),a("el-button",{on:{click:function(t){e.$router.go(-1)}}},[e._v("取消")])],1)],1)],1)},staticRenderFns:[]};var s=a("VU/8")(i,n,!1,function(e){a("L7pR")},"data-v-608ef719",null);t.default=s.exports},L7pR:function(e,t){}});
//# sourceMappingURL=39.154417e0ac4d10db6f14.js.map