diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index 4321d68d..b4b23ead 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -964,6 +964,7 @@ export default { expressionModal:'Expression Modal', expressionErrorTip:'Please check the expression, the wrong indicator is {kpiId}', expressionNoIdTip:'Please check the expression, no valid indicator is found', + unitSelect:'To better display the image, the same unit needs to be selected. The current unit is:', }, kpiKeyTarget:{ "time":"Time", diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index 52c157d6..ff567ebd 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -964,6 +964,7 @@ export default { expressionModal:'表达式模块', expressionErrorTip:'请检查表达式,错误的指标为{kpiId}', expressionNoIdTip:'请检查表达式,没有找到任何有效的指标', + unitSelect:'为更好展示图需选择相同单位,当前单位为:', }, kpiKeyTarget:{ "time":"时间", diff --git a/src/views/perfManage/kpiCReport/index.vue b/src/views/perfManage/kpiCReport/index.vue index 7a321384..f53e45f3 100644 --- a/src/views/perfManage/kpiCReport/index.vue +++ b/src/views/perfManage/kpiCReport/index.vue @@ -242,6 +242,13 @@ const statsColumns: TableColumnType[] = [ key: 'title', width: '65%', }, + { + title: t('views.perfManage.kpiOverView.totalValue'), + dataIndex: 'total', + key: 'total', + width: '12%', + sortDirections: ['ascend', 'descend'], + }, { title: t('views.perfManage.kpiOverView.avgValue'), dataIndex: 'avg', @@ -356,6 +363,7 @@ function fnGetListTitle() { dataIndex: kpiValue, align: 'left', key: kpiValue, + unit: item[`unit`], resizable: true, width: 100, minWidth: 150, @@ -448,16 +456,17 @@ function fnGetList() { const total = Number( values.reduce((sum, val) => sum + val, 0).toFixed(2) ); - // 计算平均值 const avg = values.length > 0 ? Number((total / values.length).toFixed(2)) : 0; kpiStats.value.push({ kpiId: columns.key, title: columns.title, + unit: columns.unit, max: values.length > 0 ? Math.max(...values) : 0, min: values.length > 0 ? Math.min(...values) : 0, avg, + total: total, }); } } @@ -606,7 +615,7 @@ function fnRanderChartData() { for (const item of orgData) { const keys = Object.keys(item); - //console.log(keys,item);// + //console.log(keys,item); for (const y of chartDataYSeriesData) { for (const key of keys) { if (y.key === key) { @@ -744,25 +753,42 @@ function wsMessage(res: Record) { // 添加一个变量来跟踪当前选中的行 const selectedRow = ref([]); +const selectedUnit = ref(null); // 添加处理行点击的方法 function handleRowClick(record: any) { const index = selectedRow.value.indexOf(record.kpiId); - + console.log(record) // 如果已经选中,取消选中 if (index > -1) { selectedRow.value.splice(index, 1); chartLegendSelected[record.title] = false; + // 如果取消选中的是最后一个,重置 selectedUnit + if (selectedRow.value.length === 0) { + selectedUnit.value = null; + } + } else { + + // 检查单位是否一致 + if (selectedUnit.value && selectedUnit.value !== record.unit) { + message.error(`${t('views.perfManage.customTarget.unitSelect')} ${selectedUnit.value}`); + return; + } + // 添加新的选中项 selectedRow.value.push(record.kpiId); + // 设置选中的单位 + if (!selectedUnit.value) { + selectedUnit.value = record.unit; + } + // 如果只有一个选中项,重置为 false if (selectedRow.value.length === 1) { Object.keys(chartLegendSelected).forEach(key => { chartLegendSelected[key] = false; }); } - chartLegendSelected[record.title] = true; } @@ -914,50 +940,28 @@ onBeforeUnmount(() => { - +
-
+
- + +
diff --git a/src/views/system/dict/data.vue b/src/views/system/dict/data.vue index d904fefe..9a5a17c3 100644 --- a/src/views/system/dict/data.vue +++ b/src/views/system/dict/data.vue @@ -131,6 +131,9 @@ type TabeStateType = { selectedRowKeys: (string | number)[]; }; +//是否显示type框 +const drawerVisible = ref(true); + /**表格状态 */ let tableState: TabeStateType = reactive({ loading: false, @@ -502,9 +505,11 @@ onMounted(() => { message.error(t('views.system.dictData.typeDataErr'), 3); } }); + drawerVisible.value = true; } else { // 获取列表数据 fnGetList(); + drawerVisible.value = false; } }); @@ -881,7 +886,7 @@ onMounted(() => { default-value="sys_oper_type" :placeholder="t('common.selectPlease')" :options="dict.sysDictType" - :disabled="true" + :disabled="drawerVisible" >