限制必填搜索项必填,补充KPI国际化

This commit is contained in:
猫猫guowen
2025-08-18 16:23:48 +08:00
parent e2789f1d80
commit 0e9da3259f
9 changed files with 135 additions and 29 deletions

View File

@@ -1,8 +1,8 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true">
<el-form-item label="仓库" prop="warehouseId">
<el-select v-model="queryParams.warehouseId" placeholder="请选择仓库" clearable>
<el-form-item :label="$t('inAnalysis.warehouse')" prop="warehouseId"> <!-- 仓库 -->
<el-select v-model="queryParams.warehouseId" :placeholder="$t('inAnalysis.selectWarehouse')" clearable> <!-- 请选择仓库 -->
<el-option
v-for="item in warehouseOptions"
:key="item.warehouseId"
@@ -11,19 +11,19 @@
/>
</el-select>
</el-form-item>
<el-form-item label="时间范围" prop="dateRange">
<el-form-item :label="$t('inAnalysis.timeRange')" prop="dateRange"> <!-- 时间范围 -->
<el-date-picker
v-model="dateRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:start-placeholder="$t('inAnalysis.startDate')"
:end-placeholder="$t('inAnalysis.endDate')"
value-format="yyyy-MM-dd"
@change="handleDateRangeChange"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">{{$t('inAnalysis.query')}}</el-button> <!-- 查询 -->
</el-form-item>
</el-form>
@@ -87,7 +87,7 @@ export default {
const response = await listWarehouse(this.queryWarehouseParam)
this.warehouseOptions = response.rows
} catch (error) {
console.error('获取仓库列表失败:', error)
console.error(this.$t('inAnalysis.getWarehouseListFailed'), error) // 获取仓库列表失败
}
},
/** 设置最近七天时间范围 */
@@ -115,7 +115,7 @@ export default {
updateChart() {
const option = {
title: {
text: '入库数量统计'
text: this.$t('inAnalysis.inboundQuantityStatistics') // 入库数量统计
},
tooltip: {
trigger: 'axis'
@@ -126,10 +126,10 @@ export default {
},
yAxis: {
type: 'value',
name: '入库数量'
name: this.$t('inAnalysis.inboundQuantity') // 入库数量
},
series: [{
name: '入库数量',
name: this.$t('inAnalysis.inboundQuantity'), // 入库数量
type: 'line',
data: this.chartData.series,
smooth: true
@@ -149,6 +149,12 @@ export default {
},
/** 处理查询按钮点击 */
async handleQuery() {
// 验证时间范围是否为空
if (!this.dateRange || this.dateRange.length === 0 || !this.dateRange[0] || !this.dateRange[1]) {
this.$message.warning(this.$t('inAnalysis.selectTimeRange')) // 请选择时间范围
return
}
try {
const response = await getInAnalysisData(this.queryParams)
if (response.code === 200) {
@@ -159,8 +165,8 @@ export default {
this.$message.error(response.msg)
}
} catch (error) {
console.error('获取统计数据失败:', error)
this.$message.error('获取统计数据失败')
console.error(this.$t('inAnalysis.getStatisticsDataFailed'), error) // 获取统计数据失败
this.$message.error(this.$t('inAnalysis.getStatisticsDataFailed')) // 获取统计数据失败
}
},