You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
11 KiB
1 lines
11 KiB
webpackJsonp([23],{WSQj:function(e,t){},sIiw:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a("Dd8w"),n=a.n(r),i=a("Xxa5"),o=a.n(i),l=a("mvHQ"),s=a.n(l),c=a("exGp"),u=a.n(c),d=a("NYxO"),h=a("PJh5"),m=a.n(h),p={data:function(){var e=this;return{loading:!1,searchForm:{page:1,limit:10,title:"",type:0},tableData:[],total:0,count:0,checkTreeAll:!1,authPermiList:[],ops:{vuescroll:{wheelScrollDuration:600},scrollPanel:{initialScrollY:!1,initialScrollX:!1,scrollingX:!1,scrollingY:!0,speed:2e3,easing:"easeInOutQuart",verticalNativeBarPos:"right"},rail:{},bar:{showDelay:500,onlyShowBarOnScroll:!1,keepShow:!1,background:"#c1c1c1",opacity:.5,hoverStyle:!1,specifyBorderRadius:!1,minSize:!1,size:"6px",disable:!1}},defaultProps:{children:"children",label:"title"},currentNodeKey:[],showDialog:!1,dialogType:1,subForm:{id:0,title:"",node:[]},subFormRules:{title:{required:!0,validator:this.$reg.isNotNull,text:"角色名称",reg_type:2,trigger:"blur"},role:{required:!0,validator:function(t,a,r){0===e.toReturnPermi().length?r(new Error("请选择权限")):r()},trigger:"change"}}}},created:function(){var e=this;return u()(o.a.mark(function t(){var a,r;return o.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e.getTableDataList(1),a=JSON.parse(s()(e.allRoutes)),r=[],a.map(function(t,a){var n=1*a+1,i=[];t.hidden||(t.children.map(function(t,a){var r=1*a+1;if(!t.hidden){var o=[],l=["MarketArticleEnroll","SystemVirtualRecord","SystemCarFeeCity"].includes(t.name)?1:0;t.meta.pagePermission[l].auth.map(function(t,a){var i=1*a+1;o.push({id:n+"-"+r+"-"+i,name:t,title:e.$t("action."+t),selected:!1})}),i.push({id:n+"-"+r,name:t.name,title:e.$t("menu."+t.name),children:o,selected:!1})}}),r.push({id:""+n,name:t.meta.menuName,title:e.$t("menu."+t.meta.menuName),children:i,selected:!1}))}),e.authPermiList=r;case 5:case"end":return t.stop()}},t,e)}))()},computed:n()({},Object(d.d)({allRoutes:function(e){return e.routes.allRoutes}})),methods:{resetForm:function(e){this.$refs[e].resetFields(),this.getTableDataList(1)},handleSizeChange:function(e){this.searchForm.limit=e,this.handleCurrentChange(1)},handleCurrentChange:function(e){this.searchForm.page=e,this.getTableDataList()},getTableDataList:function(e){var t=this;return u()(o.a.mark(function a(){var r,n,i;return o.a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return e&&(t.searchForm.page=1),t.tableData=[],t.loading=!0,a.next=5,t.$api.account.roleList(t.searchForm);case 5:if(r=a.sent,n=r.code,i=r.data,t.loading=!1,200===n){a.next=11;break}return a.abrupt("return");case 11:t.tableData=i.data,t.total=i.total;case 13:case"end":return a.stop()}},a,t)}))()},confirmDel:function(e){var t=this;this.$confirm(this.$t("tips.confirmDelete"),this.$t("tips.reminder"),{confirmButtonText:this.$t("action.comfirm"),cancelButtonText:this.$t("action.cancel"),type:"warning"}).then(function(){t.updateItem(e,-1)}).catch(function(){})},updateItem:function(e,t){var a=this;return u()(o.a.mark(function r(){return o.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:a.$api.account.roleUpdate({id:e,status:t}).then(function(e){if(200===e.code)a.$message.success(a.$t(-1===t?"tips.successDel":"tips.successOper")),-1===t&&(a.searchForm.page=a.searchForm.page<Math.ceil((a.total-1)/a.searchForm.limit)?a.searchForm.page:Math.ceil((a.total-1)/a.searchForm.limit),a.getTableDataList());else{if(-1===t)return;a.getTableDataList()}});case 1:case"end":return r.stop()}},r,a)}))()},toShowDialog:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return u()(o.a.mark(function a(){var r,n,i,l,c,u,d,h,m,p;return o.a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:for(r in e.subForm)e.subForm[r]=t[r];if(n=t.id,i=void 0===n?0:n,e.showDialog=!e.showDialog,i){a.next=7;break}return e.currentNodeKey=[],e.$refs.tree.setCheckedKeys([]),a.abrupt("return");case 7:return a.next=9,e.$api.account.roleInfo({id:i});case 9:l=a.sent,c=l.data,u=c.node,d=u.map(function(e){return e.node}),h=JSON.parse(s()(e.authPermiList)),m=[],p=0,h.map(function(e){e.children.map(function(e){if(0===e.children.length?p++:p+=e.children.length,d.includes(e.name)){var t=u.findIndex(function(t){return t.node===e.name}),a=u[t].auth;0===e.children.length&&m.push(e),e.children.map(function(e){a.includes(e.name)&&m.push(e)})}})}),e.count=p,e.checkTreeAll=m.length===p,e.$refs.tree.setCheckedNodes(m);case 20:case"end":return a.stop()}},a,e)}))()},handleClickTreeNode:function(e){e.selected=!e.selected},currentChecked:function(e,t){var a=this,r=t.checkedKeys;t.halfCheckedNodes.map(function(e){a.handleNodeChildren(e,r)}),this.currentNodeKey=r;var n=0;this.toReturnPermi(2).map(function(e){n+=0===e.auth.length?1:e.auth.length}),this.checkTreeAll=this.count===n},handleNodeChildren:function(e,t){var a=this;if(e.children.map(function(e){return e.name}).includes("pagedata")){var r=e.children.filter(function(e){return e.selected});e.children.map(function(e){"pagedata"===e.name&&r.length>0&&!t.includes(e.id)&&t.push(e.id)})}else e.children.map(function(e){a.handleNodeChildren(e,t)})},handleCheckTreeAllChange:function(){var e=this.checkTreeAll,t=this.authPermiList.map(function(e,t){return e.id}),a=e?t:[];this.$refs.tree.setCheckedKeys(a)},toReturnPermi:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=[];return JSON.parse(s()(this.authPermiList)).map(function(a){(0!==a.children.length||a.selected)&&a.children.map(function(a){if(0!==a.children.length||a.selected){var r=[];a.children.map(function(t){(t.selected||1!==e)&&(2!==e||t.selected||"pagedata"===t.name&&("pagedata"!==t.name||1!==a.children.length))&&r.push(t.name)}),a.children.length>0&&0===r.length||t.push({node:a.name,auth:r})}})}),t},submitFormInfo:function(){var e=this;return u()(o.a.mark(function t(){var a,r,n,i;return o.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(a=!0,e.$refs.subForm.validate(function(e){e||(a=!1)}),!a){t.next=18;break}if(r=e.subForm.id?"roleUpdate":"roleAdd",(n=JSON.parse(s()(e.subForm))).node=e.toReturnPermi(),1!==n.node.length||"ShopOrderNotice"!==n.node[0].node){t.next=9;break}return e.$message.error("不能只选择订单通知哦"),t.abrupt("return");case 9:return t.next=11,e.$api.account[r](n);case 11:if(i=t.sent,200===i.code){t.next=15;break}return t.abrupt("return");case 15:e.$message.success(e.$t(n.id?"tips.successRev":"tips.successSub")),e.showDialog=!1,e.getTableDataList();case 18:case"end":return t.stop()}},t,e)}))()}},filters:{handleTime:function(e,t){return 1===t?m()(1e3*e).format("YYYY-MM-DD"):2===t?m()(1e3*e).format("HH:mm:ss"):m()(1e3*e).format("YYYY-MM-DD HH:mm:ss")}}},f={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"lb-system-news"},[a("top-nav"),e._v(" "),a("div",{staticClass:"page-main"},[a("el-row",{staticClass:"page-top-operate"},[a("lb-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:e.$route.name+"-add",expression:"`${$route.name}-add`"}],attrs:{type:"primary",icon:"el-icon-plus"},on:{click:e.toShowDialog}},[e._v(e._s(e.$t("menu.AccountRoleAdd")))])],1),e._v(" "),a("el-row",{staticClass:"page-search-form"},[a("el-form",{ref:"searchForm",attrs:{inline:!0,model:e.searchForm},nativeOn:{submit:function(e){e.preventDefault()}}},[a("el-form-item",{attrs:{label:"角色名称",prop:"title"}},[a("el-input",{attrs:{placeholder:"请输入角色名称"},model:{value:e.searchForm.title,callback:function(t){e.$set(e.searchForm,"title",t)},expression:"searchForm.title"}})],1),e._v(" "),a("el-form-item",[a("lb-button",{staticStyle:{"margin-right":"5px"},attrs:{size:"medium",type:"primary",icon:"el-icon-search"},on:{click:function(t){return e.getTableDataList(1)}}},[e._v(e._s(e.$t("action.search")))]),e._v(" "),a("lb-button",{staticStyle:{"margin-right":"5px"},attrs:{size:"medium",icon:"el-icon-refresh-left"},on:{click:function(t){return e.resetForm("searchForm")}}},[e._v(e._s(e.$t("action.reset")))])],1)],1)],1),e._v(" "),a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],staticStyle:{width:"100%"},attrs:{data:e.tableData,"header-cell-style":{background:"#f5f7fa",color:"#606266"}}},[a("el-table-column",{attrs:{prop:"id",label:"ID"}}),e._v(" "),a("el-table-column",{attrs:{prop:"title",label:"角色名称"}}),e._v(" "),a("el-table-column",{attrs:{prop:"create_time",label:"创建时间"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("p",[e._v(e._s(e._f("handleTime")(t.row.create_time,1)))]),e._v(" "),a("p",[e._v(e._s(e._f("handleTime")(t.row.create_time,2)))])]}}])}),e._v(" "),a("el-table-column",{attrs:{"min-width":"120",label:"操作"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("div",{staticClass:"table-operate"},[a("lb-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:e.$route.name+"-edit",expression:"`${$route.name}-edit`"}],attrs:{size:"mini",plain:"",type:"primary"},on:{click:function(a){return e.toShowDialog(t.row)}}},[e._v(e._s(e.$t("action.edit")))]),e._v(" "),a("lb-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:e.$route.name+"-delete",expression:"`${$route.name}-delete`"}],attrs:{size:"mini",plain:"",type:"danger"},on:{click:function(a){return e.confirmDel(t.row.id)}}},[e._v(e._s(e.$t("action.delete")))])],1)]}}])})],1),e._v(" "),a("lb-page",{attrs:{batch:!1,page:e.searchForm.page,pageSize:e.searchForm.limit,total:e.total},on:{handleSizeChange:e.handleSizeChange,handleCurrentChange:e.handleCurrentChange}}),e._v(" "),a("el-dialog",{attrs:{title:e.$t(e.subForm.id?"menu.AccountRoleEdit":"menu.AccountRoleAdd"),visible:e.showDialog,width:"500px",center:""},on:{"update:visible":function(t){e.showDialog=t}}},[a("el-form",{ref:"subForm",staticClass:"dialog-form",attrs:{model:e.subForm,rules:e.subFormRules,"label-width":"100px"}},[a("el-form-item",{attrs:{label:"角色名称",prop:"title"}},[a("el-input",{attrs:{placeholder:"请输入角色名称",maxlength:"20","show-word-limit":""},model:{value:e.subForm.title,callback:function(t){e.$set(e.subForm,"title",t)},expression:"subForm.title"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"选择权限",prop:"role"}},[a("el-checkbox",{on:{change:e.handleCheckTreeAllChange},model:{value:e.checkTreeAll,callback:function(t){e.checkTreeAll=t},expression:"checkTreeAll"}},[e._v("全选")]),e._v(" "),a("div",{staticClass:"data-box"},[a("vue-scroll",{attrs:{ops:e.ops}},[a("el-tree",{ref:"tree",attrs:{data:e.authPermiList,"show-checkbox":"","default-expand-all":"","node-key":"id","highlight-current":"",props:e.defaultProps,"default-checked-keys":e.currentNodeKey},on:{"check-change":e.handleClickTreeNode,check:e.currentChecked}})],1)],1)],1)],1),e._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(t){e.showDialog=!1}}},[e._v("取 消")]),e._v(" "),a("el-button",{directives:[{name:"preventReClick",rawName:"v-preventReClick"}],attrs:{type:"primary"},on:{click:e.submitFormInfo}},[e._v("确 定")])],1)],1)],1)],1)},staticRenderFns:[]};var v=a("VU/8")(p,f,!1,function(e){a("WSQj")},"data-v-e15ec242",null);t.default=v.exports}}); |