Commit 9adbe1a9 authored by lixy's avatar lixy

车辆预警消息

parent ffbc494c
......@@ -730,9 +730,16 @@
<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-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-autocomplete
class="inline-input"
v-model="upkeepForm.state1"
:fetch-suggestions="querySearch"
placeholder="请输入内容"
@select="handleSelect"
></el-autocomplete>
</el-form-item>
<el-form-item label="保养项目" prop="upkeepItems">
<el-checkbox-group v-model="upkeepForm.upkeepItems">
......@@ -1124,6 +1131,7 @@
},
upkeepDialogVisible: false,
upkeepForm: {
state1: "",
vehicleId: null,
numberPlate: null,
operator: null,
......@@ -1410,6 +1418,9 @@
}
console.log(item);
},
/**
* 保养结束
* */
upkeepEndHandler(row) {
console.dir(row);
this.$confirm('此操作将结束保养, 是否继续?', '提示', {
......@@ -1457,7 +1468,21 @@
},
upkeepHandler(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;
}
});
this.upkeepForm.mileage = row.mileageLastUpdate;
this.upkeepForm.vehicleId = row.id;
this.upkeepForm.mileage = row.mileage;
this.upkeepForm.numberPlate = row.numberPlate;
this.upkeepDialogVisible = true;
},
......@@ -1468,6 +1493,7 @@
operator: null,
date: null,
mileage: null,
state1: "",
amount: null,
approvers: null,
branchCompanyId: null,
......@@ -1487,6 +1513,7 @@
this.arrivalDialogVisible = true;
this.clearArrivalForm();
this.arrivalForm.vehicleId = row.id;
this.arrivalForm.mileage = row.mileage;
this.arrivalForm.arrivalBranchCompanyId = row.subordinateBranch;
let that = this;
let selectArry = [];
......
......@@ -67,7 +67,10 @@
<el-table-column align="center" label="操作" width="100">
<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>
</template>
</el-table-column>
......@@ -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-item label="消息内容" prop="remark">
......@@ -98,7 +101,48 @@
<el-button v-else type="primary" @click="update('form')">确 定</el-button>
</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-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>
</template>
......@@ -109,14 +153,21 @@
getObj,
dealObj
} from 'api/vehicle/vehicleWarningMsg/';
import {
getAllUpkeepItem
} from 'api/vehicle/upkeep';
import rsCode from '../../../utils/rsCode';
import {mapGetters} from 'vuex';
import {
getAllCompany,
getAll
} from 'api/base_info/branch_company/';
import {
upkeepEndVehicle,
upkeepVehicle
} from 'api/vehicle/active';
export default {
name: 'vehicleInfo',
components: {},
......@@ -126,6 +177,18 @@
msg: undefined,
remark: undefined
},
upkeepForm: {
vehicleId: null,
state1: "",
numberPlate: null,
operator: null,
date: null,
mileage: null,
amount: null,
approvers: null,
branchCompanyId: null,
upkeepItems: []
},
rules: {
name: [
{
......@@ -160,12 +223,16 @@
vehicleCode: undefined,
type: undefined
},
rules4Query: undefined,
allCompanies: {},
allCompaniesArr: [],
dialogFormVisible: false,
rules4Query: undefined,
upkeepDialogVisible: false,
inline: true,
textMap: {
create: '创建'
},
allUpkeepItems: null,
dialogStatus: undefined,
tableKey: 0,
vehicle_warning_msg_btn_add: false,
......@@ -174,7 +241,16 @@
},
created() {
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_deal = this.elements['vehicleWarningMsg:btn_deal'];
},
......@@ -185,6 +261,26 @@
])
},
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) {
if (this.$utils.isEmpty(this.vehicleWarningMsgType[type])) {
return '未知';
......@@ -222,31 +318,119 @@
this.listQuery.page = val;
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() {
this.resetTemp();
this.dialogStatus = 'create';
this.dialogFormVisible = true;
},
handleDeal(row) {
this.$confirm('此操作不可恢复, 是否继续?', '提示', {
cancelUpkeep() {
this.cleanUpkeepForm();
this.upkeepDialogVisible = false;
},
/**
* 保养结束
* */
upkeepEndHandler(row) {
console.dir(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);
});
}).then(() => {
upkeepEndVehicle({
vehicleId: row.vehicleId
}).then(() => {
this.$notify({
title: '成功',
message: '操作成功',
type: 'success',
duration: 2000
});
this.getList();
});
});
},
/**
* 操作-处理
* @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) {
const set = this.$refs;
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