调整业务模块
This commit is contained in:
@@ -634,13 +634,7 @@
|
||||
item.fullName ||
|
||||
item.name
|
||||
"
|
||||
:value="
|
||||
item.value ||
|
||||
item.customerName ||
|
||||
item.carrierName ||
|
||||
item.fullName ||
|
||||
item.name
|
||||
"
|
||||
:value="taskCarrierOptionValue(item)"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -1188,13 +1182,7 @@
|
||||
item.fullName ||
|
||||
item.name
|
||||
"
|
||||
:value="
|
||||
item.value ||
|
||||
item.customerName ||
|
||||
item.carrierName ||
|
||||
item.fullName ||
|
||||
item.name
|
||||
"
|
||||
:value="taskCarrierOptionValue(item)"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -2212,12 +2200,6 @@
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<waybill-import-dialog
|
||||
v-if="config.enableWaybillImport"
|
||||
v-model="waybillImportBox"
|
||||
@closed="refreshChange"
|
||||
/>
|
||||
|
||||
<flow-design
|
||||
v-if="website.design.designMode"
|
||||
is-dialog
|
||||
@@ -2827,7 +2809,6 @@ import { h, resolveComponent } from 'vue';
|
||||
import { mapGetters } from 'vuex';
|
||||
import NProgress from 'nprogress';
|
||||
import 'nprogress/nprogress.css';
|
||||
import WaybillImportDialog from './waybill-import-dialog.vue';
|
||||
|
||||
const AMAP_KEY = '653b7cf105ad7fb8ec9b2f5198ade315';
|
||||
const AMAP_SECURITY_CODE = '5aab65c632e48ebae0d0e28f5b28e21a';
|
||||
@@ -2973,7 +2954,6 @@ const getPlainAvueForm = avueForm => {
|
||||
|
||||
export default {
|
||||
components: {
|
||||
WaybillImportDialog,
|
||||
PageAvueForm,
|
||||
InfoFilled,
|
||||
Rank,
|
||||
@@ -3073,7 +3053,6 @@ export default {
|
||||
currentPage: 1,
|
||||
total: 0,
|
||||
},
|
||||
waybillImportBox: false,
|
||||
draftSaveLoading: false,
|
||||
crudDialogType: '',
|
||||
defaultDialogButtons: null,
|
||||
@@ -3363,10 +3342,9 @@ export default {
|
||||
},
|
||||
taskCarrierValue: {
|
||||
get() {
|
||||
if (this.form.carrierType === '承运商') {
|
||||
return this.form.carrierContractId || '';
|
||||
}
|
||||
return this.form.carrierName || '';
|
||||
return this.form.carrierType === '自运'
|
||||
? this.form.carrierName || ''
|
||||
: this.form.carrierContractId || this.form.carrierName || '';
|
||||
},
|
||||
set(value) {
|
||||
this.handleTaskCarrierChange(value);
|
||||
@@ -5387,34 +5365,34 @@ export default {
|
||||
},
|
||||
handleTaskCarrierTypeChange(value) {
|
||||
const nextValue = value || '承运商';
|
||||
this.form.carrierName = '';
|
||||
this.form.carrierId = '';
|
||||
this.form.carrierContractId = '';
|
||||
if (nextValue === '承运商') {
|
||||
this.form.trailerVehicleNo = '';
|
||||
this.form.escortName = '';
|
||||
this.form.escortPhone = '';
|
||||
} else if (!this.isTaskCarrierRequired(nextValue)) {
|
||||
this.form.carrierName = '';
|
||||
this.form.carrierId = '';
|
||||
}
|
||||
if (nextValue !== '承运商') {
|
||||
this.form.carrierContractId = '';
|
||||
}
|
||||
this.form.carrierType = nextValue;
|
||||
if (nextValue === '自运') {
|
||||
const contract = this.contractOptions.find(
|
||||
item => String(item.id) === String(this.form.contractId)
|
||||
);
|
||||
this.fillSelfOperatedCarrierFromContract(contract);
|
||||
}
|
||||
this.taskCarrierRequestId += 1;
|
||||
this.taskCarrierOptions = [];
|
||||
this.taskCarrierLoading = false;
|
||||
if (nextValue === '自运' && this.form.projectId) {
|
||||
this.resetWaybillCarrierContractState();
|
||||
// 承运类型切换后必须基于当前项目重新获取承运商合同;
|
||||
// 非自运场景的承运商选项仅允许使用合同乙方。
|
||||
if (this.form.projectId) {
|
||||
this.loadTaskCarrierOptions();
|
||||
}
|
||||
},
|
||||
fillSelfOperatedCarrierFromContract(contract = {}) {
|
||||
if (this.form.carrierType !== '自运') return;
|
||||
const carrierName = String(contract.partyB || contract.partyBName || '').trim();
|
||||
const carrierName = String(
|
||||
contract.partyB ||
|
||||
contract.partyBName ||
|
||||
contract.contractPartyB ||
|
||||
contract.customerContractPartyB ||
|
||||
''
|
||||
).trim();
|
||||
if (!carrierName) return;
|
||||
const exists = this.taskCarrierOptions.some(
|
||||
item => String(item.value || item.carrierName || '') === carrierName
|
||||
@@ -5433,6 +5411,19 @@ export default {
|
||||
isTaskCarrierRequired(carrierType) {
|
||||
return ['承运商', '网货平台'].includes(String(carrierType || '').trim());
|
||||
},
|
||||
taskCarrierOptionValue(item = {}) {
|
||||
if (this.form.carrierType !== '自运') {
|
||||
return item.carrierContractId || item.value || item.id || '';
|
||||
}
|
||||
return (
|
||||
item.carrierName ||
|
||||
item.customerName ||
|
||||
item.fullName ||
|
||||
item.name ||
|
||||
item.value ||
|
||||
''
|
||||
);
|
||||
},
|
||||
getProjectCarrierOptions(project = {}) {
|
||||
const rows = this.parseJsonArray(project.carrierJson);
|
||||
const names = String(project.carrierNames || '')
|
||||
@@ -5462,18 +5453,42 @@ export default {
|
||||
},
|
||||
getWaybillCarrierContractOptions(contracts = []) {
|
||||
const carrierNameCounts = contracts.reduce((counts, contract) => {
|
||||
const carrierName = String(contract.partyA || contract.partyAName || '').trim();
|
||||
const carrierName = String(
|
||||
contract.partyB ||
|
||||
contract.partyBName ||
|
||||
contract.contractPartyB ||
|
||||
contract.customerContractPartyB ||
|
||||
contract.secondParty ||
|
||||
contract.secondPartyName ||
|
||||
''
|
||||
).trim();
|
||||
if (carrierName) counts[carrierName] = (counts[carrierName] || 0) + 1;
|
||||
return counts;
|
||||
}, {});
|
||||
return contracts
|
||||
.map(contract => {
|
||||
const carrierName = String(contract.partyA || contract.partyAName || '').trim();
|
||||
const carrierName = String(
|
||||
contract.partyB ||
|
||||
contract.partyBName ||
|
||||
contract.contractPartyB ||
|
||||
contract.customerContractPartyB ||
|
||||
contract.secondParty ||
|
||||
contract.secondPartyName ||
|
||||
''
|
||||
).trim();
|
||||
if (!carrierName || !contract.id) return null;
|
||||
const contractIdentifier = contract.contractName || contract.contractNo || contract.id;
|
||||
return {
|
||||
id: contract.id,
|
||||
carrierId: contract.partyAId || contract.partyAUserId || contract.customerId || '',
|
||||
carrierId:
|
||||
contract.partyBId ||
|
||||
contract.partyBUserId ||
|
||||
contract.contractPartyBId ||
|
||||
contract.customerContractPartyBId ||
|
||||
contract.secondPartyId ||
|
||||
contract.secondPartyUserId ||
|
||||
contract.carrierId ||
|
||||
'',
|
||||
value: contract.id,
|
||||
label:
|
||||
carrierNameCounts[carrierName] > 1
|
||||
@@ -5534,7 +5549,7 @@ export default {
|
||||
...project,
|
||||
id: projectId,
|
||||
});
|
||||
if (carrierTypeAtRequest === '承运商') {
|
||||
if (carrierTypeAtRequest !== '自运') {
|
||||
if (!projectId) {
|
||||
this.taskCarrierOptions = [];
|
||||
return Promise.resolve([]);
|
||||
@@ -5545,12 +5560,6 @@ export default {
|
||||
if (requestId !== this.taskCarrierRequestId) return this.taskCarrierOptions;
|
||||
if (options === null) return this.taskCarrierOptions;
|
||||
this.taskCarrierOptions = options || [];
|
||||
if (!this.taskCarrierOptions.length && this.form.carrierType === '自运') {
|
||||
const customerContract = this.contractOptions.find(
|
||||
item => String(item.id) === String(this.form.contractId)
|
||||
);
|
||||
this.fillSelfOperatedCarrierFromContract(customerContract);
|
||||
}
|
||||
return this.taskCarrierOptions;
|
||||
})
|
||||
.catch(() => this.taskCarrierOptions)
|
||||
@@ -5599,14 +5608,19 @@ export default {
|
||||
},
|
||||
handleTaskCarrierChange(value) {
|
||||
const carrier = this.taskCarrierOptions.find(item =>
|
||||
[item.value, item.customerName, item.carrierName, item.fullName, item.name].some(
|
||||
name => String(name || '') === String(value || '')
|
||||
)
|
||||
[
|
||||
this.taskCarrierOptionValue(item),
|
||||
item.value,
|
||||
item.customerName,
|
||||
item.carrierName,
|
||||
item.fullName,
|
||||
item.name,
|
||||
].some(name => String(name || '') === String(value || ''))
|
||||
);
|
||||
if (this.form.carrierType === '承运商') {
|
||||
if (this.form.carrierType !== '自运') {
|
||||
this.form.carrierContractId = carrier?.carrierContractId || '';
|
||||
this.form.carrierId = carrier?.carrierId || '';
|
||||
this.form.carrierName = carrier?.carrierName || value || '';
|
||||
this.form.carrierName = carrier?.carrierName || '';
|
||||
return;
|
||||
}
|
||||
this.form.carrierId = carrier?.carrierContractId ? '' : carrier?.id || '';
|
||||
@@ -7537,7 +7551,7 @@ export default {
|
||||
},
|
||||
handleImport() {
|
||||
if (this.config.enableWaybillImport) {
|
||||
this.waybillImportBox = true;
|
||||
this.$router.push({ path: '/business/waybill-import' });
|
||||
return;
|
||||
}
|
||||
const column = this.findColumn(this.excelOptionConfig.column, 'excelFile');
|
||||
|
||||
Reference in New Issue
Block a user