Commit d9198875 authored by hezhen's avatar hezhen
parents 20387399 9d69c77b
......@@ -16,3 +16,19 @@ export function arrivalVehicle(param) {
})
}
export function upkeepVehicle(param) {
return fetch({
url: '/vehicle/active/upkeep',
method: 'post',
data: param
})
}
export function upkeepEndVehicle(param) {
return fetch({
url: '/vehicle/active/upkeepEnd',
method: 'post',
data: param
})
}
import fetch from 'utils/fetch';
export function getAllUpkeepItem() {
return fetch({
url: '/vehicle/upkeep/item/all',
method: 'get'
});
}
export function itemPage(param) {
return fetch({
url: '/vehicle/upkeep/item/page',
method: 'get',
params: param
})
}
export function itemAdd(param) {
return fetch({
url: '/vehicle/upkeep/item',
method: 'post',
params: param
})
}
export function itemEdit(param) {
return fetch({
url: '/vehicle/upkeep/item',
method: 'put',
params: param
})
}
export function itemDelete(id) {
return fetch({
url: '/vehicle/upkeep/item/' + id,
method: 'delete'
})
}
export function logPage(param) {
return fetch({
url: '/vehicle/upkeep/log/page',
method: 'get',
params: param
})
}
export function getLog(id) {
return fetch({
url: '/vehicle/upkeep/log/' + id,
method: 'get'
})
}
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -211,6 +211,12 @@ export const asyncRouterMap = [{
component: _import('branchCompany/stockApply/index'),
name: '分公司股权信息管理',
authority: 'branchCompany/stockApply'
},
{
path: 'vehicleUpkeepItem',
component: _import('vehicle/vehicleUpkeepItem/index'),
name: '车辆保养项目管理',
authority: 'vehicleUpkeepItem'
}
]
}, {
......@@ -243,6 +249,12 @@ export const asyncRouterMap = [{
component: _import('vehicle/vehicleDepartureLog/index'),
name: '车辆出车记录',
authority: 'vehicleDepartureLog'
},
{
path: 'vehicleUpkeepLog',
component: _import('vehicle/vehicleUpkeepLog/index'),
name: '车辆保养记录',
authority: 'vehicleUpkeepLog'
}
]
}
......
......@@ -80,6 +80,10 @@ const baseInfo = {
4: {
code: 4,
val: '出车'
},
5: {
code: 5,
val: '保养'
}
},
codeAndBranchCompany: {},
......
......@@ -125,6 +125,7 @@
</template>
<script>
import 'static/css/uploadImg.css';
import {
search,
getObj,
......
......@@ -267,9 +267,16 @@
<template scope="scope">
<el-button v-if="vehicleInfo_btn_edit" size="small" type="success" @click="handleUpdate(scope.row)">编辑
</el-button>
<el-button v-if="scope.row.status == 1" size="small" type="success" @click="departureHandler(scope.row)">出车</el-button>
<el-button v-if="scope.row.status == 4" size="small" type="success" @click="arrivalHandler(scope.row)">收车</el-button>
<el-button v-if="scope.row.status == 1" size="small" type="success" @click="departureHandler(scope.row)">出车
</el-button>
<el-button v-if="scope.row.status == 4" size="small" type="success" @click="arrivalHandler(scope.row)">收车
</el-button>
<el-button v-if="scope.row.status == 1" size="small" type="success" @click="upkeepHandler(scope.row)">保养
</el-button>
<el-button v-if="scope.row.status == 5" size="small" type="success" @click="upkeepEndHandler(scope.row)">
保养结束
</el-button>
<el-button v-if="vehicleInfo_btn_apply && checkIfRuning(scope.row) " size="small" type="success"
@click="handleApply(scope.row)">申请预订
......@@ -552,7 +559,7 @@
<el-dialog title="出车" :visible.sync="departureDialogVisible">
<el-form :model="departureForm" :rules="rules" ref="form" label-width="90px">
<el-form-item label="车牌号">
<el-input v-model="departureForm.numberPlate" disabled="false"></el-input>
<el-input v-model="departureForm.numberPlate" disabled></el-input>
</el-form-item>
<el-form-item label="用途" prop="use">
<el-input v-model="departureForm.use" placeholder="请输入出车用途"></el-input>
......@@ -583,7 +590,7 @@
<el-dialog title="收车" :visible.sync="arrivalDialogVisible">
<el-form :model="arrivalForm" :rules="rules" ref="form" label-width="90px">
<el-form-item label="车牌号">
<el-input v-model="arrivalForm.numberPlate" disabled="false"></el-input>
<el-input v-model="arrivalForm.numberPlate" disabled></el-input>
</el-form-item>
<el-form-item label="收车人" prop="checkMan">
<el-input v-model="arrivalForm.recycleMan" placeholder="请输入收车人"></el-input>
......@@ -601,6 +608,42 @@
</div>
</el-dialog>
<!-- 车辆保养弹窗 -->
<el-dialog title="保养" :visible.sync="upkeepDialogVisible">
<el-form :model="upkeepForm" :rules="rules" ref="form" label-width="90px">
<el-form-item label="车牌号">
<el-input v-model="upkeepForm.numberPlate" disabled></el-input>
</el-form-item>
<el-form-item label="保养人" prop="operator">
<el-input v-model="upkeepForm.operator" placeholder="请输入车辆保养人"></el-input>
</el-form-item>
<el-form-item label="公里数" prop="mileage">
<el-input v-model="upkeepForm.mileage" placeholder="请输入保养时公里数"></el-input>
</el-form-item>
<el-form-item label="总费用" prop="amount">
<el-input v-model="upkeepForm.amount" placeholder="请输入保养总费用"></el-input>
</el-form-item>
<el-form-item label="审批人" prop="approvers">
<el-input v-model="upkeepForm.approvers" placeholder="请输入保养审批人"></el-input>
</el-form-item>
<el-form-item label="分公司" prop="branchCompanyId">
<el-select class="filter-item" v-model="upkeepForm.branchCompanyId" placeholder="请选择分公司">
<el-option v-for="item in allCompanies" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="保养项目" prop="upkeepItems">
<el-checkbox-group v-model="upkeepForm.upkeepItems">
<el-checkbox v-for="item in allUpkeepItems" :label="item.id">{{item.name}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancelUpkeep">取 消</el-button>
<el-button type="primary" @click="upkeepVehicleHandler">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
......@@ -625,9 +668,15 @@
import {
departureVehicle,
arrivalVehicle
arrivalVehicle,
upkeepVehicle,
upkeepEndVehicle
} from 'api/vehicle/active';
import {
getAllUpkeepItem
} from 'api/vehicle/upkeep';
import {
getSonRegionByCodes,
getRegionByCodes,
......@@ -932,7 +981,20 @@
recycleMan: null,
recycleManTel: null,
mileage: null
}
},
upkeepDialogVisible: false,
upkeepForm: {
vehicleId: null,
numberPlate: null,
operator: null,
date: null,
mileage: null,
amount: null,
approvers: null,
branchCompanyId: null,
upkeepItems: []
},
allUpkeepItems: null
}
},
created() {
......@@ -940,6 +1002,9 @@
getAllCompany(codeAndBranchCompany => {
this.allCompanies = codeAndBranchCompany;
});
getAllUpkeepItem().then(response => {
this.allUpkeepItems = response.data;
});
this.vehicleInfo_btn_edit = this.elements['vehicleInfo:btn_edit'];
this.vehicleInfo_btn_add = this.elements['vehicleInfo:btn_add'];
this.vehicleInfo_btn_apply = this.elements['vehicleInfo:btn_apply'];
......@@ -1051,6 +1116,70 @@
}
},
methods: {
upkeepEndHandler(row) {
console.dir(row);
this.$confirm('此操作将结束保养, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
upkeepEndVehicle({
vehicleId: row.id
}).then(() => {
this.$notify({
title: '成功',
message: '操作成功',
type: 'success',
duration: 2000
});
this.getList();
});
});
},
upkeepVehicleHandler() {
upkeepVehicle(this.upkeepForm).then(response => {
if (response.code === rsCode.RS_CODE_SUC) {
this.upkeepDialogVisible = false;
this.$notify({
title: '成功',
message: '操作成功',
type: 'success',
duration: 2000
});
this.getList();
} else {
this.$notify({
title: '失败',
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
})
},
cancelUpkeep() {
this.cleanUpkeepForm();
this.upkeepDialogVisible = false;
},
upkeepHandler(row) {
this.cleanUpkeepForm();
this.upkeepForm.vehicleId = row.id;
this.upkeepForm.numberPlate = row.numberPlate;
this.upkeepDialogVisible = true;
},
cleanUpkeepForm() {
this.upkeepForm = {
vehicleId: null,
numberPlate: null,
operator: null,
date: null,
mileage: null,
amount: null,
approvers: null,
branchCompanyId: null,
upkeepItems: []
}
},
handleDepartureLog(row) {
this.$router.push({
path: '/vehicle/vehicleDepartureLog',
......
<template>
<div class="app-container calendar-list-container">
<div class="filter-container">
<el-button class="filter-item" v-if="vehicleUpkeepItem_btn_add" @click="handleCreate"
type="primary" icon="edit">添加</el-button>
</div>
<el-table :key='tableKey' :data="list" v-loading.body="listLoading" border fit highlight-current-row
style="width: 100%">
<el-table-column align="center" label="保养项目" width="300">
<template scope="scope">
<span>{{scope.row.name}}</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="150">
<template scope="scope">
<el-button v-if="vehicleUpkeepItem_btn_edit" size="small" type="success" @click="handleUpdate(scope.row)">编辑
</el-button>
<el-button v-if="vehicleUpkeepItem_btn_del" size="small" type="danger" @click="handleDelete(scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
<div v-show="!listLoading" class="pagination-container">
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
: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>
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
<el-form :model="form" :rules="rules" ref="form" label-width="100px">
<el-form-item label="保养项目" prop="name">
<el-input v-model="form.name" placeholder="请输入保养项目"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel('form')">取 消</el-button>
<el-button v-if="dialogStatus=='create'" type="primary" @click="create('form')">确 定</el-button>
<el-button v-else type="primary" @click="update('form')">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
itemPage,
itemAdd,
itemEdit,
itemDelete
} from '../../../api/vehicle/upkeep';
import { mapGetters } from 'vuex';
export default {
name: 'vehicleUpkeepItem',
data() {
return {
form: {
id: null,
name: null
},
rules: {
name: [
{
required: true,
message: '请输入保养项目',
trigger: 'blur'
}
]
},
list: null,
total: null,
listLoading: true,
listQuery: {
page: 1,
limit: 20
},
tableKey: 0,
vehicleUpkeepItem_btn_add: false,
vehicleUpkeepItem_btn_edit: false,
vehicleUpkeepItem_btn_del: false,
textMap: {
update: '编辑',
create: '创建'
},
dialogFormVisible: false,
dialogStatus: ''
}
},
created() {
this.getList();
this.vehicleUpkeepItem_btn_add = this.elements['vehicleUpkeepItem:btn_add'];
this.vehicleUpkeepItem_btn_edit = this.elements['vehicleUpkeepItem:btn_edit'];
this.vehicleUpkeepItem_btn_del = this.elements['vehicleUpkeepItem:btn_del'];
},
computed: {
...mapGetters(['elements'])
},
methods: {
handleCreate() {
// 打开添加dialog
this.cleanForm();
this.dialogStatus = 'create';
this.dialogFormVisible = true;
},
create(formName) {
const set = this.$refs;
set[formName].validate(valid => {
if (valid) {
itemAdd(this.form).then(() => {
this.dialogFormVisible = false;
this.getList();
this.$notify({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
});
})
} else {
return false;
}
});
},
handleUpdate(row) {
// 打开编辑dialog
this.cleanForm();
this.form.id = row.id;
this.form.name = row.name;
this.dialogStatus = 'update';
this.dialogFormVisible = true;
},
update(formName) {
const set = this.$refs;
set[formName].validate(valid => {
if (valid) {
itemEdit(this.form).then(() => {
this.dialogFormVisible = false;
this.getList();
this.$notify({
title: '成功',
message: '修改成功',
type: 'success',
duration: 2000
});
});
} else {
return false;
}
});
},
cancel(formName) {
this.cleanForm();
this.dialogFormVisible = false;
this.$refs[formName].resetFields();
},
handleDelete(row) {
// 删除
this.$confirm('此操作将永久删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
itemDelete(row.id)
.then(() => {
this.$notify({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
});
const index = this.list.indexOf(row);
this.list.splice(index, 1);
});
});
},
cleanForm() {
this.form = {
id: null,
name: null
}
},
handleFilter() {
this.getList();
},
getList() {
this.listLoading = true;
itemPage(this.listQuery).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.listLoading = false;
});
},
handleSizeChange(val) {
this.listQuery.limit = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.page = val;
this.getList();
}
}
}
</script>
<template>
<div class="app-container calendar-list-container">
<div class="filter-container">
<el-input @keyup.enter.native="handleFilter" style="width: 200px;" class="filter-item" placeholder="车牌号"
v-model="listQuery.numberPlate"></el-input>
<el-button class="filter-item" type="primary" v-waves icon="search" @click="handleFilter">搜索</el-button>
</div>
<el-table :key='tableKey' :data="list" v-loading.body="listLoading" border fit highlight-current-row
style="width: 100%">
<el-table-column align="center" label="车牌号" width="120">
<template scope="scope">
<span>{{scope.row.numberPlate}}</span>
</template>
</el-table-column>
<el-table-column width="100" align="center" label="保养人">
<template scope="scope">
<span>{{scope.row.operator}}</span>
</template>
</el-table-column>
<el-table-column width="200" align="center" label="保养日期">
<template scope="scope">
<span>{{scope.row.date}}</span>
</template>
</el-table-column>
<el-table-column width="100" align="center" label="公里数">
<template scope="scope">
<span>{{scope.row.mileage}}</span>
</template>
</el-table-column>
<el-table-column width="200" align="center" label="总费用">
<template scope="scope">
<span>{{scope.row.amount}}</span>
</template>
</el-table-column>
<el-table-column width="250" align="center" label="审批人">
<template scope="scope">
<span>{{scope.row.approvers}}</span>
</template>
</el-table-column>
<el-table-column width="250" align="center" label="保养分公司">
<template scope="scope">
<span>{{scope.row.branchCompanyName}}</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="100">
<template scope="scope">
<el-button size="small" type="success" @click="getLogInfo(scope.row)">详情</el-button>
</template>
</el-table-column>
</el-table>
<div v-show="!listLoading" class="pagination-container">
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
: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>
<el-dialog title="保养详情" :visible.sync="dialogFormVisible">
<el-form :model="form" ref="form" label-width="100px">
<el-form-item label="车牌号" prop="name">
<el-input v-model="form.numberPlate" disabled></el-input>
</el-form-item>
<el-form-item label="保养人" prop="operator">
<el-input v-model="form.operator"></el-input>
</el-form-item>
<el-form-item label="公里数" prop="mileage">
<el-input v-model="form.mileage"></el-input>
</el-form-item>
<el-form-item label="总费用" prop="amount">
<el-input v-model="form.amount"></el-input>
</el-form-item>
<el-form-item label="审批人" prop="approvers">
<el-input v-model="form.approvers"></el-input>
</el-form-item>
<el-form-item label="保养分公司" prop="approvers">
<el-input v-model="form.branchCompanyName"></el-input>
</el-form-item>
<el-form-item label="保养项目" prop="upkeepItems">
<el-checkbox v-for="item in form.upkeepItems" :label="item.id" checked>{{item.itemName}}</el-checkbox>
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
<script>
import {
logPage,
getLog
} from '../../../api/vehicle/upkeep';
import rsCode from '../../../utils/rsCode';
export default {
name: 'vehicleUpkeepLog',
data() {
return {
form: {
vehicleId: null,
numberPlate: null,
operator: null,
date: null,
mileage: null,
amount: null,
approvers: null,
branchCompanyId: null,
branchCompanyName: null,
upkeepItems: []
},
list: null,
total: null,
listLoading: true,
listQuery: {
page: 1,
limit: 20,
numberPlate: undefined
},
tableKey: 0,
dialogFormVisible: false
}
},
created() {
this.getList();
},
methods: {
getLogInfo(row) {
getLog(row.id).then(response => {
if (response.code === rsCode.RS_CODE_SUC) {
this.dialogFormVisible = true;
this.form = response.data;
}
});
},
handleFilter() {
this.getList();
},
getList() {
this.listLoading = true;
logPage(this.listQuery).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.listLoading = false;
});
},
handleSizeChange(val) {
this.listQuery.limit = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.page = val;
this.getList();
}
}
}
</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