1、调整合同
2、调整项目 3、调整付款管理
This commit is contained in:
@@ -4552,7 +4552,7 @@
|
||||
<el-cascader
|
||||
v-model="billingMatchForm.cargoTypePath"
|
||||
:options="billingCargoTypeOptions"
|
||||
:props="billingCargoTypeCascaderProps"
|
||||
:props="billingMatchCargoTypeCascaderProps"
|
||||
:placeholder="billingMatchForm.cargoType || '请选择货物类型'"
|
||||
:loading="billingCargoTypeLoading"
|
||||
:disabled="dialogReadonly"
|
||||
@@ -4564,6 +4564,32 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="货物名称">
|
||||
<el-select
|
||||
v-model="billingMatchForm.cargoNames"
|
||||
multiple
|
||||
collapse-tags
|
||||
collapse-tags-tooltip
|
||||
clearable
|
||||
filterable
|
||||
:loading="billingMatchCargoNameLoading"
|
||||
:disabled="dialogReadonly || !billingMatchForm.cargoTypePath?.length"
|
||||
:placeholder="
|
||||
billingMatchForm.cargoTypePath?.length
|
||||
? '请选择货物名称(可多选)'
|
||||
: '请先选择货物类型'
|
||||
"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in billingMatchCargoNameOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
@@ -5304,6 +5330,7 @@ const defaultBillingRule = () => ({
|
||||
cargoType: '',
|
||||
cargoTypeCode: '',
|
||||
cargoTypePath: [],
|
||||
cargoNames: [],
|
||||
},
|
||||
});
|
||||
|
||||
@@ -5685,6 +5712,9 @@ export default {
|
||||
billingMatchRegionOptions: [],
|
||||
billingMatchRegionLoading: false,
|
||||
billingMatchRegionRequest: null,
|
||||
billingMatchCargoNameOptions: [],
|
||||
billingMatchCargoNameLoading: false,
|
||||
billingMatchCargoNameRequestId: 0,
|
||||
billingCargoTypeOptions: [],
|
||||
billingCargoTypeFlatOptions: [],
|
||||
billingCargoTypeLoading: false,
|
||||
@@ -6240,6 +6270,16 @@ export default {
|
||||
emitPath: true,
|
||||
};
|
||||
},
|
||||
billingMatchCargoTypeCascaderProps() {
|
||||
return {
|
||||
label: 'cargoName',
|
||||
value: 'id',
|
||||
children: 'children',
|
||||
leaf: 'leaf',
|
||||
checkStrictly: true,
|
||||
emitPath: true,
|
||||
};
|
||||
},
|
||||
billingCargoTypeCascaderProps() {
|
||||
return {
|
||||
label: 'cargoName',
|
||||
@@ -10476,6 +10516,33 @@ export default {
|
||||
null
|
||||
);
|
||||
},
|
||||
findBillingMatchCargoTypeByPath(path = []) {
|
||||
const values = this.normalizeBillingMatchCargoTypePath(path);
|
||||
if (!values.length) return null;
|
||||
return (
|
||||
this.billingCargoTypeFlatOptions.find(
|
||||
item =>
|
||||
item.path?.length === values.length &&
|
||||
item.path.every((value, index) => String(value) === values[index])
|
||||
) || null
|
||||
);
|
||||
},
|
||||
findBillingMatchCargoTypeByCodeOrName(condition = {}) {
|
||||
const code = String(condition.cargoTypeCode || '').trim();
|
||||
const name = String(condition.cargoType || '').trim();
|
||||
return (
|
||||
this.billingCargoTypeFlatOptions.find(item => {
|
||||
const cargoCode = String(item.cargoCode || item.code || item.id || '');
|
||||
return code && cargoCode === code;
|
||||
}) ||
|
||||
this.billingCargoTypeFlatOptions.find(item => {
|
||||
const cargoName = this.formatBillingCargoTypeLabel(item);
|
||||
const pathName = this.getBillingCargoTypePathLabels(item.path).join('/');
|
||||
return name && (cargoName === name || pathName === name);
|
||||
}) ||
|
||||
null
|
||||
);
|
||||
},
|
||||
resolveCommonCargoTypePath(row = {}) {
|
||||
const path = this.normalizeBillingCargoTypePath(row.cargoTypePath);
|
||||
if (path.length) return path;
|
||||
@@ -10490,17 +10557,17 @@ export default {
|
||||
});
|
||||
return cargoType?.path || [];
|
||||
},
|
||||
handleBillingMatchCargoTypeChange(value) {
|
||||
const path =
|
||||
Array.isArray(value) && value.length >= 2
|
||||
? value.slice(0, 2).map(item => String(item))
|
||||
: [];
|
||||
const cargoType = this.findBillingCargoTypeByPath(path);
|
||||
handleBillingMatchCargoTypeChange(value, resetCargoNames = true) {
|
||||
const path = this.normalizeBillingMatchCargoTypePath(value);
|
||||
const cargoType = this.findBillingMatchCargoTypeByPath(path);
|
||||
const labels = this.getBillingCargoTypePathLabels(path);
|
||||
this.billingMatchForm.cargoTypePath = path;
|
||||
if (resetCargoNames) this.billingMatchForm.cargoNames = [];
|
||||
if (!path.length || !cargoType) {
|
||||
this.billingMatchForm.cargoType = '';
|
||||
this.billingMatchForm.cargoTypeCode = '';
|
||||
this.billingMatchCargoNameOptions = [];
|
||||
this.billingMatchCargoNameRequestId += 1;
|
||||
return;
|
||||
}
|
||||
this.billingMatchForm.cargoType =
|
||||
@@ -10509,16 +10576,81 @@ export default {
|
||||
: labels[0] || this.formatBillingCargoTypeLabel(cargoType || {});
|
||||
this.billingMatchForm.cargoTypeCode =
|
||||
cargoType?.cargoCode || cargoType?.code || cargoType?.id || '';
|
||||
this.loadBillingMatchCargoNameOptions(path, !resetCargoNames);
|
||||
},
|
||||
loadBillingMatchCargoNameOptions(path = [], preserveSelected = false) {
|
||||
const normalizedPath = this.normalizeBillingMatchCargoTypePath(path);
|
||||
if (!normalizedPath.length) {
|
||||
this.billingMatchCargoNameOptions = [];
|
||||
this.billingMatchCargoNameLoading = false;
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
const requestId = ++this.billingMatchCargoNameRequestId;
|
||||
const selected = preserveSelected
|
||||
? this.normalizeBillingMatchCargoNames(this.billingMatchForm)
|
||||
: [];
|
||||
const firstCargoType = this.billingCargoTypeFlatOptions.find(
|
||||
item => String(item.id) === normalizedPath[0] && item.path?.length === 1
|
||||
);
|
||||
const secondCargoType = this.findBillingCargoTypeByPath(normalizedPath);
|
||||
const firstCargoTypeCode = firstCargoType?.cargoCode || firstCargoType?.code || '';
|
||||
const secondCargoTypeCode = secondCargoType?.cargoCode || secondCargoType?.code || '';
|
||||
this.billingMatchCargoNameLoading = true;
|
||||
return getCommonCargoList(1, 9999, {
|
||||
...(firstCargoTypeCode
|
||||
? { firstCargoTypeCode }
|
||||
: { firstCargoTypeId: normalizedPath[0] }),
|
||||
...(normalizedPath[1]
|
||||
? secondCargoTypeCode
|
||||
? { secondCargoTypeCode }
|
||||
: { secondCargoTypeId: normalizedPath[1] }
|
||||
: {}),
|
||||
allDept: 0,
|
||||
})
|
||||
.then(res => {
|
||||
if (requestId !== this.billingMatchCargoNameRequestId) return [];
|
||||
const names = extractRecords(res)
|
||||
.map(item => String(item.cargoName || '').trim())
|
||||
.filter(Boolean);
|
||||
const options = [...new Set([...selected, ...names])];
|
||||
this.billingMatchCargoNameOptions = options.map(value => ({ label: value, value }));
|
||||
return this.billingMatchCargoNameOptions;
|
||||
})
|
||||
.catch(error => {
|
||||
if (requestId === this.billingMatchCargoNameRequestId) {
|
||||
this.billingMatchCargoNameOptions = selected.map(value => ({ label: value, value }));
|
||||
}
|
||||
window.console.log(error);
|
||||
return [];
|
||||
})
|
||||
.finally(() => {
|
||||
if (requestId === this.billingMatchCargoNameRequestId) {
|
||||
this.billingMatchCargoNameLoading = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
normalizeBillingCargoTypePath(path) {
|
||||
return Array.isArray(path) && path.length >= 2
|
||||
? path.slice(0, 2).map(value => String(value))
|
||||
: [];
|
||||
},
|
||||
normalizeBillingMatchCargoTypePath(path) {
|
||||
return Array.isArray(path) && path.length
|
||||
? path.slice(0, 2).map(value => String(value))
|
||||
: [];
|
||||
},
|
||||
normalizeBillingMatchCargoNames(condition = {}) {
|
||||
const values = Array.isArray(condition.cargoNames)
|
||||
? condition.cargoNames
|
||||
: condition.cargoName
|
||||
? [condition.cargoName]
|
||||
: [];
|
||||
return [...new Set(values.map(value => String(value || '').trim()).filter(Boolean))];
|
||||
},
|
||||
resolveBillingMatchCargoTypePath(condition = {}) {
|
||||
const path = this.normalizeBillingCargoTypePath(condition.cargoTypePath);
|
||||
const path = this.normalizeBillingMatchCargoTypePath(condition.cargoTypePath);
|
||||
if (path.length) return path;
|
||||
const cargoType = this.findBillingCargoTypeByCodeOrName(condition);
|
||||
const cargoType = this.findBillingMatchCargoTypeByCodeOrName(condition);
|
||||
return cargoType?.path || [];
|
||||
},
|
||||
normalizeBillingMatchRegionPath(path) {
|
||||
@@ -10536,7 +10668,10 @@ export default {
|
||||
nextCondition.destinationPath = this.normalizeBillingMatchRegionPath(
|
||||
condition?.destinationPath
|
||||
);
|
||||
nextCondition.cargoTypePath = this.normalizeBillingCargoTypePath(condition?.cargoTypePath);
|
||||
nextCondition.cargoTypePath = this.normalizeBillingMatchCargoTypePath(
|
||||
condition?.cargoTypePath
|
||||
);
|
||||
nextCondition.cargoNames = this.normalizeBillingMatchCargoNames(condition);
|
||||
return nextCondition;
|
||||
},
|
||||
ensureBillingFeeCategoryOptions() {
|
||||
@@ -10892,12 +11027,13 @@ export default {
|
||||
openBillingMatch(row, index) {
|
||||
this.billingMatchRuleIndex = index;
|
||||
this.billingMatchForm = this.normalizeBillingMatchCondition(row.matchCondition);
|
||||
this.billingMatchCargoNameOptions = [];
|
||||
this.billingMatchBox = true;
|
||||
this.ensureBillingMatchRegionOptions();
|
||||
this.ensureBillingCargoTypeOptions().then(() => {
|
||||
const path = this.resolveBillingMatchCargoTypePath(this.billingMatchForm);
|
||||
if (path.length) {
|
||||
this.handleBillingMatchCargoTypeChange(path);
|
||||
this.handleBillingMatchCargoTypeChange(path, false);
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -10906,7 +11042,7 @@ export default {
|
||||
if (row) {
|
||||
this.handleBillingMatchRegionChange('origin', this.billingMatchForm.originPath);
|
||||
this.handleBillingMatchRegionChange('destination', this.billingMatchForm.destinationPath);
|
||||
this.handleBillingMatchCargoTypeChange(this.billingMatchForm.cargoTypePath);
|
||||
this.handleBillingMatchCargoTypeChange(this.billingMatchForm.cargoTypePath, false);
|
||||
row.matchCondition = this.cloneData(this.billingMatchForm);
|
||||
}
|
||||
this.billingMatchBox = false;
|
||||
|
||||
Reference in New Issue
Block a user