|
|
@@ -4,6 +4,125 @@
|
|
|
<!-- <el-icon :size="23" class="camera"><UserFilled /></el-icon> -->
|
|
|
<span class="cameratxt">车辆调度</span>
|
|
|
</div>
|
|
|
+ <!-- 新增车辆调度 -->
|
|
|
+ <el-dialog
|
|
|
+ class="sendBus"
|
|
|
+ v-model="addBusqueryVisible"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :close-on-press-escape="false"
|
|
|
+ title="新增调度"
|
|
|
+ align-center
|
|
|
+ width="600"
|
|
|
+ :before-close="editCloseQuery"
|
|
|
+ >
|
|
|
+ <el-form
|
|
|
+ ref="ruleFormRefQuery"
|
|
|
+ :model="ruleFormQuery"
|
|
|
+ :rules="rulesQuery"
|
|
|
+ label-width="150px"
|
|
|
+ class="demo-ruleForm"
|
|
|
+ :size="formSize"
|
|
|
+ label-position="left"
|
|
|
+ status-icon
|
|
|
+ >
|
|
|
+ <!-- <el-form-item label="发车日期 :" prop="startDate">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="ruleFormQuery.startDate"
|
|
|
+ type="date"
|
|
|
+ placeholder="请选择发车日期"
|
|
|
+ format="YYYY-DD-MM"
|
|
|
+ value-format="YYYY-DD-MM"
|
|
|
+ />
|
|
|
+ </el-form-item> -->
|
|
|
+ <el-form-item label="发车时间 :" prop="ci_time">
|
|
|
+ <el-time-picker
|
|
|
+ v-model="ruleFormQuery.ci_time"
|
|
|
+ placeholder="请选择发车时间"
|
|
|
+ format="HH:mm"
|
|
|
+ value-format="HH:mm"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="车牌号 :" prop="busname">
|
|
|
+ <el-select
|
|
|
+ v-model="ruleFormQuery.busname"
|
|
|
+ class="m-2"
|
|
|
+ placeholder="请选择车牌号"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ :label="item.car_number"
|
|
|
+ :value="item.car_number"
|
|
|
+ v-for="item in busNum.list"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="容量 :" prop="volume">
|
|
|
+ <el-input
|
|
|
+ v-model="ruleFormQuery.volume"
|
|
|
+ placeholder="请输入容量"
|
|
|
+ clearable
|
|
|
+ :disabled="true"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="路线 :" prop="route">
|
|
|
+ <el-select
|
|
|
+ v-model="ruleFormQuery.route"
|
|
|
+ class="m-2"
|
|
|
+ placeholder="请选择路线"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ :label="item.route"
|
|
|
+ :value="item.route"
|
|
|
+ v-for="item in pathNum.list"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="终点站 :" prop="destination">
|
|
|
+ <el-select
|
|
|
+ v-model="ruleFormQuery.destination"
|
|
|
+ class="m-2"
|
|
|
+ placeholder="请选择终点站"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ :label="item.route_end"
|
|
|
+ :value="item.route_end"
|
|
|
+ v-for="item in addendNum.list"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ label="是否可提前一天预约"
|
|
|
+ prop="yesterday"
|
|
|
+ class="yesterday"
|
|
|
+ style="
|
|
|
+ padding-bottom: 20px;
|
|
|
+ border-bottom: 1px solid rgba(230, 230, 230, 1);
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <el-switch
|
|
|
+ v-model="ruleFormQuery.yesterday"
|
|
|
+ size="large"
|
|
|
+ style="
|
|
|
+ --el-switch-on-color: rgba(61, 81, 232, 1);
|
|
|
+ /* --el-switch-off-color: rgba(61, 81, 232, 1); */
|
|
|
+ "
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item class="options">
|
|
|
+ <el-button class="congzhi" @click="editCloseQuery(ruleFormRefQuery)"
|
|
|
+ >取消</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ color="rgba(61, 81, 232, 1)"
|
|
|
+ class="queding"
|
|
|
+ type="primary"
|
|
|
+ @click="submitAddQuery(ruleFormRefQuery)"
|
|
|
+ >
|
|
|
+ 确定
|
|
|
+ </el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </el-dialog>
|
|
|
<!-- 候补派车 -->
|
|
|
<el-dialog
|
|
|
class="sendBus"
|
|
|
@@ -78,8 +197,8 @@
|
|
|
placeholder="请选择终点站"
|
|
|
>
|
|
|
<el-option
|
|
|
- :label="item"
|
|
|
- :value="item"
|
|
|
+ :label="item.route_end"
|
|
|
+ :value="item.route_end"
|
|
|
v-for="item in endNum.list"
|
|
|
/>
|
|
|
</el-select>
|
|
|
@@ -101,6 +220,16 @@
|
|
|
</el-form>
|
|
|
</el-dialog>
|
|
|
<div class="MingXi" style="height: 652px; margin: 10px 0 20px 0">
|
|
|
+ <div class="">
|
|
|
+ <el-button
|
|
|
+ style="margin: 10px 0 0 30px"
|
|
|
+ color="rgba(61, 81, 232, 1)"
|
|
|
+ type="primary"
|
|
|
+ class="search"
|
|
|
+ @click="addQuery"
|
|
|
+ ><el-icon><CirclePlus /></el-icon><span>新增调度</span></el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
<div class="footer">
|
|
|
<el-table
|
|
|
:row-class-name="tableRowClassName"
|
|
|
@@ -175,24 +304,27 @@
|
|
|
<div v-if="scope.row.state == 4" style="color: #ccc">已分车</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column align="center" label="操作" width="120">
|
|
|
+ <el-table-column align="center" label="操作" width="180">
|
|
|
<template #default="scope">
|
|
|
<el-button link type="primary" @click="sendBus(scope.row)"
|
|
|
><div class="look">调度</div></el-button
|
|
|
>
|
|
|
+ <el-button link type="primary" @click="del(scope.row)"
|
|
|
+ ><div class="look">删除</div></el-button
|
|
|
+ >
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <el-pagination
|
|
|
+ <!-- <el-pagination
|
|
|
background
|
|
|
v-model:page-size="pageSize"
|
|
|
v-model:current-page="currentPage"
|
|
|
layout="total, prev, pager, next, jumper"
|
|
|
:total="total"
|
|
|
@current-change="handleCurrentChange"
|
|
|
- />
|
|
|
+ /> -->
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -220,12 +352,15 @@ const searchInput = reactive({
|
|
|
const busNum = reactive({ list: [] }); // 车牌号
|
|
|
const pathNum = reactive({ list: [] }); // 路线
|
|
|
const endNum = reactive({ list: [] }); // 终点站
|
|
|
+const addendNum = reactive({ list: [] }); // 新增调度终点站
|
|
|
|
|
|
// 表格数据
|
|
|
const tableData = reactive({
|
|
|
list: [], //汇总数据
|
|
|
});
|
|
|
|
|
|
+const addBusqueryVisible = ref(false); // 新增车辆调度弹窗
|
|
|
+
|
|
|
const dialongTitle = ref("车辆调度"); // 弹窗标题
|
|
|
const centerDialogVisible = ref(false); // 候补弹窗显示
|
|
|
const initials = reactive({
|
|
|
@@ -246,7 +381,8 @@ const selectData = reactive({ list: [] }); // 多选框选择的数据
|
|
|
// 表单数据
|
|
|
const formSize = ref("default");
|
|
|
const ruleFormRef = ref();
|
|
|
-
|
|
|
+const ruleFormRefQuery = ref();
|
|
|
+// 派车调度数据
|
|
|
const ruleForm = reactive({
|
|
|
busname: [], //候补弹窗车牌绑定数据
|
|
|
volume: "",
|
|
|
@@ -256,6 +392,15 @@ const ruleForm = reactive({
|
|
|
state: "",
|
|
|
id: "",
|
|
|
});
|
|
|
+// 新增车辆调度数据
|
|
|
+const ruleFormQuery = reactive({
|
|
|
+ busname: "", //候补弹窗车牌绑定数据
|
|
|
+ ci_time: "", // 发车时间
|
|
|
+ volume: "",
|
|
|
+ route: "",
|
|
|
+ destination: "",
|
|
|
+ yesterday: false,
|
|
|
+});
|
|
|
// 表单验证
|
|
|
const rules = reactive({
|
|
|
ci_time: [
|
|
|
@@ -299,6 +444,110 @@ const rules = reactive({
|
|
|
},
|
|
|
],
|
|
|
});
|
|
|
+const rulesQuery = reactive({
|
|
|
+ ci_time: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "发车时间不能为空",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ busname: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "车牌号不能为空",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ volume: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "容量不能为空",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ pattern: /^(0|[1-9][0-9]*)$/,
|
|
|
+ message: "请输入正确数字",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ route: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "路线不能为空",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ destination: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请选择终点站",
|
|
|
+ trigger: "change",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+});
|
|
|
+
|
|
|
+// 监控派车弹窗选择车牌时容量发生变化
|
|
|
+watch(
|
|
|
+ () => ruleForm.busname,
|
|
|
+ (newValue, oldValue) => {
|
|
|
+ // console.log("person的job变化了", newValue);
|
|
|
+ let volume = 0;
|
|
|
+ newValue.forEach((item) => {
|
|
|
+ busNum.list.forEach((i) => {
|
|
|
+ if (item == i.car_number) {
|
|
|
+ volume = volume + i.contain;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ // console.log(volume);
|
|
|
+ ruleForm.volume = volume;
|
|
|
+ }
|
|
|
+);
|
|
|
+// 监控车牌号
|
|
|
+watch(
|
|
|
+ () => ruleFormQuery.busname,
|
|
|
+ (newValue, oldValue) => {
|
|
|
+ console.log(newValue);
|
|
|
+ if (!newValue == "") {
|
|
|
+ let arr = busNum.list.filter((item) => {
|
|
|
+ return item.car_number == newValue;
|
|
|
+ });
|
|
|
+ // console.log(arr);
|
|
|
+ if (arr == []) {
|
|
|
+ } else {
|
|
|
+ ruleFormQuery.volume = arr[0].contain;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+);
|
|
|
+
|
|
|
+// 监控新增车辆调度路线
|
|
|
+watch(
|
|
|
+ () => ruleFormQuery.route,
|
|
|
+ (newValue, oldValue) => {
|
|
|
+ console.log(newValue);
|
|
|
+ let arr = JSON.parse(sessionStorage.getItem("route_endSelect"));
|
|
|
+ // ruleFormQuery.destination = "";
|
|
|
+ // console.log(arr);
|
|
|
+
|
|
|
+ addendNum.list = arr.filter((item) => {
|
|
|
+ return item.route == newValue;
|
|
|
+ });
|
|
|
+ }
|
|
|
+);
|
|
|
+// 监控调度路线
|
|
|
+// watch(
|
|
|
+// () => ruleForm.route,
|
|
|
+// (newValue, oldValue) => {
|
|
|
+// console.log(oldValue);
|
|
|
+// let arr = JSON.parse(sessionStorage.getItem("route_endSelect"));
|
|
|
+// console.log(arr);
|
|
|
+// endNum.list = arr.filter((item) => {
|
|
|
+// return item.route == newValue;
|
|
|
+// });
|
|
|
+// }
|
|
|
+// );
|
|
|
|
|
|
// 获取数据列表
|
|
|
const getList = async () => {
|
|
|
@@ -364,6 +613,11 @@ const handleSelectionChange = (val) => {
|
|
|
selectData.list = val;
|
|
|
};
|
|
|
|
|
|
+// 新增车辆调度
|
|
|
+const addQuery = () => {
|
|
|
+ addBusqueryVisible.value = true;
|
|
|
+};
|
|
|
+
|
|
|
// 派车按钮
|
|
|
const sendBus = (row) => {
|
|
|
console.log(row);
|
|
|
@@ -424,6 +678,111 @@ const submitAdd = async (formEl) => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+// 新增车辆调度弹窗关闭
|
|
|
+const editCloseQuery = () => {
|
|
|
+ addBusqueryVisible.value = false;
|
|
|
+ ruleFormRefQuery.value.resetFields();
|
|
|
+};
|
|
|
+// 确认新增车辆调度
|
|
|
+const submitAddQuery = async (formEl) => {
|
|
|
+ if (!formEl) return;
|
|
|
+ await formEl.validate(async (valid, fields) => {
|
|
|
+ if (valid) {
|
|
|
+ let yesterday = 0;
|
|
|
+ if (ruleFormQuery.yesterday == true) {
|
|
|
+ yesterday = 1;
|
|
|
+ } else if (ruleFormQuery.yesterday == false) {
|
|
|
+ yesterday = 0;
|
|
|
+ }
|
|
|
+ let data = {
|
|
|
+ car_number: ruleFormQuery.busname,
|
|
|
+ ci_time: ruleFormQuery.ci_time,
|
|
|
+ contain: ruleFormQuery.volume,
|
|
|
+ route: ruleFormQuery.route,
|
|
|
+ route_end: ruleFormQuery.destination,
|
|
|
+ before_state: yesterday,
|
|
|
+ };
|
|
|
+ let res = await axios({
|
|
|
+ method: "post",
|
|
|
+ url: api.value + "/carBook/scheinsert.action",
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json;charset=utf-8",
|
|
|
+ token: sessionStorage.getItem("token"),
|
|
|
+ },
|
|
|
+ data: data,
|
|
|
+ });
|
|
|
+ if (res.data.code == 200) {
|
|
|
+ getList();
|
|
|
+ ElMessage({
|
|
|
+ type: "success",
|
|
|
+ showClose: true,
|
|
|
+ message: res.data.message,
|
|
|
+ center: true,
|
|
|
+ });
|
|
|
+ addBusqueryVisible.value = false;
|
|
|
+ ruleFormRefQuery.value.resetFields();
|
|
|
+ } else {
|
|
|
+ ElMessage({
|
|
|
+ type: "error",
|
|
|
+ showClose: true,
|
|
|
+ message: res.data.message,
|
|
|
+ center: true,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log("error submit!", fields);
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+//删除按钮
|
|
|
+const del = (row) => {
|
|
|
+ console.log(row);
|
|
|
+ ElMessageBox.confirm(`是否删除 ${row.car_number} 车辆?`, "提示", {
|
|
|
+ confirmButtonText: "确认",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ let data = new FormData();
|
|
|
+ data.set("id", row.id);
|
|
|
+ let res = await axios({
|
|
|
+ method: "post",
|
|
|
+ url: api.value + "/carBook/schedel.action",
|
|
|
+ headers: {
|
|
|
+ token: sessionStorage.getItem("token"),
|
|
|
+ },
|
|
|
+ data: data,
|
|
|
+ });
|
|
|
+ if (res.data.code == 200) {
|
|
|
+ // if (tableData.list.length == 1 && currentPage.value != 1) {
|
|
|
+ // currentPage.value = currentPage.value - 1;
|
|
|
+ // }
|
|
|
+ getList();
|
|
|
+ ElMessage({
|
|
|
+ type: "success",
|
|
|
+ showClose: true,
|
|
|
+ message: res.data.message,
|
|
|
+ center: true,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ ElMessage({
|
|
|
+ type: "error",
|
|
|
+ showClose: true,
|
|
|
+ message: res.data.message,
|
|
|
+ center: true,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ console.log(res);
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ ElMessage({
|
|
|
+ type: "info",
|
|
|
+ message: "已取消删除",
|
|
|
+ });
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
// 导出按钮
|
|
|
// const downLoad = lodash.debounce(async () => {
|
|
|
// let data = new FormData();
|
|
|
@@ -489,30 +848,14 @@ const tableRowClassName = ({ row, rowIndex }) => {
|
|
|
const handleCurrentChange = (value) => {
|
|
|
currentPage.value = value;
|
|
|
};
|
|
|
-// 监控派车弹窗选择车牌时容量发生变化
|
|
|
-watch(
|
|
|
- () => ruleForm.busname,
|
|
|
- (newValue, oldValue) => {
|
|
|
- // console.log("person的job变化了", newValue);
|
|
|
- let volume = 0;
|
|
|
- newValue.forEach((item) => {
|
|
|
- busNum.list.forEach((i) => {
|
|
|
- if (item == i.car_number) {
|
|
|
- volume = volume + i.contain;
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- // console.log(volume);
|
|
|
- ruleForm.volume = volume;
|
|
|
- }
|
|
|
-);
|
|
|
+
|
|
|
onBeforeMount(() => {
|
|
|
api.value = store.state.user.api;
|
|
|
pathNum.list = JSON.parse(sessionStorage.getItem("pathSelect"));
|
|
|
busNum.list = JSON.parse(sessionStorage.getItem("busSelect"));
|
|
|
let route_endSelect = JSON.parse(sessionStorage.getItem("route_endSelect"));
|
|
|
- route_endSelect.forEach((item) => {
|
|
|
- endNum.list.push(item.route_end);
|
|
|
+ endNum.list = route_endSelect.filter((item) => {
|
|
|
+ return item.route == ruleForm.route;
|
|
|
});
|
|
|
busNum.list.forEach((item) => {
|
|
|
initials.list.push(item.car_number);
|
|
|
@@ -541,6 +884,7 @@ onBeforeMount(() => {
|
|
|
width: calc(100wh - 40px);
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
height: 60px;
|
|
|
margin: 0 30px;
|
|
|
// padding: 10px 0;
|