fix: 产品管理: 导出docx: 超公里: 只有旺季, 没有平季包价

perf/export-docx
Lei OT 10 months ago
parent eadab2fc05
commit b450af9c6d

@ -94,10 +94,16 @@ const chunkBy = (use_year, dataList = [], by = []) => {
return { ...rowp, quotation, };
});
// console.log('\ndataRollSS', dataRollSS);
// console.log('\n\n', dataList[0].info.product_type_id, dataRollSS);
// ,
const allQuotesSS = dataRollSS.reduce((acc, rowp) => acc.concat(rowp.quotation.filter(q => q.quote_season === 'SS')), []);
const allQuotesPS = dataRollSS.reduce((acc, rowp) => acc.concat(rowp.quotation.filter(q => q.quote_season === 'PS')), []);
const allQuotesSSS = isEmpty(allQuotesSS) ? allQuotesPS : allQuotesSS;
// console.log('allQuotesSSS', allQuotesSS, '\n', allQuotesPS, '\n', allQuotesSSS);
// const groupSizeSS = (allQuotesSS).reduce((aq, cq) => aq.concat([[cq.group_size_min, cq.group_size_max]]), []);
const PGroupSizeSS = (allQuotesSS).reduce((aq, cq) => {
const PGroupSizeSS = (allQuotesSSS).reduce((aq, cq) => {
aq[cq.WPI_SN] = aq[cq.WPI_SN] || [];
aq[cq.WPI_SN].push(cq.group_size_min);
aq[cq.WPI_SN] = unique(aq[cq.WPI_SN]);
@ -140,14 +146,21 @@ const chunkBy = (use_year, dataList = [], by = []) => {
return acc;
}, []);
const _quotation = rowp.quotation.map((quoteItem) => {
const ssSets = structuredClone(thisRange).reverse();
const ssSets = isEmpty(thisRange) ? SSsizeSets[0] : structuredClone(thisRange).reverse();
// if (isEmpty(ssSets)) {
// console.group('quotation item');
// console.log(rowp.info.id, rowp.info.product_title, rowp);
// console.log(ssSets);
// console.log([quoteItem.group_size_min, quoteItem.group_size_max]);
// console.groupEnd();
// }
// console.group('quotation item');
// console.log(ssSets);
// console.log([quoteItem.group_size_min, quoteItem.group_size_max]);
const matchRange = (ssSets).find((ss) => quoteItem.group_size_min >= ss[0] && quoteItem.group_size_max <= ss[1]);
const findEnd = matchRange || ssSets.find((ss) => quoteItem.group_size_max > ss[0] && quoteItem.group_size_max <= ss[1] && ss[1] !== Infinity);
const findStart = findEnd || ssSets.find((ss) => quoteItem.group_size_min >= ss[0]);
const finalRange = findStart || SSsizeSets[0][0]; // todo:
const finalRange = findStart;
// console.log('find mmm', matchRange, findEnd, findStart, finalRange);
// console.log('matchRange ', 'find', [quoteItem.group_size_min, quoteItem.group_size_max], 'matched', finalRange);
// console.groupEnd();
@ -437,6 +450,7 @@ export default class AgencyContract {
* 超公里
*/
createTable_B(use_year, dataList) {
// console.log('*********************************************************************************************');
const { chunk, sizeSets, SSRange, PSRange } = chunkBy(use_year, dataList, ['quote_size']);
const infoCol = (rowp) =>
new TableCell({

Loading…
Cancel
Save