fix bug
This commit is contained in:
@@ -32,6 +32,23 @@ const parseJsonArray = value => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const hasProcessConfig = value => {
|
||||||
|
if (isEmpty(value)) return false;
|
||||||
|
if (typeof value !== 'string') {
|
||||||
|
return Array.isArray(value) ? value.length > 0 : typeof value === 'object';
|
||||||
|
}
|
||||||
|
const text = value.trim();
|
||||||
|
if (!text) return false;
|
||||||
|
try {
|
||||||
|
const result = JSON.parse(text);
|
||||||
|
return Array.isArray(result)
|
||||||
|
? result.length > 0
|
||||||
|
: Boolean(result && Object.keys(result).length);
|
||||||
|
} catch (error) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const getFirstValue = (row, props) => {
|
const getFirstValue = (row, props) => {
|
||||||
const prop = props.find(item => !isEmpty(row[item]));
|
const prop = props.find(item => !isEmpty(row[item]));
|
||||||
return prop ? row[prop] : '';
|
return prop ? row[prop] : '';
|
||||||
@@ -96,6 +113,11 @@ export const config = {
|
|||||||
exportUrl: '/blade-transport/waybill-manage/export-waybill-manage',
|
exportUrl: '/blade-transport/waybill-manage/export-waybill-manage',
|
||||||
exportName: '运单管理',
|
exportName: '运单管理',
|
||||||
importUrl: '/blade-transport/waybill-manage/import-waybill-manage',
|
importUrl: '/blade-transport/waybill-manage/import-waybill-manage',
|
||||||
|
defaultForm: {
|
||||||
|
carrierType: '承运商',
|
||||||
|
quantityUnit: '吨',
|
||||||
|
priceUnit: '元/吨',
|
||||||
|
},
|
||||||
enableAllDept: false,
|
enableAllDept: false,
|
||||||
enableProjectSelect: true,
|
enableProjectSelect: true,
|
||||||
templateCreateTarget: 'waybill-manage',
|
templateCreateTarget: 'waybill-manage',
|
||||||
@@ -103,6 +125,13 @@ export const config = {
|
|||||||
enableShippingPlanSelect: true,
|
enableShippingPlanSelect: true,
|
||||||
enableShippingInfoForm: true,
|
enableShippingInfoForm: true,
|
||||||
enableTaskInfoForm: true,
|
enableTaskInfoForm: true,
|
||||||
|
enableWaybillFooterFreightSummary: true,
|
||||||
|
enableDraftSave: true,
|
||||||
|
saveAsDraft: true,
|
||||||
|
skipDraftValidation: true,
|
||||||
|
draftStatusProp: 'businessStatus',
|
||||||
|
draftStatus: 'draft',
|
||||||
|
draftSaveText: '暂存',
|
||||||
batchDelete: false,
|
batchDelete: false,
|
||||||
actionButtonLikeSearch: true,
|
actionButtonLikeSearch: true,
|
||||||
createText: '新建运单',
|
createText: '新建运单',
|
||||||
@@ -118,6 +147,16 @@ export const config = {
|
|||||||
actions: ['copy', 'cancel', 'reassign', 'complete', 'batchComplete'],
|
actions: ['copy', 'cancel', 'reassign', 'complete', 'batchComplete'],
|
||||||
statusProp: 'businessStatus',
|
statusProp: 'businessStatus',
|
||||||
statusTextProp: 'businessStatusName',
|
statusTextProp: 'businessStatusName',
|
||||||
|
formatStatus(row, prop, defaultText) {
|
||||||
|
if (
|
||||||
|
prop === 'businessStatus' &&
|
||||||
|
row.businessStatus === 'pending' &&
|
||||||
|
!hasProcessConfig(row.processJson)
|
||||||
|
) {
|
||||||
|
return '进行中';
|
||||||
|
}
|
||||||
|
return defaultText;
|
||||||
|
},
|
||||||
deleteStatus: ['draft'],
|
deleteStatus: ['draft'],
|
||||||
editStatus: ['draft', 'pending'],
|
editStatus: ['draft', 'pending'],
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -368,19 +368,19 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #taskInfoTitle-form>
|
<template #taskInfoTitle-form>
|
||||||
<div class="dialog-section-title">任务信息</div>
|
<div class="dialog-section-title dialog-section-title--action">
|
||||||
|
<span>任务信息</span>
|
||||||
|
<el-segmented
|
||||||
|
v-model="form.taskEntryMode"
|
||||||
|
:options="taskEntryModeOptions"
|
||||||
|
:disabled="dialogReadonly"
|
||||||
|
@change="handleTaskEntryModeChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #taskInfoForm-form>
|
<template #taskInfoForm-form>
|
||||||
<div class="business-crud-page__task">
|
<div class="business-crud-page__task">
|
||||||
<div class="business-crud-page__task-toolbar">
|
|
||||||
<el-segmented
|
|
||||||
v-model="form.taskEntryMode"
|
|
||||||
:options="taskEntryModeOptions"
|
|
||||||
:disabled="dialogReadonly"
|
|
||||||
@change="handleTaskEntryModeChange"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div v-if="isTaskFullMode" class="business-crud-page__task-full">
|
<div v-if="isTaskFullMode" class="business-crud-page__task-full">
|
||||||
<div class="business-crud-page__subsection">
|
<div class="business-crud-page__subsection">
|
||||||
<div
|
<div
|
||||||
@@ -663,6 +663,7 @@
|
|||||||
v-model="form.driverPhone"
|
v-model="form.driverPhone"
|
||||||
placeholder="请输入"
|
placeholder="请输入"
|
||||||
clearable
|
clearable
|
||||||
|
maxlength="20"
|
||||||
:disabled="dialogReadonly"
|
:disabled="dialogReadonly"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -671,21 +672,67 @@
|
|||||||
v-model="form.vehicleNo"
|
v-model="form.vehicleNo"
|
||||||
placeholder="请输入"
|
placeholder="请输入"
|
||||||
clearable
|
clearable
|
||||||
|
maxlength="30"
|
||||||
:disabled="dialogReadonly"
|
:disabled="dialogReadonly"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
<div class="business-crud-page__task-row">
|
<div class="business-crud-page__task-row">
|
||||||
|
<el-form-item
|
||||||
|
v-if="isRoadTransport"
|
||||||
|
label="挂车车牌号"
|
||||||
|
class="business-crud-page__task-span-1"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="form.trailerVehicleNo"
|
||||||
|
placeholder="请输入"
|
||||||
|
clearable
|
||||||
|
maxlength="30"
|
||||||
|
:disabled="dialogReadonly"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
v-if="isRoadTransport"
|
||||||
|
label="押运人"
|
||||||
|
class="business-crud-page__task-span-1"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="form.escortName"
|
||||||
|
placeholder="请输入"
|
||||||
|
clearable
|
||||||
|
maxlength="20"
|
||||||
|
:disabled="dialogReadonly"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
v-if="isRoadTransport"
|
||||||
|
label="押运人手机号"
|
||||||
|
class="business-crud-page__task-span-1"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="form.escortPhone"
|
||||||
|
placeholder="请输入"
|
||||||
|
clearable
|
||||||
|
maxlength="20"
|
||||||
|
:disabled="dialogReadonly"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="里程(km)" class="business-crud-page__task-span-1">
|
<el-form-item label="里程(km)" class="business-crud-page__task-span-1">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="form.mileage"
|
v-model="form.mileage"
|
||||||
placeholder="请输入"
|
placeholder="请输入"
|
||||||
clearable
|
clearable
|
||||||
|
maxlength="10"
|
||||||
:disabled="dialogReadonly"
|
:disabled="dialogReadonly"
|
||||||
@input="value => handleTaskNumberInput('mileage', value)"
|
@input="handleTaskMileageInput"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="预计发货日期" class="business-crud-page__task-span-1">
|
</div>
|
||||||
|
<div class="business-crud-page__task-row">
|
||||||
|
<el-form-item
|
||||||
|
:label="isRoadTransport ? '计划发货日期' : '预计发货日期'"
|
||||||
|
class="business-crud-page__task-span-1"
|
||||||
|
>
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="form.estimatedStartTime"
|
v-model="form.estimatedStartTime"
|
||||||
type="date"
|
type="date"
|
||||||
@@ -695,7 +742,10 @@
|
|||||||
:disabled="dialogReadonly"
|
:disabled="dialogReadonly"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="预计完成日期" class="business-crud-page__task-span-1">
|
<el-form-item
|
||||||
|
:label="isRoadTransport ? '计划完成日期' : '预计完成日期'"
|
||||||
|
class="business-crud-page__task-span-1"
|
||||||
|
>
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="form.estimatedEndTime"
|
v-model="form.estimatedEndTime"
|
||||||
type="date"
|
type="date"
|
||||||
@@ -724,7 +774,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div class="business-crud-page__task-row">
|
<div class="business-crud-page__task-row">
|
||||||
<el-form-item label="司机" class="business-crud-page__task-span-1">
|
<el-form-item
|
||||||
|
label="司机"
|
||||||
|
:required="isRoadTransport"
|
||||||
|
class="business-crud-page__task-span-1"
|
||||||
|
>
|
||||||
<el-select
|
<el-select
|
||||||
v-model="form.driverName"
|
v-model="form.driverName"
|
||||||
placeholder="请输入"
|
placeholder="请输入"
|
||||||
@@ -746,11 +800,12 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="司机手机号" required class="business-crud-page__task-span-1">
|
<el-form-item label="手机号" required class="business-crud-page__task-span-1">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="form.driverPhone"
|
v-model="form.driverPhone"
|
||||||
placeholder="请输入"
|
placeholder="请输入"
|
||||||
clearable
|
clearable
|
||||||
|
maxlength="20"
|
||||||
:disabled="dialogReadonly"
|
:disabled="dialogReadonly"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -759,6 +814,7 @@
|
|||||||
v-model="form.vehicleNo"
|
v-model="form.vehicleNo"
|
||||||
placeholder="请输入"
|
placeholder="请输入"
|
||||||
clearable
|
clearable
|
||||||
|
maxlength="30"
|
||||||
:disabled="dialogReadonly"
|
:disabled="dialogReadonly"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -767,6 +823,7 @@
|
|||||||
v-model="form.trailerVehicleNo"
|
v-model="form.trailerVehicleNo"
|
||||||
placeholder="请输入"
|
placeholder="请输入"
|
||||||
clearable
|
clearable
|
||||||
|
maxlength="30"
|
||||||
:disabled="dialogReadonly"
|
:disabled="dialogReadonly"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -777,6 +834,7 @@
|
|||||||
v-model="form.escortName"
|
v-model="form.escortName"
|
||||||
placeholder="请输入"
|
placeholder="请输入"
|
||||||
clearable
|
clearable
|
||||||
|
maxlength="20"
|
||||||
:disabled="dialogReadonly"
|
:disabled="dialogReadonly"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -785,6 +843,7 @@
|
|||||||
v-model="form.escortPhone"
|
v-model="form.escortPhone"
|
||||||
placeholder="请输入"
|
placeholder="请输入"
|
||||||
clearable
|
clearable
|
||||||
|
maxlength="20"
|
||||||
:disabled="dialogReadonly"
|
:disabled="dialogReadonly"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -793,13 +852,17 @@
|
|||||||
v-model="form.mileage"
|
v-model="form.mileage"
|
||||||
placeholder="请输入"
|
placeholder="请输入"
|
||||||
clearable
|
clearable
|
||||||
|
maxlength="10"
|
||||||
:disabled="dialogReadonly"
|
:disabled="dialogReadonly"
|
||||||
@input="value => handleTaskNumberInput('mileage', value)"
|
@input="handleTaskMileageInput"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
<div class="business-crud-page__task-row">
|
<div class="business-crud-page__task-row">
|
||||||
<el-form-item label="预计发货日期" class="business-crud-page__task-span-1">
|
<el-form-item
|
||||||
|
:label="isRoadTransport ? '计划发货日期' : '预计发货日期'"
|
||||||
|
class="business-crud-page__task-span-1"
|
||||||
|
>
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="form.estimatedStartTime"
|
v-model="form.estimatedStartTime"
|
||||||
type="date"
|
type="date"
|
||||||
@@ -809,7 +872,10 @@
|
|||||||
:disabled="dialogReadonly"
|
:disabled="dialogReadonly"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="预计完成日期" class="business-crud-page__task-span-1">
|
<el-form-item
|
||||||
|
:label="isRoadTransport ? '计划完成日期' : '预计完成日期'"
|
||||||
|
class="business-crud-page__task-span-1"
|
||||||
|
>
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="form.estimatedEndTime"
|
v-model="form.estimatedEndTime"
|
||||||
type="date"
|
type="date"
|
||||||
@@ -966,7 +1032,7 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="司机">
|
<el-form-item label="司机" :required="isRoadTransport && form.carrierType === '自运'">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="form.driverName"
|
v-model="form.driverName"
|
||||||
placeholder="请选择或输入司机"
|
placeholder="请选择或输入司机"
|
||||||
@@ -992,6 +1058,7 @@
|
|||||||
v-model="form.driverPhone"
|
v-model="form.driverPhone"
|
||||||
placeholder="请输入手机号"
|
placeholder="请输入手机号"
|
||||||
clearable
|
clearable
|
||||||
|
maxlength="20"
|
||||||
:disabled="dialogReadonly"
|
:disabled="dialogReadonly"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -1000,6 +1067,34 @@
|
|||||||
v-model="form.vehicleNo"
|
v-model="form.vehicleNo"
|
||||||
placeholder="请输入车牌号"
|
placeholder="请输入车牌号"
|
||||||
clearable
|
clearable
|
||||||
|
maxlength="30"
|
||||||
|
:disabled="dialogReadonly"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="isRoadTransport" label="挂车车牌号">
|
||||||
|
<el-input
|
||||||
|
v-model="form.trailerVehicleNo"
|
||||||
|
placeholder="请输入挂车车牌号"
|
||||||
|
clearable
|
||||||
|
maxlength="30"
|
||||||
|
:disabled="dialogReadonly"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="isRoadTransport" label="押运人">
|
||||||
|
<el-input
|
||||||
|
v-model="form.escortName"
|
||||||
|
placeholder="请输入押运人"
|
||||||
|
clearable
|
||||||
|
maxlength="20"
|
||||||
|
:disabled="dialogReadonly"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="isRoadTransport" label="押运人手机号">
|
||||||
|
<el-input
|
||||||
|
v-model="form.escortPhone"
|
||||||
|
placeholder="请输入押运人手机号"
|
||||||
|
clearable
|
||||||
|
maxlength="20"
|
||||||
:disabled="dialogReadonly"
|
:disabled="dialogReadonly"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -1078,16 +1173,17 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="里程(公里)">
|
<el-form-item label="里程(km)">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="form.mileage"
|
v-model="form.mileage"
|
||||||
placeholder="请输入里程"
|
placeholder="请输入里程"
|
||||||
clearable
|
clearable
|
||||||
|
maxlength="10"
|
||||||
:disabled="dialogReadonly"
|
:disabled="dialogReadonly"
|
||||||
@input="value => handleTaskNumberInput('mileage', value)"
|
@input="handleTaskMileageInput"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="预计发货日期">
|
<el-form-item :label="isRoadTransport ? '计划发货日期' : '预计发货日期'">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="form.estimatedStartTime"
|
v-model="form.estimatedStartTime"
|
||||||
type="date"
|
type="date"
|
||||||
@@ -1097,7 +1193,7 @@
|
|||||||
:disabled="dialogReadonly"
|
:disabled="dialogReadonly"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="预计完成日期">
|
<el-form-item :label="isRoadTransport ? '计划完成日期' : '预计完成日期'">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="form.estimatedEndTime"
|
v-model="form.estimatedEndTime"
|
||||||
type="date"
|
type="date"
|
||||||
@@ -1851,11 +1947,11 @@
|
|||||||
|
|
||||||
<template #menu-form-before>
|
<template #menu-form-before>
|
||||||
<div
|
<div
|
||||||
v-if="config.enableShippingTemplateFreight && !dialogReadonly"
|
v-if="showFooterFreightSummary && !dialogReadonly"
|
||||||
class="business-crud-page__shipping-template-footer-summary"
|
class="business-crud-page__shipping-template-footer-summary"
|
||||||
>
|
>
|
||||||
<span>
|
<span>
|
||||||
运费合计:<strong>¥{{ formatShippingTemplateFooterFreightTotal }}</strong>
|
运费合计:<strong>¥{{ formatFooterFreightTotal }}</strong>
|
||||||
</span>
|
</span>
|
||||||
<el-link
|
<el-link
|
||||||
type="primary"
|
type="primary"
|
||||||
@@ -1872,7 +1968,7 @@
|
|||||||
:loading="draftSaveLoading"
|
:loading="draftSaveLoading"
|
||||||
@click="handleDraftSave"
|
@click="handleDraftSave"
|
||||||
>
|
>
|
||||||
保存
|
{{ config.draftSaveText || '保存' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -2420,18 +2516,21 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<section-card title="待调度列表">
|
<section-card>
|
||||||
|
<template #title>
|
||||||
|
<span>待调度列表</span>
|
||||||
|
<span class="business-crud-page__dispatch-list-summary">
|
||||||
|
{{ dispatchSummaryText }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
:disabled="dispatchSummaryRemainingQuantity <= 0"
|
:disabled="!dispatchHasRemainingQuantity"
|
||||||
@click="handleDispatchAddRow"
|
@click="handleDispatchAddRow"
|
||||||
>
|
>
|
||||||
新增
|
新增
|
||||||
</el-button>
|
</el-button>
|
||||||
<span class="business-crud-page__dispatch-list-summary">
|
|
||||||
{{ dispatchSummaryText }}
|
|
||||||
</span>
|
|
||||||
</template>
|
</template>
|
||||||
<el-table
|
<el-table
|
||||||
:data="dispatchRows"
|
:data="dispatchRows"
|
||||||
@@ -4408,6 +4507,9 @@ export default {
|
|||||||
isTransportPlanPage() {
|
isTransportPlanPage() {
|
||||||
return this.config.permission === 'transport_plan';
|
return this.config.permission === 'transport_plan';
|
||||||
},
|
},
|
||||||
|
isRoadTransport() {
|
||||||
|
return this.config.permission === 'waybill_manage' && this.transportMode === 'road';
|
||||||
|
},
|
||||||
transportPlanImportDuplicateCount() {
|
transportPlanImportDuplicateCount() {
|
||||||
return this.transportPlanImportRows.filter(row => row._duplicate).length;
|
return this.transportPlanImportRows.filter(row => row._duplicate).length;
|
||||||
},
|
},
|
||||||
@@ -4479,50 +4581,50 @@ export default {
|
|||||||
.join('; ');
|
.join('; ');
|
||||||
return cargoInfo || this.dispatchRow.goodsInfo || '';
|
return cargoInfo || this.dispatchRow.goodsInfo || '';
|
||||||
},
|
},
|
||||||
dispatchSummaryTotalQuantity() {
|
dispatchSummaryItems() {
|
||||||
const goodsQuantity = this.dispatchPlanGoodsRows.reduce(
|
const summaryMap = new Map();
|
||||||
(total, row) =>
|
const addQuantity = (unit, field, quantity) => {
|
||||||
total +
|
const normalizedUnit = unit || '吨';
|
||||||
this.parseDispatchQuantity(row.quantity || row.cargoQuantity || row.goodsQuantity),
|
if (!summaryMap.has(normalizedUnit)) {
|
||||||
0
|
summaryMap.set(normalizedUnit, { unit: normalizedUnit, total: 0, assigned: 0 });
|
||||||
);
|
}
|
||||||
if (goodsQuantity > 0) return goodsQuantity;
|
summaryMap.get(normalizedUnit)[field] += this.parseDispatchQuantity(quantity);
|
||||||
return this.parseDispatchQuantity(
|
};
|
||||||
this.dispatchRow.totalQuantity ||
|
const goodsRows = this.dispatchPlanGoodsRows.length
|
||||||
this.dispatchRow.totalCargoQuantity ||
|
? this.dispatchPlanGoodsRows
|
||||||
this.dispatchRow.quantity
|
: [this.dispatchRow];
|
||||||
);
|
|
||||||
|
goodsRows.forEach(row => {
|
||||||
|
addQuantity(
|
||||||
|
this.getDispatchQuantityUnit(row),
|
||||||
|
'total',
|
||||||
|
row.quantity ||
|
||||||
|
row.cargoQuantity ||
|
||||||
|
row.goodsQuantity ||
|
||||||
|
row.totalQuantity ||
|
||||||
|
row.totalCargoQuantity
|
||||||
|
);
|
||||||
|
});
|
||||||
|
this.dispatchRows.forEach(row => {
|
||||||
|
addQuantity(this.getDispatchQuantityUnit(row), 'assigned', row.quantity);
|
||||||
|
});
|
||||||
|
|
||||||
|
return Array.from(summaryMap.values()).map(item => ({
|
||||||
|
...item,
|
||||||
|
remaining: Math.max(item.total - item.assigned, 0),
|
||||||
|
}));
|
||||||
},
|
},
|
||||||
dispatchSummaryAssignedQuantity() {
|
dispatchHasRemainingQuantity() {
|
||||||
return this.dispatchRows.reduce(
|
return this.dispatchSummaryItems.some(item => item.remaining > 0);
|
||||||
(total, row) => total + this.parseDispatchQuantity(row.quantity),
|
|
||||||
0
|
|
||||||
);
|
|
||||||
},
|
|
||||||
dispatchSummaryRemainingQuantity() {
|
|
||||||
const total = this.dispatchSummaryTotalQuantity;
|
|
||||||
const assigned = this.dispatchSummaryAssignedQuantity;
|
|
||||||
const remain = total - assigned;
|
|
||||||
return remain > 0 ? remain : 0;
|
|
||||||
},
|
|
||||||
dispatchSummaryUnit() {
|
|
||||||
const unitRow = this.dispatchPlanGoodsRows.find(
|
|
||||||
row => row.quantityUnit || row.goodsQuantityUnit || row.unit
|
|
||||||
);
|
|
||||||
return (
|
|
||||||
unitRow?.quantityUnit ||
|
|
||||||
unitRow?.goodsQuantityUnit ||
|
|
||||||
unitRow?.unit ||
|
|
||||||
this.dispatchRow.quantityUnit ||
|
|
||||||
this.dispatchRows.find(row => row.quantityUnit)?.quantityUnit ||
|
|
||||||
'吨'
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
dispatchSummaryText() {
|
dispatchSummaryText() {
|
||||||
const total = this.formatDispatchQuantity(this.dispatchSummaryTotalQuantity);
|
const formatSummary = field =>
|
||||||
const assigned = this.formatDispatchQuantity(this.dispatchSummaryAssignedQuantity);
|
this.dispatchSummaryItems
|
||||||
const remain = this.formatDispatchQuantity(this.dispatchSummaryRemainingQuantity);
|
.map(item => `${this.formatDispatchQuantity(item[field])}${item.unit}`)
|
||||||
return `共${total}${this.dispatchSummaryUnit} | 已调度 ${assigned}${this.dispatchSummaryUnit},剩余${remain}${this.dispatchSummaryUnit}`;
|
.join('、');
|
||||||
|
return `共${formatSummary('total')} | 已调度 ${formatSummary('assigned')},剩余${formatSummary(
|
||||||
|
'remaining'
|
||||||
|
)}`;
|
||||||
},
|
},
|
||||||
dispatchAttachmentRows() {
|
dispatchAttachmentRows() {
|
||||||
return this.parseJsonArray(this.dispatchRow.attachmentsJson);
|
return this.parseJsonArray(this.dispatchRow.attachmentsJson);
|
||||||
@@ -4738,8 +4840,22 @@ export default {
|
|||||||
: Number(this.shippingTemplateFreight.freightAmount || 0);
|
: Number(this.shippingTemplateFreight.freightAmount || 0);
|
||||||
return freightAmount + Number(this.shippingTemplateFreight.otherFreightAmount || 0);
|
return freightAmount + Number(this.shippingTemplateFreight.otherFreightAmount || 0);
|
||||||
},
|
},
|
||||||
formatShippingTemplateFooterFreightTotal() {
|
waybillFooterFreightTotal() {
|
||||||
return this.shippingTemplateFooterFreightTotal.toLocaleString('zh-CN', {
|
return Number(this.taskFreightAmount || 0) + Number(this.form.otherFeeTotal || 0);
|
||||||
|
},
|
||||||
|
showFooterFreightSummary() {
|
||||||
|
return (
|
||||||
|
this.config.enableShippingTemplateFreight === true ||
|
||||||
|
this.config.enableWaybillFooterFreightSummary === true
|
||||||
|
);
|
||||||
|
},
|
||||||
|
footerFreightTotal() {
|
||||||
|
return this.config.enableShippingTemplateFreight === true
|
||||||
|
? this.shippingTemplateFooterFreightTotal
|
||||||
|
: this.waybillFooterFreightTotal;
|
||||||
|
},
|
||||||
|
formatFooterFreightTotal() {
|
||||||
|
return this.footerFreightTotal.toLocaleString('zh-CN', {
|
||||||
minimumFractionDigits: 2,
|
minimumFractionDigits: 2,
|
||||||
maximumFractionDigits: 2,
|
maximumFractionDigits: 2,
|
||||||
});
|
});
|
||||||
@@ -5053,13 +5169,15 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
displayStatus(row, prop) {
|
displayStatus(row, prop) {
|
||||||
|
const formatStatus = this.config.formatStatus;
|
||||||
const textProp = prop === this.config.statusProp ? this.config.statusTextProp : '';
|
const textProp = prop === this.config.statusProp ? this.config.statusTextProp : '';
|
||||||
if (textProp && row[textProp]) {
|
|
||||||
return row[textProp];
|
|
||||||
}
|
|
||||||
const column = this.findColumn(this.option.column, prop);
|
const column = this.findColumn(this.option.column, prop);
|
||||||
const item = column && (column.dicData || []).find(dic => dic.value === row[prop]);
|
const item = column && (column.dicData || []).find(dic => dic.value === row[prop]);
|
||||||
return item ? item.label : row[prop] || '未知';
|
const defaultText =
|
||||||
|
textProp && row[textProp] ? row[textProp] : item ? item.label : row[prop] || '未知';
|
||||||
|
return typeof formatStatus === 'function'
|
||||||
|
? formatStatus(row, prop, defaultText)
|
||||||
|
: defaultText;
|
||||||
},
|
},
|
||||||
syncContractNoDisabled(type) {
|
syncContractNoDisabled(type) {
|
||||||
if (!this.config.enableContractForm) return;
|
if (!this.config.enableContractForm) return;
|
||||||
@@ -5223,16 +5341,17 @@ export default {
|
|||||||
},
|
},
|
||||||
normalizeRow(row, saveAsDraft = false) {
|
normalizeRow(row, saveAsDraft = false) {
|
||||||
const submitRow = { ...row };
|
const submitRow = { ...row };
|
||||||
|
const skipValidation = saveAsDraft && this.config.skipDraftValidation === true;
|
||||||
if (this.config.enableTransportPlanForm) {
|
if (this.config.enableTransportPlanForm) {
|
||||||
if (!this.validateTransportPlanForm(submitRow)) return false;
|
if (!skipValidation && !this.validateTransportPlanForm(submitRow)) return false;
|
||||||
submitRow.goodsJson = JSON.stringify(this.transportCargoRows);
|
submitRow.goodsJson = JSON.stringify(this.transportCargoRows);
|
||||||
if (this.config.enableShippingTemplateFreight) {
|
if (this.config.enableShippingTemplateFreight) {
|
||||||
if (!this.validateShippingTemplateFreight()) return false;
|
if (!skipValidation && !this.validateShippingTemplateFreight()) return false;
|
||||||
submitRow.freightJson = this.serializeShippingTemplateFreight();
|
submitRow.freightJson = this.serializeShippingTemplateFreight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.taskInfoFormEnabled) {
|
if (this.taskInfoFormEnabled) {
|
||||||
if (!this.validateTaskInfoForm(submitRow)) return false;
|
if (!skipValidation && !this.validateTaskInfoForm(submitRow)) return false;
|
||||||
this.syncTaskInfoToRow(submitRow);
|
this.syncTaskInfoToRow(submitRow);
|
||||||
}
|
}
|
||||||
if (this.config.enableAttachmentTable) {
|
if (this.config.enableAttachmentTable) {
|
||||||
@@ -5245,7 +5364,9 @@ export default {
|
|||||||
submitRow.billingPlanJson = JSON.stringify(this.billingPlanRows);
|
submitRow.billingPlanJson = JSON.stringify(this.billingPlanRows);
|
||||||
}
|
}
|
||||||
if (this.config.enableSettlementRule) {
|
if (this.config.enableSettlementRule) {
|
||||||
if (this.settlementRuleEnabled && !this.validateSettlementRule()) return false;
|
if (!skipValidation && this.settlementRuleEnabled && !this.validateSettlementRule()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
submitRow.settlementRuleJson = JSON.stringify(this.normalizeSettlementRule());
|
submitRow.settlementRuleJson = JSON.stringify(this.normalizeSettlementRule());
|
||||||
}
|
}
|
||||||
if (this.config.enableReconciliation) {
|
if (this.config.enableReconciliation) {
|
||||||
@@ -5255,7 +5376,7 @@ export default {
|
|||||||
submitRow.changeRecordJson = JSON.stringify(this.changeRecordRows);
|
submitRow.changeRecordJson = JSON.stringify(this.changeRecordRows);
|
||||||
}
|
}
|
||||||
if (this.config.saveAsDraft && saveAsDraft) {
|
if (this.config.saveAsDraft && saveAsDraft) {
|
||||||
submitRow.approvalStatus = 'draft';
|
submitRow[this.config.draftStatusProp || 'approvalStatus'] = this.config.draftStatus || 'draft';
|
||||||
}
|
}
|
||||||
delete submitRow.basicInfoTitle;
|
delete submitRow.basicInfoTitle;
|
||||||
delete submitRow.templateInfoTitle;
|
delete submitRow.templateInfoTitle;
|
||||||
@@ -5619,7 +5740,7 @@ export default {
|
|||||||
this.draftSaveLoading = true;
|
this.draftSaveLoading = true;
|
||||||
request(submitRow)
|
request(submitRow)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.$message.success('保存成功');
|
this.$message.success(`${this.config.draftSaveText || '保存'}成功`);
|
||||||
this.onLoad(this.page, this.query);
|
this.onLoad(this.page, this.query);
|
||||||
this.closeCrudDialog();
|
this.closeCrudDialog();
|
||||||
})
|
})
|
||||||
@@ -5798,6 +5919,15 @@ export default {
|
|||||||
const number = Number(match[0]);
|
const number = Number(match[0]);
|
||||||
return Number.isFinite(number) ? number : 0;
|
return Number.isFinite(number) ? number : 0;
|
||||||
},
|
},
|
||||||
|
getDispatchQuantityUnit(row = {}) {
|
||||||
|
return row.quantityUnit || row.goodsQuantityUnit || row.unit || '吨';
|
||||||
|
},
|
||||||
|
getDispatchSummaryItem(unit) {
|
||||||
|
return this.dispatchSummaryItems.find(item => item.unit === unit);
|
||||||
|
},
|
||||||
|
getDispatchRemainingQuantity(unit) {
|
||||||
|
return this.getDispatchSummaryItem(unit)?.remaining || 0;
|
||||||
|
},
|
||||||
formatDispatchQuantity(value) {
|
formatDispatchQuantity(value) {
|
||||||
const number = Number(value || 0);
|
const number = Number(value || 0);
|
||||||
if (!Number.isFinite(number)) return '0';
|
if (!Number.isFinite(number)) return '0';
|
||||||
@@ -6060,10 +6190,10 @@ export default {
|
|||||||
this.form.model = this.form.model || taskInfo.model || goodsInfo.model || '';
|
this.form.model = this.form.model || taskInfo.model || goodsInfo.model || '';
|
||||||
this.form.quantity = this.form.quantity || taskInfo.quantity || goodsInfo.quantity || '';
|
this.form.quantity = this.form.quantity || taskInfo.quantity || goodsInfo.quantity || '';
|
||||||
this.form.quantityUnit =
|
this.form.quantityUnit =
|
||||||
this.form.quantityUnit || taskInfo.quantityUnit || goodsInfo.quantityUnit || '';
|
this.form.quantityUnit || taskInfo.quantityUnit || goodsInfo.quantityUnit || '吨';
|
||||||
this.form.mileage = this.form.mileage || taskInfo.mileage || goodsInfo.mileage || '';
|
this.form.mileage = this.form.mileage || taskInfo.mileage || goodsInfo.mileage || '';
|
||||||
this.form.unitPrice = this.form.unitPrice || taskInfo.unitPrice || goodsInfo.unitPrice || '';
|
this.form.unitPrice = this.form.unitPrice || taskInfo.unitPrice || goodsInfo.unitPrice || '';
|
||||||
this.form.priceUnit = this.form.priceUnit || taskInfo.priceUnit || goodsInfo.priceUnit || '';
|
this.form.priceUnit = this.form.priceUnit || taskInfo.priceUnit || goodsInfo.priceUnit || '元/吨';
|
||||||
this.form.otherFeeTotal =
|
this.form.otherFeeTotal =
|
||||||
this.form.otherFeeTotal || taskInfo.otherFeeTotal || goodsInfo.otherFeeTotal || '';
|
this.form.otherFeeTotal || taskInfo.otherFeeTotal || goodsInfo.otherFeeTotal || '';
|
||||||
this.form.estimatedStartTime =
|
this.form.estimatedStartTime =
|
||||||
@@ -6111,9 +6241,9 @@ export default {
|
|||||||
loadTaskCarrierOptions() {
|
loadTaskCarrierOptions() {
|
||||||
if (!this.taskInfoFormEnabled || this.taskCarrierLoading) return Promise.resolve([]);
|
if (!this.taskInfoFormEnabled || this.taskCarrierLoading) return Promise.resolve([]);
|
||||||
this.taskCarrierLoading = true;
|
this.taskCarrierLoading = true;
|
||||||
return getCarrierCustomerList(1, 9999, { customerType: '承运商' })
|
return getCarrierCustomerList(1, 9999, { customerType: '承运商', status: 1 })
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.taskCarrierOptions = extractRecords(res);
|
this.taskCarrierOptions = extractRecords(res).filter(item => Number(item.status) === 1);
|
||||||
return this.taskCarrierOptions;
|
return this.taskCarrierOptions;
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
@@ -6307,6 +6437,11 @@ export default {
|
|||||||
handleTaskNumberInput(prop, value) {
|
handleTaskNumberInput(prop, value) {
|
||||||
this.form[prop] = this.normalizeTaskNumber(value);
|
this.form[prop] = this.normalizeTaskNumber(value);
|
||||||
},
|
},
|
||||||
|
handleTaskMileageInput(value) {
|
||||||
|
this.form.mileage = this.isRoadTransport
|
||||||
|
? String(value || '').replace(/\D/g, '').slice(0, 10)
|
||||||
|
: this.normalizeTaskNumber(value);
|
||||||
|
},
|
||||||
normalizeTaskNumber(value) {
|
normalizeTaskNumber(value) {
|
||||||
const text = String(value || '').replace(/[^\d.]/g, '');
|
const text = String(value || '').replace(/[^\d.]/g, '');
|
||||||
const parts = text.split('.');
|
const parts = text.split('.');
|
||||||
@@ -6352,6 +6487,9 @@ export default {
|
|||||||
requiredFields.push(['carrierName', '承运商']);
|
requiredFields.push(['carrierName', '承运商']);
|
||||||
}
|
}
|
||||||
if (row.carrierType === '自运') {
|
if (row.carrierType === '自运') {
|
||||||
|
if (this.isRoadTransport) {
|
||||||
|
requiredFields.push(['driverName', '司机']);
|
||||||
|
}
|
||||||
requiredFields.push(['driverPhone', '手机号']);
|
requiredFields.push(['driverPhone', '手机号']);
|
||||||
}
|
}
|
||||||
const emptyField = requiredFields.find(([prop]) => this.isBillingFieldEmpty(row[prop]));
|
const emptyField = requiredFields.find(([prop]) => this.isBillingFieldEmpty(row[prop]));
|
||||||
@@ -6363,8 +6501,10 @@ export default {
|
|||||||
['quantity', '数量'],
|
['quantity', '数量'],
|
||||||
['mileage', '里程'],
|
['mileage', '里程'],
|
||||||
['unitPrice', '单价'],
|
['unitPrice', '单价'],
|
||||||
['otherFeeTotal', '其他运费合计'],
|
|
||||||
];
|
];
|
||||||
|
if (this.isTaskFullMode) {
|
||||||
|
numberFields.push(['otherFeeTotal', '其他运费合计']);
|
||||||
|
}
|
||||||
const invalidField = numberFields.find(([prop]) => {
|
const invalidField = numberFields.find(([prop]) => {
|
||||||
const value = row[prop];
|
const value = row[prop];
|
||||||
return value !== undefined && value !== null && value !== '' && Number(value) < 0;
|
return value !== undefined && value !== null && value !== '' && Number(value) < 0;
|
||||||
@@ -6373,6 +6513,27 @@ export default {
|
|||||||
this.$message.warning(`${invalidField[1]}不能小于0`);
|
this.$message.warning(`${invalidField[1]}不能小于0`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (this.isRoadTransport) {
|
||||||
|
const invalidLengthField = [
|
||||||
|
['driverName', '司机', 20],
|
||||||
|
['driverPhone', '手机号', 20],
|
||||||
|
['vehicleNo', '车牌号', 30],
|
||||||
|
['trailerVehicleNo', '挂车车牌号', 30],
|
||||||
|
['escortName', '押运人', 20],
|
||||||
|
['escortPhone', '押运人手机号', 20],
|
||||||
|
].find(([prop, , max]) => String(row[prop] || '').length > max);
|
||||||
|
if (invalidLengthField) {
|
||||||
|
this.$message.warning(`${invalidLengthField[1]}不能超过${invalidLengthField[2]}个字符`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
row.mileage &&
|
||||||
|
(!/^\d{1,10}$/.test(String(row.mileage)) || Number(row.mileage) <= 0)
|
||||||
|
) {
|
||||||
|
this.$message.warning('里程必须为不超过10位的正整数');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
row.estimatedStartTime &&
|
row.estimatedStartTime &&
|
||||||
row.estimatedEndTime &&
|
row.estimatedEndTime &&
|
||||||
@@ -8886,17 +9047,51 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
formatDispatchCargoInfo(plan = {}, item = {}) {
|
formatDispatchCargoInfo(plan = {}, item = {}) {
|
||||||
const cargoName = item.cargoName || item.goodsName || plan.cargoName || '';
|
const goodsRows = this.parseJsonArray(plan.goodsJson);
|
||||||
const cargoType = item.cargoType || item.goodsType || plan.cargoType || '';
|
const sourceRows = goodsRows.length ? goodsRows : [item];
|
||||||
const quantity = item.quantity || item.cargoQuantity || item.goodsQuantity || '';
|
const groups = sourceRows.reduce((result, goods = {}) => {
|
||||||
const unit = item.quantityUnit || item.goodsQuantityUnit || item.unit || '';
|
const cargoType =
|
||||||
const quantityText = quantity ? `${quantity}${unit}` : '';
|
goods.cargoType ||
|
||||||
return (
|
goods.secondCargoTypeName ||
|
||||||
[cargoName, cargoType, quantityText].filter(Boolean).join(' - ') || plan.goodsInfo || ''
|
goods.secondCargoType ||
|
||||||
);
|
goods.goodsType ||
|
||||||
|
goods.type ||
|
||||||
|
plan.cargoType ||
|
||||||
|
'货物';
|
||||||
|
const unit = this.getDispatchQuantityUnit(goods);
|
||||||
|
if (!result[unit]) {
|
||||||
|
result[unit] = {
|
||||||
|
cargoType,
|
||||||
|
count: 0,
|
||||||
|
quantity: 0,
|
||||||
|
unit,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
result[unit].count += 1;
|
||||||
|
result[unit].quantity += this.parseDispatchQuantity(
|
||||||
|
goods.quantity || goods.cargoQuantity || goods.goodsQuantity
|
||||||
|
);
|
||||||
|
return result;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
const cargoInfo = Object.values(groups)
|
||||||
|
.map(
|
||||||
|
group =>
|
||||||
|
`${group.cargoType}等${group.count}种货物 | ${this.formatDispatchQuantity(
|
||||||
|
group.quantity
|
||||||
|
)}${group.unit || ''}`
|
||||||
|
)
|
||||||
|
.join(';');
|
||||||
|
return cargoInfo || plan.goodsInfo || '';
|
||||||
},
|
},
|
||||||
openDispatchItemDialog(index = -1, row = defaultDispatchRow()) {
|
openDispatchItemDialog(index = -1, row = defaultDispatchRow()) {
|
||||||
const defaultGoods = this.dispatchPlanGoodsRows[0] || {};
|
const defaultSummaryItem =
|
||||||
|
this.dispatchSummaryItems.find(item => item.remaining > 0) || this.dispatchSummaryItems[0];
|
||||||
|
const defaultGoods =
|
||||||
|
this.dispatchPlanGoodsRows.find(
|
||||||
|
item => this.getDispatchQuantityUnit(item) === defaultSummaryItem?.unit
|
||||||
|
) || this.dispatchPlanGoodsRows[0] || {};
|
||||||
|
const defaultUnit = defaultSummaryItem?.unit || this.getDispatchQuantityUnit(defaultGoods);
|
||||||
const baseRow = {
|
const baseRow = {
|
||||||
...defaultDispatchRow(),
|
...defaultDispatchRow(),
|
||||||
transportType: this.dispatchRow.transportType || '',
|
transportType: this.dispatchRow.transportType || '',
|
||||||
@@ -8910,8 +9105,8 @@ export default {
|
|||||||
quantity:
|
quantity:
|
||||||
index >= 0
|
index >= 0
|
||||||
? defaultGoods.quantity || ''
|
? defaultGoods.quantity || ''
|
||||||
: this.formatDispatchQuantity(this.dispatchSummaryRemainingQuantity),
|
: this.formatDispatchQuantity(this.getDispatchRemainingQuantity(defaultUnit)),
|
||||||
quantityUnit: defaultGoods.quantityUnit || '吨',
|
quantityUnit: defaultUnit,
|
||||||
specification: defaultGoods.specification || '',
|
specification: defaultGoods.specification || '',
|
||||||
model: defaultGoods.model || '',
|
model: defaultGoods.model || '',
|
||||||
packageType: defaultGoods.packageType || '',
|
packageType: defaultGoods.packageType || '',
|
||||||
@@ -9000,17 +9195,18 @@ export default {
|
|||||||
...this.dispatchItemForm,
|
...this.dispatchItemForm,
|
||||||
attachmentsJson: JSON.stringify(this.dispatchItemAttachmentRows),
|
attachmentsJson: JSON.stringify(this.dispatchItemAttachmentRows),
|
||||||
};
|
};
|
||||||
|
const quantityUnit = this.getDispatchQuantityUnit(nextRow);
|
||||||
const otherDispatchedQuantity = this.dispatchRows.reduce((total, row, index) => {
|
const otherDispatchedQuantity = this.dispatchRows.reduce((total, row, index) => {
|
||||||
if (index === this.dispatchItemIndex) return total;
|
if (index === this.dispatchItemIndex || this.getDispatchQuantityUnit(row) !== quantityUnit) {
|
||||||
|
return total;
|
||||||
|
}
|
||||||
return total + this.parseDispatchQuantity(row.quantity);
|
return total + this.parseDispatchQuantity(row.quantity);
|
||||||
}, 0);
|
}, 0);
|
||||||
const currentQuantity = this.parseDispatchQuantity(nextRow.quantity);
|
const currentQuantity = this.parseDispatchQuantity(nextRow.quantity);
|
||||||
const totalQuantity = this.dispatchSummaryTotalQuantity;
|
const totalQuantity = this.getDispatchSummaryItem(quantityUnit)?.total || 0;
|
||||||
if (totalQuantity > 0 && otherDispatchedQuantity + currentQuantity > totalQuantity) {
|
if (totalQuantity > 0 && otherDispatchedQuantity + currentQuantity > totalQuantity) {
|
||||||
this.$message.warning(
|
this.$message.warning(
|
||||||
`已调度数量合计不能超过总数量${this.formatDispatchQuantity(totalQuantity)}${
|
`已调度${quantityUnit}合计不能超过总数量${this.formatDispatchQuantity(totalQuantity)}${quantityUnit}`
|
||||||
this.dispatchSummaryUnit
|
|
||||||
}`
|
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -9039,7 +9235,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleDispatchAddRow() {
|
handleDispatchAddRow() {
|
||||||
if (this.dispatchSummaryRemainingQuantity <= 0) {
|
if (!this.dispatchHasRemainingQuantity) {
|
||||||
this.$message.warning('剩余数量为0,不能新增调度明细');
|
this.$message.warning('剩余数量为0,不能新增调度明细');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -9141,7 +9337,7 @@ export default {
|
|||||||
},
|
},
|
||||||
submitDispatch(mode) {
|
submitDispatch(mode) {
|
||||||
this.dispatchSaving = mode;
|
this.dispatchSaving = mode;
|
||||||
const shouldCompletePlan = mode === 'submit' && this.dispatchSummaryRemainingQuantity <= 0;
|
const shouldCompletePlan = mode === 'submit' && !this.dispatchHasRemainingQuantity;
|
||||||
this.api
|
this.api
|
||||||
.dispatch(this.buildDispatchPayload(mode))
|
.dispatch(this.buildDispatchPayload(mode))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@@ -9329,12 +9525,6 @@ export default {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__task-toolbar {
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-end;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__task-form {
|
&__task-form {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||||
|
|||||||
Reference in New Issue
Block a user