2025-11-28 11:02:19 +08:00
|
|
|
|
<!-- 发货单组件 -->
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<div class="waybill-container" ref="waybillRef">
|
2026-02-01 16:41:17 +08:00
|
|
|
|
<div class="waybill-content">
|
2025-11-28 11:02:19 +08:00
|
|
|
|
<!-- 头部信息 -->
|
2026-02-02 15:59:03 +08:00
|
|
|
|
<!-- 标题信息 -->
|
|
|
|
|
|
<div class="title">科伦普发货单</div>
|
2025-11-28 11:02:19 +08:00
|
|
|
|
<div class="waybill-header">
|
|
|
|
|
|
<div class="header-left">
|
|
|
|
|
|
<span class="label">收货单位:</span>
|
2026-02-02 17:23:21 +08:00
|
|
|
|
<div class="editable-input transparent-input" contenteditable>{{ localWaybill.consigneeUnit }}</div>
|
2025-11-28 11:02:19 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="header-center">
|
2026-02-02 17:23:21 +08:00
|
|
|
|
<div class="editable-input date-input transparent-input" contenteditable>{{ localWaybill.deliveryYear }}</div>
|
2025-11-28 11:02:19 +08:00
|
|
|
|
<span class="label date-label">年</span>
|
2026-02-02 17:23:21 +08:00
|
|
|
|
<div class="editable-input date-input transparent-input" contenteditable>{{ localWaybill.deliveryMonth }}</div>
|
2026-01-27 15:41:29 +08:00
|
|
|
|
<span class="label date-label">月</span>
|
2026-02-02 17:23:21 +08:00
|
|
|
|
<div class="editable-input date-input transparent-input" contenteditable>{{ localWaybill.deliveryDay }}</div>
|
2025-11-28 11:02:19 +08:00
|
|
|
|
<span class="label date-label">日</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="header-right">
|
|
|
|
|
|
<span class="label">发货单位:</span>
|
2026-02-02 17:23:21 +08:00
|
|
|
|
<div class="editable-input transparent-input" contenteditable>{{ localWaybill.senderUnit }}</div>
|
2025-11-28 11:02:19 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-01-27 15:41:29 +08:00
|
|
|
|
<div class="waybill-header">
|
2025-11-28 14:27:55 +08:00
|
|
|
|
<div class="header-left">
|
|
|
|
|
|
<span class="label">负责人:</span>
|
2026-02-02 17:23:21 +08:00
|
|
|
|
<div class="editable-input transparent-input" contenteditable>{{ localWaybill.principal }}</div>
|
2025-11-28 14:27:55 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="header-right">
|
|
|
|
|
|
<span class="label">电话:</span>
|
2026-02-02 17:23:21 +08:00
|
|
|
|
<div class="editable-input transparent-input" contenteditable>{{ localWaybill.principalPhone }}</div>
|
2025-11-28 14:27:55 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="header-center">
|
|
|
|
|
|
<span class="label">车牌:</span>
|
2026-02-02 17:23:21 +08:00
|
|
|
|
<div class="editable-input transparent-input" contenteditable>{{ localWaybill.licensePlate }}</div>
|
2025-11-28 14:27:55 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-11-28 11:02:19 +08:00
|
|
|
|
<!-- 表格 -->
|
|
|
|
|
|
<table class="waybill-table">
|
|
|
|
|
|
<thead>
|
|
|
|
|
|
<tr>
|
|
|
|
|
|
<th>品名</th>
|
|
|
|
|
|
<th>切边</th>
|
|
|
|
|
|
<th>包装</th>
|
2026-01-27 15:41:29 +08:00
|
|
|
|
<th>仓库位置</th>
|
2025-11-28 11:02:19 +08:00
|
|
|
|
<th>结算</th>
|
|
|
|
|
|
<th>原料厂家</th>
|
|
|
|
|
|
<th>卷号</th>
|
|
|
|
|
|
<th>规格</th>
|
|
|
|
|
|
<th>材质</th>
|
2026-02-02 13:40:02 +08:00
|
|
|
|
<!-- <th>数量(件)</th> -->
|
2026-01-27 15:41:29 +08:00
|
|
|
|
<th>重量(T)</th>
|
2026-02-02 13:40:02 +08:00
|
|
|
|
<!-- <th>单价</th> -->
|
2026-01-31 16:33:10 +08:00
|
|
|
|
|
2025-11-28 11:02:19 +08:00
|
|
|
|
</tr>
|
|
|
|
|
|
</thead>
|
|
|
|
|
|
<tbody>
|
|
|
|
|
|
<!-- 无明细提示 -->
|
|
|
|
|
|
<tr v-if="localWaybillDetails.length === 0">
|
2026-01-31 16:33:10 +08:00
|
|
|
|
<td colspan="12" class="no-data">
|
2025-11-28 11:02:19 +08:00
|
|
|
|
<div class="no-data-content">
|
|
|
|
|
|
<el-empty description="暂无发货单明细" />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
<!-- 明细数据 -->
|
2026-01-31 16:33:10 +08:00
|
|
|
|
<tr v-for="(item, index) in displayWaybillDetails" :key="index">
|
2026-02-02 17:23:21 +08:00
|
|
|
|
<td><div class="table-input transparent-input" contenteditable>{{ item.productName }}</div></td>
|
|
|
|
|
|
<td><div class="table-input transparent-input" contenteditable>{{ item.edgeType }}</div></td>
|
|
|
|
|
|
<td><div class="table-input transparent-input" contenteditable>{{ item.packageType }}</div></td>
|
|
|
|
|
|
<td><div class="table-input transparent-input" contenteditable>{{ item.actualWarehouseName }}</div></td>
|
|
|
|
|
|
<td><div class="table-input transparent-input" contenteditable>{{ item.settlementType }}</div></td>
|
|
|
|
|
|
<td><div class="table-input transparent-input" contenteditable>{{ item.rawMaterialFactory }}</div></td>
|
|
|
|
|
|
<td><div class="table-input transparent-input" contenteditable>{{ item.coilNumber }}</div></td>
|
|
|
|
|
|
<td><div class="table-input transparent-input" contenteditable>{{ item.specification }}</div></td>
|
|
|
|
|
|
<td><div class="table-input transparent-input" contenteditable>{{ item.material }}</div></td>
|
2026-02-02 13:40:02 +08:00
|
|
|
|
<!-- <td><input type="number" class="table-input transparent-input" v-model.number="item.quantity"
|
|
|
|
|
|
placeholder="0" /></td> -->
|
2025-11-28 11:02:19 +08:00
|
|
|
|
<td><input type="number" class="table-input transparent-input" v-model.number="item.weight"
|
|
|
|
|
|
placeholder="0.00" /></td>
|
2026-02-02 13:40:02 +08:00
|
|
|
|
<!-- <td><input type="text" class="table-input transparent-input" v-model="item.unitPrice" /></td> -->
|
2026-02-02 17:33:34 +08:00
|
|
|
|
</tr>
|
|
|
|
|
|
<!-- 加粗最后一行的线 -->
|
|
|
|
|
|
<tr style="height: 0;">
|
|
|
|
|
|
<td style="height: 0;"></td>
|
|
|
|
|
|
<td style="height: 0;"></td>
|
|
|
|
|
|
<td style="height: 0;"></td>
|
|
|
|
|
|
<td style="height: 0;"></td>
|
|
|
|
|
|
<td style="height: 0;"></td>
|
|
|
|
|
|
<td style="height: 0;"></td>
|
|
|
|
|
|
<td style="height: 0;"></td>
|
|
|
|
|
|
<td style="height: 0;"></td>
|
|
|
|
|
|
<td style="height: 0;"></td>
|
|
|
|
|
|
<!-- <td><input type="number" class="table-input transparent-input" v-model.number="item.quantity"
|
|
|
|
|
|
placeholder="0" /></td> -->
|
|
|
|
|
|
<td style="height: 0;"></td>
|
2025-11-28 11:02:19 +08:00
|
|
|
|
</tr>
|
|
|
|
|
|
</tbody>
|
|
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 备注说明 -->
|
|
|
|
|
|
<div class="waybill-remarks">
|
2026-01-27 15:41:29 +08:00
|
|
|
|
<p>
|
|
|
|
|
|
1、品名:冷硬钢卷(酸连轧)、冷轧钢卷(脱脂退火火拉矫)、镀锌卷板,镀锌管料(镀锌分剪料);2、切边:净边/毛边;3、包装:裸包:周三径四;简包1:周三径四内外护角;简包2:周三径四+防锈纸;普包:周三径四+内外护角+防锈纸+端护板;精包1:周三径四+内外护角+防锈纸+薄膜+端护板+内外护板;精包2:周三径四+内外护角+防锈纸+薄膜+端护板+内外护板+木托。
|
|
|
|
|
|
</p>
|
2025-11-28 11:02:19 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-12-01 17:53:19 +08:00
|
|
|
|
<div class="waybill-pickup-location">
|
|
|
|
|
|
<!-- <div class="pickup-location-item inline"> -->
|
2026-02-02 17:23:21 +08:00
|
|
|
|
<span style="font-size: 18px; font-weight: bold;">取货地点:</span>
|
2026-01-27 15:41:29 +08:00
|
|
|
|
<input type="text" class="editable-input full-input transparent-input" v-model="localWaybill.pickupLocation" />
|
2025-12-01 17:53:19 +08:00
|
|
|
|
<!-- </div> -->
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-11-28 11:02:19 +08:00
|
|
|
|
<!-- 签名栏 -->
|
|
|
|
|
|
<div class="waybill-footer">
|
|
|
|
|
|
<div class="footer-item inline">
|
|
|
|
|
|
<span class="label">销售:</span>
|
2026-02-02 17:23:21 +08:00
|
|
|
|
<div class="editable-input signature-input transparent-input" contenteditable>{{ localWaybill.salesman }}</div>
|
2025-11-28 11:02:19 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="footer-item inline">
|
|
|
|
|
|
<span class="label">发货:</span>
|
2026-02-02 17:23:21 +08:00
|
|
|
|
<div class="editable-input signature-input transparent-input" contenteditable>{{ localWaybill.deliveryman }}</div>
|
2025-11-28 11:02:19 +08:00
|
|
|
|
</div>
|
2026-02-02 15:59:03 +08:00
|
|
|
|
<div class="footer-item inline">
|
|
|
|
|
|
<span class="label">司机:</span>
|
2026-02-02 17:23:21 +08:00
|
|
|
|
<div class="editable-input signature-input transparent-input" contenteditable>{{ localWaybill.driver }}</div>
|
2026-02-02 15:59:03 +08:00
|
|
|
|
</div>
|
2025-11-28 11:02:19 +08:00
|
|
|
|
<div class="footer-item inline">
|
|
|
|
|
|
<span class="label">磅房:</span>
|
2026-02-02 17:23:21 +08:00
|
|
|
|
<div class="editable-input signature-input transparent-input" contenteditable>{{ localWaybill.weightRoom }}</div>
|
2025-11-28 11:02:19 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-02-01 16:41:17 +08:00
|
|
|
|
</div>
|
2025-11-28 11:02:19 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<!-- 操作按钮 -->
|
|
|
|
|
|
<div class="waybill-actions">
|
2026-01-31 16:33:10 +08:00
|
|
|
|
<div class="waybill-pagebar">
|
|
|
|
|
|
<el-button size="mini" @click="changePage(currentPage - 1)" :disabled="currentPage <= 1">上一页</el-button>
|
|
|
|
|
|
<span class="page-info">第 {{ currentPage }} / {{ totalPages }} 页</span>
|
|
|
|
|
|
<el-button size="mini" @click="changePage(currentPage + 1)" :disabled="currentPage >= totalPages">下一页</el-button>
|
|
|
|
|
|
</div>
|
2025-11-28 11:02:19 +08:00
|
|
|
|
<el-button type="primary" @click="saveAsImage">保存为图片</el-button>
|
|
|
|
|
|
<el-button type="success" @click="printWaybill">打印</el-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import domtoimage from 'dom-to-image';
|
2026-01-27 15:41:29 +08:00
|
|
|
|
import { PDFDocument } from 'pdf-lib';
|
|
|
|
|
|
import html2canvas from 'html2canvas';
|
2025-11-28 11:02:19 +08:00
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
props: {
|
|
|
|
|
|
// 组件接收完整的发货单内容, 渲染发货单,这个面板内包括一个保存为图片(已经安装了dom-to-image)和一个打印按钮(已经安装了print-js)
|
|
|
|
|
|
waybill: {
|
|
|
|
|
|
type: Object,
|
|
|
|
|
|
default: () => { }
|
|
|
|
|
|
},
|
|
|
|
|
|
waybillDetails: {
|
|
|
|
|
|
type: Array,
|
|
|
|
|
|
default: () => []
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
2026-01-31 16:33:10 +08:00
|
|
|
|
currentPage: 1,
|
2026-02-02 17:23:21 +08:00
|
|
|
|
perPage: 7,
|
2026-01-31 16:33:10 +08:00
|
|
|
|
totalPages: 1,
|
2025-11-28 11:02:19 +08:00
|
|
|
|
// 本地可编辑的发货单数据
|
|
|
|
|
|
localWaybill: {
|
|
|
|
|
|
consigneeUnit: '',
|
|
|
|
|
|
senderUnit: '',
|
|
|
|
|
|
deliveryYear: '',
|
|
|
|
|
|
deliveryMonth: '',
|
2025-11-28 14:27:55 +08:00
|
|
|
|
deliveryDay: '',
|
|
|
|
|
|
principal: '',
|
|
|
|
|
|
principalPhone: '',
|
2025-12-09 14:37:46 +08:00
|
|
|
|
licensePlate: '',
|
|
|
|
|
|
pickupLocation: ''
|
2025-11-28 11:02:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
// 本地可编辑的发货单明细
|
2026-01-31 16:33:10 +08:00
|
|
|
|
localWaybillDetails: [],
|
2026-02-01 16:41:17 +08:00
|
|
|
|
// 预览/打印用明细(每页固定7行,不足补空行)
|
2026-01-31 16:33:10 +08:00
|
|
|
|
displayWaybillDetails: []
|
2025-11-28 11:02:19 +08:00
|
|
|
|
};
|
|
|
|
|
|
},
|
|
|
|
|
|
watch: {
|
|
|
|
|
|
// 监听props变化,更新本地数据
|
|
|
|
|
|
waybill: {
|
|
|
|
|
|
handler(newVal) {
|
|
|
|
|
|
if (newVal) {
|
|
|
|
|
|
this.localWaybill = {
|
|
|
|
|
|
consigneeUnit: newVal.consigneeUnit || '',
|
|
|
|
|
|
senderUnit: newVal.senderUnit || '',
|
|
|
|
|
|
deliveryYear: this.getYearFromDate(newVal.deliveryTime) || '',
|
|
|
|
|
|
deliveryMonth: this.getMonthFromDate(newVal.deliveryTime) || '',
|
2025-11-28 14:27:55 +08:00
|
|
|
|
deliveryDay: this.getDayFromDate(newVal.deliveryTime) || '',
|
|
|
|
|
|
principal: newVal.principal || '',
|
|
|
|
|
|
principalPhone: newVal.principalPhone || '',
|
2025-12-09 14:37:46 +08:00
|
|
|
|
licensePlate: newVal.licensePlate || '',
|
|
|
|
|
|
pickupLocation: newVal.pickupLocation || ''
|
2025-11-28 11:02:19 +08:00
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
immediate: true,
|
|
|
|
|
|
deep: true
|
|
|
|
|
|
},
|
|
|
|
|
|
waybillDetails: {
|
|
|
|
|
|
handler(newVal) {
|
|
|
|
|
|
if (newVal && Array.isArray(newVal)) {
|
|
|
|
|
|
this.localWaybillDetails = [...newVal];
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.localWaybillDetails = [];
|
|
|
|
|
|
}
|
2026-01-31 16:33:10 +08:00
|
|
|
|
this.refreshPagination();
|
2025-11-28 11:02:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
immediate: true,
|
|
|
|
|
|
deep: true
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2026-01-31 16:33:10 +08:00
|
|
|
|
buildPage(details, page) {
|
|
|
|
|
|
const perPage = this.perPage;
|
|
|
|
|
|
const src = Array.isArray(details) ? details : [];
|
|
|
|
|
|
const start = (page - 1) * perPage;
|
|
|
|
|
|
const pageRows = src.slice(start, start + perPage).map((x) => ({ ...x }));
|
|
|
|
|
|
while (pageRows.length < perPage) {
|
|
|
|
|
|
pageRows.push({
|
|
|
|
|
|
productName: '',
|
|
|
|
|
|
edgeType: '',
|
|
|
|
|
|
packageType: '',
|
|
|
|
|
|
actualWarehouseName: '',
|
|
|
|
|
|
settlementType: '',
|
|
|
|
|
|
rawMaterialFactory: '',
|
|
|
|
|
|
coilNumber: '',
|
|
|
|
|
|
specification: '',
|
|
|
|
|
|
material: '',
|
|
|
|
|
|
quantity: '',
|
|
|
|
|
|
weight: '',
|
|
|
|
|
|
unitPrice: ''
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
return pageRows;
|
|
|
|
|
|
},
|
|
|
|
|
|
refreshPagination() {
|
|
|
|
|
|
const src = Array.isArray(this.localWaybillDetails) ? this.localWaybillDetails : [];
|
|
|
|
|
|
this.totalPages = Math.max(1, Math.ceil(src.length / this.perPage));
|
|
|
|
|
|
if (this.currentPage > this.totalPages) this.currentPage = this.totalPages;
|
|
|
|
|
|
if (this.currentPage < 1) this.currentPage = 1;
|
|
|
|
|
|
this.displayWaybillDetails = this.buildPage(src, this.currentPage);
|
|
|
|
|
|
},
|
|
|
|
|
|
changePage(next) {
|
|
|
|
|
|
this.currentPage = next;
|
|
|
|
|
|
this.refreshPagination();
|
|
|
|
|
|
},
|
2025-11-28 11:02:19 +08:00
|
|
|
|
// 从日期字符串中提取年份
|
|
|
|
|
|
getYearFromDate(dateStr) {
|
|
|
|
|
|
if (dateStr) {
|
|
|
|
|
|
const date = new Date(dateStr);
|
|
|
|
|
|
return date.getFullYear().toString();
|
|
|
|
|
|
}
|
|
|
|
|
|
return '';
|
|
|
|
|
|
},
|
|
|
|
|
|
// 从日期字符串中提取月份
|
|
|
|
|
|
getMonthFromDate(dateStr) {
|
|
|
|
|
|
if (dateStr) {
|
|
|
|
|
|
const date = new Date(dateStr);
|
|
|
|
|
|
return (date.getMonth() + 1).toString();
|
|
|
|
|
|
}
|
|
|
|
|
|
return '';
|
|
|
|
|
|
},
|
|
|
|
|
|
// 从日期字符串中提取日
|
|
|
|
|
|
getDayFromDate(dateStr) {
|
|
|
|
|
|
if (dateStr) {
|
|
|
|
|
|
const date = new Date(dateStr);
|
|
|
|
|
|
return date.getDate().toString();
|
|
|
|
|
|
}
|
|
|
|
|
|
return '';
|
|
|
|
|
|
},
|
|
|
|
|
|
// 保存为图片
|
|
|
|
|
|
saveAsImage() {
|
|
|
|
|
|
const node = this.$refs.waybillRef;
|
2025-11-28 11:20:41 +08:00
|
|
|
|
// 确保容器在保存图片时能完整显示所有内容
|
|
|
|
|
|
const originalWidth = node.style.width;
|
|
|
|
|
|
const originalOverflow = node.style.overflow;
|
2026-01-27 15:41:29 +08:00
|
|
|
|
|
2025-11-28 11:20:41 +08:00
|
|
|
|
// 临时调整容器样式,确保所有内容可见
|
|
|
|
|
|
node.style.width = 'auto';
|
|
|
|
|
|
node.style.overflow = 'visible';
|
2026-01-27 15:41:29 +08:00
|
|
|
|
|
2025-11-28 11:20:41 +08:00
|
|
|
|
// 获取实际内容宽度
|
|
|
|
|
|
const contentWidth = node.scrollWidth;
|
|
|
|
|
|
const contentHeight = node.scrollHeight;
|
2026-01-27 15:41:29 +08:00
|
|
|
|
|
2025-11-28 11:20:41 +08:00
|
|
|
|
domtoimage.toPng(node, {
|
|
|
|
|
|
width: contentWidth,
|
|
|
|
|
|
height: contentHeight,
|
|
|
|
|
|
style: {
|
|
|
|
|
|
width: `${contentWidth}px`,
|
|
|
|
|
|
height: `${contentHeight}px`,
|
|
|
|
|
|
overflow: 'visible'
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2025-11-28 11:02:19 +08:00
|
|
|
|
.then(dataUrl => {
|
|
|
|
|
|
const link = document.createElement('a');
|
|
|
|
|
|
link.download = `发货单_${this.waybill.waybillName || this.waybill.waybillNo || Date.now()}.png`;
|
|
|
|
|
|
link.href = dataUrl;
|
|
|
|
|
|
link.click();
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch(error => {
|
|
|
|
|
|
console.error('保存图片失败:', error);
|
|
|
|
|
|
this.$message.error('保存图片失败');
|
2025-11-28 11:20:41 +08:00
|
|
|
|
})
|
|
|
|
|
|
.finally(() => {
|
|
|
|
|
|
// 恢复原始样式
|
|
|
|
|
|
node.style.width = originalWidth;
|
|
|
|
|
|
node.style.overflow = originalOverflow;
|
2025-11-28 11:02:19 +08:00
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
// 打印发货单
|
2026-01-27 15:41:29 +08:00
|
|
|
|
async printWaybill() {
|
2025-11-28 11:02:19 +08:00
|
|
|
|
const node = this.$refs.waybillRef;
|
2026-01-31 16:33:10 +08:00
|
|
|
|
const paperWidthMm = 241;
|
|
|
|
|
|
const paperHeightMm = 140;
|
2026-02-01 16:41:17 +08:00
|
|
|
|
const safeRightMarginMm = 45;
|
|
|
|
|
|
const safeLeftPaddingMm = 6;
|
|
|
|
|
|
const safeTopShiftMm = 15;
|
|
|
|
|
|
const safeContentWidthMm = paperWidthMm - safeRightMarginMm - safeLeftPaddingMm;
|
2026-01-27 15:41:29 +08:00
|
|
|
|
|
2026-01-31 16:33:10 +08:00
|
|
|
|
const mmToPx = (mm) => (mm * 96) / 25.4;
|
2026-01-27 15:41:29 +08:00
|
|
|
|
const mmToPt = 72 / 25.4;
|
|
|
|
|
|
const pageWidthPt = paperWidthMm * mmToPt;
|
|
|
|
|
|
const pageHeightPt = paperHeightMm * mmToPt;
|
|
|
|
|
|
|
2026-01-31 16:33:10 +08:00
|
|
|
|
const pageWidthPx = Math.round(mmToPx(paperWidthMm));
|
|
|
|
|
|
const pageHeightPx = Math.round(mmToPx(paperHeightMm));
|
|
|
|
|
|
|
|
|
|
|
|
const allDetails = Array.isArray(this.localWaybillDetails) ? this.localWaybillDetails : [];
|
|
|
|
|
|
const totalPages = Math.max(1, Math.ceil(allDetails.length / this.perPage));
|
|
|
|
|
|
|
|
|
|
|
|
const originalPage = this.currentPage;
|
|
|
|
|
|
const originalDisplay = this.displayWaybillDetails;
|
|
|
|
|
|
|
2026-01-27 15:41:29 +08:00
|
|
|
|
const pdfDoc = await PDFDocument.create();
|
2026-01-31 16:33:10 +08:00
|
|
|
|
|
2026-02-01 16:41:17 +08:00
|
|
|
|
// 强制让容器内容不被裁剪,以便html2canvas完整捕获
|
|
|
|
|
|
const originalStyle = { width: node.style.width, overflow: node.style.overflow };
|
|
|
|
|
|
const contentEl = node.querySelector('.waybill-content');
|
|
|
|
|
|
const originalContentCssText = contentEl ? contentEl.style.cssText : '';
|
|
|
|
|
|
|
|
|
|
|
|
node.style.width = 'auto';
|
|
|
|
|
|
node.style.overflow = 'visible';
|
|
|
|
|
|
|
|
|
|
|
|
// 针对“导出PDF再打印”的场景:为打印机右侧不可打印区预留约30mm
|
|
|
|
|
|
// 通过缩放内容区域(不换行、不省略),让最终PDF右侧自带留白
|
|
|
|
|
|
if (contentEl) {
|
|
|
|
|
|
contentEl.style.setProperty('--content-width-mm', String(safeContentWidthMm));
|
|
|
|
|
|
contentEl.style.setProperty('--offset-x-mm', String(safeLeftPaddingMm));
|
|
|
|
|
|
contentEl.style.setProperty('--offset-y-mm', String(safeTopShiftMm));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-31 16:33:10 +08:00
|
|
|
|
try {
|
|
|
|
|
|
for (let page = 1; page <= totalPages; page++) {
|
|
|
|
|
|
this.currentPage = page;
|
|
|
|
|
|
this.displayWaybillDetails = this.buildPage(allDetails, page);
|
|
|
|
|
|
await this.$nextTick();
|
|
|
|
|
|
|
2026-02-01 16:41:17 +08:00
|
|
|
|
// 固定按纸张尺寸截图:右侧留白来自于 contentEl 的缩放(241 -> 211mm),而不是扩大截图宽度
|
2026-01-31 16:33:10 +08:00
|
|
|
|
const canvas = await html2canvas(node, {
|
|
|
|
|
|
backgroundColor: '#ffffff',
|
|
|
|
|
|
scale: 3,
|
|
|
|
|
|
useCORS: true,
|
|
|
|
|
|
willReadFrequently: true,
|
|
|
|
|
|
width: pageWidthPx,
|
|
|
|
|
|
height: pageHeightPx,
|
|
|
|
|
|
windowWidth: pageWidthPx,
|
2026-02-01 16:41:17 +08:00
|
|
|
|
windowHeight: pageHeightPx,
|
|
|
|
|
|
scrollX: 0,
|
|
|
|
|
|
scrollY: 0
|
2026-01-31 16:33:10 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
2026-02-01 16:41:17 +08:00
|
|
|
|
const png = canvas.toDataURL('image/png');
|
|
|
|
|
|
const imgPng = await pdfDoc.embedPng(png);
|
2026-01-31 16:33:10 +08:00
|
|
|
|
const pdfPage = pdfDoc.addPage([pageWidthPt, pageHeightPt]);
|
|
|
|
|
|
pdfPage.drawImage(imgPng, {
|
2026-02-01 16:41:17 +08:00
|
|
|
|
x: 0,
|
|
|
|
|
|
y: 0,
|
|
|
|
|
|
width: pageWidthPt,
|
|
|
|
|
|
height: pageHeightPt
|
|
|
|
|
|
});
|
2026-01-31 16:33:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
} finally {
|
2026-02-01 16:41:17 +08:00
|
|
|
|
// 恢复截图前的容器样式
|
|
|
|
|
|
node.style.width = originalStyle.width;
|
|
|
|
|
|
node.style.overflow = originalStyle.overflow;
|
|
|
|
|
|
if (contentEl) contentEl.style.cssText = originalContentCssText;
|
|
|
|
|
|
|
2026-01-31 16:33:10 +08:00
|
|
|
|
this.currentPage = originalPage;
|
|
|
|
|
|
this.displayWaybillDetails = originalDisplay;
|
|
|
|
|
|
this.refreshPagination();
|
|
|
|
|
|
}
|
2026-01-27 15:41:29 +08:00
|
|
|
|
|
|
|
|
|
|
const pdfBytes = await pdfDoc.save();
|
|
|
|
|
|
const blob = new Blob([pdfBytes], { type: 'application/pdf' });
|
|
|
|
|
|
const url = URL.createObjectURL(blob);
|
|
|
|
|
|
|
|
|
|
|
|
const win = window.open(url, '_blank');
|
|
|
|
|
|
if (!win) {
|
|
|
|
|
|
const a = document.createElement('a');
|
|
|
|
|
|
a.href = url;
|
2026-01-31 16:33:10 +08:00
|
|
|
|
a.download = `发货单_${this.waybill.waybillName || this.waybill.waybillNo || new Date().getTime()}.pdf`;
|
2026-01-27 15:41:29 +08:00
|
|
|
|
document.body.appendChild(a);
|
|
|
|
|
|
a.click();
|
|
|
|
|
|
document.body.removeChild(a);
|
|
|
|
|
|
}
|
2025-11-28 11:02:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
.waybill-container {
|
2026-01-31 16:33:10 +08:00
|
|
|
|
width: 241mm;
|
|
|
|
|
|
height: 140mm;
|
2025-11-28 11:02:19 +08:00
|
|
|
|
margin: 0 auto;
|
2026-02-01 16:41:17 +08:00
|
|
|
|
padding: 0;
|
2026-01-31 16:33:10 +08:00
|
|
|
|
background: #fff;
|
|
|
|
|
|
box-shadow: none;
|
|
|
|
|
|
font-family: SimSun, "Courier New", monospace;
|
|
|
|
|
|
overflow: hidden;
|
2026-02-02 15:59:03 +08:00
|
|
|
|
color: #000 !important;
|
|
|
|
|
|
font-weight: 900 !important;
|
2026-02-01 16:41:17 +08:00
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-02 15:59:03 +08:00
|
|
|
|
.title {
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
font-size: 24px;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
margin-bottom: 5px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-01 16:41:17 +08:00
|
|
|
|
.waybill-content {
|
|
|
|
|
|
--paper-width-mm: 241;
|
|
|
|
|
|
--content-width-mm: 241;
|
|
|
|
|
|
--offset-x-mm: 0;
|
|
|
|
|
|
--offset-y-mm: 0;
|
|
|
|
|
|
--scale: calc(var(--content-width-mm) / var(--paper-width-mm));
|
|
|
|
|
|
|
|
|
|
|
|
width: calc(var(--paper-width-mm) * 1mm);
|
|
|
|
|
|
transform-origin: top left;
|
|
|
|
|
|
transform: translate(calc(var(--offset-x-mm) * 1mm), calc(var(--offset-y-mm) * 1mm)) scale(var(--scale));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.waybill-content * {
|
|
|
|
|
|
box-sizing: border-box;
|
2025-11-28 11:02:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 头部样式 */
|
|
|
|
|
|
.waybill-header {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
align-items: center;
|
2026-01-31 16:33:10 +08:00
|
|
|
|
margin-bottom: 3mm;
|
|
|
|
|
|
font-size: 11px;
|
2025-11-28 11:02:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.header-left,
|
|
|
|
|
|
.header-right {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.header-center {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 5px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.label {
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
display: inline-block;
|
2026-02-02 13:40:02 +08:00
|
|
|
|
width: 100px;
|
2026-02-02 17:23:21 +08:00
|
|
|
|
font-size: 18px;
|
2025-11-28 11:02:19 +08:00
|
|
|
|
text-align: right;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.date-label {
|
2025-11-28 14:27:55 +08:00
|
|
|
|
width: 1em;
|
2025-11-28 11:02:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 可编辑输入框样式 */
|
|
|
|
|
|
.editable-input {
|
|
|
|
|
|
padding: 4px 8px;
|
|
|
|
|
|
border: 1px solid #dcdfe6;
|
|
|
|
|
|
border-radius: 4px;
|
2026-02-02 17:23:21 +08:00
|
|
|
|
font-size: 18px;
|
2026-02-02 15:59:03 +08:00
|
|
|
|
font-weight: bold;
|
2025-11-28 11:02:19 +08:00
|
|
|
|
font-family: SimSun, serif;
|
|
|
|
|
|
outline: none;
|
|
|
|
|
|
transition: all 0.2s;
|
2026-02-02 17:23:21 +08:00
|
|
|
|
line-height: 18px;
|
2025-11-28 11:02:19 +08:00
|
|
|
|
border-bottom: 1px dashed #dcdfe6;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.editable-input:focus {
|
|
|
|
|
|
border-color: #409eff;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.date-input {
|
2026-02-02 13:40:02 +08:00
|
|
|
|
width: 40px;
|
2025-11-28 11:02:19 +08:00
|
|
|
|
text-align: center;
|
|
|
|
|
|
margin-right: 5px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 透明输入框样式 */
|
|
|
|
|
|
.transparent-input {
|
|
|
|
|
|
border: none;
|
|
|
|
|
|
border-radius: 0;
|
|
|
|
|
|
background-color: transparent;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.transparent-input:focus {
|
|
|
|
|
|
border-bottom-color: #409eff;
|
|
|
|
|
|
background-color: rgba(64, 158, 255, 0.05);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 表格样式 */
|
|
|
|
|
|
.waybill-table {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
border-collapse: collapse;
|
2026-01-31 16:33:10 +08:00
|
|
|
|
margin-bottom: 2mm;
|
|
|
|
|
|
font-size: 10px;
|
2025-11-28 11:02:19 +08:00
|
|
|
|
table-layout: fixed;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.waybill-table th,
|
|
|
|
|
|
.waybill-table td {
|
2026-01-31 16:33:10 +08:00
|
|
|
|
border: 0.4px solid #000;
|
2025-11-28 11:02:19 +08:00
|
|
|
|
box-sizing: border-box;
|
2026-01-31 16:33:10 +08:00
|
|
|
|
line-height: 6mm;
|
2025-11-28 11:02:19 +08:00
|
|
|
|
text-align: center;
|
|
|
|
|
|
vertical-align: middle;
|
2026-02-02 17:23:21 +08:00
|
|
|
|
font-size: 18px;
|
2026-02-02 15:59:03 +08:00
|
|
|
|
font-weight: 900;
|
2026-01-31 16:33:10 +08:00
|
|
|
|
padding: 0;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
white-space: nowrap;
|
2025-11-28 11:02:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 表格列宽设置 */
|
|
|
|
|
|
.waybill-table th:nth-child(1),
|
|
|
|
|
|
.waybill-table td:nth-child(1) {
|
2026-02-02 13:40:02 +08:00
|
|
|
|
width: 60px;
|
2026-01-27 15:41:29 +08:00
|
|
|
|
/* 品名 */
|
2025-11-28 11:02:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.waybill-table th:nth-child(2),
|
|
|
|
|
|
.waybill-table td:nth-child(2) {
|
2026-01-27 15:41:29 +08:00
|
|
|
|
width: 40px;
|
|
|
|
|
|
/* 切边 */
|
2025-11-28 11:02:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.waybill-table th:nth-child(3),
|
|
|
|
|
|
.waybill-table td:nth-child(3) {
|
2026-01-27 15:41:29 +08:00
|
|
|
|
width: 40px;
|
|
|
|
|
|
/* 包装 */
|
2025-11-28 11:02:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.waybill-table th:nth-child(4),
|
|
|
|
|
|
.waybill-table td:nth-child(4) {
|
2026-01-27 15:41:29 +08:00
|
|
|
|
width: 80px;
|
|
|
|
|
|
/* 仓库位置 */
|
2025-11-28 11:02:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.waybill-table th:nth-child(5),
|
|
|
|
|
|
.waybill-table td:nth-child(5) {
|
2026-01-27 15:41:29 +08:00
|
|
|
|
width: 40px;
|
|
|
|
|
|
/* 结算 */
|
2025-11-28 11:02:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.waybill-table th:nth-child(6),
|
|
|
|
|
|
.waybill-table td:nth-child(6) {
|
2026-01-27 15:41:29 +08:00
|
|
|
|
width: 80px;
|
|
|
|
|
|
/* 原料厂家 */
|
2025-11-28 11:02:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.waybill-table th:nth-child(7),
|
|
|
|
|
|
.waybill-table td:nth-child(7) {
|
2026-01-27 15:41:29 +08:00
|
|
|
|
width: 100px;
|
|
|
|
|
|
/* 卷号 */
|
2025-11-28 11:02:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.waybill-table th:nth-child(8),
|
|
|
|
|
|
.waybill-table td:nth-child(8) {
|
2026-01-27 15:41:29 +08:00
|
|
|
|
width: 80px;
|
|
|
|
|
|
/* 规格 */
|
2025-11-28 11:02:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.waybill-table th:nth-child(9),
|
|
|
|
|
|
.waybill-table td:nth-child(9) {
|
2026-02-02 13:40:02 +08:00
|
|
|
|
width: 80px;
|
2026-01-27 15:41:29 +08:00
|
|
|
|
/* 材质 */
|
2025-11-28 11:02:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-02 13:40:02 +08:00
|
|
|
|
/* 数量(件) */
|
|
|
|
|
|
/* .waybill-table th:nth-child(10),
|
2025-11-28 11:02:19 +08:00
|
|
|
|
.waybill-table td:nth-child(10) {
|
2026-01-27 15:41:29 +08:00
|
|
|
|
width: 60px;
|
2025-11-28 11:02:19 +08:00
|
|
|
|
|
2026-02-02 13:40:02 +08:00
|
|
|
|
} */
|
|
|
|
|
|
|
|
|
|
|
|
.waybill-table th:nth-child(10),
|
|
|
|
|
|
.waybill-table td:nth-child(10) {
|
2026-01-27 15:41:29 +08:00
|
|
|
|
width: 80px;
|
|
|
|
|
|
/* 重量(kg) */
|
2025-11-28 11:02:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-02 13:40:02 +08:00
|
|
|
|
/* 单价 */
|
|
|
|
|
|
/* .waybill-table th:nth-child(12),
|
2025-11-28 11:02:19 +08:00
|
|
|
|
.waybill-table td:nth-child(12) {
|
2026-01-27 15:41:29 +08:00
|
|
|
|
width: 40px;
|
2026-02-02 13:40:02 +08:00
|
|
|
|
|
|
|
|
|
|
} */
|
2026-01-27 15:41:29 +08:00
|
|
|
|
|
2025-11-28 11:02:19 +08:00
|
|
|
|
|
|
|
|
|
|
.waybill-table th {
|
|
|
|
|
|
background-color: #f5f7fa;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.waybill-table tr:nth-child(even) {
|
|
|
|
|
|
background-color: #fafafa;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 表格输入框样式 */
|
|
|
|
|
|
.table-input {
|
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
2026-01-31 16:33:10 +08:00
|
|
|
|
margin: 0;
|
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
border: none;
|
|
|
|
|
|
outline: none;
|
|
|
|
|
|
background: transparent;
|
2026-02-02 13:40:02 +08:00
|
|
|
|
/* font-family: inherit; */
|
2026-02-02 17:23:21 +08:00
|
|
|
|
font-size: 18px;
|
2026-01-31 16:33:10 +08:00
|
|
|
|
line-height: 6mm;
|
2026-02-02 13:40:02 +08:00
|
|
|
|
text-align: center;
|
2026-01-31 16:33:10 +08:00
|
|
|
|
vertical-align: middle;
|
2025-11-28 11:02:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-31 16:33:10 +08:00
|
|
|
|
.transparent-input {
|
|
|
|
|
|
border: none !important;
|
|
|
|
|
|
background: transparent !important;
|
|
|
|
|
|
padding: 0 !important;
|
|
|
|
|
|
margin: 0 !important;
|
|
|
|
|
|
height: 100% !important;
|
|
|
|
|
|
line-height: 6mm !important;
|
|
|
|
|
|
vertical-align: middle !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.waybill-table th,
|
|
|
|
|
|
.waybill-table td {
|
|
|
|
|
|
padding: 0 !important;
|
|
|
|
|
|
margin: 0 !important;
|
|
|
|
|
|
line-height: 6mm !important;
|
2026-02-02 17:33:34 +08:00
|
|
|
|
height: 6mm;
|
2026-01-31 16:33:10 +08:00
|
|
|
|
vertical-align: middle !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.waybill-table input {
|
|
|
|
|
|
vertical-align: middle !important;
|
|
|
|
|
|
height: 6mm !important;
|
|
|
|
|
|
line-height: 6mm !important;
|
|
|
|
|
|
padding: 0 2px !important;
|
|
|
|
|
|
margin: 0 !important;
|
|
|
|
|
|
border: none !important;
|
|
|
|
|
|
background: transparent !important;
|
|
|
|
|
|
box-shadow: none !important;
|
|
|
|
|
|
width: 100% !important;
|
|
|
|
|
|
max-width: 100% !important;
|
|
|
|
|
|
overflow: hidden !important;
|
|
|
|
|
|
text-overflow: ellipsis !important;
|
|
|
|
|
|
white-space: nowrap !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.waybill-table input:focus {
|
|
|
|
|
|
outline: none !important;
|
|
|
|
|
|
box-shadow: none !important;
|
|
|
|
|
|
border: 1px dashed #999 !important;
|
2025-11-28 11:02:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 无数据样式 */
|
|
|
|
|
|
.no-data {
|
|
|
|
|
|
height: 200px;
|
|
|
|
|
|
vertical-align: middle;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.no-data-content {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 表格单元格操作区 */
|
|
|
|
|
|
.table-cell-with-action {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 5px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 备注样式 */
|
|
|
|
|
|
.waybill-remarks {
|
|
|
|
|
|
margin-bottom: 30px;
|
2026-02-02 17:23:21 +08:00
|
|
|
|
font-size: 18px;
|
2025-11-28 11:02:19 +08:00
|
|
|
|
line-height: 1.5;
|
2026-02-02 15:02:22 +08:00
|
|
|
|
/* font-weight: 600; */
|
|
|
|
|
|
font-weight: bold;
|
2025-11-28 11:02:19 +08:00
|
|
|
|
text-align: justify;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.waybill-remarks p {
|
|
|
|
|
|
margin: 5px 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 底部签名样式 */
|
|
|
|
|
|
.waybill-footer {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
margin-bottom: 20px;
|
2026-02-02 17:23:21 +08:00
|
|
|
|
font-size: 18px;
|
2025-11-28 11:02:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-01 17:53:19 +08:00
|
|
|
|
.waybill-pickup-location {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
align-items: center;
|
2026-02-02 17:23:21 +08:00
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
|
font-size: 18px;
|
2025-12-01 17:53:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-02 13:40:02 +08:00
|
|
|
|
|
|
|
|
|
|
|
2025-12-01 17:53:19 +08:00
|
|
|
|
.waybill-pickup-location label {
|
2026-02-02 17:23:21 +08:00
|
|
|
|
font-size: 18px;
|
2026-02-02 13:40:02 +08:00
|
|
|
|
/* margin-right: 10px; */
|
|
|
|
|
|
text-align: left !important;
|
2025-12-01 17:53:19 +08:00
|
|
|
|
width: 40px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-28 11:02:19 +08:00
|
|
|
|
.footer-item {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 10px;
|
|
|
|
|
|
width: 200px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.footer-item.inline {
|
|
|
|
|
|
flex-direction: row;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
width: auto;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.footer-item .label {
|
2026-02-02 17:23:21 +08:00
|
|
|
|
font-size: 18px;
|
2025-11-28 11:02:19 +08:00
|
|
|
|
margin-right: 10px;
|
|
|
|
|
|
width: 40px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.signature-input {
|
|
|
|
|
|
min-width: 150px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-01 17:53:19 +08:00
|
|
|
|
.full-input {
|
|
|
|
|
|
/* 占满本行的剩余空间,父容器不是flex */
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-28 11:02:19 +08:00
|
|
|
|
/* 操作按钮样式 */
|
|
|
|
|
|
.waybill-actions {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
gap: 20px;
|
|
|
|
|
|
margin-top: 30px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 添加明细按钮 */
|
|
|
|
|
|
.add-detail-btn {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 打印样式 */
|
2026-02-01 16:41:17 +08:00
|
|
|
|
@page {
|
|
|
|
|
|
size: 241mm 140mm;
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-28 11:02:19 +08:00
|
|
|
|
@media print {
|
2026-02-01 16:41:17 +08:00
|
|
|
|
html,
|
|
|
|
|
|
body {
|
|
|
|
|
|
margin: 0;
|
2025-11-28 11:02:19 +08:00
|
|
|
|
padding: 0;
|
|
|
|
|
|
}
|
2026-01-27 15:41:29 +08:00
|
|
|
|
|
2026-02-01 16:41:17 +08:00
|
|
|
|
/* 打印机通常存在不可打印区:这里右侧预留30mm安全边距,避免右侧被裁 */
|
|
|
|
|
|
.waybill-container {
|
|
|
|
|
|
width: 241mm;
|
|
|
|
|
|
height: 140mm;
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
overflow: hidden;
|
2025-11-28 11:02:19 +08:00
|
|
|
|
}
|
2026-01-27 15:41:29 +08:00
|
|
|
|
|
2026-02-01 16:41:17 +08:00
|
|
|
|
.waybill-content {
|
|
|
|
|
|
--paper-width-mm: 241;
|
|
|
|
|
|
/* 右侧预留约30mm不可打印区:241 - 30 = 211 */
|
|
|
|
|
|
--content-width-mm: 211;
|
|
|
|
|
|
--offset-x-mm: 0;
|
|
|
|
|
|
--offset-y-mm: 0;
|
|
|
|
|
|
--scale: calc(var(--content-width-mm) / var(--paper-width-mm));
|
|
|
|
|
|
|
|
|
|
|
|
width: calc(var(--paper-width-mm) * 1mm);
|
|
|
|
|
|
transform-origin: top left;
|
|
|
|
|
|
transform: translate(calc(var(--offset-x-mm) * 1mm), calc(var(--offset-y-mm) * 1mm)) scale(var(--scale));
|
2025-11-28 11:02:19 +08:00
|
|
|
|
}
|
2026-01-27 15:41:29 +08:00
|
|
|
|
|
2026-02-01 16:41:17 +08:00
|
|
|
|
/* 打印时不要省略:允许换行并让行高/高度自适应 */
|
2025-11-28 11:02:19 +08:00
|
|
|
|
.waybill-table th,
|
|
|
|
|
|
.waybill-table td {
|
2026-02-01 16:41:17 +08:00
|
|
|
|
white-space: normal !important;
|
|
|
|
|
|
overflow: visible !important;
|
|
|
|
|
|
text-overflow: clip !important;
|
|
|
|
|
|
height: auto !important;
|
|
|
|
|
|
line-height: 1.2 !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.waybill-table input {
|
|
|
|
|
|
white-space: normal !important;
|
|
|
|
|
|
overflow: visible !important;
|
|
|
|
|
|
text-overflow: clip !important;
|
2025-11-28 11:02:19 +08:00
|
|
|
|
}
|
2026-01-27 15:41:29 +08:00
|
|
|
|
|
2025-11-28 11:02:19 +08:00
|
|
|
|
.waybill-footer {
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
align-items: flex-start;
|
|
|
|
|
|
gap: 15px;
|
|
|
|
|
|
}
|
2026-01-27 15:41:29 +08:00
|
|
|
|
|
2025-11-28 11:02:19 +08:00
|
|
|
|
.footer-item.inline {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
}
|
2026-01-27 15:41:29 +08:00
|
|
|
|
|
2025-11-28 11:02:19 +08:00
|
|
|
|
.label {
|
|
|
|
|
|
width: auto;
|
|
|
|
|
|
text-align: left;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-02-01 16:41:17 +08:00
|
|
|
|
</style>
|