| | |
| | | "productInfoList", |
| | | ]; |
| | | |
| | | const SPECIFICATION_FIELD_KEYS = ["specificationModel", "specification", "model", "spec"]; |
| | | |
| | | const normalizeNameList = (value) => { |
| | | if (Array.isArray(value)) { |
| | | return value |
| | |
| | | return itemNames[0] || fallbackNames[index] || fallbackNames[0] || ""; |
| | | }; |
| | | |
| | | const resolveSpecificationModel = (...sources) => { |
| | | for (const source of sources) { |
| | | if (!source || typeof source !== "object") continue; |
| | | for (const key of SPECIFICATION_FIELD_KEYS) { |
| | | const value = source?.[key]; |
| | | if (value !== undefined && value !== null && String(value).trim()) { |
| | | return String(value).trim(); |
| | | } |
| | | } |
| | | } |
| | | return ""; |
| | | }; |
| | | |
| | | const splitItemsByPage = (items, pageSize) => { |
| | | const list = Array.isArray(items) ? items : []; |
| | | if (list.length === 0) return [[]]; |
| | |
| | | ...item, |
| | | // 优先使用明细自身产品名,兼容“名称数组/分隔字符串”的接口格式 |
| | | productDescription: resolveProductName(item, groupNames, index), |
| | | specificationModel: resolveSpecificationModel(item, group, data), |
| | | salesContractNo: group?.salesContractNo || item?.salesContractNo || "", |
| | | widthHeight: item?.widthHeight || "", |
| | | })); |
| | |
| | | : (Array.isArray(data.items) ? data.items : []).map((item, index) => ({ |
| | | ...item, |
| | | productDescription: resolveProductName(item, dataLevelNames, index), |
| | | specificationModel: resolveSpecificationModel(item, data, selectedRow), |
| | | widthHeight: item?.widthHeight || "", |
| | | })); |
| | | |
| | |
| | | const list = Array.isArray(items) ? items : []; |
| | | const map = new Map(); |
| | | list.forEach((item) => { |
| | | const key = `${item?.productDescription || ""}__${getOrderNo(data, row, item)}`; |
| | | const key = `${item?.productDescription || ""}__${item?.specificationModel || ""}__${getOrderNo( |
| | | data, |
| | | row, |
| | | item |
| | | )}`; |
| | | if (!map.has(key)) { |
| | | map.set(key, { |
| | | productName: item?.productDescription || "", |
| | | specificationModel: item?.specificationModel || "", |
| | | orderNo: getOrderNo(data, row, item), |
| | | items: [], |
| | | }); |
| | |
| | | serial += group.items.length; |
| | | return ` |
| | | <tr class="group-title"> |
| | | <td colspan="5" class="left">产品名称: ${escapeHtml(group.productName)}</td> |
| | | <td colspan="5" class="left">产品名称: ${escapeHtml(group.productName)}${group.specificationModel ? ` 规格型号: ${escapeHtml(group.specificationModel)}` : ""}</td> |
| | | <td colspan="2" class="left">订单编号: ${escapeHtml(group.orderNo)}</td> |
| | | </tr> |
| | | ${rows} |