chunk-5503.81d086f5.js 12 KB

1
  1. (window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-5503"],{"gDS+":function(e,t,a){e.exports={default:a("oh+g"),__esModule:!0}},"oh+g":function(e,t,a){var i=a("WEpk"),l=i.JSON||(i.JSON={stringify:JSON.stringify});e.exports=function(e){return l.stringify.apply(l,arguments)}},uEPD:function(e,t,a){"use strict";a.r(t);var i=a("FyfS"),l=a.n(i),s=a("P2sY"),r=a.n(s),n=a("gDS+"),o=a.n(n),u=a("QbLZ"),d=a.n(u),c=a("t3Un");var m=[{value:1,name:"男"},{value:2,name:"女"},{value:"",name:"全部"}],p=[{value:0,name:"普通会员"},{value:1,name:"VIP会员"},{value:"",name:"全部"}],v=[{value:0,name:"冻结"},{value:1,name:"激活"},{value:"",name:"全部"}],f={name:"User",components:{Pagination:a("Mz3J").a},filters:{genderDicFilter:function(e){return 1===e||2===e?m[e-1].name:"未知"},levelDicFilter:function(e){return 0===e||1===e?p[e].name:"未知"}},data:function(){return{list:[],total:0,listLoading:!0,listQuery:{pageNo:1,limit:20,nickname:void 0,id:void 0,status:void 0,level:void 0,gender:void 0},dataForm:{id:void 0,level:void 0,phone:void 0,gender:void 0,nickname:void 0,birthday:void 0,status:void 0,password:void 0},downloadLoading:!1,genderDic:m,levelDic:p,statusDic:v,textMap:{update:"编辑",create:"创建"},dialogFormVisible:!1,dialogStatus:"",rules:{nickname:[{required:!0,message:"用户昵称不能为空",trigger:"blur"}],phone:[{required:!0,message:"用户手机不能为空",trigger:"blur"},{pattern:/^1[3456789]\d{9}$/,message:"请输入正确电话"}],gender:[{required:!0,message:"请选择用户性别类型",trigger:"blur"}],level:[{required:!0,message:"请选择用户会员等级状态",trigger:"blur"}],status:[{required:!0,message:"请选择用户状态",trigger:"blur"}],password:[{required:!0,message:"请输入密码",trigger:"blur"},{pattern:/^[0-9a-zA-Z$./]{8}/,message:"至少八个数字和字母"}]}}},created:function(){this.getList()},methods:{getList:function(){var e=this;this.listLoading=!0,function(e){return Object(c.a)({method:"get",params:d()({_gp:"admin.user",_mt:"getUser"},e)})}(this.listQuery).then(function(t){e.list=t.data.data.items,e.total=t.data.data.total,e.listLoading=!1}).catch(function(){e.list=[],e.total=0,e.listLoading=!1})},resetForm:function(){this.dataForm={id:void 0,level:void 0,phone:void 0,gender:void 0,nickname:void 0,birthday:void 0,status:void 0}},handleFilter:function(){this.listQuery.pageNo=1,this.getList()},handleStatus:function(e){var t=this;this.resetForm(),this.dataForm.id=e.id,this.dataForm.status=1===e.status?0:1,function(e){return Object(c.a)({method:"post",params:{_gp:"admin.user",_mt:"updateStatus",userId:e.id,status:e.status}})}(this.dataForm).then(function(e){t.$notify.success({title:"成功",message:"状态更改成功"}),t.getList()}).catch(function(){t.list=[],t.total=0,t.listLoading=!1})},handleCreate:function(){var e=this;this.resetForm(),this.dialogStatus="create",this.dialogFormVisible=!0,this.$nextTick(function(){e.$refs.dataForm.clearValidate()})},createData:function(){var e=this;this.$refs.dataForm.validate(function(t){t&&function(e){return Object(c.a)({method:"post",params:{_gp:"admin.user",_mt:"addUser",user:o()(e)}})}(e.dataForm).then(function(t){e.list.unshift(t.data.data),e.dialogFormVisible=!1,e.$notify.success({title:"成功",message:"创建成功"}),e.listQuery.nickname=e.dataForm.nickname,e.getList()}).catch(function(t){e.$notify.error({title:"失败",message:t.data.errmsg})})})},handleUpdate:function(e){var t=this;this.dataForm=r()({},e),this.dialogStatus="update",this.dialogFormVisible=!0,this.$nextTick(function(){t.$refs.dataForm.clearValidate()})},updateData:function(){var e=this;this.$refs.dataForm.validate(function(t){t&&function(e){return Object(c.a)({method:"post",params:{_gp:"admin.user",_mt:"updateUser",user:o()(e)}})}(e.dataForm).then(function(){var t=!0,a=!1,i=void 0;try{for(var s,r=l()(e.list);!(t=(s=r.next()).done);t=!0){var n=s.value;if(n.id===e.dataForm.id){var o=e.list.indexOf(n);e.list.splice(o,1,e.dataForm);break}}}catch(e){a=!0,i=e}finally{try{!t&&r.return&&r.return()}finally{if(a)throw i}}e.dialogFormVisible=!1,e.$notify.success({title:"成功",message:"更新用户成功"})}).catch(function(t){e.$notify.error({title:"失败",message:t.data.errmsg})})})},handleDelete:function(e){var t=this;this.$confirm("此操作将永久删除该用户---"+e.nickname+"---, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){(function(e,t){return Object(c.a)({method:"post",params:{_gp:"admin.user",_mt:"deleteUser",id:e,nickname:t}})})(e.id,e.nickname).then(function(a){t.$notify.success({title:"成功",message:"删除成功"});var i=t.list.indexOf(e);t.list.splice(i,1)}).catch(function(e){t.$notify.error({title:"失败",message:e.data.errmsg})})}).catch(function(){return!1})}}},g=a("KHd+"),h=Object(g.a)(f,function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"app-container"},[a("div",{staticClass:"filter-container"},[a("el-select",{staticClass:"filter-item",staticStyle:{width:"200px"},attrs:{placeholder:"请选择用户状态"},model:{value:e.listQuery.status,callback:function(t){e.$set(e.listQuery,"status",t)},expression:"listQuery.status"}},e._l(e.statusDic,function(e,t){return a("el-option",{key:t,attrs:{label:e.name,value:e.value}})})),e._v(" "),a("el-select",{staticClass:"filter-item",staticStyle:{width:"200px"},attrs:{placeholder:"请选择用户会员等级"},model:{value:e.listQuery.level,callback:function(t){e.$set(e.listQuery,"level",t)},expression:"listQuery.level"}},e._l(e.levelDic,function(e,t){return a("el-option",{key:t,attrs:{label:e.name,value:e.value}})})),e._v(" "),a("el-select",{staticClass:"filter-item",staticStyle:{width:"200px"},attrs:{placeholder:"请选择用户性别"},model:{value:e.listQuery.gender,callback:function(t){e.$set(e.listQuery,"gender",t)},expression:"listQuery.gender"}},e._l(e.genderDic,function(e,t){return a("el-option",{key:t,attrs:{label:e.name,value:e.value}})})),e._v(" "),a("el-input",{staticClass:"filter-item",staticStyle:{width:"200px"},attrs:{clearable:"",placeholder:"请输入用户Id"},model:{value:e.listQuery.id,callback:function(t){e.$set(e.listQuery,"id",t)},expression:"listQuery.id"}}),e._v(" "),a("el-input",{staticClass:"filter-item",staticStyle:{width:"200px"},attrs:{clearable:"",placeholder:"请输入昵称"},model:{value:e.listQuery.nickname,callback:function(t){e.$set(e.listQuery,"nickname",t)},expression:"listQuery.nickname"}}),e._v(" "),a("el-button",{directives:[{name:"permission",rawName:"v-permission",value:["system:user:query"],expression:"['system:user:query']"}],staticClass:"filter-item",attrs:{type:"primary",icon:"el-icon-search"},on:{click:e.handleFilter}},[e._v("查找")])],1),e._v(" "),a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.listLoading,expression:"listLoading"}],attrs:{data:e.list,size:"small","element-loading-text":"正在查询中。。。",border:"",fit:"","highlight-current-row":""}},[a("el-table-column",{attrs:{align:"center",width:"100px",label:"用户ID",prop:"id",sortable:""}}),e._v(" "),a("el-table-column",{attrs:{align:"center",label:"昵称",prop:"nickname"}}),e._v(" "),a("el-table-column",{attrs:{align:"center",label:"手机号码",prop:"phone"}}),e._v(" "),a("el-table-column",{attrs:{align:"center",label:"性别",prop:"gender"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-tag",[e._v(e._s(e._f("genderDicFilter")(t.row.gender)))])]}}])}),e._v(" "),a("el-table-column",{attrs:{align:"center",label:"会员等级",prop:"level"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-tag",[e._v(e._s(e._f("levelDicFilter")(t.row.level)))])]}}])}),e._v(" "),a("el-table-column",{attrs:{align:"center",label:"生日",prop:"birthday"},scopedSlots:e._u([{key:"default",fn:function(t){return[e._v(e._s(e._f("formatDate")(t.row.birthday)))]}}])}),e._v(" "),a("el-table-column",{attrs:{align:"center",label:"状态",prop:"status"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-tag",[e._v(e._s(0===t.row.status?"冻结":"激活"))])]}}])}),e._v(" "),a("el-table-column",{attrs:{align:"center",label:"上次登录时间",prop:"gmtLastLogin"},scopedSlots:e._u([{key:"default",fn:function(t){return[e._v(e._s(e._f("formatTime")(t.row.gmtLastLogin)))]}}])}),e._v(" "),a("el-table-column",{attrs:{align:"center",label:"上次登录IP",prop:"lastLoginIp"}}),e._v(" "),a("el-table-column",{attrs:{align:"center",label:"操作",width:"300","class-name":"small-padding fixed-width"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-button",{directives:[{name:"permission",rawName:"v-permission",value:["system:user:update"],expression:"['system:user:update']"}],attrs:{type:"primary",size:"mini"},on:{click:function(a){e.handleStatus(t.row)}}},[e._v(e._s(0===t.row.status?"激活":"冻结"))]),e._v(" "),a("el-button",{directives:[{name:"permission",rawName:"v-permission",value:["system:user:update"],expression:"['system:user:update']"}],attrs:{type:"primary",size:"mini"},on:{click:function(a){e.handleUpdate(t.row)}}},[e._v("编辑")]),e._v(" "),a("el-button",{directives:[{name:"permission",rawName:"v-permission",value:["system:user:delete"],expression:"['system:user:delete']"}],attrs:{type:"danger",size:"mini"},on:{click:function(a){e.handleDelete(t.row)}}},[e._v("删除")])]}}])})],1),e._v(" "),a("pagination",{directives:[{name:"show",rawName:"v-show",value:e.total>0,expression:"total>0"}],attrs:{total:e.total,page:e.listQuery.pageNo,limit:e.listQuery.limit},on:{"update:page":function(t){e.$set(e.listQuery,"pageNo",t)},"update:limit":function(t){e.$set(e.listQuery,"limit",t)},pagination:e.getList}}),e._v(" "),a("el-dialog",{attrs:{title:e.textMap[e.dialogStatus],visible:e.dialogFormVisible},on:{"update:visible":function(t){e.dialogFormVisible=t}}},[a("el-form",{ref:"dataForm",staticStyle:{width:"400px","margin-left":"50px"},attrs:{rules:e.rules,model:e.dataForm,"status-icon":"","label-position":"left","label-width":"100px"}},[a("el-form-item",{attrs:{label:"隐藏的用户id",prop:"id",hidden:""}},[a("el-input",{model:{value:e.dataForm.id,callback:function(t){e.$set(e.dataForm,"id",t)},expression:"dataForm.id"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"用户昵称",prop:"nickname"}},[a("el-input",{model:{value:e.dataForm.nickname,callback:function(t){e.$set(e.dataForm,"nickname",t)},expression:"dataForm.nickname"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"用户手机号",prop:"phone"}},[a("el-input",{model:{value:e.dataForm.phone,callback:function(t){e.$set(e.dataForm,"phone",t)},expression:"dataForm.phone"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"用户密码",prop:"password"}},[a("el-input",{model:{value:e.dataForm.password,callback:function(t){e.$set(e.dataForm,"password",t)},expression:"dataForm.password"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"用户性别",prop:"gender"}},[a("el-select",{attrs:{placeholder:"请选择"},model:{value:e.dataForm.gender,callback:function(t){e.$set(e.dataForm,"gender",t)},expression:"dataForm.gender"}},e._l(e.genderDic,function(e,t){return a("el-option",{key:t,attrs:{label:e.name,value:e.value}})}))],1),e._v(" "),a("el-form-item",{attrs:{label:"用户等级",prop:"level"}},[a("el-select",{attrs:{placeholder:"请选择"},model:{value:e.dataForm.level,callback:function(t){e.$set(e.dataForm,"level",t)},expression:"dataForm.level"}},e._l(e.levelDic,function(e,t){return a("el-option",{key:t,attrs:{label:e.name,value:e.value}})}))],1),e._v(" "),a("el-form-item",{attrs:{label:"用户状态",prop:"status"}},[a("el-select",{attrs:{placeholder:"请选择"},model:{value:e.dataForm.status,callback:function(t){e.$set(e.dataForm,"status",t)},expression:"dataForm.status"}},e._l(e.statusDic,function(e,t){return a("el-option",{key:t,attrs:{label:e.name,value:e.value}})}))],1)],1),e._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(t){e.dialogFormVisible=!1}}},[e._v("取消")]),e._v(" "),"create"==e.dialogStatus?a("el-button",{attrs:{type:"primary"},on:{click:e.createData}},[e._v("确定")]):a("el-button",{attrs:{type:"primary"},on:{click:e.updateData}},[e._v("确定")])],1)],1)],1)},[],!1,null,null,null);h.options.__file="user.vue";t.default=h.exports}}]);