提交 7ae6eec7 编写于 作者: Skyeye云's avatar Skyeye云

feat: 报表数据来源-API新增服务属性

上级 286f7fa5
......@@ -19,6 +19,7 @@ layui.config({
if (isNull(id)) {
skyeyeClassEnumUtil.showEnumDataListByClassName("reportDataFromType", 'radio', "dataFromTypeBox", '', form);
initDataFromBoxContent(dataShowType.getData('dataFromTypeBox'), null)
$("#serviceStr").html(getDataUseHandlebars(selOption, {rows: serviceMap}));
} else {
AjaxPostUtil.request({url: sysMainMation.reportBasePath + "queryReportDataFromById", params: {id: id}, type: 'json', method: 'GET', callback:function(data) {
$("#name").val(data.bean.name);
......@@ -27,6 +28,9 @@ layui.config({
initDataFromBoxContent(data.bean.type, data.bean)
$("#serviceStr").html(getDataUseHandlebars(selOption, {rows: serviceMap}));
$("#serviceStr").val(data.bean.restEntity?.serviceStr);
var list = []
if (data.bean.type == 1) {
// XML数据源
......@@ -67,10 +71,6 @@ layui.config({
type: dataShowType.getData('dataFromTypeBox'),
id: isNull(id) ? '' : id
};
if (getAnalysisData().length == 0) {
winui.window.msg('请进行字段解析操作。', {icon: 2, time: 2000});
return false;
}
var otherData = getDataByType();
params = $.extend(true, params, otherData);
......@@ -125,7 +125,8 @@ layui.config({
method: $("#restMethod").val(),
header: getRestRequestHeaderData(),
requestBody: restRequestBodyContent.getValue(),
analysisList: getAnalysisData()
analysisList: getAnalysisData(),
serviceStr: $("#serviceStr").val()
})
};
}
......@@ -352,7 +353,8 @@ layui.config({
requestUrl: $("#restUrl").val(),
requestMethod: $("#restMethod").val(),
requestHeader: getRestRequestHeaderData(),
requestBody: restRequestBodyContent.getValue()
requestBody: restRequestBodyContent.getValue(),
serviceStr: $("#serviceStr").val()
};
} else if (dataFromType == 4) {
// SQL数据源
......
......@@ -88,7 +88,7 @@ layui.config({
var topNum = multiplication(item.attrMation.attr["custom.move.y"].defaultValue, heightScale);
item.attrMation.attr["custom.move.x"].defaultValue = leftNum;
item.attrMation.attr["custom.move.y"].defaultValue = topNum;
item.attrMation.attr = getTableDataFromRest(item.attrMation.attr);
item.attrMation.businessApi = getTableDataFromRest(item.attrMation.attr);
var boxId = addNewTableModel(item.modelId, item.attrMation);
$("#" + boxId).css({
left: leftNum + "px",
......@@ -145,29 +145,20 @@ layui.config({
}
function getTableDataFromRest(attr) {
if (isNull(attr['custom.tableColumn'].defaultValue)) {
return attr;
}
var businessApi = {};
var fromId = attr['custom.dataBaseMation'].defaultValue.id;
var needGetData = {};
attr['custom.tableColumn'].defaultValue.forEach(item => {
needGetData[item.attrKey] = '';
});
if (isNull(fromId) || needGetData.length == 0) {
return attr;
if (isNull(fromId)) {
return businessApi;
}
var params = {
id: fromId,
needGetDataStr: JSON.stringify(needGetData),
inputParams: JSON.stringify({
page: 1,
limit: 15
})
id: fromId
};
AjaxPostUtil.request({url: sysMainMation.reportBasePath + "queryReportDataFromMationById", params: params, type: 'json', method: "POST", callback: function(json) {
attr["valueList"] = json.rows
AjaxPostUtil.request({url: sysMainMation.reportBasePath + "queryReportDataFromById", params: params, type: 'json', method: "GET", callback: function(json) {
businessApi.serviceStr = json.bean.restEntity?.serviceStr;
businessApi.api = json.bean.restEntity?.restUrl;
businessApi.method = json.bean.restEntity?.method;
}, async: false});
return attr;
return businessApi;
}
function addNewModel(modelId, echartsMation) {
......@@ -235,18 +226,6 @@ layui.config({
var box = createBox(boxId, modelId, null);
var tableBoxId = "table" + boxId;
var tableBox = document.createElement("div");
// 为div设置类名
tableBox.className = "table-box";
tableBox.id = "label-" + tableBoxId;
tableBox.onmousedown = ee => {
var id = $("#" + tableBoxId).parent().attr("id");
f.setMoveEvent(ee, $("#" + id));
// 阻止事件冒泡(针对父元素的move)
ee.stopPropagation();
};
box.appendChild(tableBox);
var table = document.createElement("table");
table.id = tableBoxId;
box.appendChild(table);
......
<div class="layui-form-item layui-col-xs12">
<div class="layui-form-item layui-col-xs6">
<label class="layui-form-label">所属服务<i class="red">*</i></label>
<div class="layui-input-block">
<select id="serviceStr" name="serviceStr" lay-filter="serviceStr" win-verify="required" lay-search=""></select>
</div>
</div>
<div class="layui-form-item layui-col-xs6">
<label class="layui-form-label">接口地址<i class="red">*</i></label>
<div class="layui-input-block">
<input type="text" id="restUrl" name="restUrl" win-verify="required" placeholder="请输入接口地址" class="layui-input"/>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册