* Add metric query error check,bug#38790.

This commit is contained in:
qixinzhi
2023-09-20 07:52:09 +00:00
parent dcfb555c6a
commit 625facf613
3 changed files with 42 additions and 13 deletions
+25
View File
@@ -120,6 +120,8 @@ window.handleNavMenuClick = function($el)
window.handleQueryClick = function()
{
var check = window.checkForm($('#queryForm'));
if(!check) return;
window.ajaxGetRecords(current.id);
}
@@ -609,6 +611,29 @@ window.ajaxGetRecords = function(id)
});
}
window.checkForm = function($form)
{
var formSerialize = $form.serialize();
var formObj = window.parseSerialize(formSerialize);
var dateBegin = formObj.dateBegin?.length ? new Date(formObj.dateBegin) : false;
var dateEnd = formObj.dateEnd?.length ? new Date(formObj.dateEnd) : false;
var calcBegin = formObj.calcBegin?.length ? new Date(formObj.calcBegin) : false;
var calcEnd = formObj.calcEnd?.length ? new Date(formObj.calcEnd) : false;
if(dateBegin && dateEnd && dateBegin > dateEnd)
{
zui.Messager.show(errorDateRange, {type: 'danger', time: 2000});
return false;
}
if(calcBegin && calcEnd && calcBegin > calcEnd)
{
zui.Messager.show(errorCalcTimeRange, {type: 'danger', time: 2000});
return false;
}
return true;
}
window.getFormData = function($form)
{
var formSerialize = $form.serialize();
+2
View File
@@ -64,6 +64,8 @@ $lang->metric->maxSelectTip = '可跨范围勾选多个度量项,最多
$lang->metric->upgradeTip = '此度量项为旧版本支持的度量项,若想进行编辑,请根据新版本度量项的配置规则进行重新配置。同时请注意,新版本度量项不再支持SQL编辑器,暂时无法被报表模板引用。请确认是否需要进行编辑操作。';
$lang->metric->saveSqlMeasSuccess = "查询成功,测试结果:%s";
$lang->metric->monthText = "%s号";
$lang->metric->errorDateRange = "开始日期不能大于结束日期";
$lang->metric->errorCalcTimeRange = "采集开始时间不能大于采集结束时间";
$lang->metric->noDesc = "暂无描述";
$lang->metric->noFormula = "暂无计算规则";
+15 -13
View File
@@ -10,19 +10,21 @@ declare(strict_types=1);
*/
namespace zin;
jsVar('resultHeader', isset($resultHeader) ? $resultHeader : array());
jsVar('resultData', isset($resultData) ? $resultData : array());
jsVar('objectList', $lang->metric->objectList);
jsVar('current', $current);
jsVar('maxSelectNum', $config->metric->maxSelectNum);
jsVar('maxSelectMsg', $lang->metric->maxSelect);
jsVar('maxSelectTip', $lang->metric->maxSelectTip);
jsVar('viewType', $viewType);
jsVar('selectCount', $lang->metric->selectCount);
jsVar('filterLang', $lang->metric->filter);
jsVar('scope', $scope);
jsVar('metricListLang', $metricList);
jsVar('chartTypeList', $lang->metric->chartTypeList);
jsVar('resultHeader', isset($resultHeader) ? $resultHeader : array());
jsVar('resultData', isset($resultData) ? $resultData : array());
jsVar('objectList', $lang->metric->objectList);
jsVar('current', $current);
jsVar('maxSelectNum', $config->metric->maxSelectNum);
jsVar('maxSelectMsg', $lang->metric->maxSelect);
jsVar('maxSelectTip', $lang->metric->maxSelectTip);
jsVar('viewType', $viewType);
jsVar('selectCount', $lang->metric->selectCount);
jsVar('filterLang', $lang->metric->filter);
jsVar('scope', $scope);
jsVar('metricListLang', $metricList);
jsVar('chartTypeList', $lang->metric->chartTypeList);
jsVar('errorDateRange', $lang->metric->errorDateRange);
jsVar('errorCalcTimeRange', $lang->metric->errorCalcTimeRange);
if($scope == 'collect' and empty($current))
{