fix bug
This commit is contained in:
@@ -63,8 +63,9 @@
|
||||
<el-autocomplete
|
||||
v-model="form.vehicleNo"
|
||||
:fetch-suggestions="fetchVehicleOptions"
|
||||
:disabled="boxType === 'view'"
|
||||
clearable
|
||||
placeholder="输入车牌号/船号模糊查询选择"
|
||||
:placeholder="vehicleNoPlaceholder"
|
||||
value-key="value"
|
||||
class="violation-record-page__input"
|
||||
/>
|
||||
@@ -74,12 +75,20 @@
|
||||
v-if="form.vehicleType !== '船舶'"
|
||||
v-model="form.driverName"
|
||||
:fetch-suggestions="fetchDriverOptions"
|
||||
:disabled="boxType === 'view'"
|
||||
clearable
|
||||
placeholder="输入驾驶人模糊查询选择"
|
||||
value-key="value"
|
||||
class="violation-record-page__input"
|
||||
/>
|
||||
<el-input v-else v-model="form.driverName" clearable maxlength="20" placeholder="请输入船长" />
|
||||
<el-input
|
||||
v-else
|
||||
v-model="form.driverName"
|
||||
:disabled="boxType === 'view'"
|
||||
clearable
|
||||
maxlength="20"
|
||||
placeholder="请输入船长"
|
||||
/>
|
||||
</template>
|
||||
<template #processStatus="{ row }">
|
||||
<span :class="row.processStatus === '未处理' ? 'violation-record-page__danger' : ''">
|
||||
@@ -89,6 +98,24 @@
|
||||
<template #attachments="{ row }">
|
||||
<span>{{ formatAttachments(row.attachments) }}</span>
|
||||
</template>
|
||||
<template #attachmentsForm>
|
||||
<vehicle-attachment-upload
|
||||
v-model="form.attachments"
|
||||
:readonly="boxType === 'view'"
|
||||
button-text="新增"
|
||||
button-icon="el-icon-plus"
|
||||
:show-tip="false"
|
||||
/>
|
||||
</template>
|
||||
<template #attachments-form>
|
||||
<vehicle-attachment-upload
|
||||
v-model="form.attachments"
|
||||
:readonly="boxType === 'view'"
|
||||
button-text="新增"
|
||||
button-icon="el-icon-plus"
|
||||
:show-tip="false"
|
||||
/>
|
||||
</template>
|
||||
</avue-crud>
|
||||
<empty-pagination
|
||||
:page="page"
|
||||
@@ -97,7 +124,7 @@
|
||||
@load="onLoad(page, query)"
|
||||
/>
|
||||
<el-dialog title="违章记录数据导入" append-to-body v-model="excelBox" width="555px">
|
||||
<avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter">
|
||||
<avue-form :option="excelOption" v-model="excelForm">
|
||||
<template #excelTemplate>
|
||||
<el-button type="primary" @click="handleTemplate">
|
||||
点击下载<i class="el-icon-download el-icon--right"></i>
|
||||
@@ -116,6 +143,7 @@ import { getList as getDriverList } from '@/api/transportCapacity/driver';
|
||||
import { getDeptTree } from '@/api/system/dept';
|
||||
import { exportBlob } from '@/api/common';
|
||||
import { downloadXls } from '@/utils/util';
|
||||
import { openImportDialog } from '@/utils/import-excel';
|
||||
import { getToken } from '@/utils/auth';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { excelOption, option } from '@/option/vehicle/violation-record';
|
||||
@@ -130,6 +158,7 @@ export default {
|
||||
loading: true,
|
||||
excelBox: false,
|
||||
excelForm: {},
|
||||
isDetailLoading: false,
|
||||
option,
|
||||
excelOption,
|
||||
page: {
|
||||
@@ -139,6 +168,7 @@ export default {
|
||||
total: 0,
|
||||
},
|
||||
selectionList: [],
|
||||
boxType: '',
|
||||
data: [],
|
||||
};
|
||||
},
|
||||
@@ -159,6 +189,9 @@ export default {
|
||||
editBtn: this.hasPermission('violation_record_edit'),
|
||||
};
|
||||
},
|
||||
vehicleNoPlaceholder() {
|
||||
return this.form.vehicleType === '船舶' ? '输入船号模糊查询选择' : '输入车牌号模糊查询选择';
|
||||
},
|
||||
ids() {
|
||||
const ids = [];
|
||||
this.selectionList.forEach(ele => {
|
||||
@@ -169,8 +202,8 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
'form.vehicleType': {
|
||||
handler(value) {
|
||||
this.updateVehicleTypeDisplays(value || '车辆');
|
||||
handler(value, oldValue) {
|
||||
this.updateVehicleTypeDisplays(value || '车辆', oldValue);
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
@@ -191,15 +224,22 @@ export default {
|
||||
column.dicData = res.data.data;
|
||||
});
|
||||
},
|
||||
updateVehicleTypeDisplays(vehicleType) {
|
||||
updateVehicleTypeDisplays(vehicleType, oldValue) {
|
||||
const vehicleTypeColumn = this.findColumn(this.option.column, 'vehicleType');
|
||||
const vehicleNoColumn = this.findColumn(this.option.column, 'vehicleNo');
|
||||
const driverColumn = this.findColumn(this.option.column, 'driverName');
|
||||
const typeColumn = this.findColumn(this.option.column, 'violationType');
|
||||
const itemColumn = this.findColumn(this.option.column, 'violationItem');
|
||||
vehicleNoColumn.placeholder =
|
||||
vehicleType === '船舶' ? '输入船号模糊查询选择' : '输入车牌号模糊查询选择';
|
||||
driverColumn.label = vehicleType === '船舶' ? '船长' : '驾驶人';
|
||||
typeColumn.display = vehicleType !== '船舶';
|
||||
itemColumn.display = vehicleType === '船舶';
|
||||
vehicleTypeColumn.disabled = Boolean(this.form.id);
|
||||
if (!this.isDetailLoading && oldValue && vehicleType !== oldValue) {
|
||||
this.form.vehicleNo = '';
|
||||
this.form.driverName = '';
|
||||
}
|
||||
if (vehicleType === '船舶') {
|
||||
this.form.violationType = undefined;
|
||||
} else {
|
||||
@@ -217,9 +257,7 @@ export default {
|
||||
const vehicleType = this.form.vehicleType || '车辆';
|
||||
const request = vehicleType === '船舶' ? getShipList : getVehicleList;
|
||||
const params =
|
||||
vehicleType === '船舶'
|
||||
? { shipIdentifierNo: queryString }
|
||||
: { plateNo: queryString };
|
||||
vehicleType === '船舶' ? { shipIdentifierNo: queryString } : { plateNo: queryString };
|
||||
request(1, 20, params)
|
||||
.then(res => {
|
||||
const records = res.data.data.records || [];
|
||||
@@ -277,7 +315,10 @@ export default {
|
||||
values.vehicleType = values.vehicleType || '车辆';
|
||||
values.processStatus = values.processStatus || '未处理';
|
||||
if (values.vehicleNo) {
|
||||
values.vehicleNo = values.vehicleNo.trim().toUpperCase();
|
||||
values.vehicleNo =
|
||||
values.vehicleType === '船舶'
|
||||
? values.vehicleNo.trim()
|
||||
: values.vehicleNo.trim().toUpperCase();
|
||||
}
|
||||
if (values.processStatus === '未处理') {
|
||||
values.processResult = undefined;
|
||||
@@ -291,7 +332,10 @@ export default {
|
||||
return values;
|
||||
},
|
||||
validateRow(row) {
|
||||
if (row.violationTime && new Date(row.violationTime.replace(/-/g, '/')).getTime() > Date.now()) {
|
||||
if (
|
||||
row.violationTime &&
|
||||
new Date(row.violationTime.replace(/-/g, '/')).getTime() > Date.now()
|
||||
) {
|
||||
this.$message.warning('时间不能超过当前时间');
|
||||
return false;
|
||||
}
|
||||
@@ -378,6 +422,7 @@ export default {
|
||||
});
|
||||
},
|
||||
beforeOpen(done, type) {
|
||||
this.boxType = type;
|
||||
if (type === 'add') {
|
||||
this.form = {
|
||||
vehicleType: '车辆',
|
||||
@@ -387,13 +432,20 @@ export default {
|
||||
this.updateProcessResultDisplay('未处理');
|
||||
}
|
||||
if (['edit', 'view'].includes(type)) {
|
||||
getDetail(this.form.id).then(res => {
|
||||
const detail = res.data.data;
|
||||
detail.attachments = this.parseAttachments(detail.attachments);
|
||||
this.form = detail;
|
||||
this.updateVehicleTypeDisplays(detail.vehicleType);
|
||||
this.updateProcessResultDisplay(detail.processStatus);
|
||||
});
|
||||
this.isDetailLoading = true;
|
||||
getDetail(this.form.id)
|
||||
.then(res => {
|
||||
const detail = res.data.data;
|
||||
detail.attachments = this.parseAttachments(detail.attachments);
|
||||
detail.vehicleType = detail.vehicleType || '车辆';
|
||||
detail.processStatus = detail.processStatus || '未处理';
|
||||
this.form = detail;
|
||||
this.updateVehicleTypeDisplays(detail.vehicleType);
|
||||
this.updateProcessResultDisplay(detail.processStatus);
|
||||
})
|
||||
.finally(() => {
|
||||
this.isDetailLoading = false;
|
||||
});
|
||||
}
|
||||
done();
|
||||
},
|
||||
@@ -437,12 +489,7 @@ export default {
|
||||
});
|
||||
},
|
||||
handleImport() {
|
||||
this.excelBox = true;
|
||||
},
|
||||
uploadAfter(res, done) {
|
||||
this.excelBox = false;
|
||||
this.onLoad(this.page);
|
||||
done();
|
||||
openImportDialog(this, '违章记录');
|
||||
},
|
||||
handleExport() {
|
||||
this.$confirm('是否导出违章记录数据?', '提示', {
|
||||
@@ -451,7 +498,10 @@ export default {
|
||||
type: 'warning',
|
||||
}).then(() => {
|
||||
NProgress.start();
|
||||
exportBlob('/blade-transport/violation-record/export-violation-record', this.buildExportParams())
|
||||
exportBlob(
|
||||
'/blade-transport/violation-record/export-violation-record',
|
||||
this.buildExportParams()
|
||||
)
|
||||
.then(res => {
|
||||
downloadXls(res.data, `违章记录${this.$dayjs().format('YYYY-MM-DD HH:mm:ss')}.xlsx`);
|
||||
})
|
||||
@@ -469,7 +519,9 @@ export default {
|
||||
},
|
||||
handleTemplate() {
|
||||
exportBlob(
|
||||
`/blade-transport/violation-record/export-template?${this.website.tokenHeader}=${getToken()}`
|
||||
`/blade-transport/violation-record/export-template?${
|
||||
this.website.tokenHeader
|
||||
}=${getToken()}`
|
||||
).then(res => {
|
||||
downloadXls(res.data, '违章记录模板.xlsx');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user