获取指标说明的能力

This commit is contained in:
2025-05-21 15:51:44 +08:00
parent 06c351a956
commit 1f329e3b2a
131 changed files with 4461 additions and 3126 deletions

View File

@@ -67,8 +67,8 @@
cols: [ [
{field: 'indexCode', title: '指标代码'},
{field: 'indexName', title: '指标名称'},
{field: 'isCalc', title: '是否传统算法', templet: (d) => {
return d.isCalc ?
{field: 'isCalc', title: '是否在线指标', templet: (d) => {
return !d.isCalc ?
'<i class="op-green fa-solid fa-circle-check"></i>' :
'<i class="op-red fa-solid fa-circle-exclamation"></i>';
}},
@@ -102,13 +102,13 @@
}
}
})
table.on('tool(indexInfos)', (obj) => {
table.on('tool(indexInfos)', async function (obj) {
if (obj.event == 'detail') {
Helper.showIndexDetailLayer(obj.data);
}
})
})
});
</script>
<th:block th:replace="~{admin/v1/manage/indexInfo/updateForm::indexInfoUpdateForm}"></th:block>
</body>

View File

@@ -114,7 +114,32 @@
}
}
});
enableCodeMirrorResize(editor, document.getElementById("editor-wrapper"))
enableCodeMirrorResize(editor, document.getElementById("editor-wrapper"));
let submitBtn = document.querySelector('[lay-filter="submitIndexConfigFile"]');
submitBtn.addEventListener('click', async function(e) {
e.preventDefault();
let res = await (await fetch('/admin/v1/config/indexInfo', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
configIndOnlineUrl: document.querySelector('[name="configIndOnlineUrl"]').value,
configIndOnline: JSON.parse(editor.getValue())
})
})).json();
if (res.ok) {
Dog.success({
onClose: () => location.reload()
})
}
else {
Dog.error({
msg: res && res.data,
})
}
})
}
})
}
@@ -160,5 +185,6 @@
document.body.style.cursor = "default";
});
}
</script>
</th:block>

View File

@@ -25,6 +25,9 @@
<option value="">选择更新指标</option>
</select>
</div>
<div class="layui-inline">
<a style="display:none" href="#" id="showIndexDetailLayer" onclick="javascript:showIndexDetailLayer(this, event)"><i class="fa fa-solid fa-circle-question"></i></a>
</div>
</div>
</div>
<div id="params">
@@ -112,6 +115,13 @@
}
})
})
function showIndexDetailLayer(el, event) {
event.preventDefault();
Helper.showIndexDetailLayer({
indexCode: el.dataset.indexCode,
indexName: el.dataset.indexName
});
}
function openEditForm(r) {
if (r && r.ok) {
window.editLayer = layui.layer.open({
@@ -149,11 +159,21 @@
cssPath: '/admin/v1/static/css/cron.css'
});
layui.form.on('select(indexCodeFilter)', async function (obj) {
const paramsEl = document.getElementById('params');
const periodsEl = document.getElementById('periods');
paramsEl.textContent = periodsEl.textContent = '';
const paramsEl = document.getElementById('params'); // 参数选择控件
const periodsEl = document.getElementById('periods'); // 时间粒度选择控件
paramsEl.textContent = periodsEl.textContent = ''; // 清除参数和时间粒度选择控件
const dataset = obj.elem.querySelector(`[value="${obj.value}"]`).dataset;
const detailTriggerEl = document.getElementById('showIndexDetailLayer');
if (!dataset || !dataset.indInfo) {
// 未存在 dataset/.indInfo, 则去除可能存在的指标详情按钮
detailTriggerEl.style.display = 'none';
return;
}
detailTriggerEl.style.display = '';
detailTriggerEl.dataset.indexCode = obj.value;
detailTriggerEl.dataset.indexName = dataset.indName;
const indInfo =
JSON.parse(obj.elem.querySelector(`[value="${obj.value}"]`).dataset.indInfo);
JSON.parse(dataset.indInfo);
const paramTemplet = document.getElementById('paramTemplet');
const periodsTemplet = document.getElementById('periodsTemplet');
if (indInfo.indParam) {
@@ -211,6 +231,7 @@
option.textContent = `${key} ${jo.indIdNameConfig[key]}`;
option.selected = r.data.indexCode == key;
option.dataset.indInfo = JSON.stringify(indInfo);
option.dataset.indName = jo.indIdNameConfig[key];
optionsFragment.appendChild(option);
})