chunk-7824ac93.d2d44205.js 6.1 KB

12
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-7824ac93"],{"10e1":function(t,e,a){"use strict";a.r(e);var i=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("section",[t._m(0),a("div",{staticClass:"content"},[a("div",{staticClass:"filter"},[a("el-form",{attrs:{size:"small","label-width":"70px",inline:!0,"label-position":"left"}},[a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{clearable:"",placeholder:"请输入角色名称"},model:{value:t.form.name,callback:function(e){t.$set(t.form,"name",e)},expression:"form.name"}})],1),a("el-form-item",[a("el-button",{attrs:{type:"primary"},on:{click:t.search}},[t._v("搜索")])],1),a("el-form-item",{staticStyle:{float:"right"}},[a("el-button",{attrs:{type:"primary"},on:{click:function(e){t.dialogVisible=!0,t.dialogTitle="新增角色"}}},[t._v("新增角色")])],1)],1)],1),a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],staticClass:"table",staticStyle:{width:"100%"},attrs:{data:t.list,height:"50vh",border:"","default-expand-all":"","row-key":"id"}},[a("el-table-column",{attrs:{prop:"name",width:"300",label:"角色名称"}}),a("el-table-column",{attrs:{prop:"permstr",label:"角色权限"}}),a("el-table-column",{attrs:{prop:"zip",width:"150",label:"操作"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{staticClass:"edit",attrs:{type:"text"},on:{click:function(a){return t.edit(e.row.id)}}},[t._v("编辑")]),a("el-button",{staticClass:"del",attrs:{type:"text"},on:{click:function(a){return t.del(e.row.id)}}},[t._v("删除")])]}}])})],1),a("Page",{ref:"pageButton",attrs:{current:t.form.page,page_size:t.form.page_size,total:t.total},on:{pageChange:t.gopage}})],1),a("el-dialog",{attrs:{title:t.dialogTitle,"close-on-click-modal":!1,visible:t.dialogVisible},on:{"update:visible":function(e){t.dialogVisible=e}}},[a("el-form",{staticClass:"preview",attrs:{size:"small",inline:!1,"label-width":"80px"}},[a("el-form-item",{attrs:{label:"角色名称"}},[a("el-input",{model:{value:t.form1.name,callback:function(e){t.$set(t.form1,"name",e)},expression:"form1.name"}})],1),a("el-form-item",{attrs:{label:"角色权限"}},[a("el-tree",{ref:"tree",attrs:{data:t.data,"show-checkbox":"","node-key":"id","default-expand-all":"",props:t.defaultProps},on:{"check-change":t.handleCheckChange}})],1)],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{size:"small",type:"primary"},on:{click:t.save}},[t._v("确 定")])],1)],1)],1)},s=[function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("p",[a("span",[t._v("系统管理>")]),t._v("角色管理")])}],n=(a("1bc78"),a("9973")),l={components:{Page:n["a"]},data:function(){return{form:{name:"",page:1,page_size:20},form1:{},total:1,list:[{name:"2333"}],loading:!1,input:"",dialogVisible:!1,dialogTitle:"",defaultProps:{},data:[],selected:[]}},methods:{getPermissions:function(){var t=this;this.$api.getUserPermissions().then((function(e){t.data=e.data.data}))},handleCheckChange:function(t,e,a){this.selected=this.$refs.tree.getCheckedNodes()},search:function(){this.form;this.getData()},getData:function(){var t=this,e=this.form;this.loading=!0,this.$api.getRoleList(e).then((function(e){var a=e.data.data.list;a.forEach((function(t){var e=[],a=JSON.parse(t.permissions);a&&(a.forEach((function(t){e.push(t.label)})),t.permstr=e.join(","))})),t.list=a,t.total=e.data.data.total,t.loading=!1}))},edit:function(t){var e=this;this.getData(),this.$api.getRoleInfo({id:t}).then((function(t){e.form1=t.data.data;var a=JSON.parse(t.data.data.permissions);e.$refs.tree.setCheckedNodes(a),e.selected=a})),this.dialogVisible=!0},del:function(t){var e=this;this.$confirm("确定删除吗","提示",{type:"warning"}).then((function(){e.$api.delRole({id:t}).then((function(t){e.$message({message:"删除成功",type:"success"}),e.getData()}))}))},save:function(){var t=this,e=this.form1;e.permissions=JSON.stringify(this.selected),e.id?this.$api.editRole(e).then((function(e){0==e.data.code?(t.$message({type:"success",message:"保存成功!"}),t.getData()):t.$message.error("失败!")})):this.$api.addRole(e).then((function(e){0==e.data.code?(t.$message({type:"success",message:"保存成功!"}),t.getData()):t.$message.error("失败!")})),this.dialogVisible=!1}},created:function(){this.getPermissions(),this.getData()}},o=l,r=(a("bb39"),a("5d22")),c=Object(r["a"])(o,i,s,!1,null,null,null);e["default"]=c.exports},"129d":function(t,e,a){"use strict";a("a210")},"1bc78":function(t,e,a){for(var i=a("25ba"),s=a("93ca"),n=a("84e8"),l=a("0b34"),o=a("065d"),r=a("953d"),c=a("839a"),d=c("iterator"),u=c("toStringTag"),f=r.Array,p={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},g=s(p),m=0;m<g.length;m++){var h,b=g[m],v=p[b],S=l[b],L=S&&S.prototype;if(L&&(L[d]||o(L,d,f),L[u]||o(L,u,b),r[b]=f,v))for(h in i)L[h]||n(L,h,i[h],!0)}},4045:function(t,e,a){},9973:function(t,e,a){"use strict";var i=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("el-pagination",{attrs:{background:"","page-size":t.page_size?t.page_size:20,"current-page":t.current,"page-sizes":[10,20,30,40,50,60,70,80,90,100],layout:"total,sizes,prev, pager, next",total:t.total},on:{"current-change":t.getData,"size-change":t.handleSizeChange}})},s=[],n={data:function(){return{page:1}},props:{total:"",page_size:"",current:""},methods:{getData:function(t){this.page=t,this.$emit("pageChange")},handleSizeChange:function(t){this.$emit("pageChange",t)}},created:function(){}},l=n,o=(a("129d"),a("5d22")),r=Object(o["a"])(l,i,s,!1,null,null,null);e["a"]=r.exports},a210:function(t,e,a){},bb39:function(t,e,a){"use strict";a("4045")}}]);
  2. //# sourceMappingURL=chunk-7824ac93.d2d44205.js.map