This commit is contained in:
2026-08-25 16:13:58 +08:00
parent e309987199
commit 55583551b5
14 changed files with 953 additions and 286 deletions
@@ -10,6 +10,9 @@
<el-descriptions-item label="方案名称">{{
displayValue(draft.planName)
}}</el-descriptions-item>
<el-descriptions-item label="运输方式">{{
transportModeLabel(draft.transportMode)
}}</el-descriptions-item>
<el-descriptions-item label="默认方案">{{
isDefaultPlan(draft) ? '是' : '否'
}}</el-descriptions-item>
@@ -31,10 +34,27 @@
maxlength="100"
:disabled="readonly" /></el-form-item
></el-col>
<el-col :span="8"
><el-form-item label="运输方式" prop="transportMode"
><el-select
v-model="draft.transportMode"
clearable
filterable
:loading="transportModeLoading"
placeholder="请选择运输方式"
@visible-change="visible => visible && ensureTransportModes()"
><el-option
v-for="item in transportModeOptions"
:key="item.value"
:label="item.label"
:value="item.value" /></el-select></el-form-item
></el-col>
<el-col :span="8"
><el-form-item label="默认方案"
><el-checkbox v-model="draft.defaultPlan" :disabled="readonly"
>默认方案</el-checkbox
><el-checkbox v-model="draft.defaultPlan" :disabled="readonly">默认方案</el-checkbox
><el-icon class="billing-plan-editor__default-tip" @click="showDefaultPlanTip"
><InfoFilled
/></el-icon>
></el-form-item
></el-col
>
@@ -340,6 +360,7 @@
import { getList as getCargoTypeList } from '@/api/base/cargo-type';
import { getList as getFeeItemList } from '@/api/base/fee-item';
import { getLazyTree as getRegionLazyTree } from '@/api/base/region';
import { InfoFilled } from '@element-plus/icons-vue';
import { getDictionary } from '@/api/system/dictbiz';
const clone = value => JSON.parse(JSON.stringify(value));
@@ -370,6 +391,7 @@ const defaultRule = () => ({
});
export default {
components: { InfoFilled },
props: {
modelValue: Boolean,
value: { type: Object, default: () => ({}) },
@@ -417,7 +439,10 @@ export default {
cargoFlatOptions: [],
cargoLoading: false,
cargoRequest: null,
formRules: { planName: [{ required: true, message: '请输入方案名称', trigger: 'blur' }] },
formRules: {
planName: [{ required: true, message: '请输入方案名称', trigger: 'blur' }],
transportMode: [{ required: true, message: '请选择运输方式', trigger: 'change' }],
},
};
},
computed: {
@@ -446,6 +471,7 @@ export default {
},
mounted() {
this.loadDictionaries();
this.ensureTransportModes();
},
watch: {
value: {
@@ -474,7 +500,7 @@ export default {
const option = this.transportModeOptions.find(
item => String(item.value) === String(value) || String(item.label) === String(value)
);
return this.displayValue(option?.label || value);
return this.displayValue(option?.label || this.draft.transportModeLabel || value);
},
isDefaultPlan(plan) {
return (
@@ -484,7 +510,14 @@ export default {
);
},
normalizePlan(value = {}) {
const plan = { planName: '', defaultPlan: false, remark: '', ...clone(value || {}) };
const plan = {
planName: '',
transportMode: '',
transportModeLabel: '',
defaultPlan: false,
remark: '',
...clone(value || {}),
};
plan.rules = (value?.rules?.length ? value.rules : [defaultRule()]).map(rule =>
this.normalizeRule(rule)
);
@@ -818,6 +851,10 @@ export default {
this.$refs.formRef.validate(valid => {
if (!valid || !this.validateRules()) return;
const plan = clone(this.draft);
const transportMode = this.transportModeOptions.find(
item => String(item.value) === String(plan.transportMode)
);
plan.transportModeLabel = transportMode?.label || plan.transportMode;
plan.rules = plan.rules.map(rule => {
const ranges = this.canEditLimit(rule) ? this.getRanges(rule) : [];
return {
@@ -837,6 +874,9 @@ export default {
this.visible = false;
});
},
showDefaultPlanTip() {
this.$message.info('同一运输方式仅支持配置一个默认计费方案');
},
openMatch(row, index) {
this.matchIndex = index;
this.matchForm = { ...defaultRule().matchCondition, ...(row.matchCondition || {}) };
@@ -1097,6 +1137,12 @@ export default {
margin: 12px 0;
}
.billing-plan-editor__default-tip {
margin-left: 6px;
color: #909399;
cursor: pointer;
}
.limit-list {
display: flex;
flex-direction: column;
@@ -80,7 +80,7 @@
</el-col>
<el-col :span="4"><el-form-item label="联系人"><el-input v-model="route.departureContact" placeholder="请输入" /></el-form-item></el-col>
<el-col :span="4"><el-form-item label="联系方式"><el-input v-model="route.departurePhone" placeholder="请输入" /></el-form-item></el-col>
<el-col :span="4"><el-form-item :label="dateStartLabel(route)" required><el-date-picker v-model="route.estimatedStartTime" type="date" value-format="YYYY-MM-DD" placeholder="请选择" /></el-form-item></el-col>
<el-col :span="4"><el-form-item :label="dateStartLabel(route)"><el-date-picker v-model="route.estimatedStartTime" type="date" value-format="YYYY-MM-DD" placeholder="请选择" /></el-form-item></el-col>
</el-row>
<el-row :gutter="16">
<el-col :span="12">
@@ -88,7 +88,7 @@
</el-col>
<el-col :span="4"><el-form-item label="联系人"><el-input v-model="route.arrivalContact" placeholder="请输入" /></el-form-item></el-col>
<el-col :span="4"><el-form-item label="联系方式"><el-input v-model="route.arrivalPhone" placeholder="请输入" /></el-form-item></el-col>
<el-col :span="4"><el-form-item :label="dateEndLabel(route)" required><el-date-picker v-model="route.estimatedEndTime" type="date" value-format="YYYY-MM-DD" placeholder="请选择" /></el-form-item></el-col>
<el-col :span="4"><el-form-item :label="dateEndLabel(route)"><el-date-picker v-model="route.estimatedEndTime" type="date" value-format="YYYY-MM-DD" placeholder="请选择" /></el-form-item></el-col>
</el-row>
</el-form>
@@ -601,8 +601,6 @@ export default {
if (goods.some(item => Number(item.dispatchQuantity) > this.availableDispatchQuantity(route, item))) return this.$message.warning('本次数量不能超过剩余数量');
this.syncFreightItems(route);
if (!this.validateFreightItems(route)) return;
if (!route.estimatedStartTime) return this.$message.warning(`请选择${this.dateStartLabel(route)}`);
if (!route.estimatedEndTime) return this.$message.warning(`请选择${this.dateEndLabel(route)}`);
if (!this.validateRoutePhones(route)) return;
if (route.documentType === '运单') {
if (this.isRoad(route)) {