diff --git a/App.jsx b/App.jsx
index 23e2490..9097419 100644
--- a/App.jsx
+++ b/App.jsx
@@ -2252,6 +2252,10 @@ const Styles = () => (
.cd-lib-row { display: grid; gap: 8px; align-items: start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); }
.cd-ship-row { grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) auto auto; align-items: center; }
.cd-hs-row { grid-template-columns: minmax(0, 1fr) minmax(0, 2.6fr) auto; }
+ .cd-req { color: #d92d20; }
+ .cd-missing { border-color: #f04438 !important; background: #fff6f5; }
+ .cd-prev-box { overflow: hidden; display: flex; justify-content: center; }
+ .cd-prev-box iframe { border: 0; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.12); transform-origin: top center; flex: none; }
.cd-link { border: 0; background: none; color: #2563eb; cursor: pointer; font-size: 12px; margin-left: 10px; padding: 0; font-weight: 500; }
.cd-elems { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--panel); }
.cd-elem { display: grid; grid-template-columns: minmax(150px, 46%) 1fr; align-items: center; gap: 8px; padding: 5px 10px; border-bottom: 1px solid var(--line); }
@@ -6046,44 +6050,208 @@ function cdSums(d) {
}
const cdProducer = (d) => (d.producerSame ? { name: d.shipper, code: d.shipperCode } : { name: d.producer, code: d.producerCode });
-// 打印:按海关出口报关单的样子排一份草单(仅供核对)
-function printCustomsDecl(d, customers) {
- const esc = (s) => String(s ?? '').replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c])).replace(/\n/g, '
');
+// ===== 预报关单:同一份内容用于编辑页底部的实时预览、下载 PDF、下载 Excel =====
+const CD_PREPARER = { name: 'Mike', phone: '15201273157' };
+const cdEsc = (s) => String(s ?? '').replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c])).replace(/\n/g, '
');
+const cdQty2 = (it) => (String(it.qty2 ?? '').trim() || String(it.qty ?? '').trim()); // 发票数量没单独填就等于成交数量
+const cdFileBase = (d) => `预报关单_${String(d.contractNo || d.date || '').replace(/[\\/:*?"<>|\s]+/g, '_')}`;
+// 整理成一份结构化数据,HTML 和 Excel 都从这里取
+function cdDocData(d, customers, defs) {
const cust = customers.find((c) => c.id === d.customerId);
const pr = cdProducer(d);
const term = CD_TERMS.find((t) => t[0] === d.terms);
- const cell = (label, code, val) => `
标记唛码及备注 ${esc(d.notes)} |
| 项号 | 商品编号 | 商品名称及规格型号 | 数量及单位 | 单价/总价/币制 | 原产国(地区) | 最终目的国(地区) | 境内货源地 |
|---|