Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/views/business/contract-manage.vue
This commit is contained in:
2026-09-03 15:45:29 +08:00
25 changed files with 22352 additions and 267 deletions
+3 -3
View File
@@ -201,7 +201,7 @@ export default {
},
onLoad() {
this.loading = true;
getList(this.page.currentPage, this.page.pageSize, this.query)
return getList(this.page.currentPage, this.page.pageSize, this.query)
.then(res => {
const pageData = res.data.data || {};
this.data = pageData.records || [];
@@ -268,10 +268,10 @@ export default {
this.mappingRows.map(item => ({ key: item.key, value: String(item.value || '').trim() }))
),
})
.then(() => {
.then(async () => {
this.$message.success('操作成功');
this.dialogVisible = false;
this.onLoad();
await this.onLoad();
})
.finally(() => {
this.submitLoading = false;
+1 -2
View File
@@ -555,9 +555,8 @@ export default {
editDisplay: false,
dicData: [
{ label: '全部', value: '' },
{ label: '初始化录入', value: '初始化录入' },
{ label: '批量导入', value: '批量导入' },
{ label: '手动入', value: '手动录入' },
{ label: '手动入', value: '手动录入' },
],
},
{
+16 -9
View File
@@ -150,7 +150,7 @@ export default {
};
const validateTelegraphCode = (rule, value, callback) => {
if (!/^[A-Z]{3}$/.test(String(value || '').toUpperCase())) {
callback(new Error('电报码格式不正确或已存在'));
callback(new Error('电报码格式不正确或已存在'));
} else {
callback();
}
@@ -246,12 +246,12 @@ export default {
change: ({ value }) => this.handleTmisChange(value),
},
{
label: '电报码',
label: '电报码',
prop: 'telegraphCode',
minWidth: 100,
maxlength: 3,
rules: [
{ required: true, message: '电报码格式不正确或已存在', trigger: 'blur' },
{ required: true, message: '电报码格式不正确或已存在', trigger: 'blur' },
{ validator: validateTelegraphCode, trigger: 'blur' },
],
change: ({ value }) => this.handleTelegraphChange(value),
@@ -454,9 +454,8 @@ export default {
editDisplay: false,
dicData: [
{ label: '全部', value: '' },
{ label: '初始化导入', value: '初始化导入' },
{ label: '批量', value: '批量' },
{ label: '手动', value: '手动' },
{ label: '批量导入', value: '批量' },
{ label: '手动导入', value: '手动' },
],
},
],
@@ -695,13 +694,13 @@ export default {
return Promise.reject(new Error('该TMIS编码已存在'));
}
if (telegraphExists) {
return Promise.reject(new Error('电报码格式不正确或已存在'));
return Promise.reject(new Error('电报码格式不正确或已存在'));
}
return Promise.resolve();
});
},
handleSubmitError(error, loading) {
const uniqueMessages = ['该TMIS编码已存在', '电报码格式不正确或已存在'];
const uniqueMessages = ['该TMIS编码已存在', '电报码格式不正确或已存在'];
if (uniqueMessages.includes(error.message)) {
this.$message.warning(error.message);
}
@@ -782,10 +781,18 @@ export default {
});
},
beforeOpen(done, type) {
const tmisCodeColumn = this.findColumn('tmisCode');
if (tmisCodeColumn) {
// Avue 会复用列配置,打开不同记录前必须先清除上一次编辑状态。
tmisCodeColumn.disabled = false;
}
if (['edit', 'view'].includes(type)) {
this.regionInitializing = true;
getDetail(this.form.id).then(res => {
const detail = this.normalizeRegionForm(res.data.data || {});
if (tmisCodeColumn) {
tmisCodeColumn.disabled = type === 'edit' && Number(detail.status) === 1;
}
this.loadCityOptions(detail.provinceCode)
.then(() => {
this.ensureCityOption(detail);
@@ -851,7 +858,7 @@ export default {
});
},
handleImport() {
openImportDialog(this, '铁路车站主数据');
openImportDialog(this, '铁路车站主数据', () => this.onLoad(this.page, this.query));
},
handleExport() {
this.$confirm('是否导出铁路车站主数据?', '提示', {
+26 -23
View File
@@ -4,7 +4,11 @@
<div class="box">
<el-scrollbar>
<basic-container>
<avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick" />
<avue-tree
:option="treeOption"
:data="treeData"
@node-click="nodeClick"
/>
</basic-container>
</el-scrollbar>
</div>
@@ -27,20 +31,8 @@
<el-option label="区县" :value="3" />
</el-select>
</el-form-item>
<el-form-item label="数据来源">
<el-select v-model="searchForm.dataSource" clearable placeholder="请选择" style="width: 200px;">
<el-option label="手动录入" value="手动录入" />
<el-option label="初始化导入" value="初始化导入" />
</el-select>
</el-form-item>
</div>
<div style="display: flex; flex-direction: row; align-items: center; justify-content: space-between;">
<el-form-item label="启停状态">
<el-select v-model="searchForm.status" clearable placeholder="请选择" style="width: 200px;">
<el-option label="启用" :value="1" />
<el-option label="停用" :value="2" />
</el-select>
</el-form-item>
<div style="display: flex; flex-direction: row; align-items: center; justify-content: flex-end;">
<el-form-item class="region-page__search-actions">
<el-button type="primary" @click="handleSearch">搜索</el-button>
<el-button @click="handleSearchReset">清空</el-button>
@@ -180,8 +172,6 @@ export default {
code: '',
name: '',
regionLevel: undefined,
dataSource: '',
status: undefined,
},
parentOptions: [],
syncLoading: false,
@@ -203,6 +193,7 @@ export default {
},
addBtn: false,
menu: false,
defaultExpandAll: false,
size: 'default',
props: {
labelText: '标题',
@@ -458,7 +449,13 @@ export default {
});
});
},
hasSearchCriteria() {
return Object.values(this.searchForm).some(
value => value !== '' && value !== undefined && value !== null
);
},
handleSearch() {
this.treeOption.defaultExpandAll = this.hasSearchCriteria();
this.initTree();
this.regionForm = {};
},
@@ -467,8 +464,6 @@ export default {
code: '',
name: '',
regionLevel: undefined,
dataSource: '',
status: undefined,
};
this.handleSearch();
},
@@ -507,6 +502,10 @@ export default {
this.$message.warning('请先选择一项区划');
return;
}
if (Number(this.regionForm.regionLevel) >= 3) {
this.$message.warning('区县已是末级,不能新增下级');
return;
}
const parentCode = this.regionForm.code;
const parentName = this.regionForm.name;
const parentGroupCode = this.regionForm.parentCode || this.topCode;
@@ -517,8 +516,7 @@ export default {
this.regionForm.subCode = '';
this.regionForm.originalCode = '';
this.regionForm.name = '';
this.regionForm.regionLevel =
this.regionForm.regionLevel === 5 ? 5 : this.regionForm.regionLevel + 1;
this.regionForm.regionLevel = Number(this.regionForm.regionLevel) + 1;
this.loadParentOptionsByGroup(parentGroupCode, parentCode, parentName);
},
setRegionColumnDisplay(prop, display) {
@@ -637,9 +635,14 @@ export default {
},
handleImport() {
this.syncImportAction();
openImportDialog(this, '行政区划', () => {
this.initTree();
});
openImportDialog(
this,
'行政区划',
() => {
this.initTree();
},
{ timeout: 180000 }
);
},
syncImportAction() {
const column = this.findColumn(this.excelOption.column, 'excelFile');
@@ -2265,7 +2265,7 @@
</div>
<div class="business-crud-page__transport-plan-detail-field">
<span>合同编号</span>
<strong>{{ detailRow.contractNo || detailRow.contractName || '-' }}</strong>
<strong>{{ detailRow.contractNo || '-' }}</strong>
</div>
<div class="business-crud-page__transport-plan-detail-field">
<span>货物信息</span>
@@ -3339,7 +3339,7 @@
<div class="business-crud-page__dispatch-summary-item">
<div class="business-crud-page__dispatch-summary-label">合同编号</div>
<div class="business-crud-page__dispatch-summary-value">
{{ dispatchRow.contractName || dispatchRow.contractNo || '-' }}
{{ dispatchRow.contractNo || '-' }}
</div>
</div>
<div class="business-crud-page__dispatch-summary-item">
@@ -3389,7 +3389,11 @@
{{ parseDispatchRoutePoint(dispatchRow, 'start').name || '-' }}
</div>
<div class="business-crud-page__dispatch-route-address">
{{ parseDispatchRoutePoint(dispatchRow, 'start').address || '-' }}
{{
formatTransportPlanProvinceCityDistrict(
parseDispatchRoutePoint(dispatchRow, 'start').address
)
}}
</div>
<div class="business-crud-page__dispatch-route-contact">
{{ parseDispatchRoutePoint(dispatchRow, 'start').contact || '-' }}
@@ -3406,7 +3410,11 @@
{{ parseDispatchRoutePoint(dispatchRow, 'end').name || '-' }}
</div>
<div class="business-crud-page__dispatch-route-address">
{{ parseDispatchRoutePoint(dispatchRow, 'end').address || '-' }}
{{
formatTransportPlanProvinceCityDistrict(
parseDispatchRoutePoint(dispatchRow, 'end').address
)
}}
</div>
<div class="business-crud-page__dispatch-route-contact">
{{ parseDispatchRoutePoint(dispatchRow, 'end').contact || '-' }}
@@ -3867,7 +3875,7 @@
</el-form-item>
<el-form-item v-if="dispatchCarrierRequired" :label="dispatchCarrierLabel" required>
<el-select
v-model="dispatchItemForm.carrierName"
v-model="dispatchCarrierSelection"
:placeholder="`请选择${dispatchCarrierLabel}`"
filterable
clearable
@@ -3880,8 +3888,8 @@
:key="
item.id || item.customerName || item.carrierName || item.fullName || item.name
"
:label="item.customerName || item.carrierName || item.fullName || item.name"
:value="item.customerName || item.carrierName || item.fullName || item.name"
:label="item.label || item.customerName || item.carrierName || item.fullName || item.name"
:value="dispatchIsCarrierMode ? item.carrierContractId : item.value || item.customerName || item.carrierName || item.fullName || item.name"
/>
</el-select>
</el-form-item>
@@ -4086,7 +4094,7 @@
</el-form-item>
<el-form-item v-if="dispatchCarrierRequired" :label="dispatchCarrierLabel" required>
<el-select
v-model="dispatchItemForm.carrierName"
v-model="dispatchCarrierSelection"
:placeholder="`请选择${dispatchCarrierLabel}`"
filterable
clearable
@@ -4099,8 +4107,8 @@
:key="
item.id || item.customerName || item.carrierName || item.fullName || item.name
"
:label="item.customerName || item.carrierName || item.fullName || item.name"
:value="item.customerName || item.carrierName || item.fullName || item.name"
:label="item.label || item.customerName || item.carrierName || item.fullName || item.name"
:value="dispatchIsCarrierMode ? item.carrierContractId : item.value || item.customerName || item.carrierName || item.fullName || item.name"
/>
</el-select>
</el-form-item>
@@ -5446,6 +5454,7 @@ const defaultDispatchRow = () => ({
transportType: '',
carrierType: '承运商',
carrierId: '',
carrierContractId: '',
carrierName: '',
driverId: '',
driverName: '',
@@ -6255,6 +6264,16 @@ export default {
dispatchCarrierLabel() {
return this.dispatchItemForm.carrierType === '网货平台' ? '承运方' : '承运商';
},
dispatchCarrierSelection: {
get() {
return this.dispatchIsCarrierMode
? this.dispatchItemForm.carrierContractId || ''
: this.dispatchItemForm.carrierName || '';
},
set(value) {
this.handleDispatchCarrierChange(value);
},
},
dispatchStationMode() {
return ['water', 'rail', 'air'].includes(this.dispatchTransportMode);
},
@@ -12226,6 +12245,8 @@ export default {
taskEntryMode: item.taskEntryMode || 'simple',
transportType: item.transportType || plan.transportType || '',
carrierType: item.carrierType || plan.carrierType || '承运商',
carrierId: item.carrierId || plan.carrierId || '',
carrierContractId: item.carrierContractId || plan.carrierContractId || '',
carrierName: item.carrierName || plan.carrierName || '',
driverName: item.driverName || plan.driverName || '',
driverPhone: item.driverPhone || plan.driverPhone || '',
@@ -12643,11 +12664,15 @@ export default {
this.dispatchItemForm.trailerVehicleNo = '';
this.dispatchItemForm.escortName = '';
this.dispatchItemForm.escortPhone = '';
} else if (!this.isDispatchCarrierRequired(nextValue)) {
this.dispatchItemForm.carrierId = '';
this.dispatchItemForm.carrierName = '';
} else {
this.dispatchItemForm.carrierContractId = '';
if (!this.isDispatchCarrierRequired(nextValue)) {
this.dispatchItemForm.carrierId = '';
this.dispatchItemForm.carrierName = '';
}
}
this.dispatchItemForm.carrierType = nextValue;
this.loadDispatchCarrierOptions(this.dispatchRow);
},
isDispatchCarrierRequired(carrierType) {
return ['承运商', '网货平台'].includes(String(carrierType || '').trim());
@@ -12708,22 +12733,61 @@ export default {
if (this.dispatchCarrierLoading) return Promise.resolve(this.dispatchCarrierOptions);
const projectId = plan?.projectId;
const requestId = ++this.dispatchCarrierRequestId;
const carrierTypeAtRequest = this.dispatchItemForm.carrierType || '承运商';
const project = this.projectOptions.find(item => String(item.id) === String(projectId));
this.dispatchCarrierOptions = this.getProjectCarrierOptions({ ...project, ...plan });
if (!projectId) return Promise.resolve(this.dispatchCarrierOptions);
this.dispatchCarrierLoading = true;
return getProjectDetail(projectId)
.then(res => {
if (requestId !== this.dispatchCarrierRequestId) return this.dispatchCarrierOptions;
const detail = res?.data?.data || {};
this.dispatchCarrierOptions = this.getProjectCarrierOptions({
...project,
...plan,
...detail,
const carrierContractPromise = getContractList(1, 9999, {
projectId,
projectName: plan?.projectName || project?.projectName,
contractCategory: '承运商合同',
}).then(res => this.getWaybillCarrierContractOptions(extractRecords(res)));
if (carrierTypeAtRequest === '承运商') {
return carrierContractPromise
.then(options => {
if (requestId !== this.dispatchCarrierRequestId) return this.dispatchCarrierOptions;
this.dispatchCarrierOptions = options || [];
const current = this.dispatchCarrierOptions.find(
item =>
String(item.carrierContractId) ===
String(this.dispatchItemForm.carrierContractId || '')
);
if (current) {
this.dispatchItemForm.carrierName = current.carrierName;
} else if (!this.dispatchItemForm.carrierContractId) {
const matches = this.dispatchCarrierOptions.filter(
item => String(item.carrierName) === String(this.dispatchItemForm.carrierName || '')
);
if (matches.length === 1) {
this.dispatchItemForm.carrierContractId = matches[0].carrierContractId;
}
}
return this.dispatchCarrierOptions;
})
.catch(() => this.dispatchCarrierOptions)
.finally(() => {
if (requestId === this.dispatchCarrierRequestId) {
this.dispatchCarrierLoading = false;
}
});
return this.dispatchCarrierOptions;
})
.catch(() => this.dispatchCarrierOptions)
}
return Promise.all([
getProjectDetail(projectId)
.then(res => {
if (requestId !== this.dispatchCarrierRequestId) return this.dispatchCarrierOptions;
const detail = res?.data?.data || {};
this.dispatchCarrierOptions = this.getProjectCarrierOptions({
...project,
...plan,
...detail,
});
return this.dispatchCarrierOptions;
})
.catch(() => this.dispatchCarrierOptions),
carrierContractPromise.catch(() => []),
])
.then(([options]) => options)
.finally(() => {
if (requestId === this.dispatchCarrierRequestId) {
this.dispatchCarrierLoading = false;
@@ -12731,9 +12795,19 @@ export default {
});
},
handleDispatchCarrierChange(value) {
const carrier = this.dispatchCarrierOptions.find(item => item.value === String(value || ''));
const carrier = this.dispatchCarrierOptions.find(item => {
const optionValue = this.dispatchIsCarrierMode ? item.carrierContractId : item.value;
return String(optionValue || '') === String(value || '');
});
if (this.dispatchIsCarrierMode) {
this.dispatchItemForm.carrierContractId = carrier?.carrierContractId || '';
this.dispatchItemForm.carrierId = '';
this.dispatchItemForm.carrierName = carrier?.carrierName || '';
return;
}
this.dispatchItemForm.carrierContractId = '';
this.dispatchItemForm.carrierId = carrier?.id || '';
this.dispatchItemForm.carrierName = value || '';
this.dispatchItemForm.carrierName = carrier?.carrierName || value || '';
},
loadDispatchDriverOptions() {
if (this.taskDriverLoading) return Promise.resolve([]);
@@ -12837,7 +12911,54 @@ export default {
},
dispatchItemRemainingQuantity(row = {}) {
const unit = this.getDispatchQuantityUnit(row);
let remaining = this.getDispatchRemainingQuantity(unit);
const hasCargoIdentity = Boolean(
String(row.cargoName || row.goodsName || row.name || '').trim() ||
String(
row.cargoType || row.secondCargoTypeName || row.goodsType || row.type || ''
).trim()
);
const planGoodsRows = this.dispatchPlanGoodsRows;
const cargoKey = this.getDispatchCargoIdentity(row);
//
if (planGoodsRows.length && hasCargoIdentity) {
const matchedPlanRows = planGoodsRows.filter(
goods => this.getDispatchCargoIdentity(goods) === cargoKey
);
if (!matchedPlanRows.length) return 0;
const total = matchedPlanRows.reduce(
(sum, goods) =>
sum +
this.parseDispatchQuantity(
goods.quantity || goods.cargoQuantity || goods.goodsQuantity
),
0
);
const assigned = this.dispatchRows.reduce((sum, dispatchRow, index) => {
if (
index === this.dispatchItemIndex ||
!this.hasDispatchVehicleIdentifier(dispatchRow)
) {
return sum;
}
return (
sum +
this.getDispatchGoodsSourceRows(dispatchRow).reduce((goodsSum, goods) => {
if (this.getDispatchCargoIdentity(goods) !== cargoKey) return goodsSum;
return (
goodsSum +
this.parseDispatchQuantity(
goods.quantity || goods.cargoQuantity || goods.goodsQuantity
)
);
}, 0)
);
}, 0);
return Math.max(total - assigned, 0);
}
//
const remaining = this.getDispatchRemainingQuantity(unit);
const editingRow = this.dispatchRows[this.dispatchItemIndex];
if (!editingRow || !this.hasDispatchVehicleIdentifier(editingRow)) return remaining;
const editingGoodsRows = this.dispatchGoodsRows(editingRow.goodsJson);
@@ -12943,6 +13064,9 @@ export default {
if (this.isDispatchCarrierRequired(row.carrierType)) {
requiredFields.push(['carrierName', row.carrierType === '网货平台' ? '承运方' : '承运商']);
}
if (row.carrierType === '承运商') {
requiredFields.push(['carrierContractId', '承运商合同']);
}
const fullEntry = row.taskEntryMode === 'full';
const roadTransport = this.resolveTransportMode(row.transportType) === 'road';
if (fullEntry) {
@@ -13056,16 +13180,25 @@ export default {
? this.dispatchItemCargoRows
: [this.dispatchItemForm];
if (!this.validateDispatchItemData(this.dispatchItemForm, goodsRows)) return false;
const quantitiesByUnit = new Map();
const quantityGroups = new Map();
goodsRows.forEach(goods => {
const unit = this.getDispatchQuantityUnit(goods);
quantitiesByUnit.set(
unit,
(quantitiesByUnit.get(unit) || 0) + this.parseDispatchQuantity(goods.quantity)
const hasCargoIdentity = Boolean(
String(goods.cargoName || goods.goodsName || goods.name || '').trim() ||
String(
goods.cargoType || goods.secondCargoTypeName || goods.goodsType || goods.type || ''
).trim()
);
const key = hasCargoIdentity
? `cargo:${this.getDispatchCargoIdentity(goods)}`
: `unit:${unit}`;
const group = quantityGroups.get(key) || { row: goods, quantity: 0 };
group.quantity += this.parseDispatchQuantity(goods.quantity);
quantityGroups.set(key, group);
});
for (const [unit, quantity] of quantitiesByUnit.entries()) {
const remaining = this.dispatchItemRemainingQuantity({ quantityUnit: unit });
for (const { row: goods, quantity } of quantityGroups.values()) {
const unit = this.getDispatchQuantityUnit(goods);
const remaining = this.dispatchItemRemainingQuantity(goods);
if (quantity - remaining > 1e-8) {
this.$message.warning(
`本次调度${unit}合计不能超过剩余数量${this.formatDispatchQuantity(remaining)}${unit}`
@@ -134,7 +134,6 @@
<el-row v-if="route.freightItems.length" :gutter="16">
<el-col :span="6"><el-form-item label="运费合计"><el-input :model-value="formatAmount(freightTotal(route))" readonly><template #suffix>{{ currencyLabel(route.currency) }}</template></el-input></el-form-item></el-col>
<el-col :span="6"><el-form-item label="其他费用合计"><el-input :model-value="route.otherFeeTotal" inputmode="decimal" placeholder="请输入" @input="value => handleOtherFeeTotalInput(route, value)" /></el-form-item></el-col>
<el-col :span="6"><el-form-item label="币种"><el-select v-model="route.currency"><el-option label="人民币" value="CNY" /><el-option label="美元" value="USD" /><el-option label="欧元" value="EUR" /></el-select></el-form-item></el-col>
</el-row>
</el-form>
@@ -143,16 +142,16 @@
<el-form :model="route" label-position="right" label-width="auto" class="dispatch-form carrier-form">
<el-row :gutter="16">
<template v-if="isRoad(route)">
<el-col v-if="route.carrierType === '承运商'" :span="6"><el-form-item label="承运商" required><el-select v-model="route.carrierContractId" filterable clearable placeholder="请选择" :loading="carrierLoading" @change="value => handleCarrierContractChange(route, value)"><el-option v-for="item in carrierOptions" :key="item.contractId" :label="carrierOptionLabel(item)" :value="item.contractId" /></el-select></el-form-item></el-col>
<el-col :span="6"><el-form-item label="承运商" :required="route.carrierType === '承运商'"><el-select :model-value="route.carrierType === '承运商' ? route.carrierContractId : route.carrierName" filterable clearable placeholder="请选择" :loading="carrierLoading" @change="value => handleCarrierContractChange(route, value)"><el-option v-for="item in carrierOptions" :key="carrierOptionValue(item)" :label="carrierOptionLabel(item)" :value="route.carrierType === '承运商' ? carrierOptionValue(item) : item.carrierName" /></el-select></el-form-item></el-col>
<el-col :span="6"><el-form-item label="司机" :required="route.carrierType !== '承运商'"><el-autocomplete :ref="element => setDriverInput(route.segmentNo, element)" v-model="route.driverName" :debounce="300" :fetch-suggestions="fetchDriverSuggestions" clearable placeholder="请输入司机" :loading="driverLoading" @select="item => handleDriverSuggestionSelect(route, item)" /></el-form-item></el-col>
<el-col :span="6"><el-form-item :label="route.carrierType === '承运商' ? '手机号' : '司机手机号'" :required="route.carrierType !== '承运商'"><el-input v-model="route.driverPhone" placeholder="请输入" /></el-form-item></el-col>
<el-col :span="6"><el-form-item label="车牌号" required><el-input v-model="route.vehicleNo" placeholder="请输入" /></el-form-item></el-col>
<el-col v-if="route.carrierType !== '承运商'" :span="6"><el-form-item label="挂车车牌号" required><el-input v-model="route.trailerVehicleNo" placeholder="请输入" /></el-form-item></el-col>
<el-col v-if="route.carrierType !== '承运商'" :span="6"><el-form-item label="押运人" required><el-input v-model="route.escortName" placeholder="请输入" /></el-form-item></el-col>
<el-col v-if="route.carrierType !== '承运商'" :span="6"><el-form-item label="押运人手机号" required><el-input v-model="route.escortPhone" placeholder="请输入" /></el-form-item></el-col>
<el-col v-if="route.carrierType !== '承运商'" :span="6"><el-form-item label="挂车车牌号"><el-input v-model="route.trailerVehicleNo" placeholder="请输入" /></el-form-item></el-col>
<el-col v-if="route.carrierType !== '承运商'" :span="6"><el-form-item label="押运人"><el-autocomplete v-model="route.escortName" :debounce="300" :fetch-suggestions="fetchEscortSuggestions" clearable placeholder="请输入" :loading="escortLoading" @select="item => handleEscortSuggestionSelect(route, item)" /></el-form-item></el-col>
<el-col v-if="route.carrierType !== '承运商'" :span="6"><el-form-item label="押运人手机号"><el-input v-model="route.escortPhone" placeholder="请输入" /></el-form-item></el-col>
</template>
<template v-else>
<el-col v-if="route.carrierType === '承运商'" :span="6"><el-form-item label="承运商" required><el-select v-model="route.carrierContractId" filterable clearable placeholder="请选择" :loading="carrierLoading" @change="value => handleCarrierContractChange(route, value)"><el-option v-for="item in carrierOptions" :key="item.contractId" :label="carrierOptionLabel(item)" :value="item.contractId" /></el-select></el-form-item></el-col>
<el-col :span="6"><el-form-item label="承运商" :required="route.carrierType === '承运商'"><el-select :model-value="route.carrierType === '承运商' ? route.carrierContractId : route.carrierName" filterable clearable placeholder="请选择" :loading="carrierLoading" @change="value => handleCarrierContractChange(route, value)"><el-option v-for="item in carrierOptions" :key="carrierOptionValue(item)" :label="carrierOptionLabel(item)" :value="route.carrierType === '承运商' ? carrierOptionValue(item) : item.carrierName" /></el-select></el-form-item></el-col>
<el-col :span="6"><el-form-item label="船/航/班列号" required><el-input v-model="route.vehicleNo" placeholder="请输入" /></el-form-item></el-col>
<el-col :span="6"><el-form-item label="船长"><el-input v-model="route.captainName" placeholder="请输入" /></el-form-item></el-col>
<el-col :span="6"><el-form-item label="联系电话" required><el-input v-model="route.driverPhone" placeholder="请输入" /></el-form-item></el-col>
@@ -208,7 +207,7 @@ export default {
props: { id: [String, Number] },
emits: ['back'],
data() {
return { loading: false, submitting: false, master: null, routes: [], pending: [], pendingExpanded: false, editingId: null, driverInputs: {}, carrierOptions: [], driverOptions: [], carrierLoading: false, driverLoading: false, cargoTypeOptions: [], cargoTypeCascaderProps: { label: 'cargoName', value: 'id', children: 'children', emitPath: true }, quantityUnitOptions: ['吨', '千克', '立方米', '件', '车', '箱', '托盘'] };
return { loading: false, submitting: false, master: null, routes: [], pending: [], pendingExpanded: false, editingId: null, driverInputs: {}, carrierOptions: [], driverOptions: [], carrierLoading: false, driverLoading: false, escortLoading: false, cargoTypeOptions: [], cargoTypeCascaderProps: { label: 'cargoName', value: 'id', children: 'children', emitPath: true }, quantityUnitOptions: ['吨', '千克', '立方米', '件', '车', '箱', '托盘'] };
},
computed: {
totalQuantity() { return (this.master?.goods || []).reduce((sum, item) => sum + Number(item.quantity || 0), 0); },
@@ -231,6 +230,7 @@ export default {
},
async mounted() {
await Promise.all([this.load(), this.loadCarrierOptions(), this.loadDriverOptions()]);
this.applySelfOperatedCarrierDefaults();
},
methods: {
async load() {
@@ -238,10 +238,36 @@ export default {
try {
const res = await api.getDetail(this.id);
this.master = res.data?.data || res.data || res;
await this.loadContractCurrency();
this.cargoTypeOptions = this.buildMasterCargoTypeOptions(this.master.goods || []);
this.routes = this.dispatchRouteNodes().map((node, index) => this.createRoute(node, index));
} finally { this.loading = false; }
},
normalizeCurrencyValue(value) {
const raw = typeof value === 'object'
? value.dictKey || value.value || value.code || value.dictValue || ''
: value;
const normalized = String(raw || 'RMB').trim().toUpperCase();
return normalized.includes(' - ') ? normalized.split(' - ')[0].trim() : normalized;
},
async loadContractCurrency() {
const directCurrency = this.master?.settlementCurrency || this.master?.settlementCurrencyCode || this.master?.currency;
if (!this.master?.projectId || !this.master?.contractId) {
this.master.settlementCurrency = this.normalizeCurrencyValue(directCurrency || 'RMB');
return;
}
try {
const response = await api.getProjectContracts(this.master.projectId);
const contract = unwrapRecords(response).find(item => String(item.id) === String(this.master.contractId));
this.master.customerContractPartyB = contract?.partyB || this.master.customerContractPartyB || '';
this.master.settlementCurrency = this.normalizeCurrencyValue(
directCurrency || contract?.settlementCurrency || contract?.settlementCurrencyCode || contract?.currency || 'RMB'
);
} catch {
this.master.customerContractPartyB = '';
this.master.settlementCurrency = 'RMB';
}
},
dispatchRouteNodes() {
const routes = Array.isArray(this.master?.routes) ? this.master.routes : [];
if (routes.length) return routes;
@@ -261,9 +287,9 @@ export default {
...node,
selected: false,
documentType: '运单',
carrierType: '承运商',
carrierType: node.carrierType || this.master?.carrierType || '承运商',
carrierContractId: '',
currency: 'CNY',
currency: this.normalizeCurrencyValue(this.master?.settlementCurrency || 'RMB'),
otherFeeTotal: '',
freightItems: [],
departureName: previous.departureName || '', departureAddress: previous.departureAddress || '', departureContact: previous.departureContact || '', departurePhone: previous.departurePhone || '',
@@ -343,7 +369,7 @@ export default {
},
buildFreightJson(route) {
return JSON.stringify({
currency: route.currency || 'CNY',
currency: route.currency || 'RMB',
totalFreightAmount: this.freightTotal(route),
otherFreightAmount: route.otherFeeTotal || '',
freightItems: (route.freightItems || []).map(item => ({
@@ -352,7 +378,7 @@ export default {
})),
});
},
currencyLabel(value) { return ({ CNY: '人民币', USD: '美元', EUR: '欧元' })[value] || value || '人民币'; },
currencyLabel(value) { return ({ CNY: '人民币', RMB: '人民币', USD: '美元', EUR: '欧元' })[value] || value || '人民币'; },
quantityNumber(value) { return Number(value || 0); },
goodsKey(goods = {}, includeUnit = true) {
return [
@@ -533,16 +559,23 @@ export default {
}
if (value !== '承运商') {
route.carrierContractId = '';
route.carrierName = '';
if (value === '网货平台') route.carrierName = '';
if (value === '自运') this.applySelfOperatedCarrierDefaults(route);
}
},
handleCarrierContractChange(route, contractId) {
const contract = this.carrierOptions.find(
item => String(item.contractId) === String(contractId)
item =>
[item.contractId, item.carrierName, item.id].some(
value => String(value || '') === String(contractId || '')
)
);
route.carrierContractId = contract?.contractId || '';
route.carrierContractId = route.carrierType === '承运商' ? contract?.contractId || '' : '';
route.carrierName = contract?.carrierName || '';
},
carrierOptionValue(item = {}) {
return item.contractId || item.id || item.value || item.carrierName || '';
},
carrierOptionLabel(item) {
const duplicateCount = this.carrierOptions.filter(option => option.carrierName === item.carrierName).length;
return duplicateCount > 1
@@ -568,10 +601,35 @@ export default {
this.carrierLoading = false;
}
},
applySelfOperatedCarrierDefaults(targetRoute) {
const routes = targetRoute ? [targetRoute] : this.routes;
if (!this.carrierOptions.length) {
const carrierName = String(this.master?.customerContractPartyB || '').trim();
if (carrierName) {
this.carrierOptions = [{
id: `customer-contract-${carrierName}`,
contractId: `customer-contract-${carrierName}`,
carrierName,
}];
}
}
routes.forEach(route => {
if (route.carrierType !== '自运') return;
if (this.carrierOptions.length) {
const current = this.carrierOptions.find(
item => String(item.carrierName || '') === String(route.carrierName || '')
);
route.carrierName = current?.carrierName || this.carrierOptions[0].carrierName || '';
}
route.carrierContractId = '';
});
},
async loadDriverOptions(keyword = '') {
this.driverLoading = true;
try {
this.driverOptions = unwrapRecords(await getDriverList(1, 20, { driverName: keyword }));
this.driverOptions = unwrapRecords(
await getDriverList(1, 20, { driverName: keyword, posts: '司机' })
);
} finally {
this.driverLoading = false;
}
@@ -595,6 +653,28 @@ export default {
const drivingVehicle = String(item.drivingVehicle || '').trim();
if (drivingVehicle) route.vehicleNo = drivingVehicle;
},
fetchEscortSuggestions(queryString, callback) {
const keyword = String(queryString || '').trim();
this.escortLoading = true;
getDriverList(1, 20, { ...(keyword ? { driverName: keyword } : {}), posts: '押运员' })
.then(res => {
callback(
unwrapRecords(res).map(item => ({
...item,
value: this.driverOptionLabel(item),
}))
);
})
.catch(() => callback([]))
.finally(() => {
this.escortLoading = false;
});
},
handleEscortSuggestionSelect(route, item = {}) {
route.escortName = this.driverOptionLabel(item);
const phone = item.mobile || item.driverPhone || item.phone || '';
if (phone) route.escortPhone = phone;
},
setDriverInput(segmentNo, element) {
if (element) this.driverInputs[segmentNo] = element;
else delete this.driverInputs[segmentNo];
@@ -622,7 +702,7 @@ export default {
if (route.documentType === '运单') {
if (this.isRoad(route)) {
if (route.carrierType === '承运商' && (!route.carrierContractId || !route.carrierName || !route.vehicleNo)) return this.$message.warning('请选择承运商并填写车牌号');
if (route.carrierType !== '承运商' && (!route.driverName || !route.driverPhone || !route.vehicleNo || !route.trailerVehicleNo || !route.escortName || !route.escortPhone)) return this.$message.warning('请补全自运或网货平台的车辆与人员信息');
if (route.carrierType !== '承运商' && (!route.driverName || !route.driverPhone || !route.vehicleNo)) return this.$message.warning('请补全自运或网货平台的车辆与人员信息');
} else if (!route.vehicleNo || !route.driverPhone || (route.carrierType === '承运商' && (!route.carrierContractId || !route.carrierName))) {
return this.$message.warning('请补全非公路运输的承运信息');
}
@@ -632,7 +712,7 @@ export default {
id: `${route.segmentNo}-${item.cargoName}-${Date.now()}-${Math.random()}`,
batchNo,
segmentNo: route.segmentNo, relationNo: route.segmentNo, documentType: route.documentType, transportType: route.transportType, carrierType: route.carrierType,
carrierContractId: route.carrierContractId, carrierName: route.carrierName, driverName: route.driverName, driverPhone: route.driverPhone, vehicleNo: route.vehicleNo, captainName: route.captainName, cabinNo: route.cabinNo, containerNo: route.containerNo, trailerVehicleNo: route.trailerVehicleNo, escortName: route.escortName, escortPhone: route.escortPhone, mileage: this.normalizeMileage(route.mileage), unitPrice: this.freightItemsForGoods(route, item).unitPrice || '', priceUnit: this.freightItemsForGoods(route, item).priceUnit || '', currency: route.currency || 'CNY', freightAmount: this.freightAmount(this.freightItemsForGoods(route, item)), freightTotal: this.freightTotal(route), otherFeeTotal: route.otherFeeTotal || '', freightJson: this.buildFreightJson(route), remark: route.remark,
carrierContractId: route.carrierContractId, carrierName: route.carrierName, driverName: route.driverName, driverPhone: route.driverPhone, vehicleNo: route.vehicleNo, captainName: route.captainName, cabinNo: route.cabinNo, containerNo: route.containerNo, trailerVehicleNo: route.trailerVehicleNo, escortName: route.escortName, escortPhone: route.escortPhone, mileage: this.normalizeMileage(route.mileage), unitPrice: this.freightItemsForGoods(route, item).unitPrice || '', priceUnit: this.freightItemsForGoods(route, item).priceUnit || '', currency: route.currency || 'RMB', freightAmount: this.freightAmount(this.freightItemsForGoods(route, item)), freightTotal: this.freightTotal(route), otherFeeTotal: route.otherFeeTotal || '', freightJson: this.buildFreightJson(route), remark: route.remark,
departureName: route.departureName, departureAddress: route.departureAddress, departureContact: route.departureContact, departurePhone: route.departurePhone,
arrivalName: route.arrivalName, arrivalAddress: route.arrivalAddress, arrivalContact: route.arrivalContact, arrivalPhone: route.arrivalPhone,
estimatedStartTime: route.estimatedStartTime, estimatedEndTime: route.estimatedEndTime,
@@ -661,6 +741,9 @@ export default {
}
if (goods) goods.dispatchQuantity = item.quantity;
Object.assign(route, item);
route.currency = this.normalizeCurrencyValue(
this.master?.settlementCurrency || route.currency || 'RMB'
);
this.syncFreightItems(route);
const freightItem = this.freightItemsForGoods(route, goods);
if (freightItem) { freightItem.unitPrice = item.unitPrice || ''; freightItem.priceUnit = item.priceUnit || freightItem.priceUnit; }
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -24,7 +24,7 @@
<el-form-item label="结算方式"><el-input v-model="form.settlementMode" /></el-form-item>
<el-form-item label="是否需要加盖法人章"><el-select v-model="form.legalSealFlag"><el-option label="是" :value="1" /><el-option label="否" :value="0" /></el-select></el-form-item>
<el-form-item label="一式(份)"><el-input v-model="form.copyCount" inputmode="numeric" maxlength="9" placeholder="请输入" @input="value => positiveIntegerInput('copyCount', value)" /></el-form-item>
<el-form-item label="回款账期(天)"><el-input v-model="form.paymentDays" inputmode="numeric" maxlength="9" placeholder="请输入" @input="value => positiveIntegerInput('paymentDays', value)" /></el-form-item>
<el-form-item label="回款账期"><el-input v-model="form.paymentDays" inputmode="numeric" maxlength="9" placeholder="请输入" @input="value => positiveIntegerInput('paymentDays', value)" /></el-form-item>
</div>
<el-form-item label="备注" class="contract-basic-section__remark"><el-input v-model="form.remark" type="textarea" :rows="2" maxlength="2000" show-word-limit placeholder="请输入备注" /></el-form-item>
</section>
+110 -94
View File
@@ -111,14 +111,7 @@
<div class="dialog-section-title">基本信息</div>
<div class="contract-manage-form__grid">
<el-form-item label="签约类型" prop="signType">
<el-select
v-model="form.signType"
placeholder="请选择签约类型"
:teleported="false"
:fit-input-width="true"
placement="bottom-start"
:popper-options="{ modifiers: [{ name: 'flip', enabled: false }] }"
>
<el-select v-model="form.signType" placeholder="请选择签约类型">
<el-option
v-for="item in signTypeOptions"
:key="item.value"
@@ -143,14 +136,7 @@
/>
</el-form-item>
<el-form-item label="合同类型" prop="contractCategory">
<el-select
v-model="form.contractCategory"
placeholder="请选择合同类型"
:teleported="false"
:fit-input-width="true"
placement="bottom-start"
:popper-options="{ modifiers: [{ name: 'flip', enabled: false }] }"
>
<el-select v-model="form.contractCategory" placeholder="请选择合同类型">
<el-option
v-for="item in contractCategoryOptions"
:key="item.value"
@@ -165,10 +151,6 @@
placeholder="请选择"
filterable
clearable
:teleported="false"
:fit-input-width="true"
placement="bottom-start"
:popper-options="{ modifiers: [{ name: 'flip', enabled: false }] }"
:loading="projectLoading"
@visible-change="visible => visible && loadProjectOptions()"
@change="handleProjectChange"
@@ -187,10 +169,6 @@
placeholder="请选择甲方"
filterable
clearable
:teleported="false"
:fit-input-width="true"
placement="bottom-start"
:popper-options="{ modifiers: [{ name: 'flip', enabled: false }] }"
:loading="contractPartyLoading"
@visible-change="visible => visible && loadContractPartyOptions()"
>
@@ -208,10 +186,6 @@
placeholder="请选择乙方"
filterable
clearable
:teleported="false"
:fit-input-width="true"
placement="bottom-start"
:popper-options="{ modifiers: [{ name: 'flip', enabled: false }] }"
:loading="contractPartyLoading"
@visible-change="visible => visible && loadContractPartyOptions()"
>
@@ -265,32 +239,8 @@
placeholder="请选择签订日期"
/>
</el-form-item>
<el-form-item label="结算类型" prop="settlementMode">
<el-select
v-model="form.settlementMode"
placeholder="请选择结算类型"
:teleported="false"
:fit-input-width="true"
placement="bottom-start"
:popper-options="{ modifiers: [{ name: 'flip', enabled: false }] }"
>
<el-option
v-for="item in settlementModeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="合同格式" prop="contractFormat">
<el-select
v-model="form.contractFormat"
placeholder="请选择合同格式"
:teleported="false"
:fit-input-width="true"
placement="bottom-start"
:popper-options="{ modifiers: [{ name: 'flip', enabled: false }] }"
>
<el-select v-model="form.contractFormat" placeholder="请选择合同格式">
<el-option
v-for="item in contractFormatOptions"
:key="item.value"
@@ -300,14 +250,7 @@
</el-select>
</el-form-item>
<el-form-item label="是否需要加盖法人章" prop="legalSealFlag">
<el-select
v-model="form.legalSealFlag"
placeholder="请选择"
:teleported="false"
:fit-input-width="true"
placement="bottom-start"
:popper-options="{ modifiers: [{ name: 'flip', enabled: false }] }"
>
<el-select v-model="form.legalSealFlag" placeholder="请选择">
<el-option label="" :value="0" />
<el-option label="" :value="1" />
</el-select>
@@ -320,12 +263,39 @@
><template #suffix>份</template></el-input
>
</el-form-item>
<el-form-item label="回款账期">
<el-form-item label="结算币种" prop="settlementCurrency">
<el-select v-model="form.settlementCurrency" placeholder="请选择结算币种" clearable>
<el-option
v-for="item in settlementCurrencyOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="结算方式" prop="settlementMode">
<el-select v-model="form.settlementMode" placeholder="请选择结算方式" clearable>
<el-option
v-for="item in settlementModeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="开票周期">
<el-input
v-model="form.invoiceCycle"
placeholder="请输入"
@input="value => positiveIntegerInput('invoiceCycle', value)"
><template #suffix>天</template></el-input>
</el-form-item>
<el-form-item label="回款账期">
<el-input
v-model="form.paymentDays"
placeholder="请输入"
@input="value => integerInput('paymentDays', value)"
/>
><template #suffix>天</template></el-input>
</el-form-item>
</div>
<el-form-item label="备注" prop="remark" class="contract-manage-form__remark">
@@ -406,10 +376,6 @@
<el-select
v-model="settlementRuleForm.settlementType"
placeholder="请选择结算类型"
:teleported="false"
:fit-input-width="true"
placement="bottom-start"
:popper-options="{ modifiers: [{ name: 'flip', enabled: false }] }"
@change="handleSettlementTypeChange"
>
<el-option
@@ -424,10 +390,6 @@
<el-select
v-model="settlementRuleForm.billCycleType"
placeholder="请选择账单周期类型"
:teleported="false"
:fit-input-width="true"
placement="bottom-start"
:popper-options="{ modifiers: [{ name: 'flip', enabled: false }] }"
@change="handleBillCycleTypeChange"
>
<el-option
@@ -439,14 +401,7 @@
</el-select>
</el-form-item>
<el-form-item v-if="showBillCutoffDay" label="账单截单日" required>
<el-select
v-model="settlementRuleForm.billCutoffDay"
placeholder="请选择账单截单日"
:teleported="false"
:fit-input-width="true"
placement="bottom-start"
:popper-options="{ modifiers: [{ name: 'flip', enabled: false }] }"
>
<el-select v-model="settlementRuleForm.billCutoffDay" placeholder="请选择账单截单日">
<el-option
v-for="item in billCutoffDayOptions"
:key="item.value"
@@ -456,14 +411,7 @@
</el-select>
</el-form-item>
<el-form-item v-if="showCycleDays" label="周期天数" required>
<el-select
v-model="settlementRuleForm.cycleDays"
placeholder="请选择周期天数"
:teleported="false"
:fit-input-width="true"
placement="bottom-start"
:popper-options="{ modifiers: [{ name: 'flip', enabled: false }] }"
>
<el-select v-model="settlementRuleForm.cycleDays" placeholder="请选择周期天数">
<el-option
v-for="item in cycleDayOptions"
:key="item.value"
@@ -674,9 +622,6 @@
<el-descriptions-item label="签订日期">{{
detailValue('signDate')
}}</el-descriptions-item>
<el-descriptions-item label="结算类型">{{
detailValue('settlementMode')
}}</el-descriptions-item>
<el-descriptions-item label="合同格式">{{
detailValue('contractFormat')
}}</el-descriptions-item>
@@ -686,6 +631,15 @@
<el-descriptions-item label="一式">{{
detailUnitValue('copyCount', '份')
}}</el-descriptions-item>
<el-descriptions-item label="结算币种">{{
detailDictionaryValue('settlementCurrency', settlementCurrencyOptions)
}}</el-descriptions-item>
<el-descriptions-item label="结算方式">{{
detailDictionaryValue('settlementMode', settlementModeOptions)
}}</el-descriptions-item>
<el-descriptions-item label="开票周期">{{
detailUnitValue('invoiceCycle', '天')
}}</el-descriptions-item>
<el-descriptions-item label="回款账期">{{
detailUnitValue('paymentDays', '天')
}}</el-descriptions-item>
@@ -856,6 +810,8 @@ import * as api from '@/api/business/contract-manage';
import { getList as getProjectList } from '@/api/business/project-apply';
import { getList as getCustomerArchiveList } from '@/api/vehicle/customer-archive';
import { getDeptTree } from '@/api/system/dept';
import { getDictionary as getSystemDictionary } from '@/api/system/dict';
import { getDictionary as getBizDictionary } from '@/api/system/dictbiz';
import { config, option } from '@/option/business/contract-manage';
import { getToken } from '@/utils/auth';
import { downloadFileByUrl, downloadXls } from '@/utils/util';
@@ -900,6 +856,8 @@ const defaultForm = () => ({
contractFormat: '',
legalSealFlag: 0,
copyCount: '',
settlementCurrency: '',
invoiceCycle: '',
paymentDays: '',
startDate: '',
endDate: '',
@@ -1183,14 +1141,27 @@ export default {
contractName: [{ required: true, message: '请输入合同名称', trigger: 'blur' }],
contractCategory: [{ required: true, message: '请选择合同类别', trigger: 'change' }],
signType: [{ required: true, message: '请选择签约类型', trigger: 'change' }],
settlementCurrency: [{ required: true, message: '请选择结算币种', trigger: 'change' }],
projectName: [{ required: true, message: '请选择所属项目', trigger: 'change' }],
organizationName: [{ required: true, message: '请选择所属组织', trigger: 'change' }],
partyA: [{ required: true, message: '请选择甲方', trigger: 'change' }],
partyB: [{ required: true, message: '请选择乙方', trigger: 'change' }],
signDate: [{ required: true, message: '请选择签订日期', trigger: 'change' }],
settlementMode: [{ required: true, message: '请选择结算类型', trigger: 'change' }],
settlementMode: [{ required: true, message: '请选择结算方式', trigger: 'change' }],
contractFormat: [{ required: true, message: '请选择合同格式', trigger: 'change' }],
legalSealFlag: [{ required: true, message: '请选择是否需要加盖法人章', trigger: 'change' }],
invoiceCycle: [
{
validator: (rule, value, callback) => {
if (value === '' || value === undefined || value === null) return callback();
if (!/^\d+$/.test(String(value)) || Number(value) < 1) {
return callback(new Error('开票周期只能输入正整数'));
}
callback();
},
trigger: 'blur',
},
],
startDate: [{ required: true, message: '请选择开始日期', trigger: 'change' }],
endDate: [{ required: true, message: '请选择结束日期', trigger: 'change' }],
},
@@ -1198,6 +1169,8 @@ export default {
projectOptions: [],
projectLoading: false,
selectedProjectId: '',
settlementCurrencyOptions: [],
settlementModeDictOptions: [],
contractPartyAOptions: [],
contractPartyBOptions: [],
contractPartyLoading: false,
@@ -1292,7 +1265,9 @@ export default {
return this.columnOptions('effectiveType');
},
settlementModeOptions() {
return this.columnOptions('settlementMode');
return this.settlementModeDictOptions.length
? this.settlementModeDictOptions
: this.columnOptions('settlementMode');
},
contractFormatOptions() {
return this.columnOptions('contractFormat');
@@ -1384,6 +1359,7 @@ export default {
},
created() {
this.loadProjectOptions();
this.loadSettlementDictionaries();
this.loadOrganizationOptions();
if (this.isFormPage) this.initFormPage();
},
@@ -1573,6 +1549,7 @@ export default {
...defaultForm(),
...detail,
copyCount: normalizeOptionalInteger(detail.copyCount, ''),
invoiceCycle: normalizeOptionalInteger(detail.invoiceCycle, ''),
paymentDays: normalizeOptionalInteger(detail.paymentDays, ''),
feeGenerationMode:
detail.feeGenerationMode || (Number(detail.billingEnabled) === 0 ? 'manual' : 'system'),
@@ -1617,6 +1594,10 @@ export default {
this.$message.warning('请选择合同类别');
return false;
}
if (!this.form.settlementCurrency) {
this.$message.warning('请选择结算币种');
return false;
}
if (['temporary', 'formal', 'edit'].includes(action) && !this.form.signType) {
this.$message.warning('请选择签约类型');
return false;
@@ -1630,7 +1611,7 @@ export default {
['startDate', '合同开始日期'],
['endDate', '合同结束日期'],
['signDate', '签订日期'],
['settlementMode', '结算类型'],
['settlementMode', '结算方式'],
['contractFormat', '合同格式'],
];
const empty = required.find(([prop]) => !this.form[prop]);
@@ -1649,6 +1630,7 @@ export default {
return {
...this.form,
copyCount: normalizeOptionalInteger(this.form.copyCount),
invoiceCycle: normalizeOptionalInteger(this.form.invoiceCycle),
paymentDays: normalizeOptionalInteger(this.form.paymentDays),
billingEnabled: this.form.feeGenerationMode === 'manual' ? 0 : 1,
contractFileJson: JSON.stringify(this.contractFileRows),
@@ -1725,6 +1707,29 @@ export default {
this.projectLoading = false;
});
},
loadSettlementDictionaries() {
Promise.all([
getSystemDictionary({ code: 'currency_type' }),
getBizDictionary({ code: 'settle_method' }),
]).then(([currencyRes, methodRes]) => {
const records = response => {
const data = response?.data?.data || response?.data || [];
return Array.isArray(data) ? data : data.records || [];
};
this.settlementCurrencyOptions = records(currencyRes).map(item => ({
label: `${item.dictKey} - ${item.dictValue}`,
value: item.dictKey,
}));
this.settlementModeDictOptions = records(methodRes).map(item => ({
label: item.dictValue,
value: item.dictKey,
}));
['settlementMode'].forEach(prop => {
const column = this.findColumn(this.tableOption.column, prop);
if (column) column.dicData = this.settlementModeDictOptions;
});
});
},
syncCurrentProjectOption() {
if (!this.form.projectId || !this.form.projectName) return;
if (this.projectOptions.some(item => String(item.id) === String(this.form.projectId))) return;
@@ -1733,12 +1738,13 @@ export default {
handleProjectChange(projectId) {
const project = this.projectOptions.find(item => String(item.id) === String(projectId));
if (!project) {
Object.assign(this.form, { projectId: '', projectName: '' });
Object.assign(this.form, { projectId: '', projectName: '', settlementMode: '' });
return;
}
Object.assign(this.form, {
projectId: project.id,
projectName: project.projectName || '',
settlementMode: project.settlementMode || this.form.settlementMode || '',
});
},
loadContractPartyOptions() {
@@ -1875,6 +1881,10 @@ export default {
integerInput(prop, value) {
this.form[prop] = String(value || '').replace(/\D/g, '');
},
positiveIntegerInput(prop, value) {
const normalized = String(value || '').replace(/\D/g, '').replace(/^0+/, '');
this.form[prop] = normalized;
},
previewAttachment(row, rows = []) {
const url = attachmentUrl(row);
if (!url) {
@@ -2065,6 +2075,7 @@ export default {
this.detailRow = {
...detail,
copyCount: normalizeOptionalInteger(detail.copyCount),
invoiceCycle: normalizeOptionalInteger(detail.invoiceCycle),
paymentDays: normalizeOptionalInteger(detail.paymentDays),
};
this.detailContractFileRows = parseArray(detail.contractFileJson);
@@ -2123,6 +2134,11 @@ export default {
if (prop === 'feeGenerationMode') return value === 'manual' ? '手动生成' : '系统生成';
return this.displayValue(value);
},
detailDictionaryValue(prop, options = []) {
const value = this.detailRow[prop];
if (value === undefined || value === null || value === '') return '-';
return options.find(item => String(item.value) === String(value))?.label || value;
},
handleOperation(operation, row) {
if (operation.action === 'startChange') {
this.$router.push({ path: '/business/contract-manage/change', query: { id: row.id } });
+114 -35
View File
@@ -823,12 +823,15 @@
</div>
<div class="loading-manage-dialog__grid loading-manage-dialog__task-grid">
<el-form-item
v-if="dialogForm.carrierType === '承运商'"
:required="dialogForm.carrierType === '承运商'"
label="承运商"
required
>
<el-select
v-model="dialogForm.carrierContractId"
:model-value="
dialogForm.carrierType === '承运商'
? dialogForm.carrierContractId
: dialogForm.carrierName
"
clearable
filterable
:disabled="dialogReadonly || !selectedWaybillRows.length"
@@ -839,9 +842,13 @@
>
<el-option
v-for="item in taskCarrierOptions"
:key="item.id"
:label="item.carrierName"
:value="item.id"
:key="item.id || item.carrierName"
:label="item.carrierName || item.partyB"
:value="
dialogForm.carrierType === '承运商'
? item.id
: item.carrierName || item.partyB
"
/>
</el-select>
</el-form-item>
@@ -866,7 +873,15 @@
<el-input v-model="dialogForm.trailerVehicleNo" clearable placeholder="请输入" />
</el-form-item>
<el-form-item v-if="dialogForm.carrierType !== '承运商'" label="押运人">
<el-input v-model="dialogForm.escortName" clearable placeholder="请输入" />
<el-autocomplete
v-model="dialogForm.escortName"
clearable
:debounce="300"
:fetch-suggestions="fetchEscortSuggestions"
:loading="escortLoading"
placeholder="请输入"
@select="item => handleEscortSuggestionSelect('dialog', item)"
/>
</el-form-item>
<el-form-item v-if="dialogForm.carrierType !== '承运商'" label="押运人手机号">
<el-input v-model="dialogForm.escortPhone" clearable placeholder="请输入" />
@@ -982,6 +997,7 @@ import {
getList as getWaybillList,
getDetail as getWaybillDetail,
} from '@/api/business/waybill-manage';
import { getList as getContractList } from '@/api/business/contract-manage';
import { getParentOptions as getCargoTypeOptions } from '@/api/base/cargo-type';
import { getList as getCustomerList } from '@/api/vehicle/customer-archive';
import { getList as getDriverList } from '@/api/transportCapacity/driver';
@@ -1188,6 +1204,7 @@ export default {
customerLoading: false,
cargoTypeLoading: false,
driverLoading: false,
escortLoading: false,
carrierLoading: false,
taskCarrierLoading: false,
planLoading: false,
@@ -1606,10 +1623,6 @@ export default {
this.dialogForm.waybillIdsJson,
this.dialogForm.loadingSubNos
);
if (this.dialogForm.carrierType !== '承运商') {
this.dialogForm.carrierContractId = '';
this.dialogForm.carrierName = '';
}
this.syncProcessProjectOptions();
this.restoreRouteAndCargo();
this.restoreRouteChangeRecords();
@@ -2131,7 +2144,7 @@ export default {
normalizePayload() {
this.syncRouteAddressFields();
this.rebuildSummaryFromWaybills(false);
if (this.dialogForm.carrierType !== '承运商') {
if (this.dialogForm.carrierType === '网货平台') {
this.dialogForm.carrierContractId = '';
this.dialogForm.carrierName = '';
}
@@ -2317,17 +2330,20 @@ export default {
this.dialogForm.escortName = '';
this.dialogForm.escortPhone = '';
}
if (this.dialogForm.carrierType !== '承运商') {
if (this.dialogForm.carrierType === '网货平台') {
this.dialogForm.carrierContractId = '';
this.dialogForm.carrierName = '';
this.taskCarrierOptions = [];
return;
}
this.loadTaskCarrierOptions();
},
handleTaskCarrierChange(contractId) {
const contract = this.taskCarrierOptions.find(item => String(item.id) === String(contractId));
this.dialogForm.carrierContractId = contract?.id || '';
const contract = this.taskCarrierOptions.find(item =>
[item.id, item.carrierName, item.partyB].some(
value => String(value || '') === String(contractId || '')
)
);
this.dialogForm.carrierContractId =
this.dialogForm.carrierType === '承运商' && contract?.id ? contract.id : '';
this.dialogForm.carrierName = contract?.carrierName || '';
},
handleDriverChange(value) {
@@ -2361,6 +2377,29 @@ export default {
if (drivingVehicle) this.dialogForm.vehicleNo = drivingVehicle;
}
},
fetchEscortSuggestions(queryString, callback) {
const keyword = String(queryString || '').trim();
this.escortLoading = true;
getDriverList(1, 20, { ...(keyword ? { driverName: keyword } : {}), posts: '押运员' })
.then(res => {
callback(
unwrapRecords(res).map(item => ({
...item,
value: item.driverName || item.name || '',
}))
);
})
.catch(() => callback([]))
.finally(() => {
this.escortLoading = false;
});
},
handleEscortSuggestionSelect(target, item = {}) {
if (target !== 'dialog') return;
this.dialogForm.escortName = item.driverName || item.name || '';
const phone = item.mobile || item.driverPhone || item.phone || '';
if (phone) this.dialogForm.escortPhone = phone;
},
handleMileageInput(value) {
this.dialogForm.mileage = String(value || '').replace(/[^\d.]/g, '');
},
@@ -2410,7 +2449,9 @@ export default {
async loadDriverOptions(keyword = '') {
this.driverLoading = true;
try {
this.driverOptions = unwrapRecords(await getDriverList(1, 20, { driverName: keyword }));
this.driverOptions = unwrapRecords(
await getDriverList(1, 20, { driverName: keyword, posts: '司机' })
);
} finally {
this.driverLoading = false;
}
@@ -2431,7 +2472,7 @@ export default {
},
async loadTaskCarrierOptions() {
const requestId = ++this.taskCarrierRequestId;
if (this.dialogForm.carrierType !== '承运商' || !this.selectedWaybillRows.length) {
if (!this.selectedWaybillRows.length) {
this.taskCarrierOptions = [];
this.taskCarrierLoading = false;
this.dialogForm.carrierContractId = '';
@@ -2446,27 +2487,65 @@ export default {
const response = await loadingApi.getCarrierContracts(projectIds);
if (requestId !== this.taskCarrierRequestId) return [];
const contracts = response.data?.data || response.data || [];
this.taskCarrierOptions = contracts;
const current =
contracts.find(
item => String(item.id) === String(this.dialogForm.carrierContractId)
) ||
contracts.find(
item => item.carrierName === this.dialogForm.carrierName
);
if (current) {
this.dialogForm.carrierContractId = current.id;
this.dialogForm.carrierName = current.carrierName;
} else {
this.dialogForm.carrierContractId = '';
this.dialogForm.carrierName = '';
if (this.dialogForm.carrierType === '承运商') {
this.taskCarrierOptions = contracts;
const current =
contracts.find(item => String(item.id) === String(this.dialogForm.carrierContractId)) ||
contracts.find(item => item.carrierName === this.dialogForm.carrierName);
if (current) {
this.dialogForm.carrierContractId = current.id;
this.dialogForm.carrierName = current.carrierName;
} else {
this.dialogForm.carrierContractId = '';
this.dialogForm.carrierName = '';
}
return contracts;
}
return contracts;
if (this.dialogForm.carrierType === '自运' && contracts.length) {
this.taskCarrierOptions = contracts;
const current = contracts.find(item => item.carrierName === this.dialogForm.carrierName);
this.dialogForm.carrierContractId = '';
this.dialogForm.carrierName = current?.carrierName || contracts[0].carrierName || '';
return contracts;
}
if (this.dialogForm.carrierType !== '自运') {
this.taskCarrierOptions = [];
this.dialogForm.carrierContractId = '';
return [];
}
const customerContracts = await Promise.all(
projectIds.map(projectId =>
getContractList(1, 9999, { projectId, contractCategory: '客户合同' })
.then(res => extractRecords(res))
.catch(() => [])
)
);
const partyBNames = [];
const customerContractMap = new Map(
projectIds.map((projectId, index) => [String(projectId), customerContracts[index] || []])
);
this.selectedWaybillRows.forEach(row => {
const direct = row.partyB || row.contractPartyB || row.customerContractPartyB;
const contractsForProject = customerContractMap.get(String(row.projectId)) || [];
const matched = contractsForProject.find(
item => String(item.id) === String(row.contractId)
);
const name = String(direct || matched?.partyB || '').trim();
if (name && !partyBNames.includes(name)) partyBNames.push(name);
});
this.taskCarrierOptions = partyBNames.map(name => ({
id: `customer-contract-${name}`,
carrierName: name,
partyB: name,
}));
this.dialogForm.carrierContractId = '';
this.dialogForm.carrierName = partyBNames[0] || '';
return this.taskCarrierOptions;
} catch (error) {
if (requestId !== this.taskCarrierRequestId) return [];
this.taskCarrierOptions = [];
this.dialogForm.carrierContractId = '';
this.dialogForm.carrierName = '';
if (this.dialogForm.carrierType !== '自运') this.dialogForm.carrierName = '';
return [];
} finally {
if (requestId === this.taskCarrierRequestId) this.taskCarrierLoading = false;
+13 -2
View File
@@ -813,7 +813,6 @@ import {
businessTypeOptions,
projectSourceOptions,
projectTypeOptions,
settlementModeOptions,
} from '@/option/business/common';
import { config, option } from '@/option/business/project-apply';
@@ -960,7 +959,7 @@ export default {
projectSourceOptions,
transportTypeOptions: [],
businessTypeOptions,
settlementModeOptions,
settlementModeOptions: [],
changeTypeOptions,
tableForm: {},
tableOption: this.buildTableOption(),
@@ -1225,6 +1224,7 @@ export default {
this.loadDeptOptions();
this.loadCargoTypeOptions();
this.loadTransportTypeOptions();
this.loadSettlementModeOptions();
if (this.isProjectFormPage) {
this.openProjectFormPage();
}
@@ -1970,6 +1970,17 @@ export default {
}));
});
},
loadSettlementModeOptions() {
getBizDictionary({ code: 'settle_method' }).then(res => {
const data = res.data?.data || [];
this.settlementModeOptions = data.map(item => ({
label: item.dictValue,
value: item.dictKey,
}));
const column = this.findColumn(this.tableOption.column, 'settlementMode');
if (column) column.dicData = this.settlementModeOptions;
});
},
loadCustomerOptions(type) {
const loadingKey = type === '客户' ? 'customerLoading' : 'carrierLoading';
const optionsKey = type === '客户' ? 'customerOptions' : 'carrierOptions';
+9 -3
View File
@@ -1,14 +1,20 @@
<template>
<business-crud-page :api="api" :config="config" :crud-option="option" :menu-width="270" standalone-form-page />
<shipping-template-page
:api="api"
:config="config"
:crud-option="option"
:menu-width="270"
standalone-form-page
/>
</template>
<script>
import BusinessCrudPage from './components/business-crud-page.vue';
import ShippingTemplatePage from './components/shipping-template-page.vue';
import * as api from '@/api/business/shipping-template';
import { config, option } from '@/option/business/shipping-template';
export default {
components: { BusinessCrudPage },
components: { ShippingTemplatePage },
data() {
return {
api,
+10 -3
View File
@@ -1,14 +1,21 @@
<template>
<business-crud-page :api="api" :config="config" :crud-option="option" :detail-id="$route.query.detailId" :menu-width="220" standalone-form-page />
<transport-plan-page
:api="api"
:config="config"
:crud-option="option"
:detail-id="$route.query.detailId"
:menu-width="220"
standalone-form-page
/>
</template>
<script>
import BusinessCrudPage from './components/business-crud-page.vue';
import TransportPlanPage from './components/transport-plan-page.vue';
import * as api from '@/api/business/transport-plan';
import { config, option } from '@/option/business/transport-plan';
export default {
components: { BusinessCrudPage },
components: { TransportPlanPage },
data() {
return {
api,
+10 -3
View File
@@ -1,14 +1,21 @@
<template>
<business-crud-page :api="api" :config="config" :crud-option="option" :detail-id="$route.query.detailId" :menu-width="250" standalone-form-page />
<waybill-manage-page
:api="api"
:config="config"
:crud-option="option"
:detail-id="$route.query.detailId"
:menu-width="250"
standalone-form-page
/>
</template>
<script>
import BusinessCrudPage from './components/business-crud-page.vue';
import WaybillManagePage from './components/waybill-manage-page.vue';
import * as api from '@/api/business/waybill-manage';
import { config, option } from '@/option/business/waybill-manage';
export default {
components: { BusinessCrudPage },
components: { WaybillManagePage },
data() {
return {
api,
@@ -1853,13 +1853,15 @@ export default {
return typeText && normalizedName.includes(typeText);
});
if (matchedType?.value) return matchedType.value;
const otherType = this.attachmentTypeOptions.find(item =>
String(item.label || item.value || '').includes('其他')
);
const otherType = this.attachmentTypeOptions.find(item => this.isOtherAttachmentType(item));
if (otherType?.value) return otherType.value;
this.attachmentTypeOptions.push({ label: '其他附件', value: '其他附件' });
return '其他附件';
},
isOtherAttachmentType(item) {
const typeText = String(item?.label || item?.value || '').trim();
return typeText === '其他' || typeText === '其他附件';
},
getAttachmentTypeOrder(type) {
const normalizedType = String(type || '').trim();
const index = this.attachmentTypeOptions.findIndex(
@@ -1887,7 +1889,7 @@ export default {
.filter(Boolean)
);
return this.attachmentTypeOptions
.filter(item => String(item.label || item.value || '').trim() !== '其他附件')
.filter(item => !this.isOtherAttachmentType(item))
.filter(item => !uploadedTypes.has(String(item.value || item.label || '').trim()))
.map(item => item.label || item.value);
},
@@ -1150,7 +1150,7 @@ export default {
this.resetEditor();
await this.loadFeeOptions();
await this.loadFeeCategoryOptions();
if (this.pageMode) await this.loadTransportTypeOptions();
await this.loadTransportTypeOptions();
if (this.recordId) await this.loadDetail();
else if (this.initialData) this.applyInitialData();
},