修复业务模块bug

This commit is contained in:
2026-08-14 14:46:05 +08:00
parent c6217fcff7
commit 230110c486
4 changed files with 101 additions and 36 deletions
@@ -108,6 +108,24 @@
<span>{{ formatTransportPlanGoodsInfo(row) || '-' }}</span>
</template>
<template #waybillNo="{ row }">
<el-link v-if="row.waybillNo" type="primary" @click.stop="openDetail(row)">
{{ row.waybillNo }}
</el-link>
<span v-else>-</span>
</template>
<template #loadingNo="{ row }">
<el-link
v-if="row.loadingNo"
type="primary"
@click.stop="openLoadingDetail(row)"
>
{{ row.loadingNo }}
</el-link>
<span v-else>-</span>
</template>
<template #departureAddress="{ row }">
<el-tooltip
v-if="isTransportPlanPage || isWaybillDetailLayout"
@@ -2445,7 +2463,7 @@
{{ formatTransportPlanProvinceCityDistrict(row.departureAddress) }}
</template>
</el-table-column>
<el-table-column label="状态" width="120">
<el-table-column label="状态" width="120" fixed="right">
<template #default="{ row }">
<span
:class="['business-crud-page__transport-plan-waybill-status', row.statusClass]"
@@ -5104,6 +5122,7 @@ import {
getList as getContractList,
} from '@/api/business/contract-manage';
import { getList as getProjectList } from '@/api/business/project-apply';
import { getList as getLoadingList } from '@/api/business/loading-manage';
import { getList as getCommonRouteList } from '@/api/business/common-route';
import {
getDetail as getTransportPlanDetail,
@@ -5704,7 +5723,7 @@ export default {
return this.isTransportPlanPage && this.detailBox;
},
transportPlanGoodsText() {
const text = this.formatDetailValue(this.detailRow, 'goodsInfo');
const text = this.formatTransportPlanGoodsInfo(this.detailRow);
return text && text !== '-' ? text : '暂无货物信息';
},
transportPlanDateRange() {
@@ -6304,17 +6323,39 @@ export default {
return applyTableMenuWidth(nextOption, menuButtonCount);
},
formatTransportPlanGoodsInfo(row = {}) {
if (row.goodsInfo || row.cargoInfo) return String(row.goodsInfo || row.cargoInfo);
const goodsRows = this.parseJsonArray(row.goodsJson);
const goods =
goodsRows.find(item => (item.quantityUnit || item.cargoUnit || item.unit) === '吨') ||
goodsRows[0] ||
{};
const name = goods.cargoName || goods.goodsName || goods.name || '';
const type = goods.cargoType || goods.goodsType || goods.typeName || '';
const quantity = goods.quantity ?? goods.cargoQuantity ?? goods.goodsQuantity ?? '';
const unit = goods.quantityUnit || goods.cargoUnit || goods.unit || '';
return [name, type, quantity === '' ? '' : `${quantity}${unit}`].filter(Boolean).join('/');
if (!goodsRows.length) return String(row.goodsInfo || row.cargoInfo || '');
const groups = goodsRows.reduce((result, item = {}) => {
const unit = item.quantityUnit || item.goodsQuantityUnit || item.cargoUnit || item.unit || '';
const key = unit || '__empty__';
if (!result[key]) {
result[key] = {
typeName:
item.secondCargoTypeName ||
item.secondCargoType ||
item.cargoType ||
item.goodsType ||
item.typeName ||
'货物',
count: 0,
quantity: 0,
unit,
};
}
result[key].count += 1;
result[key].quantity += this.parseDispatchQuantity(
item.quantity ?? item.cargoQuantity ?? item.goodsQuantity
);
return result;
}, {});
return Object.values(groups)
.map(group => {
const quantity = this.formatDispatchQuantity(group.quantity);
return `${group.typeName}${group.count}种货物 | ${quantity}${
group.unit ? ` ${group.unit}` : ''
}`;
})
.join(' ');
},
formatTransportPlanDistrictAddress(value) {
const text = String(value || '').trim();
@@ -6836,6 +6877,24 @@ export default {
this.detailLoading = false;
});
},
async openLoadingDetail(row = {}) {
let id = row.loadingId || row.loadingManageId || '';
if (!id && row.loadingNo) {
try {
const res = await getLoadingList(1, 1, { loadingNo: row.loadingNo });
const data = res?.data?.data || res?.data || res || {};
const records = data.records || data.rows || (Array.isArray(data) ? data : []);
id = records[0]?.id || '';
} catch (error) {
id = '';
}
}
if (!id) {
this.$message.info('当前配载单暂无详情数据');
return;
}
this.$router.push({ path: '/business/loading-manage', query: { detailId: id } });
},
loadWaybillDetailProcessNodes(projectId) {
this.waybillDetailProcessNodes = [];
if (!projectId) return Promise.resolve([]);
@@ -11864,9 +11923,9 @@ export default {
const sourceRows = goodsRows.length ? goodsRows : itemGoodsRows.length ? itemGoodsRows : [item];
const groups = sourceRows.reduce((result, goods = {}) => {
const cargoType =
goods.cargoType ||
goods.secondCargoTypeName ||
goods.secondCargoType ||
goods.cargoType ||
goods.goodsType ||
goods.type ||
plan.cargoType ||
@@ -11892,9 +11951,9 @@ export default {
group =>
`${group.cargoType}${group.count}种货物 | ${this.formatDispatchQuantity(
group.quantity
)}${group.unit || ''}`
)}${group.unit ? ` ${group.unit}` : ''}`
)
.join('');
.join(' ');
return cargoInfo || plan.goodsInfo || '';
},
dispatchGoodsRows(value) {