1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-a673812a"],{"098e":function(t,e,a){"use strict";a("84d6")},"10e1":function(t,e,a){"use strict";a.r(e);var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"app-container"},[a("el-form",{staticClass:"demo-form-inline",attrs:{inline:!0,size:"mini"}},[a("el-form-item",[a("el-button",{attrs:{type:"primary",icon:"el-icon-plus",size:"mini"},on:{click:t.showAdd}},[t._v("新增角色")])],1)],1),a("div",{staticClass:"shadow bg-white p-4"},[a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.loadingData,expression:"loadingData"}],attrs:{data:t.roleList,"highlight-current-row":!0,size:"mini"}},[a("el-table-column",{attrs:{prop:"id",label:"ID","min-width":"5%"}}),a("el-table-column",{attrs:{prop:"name",label:"名称","min-width":"10%"}}),a("el-table-column",{attrs:{prop:"created_at",label:"添加时间","min-width":"5%"}}),a("el-table-column",{attrs:{label:"操作","min-width":"5%"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("span",{staticClass:"text-blue-600 cursor-pointer pr-2",attrs:{type:"primary"},on:{click:function(a){return t.showEdit(e.row)}}},[t._v("编辑")]),a("span",{staticClass:"text-red-600 cursor-pointer",attrs:{type:"danger"},on:{click:function(a){return t.handleDel(e.row.role_id)}}},[t._v("删除")])]}}])})],1),a("pagination",{attrs:{total:t.page.total,page:t.page.num,limit:t.page.limit},on:{"update:page":function(e){return t.$set(t.page,"num",e)},"update:limit":function(e){return t.$set(t.page,"limit",e)},pagination:t.loadRoleList}})],1),a("el-dialog",{attrs:{visible:t.dialogTableVisible,title:"edit"===t.dialogType?"编辑角色":"添加角色"},on:{"update:visible":function(e){t.dialogTableVisible=e}}},[a("el-form",{ref:"roleForm",attrs:{model:t.roleForm,rules:t.rules,"label-width":"80px","label-position":"left"}},[a("el-form-item",{attrs:{label:"名称",prop:"name"}},[a("el-input",{attrs:{placeholder:"角色名称"},model:{value:t.roleForm.name,callback:function(e){t.$set(t.roleForm,"name",e)},expression:"roleForm.name"}})],1),a("el-form-item",{attrs:{label:"操作权限"}},[a("el-tree",{ref:"tree",staticClass:"auth-tree",attrs:{"check-strictly":t.checkStrictly,"default-checked-keys":t.authCheckedList,data:t.authList,props:t.props,"show-checkbox":"","node-key":"id"}})],1),a("el-form-item",{attrs:{label:"数据权限"}},t._l(t.dataAuthList,(function(e,n){return a("el-radio",{key:n,attrs:{label:e.id},model:{value:t.roleForm.data_auth,callback:function(e){t.$set(t.roleForm,"data_auth",e)},expression:"roleForm.data_auth"}},[t._v(t._s(e.name))])})),1)],1),a("div",{staticClass:"text-right"},[a("el-button",{attrs:{type:"danger"},on:{click:function(e){t.dialogVisible=!1}}},[t._v("取消")]),a("el-button",{attrs:{type:"primary"},on:{click:t.handleSave}},[t._v("确认")])],1)],1)],1)},i=[],r=(a("14d9"),a("cc5e")),o=a("3786"),l=a("333d"),s=a("4be9"),u={name:"RoleList",components:{Pagination:l["a"]},data:function(){return{page:{num:1,limit:20,total:0},loadingData:!1,roleList:[],dataAuthList:[],roleForm:{},authList:[],authCheckedList:[],rules:{name:[{required:!0,message:"角色名称",trigger:"blur"}]},props:{label:"name",id:"id",children:"children"},dialogType:"add",checkStrictly:!1,dialogTableVisible:!1}},created:function(){this.loadParam(),this.loadRoleList(),this.loadAuthList()},methods:{loadParam:function(){var t=this;Object(s["a"])("data_auth").then((function(e){t.dataAuthList=e.data}))},loadRoleList:function(){var t=this;Object(r["c"])({page:this.page.num,limit:this.page.limit}).then((function(e){200===e.code?(t.roleList=e.data.list,t.page.total=e.data.total,t.page.limit=e.data.limit):t.$message.error(e.message)}))},loadAuthList:function(){var t=this;Object(o["c"])({tree:1}).then((function(e){200===e.code?t.authList=e.data:t.$message.error(e.message)}))},showAdd:function(){this.roleForm={data_auth:1},this.dialogType="new",this.dialogTableVisible=!0,this.$refs.tree&&(this.$refs.tree.setCheckedKeys([]),this.$refs["roleForm"].clearValidate())},showEdit:function(t){var e=this;Array.isArray(t.auth_ids)||(t.auth_ids=t.auth_ids?t.auth_ids.split(","):[]),this.roleForm=t,this.dialogType="edit",this.dialogTableVisible=!0,this.checkStrictly=!0,this.$nextTick((function(){e.$refs.tree.setCheckedKeys(t.auth_ids),e.$refs["roleForm"].clearValidate(),e.checkStrictly=!1}))},handleDel:function(t){var e=this;this.$confirm("确定需要删除?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){Object(r["b"])(t).then((function(t){200===t.code?(e.loadRoleList(),e.$message.success("删除成功")):e.$message.error(t.message)}))}))},handleSave:function(){var t=this;this.$refs["roleForm"].validate((function(e){if(!e)return t.$message.error("请填写必须参数"),!1;for(var a=t.$refs.tree.getCheckedNodes(!1,!0),n=[],i=0;i<a.length;i++)n.push(a[i].id);t.roleForm.auth_ids=n,t.roleForm.id>0?Object(r["d"])(t.roleForm.id,t.roleForm).then((function(e){t.handleCallback(e)})):Object(r["a"])(t.roleForm).then((function(e){t.handleCallback(e)}))}))},handleCallback:function(t){200===t.code?(this.$message.success(t.message),this.dialogTableVisible=!1,this.loadRoleList()):this.$message.error(t.message)}}},c=u,d=a("2877"),h=Object(d["a"])(c,n,i,!1,null,"37cac804",null);e["default"]=h.exports},"333d":function(t,e,a){"use strict";var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"pagination-container",class:{hidden:t.hidden}},[a("el-pagination",t._b({attrs:{background:t.background,"current-page":t.currentPage,"page-size":t.pageSize,layout:t.layout,"page-sizes":t.pageSizes,total:t.total},on:{"update:currentPage":function(e){t.currentPage=e},"update:current-page":function(e){t.currentPage=e},"update:pageSize":function(e){t.pageSize=e},"update:page-size":function(e){t.pageSize=e},"size-change":t.handleSizeChange,"current-change":t.handleCurrentChange}},"el-pagination",t.$attrs,!1))],1)},i=[];a("a9e3");Math.easeInOutQuad=function(t,e,a,n){return t/=n/2,t<1?a/2*t*t+e:(t--,-a/2*(t*(t-2)-1)+e)};var r=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)}}();function o(t){document.documentElement.scrollTop=t,document.body.parentNode.scrollTop=t,document.body.scrollTop=t}function l(){return document.documentElement.scrollTop||document.body.parentNode.scrollTop||document.body.scrollTop}function s(t,e,a){var n=l(),i=t-n,s=20,u=0;e="undefined"===typeof e?500:e;var c=function(){u+=s;var t=Math.easeInOutQuad(u,n,i,e);o(t),u<e?r(c):a&&"function"===typeof a&&a()};c()}var u={name:"Pagination",props:{total:{required:!0,type:Number},page:{type:Number,default:1},limit:{type:Number,default:20},pageSizes:{type:Array,default:function(){return[10,20,30,50,100,200,300,500,1e3]}},layout:{type:String,default:"total, sizes, prev, pager, next, jumper"},background:{type:Boolean,default:!0},autoScroll:{type:Boolean,default:!0},hidden:{type:Boolean,default:!1}},computed:{currentPage:{get:function(){return this.page},set:function(t){this.$emit("update:page",t)}},pageSize:{get:function(){return this.limit},set:function(t){this.$emit("update:limit",t)}}},methods:{handleSizeChange:function(t){this.$emit("pagination",{page:this.currentPage,limit:t}),this.autoScroll&&s(0,800)},handleCurrentChange:function(t){this.$emit("pagination",{page:t,limit:this.pageSize}),this.autoScroll&&s(0,800)}}},c=u,d=(a("098e"),a("2877")),h=Object(d["a"])(c,n,i,!1,null,"a41fbf76",null);e["a"]=h.exports},3786:function(t,e,a){"use strict";a.d(e,"c",(function(){return i})),a.d(e,"a",(function(){return r})),a.d(e,"d",(function(){return o})),a.d(e,"b",(function(){return l}));var n=a("b775");function i(t){return Object(n["a"])({url:"auths",method:"get",params:t})}function r(t){return Object(n["a"])({url:"auths",method:"post",data:t})}function o(t,e){return Object(n["a"])({url:"auths/".concat(t),method:"put",data:e})}function l(t){return Object(n["a"])({url:"auths/".concat(t),method:"delete"})}},"4be9":function(t,e,a){"use strict";a.d(e,"b",(function(){return i})),a.d(e,"a",(function(){return r}));var n=a("b775");function i(t){return Object(n["a"])({url:"params",method:"get",params:t})}function r(t){return Object(n["a"])({url:"params/"+t,method:"get"})}},"84d6":function(t,e,a){},cc5e:function(t,e,a){"use strict";a.d(e,"c",(function(){return i})),a.d(e,"a",(function(){return r})),a.d(e,"d",(function(){return o})),a.d(e,"b",(function(){return l}));var n=a("b775");function i(t){return Object(n["a"])({url:"roles",method:"get",params:t})}function r(t){return Object(n["a"])({url:"roles",method:"post",data:t})}function o(t,e){return Object(n["a"])({url:"roles/".concat(t),method:"put",data:e})}function l(t){return Object(n["a"])({url:"roles/".concat(t),method:"delete"})}}}]);
|