初次对接

This commit is contained in:
2025-04-08 00:14:08 +08:00
parent b7f32b6f09
commit 5465099c77
7 changed files with 275 additions and 316 deletions

View File

@@ -1,187 +1,131 @@
<template>
<div class="purchase-delivery-page">
<!-- 标题 -->
<h2 class="page-title">采购送货单</h2>
<!-- 上方两列区域含二维码和基本信息 -->
<table class="header-table">
<tr>
<!-- 左侧列 -->
<td class="qr-col">
<!-- 如果有二维码图片可替换为实际图片地址 -->
<img
class="qr-image"
:src="qrCodeLeft"
alt="二维码"
/>
</td>
<td class="info-col">
<div>
<label>收料通知单编号送货单号</label>
<span>{{ receivingNoticeNumberLeft }}</span>
</div>
<div>
<label>供应商名称</label>
<span>{{ supplierNameLeft }}</span>
</div>
<div>
<label>送货日期</label>
<span>{{ deliveryDateLeft }}</span>
</div>
<div>
<label>发票号</label>
<span>{{ invoiceNumberLeft }}</span>
</div>
</td>
<!-- 右侧列 -->
<td class="qr-col">
<img
class="qr-image"
:src="qrCodeRight"
alt="二维码"
/>
</td>
</tr>
</table>
<!-- 明细表格 -->
<table class="detail-table">
<thead>
<tr>
<th>序号</th>
<th>PO号</th>
<th>物料代码</th>
<th>物料名称</th>
<th>单位</th>
<th>PO数量</th>
<th>实收数量</th>
<th>美金单价</th>
<th>供应商批号</th>
</tr>
</thead>
<tbody>
<tr v-for="(row, index) in tableData" :key="index">
<td>{{ index + 1 }}</td>
<td>{{ row.poNumber }}</td>
<td>{{ row.materialCode }}</td>
<td>{{ row.materialName }}</td>
<td>{{ row.unit }}</td>
<td>{{ row.poQuantity }}</td>
<td>{{ row.receivedQuantity }}</td>
<td>{{ row.usdPrice }}</td>
<td>{{ row.supplierBatchNumber }}</td>
</tr>
</tbody>
</table>
</div>
<div class="orderPrinting" ref="orderPrintingRef">
<div class="title">采购送货单</div>
<div class="orderPrintingTop">
<div class="item item1"></div>
<div class="item item2">
<div class="dataText">
<span class="span1">收料通知单编号送货单号</span>
<span class="span2">123465</span>
</div>
<div class="dataText">
<span class="span1">供应商名称</span>
<span class="span2">123465</span>
</div>
<div class="dataText">
<span class="span1">送货日期</span>
<span class="span2">123465</span>
</div>
<div class="dataText">
<span class="span1">发票号</span>
<span class="span2">123465</span>
</div>
</div>
<div class="item item3"></div>
</div>
<avue-crud ref="crudRef" :data="state.data" :option="state.option"> </avue-crud>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
// ---------------------
// 示例数据,根据实际情况替换
// ---------------------
// 左侧二维码与信息
const qrCodeLeft = ref('https://via.placeholder.com/100?text=QR-Left')
const receivingNoticeNumberLeft = ref('RN-LEFT-123')
const supplierNameLeft = ref('供应商A')
const deliveryDateLeft = ref('2025-03-20')
const invoiceNumberLeft = ref('INV-LEFT-001')
// 右侧二维码与信息
const qrCodeRight = ref('https://via.placeholder.com/100?text=QR-Right')
// 明细数据
const tableData = ref([
{
poNumber: 'PO-001',
materialCode: 'M-001',
materialName: '物料名称1',
unit: 'PCS',
poQuantity: 100,
receivedQuantity: 95,
usdPrice: 1.25,
supplierBatchNumber: 'BATCH-001'
},
{
poNumber: 'PO-002',
materialCode: 'M-002',
materialName: '物料名称2',
unit: 'PCS',
poQuantity: 200,
receivedQuantity: 190,
usdPrice: 0.75,
supplierBatchNumber: 'BATCH-002'
}
])
import { reactive,ref } from 'vue';
const orderPrintingRef = ref()
const state = reactive({
option: {
tip: false,
index: false,
menuWidth: 120,
border: true,
delBtn: false,
editBtn: false,
align: 'center',
// searchLabelWidth:100,
selection: false,
searchMenuSpan: 3,
addBtn: false,
menu: false,
column: [
{ label: 'PO号', prop: 'purchaseOrderFBillNo' },
{ label: '物料代码', prop: 'sheet' },
{ label: '物料名称', prop: 'fBillNo' },
{ label: '单位', prop: 'mssSupplierLot' },
{ label: 'PO数量', prop: 'fSupplierLot' },
{ label: '实收数量', prop: 'materialCode' },
{ label: '美金单价', prop: 'materialName' },
{ label: '供应商批号', prop: 'sendedQty' },
],
},
data: [
{
purchaseOrderFBillNo: 1,
sheet: 1,
fBillNo: 1,
mssSupplierLot: 1,
fSupplierLot: 1,
materialCode: 1,
materialName: 1,
sendedQty: 1,
}
],
});
defineExpose({
orderPrintingRef
});
</script>
<style scoped lang="scss">
.purchase-delivery-page {
width: 100%;
margin: 0 auto;
font-family: sans-serif;
:deep(.avue-crud__header) {
display: none;
}
/* 标题样式 */
.page-title {
text-align: center;
padding: 1em 0;
border: 1px solid #ccc;
background-color: #DEEAF6;
:deep(.avue-crud__body) {
padding: 0 !important;
}
/* 头部表格 */
.header-table {
width: 100%;
border-collapse: collapse;
}
.orderPrinting {
width: 100%;
.header-table td {
border: 1px solid #ccc;
vertical-align: top;
padding: 8px;
/* 可根据需要调整宽度分配 */
width: 30%;
}
.title {
width: 100%;
height: 50px;
background-color: #deeaf6;
display: flex;
align-items: center;
justify-content: center;
font-size: 22px;
letter-spacing: 10px;
}
.qr-col {
text-align: center;
height: 200px;
width: 33.33%;
}
.info-col>*{
margin-top: 20px;
}
.qr-image {
width: 80px;
height: 80px;
display: block;
margin: 0 auto;
}
.orderPrintingTop {
height: 200px;
border: 1px solid #c2c4ca;
box-sizing: border-box;
display: flex;
.info-col label {
font-weight: bold;
}
.item1 {
width: 33.33%;
height: 199px;
border-right: 1px solid #c2c4ca;
}
/* 明细表格 */
.detail-table {
width: 100%;
border-collapse: collapse;
}
.item2 {
width: 33.33%;
height: 199px;
border-right: 1px solid #c2c4ca;
box-sizing: border-box;
padding: 16px;
.detail-table th,
.detail-table td {
border: 1px solid #ccc;
padding: 8px;
text-align: center;
}
.dataText {
font-size: 16px;
margin-bottom: 16px;
}
}
.detail-table th {
background-color: #f5f5f5;
.item2 {
width: 33.33%;
height: 199px;
//border-right: 1px solid black;
}
}
}
</style>

View File

@@ -126,7 +126,7 @@ const state = reactive({
selectedData: [],
chengNuoJiaoQiP: '',
newChengNuoJiaoQiP: '',
selectedDataShow: false,
selectedDataShow: true,
loading: false,
});
const selectionChange = (list: any) => {

View File

@@ -1,32 +1,56 @@
<template>
<el-dialog :model-value="props.showes" width="70%" >
<ceshi></ceshi>
<div class="btnList">
<el-button type="primary">打印</el-button>
</div>
</el-dialog>
<el-dialog :model-value="props.showes" width="70%">
<ceshi ref="ceshiRef"></ceshi>
<div class="btnList">
<el-button type="primary" @click="printElement">打印</el-button>
</div>
</el-dialog>
</template>
<script setup lang="ts">
import {defineProps, reactive} from 'vue';
import ceshi from './ceshi.vue'
import { defineProps, reactive, ref, nextTick } from 'vue';
import ceshi from './ceshi.vue';
import printJS from 'print-js';
const ceshiRef = ref(null);
const props = defineProps({
listData:{
type: Array,
default: () => []
},
showes:{
type: Boolean,
default: true
}
listData: {
type: Array,
default: () => [],
},
showes: {
type: Boolean,
default: true,
},
});
const state = reactive({
dialogVisible: true,
dialogVisible: true,
});
const printElement = () => {
// 获取 DOM 元素的 HTML
nextTick(() => {
console.log(ceshiRef.value.orderPrintingRef);
// // 使用 print-js 打印
printJS({
printable: ceshiRef.value.orderPrintingRef,
type: 'html', // 指定打印 HTML 内容
style: `
@page {
margin: 0;
size: auto;
}
@page :header, @page :footer {
display: none;
}
`,
});
});
};
</script>
<style scoped lang="scss">
.btnList{
margin-top: 26px;
display: flex;
justify-content: center;
.btnList {
margin-top: 26px;
display: flex;
justify-content: center;
}
</style>
</style>