Commit 32ec2a74 authored by guoyou's avatar guoyou

车辆出行记录恢复

parent 96d86c5e
...@@ -5,27 +5,16 @@ ...@@ -5,27 +5,16 @@
<el-row> <el-row>
<el-col :span="5"> <el-col :span="5">
<el-form-item label="车辆编码" prop="code"> <el-form-item label="车辆编码" prop="code">
<el-input <el-input type="number" style="width: 200px;" v-model.number="listQuery.code"
type="number" placeholder="请输入车辆编码"></el-input>
style="width: 200px;"
v-model.number="listQuery.code"
placeholder="请输入车辆编码"
></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="5"> <el-col :span="5">
<el-form-item label="车牌号" prop="code"> <el-form-item label="车牌号" prop="code">
<el-input <el-input @keyup.enter.native="handleFilter" style="width: 200px;" class="filter-item" placeholder="车牌号"
@keyup.enter.native="handleFilter" v-model="listQuery.numberPlate"></el-input>
style="width: 200px;"
class="filter-item"
placeholder="车牌号"
v-model="listQuery.numberPlate"
></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="5"> <el-col :span="5">
<el-form-item label="出车日期" prop="startTime"> <el-form-item label="出车日期" prop="startTime">
<el-date-picker <el-date-picker
...@@ -34,11 +23,10 @@ ...@@ -34,11 +23,10 @@
:editable="false" :editable="false"
format="yyyy-MM-dd" format="yyyy-MM-dd"
prop="startTime" prop="startTime"
placeholder="请选择出车日期" placeholder="请选择出车日期">
></el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="5"> <el-col :span="5">
<el-form-item label="还车日期" prop="endTime"> <el-form-item label="还车日期" prop="endTime">
<el-date-picker <el-date-picker
...@@ -47,15 +35,14 @@ ...@@ -47,15 +35,14 @@
:editable="false" :editable="false"
format="yyyy-MM-dd" format="yyyy-MM-dd"
prop="endTime" prop="endTime"
placeholder="请选择还车日期" placeholder="请选择还车日期">
></el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="5"> <el-col :span="5">
<el-form-item label="出车公司" prop="departureId"> <el-form-item label="分公司" prop="departureId">
<el-autocomplete <el-autocomplete
class="inline-input" class="inline-input"
v-model="state1" v-model="state1"
...@@ -65,32 +52,6 @@ ...@@ -65,32 +52,6 @@
></el-autocomplete> ></el-autocomplete>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="5">
<el-form-item label="收车公司">
<el-autocomplete
class="inline-input"
v-model="arrivalBranchCompanyId"
:fetch-suggestions="querySearch"
placeholder="请输入内容"
@select="putCompanyChange"
></el-autocomplete>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="用途">
<el-select v-model="listQuery.use" filterable placeholder="请选择车辆用途">
<el-option
v-for="item in useArr"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="5"> <el-col :span="5">
<el-form-item> <el-form-item>
<el-button class="filter-item" type="primary" v-waves icon="search" @click="handleFilter">搜索</el-button> <el-button class="filter-item" type="primary" v-waves icon="search" @click="handleFilter">搜索</el-button>
...@@ -100,50 +61,38 @@ ...@@ -100,50 +61,38 @@
</el-row> </el-row>
</el-form> </el-form>
</div> </div>
<div v-show="statisticVisiable"> <div v-show="statisticVisiable">
<el-row style="text-align: center;margin-top: 10px;margin-bottom: 10px"> <el-row style="text-align: center;margin-top: 10px;margin-bottom: 10px">
<el-col :span="8"> <el-col :span="8">
<span class="statistic_number">{{statisticData.departureCount}}</span> <span class="statistic_number">{{statisticData.departureCount}}</span>
<br /> <br><br>
<br />
<span class="statistic_title">出行次数</span> <span class="statistic_title">出行次数</span>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<span class="statistic_number">{{statisticData.departureDay}}</span> <span class="statistic_number">{{statisticData.departureDay}}</span>
<br /> <br><br>
<br />
<span class="statistic_title">出行天数</span> <span class="statistic_title">出行天数</span>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<span class="statistic_number">{{statisticData.departureMileage}}</span> <span class="statistic_number">{{statisticData.departureMileage}}</span>
<br /> <br><br>
<br />
<span class="statistic_title">公里</span> <span class="statistic_title">公里</span>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
<el-button class="filter-item" type="primary" :icon=" showMoreMoreCol ? 'caret-left' : 'caret-right' " v-waves
<el-button @click="showMoreMoreCol=!showMoreMoreCol">
class="filter-item" 更多列
type="primary" </el-button>
:icon=" showMoreMoreCol ? 'caret-left' : 'caret-right' " <el-table :key='tableKey' :data="list" v-loading.body="listLoading" border fit highlight-current-row
v-waves style="width: 100%">
@click="showMoreMoreCol=!showMoreMoreCol" <el-table-column
>更多列</el-button> type="index"
<el-table label="编号"
:key="tableKey" width="65">
:data="list" </el-table-column>
v-loading.body="listLoading" <!-- <el-table-column align="center" label="编号" width="65">
border --> <!--<template scope="scope">-->
fit
highlight-current-row
style="width: 100%"
>
<el-table-column type="index" label="编号" width="65"></el-table-column>
<!-- <el-table-column align="center" label="编号" width="65">
-->
<!--<template scope="scope">-->
<!--<span>{{scope.row.id}}</span>--> <!--<span>{{scope.row.id}}</span>-->
<!--</template>--> <!--</template>-->
<!--</el-table-column>--> <!--</el-table-column>-->
...@@ -152,53 +101,12 @@ ...@@ -152,53 +101,12 @@
<span>{{scope.row.numberPlate}}</span> <span>{{scope.row.numberPlate}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="预约出/收车时间"> <el-table-column width="200" align="center" label="出车时间">
<template scope="scope">
<p>{{scope.row.book_start_date}}</p>
<p>{{scope.row.book_end_date}}</p>
</template>
</el-table-column>
<el-table-column align="center" label="实际出/收车时间">
<template scope="scope">
<p>{{scope.row.actual_start_date}}</p>
<p>{{scope.row.actual_end_date}}</p>
</template>
</el-table-column>
<el-table-column align="center" label="出/收车公司">
<template scope="scope">
<p>{{scope.row.departureName}}</p>
<p>{{scope.row.arrivalName}}</p>
</template>
</el-table-column>
<el-table-column align="center" label="出/收车人">
<template scope="scope"> <template scope="scope">
<span>{{scope.row.departureTime}}</span> <span>{{scope.row.departureTime}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="出行天数/公里数"> <el-table-column width="100" align="center" label="使用人">
<template scope="scope">
<p>{{scope.row.departureDay}}</p>
<p>{{scope.row.mileage}}</p>
</template>
</el-table-column>
<el-table-column align="center" label="客户/手机号">
<template scope="scope">
<p>{{scope.row.user}}</p>
<p>{{scope.row.userTel}}</p>
</template>
</el-table-column>
<el-table-column align="center" label="用途">
<template scope="scope">
<span>{{scope.row.use}}</span>
</template>
</el-table-column>
<el-table-column align="center" label="备注">
<template scope="scope">
<span>{{scope.row.departureTime}}</span>
</template>
</el-table-column>
<!-- <el-table-column width="100" align="center" label="使用人">
<template scope="scope"> <template scope="scope">
<span>{{scope.row.user}}</span> <span>{{scope.row.user}}</span>
</template> </template>
...@@ -242,9 +150,9 @@ ...@@ -242,9 +150,9 @@
<template scope="scope"> <template scope="scope">
<span>{{scope.row.use}}</span> <span>{{scope.row.use}}</span>
</template> </template>
</el-table-column>--> </el-table-column>
<!-- <el-table-column width="200" align="center" label="使用人电话" v-if="showMoreMoreCol"> <el-table-column width="200" align="center" label="使用人电话" v-if="showMoreMoreCol">
<template scope="scope"> <template scope="scope">
<span>{{scope.row.userTel}}</span> <span>{{scope.row.userTel}}</span>
</template> </template>
...@@ -256,6 +164,7 @@ ...@@ -256,6 +164,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column width="100" align="center" label="开始公里数" v-if="showMoreMoreCol"> <el-table-column width="100" align="center" label="开始公里数" v-if="showMoreMoreCol">
<template scope="scope"> <template scope="scope">
<span>{{scope.row.mileageStart}}</span> <span>{{scope.row.mileageStart}}</span>
...@@ -265,19 +174,13 @@ ...@@ -265,19 +174,13 @@
<template scope="scope"> <template scope="scope">
<span>{{scope.row.mileageEnd}}</span> <span>{{scope.row.mileageEnd}}</span>
</template> </template>
</el-table-column>--> </el-table-column>
</el-table> </el-table>
<div v-show="!listLoading" class="pagination-container"> <div v-show="!listLoading" class="pagination-container">
<el-pagination <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
@size-change="handleSizeChange" :current-page.sync="listQuery.page" :page-sizes="[10,20,30, 50]" :page-size="listQuery.limit"
@current-change="handleCurrentChange" layout="total, sizes, prev, pager, next, jumper" :total="total"></el-pagination>
:current-page.sync="listQuery.page"
:page-sizes="[10,20,30, 50]"
:page-size="listQuery.limit"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
></el-pagination>
</div> </div>
<!-- <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">--> <!-- <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">-->
...@@ -295,32 +198,38 @@ ...@@ -295,32 +198,38 @@
</div> </div>
</template> </template>
<style> <style>
.statistic_number { .statistic_number {
font-size: x-large; font-size: x-large;
font-weight: bolder; font-weight: bolder;
} }
.statistic_title { .statistic_title {
font-size: x-large; font-size: x-large;
} }
</style> </style>
<script> <script>
import { mapGetters } from 'vuex' import {mapGetters} from 'vuex';
import { import {
page, page,
statistic, statistic
findReserveType } from '../../../api/vehicle/departureLog';
} from '../../../api/vehicle/departureLog' import {
import { getAllCompany, getAll } from 'api/base_info/branch_company/' getAllCompany,
import { getAllZone } from 'api/base_info/constant/' getAll
import { getAllBranchCompanyByZoneId } from 'api/order/rentVehicle' } from 'api/base_info/branch_company/';
import { import {
getAllZone
} from 'api/base_info/constant/';
import {
getAllBranchCompanyByZoneId
} from 'api/order/rentVehicle';
import {
toEast8Date, toEast8Date,
deepCopyDate, deepCopyDate,
newEast8Date, newEast8Date,
getYMD_date getYMD_date
} from 'utils/dateUtils' } from 'utils/dateUtils';
export default { export default {
name: 'vehicleDepartureLog', name: 'vehicleDepartureLog',
data() { data() {
return { return {
...@@ -341,8 +250,8 @@ export default { ...@@ -341,8 +250,8 @@ export default {
mileageStart: null, mileageStart: null,
mileageEnd: null, mileageEnd: null,
state: null, state: null,
allCompaniesArr: [], allCompaniesArr:[],
selectArry: [] selectArry: [],
}, },
rules: { rules: {
name: [ name: [
...@@ -356,23 +265,19 @@ export default { ...@@ -356,23 +265,19 @@ export default {
list: null, list: null,
total: null, total: null,
listLoading: true, listLoading: true,
allBranchCompany: [], allBranchCompany:[],
baranchQuery: { baranchQuery: {
zoneId: null zoneId:null
}, },
allZoneArr: [], //全部片区 allZoneArr:[],//全部片区
state1: '', state1:'',
arrivalBranchCompanyId:null,
useArr:[],//用途
listQuery: { listQuery: {
page: 1, page: 1,
limit: 20, limit: 20,
startTime: undefined, startTime: undefined,
endTime: undefined, endTime:undefined,
numberPlate: undefined, numberPlate: undefined,
departureId: undefined, departureId:undefined,
arrivalBranchCompanyId: null,
use:null
}, },
dialogStatus: '', dialogStatus: '',
textMap: { textMap: {
...@@ -390,180 +295,144 @@ export default { ...@@ -390,180 +295,144 @@ export default {
} }
}, },
created() { created() {
let t = this let t = this;
const numberPlate = this.$route.query.numberPlate const numberPlate = this.$route.query.numberPlate;
if (numberPlate) { if (numberPlate) {
this.listQuery.numberPlate = numberPlate this.listQuery.numberPlate = numberPlate;
} }
getAll().then(response => { getAll() .then(response => {
this.allCompaniesArr = response.data this.allCompaniesArr = response.data;
let query = localStorage.getItem('vehicleDepartureLog') let query = localStorage.getItem("vehicleDepartureLog");
if (query != 'null' && query && !numberPlate) { if(query !="null" && query && !numberPlate){
this.listQuery = JSON.parse(query) this.listQuery = JSON.parse(query);
if (t.listQuery.departureId) { if(t.listQuery.departureId){
t.allCompaniesArr.map(function(item) { t.allCompaniesArr.map(function (item) {
if (item.id == t.listQuery.departureId) { if(item.id == t.listQuery.departureId){
t.state1 = item.name t.state1 = item.name;
} }
}) });
} }
} }
t.handleFilter() t.handleFilter();
})
findReserveType().then(data=>{
console.log(data);
}) })
}, },
computed: { computed: {
...mapGetters(['elements']), ...mapGetters([
'elements'
]),
//获取大区列表 //获取大区列表
getAllZoneList() { getAllZoneList() {
return getAllZone() return getAllZone();
}
}, },
methods: {
//收车公司筛选
putCompanyChange(val) {
console.log(val)
if (val) {
this.listQuery.arrivalBranchCompanyId = val.id
} else {
this.listQuery.arrivalBranchCompanyId = null
}
}, },
methods: {
/** /**
* 重置 * 重置
* */ * */
reloadPage() { reloadPage() {
this.state1 = '' this.state1='';
this.arrivalBranchCompanyId = null
this.listQuery = { this.listQuery = {
page: 1, page: 1,
limit: 20, limit: 20,
startTime: undefined, startTime: undefined,
endTime: undefined, endTime:undefined,
numberPlate: undefined, numberPlate: undefined,
departureId: undefined, departureId:undefined,
arrivalBranchCompanyId: undefined, };
use:undefined if(this.listQuery){
localStorage.setItem("vehicleDepartureLog", JSON.stringify(this.listQuery));
} }
if (this.listQuery) { this.handleFilter();
localStorage.setItem(
'vehicleDepartureLog',
JSON.stringify(this.listQuery)
)
}
this.handleFilter()
}, },
handleFilter() { handleFilter() {
this.listQuery.page = 1 this.listQuery.page = 1
if (this.listQuery) { if(this.listQuery){
localStorage.setItem( localStorage.setItem("vehicleDepartureLog", JSON.stringify(this.listQuery));
'vehicleDepartureLog',
JSON.stringify(this.listQuery)
)
} }
this.getList() this.getList();
if (this.listQuery.numberPlate) { if (this.listQuery.numberPlate) {
statistic({ numberPlate: this.listQuery.numberPlate }).then( statistic({numberPlate: this.listQuery.numberPlate}).then(response => {
response => { this.statisticData = response.data;
if (response.status == 200) { });
this.statisticData = response.data this.statisticVisiable = true;
this.statisticVisiable = true
} else {
this.$message(response.message)
}
}
)
} }
}, },
dateToString: function(date) { dateToString: function (date) {
var year = date.getFullYear() var year = date.getFullYear();
var month = (date.getMonth() + 1).toString() var month = (date.getMonth() + 1).toString();
var day = date.getDate().toString() var day = (date.getDate()).toString();
if (month.length == 1) { if (month.length == 1) {
month = '0' + month month = "0" + month;
} }
if (day.length == 1) { if (day.length == 1) {
day = '0' + day day = "0" + day;
} }
var dateTime = year + '-' + month + '-' + day var dateTime = year + "-" + month + "-" + day;
return dateTime return dateTime;
}, },
getList() { getList() {
this.listLoading = true this.listLoading = true;
if (!this.listQuery.numberPlate) { if (!this.listQuery.numberPlate) {
this.statisticVisiable = false this.statisticVisiable = false;
} }
if (this.listQuery.startTime) { if (this.listQuery.startTime) {
this.listQuery.startTime = getYMD_date( this.listQuery.startTime = getYMD_date(new Date(this.listQuery.startTime));
new Date(this.listQuery.startTime)
)
} }
if (this.listQuery.endTime) { if(this.listQuery.endTime) {
this.listQuery.endTime = getYMD_date( this.listQuery.endTime = getYMD_date(new Date(this.listQuery.endTime));
new Date(this.listQuery.endTime)
)
} }
if (!this.state1) { if (!this.state1) {
this.listQuery.departureId = undefined this.listQuery.departureId = undefined;
} }
page(this.listQuery).then(response => { page(this.listQuery)
this.list = response.data.list .then(response => {
this.total = response.data.total this.list = response.data.list;
this.listLoading = false this.total = response.data.total;
this.listLoading = false;
}) })
}, },
querySearch(queryString, cb) { querySearch(queryString, cb) {
let selectArry = [] let selectArry = [];
let iitem = { let iitem = {
value: '全部', value: "全部",
name: '全部' name: "全部"
} };
selectArry.push(iitem) selectArry.push(iitem);
this.allCompaniesArr.map(function(item) { this.allCompaniesArr.map(function (item) {
item.value = item.name item.value = item.name;
selectArry.push(item) selectArry.push(item);
}) });
this.selectArry = selectArry this.selectArry = selectArry;
var results = queryString var results = queryString ? selectArry.filter(this.createFilter(queryString)) : selectArry;
? selectArry.filter(this.createFilter(queryString))
: selectArry
// 调用 callback 返回建议列表的数据 // 调用 callback 返回建议列表的数据
cb(results) cb(results);
}, },
createFilter(queryString) { createFilter(queryString) {
return restaurant => { return (restaurant) => {
return restaurant.name.indexOf(queryString.toLowerCase()) != -1 return (restaurant.name.indexOf(queryString.toLowerCase()) != -1);
} };
}, },
handleSelect(item) { handleSelect(item) {
if (item.value == '全部') { if (item.value == "全部") {
this.listQuery.departureId = undefined this.listQuery.departureId = undefined;
} else { } else {
this.listQuery.departureId = item.id this.listQuery.departureId = item.id;
} }
}, },
handleSizeChange(val) { handleSizeChange(val) {
this.listQuery.limit = val this.listQuery.limit = val;
if (this.listQuery) { if(this.listQuery){
localStorage.setItem( localStorage.setItem("vehicleDepartureLog", JSON.stringify(this.listQuery));
'vehicleDepartureLog',
JSON.stringify(this.listQuery)
)
} }
this.getList() this.getList();
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.listQuery.page = val this.listQuery.page = val;
if (this.listQuery) { if(this.listQuery){
localStorage.setItem( localStorage.setItem("vehicleDepartureLog", JSON.stringify(this.listQuery));
'vehicleDepartureLog',
JSON.stringify(this.listQuery)
)
} }
this.getList() this.getList();
},
} }
} }
}
</script> </script>
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