|
@@ -2,12 +2,12 @@
|
|
|
|
|
|
/**
|
|
|
* @typedef {import('@/api/forecast/types').ForecastSummaryQueryParams} ForecastSummaryQueryParams
|
|
|
- * @typedef {import('@/api/forecast/types').ForecastSummaryRecord} ForecastSummaryRecord
|
|
|
+ * @typedef {import('@/api/forecast/types').SalesForecastMainListItemRecord} SalesForecastMainListItemRecord
|
|
|
* @typedef {import('./types').PageConfig} PageConfig
|
|
|
* @typedef {import('./types').ForecastSummaryComponent} ForecastSummaryComponent
|
|
|
*/
|
|
|
|
|
|
-import { getForecastSummaryList, getForecastSummaryDetail } from '@/api/forecast/forecast-summary'
|
|
|
+import { getSalesForecastMainList, getForecastSummaryDetail } from '@/api/forecast/forecast-summary'
|
|
|
import {
|
|
|
APPROVAL_STATUS,
|
|
|
APPROVAL_STATUS_CONFIG,
|
|
@@ -60,13 +60,13 @@ export default {
|
|
|
|
|
|
/**
|
|
|
* 表格数据
|
|
|
- * @type {Array<ForecastSummaryRecord>}
|
|
|
+ * @type {Array<SalesForecastMainListItemRecord>}
|
|
|
*/
|
|
|
data: [],
|
|
|
|
|
|
/**
|
|
|
* 选中的行数据
|
|
|
- * @type {Array<ForecastSummaryRecord>}
|
|
|
+ * @type {Array<SalesForecastMainListItemRecord>}
|
|
|
*/
|
|
|
selectionList: [],
|
|
|
|
|
@@ -351,7 +351,7 @@ export default {
|
|
|
/**
|
|
|
* 选择变化处理
|
|
|
* @this {ForecastSummaryComponent & Vue}
|
|
|
- * @param {Array<ForecastSummaryRecord>} selection - 选中的行数据
|
|
|
+ * @param {Array<SalesForecastMainListItemRecord>} selection - 选中的行数据
|
|
|
*/
|
|
|
selectionChange(selection) {
|
|
|
this.selectionList = selection
|
|
@@ -403,30 +403,44 @@ export default {
|
|
|
async onLoad(page, params = {}) {
|
|
|
this.loading = true
|
|
|
try {
|
|
|
- const queryParams = {
|
|
|
- ...this.query,
|
|
|
- ...params
|
|
|
+ // 仅挑选 main-list 支持的查询参数,避免无效字段影响
|
|
|
+ const merged = { ...this.query, ...params }
|
|
|
+ const safeParams = {
|
|
|
+ year: merged.year,
|
|
|
+ month: merged.month,
|
|
|
+ customerName: merged.customerName
|
|
|
}
|
|
|
|
|
|
- const response = await getForecastSummaryList(
|
|
|
+ const response = await getSalesForecastMainList(
|
|
|
page.currentPage || 1,
|
|
|
page.pageSize || 10,
|
|
|
- queryParams
|
|
|
+ safeParams
|
|
|
)
|
|
|
|
|
|
- if (response && response.data && response.data.code === 200) {
|
|
|
- const { records, total, current, size } = response.data.data
|
|
|
- this.data = records || []
|
|
|
- this.page.total = total || 0
|
|
|
- this.page.currentPage = current || 1
|
|
|
- this.page.pageSize = size || 10
|
|
|
+ if (response && response.data && response.data.code === 200 && response.data.data) {
|
|
|
+ const pageData = response.data.data
|
|
|
+ const records = Array.isArray(pageData.records) ? pageData.records : []
|
|
|
+ // 扁平化子列表供表格展示(保持ID为后端返回的原样,避免大整数精度丢失)
|
|
|
+ const flat = []
|
|
|
+ for (const rec of records) {
|
|
|
+ const list = Array.isArray(rec.pcBladeSalesForecastSummaryList) ? rec.pcBladeSalesForecastSummaryList : []
|
|
|
+ for (const item of list) {
|
|
|
+ // 通过浅拷贝确保不会意外修改原对象
|
|
|
+ flat.push({ ...item })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.data = flat
|
|
|
+ this.page.total = Number(pageData.total) || 0
|
|
|
+ this.page.currentPage = Number(pageData.current) || 1
|
|
|
+ this.page.pageSize = Number(pageData.size) || 10
|
|
|
} else {
|
|
|
this.$message.error(response?.data?.message || '获取数据失败')
|
|
|
this.data = []
|
|
|
this.page.total = 0
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- console.error('获取预测汇总列表失败:', error)
|
|
|
+ console.error('获取预测主表分页列表失败:', error)
|
|
|
this.$message.error('获取数据失败,请稍后重试')
|
|
|
this.data = []
|
|
|
this.page.total = 0
|
|
@@ -439,7 +453,7 @@ export default {
|
|
|
* 获取预测汇总详情
|
|
|
* @this {ForecastSummaryComponent & Vue}
|
|
|
* @param {string|number} id - 预测汇总ID
|
|
|
- * @returns {Promise<ForecastSummaryRecord|null>} 详情数据
|
|
|
+ * @returns {Promise<import('@/api/forecast/types').ForecastSummaryRecord|null>} 详情数据
|
|
|
*/
|
|
|
async getForecastSummaryDetail(id) {
|
|
|
try {
|