|
|
@@ -7,43 +7,56 @@
|
|
|
<div class="warning-container">
|
|
|
<BaseMain title="预警列表">
|
|
|
<template v-slot:mainArea>
|
|
|
- <div class="list-container">
|
|
|
- <el-input placeholder="请输入关键字" suffix-icon="el-icon-search" v-model="searchVal"> </el-input>
|
|
|
- <el-collapse v-model="activeNames" class="v-collapse">
|
|
|
- <template v-for="(item, index) in listItem">
|
|
|
- <el-collapse-item :title="item.name" :name="index + 1" :key="index">
|
|
|
- <template slot="title">
|
|
|
- <div class="title-num">
|
|
|
- <div class="left">{{ item.name }}</div>
|
|
|
- <div class="right">{{ item.lists.length }}个</div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <div class="list-content">
|
|
|
- <div class="item" :class="{active:activeIndex == index+i}" v-for="(item, i) in item.lists" :key="i" @click="toLoadDetail(item,index,i)">
|
|
|
- <div class="left">
|
|
|
- <img :src="item.imgUrl" alt="" />
|
|
|
+ <template v-if="lists.length > 0">
|
|
|
+ <div class="list-container">
|
|
|
+ <el-input placeholder="请输入关键字" suffix-icon="el-icon-search" v-model="searchVal"> </el-input>
|
|
|
+ <el-collapse v-model="activeNames" class="v-collapse">
|
|
|
+ <template v-for="(item, index) in lists">
|
|
|
+ <el-collapse-item :title="item.name" :name="index + 1" :key="index">
|
|
|
+ <template slot="title">
|
|
|
+ <div class="title-num">
|
|
|
+ <div class="left">{{ item.name }}</div>
|
|
|
+ <div class="right">{{ item.listItem.length }}个</div>
|
|
|
</div>
|
|
|
- <div class="right">
|
|
|
- <div class="title">{{ item.alarmBody }}</div>
|
|
|
- <div class="txt">{{ item.address }}</div>
|
|
|
- <div class="txt">{{ item.alarmTime }}</div>
|
|
|
- <div class="jzDate">{{ item.duration }}</div>
|
|
|
+ </template>
|
|
|
+ <div class="list-content">
|
|
|
+ <div class="item" :class="{ active: activeIndex == index + i }" v-for="(item, i) in item.listItem" :key="i" @click="toLoadDetail(item, index, i)">
|
|
|
+ <div class="left">
|
|
|
+ <template v-if="item.img.length == 0">
|
|
|
+ <img :src="defaultImg" alt=""/>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <img :src="item.img[0]" alt="" />
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ <div class="right">
|
|
|
+ <div class="title">{{ item.alarmBody }}</div>
|
|
|
+ <div class="txt">{{ item.address }}</div>
|
|
|
+ <div class="txt">{{ item.alarmTime }}</div>
|
|
|
+ <!-- <div class="jzDate">{{ item.duration }}</div> -->
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </el-collapse-item>
|
|
|
- </template>
|
|
|
- </el-collapse>
|
|
|
- <el-pagination
|
|
|
- @size-change="handleSizeChange"
|
|
|
- @current-change="handleCurrentChange"
|
|
|
- :current-page.sync="currentPage"
|
|
|
- :page-size="pageSize"
|
|
|
- layout="total, prev, pager, next"
|
|
|
- :total="total"
|
|
|
- >
|
|
|
- </el-pagination>
|
|
|
- </div>
|
|
|
+ </el-collapse-item>
|
|
|
+ </template>
|
|
|
+ </el-collapse>
|
|
|
+ <!-- <el-pagination
|
|
|
+ @size-change="handleSizeChange"
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ :current-page.sync="currentPage"
|
|
|
+ :page-size="pageSize"
|
|
|
+ layout="total, prev, pager, next"
|
|
|
+ :total="total"
|
|
|
+ >
|
|
|
+ </el-pagination> -->
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <div class="noData">
|
|
|
+ <img src="@/assets/image/comprehensive/noData.png" alt="" />
|
|
|
+ <div class="txt">暂无预警</div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</template>
|
|
|
</BaseMain>
|
|
|
</div>
|
|
|
@@ -56,15 +69,16 @@ import BaseMain from '@/components/base-main/base-main.vue'
|
|
|
import ImgUrl from '@/assets/image/smart-early-warning/img1.png'
|
|
|
import moment from 'moment'
|
|
|
export default {
|
|
|
- data() {
|
|
|
+ data() {
|
|
|
return {
|
|
|
- activeIndex:null,
|
|
|
+ activeIndex: null,
|
|
|
searchVal: '',
|
|
|
currentPage: 1,
|
|
|
pageSize: 6,
|
|
|
total: 0,
|
|
|
activeNames: [1, 2, 3, 4],
|
|
|
- listItem: []
|
|
|
+ lists: [],
|
|
|
+ defaultImg:ImgUrl
|
|
|
}
|
|
|
},
|
|
|
components: {
|
|
|
@@ -72,32 +86,39 @@ export default {
|
|
|
BaseMain
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.total = this.listItem.length
|
|
|
this.getData()
|
|
|
},
|
|
|
methods: {
|
|
|
getData() {
|
|
|
- window
|
|
|
+ window
|
|
|
.requestSDK(
|
|
|
'/event/getEventListByType',
|
|
|
{
|
|
|
- alarmTimeStart: moment().startOf('day').format('YYYY-MM-DD HH:mm:ss'),
|
|
|
- alarmTimeEnd: moment().endOf('day').format('YYYY-MM-DD HH:mm:ss'),
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
- pageCount: 5,
|
|
|
- searchType: '0'
|
|
|
+ alarmTimeStart:moment().startOf('day').format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+ alarmTimeEnd: moment().endOf('day').format('YYYY-MM-DD HH:mm:ss')
|
|
|
},
|
|
|
{},
|
|
|
'post'
|
|
|
)
|
|
|
.then(async (res) => {
|
|
|
- this.listItem = res.data
|
|
|
+ if(res.data.length > 0){
|
|
|
+ res.data.forEach(category => {
|
|
|
+ category.listItem.forEach(item => {
|
|
|
+ if (item.img) {
|
|
|
+ item.img = item.img.split(',');
|
|
|
+ } else {
|
|
|
+ item.img = [];//设置默认图片
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ this.lists = res.data
|
|
|
+ this.total = this.lists.length
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
- toLoadDetail(data,index,i){
|
|
|
- this.activeIndex = index+i;
|
|
|
- this.$emit('toLoadDetail',data)
|
|
|
+ toLoadDetail(data, index, i) {
|
|
|
+ this.activeIndex = index + i
|
|
|
+ this.$emit('toLoadDetail', data)
|
|
|
},
|
|
|
handleSizeChange() {},
|
|
|
handleCurrentChange() {}
|
|
|
@@ -185,9 +206,9 @@ export default {
|
|
|
display: flex;
|
|
|
justify-content: flex-start;
|
|
|
gap: px-to-rem(10);
|
|
|
- background: rgba(60,90,135,0.2);
|
|
|
+ background: rgba(60, 90, 135, 0.2);
|
|
|
border-radius: px-to-rem(4);
|
|
|
- border: px-to-rem(1) solid #2D4057;
|
|
|
+ border: px-to-rem(1) solid #2d4057;
|
|
|
padding: px-to-rem(7);
|
|
|
.left {
|
|
|
img {
|
|
|
@@ -217,9 +238,9 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- .item.active{
|
|
|
+ .item.active {
|
|
|
border: px-to-rem(1) solid #4f9fff;
|
|
|
- background: rgba(79,159,255,0.2);
|
|
|
+ background: rgba(79, 159, 255, 0.2);
|
|
|
}
|
|
|
}
|
|
|
:deep(.el-pagination) {
|
|
|
@@ -252,4 +273,17 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+.noData {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ text-align: center;
|
|
|
+ img {
|
|
|
+ margin-top: px-to-rem(70);
|
|
|
+ margin-bottom: px-to-rem(20);
|
|
|
+ }
|
|
|
+ .txt {
|
|
|
+ color: #fff;
|
|
|
+ font-size: px-to-rem(14);
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|