调整 合同、运力、基础配置、客商
This commit is contained in:
@@ -60,15 +60,44 @@
|
||||
</el-button>
|
||||
</template>
|
||||
<template #vehicleNoForm>
|
||||
<el-autocomplete
|
||||
<el-select
|
||||
v-model="form.vehicleNo"
|
||||
:fetch-suggestions="fetchVehicleOptions"
|
||||
:disabled="boxType === 'view'"
|
||||
clearable
|
||||
:loading="vehicleOptionsLoading"
|
||||
:placeholder="vehicleNoPlaceholder"
|
||||
value-key="value"
|
||||
class="violation-record-page__input"
|
||||
/>
|
||||
clearable
|
||||
filterable
|
||||
remote
|
||||
:remote-method="loadVehicleOptions"
|
||||
@visible-change="handleVehicleSelectVisible"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in vehicleOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
<template #vehicleNo-form>
|
||||
<el-select
|
||||
v-model="form.vehicleNo"
|
||||
:disabled="boxType === 'view'"
|
||||
:loading="vehicleOptionsLoading"
|
||||
:placeholder="vehicleNoPlaceholder"
|
||||
clearable
|
||||
filterable
|
||||
remote
|
||||
:remote-method="loadVehicleOptions"
|
||||
@visible-change="handleVehicleSelectVisible"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in vehicleOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
<template #driverNameForm>
|
||||
<el-autocomplete
|
||||
@@ -204,6 +233,9 @@ export default {
|
||||
},
|
||||
selectionList: [],
|
||||
boxType: '',
|
||||
vehicleOptions: [],
|
||||
vehicleOptionsLoading: false,
|
||||
vehicleOptionsRequestId: 0,
|
||||
data: [],
|
||||
};
|
||||
},
|
||||
@@ -226,7 +258,7 @@ export default {
|
||||
};
|
||||
},
|
||||
vehicleNoPlaceholder() {
|
||||
return this.form.vehicleType === '船舶' ? '输入船号模糊查询选择' : '输入车牌号模糊查询选择';
|
||||
return this.form.vehicleType === '船舶' ? '请选择船号' : '请选择车牌号';
|
||||
},
|
||||
ids() {
|
||||
const ids = [];
|
||||
@@ -284,7 +316,7 @@ export default {
|
||||
const typeColumn = this.findColumn(this.option.column, 'violationType');
|
||||
const itemColumn = this.findColumn(this.option.column, 'violationItem');
|
||||
vehicleNoColumn.placeholder =
|
||||
vehicleType === '船舶' ? '输入船号模糊查询选择' : '输入车牌号模糊查询选择';
|
||||
vehicleType === '船舶' ? '请选择船号' : '请选择车牌号';
|
||||
driverColumn.label = vehicleType === '船舶' ? '船长' : '驾驶人';
|
||||
typeColumn.display = vehicleType !== '船舶';
|
||||
itemColumn.display = vehicleType === '船舶';
|
||||
@@ -303,6 +335,8 @@ export default {
|
||||
if (!this.isDetailLoading && oldValue && vehicleType !== oldValue) {
|
||||
this.form.vehicleNo = '';
|
||||
this.form.driverName = '';
|
||||
this.vehicleOptions = [];
|
||||
this.loadVehicleOptions('');
|
||||
}
|
||||
if (vehicleType === '船舶') {
|
||||
this.form.violationType = undefined;
|
||||
@@ -317,21 +351,33 @@ export default {
|
||||
this.form.processResult = undefined;
|
||||
}
|
||||
},
|
||||
fetchVehicleOptions(queryString, callback) {
|
||||
handleVehicleSelectVisible(visible) {
|
||||
if (visible && !this.vehicleOptions.length) this.loadVehicleOptions('');
|
||||
},
|
||||
loadVehicleOptions(queryString = '') {
|
||||
const vehicleType = this.form.vehicleType || '车辆';
|
||||
const request = vehicleType === '船舶' ? getShipList : getVehicleList;
|
||||
const params =
|
||||
vehicleType === '船舶' ? { shipIdentifierNo: queryString } : { plateNo: queryString };
|
||||
const isShip = vehicleType === '船舶';
|
||||
const request = isShip ? getShipList : getVehicleList;
|
||||
const params = isShip ? { shipIdentifierNo: queryString } : { plateNo: queryString };
|
||||
const requestId = ++this.vehicleOptionsRequestId;
|
||||
this.vehicleOptionsLoading = true;
|
||||
request(1, 20, params)
|
||||
.then(res => {
|
||||
const records = res.data.data.records || [];
|
||||
callback(
|
||||
records.map(item => ({
|
||||
value: vehicleType === '船舶' ? item.shipIdentifierNo || item.shipName : item.plateNo,
|
||||
}))
|
||||
);
|
||||
if (requestId !== this.vehicleOptionsRequestId) return;
|
||||
const values = (res.data.data.records || [])
|
||||
.map(item => (isShip ? item.shipIdentifierNo || item.shipName : item.plateNo))
|
||||
.filter(Boolean);
|
||||
this.vehicleOptions = [...new Set(values)].map(value => ({ label: value, value }));
|
||||
if (this.form.vehicleNo && !this.vehicleOptions.some(item => item.value === this.form.vehicleNo)) {
|
||||
this.vehicleOptions.unshift({ label: this.form.vehicleNo, value: this.form.vehicleNo });
|
||||
}
|
||||
})
|
||||
.catch(() => callback([]));
|
||||
.catch(() => {
|
||||
if (requestId === this.vehicleOptionsRequestId) this.vehicleOptions = [];
|
||||
})
|
||||
.finally(() => {
|
||||
if (requestId === this.vehicleOptionsRequestId) this.vehicleOptionsLoading = false;
|
||||
});
|
||||
},
|
||||
fetchDriverOptions(queryString, callback) {
|
||||
getDriverList(1, 20, { driverName: queryString })
|
||||
@@ -418,7 +464,7 @@ export default {
|
||||
row.violationTime &&
|
||||
new Date(row.violationTime.replace(/-/g, '/')).getTime() > Date.now()
|
||||
) {
|
||||
this.$message.warning('时间不能超过当前时间');
|
||||
this.$message.warning('日期不能超过当前时间');
|
||||
return false;
|
||||
}
|
||||
if (Number(row.fineAmount) < 0) {
|
||||
@@ -512,6 +558,8 @@ export default {
|
||||
attachments: [],
|
||||
};
|
||||
this.updateVehicleTypeDisplays('车辆');
|
||||
this.vehicleOptions = [];
|
||||
this.loadVehicleOptions('');
|
||||
this.updateProcessResultDisplay('已处理');
|
||||
}
|
||||
if (['edit', 'view'].includes(type)) {
|
||||
@@ -524,6 +572,8 @@ export default {
|
||||
detail.processStatus = detail.processStatus || '未处理';
|
||||
this.form = detail;
|
||||
this.updateVehicleTypeDisplays(detail.vehicleType);
|
||||
this.vehicleOptions = [];
|
||||
this.loadVehicleOptions(detail.vehicleNo || '');
|
||||
this.updateProcessResultDisplay(detail.processStatus);
|
||||
})
|
||||
.finally(() => {
|
||||
|
||||
Reference in New Issue
Block a user