From 65f2b996aa6549e3dcf815534563ab1d6fc463ed Mon Sep 17 00:00:00 2001 From: Lei OT Date: Tue, 10 Sep 2024 10:31:16 +0800 Subject: [PATCH 1/2] =?UTF-8?q?perf:=20docx:=20=E4=BA=BA=E7=AD=89=E6=9C=80?= =?UTF-8?q?=E5=A4=A7=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/products/Print/AgencyContract_v0903.jsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/views/products/Print/AgencyContract_v0903.jsx b/src/views/products/Print/AgencyContract_v0903.jsx index 11b7527..34c6809 100644 --- a/src/views/products/Print/AgencyContract_v0903.jsx +++ b/src/views/products/Print/AgencyContract_v0903.jsx @@ -109,9 +109,11 @@ const chunkBy = (use_year, dataList = [], by = []) => { aq[cq.WPI_SN] = unique(aq[cq.WPI_SN]); return aq; }, {}); + const maxGroupSize = Math.max(...allQuotesSSS.map(q => q.group_size_max)); + const maxSet = maxGroupSize === 1000 ? Infinity : maxGroupSize; // console.log('PGroupSizeSS', structuredClone(PGroupSizeSS)); const _SSMinSet = uniqWith(Object.values(PGroupSizeSS), (a, b) => a.join(',') === b.join(',')); - // console.log('SSMinSet', _SSMinSet); + // console.log('SSMinSet', _SSMinSet, maxGroupSize); const uSSsizeSetArr = uniqueBySub(_SSMinSet); // console.log('uSSsizeSetArr', uSSsizeSetArr); for (const key in PGroupSizeSS) { @@ -125,7 +127,7 @@ const chunkBy = (use_year, dataList = [], by = []) => { const [SSsizeSets, PSsizeSets] = [uSSsizeSetArr, []].map((arr) => { const _arr = structuredClone(arr); const arrSets = _arr.map(keyMins => keyMins.reduce((acc, curr, idx, minsArr) => { - const _max = idx === minsArr.length - 1 ? Infinity : Number(minsArr[idx + 1])-1; + const _max = idx === minsArr.length - 1 ? maxSet : Number(minsArr[idx + 1])-1; acc.push([Number(curr), _max]); return acc; }, [])); @@ -141,7 +143,7 @@ const chunkBy = (use_year, dataList = [], by = []) => { // console.log('pkey', pkey); const thisRange = (PGroupSizeSS[rowp.info.id] || []).reduce((acc, curr, idx, minsArr) => { - const _max = idx === minsArr.length - 1 ? Infinity : Number(minsArr[idx + 1])-1; + const _max = idx === minsArr.length - 1 ? maxSet : Number(minsArr[idx + 1])-1; acc.push([Number(curr), _max]); return acc; }, []); From 903efaead2581129a3409bbe53b8e5075f21714e Mon Sep 17 00:00:00 2001 From: Lei OT Date: Tue, 10 Sep 2024 10:37:14 +0800 Subject: [PATCH 2/2] =?UTF-8?q?perf:=20docx:=20=E9=99=84=E5=8A=A0=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE:=20`=E4=B8=8D=E5=88=86=E4=BA=BA=E7=AD=89`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/products/Print/AgencyContract_v0903.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/views/products/Print/AgencyContract_v0903.jsx b/src/views/products/Print/AgencyContract_v0903.jsx index 34c6809..57150f1 100644 --- a/src/views/products/Print/AgencyContract_v0903.jsx +++ b/src/views/products/Print/AgencyContract_v0903.jsx @@ -642,12 +642,13 @@ export default class AgencyContract { const date2 = shortDate(firstQ.use_dates_end); const othersDates = others.map((oq) => `${shortDate(oq.use_dates_start)}~${shortDate(oq.use_dates_end)}`).join(', '); const otherStr = isEmpty(othersDates) ? '' : `, ${othersDates}`; + const sizeStr = [0,1].includes(firstQ.group_size_min) && firstQ.group_size_max === 1000 ? '不分人等,' : `${firstQ.group_size_min}-${firstQ.group_size_max}人,`; return new Paragraph({ children: [ // new TextRun({ text: `${extra.info.product_title} ${firstQ.unit_name}`, bold: true }), new TextRun({ text: - `${firstQ.group_size_min}-${firstQ.group_size_max}人, ${firstQ.unit_name}, ${firstQ.adult_cost}` + + `${sizeStr} ${firstQ.unit_name}, ${firstQ.adult_cost}` + // + (`, ${firstQ.group_size_min}-${firstQ.group_size_max}人`) (compactBy !== 'dates' ? `, ${date1}~${date2}${otherStr}` : ''), }),