|  | @ -6,12 +6,12 @@
 | 
	
		
			
				|  |  |     /* *************************** 模块初始化 ***************************** */
 | 
	
		
			
				|  |  |     var editorAppService = {
 | 
	
		
			
				|  |  |         //form
 | 
	
		
			
				|  |  |         actionUrl:"${contextRoot}/app/addAppService",
 | 
	
		
			
				|  |  |         $condition: null,
 | 
	
		
			
				|  |  |         $valid:"${model.valid}",
 | 
	
		
			
				|  |  |         init: function () {
 | 
	
		
			
				|  |  |             this.bindEvents();
 | 
	
		
			
				|  |  |             this.initForm();
 | 
	
		
			
				|  |  |             this.resolveParam();
 | 
	
		
			
				|  |  |         },
 | 
	
		
			
				|  |  |         initForm: function () {
 | 
	
		
			
				|  |  |             var me = this;
 | 
	
	
		
			
				|  | @ -20,11 +20,30 @@
 | 
	
		
			
				|  |  |             if(modelString!=undefined && modelString!=null && modelString.length>0)
 | 
	
		
			
				|  |  |             {
 | 
	
		
			
				|  |  |                 var valid = "${model.valid}";
 | 
	
		
			
				|  |  |                 if(valid=='1'){
 | 
	
		
			
				|  |  |                     valid="有效";
 | 
	
		
			
				|  |  |                 }else if(valid=='0'){
 | 
	
		
			
				|  |  |                     valid="无效";
 | 
	
		
			
				|  |  |                 }else{
 | 
	
		
			
				|  |  |                     valid="空";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 var healthReportType = "${model.healthReportType}";
 | 
	
		
			
				|  |  |                 if(healthReportType=='1'){
 | 
	
		
			
				|  |  |                     healthReportType="推送";
 | 
	
		
			
				|  |  |                 }else if(healthReportType=='0'){
 | 
	
		
			
				|  |  |                     healthReportType="拉取";
 | 
	
		
			
				|  |  |                 }else{
 | 
	
		
			
				|  |  |                     healthReportType="空";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 var metricsReportType = "${model.metricsReportType}";
 | 
	
		
			
				|  |  |                 liger.get("txtValid").selectValue(valid);
 | 
	
		
			
				|  |  |                 liger.get("healthReportType").selectValue(healthReportType);
 | 
	
		
			
				|  |  |                 liger.get("metricsReportType").selectValue(metricsReportType);
 | 
	
		
			
				|  |  |                 if(metricsReportType=='1'){
 | 
	
		
			
				|  |  |                     metricsReportType="推送";
 | 
	
		
			
				|  |  |                 }else if(metricsReportType=='0'){
 | 
	
		
			
				|  |  |                     metricsReportType="拉取";
 | 
	
		
			
				|  |  |                 }else{
 | 
	
		
			
				|  |  |                     metricsReportType="空";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 data={
 | 
	
		
			
				|  |  |                     id: "${model.id}",
 | 
	
	
		
			
				|  | @ -39,22 +58,15 @@
 | 
	
		
			
				|  |  |                    requestProtocol: "${model.requestProtocol}",
 | 
	
		
			
				|  |  |                    requesModule: "${model.requesModule}".replace(/<br>/ig,"\n"),
 | 
	
		
			
				|  |  |                    requestMethod: "${model.requestMethod}",
 | 
	
		
			
				|  |  |                    healthReportType: "${model.healthReportType}",
 | 
	
		
			
				|  |  |                    healthReportType: healthReportType,
 | 
	
		
			
				|  |  |                    healthEndpoint: "${model.healthEndpoint}",
 | 
	
		
			
				|  |  |                    responeResult:"${model.responeResult}".replace(/<br>/ig,"\n"),
 | 
	
		
			
				|  |  |                    responeError: "${model.responeError}".replace(/<br>/ig,"\n"),
 | 
	
		
			
				|  |  |                    metricsReportType: "${model.metricsReportType}",
 | 
	
		
			
				|  |  |                    metricsEndpoint: "${model.metricsEndpoint}"
 | 
	
		
			
				|  |  |                    metricsReportType: metricsReportType,
 | 
	
		
			
				|  |  |                     requestParameterList:'${model.requestParameterList}',
 | 
	
		
			
				|  |  |                     metricsEndpoint: "${model.metricsEndpoint}"
 | 
	
		
			
				|  |  |                 };
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 me.actionUrl = "${contextRoot}/app/updateAppService";
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                 liger.get("txtValid").selectValue("1");//默认有效
 | 
	
		
			
				|  |  |                 liger.get("healthReportType").selectValue("");
 | 
	
		
			
				|  |  |                 liger.get("metricsReportType").selectValue("");
 | 
	
		
			
				|  |  |                 data={
 | 
	
		
			
				|  |  |                     appId: "${appId}"
 | 
	
		
			
				|  |  |                 };
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             $("#div_info_form").ligerAutoForm({
 | 
	
	
		
			
				|  | @ -73,54 +85,35 @@
 | 
	
		
			
				|  |  |         },
 | 
	
		
			
				|  |  |         bindEvents: function () {
 | 
	
		
			
				|  |  |             var me = this;
 | 
	
		
			
				|  |  |             $(".m-form-bottom").on("click","#btnSave",function () {
 | 
	
		
			
				|  |  |                 if(!$("#div_info_form").ligerAutoForm("validate")){
 | 
	
		
			
				|  |  |                     return;
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 var data = $("#div_info_form").ligerAutoForm("getData");
 | 
	
		
			
				|  |  |                 $.ajax({ //ajax处理
 | 
	
		
			
				|  |  |                     type: "POST",
 | 
	
		
			
				|  |  |                     url : me.actionUrl,
 | 
	
		
			
				|  |  |                     dataType : "json",
 | 
	
		
			
				|  |  |                     data:data,
 | 
	
		
			
				|  |  |                     cache:false,
 | 
	
		
			
				|  |  |                     success :function(data){
 | 
	
		
			
				|  |  |                         if(data.successFlg) {
 | 
	
		
			
				|  |  |                             parent.appService.dialogSuccess(data.message);
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                         else{
 | 
	
		
			
				|  |  |                             $.ligerDialog.error(data.message);
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     },
 | 
	
		
			
				|  |  |                     error :function(data){
 | 
	
		
			
				|  |  |                         $.ligerDialog.error("Status:"+data.status +"(" +data.statusText+")");
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 });
 | 
	
		
			
				|  |  |             });
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             $(".m-form-bottom").on("click","#btnCancel",function () {
 | 
	
		
			
				|  |  |                 parent.appService.dialog.close();
 | 
	
		
			
				|  |  |             });
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             $("#txtValid").ligerComboBox({data : [{"value":"有效","code":"1"},{"value":"无效","code":"0"}],
 | 
	
		
			
				|  |  |                 cancelable:false,
 | 
	
		
			
				|  |  |                 onSuccess:function(data){
 | 
	
		
			
				|  |  |                 }});
 | 
	
		
			
				|  |  |             $("#healthReportType").ligerComboBox({data : [{"value":"请选择类型","code":""},{"value":"推送","code":"1"},{"value":"拉取","code":"0"}],
 | 
	
		
			
				|  |  |                 cancelable:false,
 | 
	
		
			
				|  |  |                 onSuccess:function(data){
 | 
	
		
			
				|  |  |                 }});
 | 
	
		
			
				|  |  |             $("#metricsReportType").ligerComboBox({data : [{"value":"请选择类型","code":""},{"value":"推送","code":"1"},{"value":"拉取","code":"0"}],
 | 
	
		
			
				|  |  |                 cancelable:false,
 | 
	
		
			
				|  |  |                 onSuccess:function(data){
 | 
	
		
			
				|  |  |                 }});
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             $("#resourceCondition").css("height", (window.screen.height - 200) / 5).css("overflow", "auto");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             editorAppService.$condition = $('#serviceCondition').ligerCondition({
 | 
	
		
			
				|  |  |                 stdDictUrl: "${contextRoot}/std/getDictByScheme",
 | 
	
		
			
				|  |  |             });
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         },
 | 
	
		
			
				|  |  |         resolveParam: function () {
 | 
	
		
			
				|  |  |             //将json的参数列表解析出来
 | 
	
		
			
				|  |  |             var paramStr = $("#requestParameterList").val();
 | 
	
		
			
				|  |  |             if (paramStr != ""){
 | 
	
		
			
				|  |  |                 var paramJson = $.parseJSON(paramStr);
 | 
	
		
			
				|  |  |                 var index =1;
 | 
	
		
			
				|  |  |                 for (var name in paramJson) {
 | 
	
		
			
				|  |  |                     var type = paramJson[name];
 | 
	
		
			
				|  |  |                     //动态添加参数
 | 
	
		
			
				|  |  |                     var html = '<div class="params" dataIndex="' + index + '" id="paramGroup' + index + '">';
 | 
	
		
			
				|  |  |                     html += '<div class="m-form-control" controlType="textbox" id="divName' + index + '_div" style="margin-left:0px;">参数' + index + ' : ' +
 | 
	
		
			
				|  |  |                             '<input type="text" id="name' + index + '" value='+name+' readonly="readonly"  class="l-textbox"/></div>';
 | 
	
		
			
				|  |  |                     html += '<div class="m-form-control" controlType="textbox" id="divType' + index + '_div" style="margin-left:0px;"><div class="l-text-wrapper"><div style="padding-left:10px;width: 100%;height: 100%;line-height:30px;"> 类型: </div></div>' +
 | 
	
		
			
				|  |  |                             '<input type="text" id="type' + index + '" value='+type+' data-type="select" readonly="readonly"  class="l-textbox"/></div></div>';
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     $("#paramDiv").append(html);
 | 
	
		
			
				|  |  |                     index++;
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             $(".l-text-combobox").find("div[class=l-trigger]").remove();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     };
 | 
	
		
			
				|  |  | 
 |