✨ 编辑打卡记录支持里程采集与结算后冻结
This commit is contained in:
@@ -2271,6 +2271,13 @@
|
|||||||
<span v-if="record.volume">体积 {{ record.volume }}方</span>
|
<span v-if="record.volume">体积 {{ record.volume }}方</span>
|
||||||
<span v-if="record.quantity">数量 {{ record.quantity }}</span>
|
<span v-if="record.quantity">数量 {{ record.quantity }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 里程只挂在末位节点上(needMileage 由后端下发),显示的是运单里程 -->
|
||||||
|
<div
|
||||||
|
v-if="record.needMileage && Number(record.mileage) > 0"
|
||||||
|
class="waybill-manage-page__punch-record-line"
|
||||||
|
>
|
||||||
|
里程 {{ record.mileage }} 公里
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="record.remark"
|
v-if="record.remark"
|
||||||
class="waybill-manage-page__punch-record-line"
|
class="waybill-manage-page__punch-record-line"
|
||||||
@@ -2867,6 +2874,20 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<!-- 里程只在末位打卡节点出现:后端按「末位 + 计费规则含里程」下发 needMileage,前端不自己推 -->
|
||||||
|
<el-col v-if="waybillPunchEditMileageVisible" :span="8">
|
||||||
|
<el-form-item label="里程">
|
||||||
|
<el-input
|
||||||
|
v-model="waybillPunchEditForm.mileage"
|
||||||
|
maxlength="10"
|
||||||
|
:disabled="waybillPunchEditMileageLocked"
|
||||||
|
placeholder="请输入"
|
||||||
|
@input="handleWaybillPunchMileageInput"
|
||||||
|
>
|
||||||
|
<template #append>公里</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="备注">
|
<el-form-item label="备注">
|
||||||
<el-input
|
<el-input
|
||||||
@@ -4029,6 +4050,7 @@ export default {
|
|||||||
weight: '',
|
weight: '',
|
||||||
volume: '',
|
volume: '',
|
||||||
quantity: '',
|
quantity: '',
|
||||||
|
mileage: '',
|
||||||
remark: '',
|
remark: '',
|
||||||
photos: [],
|
photos: [],
|
||||||
},
|
},
|
||||||
@@ -4431,6 +4453,15 @@ export default {
|
|||||||
waybillPunchEditPunchDisabled() {
|
waybillPunchEditPunchDisabled() {
|
||||||
return this.waybillPunchEditNode?.punch === false;
|
return this.waybillPunchEditNode?.punch === false;
|
||||||
},
|
},
|
||||||
|
// 里程:后端下发 needMileage 才出现(末位打卡节点 + 计费规则含里程);在途打卡不采集里程
|
||||||
|
waybillPunchEditMileageVisible() {
|
||||||
|
const record = this.waybillPunchEditRecord || {};
|
||||||
|
return record.needMileage === true && record.type !== 'enroute';
|
||||||
|
},
|
||||||
|
// 已生成结算单的运单里程冻结:输入框置灰,改动由后端拒绝
|
||||||
|
waybillPunchEditMileageLocked() {
|
||||||
|
return this.waybillPunchEditRecord?.mileageLocked === true;
|
||||||
|
},
|
||||||
waybillPunchEditRules() {
|
waybillPunchEditRules() {
|
||||||
return { punchTime: [{ required: true, message: '请选择打卡时间', trigger: 'change' }] };
|
return { punchTime: [{ required: true, message: '请选择打卡时间', trigger: 'change' }] };
|
||||||
},
|
},
|
||||||
@@ -5962,6 +5993,7 @@ export default {
|
|||||||
weight: record.weight || '',
|
weight: record.weight || '',
|
||||||
volume: record.volume || '',
|
volume: record.volume || '',
|
||||||
quantity: record.quantity || '',
|
quantity: record.quantity || '',
|
||||||
|
mileage: Number(record.mileage) > 0 ? String(record.mileage) : '',
|
||||||
remark: record.remark || '',
|
remark: record.remark || '',
|
||||||
photos: (record.photos || [])
|
photos: (record.photos || [])
|
||||||
.filter(photo => photo?.url)
|
.filter(photo => photo?.url)
|
||||||
@@ -6037,10 +6069,22 @@ export default {
|
|||||||
photos.splice(index, 1);
|
photos.splice(index, 1);
|
||||||
this.waybillPunchEditForm.photos = photos;
|
this.waybillPunchEditForm.photos = photos;
|
||||||
},
|
},
|
||||||
|
// 里程只收整数:非数字直接丢掉,长度与「维护里程」一致(≤10 位)
|
||||||
|
handleWaybillPunchMileageInput(value) {
|
||||||
|
this.waybillPunchEditForm.mileage = String(value || '')
|
||||||
|
.replace(/\D/g, '')
|
||||||
|
.slice(0, 10);
|
||||||
|
},
|
||||||
async submitWaybillPunchRecordEdit() {
|
async submitWaybillPunchRecordEdit() {
|
||||||
await this.$refs.waybillPunchRecordEditFormRef.validate();
|
await this.$refs.waybillPunchRecordEditFormRef.validate();
|
||||||
const record = this.waybillPunchEditRecord;
|
const record = this.waybillPunchEditRecord;
|
||||||
const form = this.waybillPunchEditForm;
|
const form = this.waybillPunchEditForm;
|
||||||
|
// 管理端里程选填:留空表示不改动运单里程,所以只校验填了值的情况
|
||||||
|
const mileageText = String(form.mileage || '').trim();
|
||||||
|
if (this.waybillPunchEditMileageVisible && mileageText && !/^[1-9]\d{0,9}$/.test(mileageText)) {
|
||||||
|
this.$message.warning('里程必须为不超过10位的正整数');
|
||||||
|
return;
|
||||||
|
}
|
||||||
const submit =
|
const submit =
|
||||||
typeof this.api?.savePunchRecord === 'function' ? this.api.savePunchRecord : savePunchRecord;
|
typeof this.api?.savePunchRecord === 'function' ? this.api.savePunchRecord : savePunchRecord;
|
||||||
this.waybillPunchRecordEditDialog.submitting = true;
|
this.waybillPunchRecordEditDialog.submitting = true;
|
||||||
@@ -6059,6 +6103,8 @@ export default {
|
|||||||
weight: form.weight,
|
weight: form.weight,
|
||||||
volume: form.volume,
|
volume: form.volume,
|
||||||
quantity: form.quantity,
|
quantity: form.quantity,
|
||||||
|
// 不传代表不改;后端按 null 处理
|
||||||
|
mileage: mileageText ? Number(mileageText) : undefined,
|
||||||
remark: form.remark,
|
remark: form.remark,
|
||||||
photos: form.photos.map(photo => ({ url: photo.url, type: photo.type })),
|
photos: form.photos.map(photo => ({ url: photo.url, type: photo.type })),
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user