forked from drone/command-center-dashboard

chenyao
2025-04-12 df4e3452ecdc510faa09c7310ba4857ed432553d
src/views/Home/EventOverviewDetail/EventOverviewDetailRight.vue
@@ -1,10 +1,12 @@
<template>
   <UserOperate/>
   <div class="event-overviewdetail-right">
      <div>工单列表</div>
      <div>
   <div class="event-overviewdetail-right" :class="{ isMore }">
      <CommonTitle title="工单列表" />
      <div class="content">
         <img class="leftArrow" :src="isMore ? rightArrowImg : leftArrowImg" @click="leftArrowFun" alt="" />
         <el-date-picker
            style="width: 100%"
            class="ztzf-date-picker"
            v-model="timeArr"
            type="daterange"
            :value-format="timeFormat"
@@ -13,64 +15,110 @@
            end-placeholder="结束日期"
            @change="timeChange"
         />
      </div>
      <el-select style="width: 100%" v-model="params.device_sn" placeholder="机巢" filterable clearable @change="getList">
         <el-option v-for="item in deviceList" :label="item.nickname" :value="item.device_sn" :key="item.device_sn" />
      </el-select>
      <el-select v-model="params.word_order_type" placeholder="工单类型" filterable clearable @change="getList">
         <el-option v-for="item in workOrderType" :label="item.dictValue" :value="item.dictKey" :key="item.dictKey" />
      </el-select>
      <div class="statusList">
         <div v-for="item in statusList" @click="statusClick(item)" :class="{ active: item.active }">
            <div>{{ item.name }}</div>
            <div>{{ item.num || 0 }}</div>
         </div>
      </div>
         <el-select
            class="ztzf-select"
            :style="{ width: pxToRem(174) }"
            v-model="params.device_sn"
            placeholder="机巢"
            filterable
            clearable
            @change="getList"
         >
            <el-option v-for="item in deviceList" :label="item.nickname" :value="item.device_sn" :key="item.device_sn" />
         </el-select>
      <el-checkbox-group v-model="params.eventKeys" @change="getList">
         <el-checkbox
            v-for="item in eventList"
            :label="item.name + ' ' + item.value"
            :value="item.status"
            :key="item.dictKey"
         />
      </el-checkbox-group>
         <el-select
            class="ztzf-select"
            :style="{ width: pxToRem(174) }"
            v-model="params.word_order_type"
            placeholder="工单类型"
            filterable
            clearable
            @change="getList"
         >
            <el-option v-for="item in workOrderType" :label="item.dictValue" :value="item.dictKey" :key="item.dictKey" />
         </el-select>
      <div class="eventList">
         <div class="eventListItem" v-for="item in list">
            <img class="eventListItemImg"
         :src="item.photo_url ?
        item.photo_url.substring(0, item.photo_url.lastIndexOf('.')) + '_small' +
        item.photo_url.substring(item.photo_url.lastIndexOf('.'))
        : ''"
      alt=""
    />
            <div class="eventListItemText">
               <div class="eventListItemName">{{ item.event_name }}</div>
               <div @click="positioning(item)">定位</div>
               <div class="eventListItemTime">{{ item.create_time }}</div>
         <div class="statusList">
            <div
               class="statusItem"
               v-for="item in isMore ? statusList : statusList.filter(i => i.few)"
               @click="statusClick(item)"
               :class="{ active: item.active }"
            >
               <img class="statusItemImg" :src="item.img" alt="" />
               <div class="statusItemInfo">
                  <div class="statusItemName">{{ item.name }}</div>
                  <div class="statusItemNum">{{ item.num || 0 }}</div>
               </div>
            </div>
         </div>
      </div>
      <el-pagination
         background
         v-model:current-page="params.current"
         v-model:page-size="params.size"
         layout="total,  prev, pager, next"
         :total="total"
         @change="pageChange"
      />
         <el-checkbox-group v-model="params.event_keys" @change="getList">
            <el-checkbox v-for="item in eventList" :value="item.status" :key="item.dictKey">
               <template #default>
                  <span class="eventListItemCheckboxName">{{ item.name }}</span>
                  <span class="eventListItemCheckboxNum">({{ item.value }})</span>
               </template>
            </el-checkbox>
         </el-checkbox-group>
         <div class="eventList">
            <div class="eventListItem" v-for="item in list">
               <img
                  class="eventListItemImg"
                  :src="
                     item.photo_url
                        ? item.photo_url.substring(0, item.photo_url.lastIndexOf('.')) +
                          '_small' +
                          item.photo_url.substring(item.photo_url.lastIndexOf('.'))
                        : ''
                  "
                  alt=""
               />
               <div class="eventListItemPosition" :title="item.address" @click="positioning(item)">
                  <img :src="positioningImg" alt="" title="点击定位" />
                  <div class="address">{{ item.address }}</div>
               </div>
               <div class="eventListItemText">
                  <div class="eventListItemName">{{ item.event_name }}</div>
                  <div class="eventListItemTime">{{ item.create_time }}</div>
               </div>
            </div>
         </div>
         <div class="pagination">
            <el-pagination
               background
               v-model:current-page="params.current"
               v-model:page-size="params.size"
               layout="total,  prev, pager, next"
               :total="total"
               @change="pageChange"
            />
         </div>
      </div>
   </div>
