优化项目细节和sql查询

This commit is contained in:
xuqiuyun
2025-11-28 17:12:36 +08:00
parent 128a4b2c6b
commit e968fcf52a
24 changed files with 1928 additions and 694 deletions

View File

@@ -33,8 +33,8 @@
</template>
<el-descriptions :column="4" border size="large">
<el-descriptions-item label="运单号">{{ data.baseInfo.deliveryNumber || '-' }}</el-descriptions-item>
<el-descriptions-item label="卖方">{{ data.baseInfo.supplierName || '-' }}</el-descriptions-item>
<el-descriptions-item label="买方">{{ data.baseInfo.buyerName || '-' }}</el-descriptions-item>
<el-descriptions-item label="卖方">{{ getSupplierName() }}</el-descriptions-item>
<el-descriptions-item label="买方">{{ getBuyerName() }}</el-descriptions-item>
<el-descriptions-item label="车牌号">{{ data.baseInfo.licensePlate || '-' }}</el-descriptions-item>
<el-descriptions-item label="司机姓名">{{ data.baseInfo.driverName || '-' }}</el-descriptions-item>
<el-descriptions-item label="起始地">{{ data.baseInfo.startLocation || '-' }}</el-descriptions-item>
@@ -85,18 +85,41 @@
<!-- 重量信息分组 -->
<div v-if="hasValue(data.baseInfo.emptyWeight) || hasValue(data.baseInfo.entruckWeight) || hasValue(data.baseInfo.landingEntruckWeight)" class="info-group">
<div class="sub-title">重量信息</div>
<el-descriptions :column="3" border>
<el-descriptions-item v-if="hasValue(data.baseInfo.emptyWeight)" label="空车过磅重量">
{{ data.baseInfo.emptyWeight }}kg
</el-descriptions-item>
<el-descriptions-item v-if="hasValue(data.baseInfo.entruckWeight)" label="装车过磅重量">
{{ data.baseInfo.entruckWeight }}kg
</el-descriptions-item>
<el-descriptions-item v-if="hasValue(data.baseInfo.landingEntruckWeight)" label="落地过磅重量">
{{ data.baseInfo.landingEntruckWeight }}kg
</el-descriptions-item>
</el-descriptions>
<div class="card-header">
<span class="header-title">重量信息</span>
</div>
<div class="weight-info-container">
<!-- 基础重量信息 -->
<div class="weight-basic-info">
<el-descriptions :column="3" border size="large">
<el-descriptions-item v-if="hasValue(data.baseInfo.emptyWeight)" label="空车过磅重量">
{{ data.baseInfo.emptyWeight }}kg
</el-descriptions-item>
<el-descriptions-item v-if="hasValue(data.baseInfo.entruckWeight)" label="装车过磅重量">
{{ data.baseInfo.entruckWeight }}kg
</el-descriptions-item>
<el-descriptions-item v-if="hasValue(data.baseInfo.landingEntruckWeight)" label="落地过磅重量">
{{ data.baseInfo.landingEntruckWeight }}kg
</el-descriptions-item>
</el-descriptions>
</div>
<!-- 计算重量信息 -->
<div class="weight-calculated-info">
<el-descriptions :column="3" border size="large">
<el-descriptions-item v-if="departureCattleWeight !== null" label="发车牛只重量">
<span class="calculated-value">{{ departureCattleWeight }}kg</span>
</el-descriptions-item>
<el-descriptions-item v-if="landingCattleWeight !== null" label="落地牛只重量">
<span class="calculated-value">{{ landingCattleWeight }}kg</span>
</el-descriptions-item>
<el-descriptions-item v-if="weightLoss !== null" label="损耗">
<span class="calculated-value loss-value" :class="{ 'positive-loss': weightLoss < 0, 'negative-loss': weightLoss > 0 }">
{{ weightLoss > 0 ? '-' : weightLoss < 0 ? '+' : '' }}{{ Math.abs(weightLoss) }}kg
</span>
</el-descriptions-item>
</el-descriptions>
</div>
</div>
</div>
<!-- 照片信息分组 -->
@@ -185,7 +208,7 @@
/>
</div>
<div class="media-item" v-if="hasValue(data.baseInfo.destinationPoundListImg)">
<div class="media-label">地纸质磅单</div>
<div class="media-label">地纸质磅单</div>
<el-image
class="photo-img"
:src="data.baseInfo.destinationPoundListImg"
@@ -195,7 +218,7 @@
/>
</div>
<div class="media-item" v-if="hasValue(data.baseInfo.destinationVehicleFrontPhoto)">
<div class="media-label">地过重磅车头</div>
<div class="media-label">地过重磅车头</div>
<el-image
class="photo-img"
:src="data.baseInfo.destinationVehicleFrontPhoto"
@@ -236,7 +259,7 @@
<video controls :src="data.baseInfo.unloadCattleVideo" />
</div>
<div class="media-item video-item" v-if="hasValue(data.baseInfo.destinationWeightVideo)">
<div class="media-label">地过磅视频</div>
<div class="media-label">地过磅视频</div>
<video controls :src="data.baseInfo.destinationWeightVideo" />
</div>
</div>
@@ -1119,6 +1142,40 @@ const getStatusType = (status) => {
};
// 判断字段是否有有效值(用于隐藏空值字段)
// 计算发车牛只重量(装车过磅重量 - 空车过磅重量)
const departureCattleWeight = computed(() => {
const emptyWeight = parseFloat(data.baseInfo.emptyWeight);
const entruckWeight = parseFloat(data.baseInfo.entruckWeight);
if (!isNaN(emptyWeight) && !isNaN(entruckWeight) && emptyWeight > 0 && entruckWeight > 0) {
const result = entruckWeight - emptyWeight;
return result > 0 ? result.toFixed(2) : null;
}
return null;
});
// 计算落地牛只重量(落地过磅重量 - 空车过磅重量)
const landingCattleWeight = computed(() => {
const emptyWeight = parseFloat(data.baseInfo.emptyWeight);
const landingWeight = parseFloat(data.baseInfo.landingEntruckWeight);
if (!isNaN(emptyWeight) && !isNaN(landingWeight) && emptyWeight > 0 && landingWeight > 0) {
const result = landingWeight - emptyWeight;
return result > 0 ? result.toFixed(2) : null;
}
return null;
});
// 计算损耗(发车牛只重量 - 落地牛只重量)
// 正数表示损耗(减少),负数表示增重(增加)
const weightLoss = computed(() => {
const departure = departureCattleWeight.value;
const landing = landingCattleWeight.value;
if (departure !== null && landing !== null) {
const result = parseFloat(departure) - parseFloat(landing);
return result.toFixed(2);
}
return null;
});
const hasValue = (value) => {
if (value === null || value === undefined) {
return false;
@@ -1129,6 +1186,26 @@ const hasValue = (value) => {
return true;
};
// 获取卖方名称:如果是从订单页面进入的,使用订单的卖方;否则显示 '-'
const getSupplierName = () => {
// 检查是否从订单页面进入(通过路由参数 fromOrder 判断)
if (route.query.fromOrder === 'true' && route.query.sellerName) {
return route.query.sellerName;
}
// 不是从订单页面进入的,直接显示 '-'
return '-';
};
// 获取买方名称:如果是从订单页面进入的,使用订单的买方;否则显示 '-'
const getBuyerName = () => {
// 检查是否从订单页面进入(通过路由参数 fromOrder 判断)
if (route.query.fromOrder === 'true' && route.query.buyerName) {
return route.query.buyerName;
}
// 不是从订单页面进入的,直接显示 '-'
return '-';
};
onMounted(() => {
data.id = route.query.id;
data.status = route.query.status;
@@ -1260,6 +1337,44 @@ onMounted(() => {
}
}
.weight-info-container {
display: flex;
flex-direction: row;
gap: 20px;
flex-wrap: wrap;
}
.weight-basic-info,
.weight-calculated-info {
flex: 1;
min-width: 400px;
}
.weight-calculated-info {
.calculated-value {
font-weight: 600;
font-size: 16px;
color: #303133;
}
.loss-value {
&.positive-loss {
color: #67c23a; // 绿色表示增重
}
&.negative-loss {
color: #f56c6c; // 红色表示损耗
}
}
}
@media (max-width: 1200px) {
.weight-basic-info,
.weight-calculated-info {
min-width: 100%;
}
}
.media-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));