1 |
- webpackJsonp([30],{"2LB4":function(i,s){},Ug3B:function(i,s,t){"use strict";Object.defineProperty(s,"__esModule",{value:!0});var e={props:["premissionName","auth_id","role_id"],data:function(){return{options:[{value:"1",label:"是"},{value:"0",label:"否"}],routeList:[],newRouterList:[],permission_arr:[],permission_arr_id:[],permission_value:[],permissionGroupList:[],page:1,total:0,pageInfoSize:20,loading:!1,isIndeterminate:!0}},created:function(){this.getAllList()},methods:{goBack:function(){console.log("返回"),this.$emit("smallPageIsShow",!1)},getAllList:function(){var i=this,s=this;this.loading=!0,this.routeList=[],this.$axios.get(this.URL.BASEURL+this.URL.routeList,{params:{page:1,auth_id:this.auth_id}}).then(function(t){t=t.data;s.loading=!1,t&&0==t.errno?(i.routeList=t.rst.data,i.routeList&&0!=i.routeList.length&&i.getRoleRouter()):s.$message({message:t.err,type:"warning"})}).catch(function(i){s.loading=!1})},getRoleRouter:function(){var i=this,s=this;this.loading=!0,this.$axios.get(this.URL.BASEURL+this.URL.roleRoutes,{params:{role_id:this.role_id}}).then(function(t){t=t.data;if(s.loading=!1,t&&0==t.errno){var e=i.routeList;e.forEach(function(i){t.rst.forEach(function(s){s.route_id==i.id&&(i.if_show=s.if_show,i.rows=s.rows)})}),i.newRouterList=e,console.log(i.newRouterList)}else s.$message({message:t.err,type:"warning"})}).catch(function(i){s.loading=!1})},changeSelect:function(i,s){this.$set(i,"if_show",s)},cInput:function(i,s){this.$set(i,"rows",s)},setRoleRouter:function(i){var s=this;if(i.if_show||0==i.if_show)if(i.rows||0==i.rows){var t=this;this.loading=!0,this.$axios.post(this.URL.BASEURL+this.URL.setRoleRoutes,{role_id:this.role_id,route_id:i.id,if_show:Number(i.if_show),rows:Number(i.rows)}).then(function(i){i=i.data;t.loading=!1,i&&0==i.errno?(s.newRouterList=[],s.getRoleRouter()):t.$message({message:i.err,type:"warning"})}).catch(function(i){t.loading=!1})}else this.$message({message:"设置条数不能为空",type:"warning"});else this.$message({message:"请设置权限是否开启",type:"warning"})}}},n={render:function(){var i=this,s=i.$createElement,t=i._self._c||s;return t("div",{directives:[{name:"loading",rawName:"v-loading",value:i.loading,expression:"loading"}],attrs:{"element-loading-text":"拼命加载中","element-loading-spinner":"el-icon-loading"}},[t("div",{staticClass:"returnPage"},[t("div",{staticClass:"return",on:{click:i.goBack}},[t("span",{staticClass:"return_icon"}),i._v(" "),t("span",[i._v("返回")])]),i._v(" "),t("span",{staticClass:"pageName"},[i._v(i._s(i.premissionName))])]),i._v(" "),t("div",{staticClass:"newlyAddedEdit"},[t("div",{staticClass:"addEdit"},[t("div",[t("el-table",{staticStyle:{width:"100%"},attrs:{data:i.newRouterList}},[t("el-table-column",{attrs:{align:"center",fixed:"",prop:"id",label:"权限ID",width:"80"}}),i._v(" "),t("el-table-column",{attrs:{align:"center",prop:"name",label:"权限名称"}}),i._v(" "),t("el-table-column",{attrs:{align:"center",prop:"route",label:"route"}}),i._v(" "),t("el-table-column",{attrs:{align:"center",prop:"city",label:"权限是否开启"},scopedSlots:i._u([{key:"default",fn:function(s){return[t("select",{directives:[{name:"model",rawName:"v-model",value:s.row.if_show,expression:"scope.row.if_show"}],on:{change:[function(t){var e=Array.prototype.filter.call(t.target.options,function(i){return i.selected}).map(function(i){return"_value"in i?i._value:i.value});i.$set(s.row,"if_show",t.target.multiple?e:e[0])},function(t){return i.changeSelect(s.row,s.row.if_show)}]}},[t("option",{attrs:{value:"1"}},[i._v("是")]),i._v(" "),t("option",{attrs:{value:"0"}},[i._v("否")])])]}}])}),i._v(" "),t("el-table-column",{attrs:{align:"center",prop:"address",label:"数据条数限制"},scopedSlots:i._u([{key:"default",fn:function(s){return[t("input",{directives:[{name:"model",rawName:"v-model",value:s.row.rows,expression:"scope.row.rows"}],staticClass:"lines",attrs:{type:"text"},domProps:{value:s.row.rows},on:{change:function(t){return i.cInput(s.row,s.row.rows)},input:function(t){t.target.composing||i.$set(s.row,"rows",t.target.value)}}}),i._v("\n 条\n ")]}}])}),i._v(" "),t("el-table-column",{attrs:{align:"center",fixed:"right",label:"操作"},scopedSlots:i._u([{key:"default",fn:function(s){return[t("el-button",{attrs:{type:"text",size:"small"},on:{click:function(t){return i.setRoleRouter(s.row)}}},[i._v("确定修改")])]}}])})],1)],1)])])])},staticRenderFns:[]};var a={props:["premissionId","premissionName"],components:{permission:t("C7Lr")(e,n,!1,function(i){t("lOkq")},"data-v-3ccc461b",null).exports},data:function(){return{isAddEdit:!1,note_input_keyword:"",note_type:1,premission_note:"",premission_id:"",loading:!1,permissionsList:[],is_switch:!1,addPermissionFlag:!1,premission_name:"",cust_show:!1,searchName:"",role_list:[],role_id:"",permissionFlag:!1}},created:function(){this.getRoleList()},methods:{smallPageIsShow:function(i){this.permissionFlag=i},getRoleList:function(){var i=this;this.loading=!0,this.$axios.get(this.URL.BASEURL+this.URL.rolesList,{params:{page:1}}).then(function(s){(s=s.data)&&0==s.errno?(i.role_list=s.rst.data,i.role_id=i.role_list[0].id,i.permissions()):(i.loading=!1,i.$message({message:s.err,type:"warning"}))}).catch(function(i){this.loading=!1})},back:function(){this.$emit("bigPageIsShow",!1)},delAuth:function(i){var s=this;this.loading=!0,this.$axios.post(this.URL.BASEURL+this.URL.delAuth,{id:i}).then(function(i){i=i.data;s.loading=!1,i&&0==i.errno?s.permissions():s.$message({message:i.err,type:"warning"})}).catch(function(i){this.loading=!1})},editPermissionEvent:function(i){var s=i.id,t=i.is_switch,e=i.name,n=i.note;this.premission_note=n,"全部权限"==n?this.note_type=1:"没有权限"==n?this.note_type=2:(this.note_type=3,this.note_input_keyword=n),this.premission_id=s,this.premission_name=e,this.addPermissionFlag=!0,this.isAddEdit=!0,this.cust_show=t},editAuth:function(){var i=this;if(""!=this.premission_name)if(3!=this.note_type||this.note_input_keyword){if(1==this.note_type)this.premission_note="全部权限";else if(2==this.note_type)this.premission_note="没有权限";else{if(3!=this.note_type)return void this.$message({message:"请选择权限描述",type:"fail"});this.premission_note=this.note_input_keyword}this.loading=!0,this.$axios.post(this.URL.BASEURL+this.URL.editAuth,{id:this.premission_id,cust_show:this.cust_show?1:0,name:this.premission_name,auth_note:this.premission_note,role_id:this.role_id}).then(function(s){s=s.data;i.loading=!1,s&&0==s.errno?(i.init(),i.permissions()):i.$message({message:s.err,type:"warning"})}).catch(function(i){this.loading=!1})}else this.$message({message:"请输入权限描述",type:"fail"});else this.$message({message:"请填写权限名称",type:"fail"})},init:function(){this.addPermissionFlag=!1,this.cust_show=!1,this.premission_name="",this.premission_note="",this.isAddEdit=!1,this.premission_id=""},switchChange:function(i){var s=this,t=i.is_switch,e=i.index,n=i.id;this.loading=!0,this.$axios.post(this.URL.BASEURL+this.URL.showAuth,{cust_show:t?1:0,id:n}).then(function(i){i=i.data;s.loading=!1,i&&0==i.errno?(s.permissionsList[e].cust_show=t?1:0,s.permissionsList[e].is_switch=t,s.$message.closeAll(),s.$message({message:"修改成功",type:"success"})):s.$message({message:i.err,type:"warning"})}).catch(function(i){this.loading=!1})},addAuth:function(){var i=this;if(""!=this.premission_name)if(3!=this.note_type||this.note_input_keyword){if(1==this.note_type)this.premission_note="全部权限";else if(2==this.note_type)this.premission_note="没有权限";else{if(3!=this.note_type)return void this.$message({message:"请选择权限描述",type:"fail"});this.premission_note=this.note_input_keyword}this.loading=!0,this.$axios.post(this.URL.BASEURL+this.URL.addAuth,{cust_show:this.cust_show?1:0,name:this.premission_name,parent_id:this.premissionId,auth_note:this.premission_note,role_id:this.role_id}).then(function(s){s=s.data;i.loading=!1,s&&0==s.errno?(i.addPermissionFlag=!1,i.cust_show=!1,i.premission_name="",i.permissions()):i.$message({message:s.err,type:"warning"})}).catch(function(i){this.loading=!1})}else this.$message({message:"请输入权限描述",type:"fail"});else this.$message({message:"请填写权限名称",type:"fail"})},permissions:function(i){this.page=i;var s=this;this.loading=!0,this.$axios.get(this.URL.BASEURL+this.URL.authsList,{params:{role_id:this.role_id,parent_id:this.premissionId}}).then(function(i){i=i.data;s.loading=!1,0==i.errno&&i?(s.permissionsList=i.rst,s.permissionsList.forEach(function(i){i.is_switch=1==i.cust_show})):s.$message({message:i.err,type:"warning"})}).catch(function(i){s.loading=!1})}},watch:{addPermissionFlag:function(){this.addPermissionFlag||this.init()},role_id:function(){this.permissions()}}},o={render:function(){var i=this,s=i.$createElement,t=i._self._c||s;return t("div",{directives:[{name:"loading",rawName:"v-loading",value:i.loading,expression:"loading"}],attrs:{"element-loading-text":"拼命加载中","element-loading-spinner":"el-icon-loading"}},[i.permissionFlag?i._e():t("div",[t("div",{staticClass:"returnPage"},[t("div",{staticClass:"return",on:{click:i.back}},[t("span",{staticClass:"return_icon"}),i._v(" "),t("span",[i._v("返回")])]),i._v(" "),t("span",{staticClass:"pageName"},[i._v(i._s(i.premissionName))])]),i._v(" "),t("div",{staticClass:"content"},[t("div",{staticClass:"topOperation clear"},[t("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(s){i.addPermissionFlag=!0}}},[i._v("+ 新增权限")]),i._v(" "),t("el-select",{staticStyle:{"margin-left":"20px"},attrs:{size:"mini",placeholder:"请选择"},model:{value:i.role_id,callback:function(s){i.role_id=s},expression:"role_id"}},i._l(i.role_list,function(i){return t("el-option",{key:i.id,attrs:{label:i.name,value:i.id}})}),1)],1),i._v(" "),t("table",{staticClass:"table"},[i._m(0),i._v(" "),i._l(i.permissionsList,function(s,e){return t("tr",{key:s.id},[t("td",[i._v(i._s(s.name))]),i._v(" "),t("td",{staticStyle:{width:"160px"}},[t("el-tooltip",{attrs:{effect:"dark",content:s.auth_note,placement:"top"}},[t("p",{staticClass:"describe",class:"Firefox"==i.$localSelfStore.getLocal("browserOs")?"describeOs":""},[i._v(i._s(s.auth_note))])])],1),i._v(" "),t("td",[i._v(i._s(s.updated_at))]),i._v(" "),t("td",[t("span",{staticStyle:{color:"#2662FF",cursor:"pointer"},on:{click:function(t){i.permissionFlag=!0,i.premission_id=s.id,i.premission_name=s.name}}},[i._v("查看权限")])]),i._v(" "),t("td",[t("el-switch",{attrs:{"active-color":"#13ce66","inactive-color":"#cccccc"},on:{change:function(t){return i.switchChange({is_switch:t,index:e,id:s.id})}},model:{value:s.is_switch,callback:function(t){i.$set(s,"is_switch",t)},expression:"item.is_switch"}})],1),i._v(" "),t("td",[t("button",{staticClass:"edit",on:{click:function(t){return i.editPermissionEvent({id:s.id,is_switch:s.is_switch,name:s.name,note:s.auth_note})}}},[i._v("编辑")]),i._v(" "),t("button",{staticClass:"delete",on:{click:function(t){return i.delAuth(s.id)}}},[i._v("删除")])])])})],2)]),i._v(" "),t("el-dialog",{staticClass:"dialog",attrs:{title:i.isAddEdit?"编辑权限":"新增权限",visible:i.addPermissionFlag,width:"30%"},on:{"update:visible":function(s){i.addPermissionFlag=s}}},[t("div",{staticClass:"dialog"},[t("div",{staticClass:"dialogBox"},[t("label",{staticClass:"label_div"},[i._v("标题名称")]),i._v(" "),t("el-input",{staticClass:"input",attrs:{placeholder:"请输入标题名称",size:"mini",clearable:""},model:{value:i.premission_name,callback:function(s){i.premission_name="string"==typeof s?s.trim():s},expression:"premission_name"}})],1),i._v(" "),t("div",{staticClass:"dialogBox"},[t("label",{staticClass:"label_div"},[i._v("是否展示")]),i._v(" "),t("el-switch",{attrs:{"active-color":"#13ce66","inactive-color":"#cccccc"},model:{value:i.cust_show,callback:function(s){i.cust_show=s},expression:"cust_show"}})],1),i._v(" "),t("div",{staticClass:"dialogBox"},[t("label",{staticClass:"label_div",staticStyle:{"vertical-align":"top"}},[i._v("权限描述")]),i._v(" "),t("el-radio-group",{staticStyle:{width:"60%"},model:{value:i.note_type,callback:function(s){i.note_type=s},expression:"note_type"}},[t("el-radio",{staticStyle:{"margin-bottom":"10px"},attrs:{label:1}},[i._v("全部权限")]),i._v(" "),t("el-radio",{staticStyle:{"margin-bottom":"10px"},attrs:{label:2}},[i._v("没有权限")]),i._v(" "),t("el-radio",{staticStyle:{"margin-bottom":"10px"},attrs:{label:3}},[i._v("自定义权限描述")])],1),i._v(" "),3==i.note_type?t("el-input",{staticClass:"input",staticStyle:{"margin-left":"72px"},attrs:{placeholder:"请输入自定义权限描述",size:"mini",clearable:""},model:{value:i.note_input_keyword,callback:function(s){i.note_input_keyword=s},expression:"note_input_keyword"}}):i._e()],1)]),i._v(" "),t("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{attrs:{size:"mini"},on:{click:function(s){i.addPermissionFlag=!1}}},[i._v("取 消")]),i._v(" "),t("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(s){i.isAddEdit?i.editAuth():i.addAuth()}}},[i._v("确 定")])],1)])],1),i._v(" "),i.permissionFlag?t("permission",{attrs:{premissionName:i.premissionName+" / "+i.premission_name,auth_id:i.premission_id,role_id:i.role_id},on:{smallPageIsShow:i.smallPageIsShow}}):i._e()],1)},staticRenderFns:[function(){var i=this.$createElement,s=this._self._c||i;return s("tr",[s("th",[this._v("权限名称")]),s("th",[this._v("权限")]),s("th",[this._v("更新时间")]),s("th",[this._v("查看权限")]),s("th",[this._v("是否展示到权限页面")]),s("th",[this._v("操作")])])}]};var r={components:{smallPermission:t("C7Lr")(a,o,!1,function(i){t("Uteu")},"data-v-f9578170",null).exports},data:function(){return{isAddEdit:!1,premission_id:"",loading:!1,permissionsList:[],is_switch:!1,addPermissionFlag:!1,premission_name:"",cust_show:!1,smallPermissionFlag:!1}},created:function(){this.permissions(1)},methods:{bigPageIsShow:function(i){console.log("sss",i),this.smallPermissionFlag=i},delAuth:function(i){var s=this;this.loading=!0,this.$axios.post(this.URL.BASEURL+this.URL.delAuth,{id:i}).then(function(i){i=i.data;s.loading=!1,i&&0==i.errno?s.permissions():s.$message({message:i.err,type:"warning"})}).catch(function(i){this.loading=!1})},editPermissionEvent:function(i){var s=i.id,t=i.is_switch,e=i.name;this.premission_id=s,this.premission_name=e,this.addPermissionFlag=!0,this.isAddEdit=!0,this.cust_show=t},editAuth:function(){var i=this;""!=this.premission_name?(this.loading=!0,this.$axios.post(this.URL.BASEURL+this.URL.editAuth,{id:this.premission_id,cust_show:this.cust_show?1:0,name:this.premission_name}).then(function(s){s=s.data;i.loading=!1,s&&0==s.errno?(i.init(),i.permissions()):i.$message({message:s.err,type:"warning"})}).catch(function(i){this.loading=!1})):this.$message({message:"请填写权限名称",type:"fail"})},init:function(){this.addPermissionFlag=!1,this.cust_show=!1,this.premission_name="",this.isAddEdit=!1,this.premission_id=""},switchChange:function(i){var s=this,t=i.is_switch,e=i.index,n=i.id;this.loading=!0,this.$axios.post(this.URL.BASEURL+this.URL.showAuth,{cust_show:t?1:0,id:n}).then(function(i){i=i.data;s.loading=!1,i&&0==i.errno?(s.permissionsList[e].cust_show=t?1:0,s.permissionsList[e].is_switch=t,s.$message.closeAll(),s.$message({message:"修改成功",type:"success"})):s.$message({message:i.err,type:"warning"})}).catch(function(i){this.loading=!1})},addAuth:function(){var i=this;""!=this.premission_name?(this.loading=!0,this.$axios.post(this.URL.BASEURL+this.URL.addAuth,{cust_show:this.cust_show?1:0,name:this.premission_name}).then(function(s){s=s.data;i.loading=!1,s&&0==s.errno?(i.addPermissionFlag=!1,i.cust_show=!1,i.premission_name="",i.permissions()):i.$message({message:s.err,type:"warning"})}).catch(function(i){this.loading=!1})):this.$message({message:"请填写权限名称",type:"fail"})},permissions:function(i){this.page=i;var s=this;this.loading=!0,this.$axios.get(this.URL.BASEURL+this.URL.authsList,{params:{}}).then(function(i){i=i.data;s.loading=!1,0==i.errno&&i?(s.permissionsList=i.rst,s.permissionsList.forEach(function(i){i.is_switch=1==i.cust_show})):s.$message({message:i.err,type:"warning"})}).catch(function(i){s.loading=!1})}},watch:{addPermissionFlag:function(){this.addPermissionFlag||this.init()}}},l={render:function(){var i=this,s=i.$createElement,t=i._self._c||s;return t("div",{directives:[{name:"loading",rawName:"v-loading",value:i.loading,expression:"loading"}],staticClass:"permission_big_div",attrs:{"element-loading-text":"拼命加载中","element-loading-spinner":"el-icon-loading"}},[i.smallPermissionFlag?i._e():t("div",[t("div",{staticClass:"content"},[t("div",{staticClass:"topOperation clear"},[t("el-button",{staticClass:"operation add",attrs:{type:"primary",size:"small"},on:{click:function(s){i.addPermissionFlag=!0}}},[i._v("+ 新增权限模块")])],1),i._v(" "),t("table",{staticClass:"table"},[i._m(0),i._v(" "),i._l(i.permissionsList,function(s,e){return t("tr",{key:s.id},[t("td",[i._v(i._s(s.name))]),i._v(" "),t("td",[i._v(i._s(s.updated_at))]),i._v(" "),t("td",[t("span",{staticStyle:{color:"#2662FF",cursor:"pointer"},on:{click:function(t){i.smallPermissionFlag=!0,i.premission_id=s.id,i.premission_name=s.name}}},[i._v("查看下级")])]),i._v(" "),t("td",[t("el-switch",{attrs:{"active-color":"#13ce66","inactive-color":"#cccccc"},on:{change:function(t){return i.switchChange({is_switch:t,index:e,id:s.id})}},model:{value:s.is_switch,callback:function(t){i.$set(s,"is_switch",t)},expression:"item.is_switch"}})],1),i._v(" "),t("td",[t("button",{staticClass:"edit",on:{click:function(t){return i.editPermissionEvent({id:s.id,is_switch:s.is_switch,name:s.name})}}},[i._v("编辑")]),i._v(" "),t("button",{staticClass:"delete",on:{click:function(t){return i.delAuth(s.id)}}},[i._v("删除")])])])})],2)]),i._v(" "),t("el-dialog",{staticClass:"dialog",attrs:{title:i.isAddEdit?"编辑权限":"新增权限大类",visible:i.addPermissionFlag,width:"30%"},on:{"update:visible":function(s){i.addPermissionFlag=s}}},[t("div",{staticClass:"dialog"},[t("div",{staticClass:"dialogBox"},[t("label",{staticClass:"label_div"},[i._v("标题名称")]),i._v(" "),t("el-input",{staticClass:"input",attrs:{placeholder:"请输入标题名称",size:"mini",clearable:""},model:{value:i.premission_name,callback:function(s){i.premission_name="string"==typeof s?s.trim():s},expression:"premission_name"}})],1),i._v(" "),t("div",{staticClass:"dialogBox"},[t("label",{staticClass:"label_div"},[i._v("是否展示")]),i._v(" "),t("el-switch",{attrs:{"active-color":"#13ce66","inactive-color":"#cccccc"},model:{value:i.cust_show,callback:function(s){i.cust_show=s},expression:"cust_show"}})],1)]),i._v(" "),t("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{attrs:{size:"mini"},on:{click:function(s){i.addPermissionFlag=!1}}},[i._v("取 消")]),i._v(" "),t("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(s){i.isAddEdit?i.editAuth():i.addAuth()}}},[i._v("确 定")])],1)])],1),i._v(" "),i.smallPermissionFlag?t("small-permission",{attrs:{premissionId:i.premission_id,premissionName:i.premission_name},on:{bigPageIsShow:i.bigPageIsShow}}):i._e()],1)},staticRenderFns:[function(){var i=this.$createElement,s=this._self._c||i;return s("tr",[s("th",[this._v("标题名称")]),s("th",[this._v("更新时间")]),s("th",[this._v("下级模块")]),s("th",[this._v("是否展示到权限页面")]),s("th",[this._v("操作")])])}]};var c=t("C7Lr")(r,l,!1,function(i){t("2LB4")},"data-v-91ba9e3e",null);s.default=c.exports},Uteu:function(i,s){},lOkq:function(i,s){}});
|