|
|
@ -94,10 +94,16 @@ const chunkBy = (use_year, dataList = [], by = []) => {
|
|
|
|
return { ...rowp, quotation, };
|
|
|
|
return { ...rowp, quotation, };
|
|
|
|
});
|
|
|
|
});
|
|
|
|
// console.log('\ndataRollSS', dataRollSS);
|
|
|
|
// 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 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 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] = aq[cq.WPI_SN] || [];
|
|
|
|
aq[cq.WPI_SN].push(cq.group_size_min);
|
|
|
|
aq[cq.WPI_SN].push(cq.group_size_min);
|
|
|
|
aq[cq.WPI_SN] = unique(aq[cq.WPI_SN]);
|
|
|
|
aq[cq.WPI_SN] = unique(aq[cq.WPI_SN]);
|
|
|
@ -140,14 +146,21 @@ const chunkBy = (use_year, dataList = [], by = []) => {
|
|
|
|
return acc;
|
|
|
|
return acc;
|
|
|
|
}, []);
|
|
|
|
}, []);
|
|
|
|
const _quotation = rowp.quotation.map((quoteItem) => {
|
|
|
|
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.group('quotation item');
|
|
|
|
// console.log(ssSets);
|
|
|
|
// console.log(ssSets);
|
|
|
|
// console.log([quoteItem.group_size_min, quoteItem.group_size_max]);
|
|
|
|
// 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 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 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 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('find mmm', matchRange, findEnd, findStart, finalRange);
|
|
|
|
// console.log('matchRange ', 'find', [quoteItem.group_size_min, quoteItem.group_size_max], 'matched', finalRange);
|
|
|
|
// console.log('matchRange ', 'find', [quoteItem.group_size_min, quoteItem.group_size_max], 'matched', finalRange);
|
|
|
|
// console.groupEnd();
|
|
|
|
// console.groupEnd();
|
|
|
@ -437,6 +450,7 @@ export default class AgencyContract {
|
|
|
|
* 超公里
|
|
|
|
* 超公里
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
createTable_B(use_year, dataList) {
|
|
|
|
createTable_B(use_year, dataList) {
|
|
|
|
|
|
|
|
// console.log('*********************************************************************************************');
|
|
|
|
const { chunk, sizeSets, SSRange, PSRange } = chunkBy(use_year, dataList, ['quote_size']);
|
|
|
|
const { chunk, sizeSets, SSRange, PSRange } = chunkBy(use_year, dataList, ['quote_size']);
|
|
|
|
const infoCol = (rowp) =>
|
|
|
|
const infoCol = (rowp) =>
|
|
|
|
new TableCell({
|
|
|
|
new TableCell({
|
|
|
|