Commit 4a7e7f22 by weijiguang

test

parent 0d476917
import {
uploadFile,
detectVehicleLicense,
detectIdentityCard,
detectDriverLicense,
login,
listCompany,
myCompany,
......@@ -35,6 +37,9 @@ import {
updateContract,
terminateContract,
returnDeposit,
listDriver,
createDriver,
updateDriver,
} from "./request_methods";
export default {
......@@ -47,6 +52,12 @@ export default {
asyncDetectVehicleLicense(_, payload) {
return detectVehicleLicense(payload)
},
asyncDetectDriverLicense(_, payload) {
return detectDriverLicense(payload)
},
asyncDetectIdentityCard(_, payload) {
return detectIdentityCard(payload)
},
asyncLogin(_, payload) {
return login(payload)
},
......@@ -152,6 +163,16 @@ export default {
return returnDeposit(payload)
},
asyncListDriver(_, payload) {
return listDriver(payload)
},
asyncCreateDriver(_, payload) {
return createDriver(payload)
},
asyncUpdateDriver(_, payload) {
return updateDriver(payload)
},
},
mutations: {
}
......
......@@ -8,8 +8,12 @@ if(process.env.NODE_ENV == 'development') {
}
// 上传文件
export const uploadFile = params => axios.post(`${proxy}/file/upload`, params, { "Content-Type": "multipart/form-data" });
// 上传文件
// 行驶证识别
export const detectVehicleLicense = data => axios.post(`${proxy}/file/vehicle/license/detect`, data);
// 驾驶证识别
export const detectDriverLicense = data => axios.post(`${proxy}/file/driver/license/detect`, data);
// 身份证识别
export const detectIdentityCard = data => axios.post(`${proxy}/file/identity/card/detect`, data);
// 登录
export const login = data => axios.post(`${proxy}/account/login`, data);
......@@ -83,3 +87,10 @@ export const updateContract = data => axios.post(`${proxy}/contract/update`, dat
export const terminateContract = data => axios.post(`${proxy}/contract/terminate`, data);
// 合同 / 车源合同 返还押金
export const returnDeposit = data => axios.post(`${proxy}/contract/return/deposit`, data);
// 司机 / 列表
export const listDriver = data => axios.post(`${proxy}/driver/list`, data);
// 司机 / 创建
export const createDriver = data => axios.post(`${proxy}/driver/create`, data);
// 司机 / 更新
export const updateDriver = data => axios.post(`${proxy}/driver/update`, data);
\ No newline at end of file
import store from "@/store";
const { dispatch } = store;
export default {
components: { },
data() {
return {
visible: false,
submitLoading: false,
frontUploadStatus: false,
backUploadStatus: false,
mainUploadStatus: false,
secondUploadStatus: false,
driverFormRule: {
name: [{ required: true, message: "请输入车牌号", trigger: "change" }],
identityNumber: [{ required: true, message: "请输入车牌号", trigger: "change" }],
phone: [{ required: true, message: "请输入车牌号", trigger: "change" }],
nation: [{ required: true, message: "请输入民族", trigger: "change" }],
birthday: [{ type: "date", required: true, message: "请输入车牌号", trigger: "change" }],
originAddress: [{ required: true, message: "请输入身份证地址", trigger: "change" }],
issueOrganization: [{ required: true, message: "请输入发证机关", trigger: "change" }],
identityValidPeriodStart: [{ type: "date", required: true, message: "请输入身份证有效斯", trigger: "change" }],
identityValidPeriodEnd: [{ type: "date", required: true, message: "请输入身份证有效斯", trigger: "change" }],
credentialNo: [{ required: true, message: "请输入驾驶证号", trigger: "change" }],
fileNo: [{ required: true, message: "请输入驾驶证档案编号", trigger: "change" }],
firstIssue: [{ type: "date", required: true, message: "请输入首次发证日期", trigger: "change" }],
licenseValidPeriodStart: [{ type: "date", required: true, message: "请输入驾驶证有效斯", trigger: "change" }],
licenseValidPeriodEnd: [{ type: "date", required: true, message: "请输入驾驶证有效斯", trigger: "change" }],
},
driverForm: {
name: "",
identityNumber: "",
phone: "",
gender: "",
contactName: "",
contactPhone: "",
address: "",
serviceLicense: "",
frontFileId: 0,
backFileId: 0,
frontFileUrl: null,
backFileUrl: null,
nation: "",
birthday: "",
issueOrganization: "",
originAddress: "",
identityValidPeriodStart: "",
identityValidPeriodEnd: "",
mainFileId: 0,
secondFileId: 0,
mainFileUrl: null,
secondFileUrl: null,
credentialNo: "",
fileNo: "",
firstIssue: "",
drivingClass: "",
licenseValidPeriodStart: "",
licenseValidPeriodEnd: ""
},
};
},
watch: {
visible(show) {
this.submitLoading = false;
this.$refs.driverForm.resetFields();
this.driverForm.frontFileId = 0;
this.driverForm.backFileId = 0;
this.driverForm.frontFileUrl = null;
this.driverForm.backFileUrl = null;
this.driverForm.mainFileId = 0;
this.driverForm.secondFileId = 0;
this.driverForm.mainFileUrl = null;
this.driverForm.secondFileUrl = null;
this.driverForm.name = "";
this.driverForm.identityNumber = "";
this.driverForm.phone = "";
this.driverForm.gender = "男";
this.driverForm.contactName = "";
this.driverForm.contactPhone = "";
this.driverForm.address = "";
this.driverForm.serviceLicense = "0";
this.driverForm.nation = "";
this.driverForm.birthday = "";
this.driverForm.issueOrganization = "";
this.driverForm.originAddress = "";
this.driverForm.identityValidPeriodStart = "";
this.driverForm.identityValidPeriodEnd = "";
this.driverForm.credentialNo = "";
this.driverForm.fileNo = null;
this.driverForm.firstIssue = null;
this.driverForm.drivingClass = "";
this.driverForm.licenseValidPeriodStart = "";
this.driverForm.licenseValidPeriodEnd = "";
},
},
methods: {
upload(file, type) {
const formData = new FormData();
formData.append("file", file);
if(type == 1) {
this.mainUploadStatus = true;
} else if(type == 2) {
this.secondUploadStatus = true;
} else if(type == 3) {
this.frontUploadStatus = true;
} else if(type == 4) {
this.backUploadStatus = true;
}
dispatch("invoke/asyncUploadFile", formData).then(res => {
const { code, data, msg } = res;
if(code == 1) {
this.$Message.info("上传成功");
} else {
this.$Message.info("上传失败");
}
if(type == 1) {
this.mainUploadStatus = false;
this.driverForm.mainFileId = data.id;
this.driverForm.mainFileUrl = data.filePath;
} else if(type == 2) {
this.secondUploadStatus = false;
this.driverForm.secondFileId = data.id;
this.driverForm.secondFileUrl = data.filePath;
} else if(type == 3) {
this.frontUploadStatus = false;
this.driverForm.frontFileId = data.id;
this.driverForm.frontFileUrl = data.filePath;
} else if(type == 4) {
this.backUploadStatus = false;
this.driverForm.backFileId = data.id;
this.driverForm.backFileUrl = data.filePath;
}
if(type==1) {
this.detectDriverLicense(data.filePath, type);
} else if(type==3 || type==4) {
this.detectIdentityCard(data.filePath, type);
}
});
},
handleUploadMain(file) {
this.upload(file, 1);
return false;
},
handleUploadSecond(file) {
this.upload(file, 2);
return false;
},
handleUploadFront(file) {
this.upload(file, 3);
return false;
},
handleUploadBack(file) {
this.upload(file, 4);
return false;
},
detectDriverLicense(url, isMain) {
var requestData = {
url: url,
}
dispatch("invoke/asyncDetectDriverLicense", requestData).then(({ data }) => {
if(isMain == 1) {
this.driverForm.credentialNo = data.credentialNo;
this.driverForm.country = data.country;
this.driverForm.drivingClass = data.drivingClass;
this.driverForm.firstIssue = data.firstIssue;
this.driverForm.licenseValidPeriodStart = data.validPeriodStart;
this.driverForm.licenseValidPeriodEnd = data.validPeriodEnd;
}
});
},
detectIdentityCard(url, isMain) {
var requestData = {
url: url,
isMain: isMain,
}
dispatch("invoke/asyncDetectIdentityCard", requestData).then(({ data }) => {
if(isMain == 3) {
this.driverForm.nation = data.nation;
this.driverForm.birthday = data.birthday;
this.driverForm.originAddress = data.originAddress;
} else {
this.driverForm.issueOrganization = data.issueOrganization;
this.driverForm.identityValidPeriodStart = data.validPeriodStart;
this.driverForm.identityValidPeriodEnd = data.validPeriodEnd;
}
});
},
saveDriver() {
this.$refs.driverForm.validate(valid => {
console.log("saveDriver:"+valid);
if (valid) {
dispatch("invoke/asyncCreateDriver", this.driverForm).then(({ code }) => {
this.submitLoading = false;
if (code === 1) {
this.$Message.success("添加成功");
this.$emit("search");
this.visible = false;
}
});
}
});
},
},
mounted() {
}
};
import store from "@/store";
const { dispatch } = store;
export default {
components: { },
data() {
return {
visible: false,
driver: null,
submitLoading: false,
frontUploadStatus: false,
backUploadStatus: false,
mainUploadStatus: false,
secondUploadStatus: false,
driverFormRule: {
name: [{ required: true, message: "请输入车牌号", trigger: "change" }],
identityNumber: [{ required: true, message: "请输入车牌号", trigger: "change" }],
phone: [{ required: true, message: "请输入车牌号", trigger: "change" }],
nation: [{ required: true, message: "请输入民族", trigger: "change" }],
birthday: [{ type: "date", required: true, message: "请输入车牌号", trigger: "change" }],
originAddress: [{ required: true, message: "请输入身份证地址", trigger: "change" }],
issueOrganization: [{ required: true, message: "请输入发证机关", trigger: "change" }],
identityValidPeriodStart: [{ type: "date", required: true, message: "请输入身份证有效斯", trigger: "change" }],
identityValidPeriodEnd: [{ type: "date", required: true, message: "请输入身份证有效斯", trigger: "change" }],
credentialNo: [{ required: true, message: "请输入驾驶证号", trigger: "change" }],
fileNo: [{ required: true, message: "请输入驾驶证档案编号", trigger: "change" }],
firstIssue: [{ type: "date", required: true, message: "请输入首次发证日期", trigger: "change" }],
licenseValidPeriodStart: [{ type: "date", required: true, message: "请输入驾驶证有效斯", trigger: "change" }],
licenseValidPeriodEnd: [{ type: "date", required: true, message: "请输入驾驶证有效斯", trigger: "change" }],
},
driverForm: {
id: 0,
name: "",
identityNumber: "",
phone: "",
gender: "",
contactName: "",
contactPhone: "",
address: "",
serviceLicense: "",
frontFileId: 0,
backFileId: 0,
frontFileUrl: null,
backFileUrl: null,
nation: "",
birthday: "",
issueOrganization: "",
originAddress: "",
identityValidPeriodStart: "",
identityValidPeriodEnd: "",
mainFileId: 0,
secondFileId: 0,
mainFileUrl: null,
secondFileUrl: null,
credentialNo: "",
fileNo: "",
firstIssue: "",
drivingClass: "",
licenseValidPeriodStart: "",
licenseValidPeriodEnd: ""
},
};
},
watch: {
visible(show) {
this.submitLoading = false;
this.$refs.driverForm.resetFields();
if(show) {
this.driverForm.id = this.driver.id;
this.driverForm.frontFileId = this.driver.frontFile.id;
this.driverForm.frontFileUrl = this.driver.frontFile.filePath;
this.driverForm.backFileId = this.driver.backFile.id;
this.driverForm.backFileUrl = this.driver.backFile.filePath;
this.driverForm.mainFileId = this.driver.mainFile.id;
this.driverForm.mainFileUrl = this.driver.mainFile.filePath;
this.driverForm.secondFileId = this.driver.secondFile.id;
this.driverForm.secondFileUrl = this.driver.secondFile.filePath;
this.driverForm.name = this.driver.name;
this.driverForm.identityNumber = this.driver.identityNumber;
this.driverForm.phone = this.driver.phone;
this.driverForm.gender = this.driver.gender;
this.driverForm.contactName = this.driver.contactName;
this.driverForm.contactPhone = this.driver.contactPhone;
this.driverForm.address = this.driver.address;
this.driverForm.serviceLicense = ""+this.driver.serviceLicense;
this.driverForm.nation = this.driver.nation;
this.driverForm.birthday = this.driver.birthday;
this.driverForm.issueOrganization = this.driver.issueOrganization;
this.driverForm.originAddress = this.driver.originAddress;
this.driverForm.identityValidPeriodStart = this.driver.identityValidPeriodStart;
this.driverForm.identityValidPeriodEnd = this.driver.identityValidPeriodEnd;
this.driverForm.credentialNo = this.driver.credentialNo;
this.driverForm.fileNo = this.driver.fileNo;
this.driverForm.firstIssue = this.driver.firstIssue;
this.driverForm.drivingClass = this.driver.drivingClass;
this.driverForm.licenseValidPeriodStart = this.driver.licenseValidPeriodStart;
this.driverForm.licenseValidPeriodEnd = this.driver.licenseValidPeriodEnd;
} else {
this.driverForm.id = 0;
this.driverForm.frontFileId = 0;
this.driverForm.backFileId = 0;
this.driverForm.frontFileUrl = null;
this.driverForm.backFileUrl = null;
this.driverForm.mainFileId = 0;
this.driverForm.secondFileId = 0;
this.driverForm.mainFileUrl = null;
this.driverForm.secondFileUrl = null;
this.driverForm.name = "";
this.driverForm.identityNumber = "";
this.driverForm.phone = "";
this.driverForm.gender = "男";
this.driverForm.contactName = "";
this.driverForm.contactPhone = "";
this.driverForm.address = "";
this.driverForm.serviceLicense = "0";
this.driverForm.nation = "";
this.driverForm.birthday = "";
this.driverForm.issueOrganization = "";
this.driverForm.originAddress = "";
this.driverForm.identityValidPeriodStart = "";
this.driverForm.identityValidPeriodEnd = "";
this.driverForm.credentialNo = "";
this.driverForm.fileNo = null;
this.driverForm.firstIssue = null;
this.driverForm.drivingClass = "";
this.driverForm.licenseValidPeriodStart = "";
this.driverForm.licenseValidPeriodEnd = "";
}
},
},
methods: {
upload(file, type) {
const formData = new FormData();
formData.append("file", file);
if(type == 1) {
this.mainUploadStatus = true;
} else if(type == 2) {
this.secondUploadStatus = true;
} else if(type == 3) {
this.frontUploadStatus = true;
} else if(type == 4) {
this.backUploadStatus = true;
}
dispatch("invoke/asyncUploadFile", formData).then(res => {
const { code, data, msg } = res;
if(code == 1) {
this.$Message.info("上传成功");
} else {
this.$Message.info("上传失败");
}
if(type == 1) {
this.mainUploadStatus = false;
this.driverForm.mainFileId = data.id;
this.driverForm.mainFileUrl = data.filePath;
} else if(type == 2) {
this.secondUploadStatus = false;
this.driverForm.secondFileId = data.id;
this.driverForm.secondFileUrl = data.filePath;
} else if(type == 3) {
this.frontUploadStatus = false;
this.driverForm.frontFileId = data.id;
this.driverForm.frontFileUrl = data.filePath;
} else if(type == 4) {
this.backUploadStatus = false;
this.driverForm.backFileId = data.id;
this.driverForm.backFileUrl = data.filePath;
}
if(type==1) {
this.detectDriverLicense(data.filePath, type);
} else if(type==3 || type==4) {
this.detectIdentityCard(data.filePath, type);
}
});
},
handleUploadMain(file) {
this.upload(file, 1);
return false;
},
handleUploadSecond(file) {
this.upload(file, 2);
return false;
},
handleUploadFront(file) {
this.upload(file, 3);
return false;
},
handleUploadBack(file) {
this.upload(file, 4);
return false;
},
detectDriverLicense(url, isMain) {
var requestData = {
url: url,
}
dispatch("invoke/asyncDetectDriverLicense", requestData).then(({ data }) => {
if(isMain == 1) {
this.driverForm.credentialNo = data.credentialNo;
this.driverForm.country = data.country;
this.driverForm.drivingClass = data.drivingClass;
this.driverForm.firstIssue = data.firstIssue;
this.driverForm.licenseValidPeriodStart = data.validPeriodStart;
this.driverForm.licenseValidPeriodEnd = data.validPeriodEnd;
}
});
},
detectIdentityCard(url, isMain) {
var requestData = {
url: url,
isMain: isMain,
}
dispatch("invoke/asyncDetectIdentityCard", requestData).then(({ data }) => {
if(isMain == 3) {
this.driverForm.nation = data.nation;
this.driverForm.birthday = data.birthday;
this.driverForm.originAddress = data.originAddress;
} else {
this.driverForm.issueOrganization = data.issueOrganization;
this.driverForm.identityValidPeriodStart = data.validPeriodStart;
this.driverForm.identityValidPeriodEnd = data.validPeriodEnd;
}
});
},
saveDriver() {
this.$refs.driverForm.validate(valid => {
console.log("saveDriver:"+valid);
if (valid) {
dispatch("invoke/asyncUpdateDriver", this.driverForm).then(({ code }) => {
this.submitLoading = false;
if (code === 1) {
this.$Message.success("修改成功");
this.$emit("search");
this.visible = false;
}
});
}
});
},
},
mounted() {
}
};
export const columns = (disable, enable, updatePassword) => [
export const columns = (search, showEdit) => [
{
title: "帐号",
key: "username",
title: "id",
key: "id",
align: "center",
minWidth: 60,
width: 60,
},
{
title: "姓名",
key: "realName",
align: "center",
minWidth: 60,
minWidth: 100,
render: (h, { row }) => {
const { name } = row;
return h(
"a",
{
on: { click: () => {
showEdit(row);
}}
},
name
);
}
},
{
title: "性别",
key: "gender",
align: "center",
minWidth: 80,
},
{
title: "电话",
key: "phone",
align: "center",
minWidth: 60,
minWidth: 120,
},
{
title: "地址",
key: "address",
align: "center",
minWidth: 60,
minWidth: 200,
},
{
title: "类型",
title: "身份证号",
key: "identityNumber",
align: "center",
width: 120,
render(h, { row }) {
try {
const { type } = row;
return h("span", type == 1 ? '主帐号' : '子帐号');
} catch(e) {
console.log(e);
}
}
minWidth: 150,
},
{
title: "状态",
title: "联系人",
key: "contactName",
align: "center",
width: 120,
render(h, { row }) {
try {
const { status } = row;
return h("span", {style: {color: status == 1 ? 'green' : 'red' }}, status == 1 ? '有效' : '失效');
} catch(e) {
console.log(e);
}
}
minWidth: 100,
},
{
title: "联系人电话",
key: "contactPhone",
align: "center",
minWidth: 120,
},
{
title: "创建时间",
key: "createTime",
align: "center",
minWidth: 150,
},
{
title: "操作",
......@@ -59,37 +74,7 @@ export const columns = (disable, enable, updatePassword) => [
const { status } = row;
var emptyTag = h("span"," ");
var updatePasswordTag = h(
"Button",
{
props: { type: "primary", size: "small" },
on: { click: () => {
updatePassword.dataSource = row;
updatePassword.visible = true;
}}
},
"修改密码"
);
var disableTag = h(
"Poptip",
{
props: { title: "确定停用当前帐号吗?", transfer: true, confirm: true, size: "small" },
on: { "on-ok": () => { row.status=0; disable(row); } }
},
[
h("Button", {props: {type: "error", size: "small"}}, "停用")
]
);
var enableTag = h(
"Button",
{
props: { type: "primary", size: "small" },
on: { click: () => { row.status=1; enable(row); }}
},
"启用"
);
return h("span", [updatePasswordTag, emptyTag, status == 1 ? disableTag : enableTag]);
return h("span", [emptyTag]);
}
},
];
import store from "@/store";
const { dispatch } = store;
import { columns } from "./helper.js";
import AddDriver from "../add/index.vue";
import EditDriver from "../edit/index.vue";
export default {
components: { },
components: { AddDriver, EditDriver },
data() {
return {
loading: false,
columns: [],
name: "",
phone: "",
identityNumber: "",
changeCurrent: 1,
data: {
total:0,
current: 1,
records:[],
},
page: {
size: 10,
},
}
},
methods: {
disable(account) {
dispatch("invoke/asyncUpdateAccountStatus", account);
},
enable(account) {
dispatch("invoke/asyncUpdateAccountStatus", account);
showEdit(driver) {
this.$refs.editDriver.driver = driver;
this.$refs.editDriver.visible = true;
},
search() {
this.loading = true;
dispatch("invoke/asyncListAccountMine", {}).then(({ data }) => {
search(current = 1) {
this.searchForm = {
name: this.name,
phone: this.phone,
identityNumber: this.identityNumber,
};
this.loading = true
const initQuery = {
current,
size: this.page.size,
records: this.searchForm
};
dispatch("invoke/asyncListDriver", {
...initQuery
}).then(({ data }) => {
this.loading = false
if (data != null) {
this.data.records = data;
this.data = {...data};
} else {
this.data = {
total:0,
current: 1,
records:[],
};
}
console.log(this.data)
});
},
changePage(current) {
this.search(current);
this.changeCurrent = current
},
changeSize(value) {
this.page.size = value
this.search();
},
},
mounted() {
this.columns = columns(this.disable, this.enable, this.$refs.updatePassword);
this.columns = columns(this.search, this.showEdit);
this.search();
}
};
<template>
<div>
<Card>
<Form :label-width="80" label-colon>
<Row :gutter="5">
<Col span="4">
<FormItem label="姓名" >
<Input v-model="name" placeholder="Enter something..." />
</FormItem>
</Col>
<Col span="4">
<FormItem label="手机号" >
<Input v-model="phone" placeholder="Enter something..." />
</FormItem>
</Col>
<Col span="4">
<FormItem label="身份证号" >
<Input v-model="identityNumber" placeholder="Enter something..." />
</FormItem>
</Col>
<Col span="4">
<Button @click="search()" type="primary"><Icon type="ios-search-outline" /> 查询</Button>
</Col>
<Col span="8">
<AddDriver ref="addDriver" @search="search" style="float:right" />
<EditDriver ref="editDriver" @search="search" style="float:right" />
</Col>
</Row>
</Form>
</Card>
<Card style="margin-top:10px">
<Table
......@@ -8,6 +34,17 @@
:loading="loading"
:columns="columns"
:data="data.records"/>
<Page
style="margin-top:10px"
:total="Number(data.total)"
:current="Number(data.current)"
@on-change="changePage"
@on-page-size-change="changeSize"
:placement="'top'"
:page-size-opts="[10, 30, 50, 100]"
show-sizer
show-elevator
show-total></Page>
</Card>
</div>
</template>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment