fix
This commit is contained in:
@@ -2143,6 +2143,9 @@
|
||||
<el-link type="primary" v-if="canComplete(row)" @click="handleAction('complete', row)">
|
||||
{{ completeActionLabel }}
|
||||
</el-link>
|
||||
<el-link type="primary" v-if="canMaintainMileage(row)" @click="openMileageDialog(row)">
|
||||
维护里程
|
||||
</el-link>
|
||||
<el-link
|
||||
v-for="operation in customOperations(row)"
|
||||
:key="operation.action"
|
||||
@@ -2156,6 +2159,59 @@
|
||||
</template>
|
||||
</component>
|
||||
|
||||
<el-dialog
|
||||
v-model="mileageDialog.visible"
|
||||
width="520px"
|
||||
append-to-body
|
||||
:close-on-click-modal="false"
|
||||
class="business-crud-page__mileage-dialog"
|
||||
@closed="resetMileageDialog"
|
||||
>
|
||||
<template #header>
|
||||
<div class="dialog-section-title">维护里程</div>
|
||||
</template>
|
||||
<el-form
|
||||
ref="mileageFormRef"
|
||||
:model="mileageForm"
|
||||
:rules="mileageRules"
|
||||
label-position="right"
|
||||
label-width="auto"
|
||||
class="business-crud-page__mileage-form"
|
||||
>
|
||||
<el-form-item label="里程(公里)" prop="mileage">
|
||||
<el-input
|
||||
:model-value="mileageForm.mileage"
|
||||
inputmode="numeric"
|
||||
maxlength="10"
|
||||
placeholder="请输入里程"
|
||||
@input="handleMaintainMileageInput"
|
||||
>
|
||||
<template #append>公里</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="mileageRemark">
|
||||
<el-input
|
||||
v-model="mileageForm.mileageRemark"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
maxlength="200"
|
||||
show-word-limit
|
||||
placeholder="请输入里程维护备注"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="mileageDialog.visible = false">取消</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
:loading="mileageDialog.submitting"
|
||||
@click="submitMileageMaintenance"
|
||||
>
|
||||
提交
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<empty-pagination
|
||||
v-show="!isStandaloneFormPage"
|
||||
:page="page"
|
||||
@@ -5507,6 +5563,26 @@ export default {
|
||||
waybillRouteChangeRecords: [],
|
||||
waybillRouteChangeDragIndex: -1,
|
||||
waybillRouteChangeSaving: false,
|
||||
mileageDialog: {
|
||||
visible: false,
|
||||
submitting: false,
|
||||
row: null,
|
||||
},
|
||||
mileageForm: {
|
||||
id: '',
|
||||
mileage: '',
|
||||
mileageRemark: '',
|
||||
},
|
||||
mileageRules: {
|
||||
mileage: [
|
||||
{ required: true, message: '请输入里程', trigger: 'blur' },
|
||||
{
|
||||
pattern: /^[1-9]\d{0,9}$/,
|
||||
message: '里程必须为不超过10位的正整数',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
waybillCommonAddressBox: false,
|
||||
waybillCommonAddressLoading: false,
|
||||
waybillCommonAddressQuery: {
|
||||
@@ -6717,6 +6793,15 @@ export default {
|
||||
? status === 'dispatching'
|
||||
: status === 'processing';
|
||||
},
|
||||
canMaintainMileage(row) {
|
||||
return (
|
||||
this.config.permission === 'waybill_manage' &&
|
||||
this.hasPermission(`${this.config.permission}_mileage`) &&
|
||||
typeof this.api.maintainMileage === 'function' &&
|
||||
this.statusValue(row) === 'completed' &&
|
||||
row.mileageMaintainable === true
|
||||
);
|
||||
},
|
||||
canReassign(row) {
|
||||
return (
|
||||
this.hasAction('reassign') &&
|
||||
@@ -11572,6 +11657,46 @@ export default {
|
||||
this.onLoad(this.page, this.query);
|
||||
});
|
||||
},
|
||||
openMileageDialog(row) {
|
||||
this.mileageDialog = {
|
||||
visible: true,
|
||||
submitting: false,
|
||||
row,
|
||||
};
|
||||
this.mileageForm = {
|
||||
id: row.id,
|
||||
mileage: row.mileage === null || row.mileage === undefined ? '' : String(row.mileage),
|
||||
mileageRemark: row.mileageRemark || '',
|
||||
};
|
||||
this.$nextTick(() => this.$refs.mileageFormRef?.clearValidate());
|
||||
},
|
||||
handleMaintainMileageInput(value) {
|
||||
this.mileageForm.mileage = String(value || '')
|
||||
.replace(/\D/g, '')
|
||||
.slice(0, 10);
|
||||
},
|
||||
async submitMileageMaintenance() {
|
||||
const valid = await this.$refs.mileageFormRef?.validate().catch(() => false);
|
||||
if (!valid || this.mileageDialog.submitting) return;
|
||||
this.mileageDialog.submitting = true;
|
||||
try {
|
||||
await this.api.maintainMileage({
|
||||
id: this.mileageForm.id,
|
||||
mileage: Number(this.mileageForm.mileage),
|
||||
mileageRemark: String(this.mileageForm.mileageRemark || '').trim(),
|
||||
});
|
||||
this.$message.success('里程维护成功');
|
||||
this.mileageDialog.visible = false;
|
||||
this.onLoad(this.page, this.query);
|
||||
} finally {
|
||||
this.mileageDialog.submitting = false;
|
||||
}
|
||||
},
|
||||
resetMileageDialog() {
|
||||
this.mileageDialog.row = null;
|
||||
this.mileageForm = { id: '', mileage: '', mileageRemark: '' };
|
||||
this.$refs.mileageFormRef?.clearValidate();
|
||||
},
|
||||
handleAction(action, row) {
|
||||
const actionName = {
|
||||
enable: '启用',
|
||||
@@ -15592,6 +15717,18 @@ export default {
|
||||
top: 92px !important;
|
||||
left: 0 !important;
|
||||
}
|
||||
:global(.business-crud-page__mileage-dialog .business-crud-page__mileage-form) {
|
||||
padding: 4px 20px 0;
|
||||
}
|
||||
|
||||
:global(.business-crud-page__mileage-dialog .business-crud-page__mileage-form .el-form-item) {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
:global(.business-crud-page__mileage-dialog .business-crud-page__mileage-form .el-input),
|
||||
:global(.business-crud-page__mileage-dialog .business-crud-page__mileage-form .el-textarea) {
|
||||
width: 100%;
|
||||
}
|
||||
.el-input__icon {
|
||||
color: #1e90ff !important;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user