Commit 9adbe1a9 authored by lixy's avatar lixy

车辆预警消息

parent ffbc494c
...@@ -730,9 +730,16 @@ ...@@ -730,9 +730,16 @@
<el-input v-model="upkeepForm.approvers" placeholder="请输入保养审批人"></el-input> <el-input v-model="upkeepForm.approvers" placeholder="请输入保养审批人"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="分公司" prop="branchCompanyId"> <el-form-item label="分公司" prop="branchCompanyId">
<el-select class="filter-item" v-model="upkeepForm.branchCompanyId" placeholder="请选择分公司"> <!--<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-option v-for="item in allCompanies" :key="item.id" :label="item.name" :value="item.id"></el-option>-->
</el-select> <!--</el-select>-->
<el-autocomplete
class="inline-input"
v-model="upkeepForm.state1"
:fetch-suggestions="querySearch"
placeholder="请输入内容"
@select="handleSelect"
></el-autocomplete>
</el-form-item> </el-form-item>
<el-form-item label="保养项目" prop="upkeepItems"> <el-form-item label="保养项目" prop="upkeepItems">
<el-checkbox-group v-model="upkeepForm.upkeepItems"> <el-checkbox-group v-model="upkeepForm.upkeepItems">
...@@ -1124,6 +1131,7 @@ ...@@ -1124,6 +1131,7 @@
}, },
upkeepDialogVisible: false, upkeepDialogVisible: false,
upkeepForm: { upkeepForm: {
state1: "",
vehicleId: null, vehicleId: null,
numberPlate: null, numberPlate: null,
operator: null, operator: null,
...@@ -1410,6 +1418,9 @@ ...@@ -1410,6 +1418,9 @@
} }
console.log(item); console.log(item);
}, },
/**
* 保养结束
* */
upkeepEndHandler(row) { upkeepEndHandler(row) {
console.dir(row); console.dir(row);
this.$confirm('此操作将结束保养, 是否继续?', '提示', { this.$confirm('此操作将结束保养, 是否继续?', '提示', {
...@@ -1457,7 +1468,21 @@ ...@@ -1457,7 +1468,21 @@
}, },
upkeepHandler(row) { upkeepHandler(row) {
this.cleanUpkeepForm(); this.cleanUpkeepForm();
this.upkeepForm.branchCompanyId = row.subordinateBranch;
let that = this;
let selectArry = [];
this.allCompaniesArr.map(function(item){
item.value = item.name;
selectArry.push(item);
});
selectArry.map(function (iitem) {
if( row.subordinateBranch == iitem.id){
that.upkeepForm.state1 = iitem.name;
}
});
this.upkeepForm.mileage = row.mileageLastUpdate;
this.upkeepForm.vehicleId = row.id; this.upkeepForm.vehicleId = row.id;
this.upkeepForm.mileage = row.mileage;
this.upkeepForm.numberPlate = row.numberPlate; this.upkeepForm.numberPlate = row.numberPlate;
this.upkeepDialogVisible = true; this.upkeepDialogVisible = true;
}, },
...@@ -1468,6 +1493,7 @@ ...@@ -1468,6 +1493,7 @@
operator: null, operator: null,
date: null, date: null,
mileage: null, mileage: null,
state1: "",
amount: null, amount: null,
approvers: null, approvers: null,
branchCompanyId: null, branchCompanyId: null,
...@@ -1487,6 +1513,7 @@ ...@@ -1487,6 +1513,7 @@
this.arrivalDialogVisible = true; this.arrivalDialogVisible = true;
this.clearArrivalForm(); this.clearArrivalForm();
this.arrivalForm.vehicleId = row.id; this.arrivalForm.vehicleId = row.id;
this.arrivalForm.mileage = row.mileage;
this.arrivalForm.arrivalBranchCompanyId = row.subordinateBranch; this.arrivalForm.arrivalBranchCompanyId = row.subordinateBranch;
let that = this; let that = this;
let selectArry = []; let selectArry = [];
......
...@@ -67,7 +67,10 @@ ...@@ -67,7 +67,10 @@
<el-table-column align="center" label="操作" width="100"> <el-table-column align="center" label="操作" width="100">
<template scope="scope"> <template scope="scope">
<el-button v-if="vehicle_warning_msg_btn_deal " size="small" type="success" @click="handleDeal(scope.row)">处理 <el-button v-if="scope.row.status == 1" size="small" type="success" @click="handleDeal(scope.row)">处理
</el-button>
<el-button v-if="scope.row.status == 5" size="small" type="success" @click="upkeepEndHandler(scope.row)">
保养结束
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
...@@ -82,7 +85,7 @@ ...@@ -82,7 +85,7 @@
<!-- 增加/修改弹出框 --> <!-- 增加/修改弹出框 -->
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible"> <el-dialog title="保养" :visible.sync="dialogFormVisible">
<el-form :model="form" :rules="rules" ref="form" label-width="120px"> <el-form :model="form" :rules="rules" ref="form" label-width="120px">
<el-form-item label="消息内容" prop="remark"> <el-form-item label="消息内容" prop="remark">
...@@ -98,7 +101,48 @@ ...@@ -98,7 +101,48 @@
<el-button v-else type="primary" @click="update('form')">确 定</el-button> <el-button v-else type="primary" @click="update('form')">确 定</el-button>
</div> </div>
</el-dialog> </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-autocomplete
class="inline-input"
v-model="upkeepForm.state1"
:fetch-suggestions="querySearch"
placeholder="请输入内容"
@select="handleSelect"
></el-autocomplete>
<!--<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" :key="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> </div>
</template> </template>
...@@ -109,14 +153,21 @@ ...@@ -109,14 +153,21 @@
getObj, getObj,
dealObj dealObj
} from 'api/vehicle/vehicleWarningMsg/'; } from 'api/vehicle/vehicleWarningMsg/';
import {
getAllUpkeepItem
} from 'api/vehicle/upkeep';
import rsCode from '../../../utils/rsCode'; import rsCode from '../../../utils/rsCode';
import {mapGetters} from 'vuex'; import {mapGetters} from 'vuex';
import {
getAllCompany,
getAll
} from 'api/base_info/branch_company/';
import {
upkeepEndVehicle,
upkeepVehicle
} from 'api/vehicle/active';
export default { export default {
name: 'vehicleInfo', name: 'vehicleInfo',
components: {}, components: {},
...@@ -126,6 +177,18 @@ ...@@ -126,6 +177,18 @@
msg: undefined, msg: undefined,
remark: undefined remark: undefined
}, },
upkeepForm: {
vehicleId: null,
state1: "",
numberPlate: null,
operator: null,
date: null,
mileage: null,
amount: null,
approvers: null,
branchCompanyId: null,
upkeepItems: []
},
rules: { rules: {
name: [ name: [
{ {
...@@ -160,12 +223,16 @@ ...@@ -160,12 +223,16 @@
vehicleCode: undefined, vehicleCode: undefined,
type: undefined type: undefined
}, },
rules4Query: undefined, allCompanies: {},
allCompaniesArr: [],
dialogFormVisible: false, dialogFormVisible: false,
rules4Query: undefined,
upkeepDialogVisible: false,
inline: true, inline: true,
textMap: { textMap: {
create: '创建' create: '创建'
}, },
allUpkeepItems: null,
dialogStatus: undefined, dialogStatus: undefined,
tableKey: 0, tableKey: 0,
vehicle_warning_msg_btn_add: false, vehicle_warning_msg_btn_add: false,
...@@ -174,7 +241,16 @@ ...@@ -174,7 +241,16 @@
}, },
created() { created() {
this.getList(); this.getList();
getAll()
.then(response => {
this.allCompaniesArr = response.data;
})
getAllCompany(codeAndBranchCompany => {
this.allCompanies = codeAndBranchCompany;
});
getAllUpkeepItem().then(response => {
this.allUpkeepItems = response.data;
});
this.vehicle_warning_msg_btn_add = this.elements['vehicleWarningMsg:btn_add']; this.vehicle_warning_msg_btn_add = this.elements['vehicleWarningMsg:btn_add'];
this.vehicle_warning_msg_btn_deal = this.elements['vehicleWarningMsg:btn_deal']; this.vehicle_warning_msg_btn_deal = this.elements['vehicleWarningMsg:btn_deal'];
}, },
...@@ -185,6 +261,26 @@ ...@@ -185,6 +261,26 @@
]) ])
}, },
methods: { methods: {
querySearch(queryString, cb) {
let selectArry = [];
this.allCompaniesArr.map(function(item){
item.value = item.name;
selectArry.push(item);
});
this.selectArry = selectArry;
var results = queryString ? selectArry.filter(this.createFilter(queryString)) : selectArry;
// 调用 callback 返回建议列表的数据
cb(results);
},
handleSelect(item) {
this.upkeepForm.branchCompanyId = item.id;
console.log(item);
},
createFilter(queryString) {
return (restaurant) => {
return (restaurant.name.indexOf(queryString.toLowerCase()) != -1);
};
},
getTypeName: function(type) { getTypeName: function(type) {
if (this.$utils.isEmpty(this.vehicleWarningMsgType[type])) { if (this.$utils.isEmpty(this.vehicleWarningMsgType[type])) {
return '未知'; return '未知';
...@@ -222,31 +318,119 @@ ...@@ -222,31 +318,119 @@
this.listQuery.page = val; this.listQuery.page = val;
this.getList(); this.getList();
}, },
/**
* 保养-确定
* */
upkeepVehicleHandler() {debugger
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
});
}
})
},
handleCreate() { handleCreate() {
this.resetTemp(); this.resetTemp();
this.dialogStatus = 'create'; this.dialogStatus = 'create';
this.dialogFormVisible = true; this.dialogFormVisible = true;
}, },
handleDeal(row) { cancelUpkeep() {
this.$confirm('此操作不可恢复, 是否继续?', '提示', { this.cleanUpkeepForm();
this.upkeepDialogVisible = false;
},
/**
* 保养结束
* */
upkeepEndHandler(row) {
console.dir(row);
this.$confirm('此操作将结束保养, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}) }).then(() => {
.then(() => { upkeepEndVehicle({
dealObj(row.id) vehicleId: row.vehicleId
.then(() => { }).then(() => {
this.$notify({ this.$notify({
title: '成功', title: '成功',
message: '处理成功', message: '操作成功',
type: 'success', type: 'success',
duration: 2000 duration: 2000
}); });
const index = this.list.indexOf(row); this.getList();
this.list.splice(index, 1);
});
}); });
});
},
/**
* 操作-处理
* @param row
*/
handleDeal(row) {
this.cleanUpkeepForm();
this.upkeepForm.branchCompanyId = row.subordinateBranch;
let that = this;
let selectArry = [];
this.allCompaniesArr.map(function(item){
item.value = item.name;
selectArry.push(item);
});
selectArry.map(function (iitem) {
if( row.subordinateBranch == iitem.id){
that.upkeepForm.state1 = iitem.name;
}
});debugger
this.upkeepForm.mileage = row.mileageLastUpdate;
this.upkeepForm.vehicleId = row.vehicleId;
this.upkeepForm.numberPlate = row.numberPlate;
this.upkeepDialogVisible = true;
},
cleanUpkeepForm() {
this.upkeepForm = {
state1: "",
vehicleId: null,
numberPlate: null,
operator: null,
date: null,
mileage: null,
amount: null,
approvers: null,
branchCompanyId: null,
upkeepItems: []
}
}, },
// handleDeal(row) {
// this.$confirm('此操作不可恢复, 是否继续?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// })
// .then(() => {
// dealObj(row.id)
// .then(() => {
// this.$notify({
// title: '成功',
// message: '处理成功',
// type: 'success',
// duration: 2000
// });
// const index = this.list.indexOf(row);
// this.list.splice(index, 1);
// });
// });
// },
create(formName) { create(formName) {
const set = this.$refs; const set = this.$refs;
set[formName].validate(valid => { set[formName].validate(valid => {
......
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