"use strict";(self["webpackChunkeatwhat_admin"]=self["webpackChunkeatwhat_admin"]||[]).push([[801],{3801:function(e,r,s){s.r(r),s.d(r,{default:function(){return n}});var t=function(){var e=this,r=e.$createElement,s=e._self._c||r;return s("el-card",[s("div",{staticClass:"user"},[s("div",{staticClass:"title"},[s("el-alert",{attrs:{title:"用户管理界面",type:"success",center:"",closable:!1}})],1),s("div",{staticClass:"btn"},[s("el-button",{attrs:{type:"primary",size:"small",round:"",icon:"el-icon-plus"},on:{click:function(r){e.addUserDialogVisible=!0}}},[e._v("添加用户")])],1),s("div",{staticClass:"table"},[s("el-table",{staticStyle:{width:"100%"},attrs:{data:e.user.filter((function(r){return!e.userSearch||r.userName.toLowerCase().includes(e.userSearch.toLowerCase())})),fit:"",lazy:"",stripe:!0,border:!0,"highlight-current-row":!0,"empty-text":"🥶正在努力加载中..."}},[s("el-table-column",{attrs:{label:"用户昵称",align:"center"},scopedSlots:e._u([{key:"default",fn:function(r){return[e._v(" "+e._s(r.row.userName||"神秘人")+" ")]}}])}),s("el-table-column",{attrs:{label:"性别",align:"center",width:"100"},scopedSlots:e._u([{key:"default",fn:function(r){return[e._v(" "+e._s(r.row.userGend||"隐私")+" ")]}}])}),s("el-table-column",{attrs:{label:"手机账号",align:"center"},scopedSlots:e._u([{key:"default",fn:function(r){return[e._v(" "+e._s(r.row.userNumb||"未知")+" ")]}}])}),s("el-table-column",{attrs:{label:"喜好",align:"center"},scopedSlots:e._u([{key:"default",fn:function(r){return[e._v(" "+e._s(r.row.userLike||"未知")+" ")]}}])}),s("el-table-column",{attrs:{label:"住址",align:"center"},scopedSlots:e._u([{key:"default",fn:function(r){return[e._v(" "+e._s(r.row.userAdd||"未知")+" ")]}}])}),s("el-table-column",{attrs:{align:"center"},scopedSlots:e._u([{key:"header",fn:function(r){return[s("el-input",{attrs:{size:"mini",placeholder:"输入用户名称搜索"},model:{value:e.userSearch,callback:function(r){e.userSearch=r},expression:"userSearch"}})]}},{key:"default",fn:function(r){return[s("el-button",{attrs:{type:"primary",size:"mini",plain:""},on:{click:function(s){return e.showUpdateUser(r.row.userId)}}},[e._v("编辑")]),s("el-popconfirm",{staticStyle:{"margin-left":"5px"},attrs:{title:"确定删除该用户?此操作不可逆"},on:{confirm:function(s){return e.deleteUser(r.row.userId)}}},[s("el-button",{attrs:{slot:"reference",type:"danger",size:"mini",plain:""},slot:"reference"},[e._v("删除")])],1)]}}])})],1)],1)]),s("el-dialog",{attrs:{title:"添加用户",visible:e.addUserDialogVisible,width:"45%",center:!0},on:{"update:visible":function(r){e.addUserDialogVisible=r},close:e.addUserDialogClosed}},[s("el-form",{ref:"addUserFormRef",attrs:{model:e.addUserForm,"label-width":"80px",size:"small",rules:e.addUserFormRules}},[s("el-form-item",{attrs:{label:"用户昵称",prop:"userName"}},[s("el-input",{attrs:{"prefix-icon":"el-icon-user-solid",autocomplete:"off",maxlength:"8",clearable:!0},model:{value:e.addUserForm.userName,callback:function(r){e.$set(e.addUserForm,"userName",r)},expression:"addUserForm.userName"}})],1),s("el-form-item",{attrs:{label:"用户性别",prop:"userGend"}},[s("el-radio-group",{model:{value:e.addUserForm.userGend,callback:function(r){e.$set(e.addUserForm,"userGend",r)},expression:"addUserForm.userGend"}},[s("el-radio",{attrs:{label:"男"}},[e._v("男")]),s("el-radio",{attrs:{label:"女"}},[e._v("女")])],1)],1),s("el-form-item",{attrs:{label:"用户电话",prop:"userNumb"}},[s("el-input",{attrs:{autocomplete:"off","prefix-icon":"el-icon-phone",clearable:!0,maxlength:"11"},model:{value:e.addUserForm.userNumb,callback:function(r){e.$set(e.addUserForm,"userNumb",e._n(r))},expression:"addUserForm.userNumb"}})],1),s("el-form-item",{attrs:{label:"登陆密码",prop:"userPwd"}},[s("el-input",{attrs:{autocomplete:"off","prefix-icon":"el-icon-lock",clearable:!0,minlength:"6",maxlength:"13","show-password":""},model:{value:e.addUserForm.userPwd,callback:function(r){e.$set(e.addUserForm,"userPwd",r)},expression:"addUserForm.userPwd"}})],1),s("el-form-item",{attrs:{label:"用户喜好",prop:"userLike"}},[s("el-input",{attrs:{autocomplete:"off","prefix-icon":"el-icon-sugar",clearable:!0},model:{value:e.addUserForm.userLike,callback:function(r){e.$set(e.addUserForm,"userLike",r)},expression:"addUserForm.userLike"}})],1),s("el-form-item",{attrs:{label:"用户住址",prop:"userAdd"}},[s("el-cascader",{staticStyle:{width:"100%"},attrs:{options:e.citys,filterable:"",clearable:"",props:{expandTrigger:"hover"}},model:{value:e.addUserForm.userAdd,callback:function(r){e.$set(e.addUserForm,"userAdd",r)},expression:"addUserForm.userAdd"}})],1)],1),s("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("el-button",{attrs:{round:"",plain:"",size:"small",type:"info"},on:{click:function(r){e.addUserDialogVisible=!1}}},[e._v("取 消")]),s("el-button",{attrs:{type:"primary",round:"",plain:"",size:"small"},on:{click:e.addUser}},[e._v("确 定")])],1)],1),s("el-dialog",{attrs:{title:"更新用户信息",visible:e.updateUserDialogVisible,width:"45%",center:!0},on:{"update:visible":function(r){e.updateUserDialogVisible=r}}},[s("el-form",{ref:"updateUserFormRef",attrs:{model:e.updateUserForm,"label-width":"80px",size:"small",rules:e.addUserFormRules}},[s("el-form-item",{attrs:{label:"用户昵称",prop:"userName"}},[s("el-input",{attrs:{"prefix-icon":"el-icon-user-solid",autocomplete:"off",maxlength:"8",clearable:!0},model:{value:e.updateUserForm.userName,callback:function(r){e.$set(e.updateUserForm,"userName",r)},expression:"updateUserForm.userName"}})],1),s("el-form-item",{attrs:{label:"用户性别",prop:"userGend"}},[s("el-radio-group",{model:{value:e.updateUserForm.userGend,callback:function(r){e.$set(e.updateUserForm,"userGend",r)},expression:"updateUserForm.userGend"}},[s("el-radio",{attrs:{label:"男"}},[e._v("男")]),s("el-radio",{attrs:{label:"女"}},[e._v("女")])],1)],1),s("el-form-item",{attrs:{label:"用户电话",prop:"userNumb"}},[s("el-input",{attrs:{autocomplete:"off","prefix-icon":"el-icon-phone",clearable:!0,maxlength:"11"},model:{value:e.updateUserForm.userNumb,callback:function(r){e.$set(e.updateUserForm,"userNumb",e._n(r))},expression:"updateUserForm.userNumb"}})],1),s("el-form-item",{attrs:{label:"登陆密码",prop:"userPwd"}},[s("el-input",{attrs:{autocomplete:"off","prefix-icon":"el-icon-lock",clearable:!0,minlength:"6",maxlength:"13","show-password":""},model:{value:e.updateUserForm.userPwd,callback:function(r){e.$set(e.updateUserForm,"userPwd",r)},expression:"updateUserForm.userPwd"}})],1),s("el-form-item",{attrs:{label:"用户喜好",prop:"userLike"}},[s("el-input",{attrs:{autocomplete:"off","prefix-icon":"el-icon-sugar",clearable:!0},model:{value:e.updateUserForm.userLike,callback:function(r){e.$set(e.updateUserForm,"userLike",r)},expression:"updateUserForm.userLike"}})],1),s("el-form-item",{attrs:{label:"用户住址",prop:"userAdd"}},[s("el-cascader",{staticStyle:{width:"100%"},attrs:{options:e.citys,filterable:"",clearable:"",props:{expandTrigger:"hover"}},model:{value:e.updateUserForm.userAdd,callback:function(r){e.$set(e.updateUserForm,"userAdd",r)},expression:"updateUserForm.userAdd"}})],1)],1),s("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("el-button",{attrs:{round:"",plain:"",size:"small",type:"info"},on:{click:function(r){e.updateUserDialogVisible=!1}}},[e._v("取 消")]),s("el-button",{attrs:{type:"primary",round:"",plain:"",size:"small"},on:{click:e.updateUser}},[e._v("确 定")])],1)],1)],1)},a=[],l=s(3325),o={name:"User",data(){return{user:[],userSearch:"",addUserDialogVisible:!1,updateUserDialogVisible:!1,addUserForm:{userId:"",userPwd:"123456",userName:"神秘人",userNumb:"",userLike:"",userAdd:"",userGend:"男"},updateUserForm:{userId:"",userPwd:"",userName:"",userNumb:"",userLike:"",userAdd:"",userGend:""},addUserFormRules:{userName:[{required:!0,message:"请输入用户昵称",trigger:"blur"},{min:1,max:8,message:"长度在 1 到 8 个字符",trigger:"blur"}],userPwd:[{required:!0,message:"请输入用户登录密码",trigger:"blur"},{min:6,max:13,message:"长度在 6 到 13 个字符",trigger:"blur"}],userNumb:[{required:!0,message:"请输入电话号码",trigger:"blur"},{pattern:/^((13[0-9])|(14[5-9])|(15([0-3]|[5-9]))|(16[6-7])|(17[1-8])|(18[0-9])|(19[1|3])|(19[5|6])|(19[8|9]))\d{8}$/,message:"手机号码格式不符合",trigger:"blur"}],userLike:[],userAdd:[{required:!0,message:"住址不可为空",trigger:"blur"}],userGend:[{required:!0,message:"性别不可为空",trigger:"blur"}]},citys:l.Z}},methods:{async getUser(){const{data:e}=await this.$http.get("user");this.user=e},addUserDialogClosed(){this.$refs.addUserFormRef.resetFields()},addUser(){this.$refs.addUserFormRef.validate((async e=>{if(e){for(let e=0;e{e?(this.updateUserForm.userAdd=this.getLocationTransform(this.updateUserForm.userAdd),await this.$http.put("user",this.updateUserForm),this.getUser(),this.$message.success("更新用户信息成功")):this.$message.error("更新用户信息验证失败")})),this.updateUserDialogVisible=!1},async deleteUser(e){await this.$http.delete("user/"+e),this.getUser(),this.$message.success("删除用户成功!")},guid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var r=16*Math.random()|0,s="x"==e?r:3&r|8;return s.toString(16)}))},getLocationTransform(e){const r=e,s=r[0],t=r[1],a=r[2];var l=[],o=(e=[],"");return this.citys.forEach((e=>{e.value===s&&(o+=e.label,l=e.children)})),l.forEach((r=>{r.value===t&&(o=o+"/"+r.label,e=r.children)})),e.forEach((e=>{e.value===a&&(o=o+"/"+e.label)})),o}},created(){this.getUser()}},i=o,u=s(1001),d=(0,u.Z)(i,t,a,!1,null,null,null),n=d.exports}}]); //# sourceMappingURL=801.259d5b91.js.map