From a7e6761ba0cfccdf33ed552eb2d3b783c8e4ab4a Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Wed, 16 Apr 2025 20:49:12 +0800
Subject: [PATCH] feat:事件弹窗显示调整
---
src/views/Home/EventOverviewDetail/EventOverviewDetailRight.vue | 456 +++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 410 insertions(+), 46 deletions(-)
diff --git a/src/views/Home/EventOverviewDetail/EventOverviewDetailRight.vue b/src/views/Home/EventOverviewDetail/EventOverviewDetailRight.vue
index ec8beda..edfc854 100644
--- a/src/views/Home/EventOverviewDetail/EventOverviewDetailRight.vue
+++ b/src/views/Home/EventOverviewDetail/EventOverviewDetailRight.vue
@@ -1,114 +1,478 @@
<template>
- <div class="right">
- <div>工单列表</div>
+ <div class="event-overviewdetail-right" :class="{ isMore }">
+ <CommonTitle title="工单列表" />
- <div>
+ <div class="content">
+ <img class="leftArrow" :src="isMore ? rightArrowImg : leftArrowImg" @click="leftArrowFun" alt="" />
+
<el-date-picker
+ class="ztzf-date-picker"
v-model="timeArr"
type="daterange"
- value-format="YYYY-MM-DD"
+ :value-format="timeFormat"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
- @change="change"
- disabled
+ @change="timeChange"
/>
- <el-select v-model="params.device_sn" placeholder="请选择" size="large" filterable clearable>
- <el-option
- v-for="item in deviceList"
- :label="item.nickname"
- :value="item.device_sn"
- :key="item.device_sn"
- />
+
+ <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-select
+ class="ztzf-select"
+ :style="{ width: pxToRem(174) }"
v-model="params.word_order_type"
- placeholder="请选择"
- size="large"
+ placeholder="工单类型"
filterable
clearable
+ @change="getList"
>
- <el-option
- v-for="item in workOrderType"
- :label="item.dictValue"
- :value="item.dictKey"
- :key="item.dictKey"
- />
+ <el-option v-for="item in workOrderType" :label="item.dictValue" :value="item.dictKey" :key="item.dictKey" />
</el-select>
- <div>
- <div v-for="item in statusList">
- <div>{{ item.name }}</div>
- <div>{{ item.num || 0 }}</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>
- <el-checkbox-group v-model="params.SFType">
- <el-checkbox v-for="item in SFDictList" :label="item.dictValue":value="item.dictKey" :key="item.dictKey"/>
+ <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="getSmallImg(item.photo_url)"
+ 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
+ class="ztzf-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 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 { getEventStatusNum } 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'
+import { useStore } from 'vuex'
+const store = useStore()
+// const eventTimeRange = computed(() => store.state.home.eventTimeRange)
const timeFormat = 'YYYY-MM-DD HH:mm:ss'
const today = dayjs().format(timeFormat)
-const oneWeekAgo = dayjs().subtract(7, 'day').format(timeFormat)
-const timeArr = ref([oneWeekAgo, today])
+// const oneWeekAgo = dayjs().subtract(7, 'day').format(timeFormat)
+// const timeArr = ref([oneWeekAgo, today])
+const startOfWeek = dayjs().startOf('week').add(1, 'day').format(timeFormat)
+const endOfWeek = dayjs().endOf('week').add(1, 'day').format(timeFormat)
+const timeArr = ref([startOfWeek, endOfWeek])
const deviceList = ref([])
+const total = ref(0)
const params = ref({
- device_sn: '',
- word_order_type: '',
- SFType:[]
+ start_date: timeArr.value[0],
+ end_date: timeArr.value[1],
+ device_sn: undefined,
+ word_order_type: undefined,
+ status: undefined,
+ event_keys: [],
+ current: 1,
+ size: 8,
})
+
+const getSmallImg = (url) => {
+ return url ? url.substring(0, url.lastIndexOf('.')) + '_small' + url.substring(url.lastIndexOf('.')) : ''
+}
+
+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
+ statusList.value = statusList.value.map(item => ({
+ ...item,
+ active: item.name === row.name,
+ }))
+ getList()
+}
const getDeviceList = async () => {
const res = await selectDevicePage({ current: 1, size: 99999, type: 1 })
deviceList.value = res.data?.data?.records || []
}
+// 工单类型
const workOrderType = ref([])
-const SFDictList = ref([])
const getDictList = () => {
getMultipleDictionary('WORK_ORDER_TYPE,SF').then(res => {
workOrderType.value = res.data.data?.['WORK_ORDER_TYPE'] || []
- SFDictList.value = res.data.data?.['SF'] || []
})
}
+const { flyTo } = cesiumOperation()
+const positioning = row => {
+ const longitude = Number(row.longitude)
+ const latitude = Number(row.latitude)
+ 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 || []
+ 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
})
}
-const change = value => {}
+// 事件+数量
+const eventList = ref([])
+const getEventList = () => {
+ const [start_date, end_date] = timeArr.value
+ getEvenNum({ start_date, end_date }).then(res => {
+ eventList.value = res.data.data
+ })
+}
+
+const timeChange = value => {
+ const [start_date, end_date] = timeArr.value
+ params.value.start_date = start_date
+ params.value.end_date = end_date
+ // 提交数据,更新聚合
+ store.commit('setEventTimeRang', timeArr.value);
+ // 重置
+ getEventStatusNumFun()
+ getEventList()
+ params.value.status = undefined
+ params.value.event_keys = undefined
+ getList()
+}
+
+const pageChange = val => {
+ params.value.current = val
+ getList()
+}
+
+const list = ref([])
+const getList = () => {
+ 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
+ })
+}
+
+const getDateRange = unit => {
+ if (unit === 'today') {
+ return [dayjs().format('YYYY-MM-DD HH:mm:ss'), dayjs().format('YYYY-MM-DD HH:mm:ss')];
+ }
+ return [dayjs().startOf(unit).format('YYYY-MM-DD HH:mm:ss'), dayjs().endOf(unit).format('YYYY-MM-DD HH:mm:ss')];
+};
+
+// 监听事件时间范围变化
+watch(() => store.state.home.eventTimeType, (newVal) => {
+ timeArr.value = getDateRange(newVal);
+ const [start_date, end_date] = getDateRange(newVal);
+ params.value.start_date = start_date
+ params.value.end_date = end_date
+ getEventStatusNumFun()
+ getEventList()
+ getList()
+}, { immediate: false,deep: true })
onMounted(() => {
getDeviceList()
getDictList()
getEventStatusNumFun()
+ getEventList()
+ getList()
})
</script>
<style scoped lang="scss">
-.right {
+.event-overviewdetail-right {
position: absolute;
- right: 0;
- top: 88px;
- color: black;
+ right: 36px;
+ top: 122px;
display: flex;
flex-direction: column;
- align-items: center;
- height: 900px;
- width: 400px;
- background: white;
+ align-items: end;
+ height: 922px;
+ width: 405px;
+ font-size: 18px;
+
+ &.isMore {
+ width: 807px;
+
+ .content {
+ width: 792px;
+ }
+ }
+
+ .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;
+
+ .leftArrow {
+ position: absolute;
+ left: -11px;
+ top: 50%;
+ transform: translateY(-50%);
+ cursor: pointer;
+ }
+
+ .statusList {
+ width: 100%;
+ display: flex;
+
+ .statusItem {
+ width: 95px;
+ height: 44px;
+ display: flex;
+ 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;
}
</style>
--
Gitblit v1.9.3