(self["webpackChunkerp"]=self["webpackChunkerp"]||[]).push([[712],{8712:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var s=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"conent"},[n("div",{staticClass:"from"},[n("el-dialog",{attrs:{title:"新增角色",visible:e.dialogVisible2,width:"30%","close-on-click-modal":!1},on:{"update:visible":function(t){e.dialogVisible2=t}}},[n("div",[n("el-form",{attrs:{"label-width":"80px"}},[n("el-form-item",{attrs:{label:"角色名称"}},[n("el-input",{model:{value:e.newrole,callback:function(t){e.newrole=t},expression:"newrole"}})],1),n("div",{staticClass:"from-btn"},[n("el-button",{attrs:{type:"danger"},on:{click:function(t){e.dialogVisible2=!1}}},[e._v("取消")]),n("el-button",{on:{click:e.onSubmit}},[e._v("确认")])],1)],1)],1)])],1),n("el-button",{attrs:{type:"primary"},on:{click:function(t){e.dialogVisible2=!0}}},[e._v("新增")]),n("div",{staticClass:"table",staticStyle:{"margin-top":"10px"}},[n("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],staticStyle:{width:"100%"},attrs:{data:e.tableList}},[n("el-table-column",{attrs:{prop:"id",label:"ID"}}),n("el-table-column",{attrs:{prop:"name",label:"角色名称"}}),n("el-table-column",{attrs:{label:"权限内容"},scopedSlots:e._u([{key:"default",fn:function(t){return e._l(t.row.permissions,(function(t){return n("span",{key:t.id},[e._v(e._s(t.name)+" ")])}))}}])}),n("el-table-column",{attrs:{label:"操作"},scopedSlots:e._u([{key:"default",fn:function(t){return[n("el-button",{on:{click:function(n){return e.onEdit(t.row)}}},[e._v("编辑")])]}}])})],1)],1),n("el-dialog",{attrs:{title:"编辑权限",visible:e.dialogVisible,width:"30%","close-on-click-modal":!1},on:{"update:visible":function(t){e.dialogVisible=t}}},[e.isShowtree?n("el-tree",{ref:"tree",attrs:{data:e.Role_Permission,"show-checkbox":"","default-expand-all":!1,"node-key":"id","highlight-current":"",props:e.defaultProps,"default-checked-keys":e.chekedKeys},model:{value:e.permissionIds,callback:function(t){e.permissionIds=t},expression:"permissionIds"}}):e._e(),n("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{on:{click:function(t){return e.cancel()}}},[e._v("取 消")]),n("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.getCheckedKeys()}}},[e._v("确 定")])],1)],1)],1)},i=[],r=n(8430);function o(){return(0,r.Z)({url:"/api/roles",method:"get"})}function a(e){return(0,r.Z)({url:"/api/roles",method:"post",data:e})}function l(){return(0,r.Z)({url:"/api/permissions",method:"get"})}function u(e,t){return(0,r.Z)({url:`/api/roles/${e}/permissions`,method:"post",data:t})}var c={data(){return{id:"",loading:!0,tableList:[],rolePermissions:[],newrole:"",dialogVisible:!1,dialogVisible2:!1,permissionIds:[],allpermissionIds:{},Role_Permission:[],defaultProps:{children:"children",label:"name"},isShowtree:!1,chekedKeys:[]}},mounted(){this.getroleList(),this.getJurisdiction()},methods:{getroleList(){o().then((e=>{this.tableList=e.data.data})),this.loading=!1},getJurisdiction(){l().then((e=>{this.Role_Permission=e.data.data}))},onSubmit(){let e={name:this.newrole};a(e).then((e=>{this.dialogVisible2=!1,this.getroleList(),201==e.status&&this.$message({message:"角色添加成功！",type:"success"})}))},onEdit(e){this.id=e.id;let t=e.permissions.map((e=>e.id));this.chekedKeys=t,this.dialogVisible=!0,this.isShowtree=!0},cancel(){this.dialogVisible=!1,this.isShowtree=!1},getCheckedKeys(){let e=this.id;this.permissionIds=this.$refs.tree.getCheckedKeys(),this.allpermissionIds={permissionIds:this.permissionIds},u(e,this.allpermissionIds).then((e=>{200===e.status&&(this.dialogVisible=!1,this.getroleList(),this.$message({message:"权限修改成功！",type:"success"}))}))}}},d=c,m=n(1001),p=(0,m.Z)(d,s,i,!1,null,"7d26d779",null),f=p.exports},4865:function(e,t,n){var s,i;
/* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress
 * @license MIT */(function(r,o){s=o,i="function"===typeof s?s.call(t,n,t,e):s,void 0===i||(e.exports=i)})(0,(function(){var e={version:"0.2.0"},t=e.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'};function n(e,t,n){return e<t?t:e>n?n:e}function s(e){return 100*(-1+e)}function i(e,n,i){var r;return r="translate3d"===t.positionUsing?{transform:"translate3d("+s(e)+"%,0,0)"}:"translate"===t.positionUsing?{transform:"translate("+s(e)+"%,0)"}:{"margin-left":s(e)+"%"},r.transition="all "+n+"ms "+i,r}e.configure=function(e){var n,s;for(n in e)s=e[n],void 0!==s&&e.hasOwnProperty(n)&&(t[n]=s);return this},e.status=null,e.set=function(s){var a=e.isStarted();s=n(s,t.minimum,1),e.status=1===s?null:s;var l=e.render(!a),u=l.querySelector(t.barSelector),c=t.speed,d=t.easing;return l.offsetWidth,r((function(n){""===t.positionUsing&&(t.positionUsing=e.getPositioningCSS()),o(u,i(s,c,d)),1===s?(o(l,{transition:"none",opacity:1}),l.offsetWidth,setTimeout((function(){o(l,{transition:"all "+c+"ms linear",opacity:0}),setTimeout((function(){e.remove(),n()}),c)}),c)):setTimeout(n,c)})),this},e.isStarted=function(){return"number"===typeof e.status},e.start=function(){e.status||e.set(0);var n=function(){setTimeout((function(){e.status&&(e.trickle(),n())}),t.trickleSpeed)};return t.trickle&&n(),this},e.done=function(t){return t||e.status?e.inc(.3+.5*Math.random()).set(1):this},e.inc=function(t){var s=e.status;return s?("number"!==typeof t&&(t=(1-s)*n(Math.random()*s,.1,.95)),s=n(s+t,0,.994),e.set(s)):e.start()},e.trickle=function(){return e.inc(Math.random()*t.trickleRate)},function(){var t=0,n=0;e.promise=function(s){return s&&"resolved"!==s.state()?(0===n&&e.start(),t++,n++,s.always((function(){n--,0===n?(t=0,e.done()):e.set((t-n)/t)})),this):this}}(),e.render=function(n){if(e.isRendered())return document.getElementById("nprogress");l(document.documentElement,"nprogress-busy");var i=document.createElement("div");i.id="nprogress",i.innerHTML=t.template;var r,a=i.querySelector(t.barSelector),u=n?"-100":s(e.status||0),c=document.querySelector(t.parent);return o(a,{transition:"all 0 linear",transform:"translate3d("+u+"%,0,0)"}),t.showSpinner||(r=i.querySelector(t.spinnerSelector),r&&d(r)),c!=document.body&&l(c,"nprogress-custom-parent"),c.appendChild(i),i},e.remove=function(){u(document.documentElement,"nprogress-busy"),u(document.querySelector(t.parent),"nprogress-custom-parent");var e=document.getElementById("nprogress");e&&d(e)},e.isRendered=function(){return!!document.getElementById("nprogress")},e.getPositioningCSS=function(){var e=document.body.style,t="WebkitTransform"in e?"Webkit":"MozTransform"in e?"Moz":"msTransform"in e?"ms":"OTransform"in e?"O":"";return t+"Perspective"in e?"translate3d":t+"Transform"in e?"translate":"margin"};var r=function(){var e=[];function t(){var n=e.shift();n&&n(t)}return function(n){e.push(n),1==e.length&&t()}}(),o=function(){var e=["Webkit","O","Moz","ms"],t={};function n(e){return e.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,(function(e,t){return t.toUpperCase()}))}function s(t){var n=document.body.style;if(t in n)return t;var s,i=e.length,r=t.charAt(0).toUpperCase()+t.slice(1);while(i--)if(s=e[i]+r,s in n)return s;return t}function i(e){return e=n(e),t[e]||(t[e]=s(e))}function r(e,t,n){t=i(t),e.style[t]=n}return function(e,t){var n,s,i=arguments;if(2==i.length)for(n in t)s=t[n],void 0!==s&&t.hasOwnProperty(n)&&r(e,n,s);else r(e,i[1],i[2])}}();function a(e,t){var n="string"==typeof e?e:c(e);return n.indexOf(" "+t+" ")>=0}function l(e,t){var n=c(e),s=n+t;a(n,t)||(e.className=s.substring(1))}function u(e,t){var n,s=c(e);a(e,t)&&(n=s.replace(" "+t+" "," "),e.className=n.substring(1,n.length-1))}function c(e){return(" "+(e.className||"")+" ").replace(/\s+/gi," ")}function d(e){e&&e.parentNode&&e.parentNode.removeChild(e)}return e}))},3695:function(e,t,n){"use strict";n.d(t,{LP:function(){return i},gy:function(){return r}});const s="admin_token";function i(){return localStorage.getItem("token")}function r(){return localStorage.removeItem(s)}},8430:function(e,t,n){"use strict";var s=n(9669),i=n.n(s),r=n(3695),o=n(4865),a=n.n(o),l=n(4720),u=i().create({timeout:36e4});u.interceptors.request.use((e=>(e.headers.Authorization="Bearer "+(0,r.LP)(),a().start(),e)),(e=>Promise.reject(e))),u.interceptors.response.use((e=>{a().done();const t=e.status;if(200===t||201===t)return e}),(e=>(a().done(),400===e.response.status&&(0,l.Message)({message:e.response.data.errorMessage,type:"error"}),500===e.response.status&&(0,l.Message)({message:e.response.data.message,type:"error"}),Promise.reject(e)))),t.Z=u}}]);
//# sourceMappingURL=712.93ae2c1f.js.map