You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

650 lines
24 KiB

<template>
<basic-container>
<div class="avue-crud">
<el-row v-if="!search" style="padding:6px 18px">
<!-- 查询模块 -->
<el-form :inline="true" :model="query">
<el-form-item label="司机姓名:">
<el-input v-model="query.name" placeholder="请输入司机姓名"></el-input>
</el-form-item>
<el-form-item label="司机手机号码:">
<el-input v-model="query.phone" placeholder="请输入司机手机号码"></el-input>
</el-form-item>
<el-form-item label="司机类型">
<el-select v-model="query.type" clearable placeholder="请选择类型">
<el-option
v-for="item in typeData"
:key="item.dictKey"
:label="item.dictValue"
:value="item.dictKey">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="职务类型">
<el-select v-model="query.jobType" clearable placeholder="请选择类型">
<el-option
v-for="item in jobTypeData"
:key="item.dictKey"
:label="item.dictValue"
:value="item.dictKey">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="承运商">
<el-select v-model="query.carrierId" clearable placeholder="请选择承运商">
<el-option
v-for="item in carrierData"
:key="item.id"
:label="item.number"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<!-- 查询按钮 -->
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="searchChange">搜 索</el-button>
<el-button icon="el-icon-delete" @click="searchReset()">清 空</el-button>
</el-form-item>
</el-form>
</el-row>
<el-row>
<div class="avue-crud__header">
<!-- 头部左侧按钮模块 -->
<div class="avue-crud__left">
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新 增</el-button>
<el-button type="danger" icon="el-icon-delete" @click="handleDelete" plain>删 除</el-button>
</div>
<!-- 头部右侧按钮模块 -->
<div class="avue-crud__right">
<el-button icon="el-icon-refresh" @click="searchChange" circle></el-button>
<el-button icon="el-icon-search" @click="searchHide" circle></el-button>
</div>
</div>
</el-row>
<el-row>
<!-- 列表模块 -->
<el-table ref="table" v-loading="loading"
@selection-change="selectionChange"
:data="data"
:height="height"
style="width: 100%"
:border="option.border">
<el-table-column type="selection" v-if="option.selection" width="55" align="center"></el-table-column>
<el-table-column type="expand" v-if="option.expand" align="center"></el-table-column>
<el-table-column v-if="option.index" label="序号" type="index" width="80" align="center">
</el-table-column>
<template v-for="(item,index) in option.column">
<!-- table字段 -->
<el-table-column v-if="item.hide!==true"
:prop="item.prop"
:label="item.label"
align="center"
:width="item.width"
:key="index">
</el-table-column>
</template>
<!-- 操作栏模块 -->
<el-table-column prop="menu" label="操作" :width="220" align="center">
<template #="{row}">
<el-button type="primary" text icon="el-icon-view" @click="handleView(row)">查看</el-button>
<el-button type="primary" text icon="el-icon-edit" @click="handleEdit(row)">编辑</el-button>
<el-button type="primary" text icon="el-icon-delete" @click="rowDel(row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-row>
<el-row>
<div class="avue-crud__pagination" style="width:100%">
<!-- 分页模块 -->
<el-pagination align="right"
background
@size-change="sizeChange"
@current-change="currentChange"
:current-page="page.currentPage"
:page-sizes="[30, 50,80, 120]"
:page-size="page.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="page.total">
</el-pagination>
</div>
</el-row>
<!-- 表单模块 -->
<el-dialog :title="title"
v-model="box"
width="50%"
:before-close="beforeClose"
append-to-body>
<el-form :disabled="view" ref="form" :model="form" :rules="validatorRules" label-width="80px">
<!-- 表单字段 -->
<el-row>
<el-col :span="11">
<el-form-item label="司机姓名" prop="name">
<el-input v-model="form.name" placeholder="请输入司机姓名"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="手机号码" prop="phone">
<el-input v-model="form.phone" placeholder="请输入司机手机号码"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="司机类型" prop="type">
<el-select v-model="form.type" clearable placeholder="请选择司机类型" style="position: absolute;right: 0px;width: 100%">
<el-option
v-for="item in typeData"
:key="item.dictKey"
:label="item.dictValue"
:value="item.dictKey">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="职务类型" prop="jobType">
<el-select v-model="form.jobType" clearable placeholder="请选择职务类型" style="position: absolute;right: 0px;width: 100%">
<el-option
v-for="item in jobTypeData"
:key="item.dictKey"
:label="item.dictValue"
:value="item.dictKey">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="准驾车型" prop="drivingType">
<el-select v-model="form.drivingType" clearable placeholder="请选择准驾车型" style="position: absolute;right: 0px;width: 100%">
<el-option
v-for="item in drivingTypeData"
:key="item.dictKey"
:label="item.dictValue"
:value="item.dictKey">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="身份证号" prop="idCard">
<el-input v-model="form.idCard" placeholder="请输入身份证号"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="合同开始时间" label-width="100px" prop="contractStartTime">
<el-date-picker v-model="form.contractStartTime" value-format="YYYY-MM-DD" placeholder="请输入合同开始时间" style="position: absolute;right: 0px;width: 100%"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="合同结束时间" label-width="100px" prop="contractEndTime">
<el-date-picker v-model="form.contractEndTime" value-format="YYYY-MM-DD" placeholder="请输入合同结束时间" style="position: absolute;right: 0px;width: 100%"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="性别" prop="gender">
<el-select v-model="form.gender" clearable placeholder="请选择性别" style="position: absolute;right: 0px;width: 100%">
<el-option
v-for="item in genderData"
:key="item.dictKey"
:label="item.dictValue"
:value="item.dictKey">
</el-option>
</el-select>
</el-form-item> </el-col>
<el-col :span="12">
<el-form-item label="居住地址" prop="residentialAddress">
<el-input v-model="form.residentialAddress" placeholder="请输入居住地址"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="银行类型" prop="bankType">
<el-select v-model="form.bankType" clearable placeholder="请选择银行类型" style="position: absolute;right: 0px;width: 100%">
<el-option
v-for="item in bankTypeData"
:key="item.dictKey"
:label="item.dictValue"
:value="item.dictKey">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="银行卡号" prop="bankCardNub">
<el-input v-model="form.bankCardNub" placeholder="请输入银行卡号"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="承运商" prop="carrierId">
<el-select v-model="form.carrierId" clearable placeholder="请选择承运商" style="position: absolute;right: 0px;width: 100%">
<el-option
v-for="item in carrierData"
:key="item.id"
:label="item.number"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="notes">
<el-input v-model="form.notes" placeholder="请输入备注" style="position: absolute;right: 0px;width: 100%"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="驾驶证号" prop="driverLicenseNub">
<el-input v-model="form.driverLicenseNub" placeholder="请输入驾驶证号" style="position: absolute;right: 0px;width: 100%"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="驾驶证发证机关" label-width="120px" prop="driverLicenseOrgan">
<el-input v-model="form.driverLicenseOrgan" placeholder="请输入驾驶证发证机关" style="position: absolute;right: 0px;width: 100%"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="驾驶证起始日期" label-width="120px" prop="driverLicenseStartTime">
<el-date-picker v-model="form.driverLicenseStartTime" value-format="YYYY-MM-DD" placeholder="请输入驾驶证起始日期" style="position: absolute;right: 0px;width: 100%"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="驾驶证到期日期" label-width="120px" prop="driverLicenseEndTime">
<el-date-picker v-model="form.driverLicenseEndTime" value-format="YYYY-MM-DD" placeholder="请输入驾驶证到期日期" style="position: absolute;right: 0px;width: 100%"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="从业资格证编号" label-width="120px" prop="employeeQualificationNub">
<el-input v-model="form.employeeQualificationNub" placeholder="请输入从业资格证编号" style="position: absolute;right: 0px;width: 100%"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="道路经营许可证号" label-width="150px" prop="roadOperationLicenseNub">
<el-input v-model="form.roadOperationLicenseNub" placeholder="请输入道路经营许可证号" style="position: absolute;right: 0px;width: 100%"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="运输协议" prop="transportationAgreement">
<el-input v-model="form.transportationAgreement" placeholder="请输入运输协议" style="position: absolute;right: 0px;width: 100%"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="身份证正面照片" label-width="120px" prop="idCardFrontPhoto">
<el-input v-model="form.idCardFrontPhoto" placeholder="请输入身份证正面照片"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="身份证背面照片" label-width="120px" prop="idCardBackPhoto">
<el-input v-model="form.idCardBackPhoto" placeholder="请输入身份证背面照片"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="驾驶证照片" label-width="100px" prop="driverLicensePhoto">
<el-input v-model="form.driverLicensePhoto" placeholder="请输入驾驶证照片"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="驾驶证背面照片" label-width="120px" prop="driverLicensePhotoBack">
<el-input v-model="form.driverLicensePhotoBack" placeholder="请输入驾驶证背面照片"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<!-- <el-col :span="11">-->
<!-- <el-form-item label="人证合照照片" prop="licensePeoplePhoto">-->
<!-- <el-input v-model="form.licensePeoplePhoto" placeholder="请输入人证合照照片"/>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="12">-->
<!-- <el-form-item label="驾驶证背面照片" prop="driverLicensePhotoBack">-->
<!-- <el-input v-model="form.driverLicensePhotoBack" placeholder="请输入驾驶证背面照片"/>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
</el-row>
</el-form>
<!-- 表单按钮 -->
<template #footer>
<span v-if="!view" class="dialog-footer">
<el-button type="primary" icon="el-icon-circle-check" @click="handleSubmit">提 交</el-button>
<el-button icon="el-icon-circle-close" @click="box = false"> </el-button>
</span>
</template>
</el-dialog>
</div>
</basic-container>
</template>
<script>
import { getList, getDetail, add, update, remove } from "@/api/basicdata/basicdataDriverArtery";
import {getList as carrierData } from "@/api/basicdata/basicdataCarrier";
import option from "@/option/basicdata/basicdataDriverArtery2";
import { mapGetters } from "vuex";
import { getDictionaryBiz } from '@/api/system/dict';
export default {
data () {
return {
height: 0,
// 弹框标题
title: '',
// 是否展示弹框
box: false,
// 是否显示查询
search: true,
// 加载中
loading: true,
// 是否为查看模式
view: false,
// 查询信息
query: {},
carrierquery: {},
// 承运商分页信息
carrierpage: {
currentPage: 1,
pageSize: 50,
total: 40
},
// 分页信息
page: {
currentPage: 1,
pageSize: 30,
total: 40
},
// 表单数据
form: {},
// 选择行
selectionList: [],
typeData:[],
jobTypeData:[],
carrierData:[],
drivingTypeData:[],
genderData:[],
bankTypeData:[],
// 表单配置
option: option,
// 表单列表
data: [],
//检验
validatorRules: {
type: [
{ required: true, message: '请选择司机类型!',trigger: 'blur'},{pattern: /(^[1-9]\d{0,9}(\.\d{1,4})?$)|(^0(\.\d{1,2})?$)/, message: '格式不正确!'}
],
jobType: [
{ required: true, message: '请选择职务类型!',trigger: 'blur'}
],
carrierId: [
{ required: true, message: '请选择承运商!',trigger: 'blur'}
],
},
}
},
mounted () {
this.init();
//查询字典
this.queryDictionary();
},
created() {
//
// this.queryDictionary();
},
computed: {
...mapGetters(["permission"]),
ids () {
let ids = [];
this.selectionList.forEach(ele => {
ids.push(ele.id);
});
return ids.join(",");
}
},
methods: {
queryDictionary() {
getDictionaryBiz('basic_driver_type').then(res => {
this.typeData = res.data.data;
});
getDictionaryBiz('basic_driverjob_type').then(res => {
this.jobTypeData = res.data.data;
});
getDictionaryBiz('basic_driving_type').then(res => {
this.drivingTypeData = res.data.data;
});
getDictionaryBiz('sex').then(res => {
this.genderData = res.data.data;
});
getDictionaryBiz('basic_bank_type').then(res => {
this.bankTypeData = res.data.data;
});
//查询承运商
let params ={}
carrierData(this.carrierpage.currentPage, this.carrierpage.pageSize, Object.assign(params, this.carrierquery)).then(res => {
this.carrierData = res.data.data.records
this.onLoad(this.page);
});
},
init () {
this.height = this.setPx(document.body.clientHeight - 340);
},
searchHide () {
this.search = !this.search;
},
searchChange () {
this.onLoad(this.page);
},
searchReset () {
this.query = {};
this.page.currentPage = 1;
this.onLoad(this.page);
},
handleSubmit () {
this.$refs.form.validate(valid=>{
if (valid) {
if (!this.form.id) {
add(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
});
} else {
update(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
})
}
} else {
console.log('error submit!!');
return false;
}
});
},
handleAdd () {
this.title = '新增'
this.form = {}
this.box = true
},
handleEdit (row) {
this.title = '编辑'
this.box = true
getDetail(row.id).then(res => {
this.form = res.data.data;
});
},
handleView (row) {
this.title = '查看'
this.view = true;
this.box = true;
getDetail(row.id).then(res => {
this.form = res.data.data;
});
},
handleDelete () {
if (this.selectionList.length === 0) {
this.$message.warning("请选择至少一条数据");
return;
}
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
return remove(this.ids);
})
.then(() => {
this.selectionClear();
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
});
},
rowDel (row) {
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
return remove(row.id);
})
.then(() => {
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
});
},
beforeClose (done) {
done()
this.form = {};
this.view = false;
},
selectionChange (list) {
this.selectionList = list;
},
selectionClear () {
this.selectionList = [];
this.$refs.table.clearSelection();
},
currentChange (currentPage) {
this.page.currentPage = currentPage;
this.onLoad(this.page);
},
sizeChange (pageSize) {
this.page.pageSize = pageSize;
this.onLoad(this.page);
},
onLoad (page, params = {}) {
this.loading = true;
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
const data = res.data.data;
// eslint-disable-next-line no-empty
for (let i = 0; i < data.records.length; i++) {
// eslint-disable-next-line no-empty
for (let j = 0; j < this.typeData.length; j++) {
// eslint-disable-next-line no-empty
if (data.records[i].type == this.typeData[j].dictKey){
data.records[i].type=this.typeData[j].dictValue;
}
}
for (let j = 0; j < this.jobTypeData.length; j++) {
// eslint-disable-next-line no-empty
if (data.records[i].jobType == this.jobTypeData[j].dictKey){
data.records[i].jobType=this.jobTypeData[j].dictValue;
}
}
for (let j = 0; j < this.drivingTypeData.length; j++) {
// eslint-disable-next-line no-empty
if (data.records[i].drivingType == this.drivingTypeData[j].dictKey){
data.records[i].drivingType=this.drivingTypeData[j].dictValue;
}
}
for (let j = 0; j < this.genderData.length; j++) {
// eslint-disable-next-line no-empty
if (data.records[i].gender == this.genderData[j].dictKey){
data.records[i].gender=this.genderData[j].dictValue;
}
}
for (let j = 0; j < this.bankTypeData.length; j++) {
// eslint-disable-next-line no-empty
if (data.records[i].bankType == this.bankTypeData[j].dictKey){
data.records[i].bankType=this.bankTypeData[j].dictValue;
}
}
for (let j = 0; j < this.carrierData.length; j++) {
// eslint-disable-next-line no-empty
if (data.records[i].carrierId == this.carrierData[j].id){
data.records[i].carrierId =this.carrierData[j].number;
}
}
}
this.page.total = data.total;
this.data = data.records;
this.loading = false;
this.selectionClear();
});
}
}
};
</script>