Authored by qinchao

bug修复

... ... @@ -110,9 +110,9 @@
<input type="text" id="searchApiUrl" name="searchApiUrl" class="form-control"
placeholder=""/>
</div>
<button id="searchJavaInfoBtn" class="btn btn-default">搜索</button>
<button id="searchJavaInfoBtn" class="btn btn-primary">搜索</button>
</div>
<button id="addInfoBtn" class="btn btn-primary" style="margin-top: 12px;margin-left: 100px;">
<button id="addInfoBtn" class="btn btn-info" style="margin-top: 12px;margin-left: 100px;">
新增
</button>
</div>
... ... @@ -134,20 +134,7 @@
var java_api_type = [];
var java_app = {};
var table_data;
var refreshTypeSelected = function () {
var selObj = $("#searchApiType");
$.each(java_api_type, function (idx, val) {
var value = val.value;
var text = val.text;
selObj.append("<option value='" + value + "'>" + text + "</option>");
});
if (api_type != undefined && api_type != 0) {
selObj.val(api_type);
}
};
var getTypeName = function (typeId) {
for (var i = 0; i < java_api_type.length; i++) {
if (java_api_type[i].value == typeId) {
... ... @@ -159,55 +146,6 @@
};
var getJavaAppType = function () {
$.ajax({
url: contextPath + "/type/queryJavaApiType",
type: 'get',
success: function (data) {
if (!data || data.code != 200) {
$.toaster('获取java服务类型失败', '警告', 'warning');
return;
}
$.each(data.data, function (idx, val) {
java_api_type.push({
"value": val.typeId,
"text": val.typeName
});
})
refreshTypeSelected();
},
error: function (data) {
$.toaster('获取java服务类型失败', '警告', 'warning');
}
});
};
var getJavaApp = function () {
$.ajax({
url: contextPath + "/mobject/queryJavaApp",
type: 'get',
success: function (data) {
if (!data || data.code != 200) {
$.toaster('获取java服务失败', '警告', 'warning');
return;
}
console.log(data.data);
$.each(data.data, function (idx, val) {
if (java_app["" + val.moTypeId] == undefined) {
java_app["" + val.moTypeId] = [];
}
java_app["" + val.moTypeId].push(val);
})
console.log(java_app);
},
error: function (data) {
$.toaster('获取java服务失败', '警告', 'warning');
}
});
};
// $('body').popover({
// selector: '.has-popover',
// container: 'body'
... ... @@ -327,7 +265,7 @@
});
});
}
//console.log("refresh status"+JSON.stringify(reqList));
console.log("refresh status"+JSON.stringify(reqList));
//每行就去获取,缩短整个表请求时间
$.ajax({
... ... @@ -337,8 +275,9 @@
list: JSON.stringify(reqList)
},
success: function (data) {
// console.log(data);
//
if (!data || data.code != 200) {
console.log(data);
$.toaster('获取java服务状态失败', '警告', 'warning');
return;
}
... ... @@ -380,12 +319,34 @@
setTimeout("timer()", 50000);
}
timer();
$(function () {
getJavaAppType();
getJavaApp();
$("#addInfoBtn").click(function () {
editJavaInfo(null);
});
//点击查询按钮
$("#searchJavaInfoBtn").click(function () {
var name = $("#searchApiName").val();
var url = $("#searchApiUrl").val();
var type = $("#searchApiType").val();
var method = $("#searchApiReqMethod").val();
$("#infoTable").table("load", {
'apiName': name,
'apiUrl': url,
'serviceType': type,
'apiReqMethod': method
});
});
});
function getTableParam() {
var tableParam = {
columnAutoWidth: false,
url: contextPath + "/javaApi/query",
... ... @@ -547,34 +508,84 @@
width: "10%"
}]
};
var params = {};
if (api_type != undefined && api_type != 0) {
tableParam.queryParams = {
'serviceType': api_type
}
}
//加载表格
$("#infoTable").table(tableParam);
return tableParam;
}
$("#addInfoBtn").click(function () {
editJavaInfo(null);
function getJavaApp() {
$.ajax({
url: contextPath + "/mobject/queryJavaApp",
type: 'get',
success: function (data) {
if (!data || data.code != 200) {
$.toaster('获取java服务失败', '警告', 'warning');
return;
}
console.log(data.data);
$.each(data.data, function (idx, val) {
if (java_app["" + val.moTypeId] == undefined) {
java_app["" + val.moTypeId] = [];
}
java_app["" + val.moTypeId].push(val);
})
console.log(java_app);
//加载表格
$("#infoTable").table(getTableParam());
},
error: function (data) {
$.toaster('获取java服务失败', '警告', 'warning');
}
});
//点击查询按钮
$("#searchJavaInfoBtn").click(function () {
var name = $("#searchApiName").val();
var url = $("#searchApiUrl").val();
var type = $("#searchApiType").val();
var method = $("#searchApiReqMethod").val();
$("#infoTable").table("load", {
'apiName': name,
'apiUrl': url,
'serviceType': type,
'apiReqMethod': method
});
}
function getJavaAppType() {
$.ajax({
url: contextPath + "/type/queryJavaApiType",
type: 'get',
success: function (data) {
if (!data || data.code != 200) {
$.toaster('获取java服务类型失败', '警告', 'warning');
return;
}
$.each(data.data, function (idx, val) {
java_api_type.push({
"value": val.typeId,
"text": val.typeName
});
})
refreshTypeSelected();
},
error: function (data) {
$.toaster('获取java服务类型失败', '警告', 'warning');
}
});
});
}
function refreshTypeSelected() {
var selObj = $("#searchApiType");
$.each(java_api_type, function (idx, val) {
var value = val.value;
var text = val.text;
selObj.append("<option value='" + value + "'>" + text + "</option>");
});
if (api_type != undefined && api_type != 0) {
selObj.val(api_type);
}
}
//打开新增或修改页面
... ...