@@ -12,6 +12,9 @@
|
||||
<el-descriptions-item label="方案名称">{{
|
||||
displayValue(draft.planName)
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="适用客商">{{
|
||||
displayValue(draft.customerName || partyOptionLabel(draft.partyRowId))
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="运输方式">{{
|
||||
transportModeLabel(draft.transportMode)
|
||||
}}</el-descriptions-item>
|
||||
@@ -37,6 +40,20 @@
|
||||
:disabled="readonly" /></el-form-item
|
||||
></el-col>
|
||||
<el-col :span="8"
|
||||
><el-form-item label="适用客商" prop="partyRowId"
|
||||
><el-select
|
||||
v-model="draft.partyRowId"
|
||||
clearable
|
||||
filterable
|
||||
placeholder="请选择适用客商"
|
||||
@change="handlePartyChange"
|
||||
><el-option
|
||||
v-for="item in partyOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value" /></el-select></el-form-item
|
||||
></el-col>
|
||||
<el-col :span="8"
|
||||
><el-form-item label="运输方式" prop="transportMode"
|
||||
><el-select
|
||||
v-model="draft.transportMode"
|
||||
@@ -433,6 +450,7 @@ export default {
|
||||
index: { type: Number, default: -1 },
|
||||
readonly: Boolean,
|
||||
settlementCurrency: { type: String, default: 'RMB' },
|
||||
partyOptions: { type: Array, default: () => [] },
|
||||
},
|
||||
emits: ['update:modelValue', 'save'],
|
||||
data() {
|
||||
@@ -476,6 +494,7 @@ export default {
|
||||
cargoRequest: null,
|
||||
formRules: {
|
||||
planName: [{ required: true, message: '请输入方案名称', trigger: 'blur' }],
|
||||
partyRowId: [{ required: true, message: '请选择适用客商', trigger: 'change' }],
|
||||
transportMode: [{ required: true, message: '请选择运输方式', trigger: 'change' }],
|
||||
},
|
||||
};
|
||||
@@ -549,6 +568,10 @@ export default {
|
||||
normalizePlan(value = {}) {
|
||||
const plan = {
|
||||
planName: '',
|
||||
partyRowId: '',
|
||||
partyRole: '',
|
||||
customerId: '',
|
||||
customerName: '',
|
||||
transportMode: '',
|
||||
transportModeLabel: '',
|
||||
defaultPlan: false,
|
||||
@@ -560,6 +583,21 @@ export default {
|
||||
);
|
||||
return plan;
|
||||
},
|
||||
partyOptionLabel(partyRowId) {
|
||||
const matched = (this.partyOptions || []).find(
|
||||
item => String(item.value) === String(partyRowId)
|
||||
);
|
||||
return matched?.label || '';
|
||||
},
|
||||
handlePartyChange(partyRowId) {
|
||||
const matched = (this.partyOptions || []).find(
|
||||
item => String(item.value) === String(partyRowId)
|
||||
);
|
||||
this.draft.partyRowId = matched?.partyRowId || matched?.value || '';
|
||||
this.draft.partyRole = matched?.partyRole || '';
|
||||
this.draft.customerId = matched?.customerId || '';
|
||||
this.draft.customerName = matched?.customerName || '';
|
||||
},
|
||||
normalizeRule(rule = {}) {
|
||||
const next = { ...defaultRule(), ...clone(rule) };
|
||||
if (next.billingType === '阶梯单价' && next.minimumBillingWeight === '') {
|
||||
@@ -1032,6 +1070,11 @@ export default {
|
||||
this.$refs.formRef.validate(valid => {
|
||||
if (!valid || !this.validateRules()) return;
|
||||
const plan = clone(this.draft);
|
||||
this.handlePartyChange(plan.partyRowId);
|
||||
plan.partyRowId = this.draft.partyRowId;
|
||||
plan.partyRole = this.draft.partyRole;
|
||||
plan.customerId = this.draft.customerId;
|
||||
plan.customerName = this.draft.customerName;
|
||||
const transportMode = this.transportModeOptions.find(
|
||||
item => String(item.value) === String(plan.transportMode)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user