Commit 573c387b by yancanhua

fix: 车辆检测开发

1 parent 6a506788
import { AxiosResponse, AxiosStatic } from 'axios';
/**
*/
export class DetectionController {
static pagePreference(axios: AxiosStatic, params: any): Promise<AxiosResponse> {
return axios.post('inspect/page', params);
}
static PAGE_INSPECTOR = 'inspect/page';
static getPreferenceDetail(axios: AxiosStatic, id: number): Promise<AxiosResponse> {
return axios.get('account/preference/detail/' + id, {});
}
static inspectAdd(axios: AxiosStatic, params: any): Promise<AxiosResponse> {
return axios.post('inspect/add', params);
}
static exportPreference(axios: AxiosStatic, params: any, config?: any): Promise<AxiosResponse<void>> {
return axios.post('account/preference/export', params, config);
}
}
......@@ -2,22 +2,30 @@
<a-card class="tabs-card" :bordered="false">
<!--查询栏-->
<m-pagination-query-render :fields="pagination.filterFields" :form="pagination.queryForm" @onSearch="pageReload"
@onReset="pageReset" :simpleFieldNum="4" />
@onReset="handleReset()" :simpleFieldNum="4">
<template #cityCodeName="{ record }">
<a-cascader v-model:value="carProvinceCity" :options="areaData" @change="handleChangeCity"
placeholder="请选择省/市" />
</template>
</m-pagination-query-render>
<!--查询栏end-->
<!--库存车辆列表start-->
<div class="table-operations" style="margin-bottom: 16px;width: 100%;float: left;">
<div class="flex justify-end" style="float: left;">
检测师列表
</div>
<div class="flex justify-end" style="float: right;">
<a-button type="primary" @click="handleAdd()" >新增检测师</a-button>
<a-button type="primary" @click="handleAdd()">新增检测师</a-button>
<a-button @click="downloadExcel" :disabled="exporting">导出</a-button>
</div>
</div>
<a-table :columns="columns" :data-source="pagination.content" :loading="loading" :bordered="false"
@change="pageRefresh" @resizeColumn="this.$filters.tableResizeColumn" size="small" :pagination="pageState"
:row-key="record => record.vehicleId" :scroll="{ y: 'calc(100vh - 350px)' }">
:row-key="record => record.id" :scroll="{ y: 'calc(100vh - 288px)' }">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'vehicleState'">
111
......@@ -25,6 +33,7 @@
</template>
</a-table>
<!--新增/编辑检测师弹窗-->
<InspectorAddForm ref="inspectorAddFormRef" />
</a-card>
......@@ -32,9 +41,7 @@
<script lang="ts">
import { Component } from 'vue-facing-decorator';
import { message, TableColumnsType } from "ant-design-vue";
import { VehicleController } from "@/api/VehicleController";
import { Operator, Order } from "lib/src/core/page/Pagination";
import VehicleStateTag from "@/views/vehicle/inventory/VehicleStateTag.vue";
import { PaginationComponent } from "@/components/PaginationComponent";
import { Vehicle } from "lib/src/entity/vehicle/entity/Vehicle";
import { Security } from "@/store";
......@@ -42,62 +49,84 @@ import { ExportUtil } from "@/common/ExportUtil";
import InspectorAddForm from "@/views/detection/inspector/components/InspectorAddForm.vue";
import { DetectionController } from "@/api/DetectionController";
import { convertToTree } from "@/common/chinaarea";
import { DefaultOptionType } from "ant-design-vue/es/vc-cascader/Cascader";
@Component({
components: { InspectorAddForm }
})
export default class detectionInspectorPage extends PaginationComponent<Vehicle> {
vehicleStateIndex = "0";
exporting = false;
vehicleCount: any = {};
@Security.Getter hasPrivilege;
export default class DetectionInspectorPage extends PaginationComponent<Vehicle> {
areaData: DefaultOptionType[] = [];
carProvinceCity = [];
detectingStatusList = [
{ label: '待检测', value: 'TO_BE_DETECTED' },
{ label: '检测中', value: 'DETECTING' },
{ label: '已检测', value: 'DETECTED' },
];
exporting = false;
reviewStatusList = [
{ label: '待审核', value: 'TO_BE_AUDITED' },
{ label: '审核中', value: 'AUDITING' },
{ label: '已审核', value: 'AUDITED' },
{ label: '启用', value: '1' },
{ label: '禁用', value: '0' },
];
tabKey = "TO_BE_PRICED";
/**
* 表格列配置
*/
columns: TableColumnsType = [
{ title: '姓名', dataIndex: ['baseInfo', "sourceNo"], key: 'sourceNo', align: 'center', width: 150, resizable: true, ellipsis: true },
{ title: '手机号', dataIndex: 'updateTime', key: 'updateTime', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '所在城市', dataIndex: ['baseInfo', "sourceNo"], key: 'sourceNo', align: 'center', width: 150, resizable: true, ellipsis: true },
{ title: '待检测任务', dataIndex: ['baseInfo', "vin"], key: 'vin', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '检测中任务', dataIndex: ['baseInfo', "carTypeName"], key: 'carTypeName', align: 'center', width: 240, resizable: true, ellipsis: true },
{ title: '已完成任命', dataIndex: 'warehousingTime', key: 'warehousingTime', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '平均检测耗时', dataIndex: 'createTime', key: 'createTime', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '账号状态', dataIndex: 'updateTime', key: 'updateTime', align: 'center', width: 170, resizable: true, ellipsis: true },
{
title: '序号', key: 'index', width: 70, align: 'center', sorter: false,
customRender: ({ index }) => {
return (this.getPagination().pageIndex - 1) * this.getPagination().pageSize + index + 1;
},
},
{ title: '姓名', dataIndex: 'name', key: 'name', align: 'center', width: 150, resizable: true, ellipsis: true },
{ title: '手机号', dataIndex: 'phone', key: 'phone', align: 'center', width: 160, resizable: true, ellipsis: true },
{ title: '所在城市', dataIndex: 'regionName', key: 'regionName', align: 'center', width: 160, resizable: true, ellipsis: true },
{ title: '待检测任务', dataIndex: 'updateTime', key: 'vin', align: 'center', width: 160, resizable: true, ellipsis: true },
{ title: '检测中任务', dataIndex: 'updateTime', key: 'carTypeName', align: 'center', width: 160, resizable: true, ellipsis: true },
{ title: '已完成任务', dataIndex: 'warehousingTime', key: 'warehousingTime', align: 'center', width: 160, resizable: true, ellipsis: true },
{ title: '平均检测耗时', dataIndex: 'createTime', key: 'createTime', align: 'center', width: 160, resizable: true, ellipsis: true },
{ title: '账号状态', dataIndex: 'status', key: 'status', align: 'center', width: 160, resizable: true, ellipsis: true },
{ title: '操作', key: 'action', width: 170, align: 'center', fixed: 'right' },
];
getPagination() {
return this.pagination;
}
/**
* 初始化配置
*/
created(): void {
this.init(this.axios, VehicleController.PAGE_PRICE_VEHICLE);
this.init(this.axios, DetectionController.PAGE_INSPECTOR);
this.buildQueryForm({
sourceNo: [null, { label: '关键字', field: 'key', placeholder: '搜索姓名、手机号', operator: Operator.like }],
status: [null, {
label: '所在城市', field: 'status', type: 'select', allowClear: true, optionItems: this.detectingStatusList, operator: Operator.eq
cityCode: [null, {
name: 'cityCodeName', label: '所在城市', field: 'cityCode', type: 'slot', placeholder: '请选择省/市', operator: Operator.eq
}],
vehicleState: [null, {
label: '账号状态', field: 'vehicleState', type: 'select', allowClear: true, optionItems: this.reviewStatusList, operator: Operator.eq
status: [null, {
label: '账号状态', field: 'status', type: 'select', allowClear: true, optionItems: this.reviewStatusList, operator: Operator.eq
}],
});
this.pagination.setDefaultSort('createTime', Order.desc);
this.pageLoad();
this.areaData = convertToTree(false);
}
//区域数据发生变化
handleChangeCity(value: string[], e: any) {
let code = ''
if (e && e.length > 0) {
const cityObj = e[e.length - 1];
code = cityObj.value || '';
}
this.pagination.queryForm.cityCode = code;
}
//重置查询条件
handleReset() {
this.carProvinceCity = [];
this.pageReset();
}
handleAdd(): void {
......
......@@ -4,24 +4,24 @@
<a-spin :spinning="submitted" style="margin-top: 16px;">
<a-form layout="vertical" :model="postData" :label-col="labelCol" :wrapper-col="wrapperCol"
ref="formRef">
<a-form-item name="realName" label="姓名"
<a-form-item name="name" label="姓名"
:rules="[{ required: true, message: '请输入检测室真实姓名' }, { pattern: /^(?:[\u4e00-\u9fa5]{1,10}|[a-zA-Z]{2,20})$/, message: '请输入1-10个中文字符或2-20个英文字符' }]">
<a-input v-model:value="postData.realName" placeholder="请输入检测室真实姓名" :maxlength="20"
<a-input v-model:value="postData.name" placeholder="请输入检测室真实姓名" :maxlength="20"
style="width: 376px;" />
</a-form-item>
<a-form-item name="mobile" label="手机号码"
<a-form-item name="phone" label="手机号码"
:rules="[{ required: true, message: '请输入11位手机号' }, { pattern: /^1(3|4|5|6|7|8|9)\d{9}$/, message: '请输入正确的11位手机号码' }]">
<a-input v-model:value="postData.mobile" placeholder="请输入11位手机号" :maxlength="11"
style="width: 376px;" />
<a-input v-model:value="postData.phone" :disabled="formDisabled" placeholder="请输入11位手机号"
:maxlength="11" style="width: 376px;" />
</a-form-item>
<a-form-item label="所在城市" name="registrationCity"
:rules="[{ required: true, message: '请选择所在城市!' }]">
<a-cascader v-model:value="postData.registrationCity" :options="areaData" placeholder="请选择所在城市"
style="width: 376px;" />
<a-cascader v-model:value="postData.registrationCity" :options="areaData"
@change="handleCitiesChange" placeholder="请选择所在城市" style="width: 376px;" />
</a-form-item>
<a-form-item name="enabled" label="账号状态" :rules="[{ required: true, message: '请选择账号状态' }]">
<a-switch v-model:checked="postData.enabled" />
<span style="padding-left: 8px;">{{ postData.enabled ? '启用' : '禁用' }}</span>
<a-form-item name="status" label="账号状态">
<a-switch v-model:checked="postData.status" />
<span style="padding-left: 8px;">{{ postData.status ? '启用' : '禁用' }}</span>
</a-form-item>
</a-form>
</a-spin>
......@@ -31,13 +31,10 @@
<script lang="ts">
import { Component } from 'vue-facing-decorator';
import { reactive } from "vue";
import { EnhanceFormComponent } from "@/core/form/EnhanceFormComponent";
import { SecurityController } from "@/api/SecurityController";
import { DetectionController } from "@/api/DetectionController";
import { message } from "ant-design-vue";
import { User } from "lib/src/entity/security/entity/User";
import { Role } from "lib/src/entity/security/entity/Role";
import { RuleObject } from "ant-design-vue/es/form/interface";
import { DefaultOptionType } from "ant-design-vue/es/vc-cascader/Cascader";
import { convertToTree } from "@/common/chinaarea";
......@@ -53,35 +50,65 @@ export default class InspectorAddForm extends EnhanceFormComponent<User> {
titleVisible = "新增检测师";
postData = {
realName: "",
mobile: "",
registrationCity: "",
enabled: true,
id: "",
name: "",
phone: "",
registrationCity: [],
region: "",
regionName: "",
status: true,
}
formDisabled = false;
created(): void {
this.areaData = convertToTree(false);
}
init(data): void {
console.log('1111111111111111111111111111111111', data);
this.dialogVisible = true;
this.titleVisible = data.id ? "编辑检测师" : "新增检测师";
this.formDisabled = data.id ? true : false;
if (data.id) {
this.postData.id = data.id || '';
this.postData.name = data.name || '';
this.postData.phone = data.phone || '';
this.postData.region = data.region || '';
this.postData.regionName = data.regionName || '';
this.postData.status = data.status === 1;
}
if (data.region) {
const cityCode = data.region.substring(0, 2);
this.postData.registrationCity = [cityCode + '0000', data.cityCode];
} else {
this.postData.registrationCity = []
}
}
handleCitiesChange(value, selectedOptions: DefaultOptionType[]): void {
const cityItem = selectedOptions && selectedOptions.length ? selectedOptions[selectedOptions.length - 1] : {};
this.postData.region = cityItem.value || '';
this.postData.regionName = cityItem.label || '';
}
handleOk() {
this.$refs.formRef.validate().then((valid) => {
if (valid) {
this.submitted = true;
// SecurityController.addUser(this.formState).then((response) => {
// this.submitted = false;
// this.open = false;
// message.success("添加成功");
// this.$emit("ok");
// }).catch((error) => {
// this.submitted = false;
// message.error(error.message);
// });
const formData = {
id: this.postData.id || '',
name: this.postData.name,
phone: this.postData.phone,
region: this.postData.region,
regionName: this.postData.regionName,
status: this.postData.status ? 1 : 0,
}
DetectionController.inspectAdd(this.axios, formData).then(response => {
this.submitted = false;
message.success("添加成功");
this.$emit("ok");
this.dialogVisible = false;
}).finally(() => this.submitted = false);
}
});
}
......
......@@ -100,7 +100,7 @@ import { ExportUtil } from "@/common/ExportUtil";
import { Security } from "@/store";
import PageMultipleTag from "@/views/finance/preference/PageMultipleTag.vue";
import { returnPreferenceList } from "@/views/finance/preference/listData";
import { convertToTree } from "@/common/chinaarea";;
import { convertToTree } from "@/common/chinaarea";
import { DefaultOptionType } from "ant-design-vue/es/vc-cascader/Cascader";
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!