Commit 4a7e7f22 by weijiguang

test

parent 0d476917
import {
uploadFile,
detectVehicleLicense,
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)
},
......@@ -151,6 +162,16 @@ export default {
asyncReturnDeposit(_, payload) {
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);
......@@ -82,4 +86,11 @@ 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);
\ No newline at end of file
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() {
}
};
<template>
<div>
<Button icon="ios-add" type="primary" @click="visible = true">添加司机</Button>
<Modal width="800" v-model="visible" title="司机信息 - 添加" fullscreen>
<div>
<Form ref="driverForm" :model="driverForm" :rules="driverFormRule" :label-width="100" label-colon>
<Card :bordered="false">
<p slot="title"><Icon type="ios-film-outline"></Icon> 基本信息</p>
<Row>
<Col span="6">
<FormItem label="姓名" prop="name">
<Input v-model.trim="driverForm.name" type="text" />
</FormItem>
</Col>
<Col span="6">
<FormItem label="身份证号" prop="identityNumber">
<Input v-model.trim="driverForm.identityNumber" type="text" />
</FormItem>
</Col>
<Col span="6">
<FormItem label="电话" prop="phone">
<Input v-model.trim="driverForm.phone" type="text" />
</FormItem>
</Col>
<Col span="6">
<FormItem label="性别" prop="gender">
<Select v-model.trim="driverForm.gender" >
<Option value="男" key="男"></Option>
<Option value="女" key="女"></Option>
</Select>
</FormItem>
</Col>
</Row>
<Row>
<Col span="6">
<FormItem label="紧急联系人" prop="contactName">
<Input v-model.trim="driverForm.contactName" type="text" />
</FormItem>
</Col>
<Col span="6">
<FormItem label="紧急联系人电话" prop="contactPhone">
<Input v-model.trim="driverForm.contactPhone" type="text" />
</FormItem>
</Col>
<Col span="6">
<FormItem label="现住址" prop="address">
<Input v-model.trim="driverForm.address" type="text" />
</FormItem>
</Col>
<Col span="6">
<FormItem label="网约车执照" prop="serviceLicense">
<Select v-model.trim="driverForm.serviceLicense">
<Option value="1" key="1"></Option>
<Option value="0" key="0"></Option>
</Select>
</FormItem>
</Col>
</Row>
</Card>
<br/>
<Card :bordered="false">
<p slot="title"><Icon type="ios-film-outline"></Icon> 身份证照片</p>
<Row :gutter="20">
<Col span="12">
<Upload type="drag" action :before-upload="handleUploadFront" accept="image/*" >
<div style="padding: 20px 0">
<div v-if="driverForm.frontFileUrl==null">
<Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
<p>身份证人像面(照片)</p>
</div>
<img v-if="driverForm.frontFileUrl!=null" class="img" :src="driverForm.frontFileUrl" />
<Spin size="large" fix v-if="frontUploadStatus"></Spin>
</div>
</Upload>
</Col>
<Col span="12">
<Upload type="drag" action :before-upload="handleUploadBack" accept="image/*" >
<div style="padding: 20px 0">
<div v-if="driverForm.backFileUrl==null">
<Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
<p>身份证国徽面(照片)</p>
</div>
<img v-if="driverForm.backFileUrl!=null" class="img" :src="driverForm.backFileUrl" />
<Spin size="large" fix v-if="backUploadStatus"></Spin>
</div>
</Upload>
</Col>
</Row>
</Card>
<br/>
<Card :bordered="false">
<p slot="title"><Icon type="ios-film-outline"></Icon> 身份证信息</p>
<Row>
<Col span="8">
<FormItem label="民族" prop="nation">
<Input v-model.trim="driverForm.nation" type="text" />
</FormItem>
</Col>
<Col span="8">
<FormItem label="出生日期" prop="birthday">
<DatePicker v-model="driverForm.birthday" type="date" style="width: 100%" placeholder="请输入出生日期"></DatePicker>
</FormItem>
</Col>
<Col span="8">
<FormItem label="身份证地址" prop="originAddress">
<Input v-model.trim="driverForm.originAddress" type="text" />
</FormItem>
</Col>
</Row>
<Row>
<Col span="8">
<FormItem label="发证机关" prop="issueOrganization">
<Input v-model.trim="driverForm.issueOrganization" type="text" />
</FormItem>
</Col>
<Col span="8">
<FormItem label="有效期-起" prop="identityValidPeriodStart">
<DatePicker v-model="driverForm.identityValidPeriodStart" type="date" style="width: 100%" placeholder="请输入开始日期"></DatePicker>
</FormItem>
</Col>
<Col span="8">
<FormItem label="有效期-止" prop="identityValidPeriodEnd">
<DatePicker v-model="driverForm.identityValidPeriodEnd" type="date" style="width: 100%" placeholder="请输入结束日期"></DatePicker>
</FormItem>
</Col>
</Row>
</Card>
<br/>
<Card :bordered="false">
<p slot="title"><Icon type="ios-film-outline"></Icon> 驾驶证照片</p>
<Row :gutter="20">
<Col span="12">
<Upload type="drag" action :before-upload="handleUploadMain" accept="image/*" >
<div style="padding: 20px 0">
<div v-if="driverForm.mainFileUrl==null">
<Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
<p>驾驶证主页(照片)</p>
</div>
<img v-if="driverForm.mainFileUrl!=null" class="img" :src="driverForm.mainFileUrl" />
<Spin size="large" fix v-if="mainUploadStatus"></Spin>
</div>
</Upload>
</Col>
<Col span="12">
<Upload type="drag" action :before-upload="handleUploadSecond" accept="image/*" >
<div style="padding: 20px 0">
<div v-if="driverForm.secondFileUrl==null">
<Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
<p>驾驶证副页(照片)</p>
</div>
<img v-if="driverForm.secondFileUrl!=null" class="img" :src="driverForm.secondFileUrl" />
<Spin size="large" fix v-if="secondUploadStatus"></Spin>
</div>
</Upload>
</Col>
</Row>
</Card>
<br/>
<Card :bordered="false">
<p slot="title"><Icon type="ios-film-outline"></Icon> 驾驶证信息</p>
<Row>
<Col span="8">
<FormItem label="驾驶证号" prop="credentialNo">
<Input v-model.trim="driverForm.credentialNo" type="text" />
</FormItem>
</Col>
<Col span="8">
<FormItem label="档案编号" prop="fileNo">
<Input v-model.trim="driverForm.fileNo" type="text" />
</FormItem>
</Col>
<Col span="8">
<FormItem label="准驾车型" prop="drivingClass">
<Input v-model.trim="driverForm.drivingClass" type="text" />
</FormItem>
</Col>
</Row>
<Row>
<Col span="8">
<FormItem label="首次发证日期" prop="firstIssue">
<DatePicker v-model="driverForm.firstIssue" type="date" style="width: 100%" placeholder="请输入首次发证日期"></DatePicker>
</FormItem>
</Col>
<Col span="8">
<FormItem label="有效期-起" prop="licenseValidPeriodStart">
<DatePicker v-model="driverForm.licenseValidPeriodStart" type="date" style="width: 100%" placeholder="请输入开始日期"></DatePicker>
</FormItem>
</Col>
<Col span="8">
<FormItem label="有效期-止" prop="licenseValidPeriodEnd">
<DatePicker v-model="driverForm.licenseValidPeriodEnd" type="date" style="width: 100%" placeholder="请输入结束日期"></DatePicker>
</FormItem>
</Col>
</Row>
</Card>
</Form>
</div>
<div slot="footer">
<Button @click="visible = false">取消</Button>
<Button @click="saveDriver" :loading="submitLoading" type="primary">确定</Button>
</div>
</Modal>
</div>
</template>
<script src="./index.js"/>
<style lang="less" scoped>
.img {
max-height:150px;
}
</style>
\ No newline at end of file
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() {
}
};
<template>
<div>
<Modal width="800" v-model="visible" title="司机信息 - 修改" fullscreen>
<div>
<Form ref="driverForm" :model="driverForm" :rules="driverFormRule" :label-width="100" label-colon>
<Card :bordered="false">
<p slot="title"><Icon type="ios-film-outline"></Icon> 基本信息</p>
<Row>
<Col span="6">
<FormItem label="姓名" prop="name">
<Input v-model.trim="driverForm.name" type="text" disabled />
</FormItem>
</Col>
<Col span="6">
<FormItem label="身份证号" prop="identityNumber">
<Input v-model.trim="driverForm.identityNumber" type="text" disabled />
</FormItem>
</Col>
<Col span="6">
<FormItem label="电话" prop="phone">
<Input v-model.trim="driverForm.phone" type="text" />
</FormItem>
</Col>
<Col span="6">
<FormItem label="性别" prop="gender">
<Select v-model.trim="driverForm.gender" >
<Option value="男" key="男"></Option>
<Option value="女" key="女"></Option>
</Select>
</FormItem>
</Col>
</Row>
<Row>
<Col span="6">
<FormItem label="紧急联系人" prop="contactName">
<Input v-model.trim="driverForm.contactName" type="text" />
</FormItem>
</Col>
<Col span="6">
<FormItem label="紧急联系人电话" prop="contactPhone">
<Input v-model.trim="driverForm.contactPhone" type="text" />
</FormItem>
</Col>
<Col span="6">
<FormItem label="现住址" prop="address">
<Input v-model.trim="driverForm.address" type="text" />
</FormItem>
</Col>
<Col span="6">
<FormItem label="网约车执照" prop="serviceLicense">
<Select v-model.trim="driverForm.serviceLicense">
<Option value="1" key="1"></Option>
<Option value="0" key="0"></Option>
</Select>
</FormItem>
</Col>
</Row>
</Card>
<br/>
<Card :bordered="false">
<p slot="title"><Icon type="ios-film-outline"></Icon> 身份证照片</p>
<Row :gutter="20">
<Col span="12">
<Upload type="drag" action :before-upload="handleUploadFront" accept="image/*" >
<div style="padding: 20px 0">
<div v-if="driverForm.frontFileUrl==null">
<Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
<p>身份证人像面(照片)</p>
</div>
<img v-if="driverForm.frontFileUrl!=null" class="img" :src="driverForm.frontFileUrl" />
<Spin size="large" fix v-if="frontUploadStatus"></Spin>
</div>
</Upload>
</Col>
<Col span="12">
<Upload type="drag" action :before-upload="handleUploadBack" accept="image/*" >
<div style="padding: 20px 0">
<div v-if="driverForm.backFileUrl==null">
<Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
<p>身份证国徽面(照片)</p>
</div>
<img v-if="driverForm.backFileUrl!=null" class="img" :src="driverForm.backFileUrl" />
<Spin size="large" fix v-if="backUploadStatus"></Spin>
</div>
</Upload>
</Col>
</Row>
</Card>
<br/>
<Card :bordered="false">
<p slot="title"><Icon type="ios-film-outline"></Icon> 身份证信息</p>
<Row>
<Col span="8">
<FormItem label="民族" prop="nation">
<Input v-model.trim="driverForm.nation" type="text" />
</FormItem>
</Col>
<Col span="8">
<FormItem label="出生日期" prop="birthday">
<DatePicker v-model="driverForm.birthday" type="date" style="width: 100%" placeholder="请输入出生日期"></DatePicker>
</FormItem>
</Col>
<Col span="8">
<FormItem label="身份证地址" prop="originAddress">
<Input v-model.trim="driverForm.originAddress" type="text" />
</FormItem>
</Col>
</Row>
<Row>
<Col span="8">
<FormItem label="发证机关" prop="issueOrganization">
<Input v-model.trim="driverForm.issueOrganization" type="text" />
</FormItem>
</Col>
<Col span="8">
<FormItem label="有效期-起" prop="identityValidPeriodStart">
<DatePicker v-model="driverForm.identityValidPeriodStart" type="date" style="width: 100%" placeholder="请输入开始日期"></DatePicker>
</FormItem>
</Col>
<Col span="8">
<FormItem label="有效期-止" prop="identityValidPeriodEnd">
<DatePicker v-model="driverForm.identityValidPeriodEnd" type="date" style="width: 100%" placeholder="请输入结束日期"></DatePicker>
</FormItem>
</Col>
</Row>
</Card>
<br/>
<Card :bordered="false">
<p slot="title"><Icon type="ios-film-outline"></Icon> 驾驶证照片</p>
<Row :gutter="20">
<Col span="12">
<Upload type="drag" action :before-upload="handleUploadMain" accept="image/*" >
<div style="padding: 20px 0">
<div v-if="driverForm.mainFileUrl==null">
<Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
<p>驾驶证主页(照片)</p>
</div>
<img v-if="driverForm.mainFileUrl!=null" class="img" :src="driverForm.mainFileUrl" />
<Spin size="large" fix v-if="mainUploadStatus"></Spin>
</div>
</Upload>
</Col>
<Col span="12">
<Upload type="drag" action :before-upload="handleUploadSecond" accept="image/*" >
<div style="padding: 20px 0">
<div v-if="driverForm.secondFileUrl==null">
<Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
<p>驾驶证副页(照片)</p>
</div>
<img v-if="driverForm.secondFileUrl!=null" class="img" :src="driverForm.secondFileUrl" />
<Spin size="large" fix v-if="secondUploadStatus"></Spin>
</div>
</Upload>
</Col>
</Row>
</Card>
<br/>
<Card :bordered="false">
<p slot="title"><Icon type="ios-film-outline"></Icon> 驾驶证信息</p>
<Row>
<Col span="8">
<FormItem label="驾驶证号" prop="credentialNo">
<Input v-model.trim="driverForm.credentialNo" type="text" />
</FormItem>
</Col>
<Col span="8">
<FormItem label="档案编号" prop="fileNo">
<Input v-model.trim="driverForm.fileNo" type="text" />
</FormItem>
</Col>
<Col span="8">
<FormItem label="准驾车型" prop="drivingClass">
<Input v-model.trim="driverForm.drivingClass" type="text" />
</FormItem>
</Col>
</Row>
<Row>
<Col span="8">
<FormItem label="首次发证日期" prop="firstIssue">
<DatePicker v-model="driverForm.firstIssue" type="date" style="width: 100%" placeholder="请输入首次发证日期"></DatePicker>
</FormItem>
</Col>
<Col span="8">
<FormItem label="有效期-起" prop="licenseValidPeriodStart">
<DatePicker v-model="driverForm.licenseValidPeriodStart" type="date" style="width: 100%" placeholder="请输入开始日期"></DatePicker>
</FormItem>
</Col>
<Col span="8">
<FormItem label="有效期-止" prop="licenseValidPeriodEnd">
<DatePicker v-model="driverForm.licenseValidPeriodEnd" type="date" style="width: 100%" placeholder="请输入结束日期"></DatePicker>
</FormItem>
</Col>
</Row>
</Card>
</Form>
</div>
<div slot="footer">
<Button @click="visible = false">取消</Button>
<Button @click="saveDriver" :loading="submitLoading" type="primary">确定</Button>
</div>
</Modal>
</div>
</template>
<script src="./index.js"/>
<style lang="less" scoped>
.img {
max-height:150px;
}
</style>
\ No newline at end of file
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>
</Card>
<Card style="margin-top:10px">
<Table
border
:loading="loading"
:columns="columns"
:data="data.records"/>
</Card>
<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
border
: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