msServiceInfoForm.js 2.1 KB

1
  1. var msServiceInfoFormVm=new Vue({el:"#msServiceInfoForm",data:function(){return{msConfig:{},entity:{version:0,id:GetQueryString("id")||"",sysId:GetQueryString("sysId"),serviceCode:"",serviceName:"",serviceDesc:"",status:"",swaggerUrl:"",createUser:"",createTime:"",modifyUser:"",modifyTime:""},dictMap:{status:"ms_service_status"},pageDictMap:{},editType:GetQueryString("editType"),rules:{serviceCode:[{required:!0,message:"服务编码不能为空",trigger:"change"},{max:100,message:"长度不能超过 100 个字符",trigger:"change"}],serviceName:[{max:100,message:"长度不能超过 100 个字符",trigger:"change"}],serviceDesc:[{max:1e3,message:"长度不能超过 1000 个字符",trigger:"change"}],status:[{max:15,message:"长度不能超过 15 个字符",trigger:"change"}],swaggerUrl:[{max:100,message:"长度不能超过 100 个字符",trigger:"change"}]}}},computed:{urlPrefix:function(){return this.msConfig.gatewayRoute+this.msConfig.adminPath+"/platman/msServiceInfo"}},methods:{initFormData:function(){var e,t,i=this.entity.id;i&&(e=this.urlPrefix+"/getMsServiceInfoList?id="+i,t="获取微服务信息",axios.get(e).then(function(e){var i=getDataFromAxiosResponse(e,t);i.list&&i.list[0]&&(msServiceInfoFormVm.entity=i.list[0])}).catch(function(e){axiosErrorTips(e,t+"异常")}))},getDictByField:function(e){return this.pageDictMap[this.dictMap[e]]}},created:function(){var i=this;i.msConfig=(new ProjectConfig).platmanServiceConfig,checkPagePermission(i.urlPrefix+"/checkMsServiceInfoFormPermission");var t="获取字典信息";axios.get(dictUrl+"ms_service_status").then(function(e){i.pageDictMap=getDataFromAxiosResponse(e,t).data,i.initFormData()}).catch(function(e){axiosErrorTips(e,t+"异常")})},mounted:function(){var i=this;window.doSubmit=function(r){return i.$refs.msServiceInfoForm.validate(function(e){if(e){var t="保存微服务信息";return axios.post(i.urlPrefix+"/save",i.entity).then(function(e){var i=getDataFromAxiosResponse(e,t);i&&"success"===i.type&&r(i)}).catch(function(e){axiosErrorTips(e,t+"异常")}),!1}direwolfCommonTips("error","内容填写有误,请修改后再提交")}),!1}}});