作者 王勇

添加批量删除功能

... ... @@ -22,7 +22,8 @@ export const insertDispatchNote = params =>{return http.post(`${baseUrl}/dispatc
export const updateDispatchNote = params =>{return http.put(`${baseUrl}/dispatchNote/updateDispatchNote`, params);};
/*管理员端,调度记录,删除车辆调度记录*/
export const deleteDispatchNote = params =>{return http.del(`${baseUrl}/dispatchNote/deleteDispatchNote`, params);};
/*管理员端,调度记录,批量删除车辆调度记录*/
export const batchRemoveDispatchNode = params =>{return http.get(`${baseUrl}/dispatchNote/batchRemove`, params);};
/*管理员端,车辆信息,查询车辆信息*/
export const selectVehicleInfoList = params =>{return http.get(`${baseUrl}/vehicleInfo/selectVehicleInfoList`, params);};
... ... @@ -32,6 +33,8 @@ export const insertVehicleInfo = params =>{return http.post(`${baseUrl}/vehicleI
export const updateVehicleInfo = params =>{return http.put(`${baseUrl}/vehicleInfo/updateVehicleInfo`, params);};
/*管理员端,车辆信息,删除车辆信息*/
export const deleteVehicleInfo = params =>{return http.del(`${baseUrl}/vehicleInfo/deleteVehicleInfo`, params);};
/*管理员端,车辆信息,批量删除车辆信息*/
export const batchRemoveVehicleInfo= params =>{return http.get(`${baseUrl}/vehicleInfo/batchRemove`, params);};
/*管理员端,驾驶员信息,查询驾驶员信息*/
export const selectDriverInfoList = params =>{return http.get(`${baseUrl}/driverInfo/selectDriverInfoList`, params);};
... ... @@ -41,3 +44,5 @@ export const insertDriverInfo = params =>{return http.post(`${baseUrl}/driverInf
export const updateDriverInfo = params =>{return http.put(`${baseUrl}/driverInfo/updateDriverInfo`, params);};
/*管理员端,驾驶员信息,删除驾驶员信息*/
export const deleteDriverInfo = params =>{return http.del(`${baseUrl}/driverInfo/deleteDriverInfo`, params);};
/*管理员端,驾驶员信息,批量删除驾驶员信息*/
export const batchRemoveDriverInfo= params =>{return http.get(`${baseUrl}/driverInfo/batchRemove`, params);};
... ...
... ... @@ -636,7 +636,8 @@
this.cancelLoading = false;
this.$message.error(error.toString());
});
}).catch();
}).catch(() => {
});
},
/**
* 获取用户信息
... ...
... ... @@ -63,7 +63,9 @@
<div style="margin-top: 20px;">
<el-table :data="DispatchNoteList" border v-loading="listLoading"
:row-class-name="rowStatus"
@selection-change="selsChange"
element-loading-text="拼命加载中">
<el-table-column type="selection" width="55" align="center"></el-table-column>
<el-table-column type="index" align="center"></el-table-column>
<el-table-column label="用户名称" prop="userName" align="center" width="100"></el-table-column>
<el-table-column label="联系方式" prop="userMobile" align="center" width="120"></el-table-column>
... ... @@ -148,15 +150,24 @@
</el-table>
<!-- 分页区域 -->
<div style="margin-top: 10px">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryInfo.pageNum"
:page-sizes="[10,15,20,50]"
:page-size="queryInfo.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
<el-row :gutter="24">
<el-col :span="5">
<el-button type="danger" icon="el-icon-delete" @click="batchRemove"
:disabled="this.sels.length===0">批量删除
</el-button>
</el-col>
<el-col :span="10" style="margin-top: 5px">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryInfo.pageNum"
:page-sizes="[10,15,20,50]"
:page-size="queryInfo.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
</el-col>
</el-row>
</div>
</div>
</el-card>
... ... @@ -387,9 +398,11 @@
insertDispatchNote,
updateDispatchNote,
deleteDispatchNote,
batchRemoveDispatchNode,
startTask,
completeTask
} from "../../api/dispatch_api";
import {batchRemoveUser} from "../../api/user";
export default {
name: "dispatch_api",
... ... @@ -527,7 +540,10 @@
addDispatchNodeFormVisible: false,
//控制编辑调度记录明细,对话框的显示与隐藏
viewDialogVisible: false,
//记录的总条数
total: 0,
/* 批量删除的选中列表 */
sels: [],
/* 列表加载 */
listLoading: false,
/* 添加加载 */
... ... @@ -683,7 +699,7 @@
* 管理员端,删除车辆调度记录
*/
removeDispatchNode(index, row) {
//弹框询问是否取消车辆调度
//弹框询问是否删除车辆调度记录
this.$confirm('此操作永久删除该车辆调度记录, 是否继续?', '警告', {
confirmButtonText: '确定删除',
cancelButtonText: '取消',
... ... @@ -705,7 +721,8 @@
this.delLoading = false;
this.$message.error(error.toString());
});
}).catch();
}).catch(() => {
});
},
/**
* 管理员端,编辑车辆调度记录
... ... @@ -777,6 +794,45 @@
this.$message.error(error.toString());
});
},
/**
* 批量删除,之前的选中
*/
selsChange: function (sels) {
this.sels = sels;
},
/**
* 批量删除功能
*/
batchRemove() {
var ids = this.sels.map(item => item.id).toString();
console.log(ids);
//弹框询问是否批量删除选中的车辆调度记录
this.$confirm('此操作永久删除选中的车辆调度记录, 是否继续?', '警告', {
confirmButtonText: '确定删除',
cancelButtonText: '取消',
type: 'warning'
}
).then(() => {
//开启加载
this.listLoading = true;
let params = {ids: ids};
batchRemoveDispatchNode(params).then(response => {
let res = response.data;
if (res.code !== '200') {
this.listLoading = false;
return this.$message.error('删除车辆调度记录,失败');
}
this.$message.success('删除车辆调度记录,成功!');
this.listLoading = false;
//刷新车辆调度记录列表
this.getDispatchNodeList();
}).catch(error => {
this.delLoading = false;
this.$message.error(error.toString());
});
}).catch(() => {
});
},
//监听,我要调度车辆,对话框的关闭事件
dispatchDialogClosed() {
//重置对话框
... ...
... ... @@ -44,7 +44,9 @@
<!--驾驶员信息列表区域-->
<div style="margin-top: 20px;">
<el-table :data="driverInfoList" border stripe highlight-current-row v-loading="listLoading"
@selection-change="selsChange"
element-loading-text="拼命加载中">
<el-table-column type="selection" width="55" align="center"></el-table-column>
<el-table-column type="index" align="center"></el-table-column>
<el-table-column label="姓名" prop="driverName" align="center" width="100"></el-table-column>
<el-table-column label="联系方式" prop="driverMobile" align="center" width="130"></el-table-column>
... ... @@ -88,15 +90,24 @@
</el-table>
<!--分页区域-->
<div style="margin-top: 10px">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryInfo.pageNum"
:page-sizes="[10,20,30,50]"
:page-size="queryInfo.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
<el-row :gutter="24">
<el-col :span="5">
<el-button type="danger" icon="el-icon-delete" @click="batchRemove"
:disabled="this.sels.length===0">批量删除
</el-button>
</el-col>
<el-col :span="10" style="margin-top: 5px">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryInfo.pageNum"
:page-sizes="[10,20,30,50]"
:page-size="queryInfo.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
</el-col>
</el-row>
</div>
</div>
</el-card>
... ... @@ -112,7 +123,7 @@
:rules="addDriverInfoFormRules" ref="addDriverInfoFormRef"
size="medium" align="center" :inline="true"
style="background-color: #F5F7FA">
<div style="margin-top: -15px">
<div style="margin-top: -15px">
<br>
<el-form-item label="司机姓名:" prop="driverName">
<el-input v-model="addDriverInfoForm.driverName" style="width: 300px;" clearable
... ... @@ -182,7 +193,7 @@
:rules="editDriverInfoFormRules" ref="editDriverInfoFormRef"
:inline="true" size="medium" align="center"
style="background-color: #F5F7FA">
<div style="margin-top: -15px">
<div style="margin-top: -15px">
<br>
<el-form-item label="司机姓名:" prop="driverName">
<el-input v-model="editDriverInfoForm.driverName" style="width: 300px;" clearable
... ... @@ -249,7 +260,8 @@
selectDriverInfoList,
insertDriverInfo,
updateDriverInfo,
deleteDriverInfo, insertVehicleInfo, deleteVehicleInfo, updateVehicleInfo
batchRemoveDriverInfo,
deleteDriverInfo,
} from "../../api/dispatch_api";
export default {
... ... @@ -292,6 +304,10 @@
*/
total: 0,
/**
* 批量删除的选中列表
*/
sels: [],
/**
* 驾驶员信息列表
*/
driverInfoList: [],
... ... @@ -501,7 +517,47 @@
this.delLoading = false;
this.$message.error(error.toString());
});
}).catch();
}).catch(() => {
});
},
/**
* 批量删除,之前的选中
*/
selsChange: function (sels) {
this.sels = sels;
},
/**
* 批量删除功能
*/
batchRemove() {
var ids = this.sels.map(item => item.id).toString();
console.log(ids);
//弹框询问是否批量删除选中的车辆调度记录
this.$confirm('此操作将永久删除,选中的驾驶员信息, 是否继续?', '警告', {
confirmButtonText: '确定删除',
cancelButtonText: '取消',
type: 'warning'
}
).then(() => {
//开启加载
this.listLoading = true;
let params = {ids: ids};
batchRemoveDriverInfo(params).then(response => {
let res = response.data;
if (res.code !== '200') {
this.listLoading = false;
return this.$message.error('批量删除驾驶员信息,失败');
}
this.$message.success('批量删除驶员信息,成功!');
this.listLoading = false;
//刷新驾驶员信息列表
this.getDriverInfoList();
}).catch(error => {
this.delLoading = false;
this.$message.error(error.toString());
});
}).catch(() => {
});
},
/**
* 编辑驾驶员信息
... ...
... ... @@ -51,7 +51,9 @@
<!--车辆信息列表区域-->
<div style="margin-top: 20px;">
<el-table :data="vehicleInfoList" border stripe highlight-current-row v-loading="listLoading"
@selection-change="selsChange"
element-loading-text="拼命加载中">
<el-table-column type="selection" width="55" align="center"></el-table-column>
<el-table-column type="index" align="center"></el-table-column>
<el-table-column label="车辆类型" prop="vehicleType" align="center" width="120">
<template slot-scope="scope">
... ... @@ -107,15 +109,24 @@
</el-table>
<!--分页区域-->
<div style="margin-top: 10px">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryInfo.pageNum"
:page-sizes="[10,20,30,50]"
:page-size="queryInfo.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
<el-row :gutter="24">
<el-col :span="5">
<el-button type="danger" icon="el-icon-delete" @click="batchRemove"
:disabled="this.sels.length===0">批量删除
</el-button>
</el-col>
<el-col :span="10" style="margin-top: 5px">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryInfo.pageNum"
:page-sizes="[10,20,30,50]"
:page-size="queryInfo.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
</el-col>
</el-row>
</div>
</div>
</el-card>
... ... @@ -192,9 +203,9 @@
width="60%" @close="editVehicleInfoDialogClosed">
<el-form :model="editVehicleInfoForm" label-width="100px" status-icon
:rules="editVehicleInfoFormRules" ref="editVehicleInfoFormRef"
:inline="true" align="center"
:inline="true" align="center"
style="background-color: #F5F7FA">
<div >
<div>
<br>
<el-form-item label="车牌号码:" prop="licensePlateNumber">
<el-input v-model="editVehicleInfoForm.licensePlateNumber" clearable
... ... @@ -207,7 +218,7 @@
placeholder="请输入车辆行驶证号"></el-input>
</el-form-item>
<el-form-item label="车辆类型:" prop="vehicleType">
<el-select v-model="editVehicleInfoForm.vehicleType" clearable
<el-select v-model="editVehicleInfoForm.vehicleType" clearable
style="width:250px"
placeholder="请选择车辆类型">
<el-option
... ... @@ -239,7 +250,7 @@
</el-form-item>
<el-form-item label="有无挂车:" prop="vehicleType">
<el-select v-model="editVehicleInfoForm.isTrailer" clearable
style="width:250px" clearable
style="width:250px" clearable
placeholder="请选择有无挂车">
<el-option
v-for="item in isTrailerList"
... ... @@ -278,6 +289,7 @@
selectVehicleInfoList,
insertVehicleInfo,
updateVehicleInfo,
batchRemoveVehicleInfo,
deleteVehicleInfo, deleteDispatchNote
} from "../../api/dispatch_api";
... ... @@ -311,6 +323,10 @@
*/
total: 0,
/**
* 批量删除,选中列表
*/
sels: [],
/**
* 车辆信息列表
*/
vehicleInfoList: [],
... ... @@ -543,10 +559,50 @@
this.delLoading = false;
this.$message.error(error.toString());
});
}).catch();
}).catch(() => {
});
},
/**
* 批量删除,之前的选中
*/
selsChange: function (sels) {
this.sels = sels;
},
/**
* 批量删除功能
*/
batchRemove() {
var ids = this.sels.map(item => item.id).toString();
console.log(ids);
//弹框询问是否批量删除选中的车辆调度记录
this.$confirm('此操作永久删除选中的车辆信息, 是否继续?', '警告', {
confirmButtonText: '确定删除',
cancelButtonText: '取消',
type: 'warning'
}
).then(() => {
//开启加载
this.listLoading = true;
let params = {ids: ids};
batchRemoveVehicleInfo(params).then(response => {
let res = response.data;
if (res.code !== '200') {
this.listLoading = false;
return this.$message.error('批量删除车辆信息,失败');
}
this.$message.success('批量删除车辆信息,成功!');
this.listLoading = false;
//刷新车辆信息列表
this.getVehicleInfoList();
}).catch(error => {
this.delLoading = false;
this.$message.error(error.toString());
});
}).catch(() => {
});
},
/**
* 管理员端,编辑车辆信息
*/
editVehicleInfo() {
... ...