|
|
@@ -45,14 +45,20 @@
|
|
|
|
|
|
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
|
|
<el-form ref="carInfoFormRef" :model="dateObj" :rules="rules" label-width="80px">
|
|
|
- <el-form-item label="路线">
|
|
|
- <el-select v-model="line" placeholder="请选择路线" style="width: 240px" @change="changeSelect">
|
|
|
- <el-option v-for="item in carPathList" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
- </el-select>
|
|
|
+ <el-form-item label="出发时间">
|
|
|
+ <el-time-picker v-model="startTime" :picker-options="{
|
|
|
+ selectableRange: '00:00:00 - 23:59:59'
|
|
|
+ }" placeholder="选择出发时间">
|
|
|
+ </el-time-picker>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="车辆">
|
|
|
- <el-select v-model="form.carNum" value-key="id" placeholder="请选择车辆" style="width: 240px">
|
|
|
- <el-option v-for="item in carInfoList" :key="item.carNum" :label="item.carNum" :value="item.carNum" />
|
|
|
+ <el-select v-model="form.carId" placeholder="请选择车辆" style="width: 240px" @change="changeCarNum">
|
|
|
+ <el-option v-for="item in carInfoList" :key="item.id" :label="item.carNum" :value="item.id" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="路线">
|
|
|
+ <el-select v-model="line" placeholder="请选择路线" style="width: 240px">
|
|
|
+ <el-option v-for="item in carPathList" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="司机">
|
|
|
@@ -88,7 +94,8 @@ import { CarInfoVO, CarInfoQuery, CarInfoForm } from '@/api/carInfo/types';
|
|
|
import tableElm from "@/components/Public/table.vue";
|
|
|
import { allocatedUserList, authUserCancel, authUserCancelAll } from "@/api/system/role";
|
|
|
import { useRoute, useRouter } from "vue-router";
|
|
|
-import moment from 'moment';
|
|
|
+import moment, { months } from 'moment';
|
|
|
+import Data from "@/views/system/dict/data.vue";
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
|
@@ -106,6 +113,9 @@ const carPathList = ref([]);
|
|
|
const line = ref(null);
|
|
|
const carPathObj = ref(null)
|
|
|
const carInfoList = ref<CarInfoVO[]>([])
|
|
|
+const startTime = ref(new Date(2016, 9, 10, 0, 0))
|
|
|
+
|
|
|
+const carInfoObj = ref()
|
|
|
|
|
|
const queryFormRef = ref<ElFormInstance>();
|
|
|
const carScheduleFormRef = ref<ElFormInstance>();
|
|
|
@@ -119,7 +129,7 @@ const initFormData: CarScheduleForm = {
|
|
|
id: undefined,
|
|
|
pathInfo: undefined,
|
|
|
scheduleDate: undefined,
|
|
|
- carNum: undefined
|
|
|
+ carNum: undefined,
|
|
|
}
|
|
|
|
|
|
const selectDate = ref<Date>(null)
|
|
|
@@ -136,7 +146,7 @@ const formParams = ref({
|
|
|
});
|
|
|
|
|
|
const data = reactive<PageData<CarScheduleForm, CarScheduleQuery>>({
|
|
|
- form: { ...initFormData },
|
|
|
+ form: { ...initFormData,carId:undefined },
|
|
|
queryParams: {
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
@@ -178,19 +188,33 @@ const addSchedule = () => {
|
|
|
}
|
|
|
|
|
|
const getcarInfoList = async () => {
|
|
|
- const carList = await listCarInfo(queryParams.value);
|
|
|
+ const carList = await listCarInfo({pageSize:10000});
|
|
|
carInfoList.value = carList.rows
|
|
|
}
|
|
|
|
|
|
+const getCarNum = (value) =>{
|
|
|
+ for(var index in carInfoList.value){
|
|
|
+ if(carInfoList.value[index].id == value){
|
|
|
+ return carInfoList.value[index].carNum
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const getCarId = (value) =>{
|
|
|
+ for(var index in carInfoList.value){
|
|
|
+ if(carInfoList.value[index].carNum == value){
|
|
|
+ return carInfoList.value[index].id
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
const getUserList = async () => {
|
|
|
loading.value = true;
|
|
|
const res = await allocatedUserList({ pageSize: 1000, roleId: '1763484881548447746' });
|
|
|
sjList.value = res.rows
|
|
|
- console.log(sjList.value)
|
|
|
loading.value = true;
|
|
|
const ckres = await allocatedUserList({ pageSize: 1000, roleId: '1763484977044361217' });
|
|
|
ckList.value = ckres.rows
|
|
|
- console.log(ckList.value)
|
|
|
}
|
|
|
|
|
|
const getattend = (value) => {
|
|
|
@@ -252,13 +276,15 @@ const getList = async () => {
|
|
|
loading.value = false;
|
|
|
}
|
|
|
|
|
|
-const changeSelect = (val) => {
|
|
|
- for (var index in carPathList.value) {
|
|
|
- if (val == carPathList.value[index].id) {
|
|
|
- carPathObj.value = carPathList.value[index]
|
|
|
- form.value.carNum = JSON.parse(carPathObj.value.ext1).carNum
|
|
|
- formParams.value.driverInfo = carPathList.value[index].driverInfo
|
|
|
- formParams.value.attendantInfo = carPathList.value[index].attendantInfo
|
|
|
+const changeCarNum = (val) => {
|
|
|
+ for (var i in carInfoList.value) {
|
|
|
+ if (val == carInfoList.value[i].id) {
|
|
|
+ if (carInfoList.value[i].ext2 != null) {
|
|
|
+ var obj = JSON.parse(carInfoList.value[i].ext2)
|
|
|
+ line.value = obj.pathId
|
|
|
+ formParams.value.driverInfo = obj.driverInfo;
|
|
|
+ formParams.value.attendantInfo = obj.attendantInfo;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -278,6 +304,7 @@ const reset = () => {
|
|
|
}
|
|
|
line.value = null;
|
|
|
carPathObj.value = null;
|
|
|
+ startTime.value = new Date("2024-01-01 00:00:00")
|
|
|
carScheduleFormRef.value?.resetFields();
|
|
|
}
|
|
|
|
|
|
@@ -315,11 +342,11 @@ const handleUpdate = async (row?: CarScheduleVO) => {
|
|
|
form.value.id = _id
|
|
|
// Object.assign(form.value, res.data);
|
|
|
var data = JSON.parse(res.data.pathInfo);
|
|
|
- form.value.carNum = row.carNum
|
|
|
+ startTime.value = new Date(row.scheduleDate);
|
|
|
+ form.value.carId = getCarId(row.carNum);
|
|
|
formParams.value.driverInfo = data.driverInfo
|
|
|
formParams.value.attendantInfo = data.attendantInfo
|
|
|
line.value = data.lineID
|
|
|
- console.log(formParams.value)
|
|
|
dialog.visible = true;
|
|
|
dialog.title = "修改车及人员排班";
|
|
|
}
|
|
|
@@ -358,28 +385,30 @@ const handleExport = () => {
|
|
|
}
|
|
|
|
|
|
const submitSchedule = async () => {
|
|
|
- console.log(selectDate.value)
|
|
|
var dataList = [];
|
|
|
+ for(var index in carPathList.value){
|
|
|
+ if(carPathList.value[index].id == line.value){
|
|
|
+ carPathObj.value = carPathList.value[index]
|
|
|
+ }
|
|
|
+ }
|
|
|
if (carPathObj.value != null) {
|
|
|
var stationList = JSON.parse(carPathObj.value.stationList)
|
|
|
- console.log(stationList);
|
|
|
for (var index in stationList) {
|
|
|
var obj = {};
|
|
|
obj.order = Number(index) + 1
|
|
|
obj.location = stationList[index].data.dictValue
|
|
|
if (stationList[index].timeObj) {
|
|
|
- obj.planInTime = stationList[index].timeObj.startTime + ":00"
|
|
|
- obj.planOutTime = stationList[index].timeObj.endTime + ":00"
|
|
|
- }else{
|
|
|
+ obj.planInTime = timeDateFormat(stationList[index].timeObj.startTime + ":00")
|
|
|
+ obj.planOutTime = timeDateFormat(stationList[index].timeObj.endTime + ":00")
|
|
|
+ } else {
|
|
|
obj.planInTime = ''
|
|
|
obj.planOutTime = ''
|
|
|
}
|
|
|
obj.stationName = stationList[index].data.dictLabel
|
|
|
dataList.push(obj)
|
|
|
if (index == 0) {
|
|
|
- console.log(stationList[index].timeObj.startTime + ":00");
|
|
|
- var date = moment(selectDate.value).format('YYYY-MM-DD') + ' ' + stationList[index].timeObj.startTime + ":00";
|
|
|
- form.value.scheduleDate = date;
|
|
|
+ // var date = moment(selectDate.value).format('YYYY-MM-DD') + ' ' + stationList[index].timeObj.startTime + ":00";
|
|
|
+ form.value.scheduleDate = moment(selectDate.value).format('YYYY-MM-DD') + ' '+moment(startTime.value).format('HH:mm:ss');
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -387,6 +416,7 @@ const submitSchedule = async () => {
|
|
|
lineobj.lineID = line.value
|
|
|
lineobj.pathLine = dataList
|
|
|
form.value.pathInfo = JSON.stringify(lineobj);
|
|
|
+ form.value.carNum = getCarNum(form.value.carId);
|
|
|
if (form.value.id) {
|
|
|
await updateCarSchedule(form.value).finally(() => buttonLoading.value = false);
|
|
|
} else {
|
|
|
@@ -403,22 +433,36 @@ const initData = async () => {
|
|
|
const res = await listCarPath({ pageSize: 1000 });
|
|
|
carPathList.value = res.rows
|
|
|
selectDate.value = new Date();
|
|
|
- console.log(selectDate.value)
|
|
|
initList(selectDate.value);
|
|
|
}
|
|
|
|
|
|
|
|
|
const initList = (val) => {
|
|
|
- console.log(val)
|
|
|
queryParams.value.params.scheduleDate = moment(val).format('YYYY-MM-DD');
|
|
|
listCarSchedule(queryParams.value).then(res => {
|
|
|
- console.log(res)
|
|
|
- console.log(table.value)
|
|
|
table.value.setDataList(res.rows);
|
|
|
total.value = res.total;
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+const getTimeData = (date) => {
|
|
|
+ var startDate = moment(new Date()).format("YYYY-MM-DD HH:mm:ss")+" "+date
|
|
|
+ var time = startTime.value.getTime() - new Date(2016, 9, 10, 0, 0).getTime()
|
|
|
+ var siteTime = new Date(date).getTime() + time
|
|
|
+ // var str = moment(siteTime).format("YYYY-MM-DD HH:mm:ss")
|
|
|
+ var str = moment(siteTime).format("YYYY-MM-DD HH:mm:ss")
|
|
|
+ return str
|
|
|
+}
|
|
|
+
|
|
|
+const timeDateFormat = (date) =>{
|
|
|
+ var startDate = moment(startTime.value).format("YYYY-MM-DD")+" "+date
|
|
|
+ console.log(startTime.value)
|
|
|
+ var time = startTime.value.getTime() - new Date(2016, 9, 10, 0, 0).getTime()
|
|
|
+ var siteTime = new Date(startDate).getTime() + time
|
|
|
+ var str = moment(siteTime).format("HH:mm:ss")
|
|
|
+ return str
|
|
|
+}
|
|
|
+
|
|
|
// const initList = (data) =>{
|
|
|
// console.log(data)
|
|
|
// var date = data.day;
|