liwei19941102 пре 2 година
родитељ
комит
55008986a4

+ 66 - 22
src/components/Public/timeLine.vue

@@ -1,38 +1,58 @@
 <template>
   <div>
     <div style="display: flex;flex-direction: row;">
-    <div v-for="(obj, index1) in activities" style="width: 13vw;">
-      <div style="height: 40px;">
-         <img v-if="obj.isNow" style="width: 40px;" src="@/assets/images/icon/小货车.png" />
-      </div>
-      <div style="display: flex;flex-direction: row;  font-family: 思源黑体;font-size: 18px;font-weight: bold;color:#C0C4CC">
-        <div>{{ obj.startTime }}</div>
-        <div style="padding-left: 40px;">{{ obj.endTime }}</div>
+      <div v-for="(obj, index1) in list" style="width: 13vw;">
+        <div style="display: flex;flex-direction: row;">
+          <div style="height: 40px;">
+            <img v-if="getCurrentStation(obj.stationName, index1)" style="width: 40px;"
+              src="@/assets/images/icon/小货车.png" />
+          </div>
+          <!-- <div style="height: 40px;">
+            <img v-if="getCurrentStation(obj.stationName, index1)" style="width: 40px;margin-left: 4vw;"
+              src="@/assets/images/icon/小货车.png" />
+          </div> -->
+        </div>
+        <div
+          style="width:13vw;display: flex;flex-direction: row;  font-family: 思源黑体;font-size: 18px;font-weight: bold;color:#C0C4CC">
+          <div v-show="index1 != 0">{{ formatDate(obj.planInTime) }}</div>
+          <div style="padding-left: 20px;">{{ formatDate(obj.planOutTime) }}</div>
+        </div>
       </div>
     </div>
-    </div>
     <div style="display: flex;flex-direction: row;padding-left: 3%;">
-    <div v-for="(item, index) in activities" style="width: 13vw;">
-      <div>
-        <div style="display: flex;flex-direction: row;">
-          <div class="activitieyContent" v-if="item.rank == 1" style="background: #06D903;">
-            起
-          </div>
-          <div class="activitieyContent" v-if="item.rank != 1" style="">
-            {{ index }}
+      <div v-for="(item, index) in list" style="width: 13vw;">
+        <div>
+          <div style="display: flex;flex-direction: row;">
+            <div class="activitieyContent" v-if="item.rank == 1" style="background: #06D903;">
+              起
+            </div>
+            <div class="activitieyContent" v-if="item.rank != 1" style="">
+              {{ index }}
+            </div>
+            <div class="line" style="margin-top:17px;margin-left: 2px;" v-if="index != list.length - 1"></div>
           </div>
-          <div class="line" style="margin-top:17px;margin-left: 2px;" v-if="item.rank != 999"></div>
-        </div>
-        <div style="writing-mode:vertical-rl;width: 40px;line-height: 40px;font-family: 思源黑体;
+          <div style="writing-mode:vertical-rl;width: 40px;line-height: 40px;font-family: 思源黑体;
                     font-size: 23px;font-weight: bold;letter-spacing: 10px;margin-top: 10px;">
-          {{ item.content }}
+            {{ item.stationName }}
+          </div>
         </div>
       </div>
     </div>
-    </div>
   </div>
 </template>
 <script lang="ts" setup>
