目前还差物联网分配问题

This commit is contained in:
xuqiuyun
2025-10-21 17:29:52 +08:00
parent 5fe7a5c48a
commit 0249dfc5bb
314 changed files with 91767 additions and 91 deletions

View File

@@ -87,7 +87,7 @@
link
v-if="scope.row.status == 4 || scope.row.status == 5"
v-hasPermi="['entry:download']"
@click="download(scope.row.zipUrl)"
@click="download(scope.row)"
:loading="downLoading[scope.row.id]"
style="padding: 0"
>下载文件</el-button
@@ -137,21 +137,29 @@ const formItemList = reactive([
param: 'licensePlate',
labelWidth: 65,
span: 7,
placeholder: '请输入完整车牌号',
},
{
label: '创建时间',
type: 'daterange',
type: 'date',
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD',
param: 'myTimes',
param: 'createTime',
labelWidth: 80,
span: 7,
placeholder: '请选择创建日期',
},
{
label: '核验状态',
type: 'select',
selectOptions: [
{ value: 1, text: '待核验' },
{ value: 2, text: '已核验' },
{ value: 1, text: '待装车' },
{ value: 2, text: '已装车/预付款已支付' },
{ value: 3, text: '已装车/尾款待支付' },
{ value: 4, text: '已核验/待买家付款' },
{ value: 5, text: '尾款已付款' },
{ value: 6, text: '发票待开/进项票' },
{ value: 7, text: '发票待开/销项' },
],
param: 'status',
span: 7,
@@ -177,12 +185,20 @@ const getDataList = () => {
};
params.interfaceType = 2;
// 安全处理时间参数
if (searchParams.myTimes && Array.isArray(searchParams.myTimes) && searchParams.myTimes.length > 0) {
params.startTime = searchParams.myTimes[0];
params.endTime = searchParams.myTimes[1];
// 处理精确的创建时间查询
if (searchParams.createTime) {
params.createTime = searchParams.createTime;
console.log('精确创建时间查询:', searchParams.createTime);
}
// 处理精确的车牌号查询
if (searchParams.licensePlate) {
params.licensePlate = searchParams.licensePlate.trim();
console.log('精确车牌号查询:', params.licensePlate);
}
console.log('查询参数:', params);
inspectionList(params)
.then((ret) => {
console.log('入境检疫列表返回结果:', ret);
@@ -202,6 +218,22 @@ const getDataList = () => {
driverName: firstRow.driverName,
licensePlate: firstRow.licensePlate
});
// 检查Word导出所需字段
console.log('Word导出字段检查:', {
supplierName: firstRow.supplierName,
buyerName: firstRow.buyerName,
startLocation: firstRow.startLocation,
createTime: firstRow.createTime,
endLocation: firstRow.endLocation,
driverName: firstRow.driverName,
driverMobile: firstRow.driverMobile,
licensePlate: firstRow.licensePlate,
ratedQuantity: firstRow.ratedQuantity,
landingEntruckWeight: firstRow.landingEntruckWeight,
emptyWeight: firstRow.emptyWeight,
firmPrice: firstRow.firmPrice
});
}
})
.catch(() => {
@@ -219,19 +251,263 @@ const details = (row, length) => {
},
});
};
// 下载文件
const download = (url) => {
window.location.href = url;
// 下载文件 - 生成HTML文档可打印为PDF或Word
const download = async (row) => {
try {
downLoading[row.id] = true;
// 计算字段
const landingWeight = parseFloat(row.landingEntruckWeight || 0);
const emptyWeight = parseFloat(row.emptyWeight || 0);
const totalWeight = ((landingWeight - emptyWeight) / 2).toFixed(2);
const unitPrice = (parseFloat(row.firmPrice || 0) / 2).toFixed(2);
const totalAmount = (parseFloat(totalWeight) * parseFloat(unitPrice)).toFixed(2);
// 准备数据 - 使用回退机制
const data = {
supplierName: row.supplierName || row.supplierMobile || '',
buyerName: row.buyerName || row.buyerMobile || '',
startLocation: row.startLocation || '',
createTime: row.createTime || '',
endLocation: row.endLocation || '',
driverName: row.driverName || '',
driverMobile: row.driverMobile || '',
licensePlate: row.licensePlate || '',
ratedQuantity: row.ratedQuantity || '',
totalWeight: totalWeight,
unitPrice: unitPrice,
totalAmount: totalAmount
};
console.log('生成Word文档数据:', data);
console.log('原始数据字段检查:', {
supplierName: row.supplierName,
buyerName: row.buyerName,
supplierMobile: row.supplierMobile,
buyerMobile: row.buyerMobile,
fundName: row.fundName,
fundMobile: row.fundMobile
});
// 生成HTML内容
const htmlContent = `
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>牛只发车验收单</title>
<style>
@media print {
body { margin: 0; }
.no-print { display: none; }
}
body {
font-family: "Microsoft YaHei", "SimSun", Arial, sans-serif;
margin: 20px;
line-height: 1.4;
}
.header {
text-align: center;
font-size: 20px;
font-weight: bold;
margin-bottom: 30px;
border-bottom: 2px solid #000;
padding-bottom: 10px;
}
.order-number {
text-align: right;
margin-bottom: 20px;
font-size: 14px;
}
.info-grid {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
font-size: 14px;
}
.info-grid td {
border: 1px solid #000;
padding: 10px;
vertical-align: top;
}
.info-grid .label {
background-color: #f5f5f5;
font-weight: bold;
width: 20%;
text-align: center;
}
.cattle-table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
font-size: 14px;
}
.cattle-table th, .cattle-table td {
border: 1px solid #000;
padding: 10px;
text-align: center;
}
.cattle-table th {
background-color: #f5f5f5;
font-weight: bold;
}
.signature-section {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
font-size: 14px;
}
.signature-section td {
border: 1px solid #000;
padding: 10px;
vertical-align: top;
}
.signature-section .label {
background-color: #f5f5f5;
font-weight: bold;
width: 25%;
text-align: center;
}
.print-button {
background-color: #409EFF;
color: white;
border: none;
padding: 10px 20px;
border-radius: 4px;
cursor: pointer;
margin: 20px 0;
}
.print-button:hover {
background-color: #66b1ff;
}
</style>
</head>
<body>
<div class="header">牛只发车验收单</div>
<div class="order-number">订单编号: </div>
<table class="info-grid">
<tr>
<td class="label">供货单位</td>
<td>${data.supplierName}</td>
<td class="label">收货单位</td>
<td>${data.buyerName}</td>
</tr>
<tr>
<td class="label">发车地点</td>
<td>${data.startLocation}</td>
<td class="label">发车时间</td>
<td>${data.createTime}</td>
</tr>
<tr>
<td class="label">到达地点</td>
<td>${data.endLocation}</td>
<td class="label">动物检疫合格证明编号</td>
<td></td>
</tr>
<tr>
<td class="label">司机姓名及联系方式</td>
<td>${data.driverName} ${data.driverMobile}</td>
<td class="label">装车车牌号</td>
<td>${data.licensePlate}</td>
</tr>
</table>
<table class="cattle-table">
<thead>
<tr>
<th>序号</th>
<th>活牛品种</th>
<th>单只体重范围 (斤)</th>
<th>下车总数量 (头)</th>
<th>下车总重量 (斤)</th>
<th>单价 (元/斤)</th>
<th>总金额 (元)</th>
<th>备注</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td>${data.ratedQuantity}</td>
<td>${data.totalWeight}</td>
<td>${data.unitPrice}</td>
<td>${data.totalAmount}</td>
<td></td>
</tr>
</tbody>
</table>
<table class="signature-section">
<tr>
<td class="label">已支付货款时间</td>
<td></td>
<td class="label">已支付货款金额</td>
<td></td>
</tr>
<tr>
<td class="label">应支付尾款时间</td>
<td></td>
<td class="label">应支付尾款金额</td>
<td></td>
</tr>
<tr>
<td class="label">验收结论</td>
<td></td>
<td class="label">验收时间</td>
<td></td>
</tr>
<tr>
<td class="label">供货单位指定验收人签字及联系方式</td>
<td></td>
<td class="label">收货单位指定验收人签字及联系方式</td>
<td></td>
</tr>
<tr>
<td class="label">供货单位盖章</td>
<td></td>
<td class="label">收货单位盖章</td>
<td></td>
</tr>
</table>
<div class="no-print">
<button class="print-button" onclick="window.print()">打印/保存为PDF</button>
<p style="color: #666; font-size: 12px;">
提示:点击"打印/保存为PDF"按钮可以将此文档打印或保存为PDF格式。
在打印对话框中,您也可以选择"另存为PDF"来保存文档。
</p>
</div>
</body>
</html>`;
// 在新窗口中打开HTML文档
const newWindow = window.open('', '_blank');
newWindow.document.write(htmlContent);
newWindow.document.close();
ElMessage.success('文档已生成,可以在新窗口中查看和打印');
} catch (error) {
console.error('生成文档失败:', error);
ElMessage.error('生成文档失败,请重试');
} finally {
downLoading[row.id] = false;
}
};
// 状态文本转换
const getStatusText = (status) => {
const statusMap = {
1: '待装车',
2: '已装车/待资金方付款',
3: '待核验/资金方已付款',
2: '已装车/预付款已支付',
3: '已装车/尾款待支付',
4: '已核验/待买家付款',
5: '买家已付款'
5: '尾款已付款',
6: '发票待开/进项票',
7: '发票待开/销项'
};
return statusMap[status] || '未知状态';
};
@@ -240,10 +516,12 @@ const getStatusText = (status) => {
const getStatusTagType = (status) => {
const typeMap = {
1: 'warning', // 待装车 - 橙色
2: 'info', // 已装车/待资金方付款 - 蓝色
3: 'warning', // 待核验/资金方已付款 - 橙色
2: 'info', // 已装车/预付款已支付 - 蓝色
3: 'warning', // 已装车/尾款待支付 - 橙色
4: 'success', // 已核验/待买家付款 - 绿色
5: 'success' // 买家已付款 - 绿色
5: 'success', // 尾款已付款 - 绿色
6: 'info', // 发票待开/进项票 - 蓝色
7: 'info' // 发票待开/销项 - 蓝色
};
return typeMap[status] || 'info';
};

View File

@@ -88,6 +88,9 @@
<el-descriptions-item label="装车过磅重量:">{{
data.baseInfo.entruckWeight ? data.baseInfo.entruckWeight + 'kg' : ''
}}</el-descriptions-item>
<el-descriptions-item label="落地过磅重量:">{{
data.baseInfo.landingEntruckWeight ? data.baseInfo.landingEntruckWeight + 'kg' : ''
}}</el-descriptions-item>
<!-- 照片上传区域 -->
<el-descriptions-item label="检疫票:">