feat: 数据预测

This commit is contained in:
JiangSheng
2025-12-02 09:29:14 +08:00
parent 536daa1984
commit 3047525df7
3 changed files with 40 additions and 19 deletions

View File

@@ -20,6 +20,10 @@ const lang = {
'查看': 'View',
'审批类型': 'Approval Type',
'任务': 'Task',
'请输入': 'Please Enter ',
'请选择': 'Please Select ',
'操作成功': 'Operation Successful',
'操作失败': 'Operation Failed',
},
'菜单': {
'首页': 'Home',

View File

@@ -20,6 +20,10 @@ const lang = {
'查看': '查看',
'审批类型': '审批类型',
'任务': '任务',
'请输入': '请输入',
'请选择': '请选择',
'操作成功': '操作成功',
'操作失败': '操作失败',
},
'菜单': {
'首页': '首页',

View File

@@ -4,18 +4,14 @@
<div class="form">
<el-form>
<el-form-item :label="$t('数据预测.降阶模型')">
<el-select v-model="selectedModel" placeholder="请选择降阶模型" filterable @change="onModelChangeFun">
<el-select v-model="selectedModel" :placeholder="$t('通用.请选择')" filterable @change="onModelChangeFun">
<el-option v-for="item in modelOptions" :label="item.label" :value="item" :key="item.id" />
</el-select>
</el-form-item>
</el-form>
</div>
<div class="button">
<el-popover
class="box-item"
:title="selectedModel?.modelName"
:content="selectedModel?.description"
>
<el-popover class="box-item" :title="selectedModel?.modelName" :content="selectedModel?.description">
<template #reference>
<el-button>{{ $t('数据预测.功能说明') }}</el-button>
</template>
@@ -24,27 +20,41 @@
</div>
<div class="content" v-loading="forecastLoading">
<div class="left">
<BaseTable ref="inputTableRef" :tableName="TABLE_NAME.DATA_FORECAST_INPUT" showIndex :actionsWidth="200" hidePagination>
<BaseTable
ref="inputTableRef"
:tableName="TABLE_NAME.DATA_FORECAST_INPUT"
showIndex
hidePagination
>
<template #type>
{{ $t('数据预测.输入') }}
</template>
<template #value="{ row }">
<el-input-number
v-model="row.value"
placeholder="请输入内容"
/>
<el-input-number v-model="row.value" :placeholder="$t('通用.请输入')" class="full"/>
</template>
</BaseTable>
</div>
<div class="center">
<el-popconfirm :title="$t('数据预测.确定开始预测吗')" @confirm="beginForecastFun">
<el-popconfirm
:title="$t('数据预测.确定开始预测吗')"
@confirm="beginForecastFun"
:confirmButtonText="$t('通用.确定')"
:cancelButtonText="$t('通用.取消')"
>
<template #reference>
<el-button :disabled="selectedModel?.predStatus==='预测中'" type="primary" :loading="forecastLoading" >{{ $t('数据预测.开始预测') }}</el-button>
<el-button :disabled="selectedModel?.predStatus === '预测中'" type="primary" :loading="forecastLoading">
{{ $t('数据预测.开始预测') }}
</el-button>
</template>
</el-popconfirm>
</div>
<div class="right">
<BaseTable ref="outputTableRef" :tableName="TABLE_NAME.DATA_FORECAST_OUTPUT" showIndex :actionsWidth="200" hidePagination>
<BaseTable
ref="outputTableRef"
:tableName="TABLE_NAME.DATA_FORECAST_OUTPUT"
showIndex
hidePagination
>
<template #type>
{{ $t('数据预测.输出') }}
</template>
@@ -146,7 +156,7 @@ const getTitleMapFun = async () => {
if (Array.isArray(res.data?.source_title)) {
const titleMap: Record<string, string> = {};
res.data?.source_title.forEach((item: Record<string, string>) => {
Object.keys(item).forEach((key:string) => {
Object.keys(item).forEach((key: string) => {
titleMap[key] = item[key];
});
});
@@ -167,7 +177,7 @@ const clearResultFun = () => {
value: '',
};
});
const outputDataFormatted = outputData.map((item: any ) => {
const outputDataFormatted = outputData.map((item: any) => {
return {
...item,
value: '',
@@ -187,13 +197,13 @@ const getModelPredictResultFun = async () => {
const inputPredLabelValue = res.data?.inputPredLabelValue || [];
const forecastValue = res.data?.outputPredLabelValue;
const inputDataFormatted = inputData.map((item: any) => {
const inputValue = inputPredLabelValue.find((inputItem: any) => inputItem.name === item.name);
const inputValue = inputPredLabelValue.find((inputItem: any) => inputItem.name === item.name) || {};
return {
...item,
value: inputValue.value || '',
value: inputValue.value || null,
};
});
const outputDataFormatted = outputData.map((item: any ) => {
const outputDataFormatted = outputData.map((item: any) => {
return {
...item,
value: forecastValue ? forecastValue[item.name] : '',
@@ -251,4 +261,7 @@ onMounted(() => {
height: 100%;
}
}
.full {
width: 100%;
}
</style>