chunk-7311.b8e24e8a.js 10 KB

1
  1. (window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-7311"],{"9x9g":function(t,e,a){"use strict";var i=a("bS7j");a.n(i).a},CzTM:function(t,e,a){"use strict";a.r(e);var i=a("FyfS"),n=a.n(i),r=a("P2sY"),o=a.n(r),s=a("gDS+"),l=a.n(s),d=a("QbLZ"),u=a.n(d),m=a("t3Un"),c=a("Qyje"),p=a.n(c);var f=a("zF5t"),g=a("rs3x"),v=a("X4fA"),h={name:"Admin",components:{Pagination:a("Mz3J").a},data:function(){return{uploadPath:g.b,list:null,total:0,roleOptions:null,listLoading:!0,listQuery:{page:1,limit:20,username:void 0,sort:"add_time",order:"desc"},tenementForm:{title:void 0,tenementCode:void 0},dataForm:{id:void 0,username:void 0,password:void 0,avatar:void 0,roleIds:[]},dialogFormVisible:!1,dialogStatus:"",textMap:{update:"编辑",create:"创建"},rules:{username:[{required:!0,message:"管理员名称不能为空",trigger:"blur"}],password:[{required:!0,message:"密码不能为空",trigger:"blur"}],phone:[{required:!0,message:"手机号不能为空",trigger:"blur"}],realname:[{required:!0,message:"真实姓名不能为空",trigger:"blur"}]}}},computed:{headers:function(){return{accessToken:Object(v.a)()}}},created:function(){var t=this;this.getList(),Object(f.e)().then(function(e){t.roleOptions=e.data.data})},methods:{formatRole:function(t){for(var e=0;e<this.roleOptions.length;e++)if(t===this.roleOptions[e].value)return this.roleOptions[e].label;return""},getList:function(){var t=this;this.listLoading=!0,function(t){return Object(m.a)({method:"get",params:u()({_gp:"admin",_mt:"list"},t)})}(this.listQuery).then(function(e){t.list=e.data.data.items,t.total=e.data.data.total,t.listLoading=!1}).catch(function(){t.list=[],t.total=0,t.listLoading=!1})},handleFilter:function(){this.listQuery.page=1,this.getList()},resetForm:function(){this.dataForm={id:void 0,username:void 0,password:void 0,avatar:void 0,roleIds:[]}},uploadAvatar:function(t){this.dataForm.avatar=t.url},handleCreate:function(){var t=this;this.resetForm(),this.dialogStatus="create",this.dialogFormVisible=!0,this.$nextTick(function(){t.$refs.dataForm.clearValidate()})},createData:function(){var t=this;this.$refs.dataForm.validate(function(e){e&&function(t){return Object(m.a)({method:"post",data:p.a.stringify({_gp:"admin",_mt:"create",adminDTO:l()(t)})})}(t.dataForm).then(function(e){t.list.unshift(e.data.data),t.dialogFormVisible=!1,t.$notify.success({title:"成功",message:"添加管理员成功"})}).catch(function(e){t.$notify.error({title:"失败",message:e.data.errmsg})})})},handleUpdate:function(t){var e=this;this.dataForm=o()({},t),this.dialogStatus="update",this.dialogFormVisible=!0,this.$nextTick(function(){e.$refs.dataForm.clearValidate()})},updateData:function(){var t=this;this.$refs.dataForm.validate(function(e){e&&function(t){return Object(m.a)({method:"post",data:p.a.stringify({_gp:"admin",_mt:"update",adminDTO:l()(t)})})}(t.dataForm).then(function(){var e=!0,a=!1,i=void 0;try{for(var r,o=n()(t.list);!(e=(r=o.next()).done);e=!0){var s=r.value;if(s.id===t.dataForm.id){var l=t.list.indexOf(s);t.list.splice(l,1,t.dataForm);break}}}catch(t){a=!0,i=t}finally{try{!e&&o.return&&o.return()}finally{if(a)throw i}}t.dialogFormVisible=!1,t.$notify.success({title:"成功",message:"更新管理员成功"})}).catch(function(e){t.$notify.error({title:"失败",message:e.data.errmsg})})})},handleDelete:function(t){var e=this;this.$confirm("此操作将永久删除该管理员---"+t.username+"---, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){(function(t){return Object(m.a)({method:"post",params:{_gp:"admin",_mt:"delete",id:t}})})(t.id).then(function(a){e.$notify.success({title:"成功",message:"删除管理员成功"});var i=e.list.indexOf(t);e.list.splice(i,1)}).catch(function(t){e.$notify.error({title:"失败",message:t.data.errmsg})})}).catch(function(){return!1})}}},b=(a("9x9g"),a("KHd+")),_=Object(b.a)(h,function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"app-container"},[a("div",{staticClass:"filter-container"},[a("el-input",{staticClass:"filter-item",staticStyle:{width:"200px"},attrs:{clearable:"",placeholder:"请输入管理员名称"},model:{value:t.listQuery.username,callback:function(e){t.$set(t.listQuery,"username",e)},expression:"listQuery.username"}}),t._v(" "),a("el-button",{directives:[{name:"permission",rawName:"v-permission",value:["admin:admin:list"],expression:"['admin:admin:list']"}],staticClass:"filter-item",attrs:{type:"primary",icon:"el-icon-search"},on:{click:t.handleFilter}},[t._v("查找")]),t._v(" "),a("el-button",{directives:[{name:"permission",rawName:"v-permission",value:["admin:admin:create"],expression:"['admin:admin:create']"}],staticClass:"filter-item",attrs:{type:"primary",icon:"el-icon-edit"},on:{click:t.handleCreate}},[t._v("添加")])],1),t._v(" "),a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.listLoading,expression:"listLoading"}],attrs:{data:t.list,size:"small","element-loading-text":"正在查询中。。。",border:"",fit:"","highlight-current-row":""}},[a("el-table-column",{attrs:{align:"center",label:"管理员ID",prop:"id",sortable:""}}),t._v(" "),a("el-table-column",{attrs:{align:"center",label:"管理员名称",prop:"username"}}),t._v(" "),a("el-table-column",{attrs:{align:"center",label:"管理员头像",prop:"avatar"},scopedSlots:t._u([{key:"default",fn:function(e){return[e.row.avatar?a("img",{attrs:{src:e.row.avatar,width:"40"}}):t._e()]}}])}),t._v(" "),a("el-table-column",{attrs:{align:"center",label:"管理员角色",prop:"roleIds"},scopedSlots:t._u([{key:"default",fn:function(e){return t._l(e.row.roleIds,function(e){return a("el-tag",{key:e,staticStyle:{"margin-right":"20px"},attrs:{type:"primary"}},[t._v(t._s(t.formatRole(e)))])})}}])}),t._v(" "),a("el-table-column",{attrs:{align:"center",label:"操作","class-name":"small-padding fixed-width"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{directives:[{name:"permission",rawName:"v-permission",value:["admin:admin:update"],expression:"['admin:admin:update']"}],attrs:{type:"primary",size:"mini"},on:{click:function(a){t.handleUpdate(e.row)}}},[t._v("编辑")]),t._v(" "),a("el-button",{directives:[{name:"permission",rawName:"v-permission",value:["admin:admin:delete"],expression:"['admin:admin:delete']"}],attrs:{type:"danger",size:"mini"},on:{click:function(a){t.handleDelete(e.row)}}},[t._v("删除")])]}}])})],1),t._v(" "),a("pagination",{directives:[{name:"show",rawName:"v-show",value:t.total>0,expression:"total>0"}],attrs:{total:t.total,page:t.listQuery.page,limit:t.listQuery.limit},on:{"update:page":function(e){t.$set(t.listQuery,"page",e)},"update:limit":function(e){t.$set(t.listQuery,"limit",e)},pagination:t.getList}}),t._v(" "),a("el-dialog",{attrs:{title:t.textMap[t.dialogStatus],visible:t.dialogFormVisible},on:{"update:visible":function(e){t.dialogFormVisible=e}}},[a("el-form",{ref:"dataForm",staticStyle:{width:"400px","margin-left":"50px"},attrs:{rules:t.rules,model:t.dataForm,"status-icon":"","label-position":"left","label-width":"100px"}},[a("el-form-item",{attrs:{label:"登录名",prop:"username"}},[a("el-input",{attrs:{disabled:"update"===t.dialogStatus},model:{value:t.dataForm.username,callback:function(e){t.$set(t.dataForm,"username",e)},expression:"dataForm.username"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"密码",prop:"password"}},[a("el-input",{attrs:{type:"password","auto-complete":"off"},model:{value:t.dataForm.password,callback:function(e){t.$set(t.dataForm,"password",e)},expression:"dataForm.password"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"手机号",prop:"phone"}},[a("el-input",{model:{value:t.dataForm.phone,callback:function(e){t.$set(t.dataForm,"phone",e)},expression:"dataForm.phone"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"真实姓名",prop:"realname"}},[a("el-input",{model:{value:t.dataForm.realname,callback:function(e){t.$set(t.dataForm,"realname",e)},expression:"dataForm.realname"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"授权角色",prop:"roleIds"}},[a("el-select",{attrs:{multiple:"",placeholder:"请选择"},model:{value:t.dataForm.roleIds,callback:function(e){t.$set(t.dataForm,"roleIds",e)},expression:"dataForm.roleIds"}},t._l(t.roleOptions,function(t){return a("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})}))],1)],1),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.dialogFormVisible=!1}}},[t._v("取消")]),t._v(" "),"create"==t.dialogStatus?a("el-button",{attrs:{type:"primary"},on:{click:t.createData}},[t._v("确定")]):a("el-button",{attrs:{type:"primary"},on:{click:t.updateData}},[t._v("确定")])],1)],1)],1)},[],!1,null,null,null);_.options.__file="admin.vue";e.default=_.exports},bS7j:function(t,e,a){},"gDS+":function(t,e,a){t.exports={default:a("oh+g"),__esModule:!0}},"oh+g":function(t,e,a){var i=a("WEpk"),n=i.JSON||(i.JSON={stringify:JSON.stringify});t.exports=function(t){return n.stringify.apply(n,arguments)}},rs3x:function(t,e,a){"use strict";a.d(e,"b",function(){return n}),a.d(e,"a",function(){return r});var i=a("t3Un"),n="https://api.diy-factoies.com/upload/admin";function r(t){return Object(i.a)({url:n,method:"post",data:t})}},zF5t:function(t,e,a){"use strict";a.d(e,"d",function(){return u}),a.d(e,"a",function(){return m}),a.d(e,"g",function(){return c}),a.d(e,"b",function(){return p}),a.d(e,"c",function(){return f}),a.d(e,"f",function(){return g}),a.d(e,"e",function(){return v});var i=a("gDS+"),n=a.n(i),r=a("QbLZ"),o=a.n(r),s=a("t3Un"),l=a("Qyje"),d=a.n(l);function u(t){return Object(s.a)({method:"get",params:o()({_gp:"admin.role",_mt:"list"},t)})}function m(t){return Object(s.a)({method:"post",data:d.a.stringify({_gp:"admin.role",_mt:"create",role:n()(t)})})}function c(t){return Object(s.a)({method:"post",data:d.a.stringify({_gp:"admin.role",_mt:"update",role:n()(t)})})}function p(t){return Object(s.a)({method:"post",params:{_gp:"admin.role",_mt:"delete",roleId:t}})}function f(t){return Object(s.a)({method:"get",params:o()({_gp:"admin.role",_mt:"permissionList"},t)})}function g(t){return Object(s.a)({method:"post",data:d.a.stringify({_gp:"admin.role",_mt:"permissionSet",roleSetPermissionDTO:n()(t)})})}function v(t){return Object(s.a)({method:"get",params:{_gp:"admin.role",_mt:"options"}})}}}]);