+
+const props = defineProps({
+  list: {
+    type: [Object],
+    default: ""
+  },
+  stationInfo: {
+    type: Object,
+    default: ""
+  }
+});
+
 const activities = [
   {
     content: '白下',
@@ -42,7 +62,7 @@ const activities = [
     color: '#06D903',
     index: '起点',
     rank: 1,
-    isNow:true
+    isNow: true
   },
   {
     content: '白下',
@@ -85,6 +105,30 @@ const activities = [
     rank: 999
   },
 ]
+
+const formatDate = (value) => {
+  var detaAtty = value.split(":")
+  if (detaAtty.length > 1) {
+    return detaAtty[0] + ":" + detaAtty[1]
+  } else {
+    return value
+  }
+}
+
+const getCurrentStation = (name, index) => {
+  var stationObj = props.stationInfo;
+  if (stationObj.passStations == 'null') {
+    console.log(index == 0)
+    return index == 0
+  } else {
+        var passStationsArry = stationObj.passStations.split(",");
+  }
+}
+
+onMounted(() => {
+  console.log(props.stationInfo)
+  // getCurrentStation()
+});
 </script>
 <style lang="scss" scoped>
 .activitieyContent {

+ 38 - 10
src/views/car/work/schedule.vue

@@ -50,6 +50,11 @@
             <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="车辆">
+          <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>
+        </el-form-item>
         <el-form-item label="司机">
           <el-select v-model="formParams.driverInfo" placeholder="请选择司机" style="width: 240px">
             <el-option v-for="item in sjList" :key="item.userId" :label="item.nickName" :value="item.userId" />
@@ -100,6 +105,7 @@ const ckList = ref([]);
 const carPathList = ref([]);
 const line = ref(null);
 const carPathObj = ref(null)
+const carInfoList = ref<CarInfoVO[]>([])
 
 const queryFormRef = ref<ElFormInstance>();
 const carScheduleFormRef = ref<ElFormInstance>();
@@ -171,6 +177,11 @@ const addSchedule = () => {
   dialog.visible = true
 }
 
+const getcarInfoList = async () => {
+  const carList = await listCarInfo(queryParams.value);
+  carInfoList.value = carList.rows
+}
+
 const getUserList = async () => {
   loading.value = true;
   const res = await allocatedUserList({ pageSize: 1000, roleId: '1763484881548447746' });
@@ -190,6 +201,8 @@ const getattend = (value) => {
   }
 }
 
+
+
 const getDriverTable = (value) => {
   for (var index in sjList.value) {
     if (sjList.value[index].userId == value) {
@@ -199,7 +212,6 @@ const getDriverTable = (value) => {
 }
 
 const childrenClick = (data) => {
-  eval(data.func + "(data.data)")
   if (data.func == 'handleUpdate') {
     handleUpdate(data.data)
   } else if (data.func == 'handleDelete') {
@@ -213,8 +225,14 @@ const childFormat = ({ data, fn }) => {
     if (ext != null) {
       var obj = JSON.parse(ext);
       var value = obj[data.pprop]
-      var data = eval(data.func + "(value)")
-      fn(data)
+      // var data = eval(data.func + "(value)")
+      var res = ''
+      if (data.func == "getattend") {
+        res = getattend(value)
+      } else if (data.func == "getDriverTable") {
+        res = getDriverTable(value)
+      }
+      fn(res)
     }
   } else {
     var value = data.data[data.prop]
@@ -238,6 +256,7 @@ 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
     }
@@ -296,6 +315,7 @@ 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
   formParams.value.driverInfo = data.driverInfo
   formParams.value.attendantInfo = data.attendantInfo
   line.value = data.lineID
@@ -327,7 +347,7 @@ const handleDelete = async (row?: CarScheduleVO) => {
   await proxy?.$modal.confirm('是否确认删除车及人员排班编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
   await delCarSchedule(_ids);
   proxy?.$modal.msgSuccess("删除成功");
-  await getList();
+  await initList(selectDate.value);
 }
 
 /** 导出按钮操作 */
@@ -343,13 +363,17 @@ const submitSchedule = async () => {
   if (carPathObj.value != null) {
     var stationList = JSON.parse(carPathObj.value.stationList)
     console.log(stationList);
-    form.value.carNum = JSON.parse(carPathObj.value.ext1).carNum
     for (var index in stationList) {
       var obj = {};
       obj.order = Number(index) + 1
       obj.location = stationList[index].data.dictValue
-      obj.planInTime = stationList[index].timeObj.startTime + ":00"
-      obj.planOutTime = stationList[index].timeObj.endTime + ":00"
+      if (stationList[index].timeObj) {
+        obj.planInTime = stationList[index].timeObj.startTime + ":00"
+        obj.planOutTime = stationList[index].timeObj.endTime + ":00"
+      }else{
+        obj.planInTime = ''
+        obj.planOutTime = ''
+      }
       obj.stationName = stationList[index].data.dictLabel
       dataList.push(obj)
       if (index == 0) {
@@ -370,16 +394,20 @@ const submitSchedule = async () => {
   }
   proxy?.$modal.msgSuccess("修改成功");
   dialog.visible = false;
-  await getList();
+  initList(selectDate.value);
 }
 
 const initData = async () => {
-  getUserList();
+  await getUserList();
+  await getcarInfoList();
   const res = await listCarPath({ pageSize: 1000 });
   carPathList.value = res.rows
-  initList();
+  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');

+ 127 - 58
src/views/yunying/scheduling/index.vue

@@ -35,49 +35,63 @@
                 </div>
             </div>
         </transition>
-        <el-card shadow="never">
-            <div class="carDiv">
-                <div
-                    style="width: 18%;background: #7BC932;text-align: center;display: flex;flex-direction: column;justify-content: center;align-items:center;">
-                    <div class="carDetail">苏A xxxxx</div>
-                    <div class="carFont">07:00-10:00</div>
-                    <div class="carFont">白下/新港</div>
-                    <div class="carFont">张三</div>
-                    <div class="carFont">小型电动吊桶车</div>
-                </div>
-                <div style="width: 80%;">
-                    <timeLineDiv></timeLineDiv>
-                </div>
-                <div style="padding-top:1%">
-                    <div style="width: 30px;height: 30px;border: 1px solid #000000;border-radius: 20%;" @click="dialogMap.visible = true">
-                        <img style="width: 28px;height: 28px;" src='@/assets/images/icon/map.png' />
+        <div v-for="(item, index) in carScheduleList">
+            <el-card shadow="never">
+                <div class="carDiv">
+                    <div
+                        style="width: 18%;background: #7BC932;text-align: center;display: flex;flex-direction: column;justify-content: center;align-items:center;">
+                        <div class="carDetail">{{ item.carNum }}</div>
+                        <div class="carFont">{{ getTimeFormat(item.pathInfo) }}</div>
+                        <div class="carFont">{{ getAddr(item.pathInfo) }}</div>
+                        <!-- <div class="carFont">{{ JSON.parse(item.pathInfo).driver_info.nickName }}</div> -->
+                        <div class="carFont">{{ getUserName(JSON.parse(item.pathInfo).driverInfo) }}</div>
+                        <div class="carFont">{{ getCatInfo(item.carNum) }}</div>
+                    </div>
+                    <div style="width: 80%;">
+                        <el-scrollbar ref="scrollbarRef" height="400px" always @scroll="scroll">
+                            <timeLineDiv :list="JSON.parse(item.pathInfo).pathLine" :stationInfo="JSON.parse(item.stationInfo)"></timeLineDiv>
+                        </el-scrollbar>
                     </div>
-                    <div style="width: 30px;height: 30px;border: 1px solid #000000;border-radius: 20%;margin-top: 5px"  @click="dialog.visible = true">
-                        <img style="width: 28px;height: 28px;" src='@/assets/images/icon/video.png' />
+                    <div style="padding-top:1%">
+                        <div style="width: 30px;height: 30px;border: 1px solid #000000;border-radius: 20%;"
+                            @click="dialogMap.visible = true">
+                            <img style="width: 28px;height: 28px;" src='@/assets/images/icon/map.png' />
+                        </div>
+                        <div style="width: 30px;height: 30px;border: 1px solid #000000;border-radius: 20%;margin-top: 5px"
+                            @click="dialog.visible = true">
+                            <img style="width: 28px;height: 28px;" src='@/assets/images/icon/video.png' />
+                        </div>
                     </div>
                 </div>
-            </div>
-        </el-card>
+            </el-card>
+        </div>
 
         <el-dialog :title="dialogMap.title" v-model="dialogMap.visible" width="40vw" append-to-body>
-            <mapDiv style="width:40vw;height:40vh;" @childToParent='childrenClick'></mapDiv>
+            <mapDiv style="width:40vw;height:40vh;"></mapDiv>
         </el-dialog>
 
         <el-dialog :title="dialog.title" v-model="dialog.visible" width="40vw" append-to-body>
             <video v-for="item in 1" style="width: 99%;margin-left:0.5%" controls="controls" :autoplay="false"
-              muted="muted" :ref="`videoref${item}`"></video>
+                muted="muted" :ref="`videoref${item}`"></video>
         </el-dialog>
     </div>
 </template>
 
 <script setup name="CarInfo" lang="ts">
+import api from "@/api/system/user"
+import { UserForm, UserQuery, UserVO } from '@/api/system/user/types';
 import { listCarInfo, getCarInfo, delCarInfo, addCarInfo, updateCarInfo } from '@/api/carInfo';
 import { CarInfoVO, CarInfoQuery, CarInfoForm } from '@/api/carInfo/types';
 import tableElm from "@/components/Public/table.vue";
 import { useRoute, useRouter } from "vue-router";
 import timeLineDiv from "@/components/Public/timeline";
+import { getDicts } from '@/api/system/dict/data'
 import useTagsViewStore from '@/store/modules/tagsView';
 import mapDiv from "@/components/Map/index.vue"
+import { listCarSchedule, getCarSchedule, delCarSchedule, addCarSchedule, updateCarSchedule } from '@/api/carSchedule';
+import { CarScheduleVO, CarScheduleQuery, CarScheduleForm } from '@/api/carSchedule/types';
+import moment from 'moment';
+
 
 import videojs from "video.js"
 import "video.js/dist/video-js.css"
@@ -98,6 +112,7 @@ const single = ref(true);
 const multiple = ref(true);
 const total = ref(0);
 const value2 = ref('')
+const carScheduleList = ref<CarScheduleVO[]>([]);
 
 const queryFormRef = ref<ElFormInstance>();
 const carInfoFormRef = ref<ElFormInstance>();
@@ -206,49 +221,56 @@ const data = reactive<PageData<CarInfoForm, CarInfoQuery>>({
 
 const { queryParams, form, rules } = toRefs(data);
 
+const carTypeList = ref([]);
+const energyTypeList = ref([])
+const bussinessTypeList = ref([])
+
+const userList = ref<UserVO[]>();
+
 const goadd = () => {
     useTagsViewStore().delView(route);
     router.push("/car/work/addWork")
 }
 
-/** 查询车辆信息列表 */
-const getList = async () => {
-    // loading.value = true;
-    // const res = await listCarInfo(queryParams.value);
-    var res = {
-        rows: [
-            {
-                carNum: '张林',
-                workTime: "320902198711957841",
-                workName: "13898219932",
-                type: "xxxxx",
-                wangge: "苏A51972",
-                gpeople: "仙林",
-                people: "司机"
+const getScheduleList = async () => {
+    var date = new Date();
+    var param = {
+        params: {
+            scheduleDate: moment(date).format('YYYY-MM-DD')
+        },
+        pageSize: "1000"
+    }
+    const res = await listCarSchedule(param);
+    carScheduleList.value = res.rows;
+    console.log(carScheduleList.value)
+}
 
-            }
-        ],
-        total: 12
+const getTimeFormat = (data) => {
+    var value = JSON.parse(data).pathLine
+    console.log(value)
+    if (value[0].planInTime && value[value.length - 1].planOutTime) {
+        return value[0].planInTime + '-' + value[value.length - 1].planOutTime
+    } else {
+        return "请填写路线时间"
     }
-    table.value.setDataList(res.rows);
-    total.value = res.total;
-    loading.value = false;
 }
 
-const activities = [
-    {
-        content: 'Event start',
-        timestamp: '2018-04-15',
-    },
-    {
-        content: 'Approved',
-        timestamp: '2018-04-13',
-    },
-    {
-        content: 'Success',
-        timestamp: '2018-04-11',
-    },
-]
+const getAddr = (data) => {
+    var value = JSON.parse(data).pathLine
+    return value[0].stationName + '-' + value[value.length - 1].stationName
+}
+
+const getList = async () => {
+    const res = await listCarInfo({ pageSize: 1000 });
+    carInfoList.value = res.rows
+    //   console.log(res);
+}
+
+const getDictsData = (param, obj) => {
+    getDicts(param).then(res => {
+        obj.value = res.data;
+    })
+}
 
 /** 取消按钮 */
 const cancel = () => {
@@ -256,6 +278,22 @@ const cancel = () => {
     dialog.visible = false;
 }
 
+const getUserList = () => {
+    api.listUser({ pageSize: 1000 }).then(res => {
+        console.log(res.rows)
+        userList.value = res.rows;
+        console.log(userList.value)
+    });
+}
+
+const getUserName = (value) => {
+    for (var index in userList.value) {
+        if (value == userList.value[index].userId) {
+            return userList.value[index].nickName
+        }
+    }
+}
+
 /** 表单重置 */
 const reset = () => {
     form.value = { ...initFormData };
@@ -331,8 +369,39 @@ const handleExport = () => {
     }, `carInfo_${new Date().getTime()}.xlsx`)
 }
 
+const initData = async () => {
+    await getDictsData('tbl_car_type', carTypeList);
+    await getDictsData('energy_type', energyTypeList);
+    await getDictsData('business_type', bussinessTypeList);
+    await getList();
+    await getUserList();
+    getScheduleList();
+}
+
+const getDictLabel = (value, list) => {
+    for (var index in list.value) {
+        // console.log(list[index])
+        if (list.value[index].dictValue == value) {
+            return list.value[index].dictLabel
+        }
+    }
+}
+
+const getCatInfo = (value) => {
+    console.log(value)
+    console.log(carInfoList.value);
+    for (var index in carInfoList.value) {
+        console.log(carInfoList.value[index].carNum)
+        if (carInfoList.value[index].carNum == value) {
+            console.log(carInfoList.value[index]);
+            var data = JSON.parse(carInfoList.value[index].ext1)
+            return getDictLabel(data.energyType, energyTypeList).replaceAll("车", "") + getDictLabel(data.bussinessType, bussinessTypeList)
+        }
+    }
+}
+
 onMounted(() => {
-    getList();
+    initData();
 });
 </script>
 
@@ -342,7 +411,7 @@ onMounted(() => {
     opacity: 1;
     box-sizing: border-box;
     border: 1px solid #7BC932;
-    height: 20vh;
+    height: 25vh;
     display: flex;
     flex-direction: row;
 }

+ 0 - 1
src/views/yunying/video/index.vue

@@ -145,7 +145,6 @@ const { queryParams, form, rules } = toRefs(data);
 
 /** 查询车辆信息列表 */
 const getList = async () => {
-  loading.value = true;
   const res = await listCarInfo({ pageSize:1000 });
   for(var index in res.rows){
       data[0].children.push(res.rows[index]);