chore: 编译类型错误

This commit is contained in:
TsMask
2025-02-20 19:24:06 +08:00
parent f60e530636
commit bae61108be
3 changed files with 109 additions and 36 deletions

View File

@@ -1084,7 +1084,7 @@ onBeforeUnmount(() => {
:scroll="{ y: 250 }" :scroll="{ y: 250 }"
size="small" size="small"
:custom-row=" :custom-row="
record => ({ (record:any) => ({
onClick: () => handleRowClick(record), onClick: () => handleRowClick(record),
class: selectedRow.includes(record.kpiId) ? 'selected-row' : '', class: selectedRow.includes(record.kpiId) ? 'selected-row' : '',
}) })

View File

@@ -757,7 +757,7 @@ const selectedUnit = ref<string | null>(null);
// 添加处理行点击的方法 // 添加处理行点击的方法
function handleRowClick(record: any) { function handleRowClick(record: any) {
const index = selectedRow.value.indexOf(record.kpiId); const index = selectedRow.value.indexOf(record.kpiId);
console.log(record) console.log(record);
// 如果已经选中,取消选中 // 如果已经选中,取消选中
if (index > -1) { if (index > -1) {
selectedRow.value.splice(index, 1); selectedRow.value.splice(index, 1);
@@ -766,12 +766,12 @@ function handleRowClick(record: any) {
if (selectedRow.value.length === 0) { if (selectedRow.value.length === 0) {
selectedUnit.value = null; selectedUnit.value = null;
} }
} else { } else {
// 检查单位是否一致 // 检查单位是否一致
if (selectedUnit.value && selectedUnit.value !== record.unit) { if (selectedUnit.value && selectedUnit.value !== record.unit) {
message.error(`${t('views.perfManage.customTarget.unitSelect')} ${selectedUnit.value}`); message.error(
`${t('views.perfManage.customTarget.unitSelect')} ${selectedUnit.value}`
);
return; return;
} }
@@ -940,28 +940,50 @@ onBeforeUnmount(() => {
<template> <template>
<PageContainer> <PageContainer>
<a-card v-show="tableState.seached" :bordered="false" :body-style="{ marginBottom: '24px', paddingBottom: 0 }"> <a-card
v-show="tableState.seached"
:bordered="false"
:body-style="{ marginBottom: '24px', paddingBottom: 0 }"
>
<!-- 表格搜索栏 --> <!-- 表格搜索栏 -->
<a-form :model="queryParams" name="queryParamsFrom" layout="horizontal"> <a-form :model="queryParams" name="queryParamsFrom" layout="horizontal">
<a-row :gutter="16"> <a-row :gutter="16">
<a-col :lg="6" :md="12" :xs="24"> <a-col :lg="6" :md="12" :xs="24">
<a-form-item name="neType" :label="t('views.ne.common.neType')"> <a-form-item name="neType" :label="t('views.ne.common.neType')">
<a-cascader v-model:value="state.neType" :options="neCascaderOptions" :allow-clear="false" <a-cascader
:placeholder="t('common.selectPlease')" /> v-model:value="state.neType"
:options="neCascaderOptions"
:allow-clear="false"
:placeholder="t('common.selectPlease')"
/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="10" :md="12" :xs="24"> <a-col :lg="10" :md="12" :xs="24">
<a-form-item :label="t('views.perfManage.goldTarget.timeFrame')" name="timeFrame"> <a-form-item
<a-range-picker v-model:value="queryRangePicker" bordered :allow-clear="false" :label="t('views.perfManage.goldTarget.timeFrame')"
:show-time="{ format: 'HH:mm:ss' }" format="YYYY-MM-DD HH:mm:ss" value-format="x" :presets="ranges" name="timeFrame"
style="width: 100%"></a-range-picker> >
<a-range-picker
v-model:value="queryRangePicker"
bordered
:allow-clear="false"
:show-time="{ format: 'HH:mm:ss' }"
format="YYYY-MM-DD HH:mm:ss"
value-format="x"
:presets="ranges"
style="width: 100%"
></a-range-picker>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="2" :md="12" :xs="24"> <a-col :lg="2" :md="12" :xs="24">
<a-form-item> <a-form-item>
<a-space :size="8"> <a-space :size="8">
<a-button type="primary" :loading="tableState.loading" @click.prevent="fnGetListTitle()"> <a-button
type="primary"
:loading="tableState.loading"
@click.prevent="fnGetListTitle()"
>
<template #icon> <template #icon>
<SearchOutlined /> <SearchOutlined />
</template> </template>
@@ -978,7 +1000,11 @@ onBeforeUnmount(() => {
<!-- 插槽-卡片左侧侧 --> <!-- 插槽-卡片左侧侧 -->
<template #title> <template #title>
<a-space :size="8" align="center"> <a-space :size="8" align="center">
<a-button type="primary" :loading="tableState.loading" @click.prevent="fnChangShowType()"> <a-button
type="primary"
:loading="tableState.loading"
@click.prevent="fnChangShowType()"
>
<template #icon> <template #icon>
<AreaChartOutlined /> <AreaChartOutlined />
</template> </template>
@@ -988,8 +1014,12 @@ onBeforeUnmount(() => {
: t('views.perfManage.goldTarget.kpiTableTitle') : t('views.perfManage.goldTarget.kpiTableTitle')
}} }}
</a-button> </a-button>
<a-button type="dashed" :loading="tableState.loading" @click.prevent="fnRecordExport()" <a-button
v-show="tableState.showTable"> type="dashed"
:loading="tableState.loading"
@click.prevent="fnRecordExport()"
v-show="tableState.showTable"
>
<template #icon> <template #icon>
<ExportOutlined /> <ExportOutlined />
</template> </template>
@@ -1009,8 +1039,12 @@ onBeforeUnmount(() => {
</template> </template>
</a-button> </a-button>
</a-tooltip> </a-tooltip>
<TableColumnsDnd v-if="tableColumns.length > 0" :cache-id="`kpiTarget_${state.neType[0]}`" <TableColumnsDnd
:columns="tableColumns" v-model:columns-dnd="tableColumnsDnd"></TableColumnsDnd> v-if="tableColumns.length > 0"
:cache-id="`kpiTarget_${state.neType[0]}`"
:columns="tableColumns"
v-model:columns-dnd="tableColumnsDnd"
></TableColumnsDnd>
<a-tooltip> <a-tooltip>
<template #title>{{ t('common.sizeText') }}</template> <template #title>{{ t('common.sizeText') }}</template>
<a-dropdown trigger="click" placement="bottomRight"> <a-dropdown trigger="click" placement="bottomRight">
@@ -1020,7 +1054,10 @@ onBeforeUnmount(() => {
</template> </template>
</a-button> </a-button>
<template #overlay> <template #overlay>
<a-menu :selected-keys="[tableState.size as string]" @click="fnTableSize"> <a-menu
:selected-keys="[tableState.size as string]"
@click="fnTableSize"
>
<a-menu-item key="default"> <a-menu-item key="default">
{{ t('common.size.default') }} {{ t('common.size.default') }}
</a-menu-item> </a-menu-item>
@@ -1049,32 +1086,60 @@ onBeforeUnmount(() => {
size="small" size="small"
/> />
</a-form-item> --> </a-form-item> -->
<a-form-item :label="t('views.perfManage.goldTarget.realTimeData')" name="chartRealTime"> <a-form-item
<a-switch :disabled="tableState.loading" v-model:checked="state.chartRealTime" :label="t('views.perfManage.goldTarget.realTimeData')"
:checked-children="t('common.switch.open')" :un-checked-children="t('common.switch.shut')" name="chartRealTime"
@change="fnRealTimeSwitch" size="small" /> >
<a-switch
:disabled="tableState.loading"
v-model:checked="state.chartRealTime"
:checked-children="t('common.switch.open')"
:un-checked-children="t('common.switch.shut')"
@change="fnRealTimeSwitch"
size="small"
/>
</a-form-item> </a-form-item>
</a-form> </a-form>
</template> </template>
<!-- 表格列表 --> <!-- 表格列表 -->
<a-table v-show="tableState.showTable" class="table" row-key="id" :columns="tableColumnsDnd" <a-table
:loading="tableState.loading" :data-source="tableState.data" :size="tableState.size" v-show="tableState.showTable"
:pagination="tablePagination" :scroll="{ x: tableColumnsDnd.length * 200, y: 'calc(100vh - 480px)' }" class="table"
@resizeColumn="(w: number, col: any) => (col.width = w)" :show-expand-column="false" @change="fnTableChange"> row-key="id"
:columns="tableColumnsDnd"
:loading="tableState.loading"
:data-source="tableState.data"
:size="tableState.size"
:pagination="tablePagination"
:scroll="{ x: tableColumnsDnd.length * 200, y: 'calc(100vh - 480px)' }"
@resizeColumn="(w: number, col: any) => (col.width = w)"
:show-expand-column="false"
@change="fnTableChange"
>
</a-table> </a-table>
<!-- 图表 --> <!-- 图表 -->
<div style="padding: 24px" v-show="!tableState.showTable"> <div style="padding: 24px" v-show="!tableState.showTable">
<div ref="kpiChartDom" class="chart-container" style="height: 450px; width: 100%"></div> <div
ref="kpiChartDom"
class="chart-container"
style="height: 450px; width: 100%"
></div>
<div class="table-container"> <div class="table-container">
<a-table :columns="statsColumns" :data-source="kpiStats" :pagination="false" :scroll="{ y: 250 }" size="small" <a-table
:custom-row="record => ({ :columns="statsColumns"
:data-source="kpiStats"
:pagination="false"
:scroll="{ y: 250 }"
size="small"
:custom-row="(record:any) => ({
onClick: () => handleRowClick(record), onClick: () => handleRowClick(record),
class: selectedRow.includes(record.kpiId) ? 'selected-row' : '', class: selectedRow.includes(record.kpiId) ? 'selected-row' : '',
}) })
"> "
>
<template #headerCell="{ column }"> <template #headerCell="{ column }">
<template v-if="column.key === 'total'"> <template v-if="column.key === 'total'">
<span> <span>

View File

@@ -1333,7 +1333,7 @@ const handleTabChange = async (activeKey: string, type: AllChartType) => {
:scroll="{ y: 'true' }" :scroll="{ y: 'true' }"
:loading="chartStates[type].tableState.loading" :loading="chartStates[type].tableState.loading"
:custom-row=" :custom-row="
record => ({ (record:any) => ({
onClick: () => handleRowClick(record, type), onClick: () => handleRowClick(record, type),
class: selectedRows[type]?.includes(record.kpiId) class: selectedRows[type]?.includes(record.kpiId)
? 'selected-row' ? 'selected-row'
@@ -1348,7 +1348,9 @@ const handleTabChange = async (activeKey: string, type: AllChartType) => {
<a-tooltip placement="bottom"> <a-tooltip placement="bottom">
<template #title> <template #title>
<span> <span>
{{ t('views.perfManage.kpiOverView.totalValueTip') }} {{
t('views.perfManage.kpiOverView.totalValueTip')
}}
</span> </span>
</template> </template>
<InfoCircleOutlined /> <InfoCircleOutlined />
@@ -1361,7 +1363,9 @@ const handleTabChange = async (activeKey: string, type: AllChartType) => {
<a-tooltip placement="bottom"> <a-tooltip placement="bottom">
<template #title> <template #title>
<span> <span>
{{ t('views.perfManage.kpiOverView.avgValueTip') }} {{
t('views.perfManage.kpiOverView.avgValueTip')
}}
</span> </span>
</template> </template>
<InfoCircleOutlined /> <InfoCircleOutlined />
@@ -1374,7 +1378,9 @@ const handleTabChange = async (activeKey: string, type: AllChartType) => {
<a-tooltip placement="bottom"> <a-tooltip placement="bottom">
<template #title> <template #title>
<span> <span>
{{ t('views.perfManage.kpiOverView.maxValueTip') }} {{
t('views.perfManage.kpiOverView.maxValueTip')
}}
</span> </span>
</template> </template>
<InfoCircleOutlined /> <InfoCircleOutlined />
@@ -1387,7 +1393,9 @@ const handleTabChange = async (activeKey: string, type: AllChartType) => {
<a-tooltip placement="bottom"> <a-tooltip placement="bottom">
<template #title> <template #title>
<span> <span>
{{ t('views.perfManage.kpiOverView.minValueTip') }} {{
t('views.perfManage.kpiOverView.minValueTip')
}}
</span> </span>
</template> </template>
<InfoCircleOutlined /> <InfoCircleOutlined />