</template>
<script setup>
import UserOperate from '@/components/UserOperate.vue';
import status0Img from '@/assets/images/home/eventOverviewDetail/status0.png'
import status1Img from '@/assets/images/home/eventOverviewDetail/status1.png'
import status2Img from '@/assets/images/home/eventOverviewDetail/status2.png'
import status3Img from '@/assets/images/home/eventOverviewDetail/status3.png'
import status4Img from '@/assets/images/home/eventOverviewDetail/status4.png'
import status5Img from '@/assets/images/home/eventOverviewDetail/status5.png'
import positioningImg from '@/assets/images/home/eventOverviewDetail/positioning.png'
import leftArrowImg from '@/assets/images/home/eventOverviewDetail/leftArrow.png'
import rightArrowImg from '@/assets/images/home/eventOverviewDetail/rightArrow.png'
import dayjs from 'dayjs'
import { selectDevicePage } from '@/api/home/machineNest'
import { getMultipleDictionary } from '@/api/system/dictbiz'
import { getEvenNum, getEventPage, getEventStatusNum, getEventTrend } from '@/api/home/event'
import { getEvenNum, getEventPage, getEventStatusNum } from '@/api/home/event'
import cesiumOperation from '@/utils/cesium-tsa'
import CommonTitle from '@/components/CommonTitle.vue'
import { pxToRem } from '@/utils/rem'
const timeFormat = 'YYYY-MM-DD HH:mm:ss'
const today = dayjs().format(timeFormat)
@@ -85,10 +133,18 @@
   device_sn: undefined,
   word_order_type: undefined,
   status: undefined,
   eventKeys: [],
   event_keys: [],
   current: 1,
   size: 10,
   size: 8,
})
const isMore = ref(false)
const leftArrowFun = () => {
   isMore.value = !isMore.value
   params.value.size = isMore.value ? 16 : 8
   params.value.current = 1
   getList()
}
const statusClick = row => {
   params.value.status = row.id || undefined
@@ -111,20 +167,36 @@
      workOrderType.value = res.data.data?.['WORK_ORDER_TYPE'] || []
   })
}
const { flyTo } = cesiumOperation();
const positioning = (row) =>{
const { flyTo } = cesiumOperation()
const positioning = row => {
   const longitude = Number(row.longitude)
   const latitude = Number(row.latitude)
   flyTo({ longitude, latitude }, 1, 1000);
   flyTo({ longitude, latitude }, 1, 1000)
}
// 事件状态+数量
const statusList = ref([])
const statusList = ref([
   { name: '全部状态', img: status0Img, id: undefined,few: true },
   { name: '待审核', img: status1Img, id: 2 },
   { name: '待处理', img: status2Img, id: 0, few: true },
   { name: '处理中', img: status3Img, id: 3, few: true },
   { name: '已完成', img: status4Img, id: 4, few: true },
   { name: '待分拨', img: status5Img, id: 1 },
])
const getEventStatusNumFun = () => {
   const [start_date, end_date] = timeArr.value
   getEventStatusNum({ start_date, end_date }).then(res => {
      statusList.value = (res.data?.data || []).map(i => ({ ...i, active: false }))
      const list = res.data?.data || []
      statusList.value = statusList.value.map(item => {
         const find = list.find(item1 => item.id === item1.id) || {}
         return {
            ...item,
            ...find,
         }
      })
      statusList.value[0].active = true
      console.log(statusList.value)
   })
}
@@ -145,7 +217,7 @@
   getEventStatusNumFun()
   getEventList()
   params.value.status = undefined
   params.value.eventKeys = undefined
   params.value.event_keys = undefined
   getList()
}
@@ -156,7 +228,11 @@
const list = ref([])
const getList = () => {
   getEventPage(params.value).then(res => {
   const pageParams = {
      current: params.value.current,
      size: params.value.size,
   }
   getEventPage(params.value, pageParams).then(res => {
      const resData = res.data.data
      list.value = resData?.records || []
      total.value = resData.total
@@ -174,42 +250,213 @@
<style scoped lang="scss">
.event-overviewdetail-right {
   position: absolute;
   right: 29px;
   right: 36px;
   top: 122px;
   // color: black;
   display: flex;
   flex-direction: column;
   align-items: center;
   height: 900px;
   width: 400px;
   background: white;
   align-items: end;
   height: 922px;
   width: 405px;
   font-size: 18px;
   .statusList {
      display: flex;
      flex-wrap: wrap;
   &.isMore {
      width: 807px;
      .active {
         background: #19ad8d;
      .content {
         width: 792px;
      }
   }
   .eventList {
   .content {
      width: 390px;
      height: 877px;
      background: linear-gradient(270deg, #1f3e7a 0%, rgba(31, 62, 122, 0.35) 79%, rgba(31, 62, 122, 0) 100%);
      display: flex;
      justify-content: space-between;
      align-content: start;
      flex-wrap: wrap;
      padding: 7px 15px 0 11px;
      gap: 10px;
      .eventListItem {
         .eventListItemImg {
            width: 120px;
            height: 100px;
         }
      .leftArrow {
         position: absolute;
         left: 0;
         top: 50%;
         transform: translateY(-50%);
         cursor: pointer;
      }
         .eventListItemText {
      .statusList {
         width: 100%;
         display: flex;
         .statusItem {
            width: 95px;
            height: 44px;
            display: flex;
            justify-content: space-between;
            font-size: 16px;
            flex: 1;
            justify-content: center;
            position: relative;
            cursor: pointer;
            &.active {
               background: linear-gradient(
                  180deg,
                  rgba(19, 80, 141, 0) 0%,
                  rgba(22, 56, 91, 0.48) 48%,
                  #053462 91%,
                  #259dff 91%,
                  #259dff 98%
               );
            }
            .statusItemImg {
               width: 35px;
               height: 35px;
            }
            .statusItemInfo {
               .statusItemName {
                  width: 59px;
                  height: 17px;
                  font-family: Segoe UI, Segoe UI;
                  font-weight: 400;
                  font-size: 14px;
                  color: #ffffff;
                  line-height: 17px;
                  text-align: left;
                  font-style: normal;
                  text-transform: none;
               }
               .statusItemNum {
                  width: 32px;
                  height: 16px;
                  font-family: Segoe UI, Segoe UI;
                  font-weight: bold;
                  font-size: 16px;
                  color: #ffd509;
                  line-height: 16px;
                  text-align: left;
                  font-style: normal;
                  text-transform: none;
               }
            }
         }
      }
      .el-checkbox-group {
         :deep() {
            .el-checkbox {
               height: 20px;
               margin-right: 10px;
            }
            .el-checkbox__inner {
               background: transparent;
               width: 18px;
               height: 18px;
               border: 1px solid #3194ef;
            }
            .el-checkbox__label {
               font-family: Segoe UI, Segoe UI;
               font-weight: 400;
               font-size: 14px;
               color: #ffffff;
               line-height: 17px;
               .eventListItemCheckboxNum {
                  color: #ffa500;
               }
            }
         }
      }
      .eventList {
         width: 100%;
         display: flex;
         flex-wrap: wrap;
         justify-content: space-between;
         gap: 20px 0;
         .eventListItem {
            width: 175px;
            height: 140px;
            position: relative;
            .eventListItemImg {
               width: 174px;
               height: 116px;
               border-radius: 4px 4px 4px 4px;
               margin-bottom: 7px;
            }
            .eventListItemPosition {
               position: absolute;
               right: 0;
               top: 116px;
               width: 174px;
               height: 20px;
               transform: translateY(-100%);
               background: rgba(22, 22, 22, 0.68);
               border-radius: 0 0 4px 4px;
               font-family: Segoe UI, Segoe UI;
               font-weight: 400;
               font-size: 12px;
               line-height: 17px;
               color: #51a8ff;
               cursor: pointer;
               padding-right: 5px;
               display: flex;
               justify-content: end;
               img {
                  margin-right: 5px;
               }
               .address {
                  display: inline-block;
                  width: 60px;
                  overflow: hidden;
                  white-space: nowrap;
                  text-overflow: ellipsis;
               }
            }
            .eventListItemText {
               display: flex;
               justify-content: space-between;
               font-family: Segoe UI, Segoe UI;
               font-weight: 400;
               font-size: 14px;
               color: #ffffff;
               line-height: 17px;
               .eventListItemTime {
                  font-family: Segoe UI, Segoe UI;
                  font-weight: 400;
                  font-size: 14px;
                  color: #96a3cc;
                  line-height: 17px;
               }
            }
         }
      }
   }
}
.pagination {
   width: 100%;
   display: flex;
   justify-content: center;
   .el-pagination {
      --el-color-primary: #173da7;
      --el-pagination-button-bg-color: #131c35;
      --el-pagination-button-color: #ecf1ff;
      --el-disabled-bg-color: #131c35;
      --el-text-color-regular: #ecf1ff;
   }
}
</style>