修复业务模块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
+4 -4
View File
@@ -51,9 +51,9 @@ const formatGoodsQuantity = value => {
}; };
const getSecondCargoTypeName = item => const getSecondCargoTypeName = item =>
item?.cargoType ||
item?.secondCargoTypeName || item?.secondCargoTypeName ||
item?.secondCargoType || item?.secondCargoType ||
item?.cargoType ||
item?.goodsType || item?.goodsType ||
item?.type || item?.type ||
item?.cargoTypeName || item?.cargoTypeName ||
@@ -97,10 +97,10 @@ const formatGoodsInfo = row => {
const text = Object.entries(groups) const text = Object.entries(groups)
.map(([unit, group]) => { .map(([unit, group]) => {
const quantity = `${formatGoodsQuantity(group.quantity)}${unit}`; const quantity = formatGoodsQuantity(group.quantity);
return `${group.typeName}${group.count}种货物 | ${quantity}`; return `${group.typeName}${group.count}种货物 | ${quantity}${unit ? ` ${unit}` : ''}`;
}) })
.join('; '); .join(' ');
return text || row.goodsInfo || ''; return text || row.goodsInfo || '';
}; };
+1
View File
@@ -261,6 +261,7 @@ export const config = {
importUrl: '/blade-transport/waybill-manage/import-waybill-manage', importUrl: '/blade-transport/waybill-manage/import-waybill-manage',
defaultForm: { defaultForm: {
carrierType: '承运商', carrierType: '承运商',
transportType: 'road',
quantityUnit: '吨', quantityUnit: '吨',
priceUnit: '元/吨', priceUnit: '元/吨',
}, },
@@ -108,6 +108,24 @@
<span>{{ formatTransportPlanGoodsInfo(row) || '-' }}</span> <span>{{ formatTransportPlanGoodsInfo(row) || '-' }}</span>
</template> </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 }"> <template #departureAddress="{ row }">
<el-tooltip <el-tooltip
v-if="isTransportPlanPage || isWaybillDetailLayout" v-if="isTransportPlanPage || isWaybillDetailLayout"
@@ -2445,7 +2463,7 @@
{{ formatTransportPlanProvinceCityDistrict(row.departureAddress) }} {{ formatTransportPlanProvinceCityDistrict(row.departureAddress) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="状态" width="120"> <el-table-column label="状态" width="120" fixed="right">
<template #default="{ row }"> <template #default="{ row }">
<span <span
:class="['business-crud-page__transport-plan-waybill-status', row.statusClass]" :class="['business-crud-page__transport-plan-waybill-status', row.statusClass]"
@@ -5104,6 +5122,7 @@ import {
getList as getContractList, getList as getContractList,
} from '@/api/business/contract-manage'; } from '@/api/business/contract-manage';
import { getList as getProjectList } from '@/api/business/project-apply'; 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 { getList as getCommonRouteList } from '@/api/business/common-route';
import { import {
getDetail as getTransportPlanDetail, getDetail as getTransportPlanDetail,
@@ -5704,7 +5723,7 @@ export default {
return this.isTransportPlanPage && this.detailBox; return this.isTransportPlanPage && this.detailBox;
}, },
transportPlanGoodsText() { transportPlanGoodsText() {
const text = this.formatDetailValue(this.detailRow, 'goodsInfo'); const text = this.formatTransportPlanGoodsInfo(this.detailRow);
return text && text !== '-' ? text : '暂无货物信息'; return text && text !== '-' ? text : '暂无货物信息';
}, },
transportPlanDateRange() { transportPlanDateRange() {
@@ -6304,17 +6323,39 @@ export default {
return applyTableMenuWidth(nextOption, menuButtonCount); return applyTableMenuWidth(nextOption, menuButtonCount);
}, },
formatTransportPlanGoodsInfo(row = {}) { formatTransportPlanGoodsInfo(row = {}) {
if (row.goodsInfo || row.cargoInfo) return String(row.goodsInfo || row.cargoInfo);
const goodsRows = this.parseJsonArray(row.goodsJson); const goodsRows = this.parseJsonArray(row.goodsJson);
const goods = if (!goodsRows.length) return String(row.goodsInfo || row.cargoInfo || '');
goodsRows.find(item => (item.quantityUnit || item.cargoUnit || item.unit) === '吨') || const groups = goodsRows.reduce((result, item = {}) => {
goodsRows[0] || const unit = item.quantityUnit || item.goodsQuantityUnit || item.cargoUnit || item.unit || '';
{}; const key = unit || '__empty__';
const name = goods.cargoName || goods.goodsName || goods.name || ''; if (!result[key]) {
const type = goods.cargoType || goods.goodsType || goods.typeName || ''; result[key] = {
const quantity = goods.quantity ?? goods.cargoQuantity ?? goods.goodsQuantity ?? ''; typeName:
const unit = goods.quantityUnit || goods.cargoUnit || goods.unit || ''; item.secondCargoTypeName ||
return [name, type, quantity === '' ? '' : `${quantity}${unit}`].filter(Boolean).join('/'); 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) { formatTransportPlanDistrictAddress(value) {
const text = String(value || '').trim(); const text = String(value || '').trim();
@@ -6836,6 +6877,24 @@ export default {
this.detailLoading = false; 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) { loadWaybillDetailProcessNodes(projectId) {
this.waybillDetailProcessNodes = []; this.waybillDetailProcessNodes = [];
if (!projectId) return Promise.resolve([]); if (!projectId) return Promise.resolve([]);
@@ -11864,9 +11923,9 @@ export default {
const sourceRows = goodsRows.length ? goodsRows : itemGoodsRows.length ? itemGoodsRows : [item]; const sourceRows = goodsRows.length ? goodsRows : itemGoodsRows.length ? itemGoodsRows : [item];
const groups = sourceRows.reduce((result, goods = {}) => { const groups = sourceRows.reduce((result, goods = {}) => {
const cargoType = const cargoType =
goods.cargoType ||
goods.secondCargoTypeName || goods.secondCargoTypeName ||
goods.secondCargoType || goods.secondCargoType ||
goods.cargoType ||
goods.goodsType || goods.goodsType ||
goods.type || goods.type ||
plan.cargoType || plan.cargoType ||
@@ -11892,7 +11951,7 @@ export default {
group => group =>
`${group.cargoType}${group.count}种货物 | ${this.formatDispatchQuantity( `${group.cargoType}${group.count}种货物 | ${this.formatDispatchQuantity(
group.quantity group.quantity
)}${group.unit || ''}` )}${group.unit ? ` ${group.unit}` : ''}`
) )
.join(' '); .join(' ');
return cargoInfo || plan.goodsInfo || ''; return cargoInfo || plan.goodsInfo || '';
+22 -17
View File
@@ -583,6 +583,7 @@
clearable clearable
filterable filterable
placeholder="请选择" placeholder="请选择"
:disabled="dialogMode === 'add'"
@visible-change="visible => visible && loadTransportTypeOptions()" @visible-change="visible => visible && loadTransportTypeOptions()"
> >
<el-option <el-option
@@ -841,13 +842,13 @@
<el-form-item label="车牌号" required> <el-form-item label="车牌号" required>
<el-input v-model="dialogForm.vehicleNo" clearable placeholder="请输入" /> <el-input v-model="dialogForm.vehicleNo" clearable placeholder="请输入" />
</el-form-item> </el-form-item>
<el-form-item label="挂车车牌号"> <el-form-item v-if="dialogForm.carrierType !== '承运商'" label="挂车车牌号">
<el-input v-model="dialogForm.trailerVehicleNo" clearable placeholder="请输入" /> <el-input v-model="dialogForm.trailerVehicleNo" clearable placeholder="请输入" />
</el-form-item> </el-form-item>
<el-form-item label="押运人"> <el-form-item v-if="dialogForm.carrierType !== '承运商'" label="押运人">
<el-input v-model="dialogForm.escortName" clearable placeholder="请输入" /> <el-input v-model="dialogForm.escortName" clearable placeholder="请输入" />
</el-form-item> </el-form-item>
<el-form-item label="押运人手机号"> <el-form-item v-if="dialogForm.carrierType !== '承运商'" label="押运人手机号">
<el-input v-model="dialogForm.escortPhone" clearable placeholder="请输入" /> <el-input v-model="dialogForm.escortPhone" clearable placeholder="请输入" />
</el-form-item> </el-form-item>
<el-form-item label="里程(km)"> <el-form-item label="里程(km)">
@@ -1035,7 +1036,7 @@ const createDialogForm = () => ({
batchNo: '', batchNo: '',
currentProcessNode: '接单', currentProcessNode: '接单',
mileage: '', mileage: '',
estimatedStartDate: dayjs().format('YYYY-MM-DD'), estimatedStartDate: '',
estimatedEndDate: '', estimatedEndDate: '',
taskRemark: '', taskRemark: '',
goodsJson: '', goodsJson: '',
@@ -1195,6 +1196,13 @@ export default {
mounted() { mounted() {
this.loadTransportTypeOptions(); this.loadTransportTypeOptions();
this.loadTable(); this.loadTable();
const detailId = this.$route.query.detailId;
if (detailId) this.openLoadingDialog('view', { id: detailId });
},
watch: {
'$route.query.detailId'(detailId) {
if (detailId) this.openLoadingDialog('view', { id: detailId });
},
}, },
methods: { methods: {
buildQueryParams(form) { buildQueryParams(form) {
@@ -1403,6 +1411,7 @@ export default {
this.dialogVisible = true; this.dialogVisible = true;
this.dialogLoading = true; this.dialogLoading = true;
this.resetDialogData(); this.resetDialogData();
if (mode === 'add') this.candidateQuery.transportType = 'road';
try { try {
if (row?.id) { if (row?.id) {
const res = await loadingApi.getDetail(row.id); const res = await loadingApi.getDetail(row.id);
@@ -1423,6 +1432,7 @@ export default {
} else { } else {
this.dialogForm = createDialogForm(); this.dialogForm = createDialogForm();
this.candidateQuery = createCandidateSearchForm(); this.candidateQuery = createCandidateSearchForm();
this.candidateQuery.transportType = 'road';
await this.loadCandidateWaybills(); await this.loadCandidateWaybills();
} }
} finally { } finally {
@@ -1453,6 +1463,7 @@ export default {
}, },
clearLoadingDialog() { clearLoadingDialog() {
this.resetDialogData(); this.resetDialogData();
if (this.dialogMode === 'add') this.candidateQuery.transportType = 'road';
this.loadCandidateWaybills(); this.loadCandidateWaybills();
}, },
restoreRouteAndCargo() { restoreRouteAndCargo() {
@@ -1702,6 +1713,7 @@ export default {
...this.buildQueryParams(this.candidateQuery), ...this.buildQueryParams(this.candidateQuery),
businessStatus: 'pending', businessStatus: 'pending',
onlyUnassignedLoading: 1, onlyUnassignedLoading: 1,
...(this.dialogMode === 'add' ? { transportType: 'road' } : {}),
} }
); );
const page = unwrapPage(res); const page = unwrapPage(res);
@@ -1721,6 +1733,7 @@ export default {
}, },
handleCandidateReset() { handleCandidateReset() {
this.candidateQuery = createCandidateSearchForm(); this.candidateQuery = createCandidateSearchForm();
if (this.dialogMode === 'add') this.candidateQuery.transportType = 'road';
this.candidatePage.currentPage = 1; this.candidatePage.currentPage = 1;
this.loadCandidateWaybills(); this.loadCandidateWaybills();
}, },
@@ -1788,18 +1801,6 @@ export default {
if (!this.dialogForm.transportType) { if (!this.dialogForm.transportType) {
this.dialogForm.transportType = rows.find(row => row.transportType)?.transportType || ''; this.dialogForm.transportType = rows.find(row => row.transportType)?.transportType || '';
} }
if (!this.dialogForm.carrierName) {
this.dialogForm.carrierName = rows.find(row => row.carrierName)?.carrierName || '';
}
if (!this.dialogForm.driverName) {
this.dialogForm.driverName = rows.find(row => row.driverName)?.driverName || '';
}
if (!this.dialogForm.driverPhone) {
this.dialogForm.driverPhone = rows.find(row => row.driverPhone)?.driverPhone || '';
}
if (!this.dialogForm.vehicleNo) {
this.dialogForm.vehicleNo = rows.find(row => row.vehicleNo)?.vehicleNo || '';
}
if (rebuildRoute) { if (rebuildRoute) {
this.routeNodes = this.buildRouteNodes(rows); this.routeNodes = this.buildRouteNodes(rows);
} }
@@ -2057,7 +2058,11 @@ export default {
}); });
}, },
handleCarrierTypeChange() { handleCarrierTypeChange() {
if (['自运', '网货平台'].includes(this.dialogForm.carrierType)) { if (this.dialogForm.carrierType === '承运商') {
this.dialogForm.trailerVehicleNo = '';
this.dialogForm.escortName = '';
this.dialogForm.escortPhone = '';
} else if (['自运', '网货平台'].includes(this.dialogForm.carrierType)) {
this.dialogForm.carrierName = ''; this.dialogForm.carrierName = '';
} }
}, },