msSystemConfigCenter.js 4.5 KB

1
  1. var defaultParams={application:"",profile:"",label:"",limit:5,offset:0,order:"",sort:""},serviceCode_serviceNameJson={},msSecurityStrategyConfigListContentVm=new Vue({el:"#msSecurityStrategyConfigListContent",data:{searchParams:JSON.parse(JSON.stringify(defaultParams)),msSecurityStrategyConfigTablePage:{},editType:GetQueryString("editType"),sysId:GetQueryString("sysId"),pageLoading:!1,msSecurityStrategyConfigTableLoading:!1,applicationSelect:null,profileSelect:null,labelSelect:null},created:function(){var e=this;e.msConfig=(new ProjectConfig).platmanServiceConfig,checkPagePermission(commonConfig.sysBackendContext+"/sys/sysParam/checkSysParamListPermission"),e.pageLoading=!1,e.getAllApplicationSelect()},computed:{formBaseUrl:function(){return getRelativePath()+"msSystemConfigCenterForm.html?editType="},requestPrefix:function(){return this.msConfig.gatewayRoute+this.msConfig.adminPath}},methods:{getAllApplicationSelect:function(){var i=this,e=i.requestPrefix+"/platman/msServiceInfo/getAllMsServiceInfoServiceCodeAndServiceNameBySysId?sysId="+i.sysId;axiosRequest(e,"获取服务列表").then(function(e){i.applicationSelect=e;var t=i.applicationSelect[0];for(var a in t&&(i.searchParams.application=t.serviceCode),e)serviceCode_serviceNameJson[e[a].serviceCode]=e[a].serviceName;i.refreshTable(),i.getAllProfileSelect()})},getAllProfileSelect:function(){var t=this,e=commonConfig.sysBackendContext+"/sys/sysParam/getAllProfileAndLabelBySysParam?application="+t.searchParams.application;axiosRequest(e,"获取当前服务的环境").then(function(e){e&&(t.profileSelect=e.profileSelect)})},getAllLabelSelect:function(){this.searchParams.label="",this.labelSelect=null;var t=this,e=commonConfig.sysBackendContext+"/sys/sysParam/getAllProfileAndLabelBySysParam?application="+t.searchParams.application+"&profile="+t.searchParams.profile;axiosRequest(e,"获取当前服务和环境的分支").then(function(e){e&&(t.labelSelect=e.labelSelect)})},changeApplicationSelect:function(){this.searchParams.profile="",this.searchParams.label="",this.profileSelect=null,this.labelSelect=null,this.getAllProfileSelect()},changeProfileSelect:function(){this.getAllLabelSelect()},refreshTable:function(){var i=this;i.msSecurityStrategyConfigTableLoading=!0;var e=commonConfig.sysBackendContext+"/sys/sysParam/getSysParamList?"+jsonToSpringBinder(this.searchParams);axiosRequest(e,"获取SysParam信息记录").then(function(e){i.msSecurityStrategyConfigTablePage=e;var t=i.msSecurityStrategyConfigTablePage.list;for(var a in t)t[a].application&&(t[a].application=serviceCode_serviceNameJson[t[a].application.toUpperCase()]);i.msSecurityStrategyConfigTableLoading=!1})},resetSearchParam:function(){this.searchParams=JSON.parse(JSON.stringify(defaultParams)),this.profileSelect=null,this.labelSelect=null,this.getAllApplicationSelect()},handleRowClick:function(e,t,a){eleTableClickSelection(this.$refs.msSecurityStrategyConfigTable,e,a)},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):(this.searchParams.sort=e.prop,this.searchParams.order=e.order.split("ending")[0]),this.refreshTable()},addNewSysParam:function(){var e=this.formBaseUrl+"add&sysId="+this.sysId,t=this;openDialog("新增配置项信息",e,{width:"700px",height:"350px",callback:function(){t.getAllProfileSelect(),t.refreshTable()}})},deleteSelectedSysParam:function(){var a=this,i=a.$refs.msSecurityStrategyConfigTable.selection;0!==i.length?direwolfCommonConfirm({message:"数据删除后不可恢复,确定继续删除吗?",title:"删除提醒"},function(){var e,t="";i.forEach(function(e){e.id&&(t+=e.id+",")}),1<t.length&&(t=t.substr(0,t.length-1),e=commonConfig.sysBackendContext+"/sys/sysParam/deleteAll?type=del&ids="+t,axiosRequest(e,"批量删除配置项信息","POST",null).then(function(e){e&&"success"===e.type&&(a.getAllProfileSelect(),a.refreshTable())}))}):direwolfCommonTips("warning","请选择要删除的记录")},editSelectedSysParam:function(){var e,t=this,a=this.$refs.msSecurityStrategyConfigTable.selection;1===a.length?(e=this.formBaseUrl+"edit&sysParamCode="+a[0].sysParamCode+"&sysId="+t.sysId,openDialog("修改配置项信息",e,{width:"700px",height:"350px",callback:function(e){t.refreshTable()}})):direwolfCommonTips("warning","仅能选择一条记录进行编辑")},backToLastHtml:function(){window.location.href="./msSystemInfoList.html"}}});