msSecurityStrategyConfigList.js 5.4 KB

1
  1. var defaultParams={sys:{id:""},strategyName:"",userName:"",limit:5,offset:0,order:"",sort:""},lib=window.getDirewolfLibrary(),msSecurityStrategyConfigListContentVm=new Vue({el:"#msSecurityStrategyConfigListContent",data:{searchParams:JSON.parse(JSON.stringify(defaultParams)),msSecurityStrategyConfigTablePage:{},editType:GetQueryString("editType"),msSysList:[],pageLoading:!1,sysLoading:!1,pageToken:"",msSecurityStrategyConfigTableLoading:!1},computed:{formBaseUrl:function(){return getRelativePath()+"msSecurityStrategyConfigForm.html?editType="},requestPrefix:function(){return this.msConfig.gatewayRoute+this.msConfig.adminPath},inViewMode:function(){return"view"===this.editType||!(this.hasPermission("edit")&&this.hasPermission("del")&&this.hasPermission("add"))}},methods:{hasPermission:function(e){return lib.$$utils.permission.hasPermission("platman:msSecurityStrategyConfig:"+e)},refreshTable:function(){var e=this.requestPrefix+"/platman/msSecurityStrategyConfig/getMsSecurityStrategyConfigList?"+lib.$$utils.stringifyQueryParams(this.searchParams),t="获取安全策略信息记录",s=this;s.msSecurityStrategyConfigTableLoading=!0,axios.get(e).then(function(e){s.msSecurityStrategyConfigTablePage=getDataFromAxiosResponse(e,t),s.msSecurityStrategyConfigTableLoading=!1}).catch(function(e){axiosErrorTips(e,t+"异常")})},resetSearchParam:function(){this.searchParams=JSON.parse(JSON.stringify(defaultParams)),this.refreshTable()},handleRowClick:function(e,t,s){eleTableClickSelection(this.$refs.msSecurityStrategyConfigTable,e,s)},handleTableSizeChange:function(e){this.searchParams.limit=e,this.refreshTable()},handleTableCurrentChange:function(e){this.searchParams.offset=this.searchParams.limit*(e-1),this.refreshTable()},handleSortChange:function(e){null===e.prop||null===e.order?(this.searchParams.sort=defaultParams.sort,this.searchParams.order=defaultParams.order):("sysName"===e.prop?this.searchParams.sort="sysId":this.searchParams.sort=e.prop,this.searchParams.order=e.order.split("ending")[0]),this.refreshTable()},addNewMsSecurityStrategyConfig:function(){var e=this.formBaseUrl+"add",t=this;openDialog("新增安全策略信息",e,{width:"700px",height:"350px",callback:function(){t.refreshTable()}})},deleteSelectedMsSecurityStrategyConfig:function(){var i=this,r=i.$refs.msSecurityStrategyConfigTable.selection;0!==r.length?direwolfCommonConfirm({message:'删除前请点击右侧按钮确认无网关引用选中的安全策略,否则将导致网关<span style="color: #F56C6C">访问错误</span><br>确认继续删除吗?',title:"删除提醒"},function(){var e,t,s="";r.forEach(function(e){e.id&&(s+=e.id+",")}),1<s.length&&(s=s.substr(0,s.length-1),e=i.requestPrefix+"/platman/msSecurityStrategyConfig/deleteAll?ids="+s,t="批量删除安全策略信息",axios.post(e).then(function(e){"success"===getDataFromAxiosResponse(e,t,!0).type&&i.refreshTable()}).catch(function(e){axiosErrorTips(e,t+"异常")}))}):direwolfCommonTips("warning","请选择要删除的记录")},editSelectedMsSecurityStrategyConfig:function(){var e,t=this,s=t.$refs.msSecurityStrategyConfigTable.selection;1===s.length?(e=t.formBaseUrl+"edit&id="+s[0].id,openDialog("修改安全策略信息",e,{width:"700px",height:"350px",callback:function(e){t.refreshTable()}})):direwolfCommonTips("warning","仅能选择一条记录进行编辑")},handleSysParamFocus:function(){this.getSysListByUser("")},getSysListByUser:function(e){var t=this,s=t.requestPrefix+"/platman/msSystemAdmin/listSystemByCurrentUser?sysName="+e,i="获取系统列表";t.sysLoading=!0,axios.get(s).then(function(e){t.sysLoading=!1,t.msSysList=getDataFromAxiosResponse(e,i).data}).catch(function(e){t.sysLoading=!1,axiosErrorTips(e,i+"异常")})},validatePassword:function(s){var i=this;i.$$utils.direwolfCommonPrompt({message:"请输入密码",title:"密码检查",inputType:"password"},function(e){var t;"confirm"===e.action&&(t=i.requestPrefix+"/platman/msSecurityStrategyConfig/validatePassword?id="+s.row.id+"&userPassword="+e.value,i.$$utils.axiosRequest(t,"密码检查").then(function(e){"T"===e.data?i.$$utils.direwolfCommonTips("success","输入密码正确"):i.$$utils.direwolfCommonTips("error","输入密码错误")}))})},showReference:function(e){var s=this,t=s.requestPrefix+"/platman/msGatewayRouteConfig/getMsGatewayRouteConfigList?secStrategyId="+e.row.id;s.sysLoading=!0,axios.get(t).then(function(e){var t={size:"medium",stripe:!(s.sysLoading=!1),border:!0,tooltipEffect:"dark",data:getDataFromAxiosResponse(e,"获取网关配置列表").list};s.$$utils.showStaticPage({title:"引用此安全策略的网关配置",contentHeight:"340px",width:"80%"},{tag:"el-table",props:{props:t},children:[{tag:"el-table-column",props:{props:{prop:"routeName",label:"名称"}}},{tag:"el-table-column",props:{props:{prop:"sysName",label:"所属系统"}}},{tag:"el-table-column",props:{props:{prop:"serviceName",label:"所属服务"}}},{tag:"el-table-column",props:{props:{prop:"routeEnabled",label:"网关是否启用",formatter:function(e,t,s){return"0"===s?"否":"是"}}}},{tag:"el-table-column",props:{props:{prop:"enableSecStrategy",label:"安全策略是否启用",formatter:function(e,t,s){return"0"===s?"否":"是"}}}}]})}).catch(function(e){s.sysLoading=!1,axiosErrorTips(e,listInfo+"异常")})}},created:function(){var e=this;e.msConfig=(new ProjectConfig).platmanServiceConfig,checkPagePermission(e.requestPrefix+"/platman/msSecurityStrategyConfig/checkMsSecurityStrategyConfigListPermission"),e.pageLoading=!1,e.refreshTable()},mounted:function(){}});