This commit is contained in:
2026-08-26 23:18:14 +08:00
parent 9d512ebad4
commit b36aefc7c4
43 changed files with 991 additions and 383 deletions
+190
View File
@@ -204,6 +204,29 @@
<el-input v-model="driverForm.address" maxlength="200" show-word-limit />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="18">
<el-col :span="8">
<el-form-item label="驾驶车辆" prop="drivingVehicle">
<el-input
v-model="driverForm.drivingVehicle"
maxlength="30"
clearable
placeholder="请输入或选择车辆"
>
<template #append>
<el-tooltip content="选择车辆" placement="top">
<el-button
:icon="List"
:disabled="readonly"
aria-label="选择车辆"
@click="openVehicleSelector"
/>
</el-tooltip>
</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="岗位" prop="postList">
<el-checkbox-group v-model="driverForm.postList">
@@ -487,6 +510,64 @@
</el-button>
</template>
</el-dialog>
<el-dialog
v-model="vehicleSelectorVisible"
title="选择车辆"
append-to-body
width="92%"
top="4vh"
class="vehicle-selector-dialog"
@closed="resetVehicleSelector"
>
<avue-crud
v-if="vehicleSelectorVisible"
ref="vehicleSelectorCrud"
v-model="vehicleSelectorForm"
v-model:page="vehicleSelectorPage"
:option="vehicleSelectorOption"
:table-loading="vehicleSelectorLoading"
:data="vehicleSelectorData"
@search-change="vehicleSelectorSearchChange"
@search-reset="vehicleSelectorSearchReset"
@current-change="vehicleSelectorCurrentChange"
@size-change="vehicleSelectorSizeChange"
@refresh-change="vehicleSelectorRefreshChange"
@on-load="loadVehicleSelector"
>
<template #plateNo="{ row }">
<span>{{ row.plateNo || '-' }}</span>
</template>
<template #organizationName="{ row }">
{{ String(row.organizationName || '').replace(/^[\s\u3000]+/, '') }}
</template>
<template #boundDriver>
<span>-</span>
</template>
<template #certificationStatus="{ row }">
<el-tag :type="getVehicleCertificationStatus(row).type" class="status-text">
{{ getVehicleCertificationStatus(row).label }}
</el-tag>
</template>
<template #status="{ row }">
<el-tag :type="row.status === 1 ? 'primary' : 'info'" class="status-text">
{{ row.status === 1 ? '启用' : '停用' }}
</el-tag>
</template>
<template #drivingLicenseEndDate="{ row }">
{{ formatEndDate(row.drivingLicenseEndDate, row.drivingLicenseLongTerm) }}
</template>
<template #roadTransportCertEndDate="{ row }">
{{ formatEndDate(row.roadTransportCertEndDate, row.roadTransportCertLongTerm) }}
</template>
<template #annualReviewEndDate="{ row }">
{{ formatEndDate(row.annualReviewEndDate, row.annualReviewLongTerm) }}
</template>
<template #menu="{ row }">
<el-link type="primary" @click="selectDrivingVehicle(row)">选择</el-link>
</template>
</avue-crud>
</el-dialog>
</basic-container>
</template>
@@ -494,7 +575,9 @@
import { mapGetters } from 'vuex';
import NProgress from 'nprogress';
import { ElLoading } from 'element-plus';
import { List } from '@element-plus/icons-vue';
import { option } from '@/option/transportCapacity/driver';
import { option as transportVehicleOption } from '@/option/transportCapacity/transport-vehicle';
import {
getList,
getDetail,
@@ -506,6 +589,7 @@ import {
recognitionTransportCertificates,
recognizeBaiduOcr,
} from '@/api/transportCapacity/driver';
import { getList as getVehicleList } from '@/api/transportCapacity/transport-vehicle';
import { getDeptTree } from '@/api/system/dept';
import { getDictionary } from '@/api/system/dictbiz';
import { getLazyTree } from '@/api/base/region';
@@ -515,6 +599,25 @@ import { getUploadHeaders } from '@/utils/upload';
import { downloadXls } from '@/utils/util';
import ImageUploadField from '@/components/image-upload-field/main.vue';
const vehicleSelectorOption = {
...transportVehicleOption,
height: 430,
selection: false,
addBtn: false,
editBtn: false,
delBtn: false,
viewBtn: false,
columnBtn: false,
menuWidth: 90,
menuFixed: 'right',
column: transportVehicleOption.column.map(column => ({
...column,
dicData: Array.isArray(column.dicData)
? column.dicData.map(item => ({ ...item }))
: column.dicData,
})),
};
const emptyForm = () => ({
id: '',
driverName: '',
@@ -526,6 +629,7 @@ const emptyForm = () => ({
addressRegionPath: [],
addressRegion: '',
address: '',
drivingVehicle: '',
postList: ['司机'],
posts: '',
idCardFront: '',
@@ -560,6 +664,7 @@ export default {
data() {
return {
option,
List,
form: {},
query: {
expireStatus: '',
@@ -581,6 +686,17 @@ export default {
expired: 0,
},
driverBox: false,
vehicleSelectorVisible: false,
vehicleSelectorLoading: false,
vehicleSelectorOption,
vehicleSelectorForm: {},
vehicleSelectorData: [],
vehicleSelectorSearchForm: {},
vehicleSelectorPage: {
pageSize: 10,
currentPage: 1,
total: 0,
},
readonly: false,
driverForm: emptyForm(),
drivingLicenseUploads: {},
@@ -745,6 +861,11 @@ export default {
this.organizationOptions = this.formatDeptOptions(res.data.data || []);
const column = this.findColumn(this.option.column, 'organizationName');
column.dicData = this.organizationOptions;
const vehicleColumn = this.findColumn(
this.vehicleSelectorOption.column,
'organizationName'
);
vehicleColumn.dicData = this.organizationOptions;
if (this.driverBox && !this.driverForm.id && !this.driverForm.organizationName) {
this.driverForm.organizationName = this.getCurrentOrganizationName();
}
@@ -952,6 +1073,75 @@ export default {
this.submitLoading = false;
this.$refs.driverForm?.clearValidate();
},
openVehicleSelector() {
if (this.readonly) return;
this.vehicleSelectorPage.currentPage = 1;
this.vehicleSelectorVisible = true;
},
resetVehicleSelector() {
this.vehicleSelectorForm = {};
this.vehicleSelectorData = [];
this.vehicleSelectorSearchForm = {};
this.vehicleSelectorPage = {
pageSize: 10,
currentPage: 1,
total: 0,
};
},
normalizeVehicleSelectorQuery(params = {}) {
const query = {
...this.vehicleSelectorSearchForm,
...params,
};
if (Array.isArray(query.organizationName)) {
query.organizationName = query.organizationName[query.organizationName.length - 1] || '';
}
return query;
},
loadVehicleSelector(page = this.vehicleSelectorPage, params = {}) {
this.vehicleSelectorLoading = true;
getVehicleList(page.currentPage, page.pageSize, this.normalizeVehicleSelectorQuery(params))
.then(res => {
const data = res.data.data || {};
this.vehicleSelectorData = data.records || [];
this.vehicleSelectorPage.total = data.total || 0;
})
.finally(() => {
this.vehicleSelectorLoading = false;
});
},
vehicleSelectorSearchChange(params, done) {
this.vehicleSelectorSearchForm = params;
this.vehicleSelectorPage.currentPage = 1;
this.loadVehicleSelector(this.vehicleSelectorPage, params);
done();
},
vehicleSelectorSearchReset() {
this.vehicleSelectorSearchForm = {};
this.vehicleSelectorPage.currentPage = 1;
this.loadVehicleSelector();
},
vehicleSelectorCurrentChange(currentPage) {
this.vehicleSelectorPage.currentPage = currentPage;
},
vehicleSelectorSizeChange(pageSize) {
this.vehicleSelectorPage.pageSize = pageSize;
},
vehicleSelectorRefreshChange() {
this.loadVehicleSelector();
},
selectDrivingVehicle(row) {
this.driverForm.drivingVehicle = row.plateNo || '';
this.vehicleSelectorVisible = false;
},
getVehicleCertificationStatus(row) {
const statusMap = {
0: { label: '认证中', type: 'warning' },
1: { label: '已认证', type: 'success' },
2: { label: '已驳回', type: 'danger' },
};
return statusMap[row.certificationStatus] || { label: '-', type: 'info' };
},
setImage(prop, url) {
this.driverForm[prop] = url;
this.$refs.driverForm?.validateField(prop);