|
|
@@ -7,7 +7,7 @@
|
|
|
* @typedef {import('./types').ForecastSummaryComponent} ForecastSummaryComponent
|
|
|
*/
|
|
|
|
|
|
-import { getSalesForecastMainList, getForecastSummaryDetail, exportSalesForecastTemplate, exportSalesForecastByMonth, exportSalesForecastByMainId } from '@/api/forecast/forecast-summary'
|
|
|
+import { getSalesForecastMainPage, getForecastSummaryDetail, exportSalesForecastTemplate, exportSalesForecastByMonth, exportSalesForecastByMainId } from '@/api/forecast/forecast-summary'
|
|
|
import {
|
|
|
APPROVAL_STATUS,
|
|
|
APPROVAL_STATUS_CONFIG,
|
|
|
@@ -516,11 +516,11 @@ import { mapGetters } from 'vuex'
|
|
|
customerName: merged.customerName
|
|
|
}
|
|
|
|
|
|
- const response = await getSalesForecastMainList(
|
|
|
- page.currentPage || 1,
|
|
|
- page.pageSize || 10,
|
|
|
- safeParams
|
|
|
- )
|
|
|
+ const response = await getSalesForecastMainPage(
|
|
|
+ page.currentPage || 1,
|
|
|
+ page.pageSize || 10,
|
|
|
+ safeParams
|
|
|
+ )
|
|
|
|
|
|
if (response && response.data && response.data.code === 200 && response.data.data) {
|
|
|
const pageData = response.data.data
|
|
|
@@ -528,20 +528,21 @@ import { mapGetters } from 'vuex'
|
|
|
// 字段类型转换与BigInt处理
|
|
|
this.data = records.map(r => {
|
|
|
const children = Array.isArray(r.pcBladeSalesForecastSummaryList)
|
|
|
- ? r.pcBladeSalesForecastSummaryList.map(it => ({
|
|
|
- ...it,
|
|
|
- idBigint: this.safeBigInt(it.id),
|
|
|
- forecastMainIdBigint: it.forecastMainId != null ? this.safeBigInt(it.forecastMainId) : null,
|
|
|
- year: Number(it.year),
|
|
|
- month: Number(it.month),
|
|
|
- forecastQuantity: typeof it.forecastQuantity === 'string' ? Number(it.forecastQuantity) : Number(it.forecastQuantity),
|
|
|
- // 继承主表字段,确保子表数据完整性
|
|
|
- customerName: it.customerName != null ? it.customerName : r.customerName,
|
|
|
- approvalStatus: it.approvalStatus != null ? it.approvalStatus : r.approvalStatus,
|
|
|
- approvedName: it.approvedName != null ? it.approvedName : r.approvedName,
|
|
|
- approvedTime: it.approvedTime != null ? it.approvedTime : r.approvedTime
|
|
|
- }))
|
|
|
- : []
|
|
|
+ ? r.pcBladeSalesForecastSummaryList.map(it => ({
|
|
|
+ ...it,
|
|
|
+ idBigint: this.safeBigInt(it.id),
|
|
|
+ forecastMainIdBigint: it.forecastMainId != null ? this.safeBigInt(it.forecastMainId) : null,
|
|
|
+ year: Number(it.year),
|
|
|
+ month: Number(it.month),
|
|
|
+ forecastQuantity: typeof it.forecastQuantity === 'string' ? Number(it.forecastQuantity) : Number(it.forecastQuantity),
|
|
|
+ // 继承主表字段,确保子表数据完整性
|
|
|
+ customerName: it.customerName != null ? it.customerName : r.customerName,
|
|
|
+ approvalStatus: it.approvalStatus != null ? it.approvalStatus : r.approvalStatus,
|
|
|
+ approvedName: it.approvedName != null ? it.approvedName : r.approvedName,
|
|
|
+ approvedTime: it.approvedTime != null ? it.approvedTime : r.approvedTime
|
|
|
+ }))
|
|
|
+ : []
|
|
|
+
|
|
|
return {
|
|
|
...r,
|
|
|
idBigint: this.safeBigInt(r.id),
|
|
|
@@ -550,35 +551,36 @@ import { mapGetters } from 'vuex'
|
|
|
pcBladeSalesForecastSummaryList: children
|
|
|
}
|
|
|
})
|
|
|
- this.page.total = Number(pageData.total) || 0
|
|
|
- this.page.currentPage = Number(pageData.current) || 1
|
|
|
- this.page.pageSize = Number(pageData.size) || 10
|
|
|
- } else {
|
|
|
- this.data = []
|
|
|
- this.page.total = 0
|
|
|
+
|
|
|
+ this.page.total = Number(pageData.total || 0)
|
|
|
+ this.page.pageSize = Number(pageData.size || page.pageSize)
|
|
|
+ this.page.currentPage = Number(pageData.current || page.currentPage)
|
|
|
}
|
|
|
} catch (e) {
|
|
|
- console.error('加载销售预测汇总数据失败:', e)
|
|
|
- this.$message.error('加载失败,请稍后重试')
|
|
|
+ console.error('加载列表失败:', e)
|
|
|
} finally {
|
|
|
this.loading = false
|
|
|
}
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
- * BigInt 安全转换(兼容 stringify)
|
|
|
- * @param {string|number|bigint|null|undefined} v
|
|
|
- * @returns {string|null}
|
|
|
- */
|
|
|
- safeBigInt(v) {
|
|
|
- try {
|
|
|
- if (v === null || v === undefined) return null
|
|
|
- const n = BigInt(v)
|
|
|
- return n.toString()
|
|
|
- } catch (e) {
|
|
|
- return v != null ? String(v) : null
|
|
|
- }
|
|
|
- },
|
|
|
+ * BigInt 安全转换(兼容 stringify)
|
|
|
+ * @param {string|number|bigint|null|undefined} v
|
|
|
+ * @returns {string|null}
|
|
|
+ */
|
|
|
+ safeBigInt(v) {
|
|
|
+ try {
|
|
|
+ if (v === null || v === undefined) return '0'
|
|
|
+ // 兼容旧浏览器/运行环境无 BigInt 的情况
|
|
|
+ if (typeof BigInt === 'function') {
|
|
|
+ const n = BigInt(v)
|
|
|
+ return n.toString()
|
|
|
+ }
|
|
|
+ return String(v)
|
|
|
+ } catch (e) {
|
|
|
+ return v != null ? String(v) : null
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
/**
|
|
|
* 查询主表对应的子表明细
|