From b450af9c6d0045f9610a706a76bddc80a36e5a29 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Mon, 2 Sep 2024 15:28:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BA=A7=E5=93=81=E7=AE=A1=E7=90=86:=20?= =?UTF-8?q?=E5=AF=BC=E5=87=BAdocx:=20=E8=B6=85=E5=85=AC=E9=87=8C:=20?= =?UTF-8?q?=E5=8F=AA=E6=9C=89=E6=97=BA=E5=AD=A3,=20=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=B9=B3=E5=AD=A3=E5=8C=85=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/products/Print/AgencyContract.jsx | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/views/products/Print/AgencyContract.jsx b/src/views/products/Print/AgencyContract.jsx index 09a88bd..3ce91a0 100644 --- a/src/views/products/Print/AgencyContract.jsx +++ b/src/views/products/Print/AgencyContract.jsx @@ -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({