123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411 |
- <!-- 安全检查-校院巡查管理 -->
- <template>
- <view id="earlyWarning">
- <view class="top-picker-max-box">
- <view class="top-picker-box">
- <picker @change="facultyChange" :value="facultyIndex" :range="facultyArray">
- <view class="picker-view">
- <view class="picker-view-l">{{!facultyIndex?'学院':facultyArray[facultyIndex]}}</view>
- <img class="picker-img" src="@/pages_manage/images/icon_06.png" alt="">
- </view>
- </picker>
- </view>
- <view class="top-picker-box">
- <picker mode="date" @change="startChange($event)">
- <view class="picker-view">
- <view class="picker-view-l">{{!getData.startTime?'开始时间':getData.startTime}}</view>
- <img class="picker-img" src="@/pages_manage/images/icon_06.png" alt="">
- </view>
- </picker>
- </view>
- <view class="top-picker-box">
- <picker mode="date" @change="endChange($event)">
- <view class="picker-view">
- <view class="picker-view-l">{{!getData.endTime?'结束时间':getData.endTime}}</view>
- <img class="picker-img" src="@/pages_manage/images/icon_06.png" alt="">
- </view>
- </picker>
- </view>
- </view>
- <scroll-view scroll-y @scrolltolower="scrollGet" class="info-max-box">
- <viw class="list" v-for="(item,index) in dataList" :key="index">
- <view class="list_t">{{item[0].createDate}}</view>
- <view class="list_li" v-for="(item2,index2) in item" :key="index2" @click="handleClick(item2,'detail')">
- <view class="list_li_t">
- <view class="list_li_t_l"></view>
- <view class="list_li_t_c orange_color" v-if="item2.warningType==1">算法识别</view>
- <view class="list_li_t_c yellow_color" v-if="item2.warningType==2">化学品</view>
- <view class="list_li_t_c yellow_color" v-if="item2.warningType==3">气瓶</view>
- <view class="list_li_t_c red_color" v-if="item2.warningType==4">预案</view>
- <view class="list_li_t_c2">{{item2.warningContent}}</view>
- <view class="list_li_t_r"></view>
- </view>
- <view class="list_li_b">
- <view class="list_li_b_t">
- <text>{{item2.subName}}</text>
- <text>{{item2.warningTime.split(' ')[1]}}</text>
- </view>
- <view class="list_li_b_b">
- <img src="@/images/Version2.2/icon_wtzg_xx.png"/>
- <text>{{item2.buildName}}-{{item2.floorName}}{{item2.roomNum}}</text>
- </view>
- </view>
- </view>
- </viw>
- <img class="null-img" v-if="!dataList[0]" src="@/images/null-data-1.png">
- </scroll-view>
- </view>
- </template>
- <script>
- import { config } from '@/api/request/config.js'
- import {checkManageList,conditionCollegeInfo,warningNoticeLogList,listDepartments} from '@/api/index.js'
- export default {
- name: "earlyWarning",
- components: {
-
- },
- data() {
- return {
- //列表请求参数
- getData:{
- pageNum:1,
- pageSize:10,
- startTime:'',
- endTime:'',
- searchValue:'',
- },
- dataList:[],
- dataArr:[],//临时存储
- total:0,
- timeStatus:false,//判断是否超过当前时间30分钟
- //院系选择器数据
- facultyList:[],
- facultyArray:[],
- facultyIndex:"",
-
- }
- },
- onLoad(option) {
-
- },
- onShow() {
-
- },
- mounted(){
- this.listDepartments();
- this.getList();
- },
- methods: {
-
- //滚动事件
- scrollGet(){
- let self=this;
- if(self.total/self.getData.pageSize<=self.getData.pageNum){
- console.log('没有更多数据!')
- }else{
- setTimeout(function(){
- self.getData.pageNum += 1;
- self.getList();
- },1000)
-
- }
-
- },
- //获取院系
- async listDepartments(){
- const {data} = await listDepartments();
- if(data.code == 200){
- let list = [];
- for(let i=0;i<data.data.length;i++){
- list.push(data.data[i].deptName)
- }
- this.facultyArray = list;
- list.unshift('全部院系');
- this.facultyList = data.data;
- this.facultyList.unshift({deptName:"全部院系", deptId:""})
- }
- },
- //学院选中
- facultyChange: function(e) {
- if(this.facultyArray[0]){
- this.facultyIndex = parseInt(e.target.value);
- }
- },
- //开始时间选中事件
- startChange(e){
- if(new Date(e.target.value).getTime()>=new Date(this.getData.endTime).getTime()){
- uni.showToast({
- title: '结束时间不能小于开始时间',
- icon:"none",
- mask:true,
- duration: 2000
- });
- }else{
- this.getData.startTime=e.target.value
- }
- },
- //结束时间选中事件
- endChange(e){
- if(new Date(this.getData.startTime).getTime()>=new Date(e.target.value).getTime()){
- uni.showToast({
- title: '结束时间不能小于开始时间',
- icon:"none",
- mask:true,
- duration: 2000
- });
- }else{
- this.getData.endTime=e.target.value
- }
- },
-
- handleClick(row,doType){
- let self=this;
- if( doType=='detail'){//详情
- uni.navigateTo({
- url: '/pages/earlyWarningManage/earlyWarningDetail?warningId='+row.id,//安全警报
- });
- }
-
- },
- //排序
- sortClass(sortData){
- const groupBy = (array, f) => {
- let groups = {};
- array.forEach((o) => {
- let group = JSON.stringify(f(o));
-
- groups[group] = groups[group] || [];
- groups[group].push(o);
- });
- return Object.keys(groups).map((group) => {
- return groups[group];
- });
- };
- const sorted = groupBy(sortData, (item) => {
- return item.createDate; // 返回需要分组的对象
- });
- return sorted;
- },
- async getList(){
- let self = this;
- const {data} = await warningNoticeLogList(this.getData);
- if(data.code==200){
- this.dataArr=[...this.dataArr,...data.data.records]
- this.dataList=this.sortClass(this.dataArr)
- console.log(this.dataList)
- this.total=data.data.total;
- }
- },
-
- }
- }
- </script>
- <style lang="stylus" scoped>
- #earlyWarning{
- height: 100%;
- width: 100%;
- flex :1;
- display flex;
- flex-direction column
- overflow hidden;
- .red_color{
- color: #D40000;
- border: 1rpx solid #D40000;
- }
- .orange_color{
- color: #FF4800;
- border: 1rpx solid #FF4800;
- }
- .yellow_color{
- color: #FFA34E;
- border: 1rpx solid #FFA34E;
- }
- .null-img{
- display block
- width:276rpx;
- height:321rpx;
- margin:100rpx 0 0 274rpx;
- }
- .top-picker-max-box{
- display:flex;
- padding:0 20rpx;
- background #fff
- border-bottom:1rpx solid #E0E0E0;
- .top-picker-box{
- line-height:80rpx;
- height:80rpx;
- .picker-view{
- display flex;
- .picker-view-l{
- display:block;
-
- overflow:hidden;
- text-overflow:ellipsis;
- white-space:nowrap;
- font-size:28rpx;
- }
- .picker-img{
- width:24rpx;
- height:13rpx;
- margin-top:36rpx;
- margin-left:13rpx;
- }
- }
- }
- .top-picker-box:nth-child(1){
- text-align left;
- width:320rpx;
- .picker-view{
- .picker-view-l{
- max-width:260rpx;
- }
- }
- }
- .top-picker-box:nth-child(2){
- text-align left;
- width:215rpx;
- .picker-view{
- .picker-view-l{
- max-width:156rpx;
- }
- }
- }
- .top-picker-box:nth-child(3){
- text-align right;
- width:195rpx;
- .picker-view{
- .picker-view-l{
- flex:1;
-
- }
- }
- }
-
-
- }
-
- .list{
- .list_t{
- height: 80rpx;
- font-size: 30rpx;
- font-family: PingFang SC-Medium, PingFang SC;
- font-weight: 400;
- color: #666666;
- line-height: 80rpx;
- }
- .list_li{
- width: 690rpx;
- height:auto;
- background: #FFFFFF;
- border-radius: 10rpx;
- padding-bottom: 52rpx;
- box-sizing: border-box;
- margin-bottom: 20rpx;
- .list_li_t{
- position: relative;
- height: 110rpx;
- display: flex;
- justify-content: flex-start;
- align-items: center;
- .list_li_t_l{
- position: absolute;
- left:-15rpx;
- top: 76rpx;
- width: 30rpx;
- height: 30rpx;
- background:#F5F5F5;
- border-radius: 15rpx;
- }
- .list_li_t_c{
- height: 40rpx;
- font-size: 30rpx;
- font-family: PingFang SC-Medium, PingFang SC;
- font-weight: 400;
- line-height: 36rpx;
- margin-left: 30rpx;
- margin-right: 20rpx;
- border-radius: 20rpx;
- padding: 0 20rpx;
- box-sizing: border-box;
-
- }
- .list_li_t_c2{
- font-size: 30rpx;
- font-family: PingFang SC-Medium, PingFang SC;
- font-weight: 400;
- color: #333333;
- line-height: 30rpx;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- flex: 1;
- }
- .list_li_t_r{
- position: absolute;
- right:-15rpx;
- top: 76rpx;
- width: 30rpx;
- height: 30rpx;
- background:#F5F5F5;
- border-radius: 15rpx;
- }
- }
- .list_li_b{
- margin: 0 30rpx;
- border-top: 1rpx dotted #D8D8D8;
-
- .list_li_b_t{
- display: flex;
- justify-content: space-between;
- margin-top:28rpx;
- >text:nth-of-type(1){
- font-size: 30rpx;
- font-family: PingFang SC-Medium, PingFang SC;
- font-weight: 400;
- color: #333333;
- line-height: 30rpx;
- }
- >text:nth-of-type(2){
- font-size: 30rpx;
- font-family: PingFang SC-Medium, PingFang SC;
- font-weight: 400;
- color: #666666;
- line-height: 30rpx;
- }
- }
- .list_li_b_b{
- display: flex;
- justify-content: flex-start;
- margin-top:30rpx;
- >img{
- width: 30rpx;
- height: 30rpx;
- margin-right: 22rpx;
- }
- >text{
- font-size: 28rpx;
- font-family: PingFang SC-Medium, PingFang SC;
- font-weight: 400;
- color: #666666;
- line-height: 28rpx;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- flex: 1;
- }
- }
- }
- }
- }
- .info-max-box{
- flex: 1;
- overflow: scroll;
- padding: 0 30rpx;
- box-sizing: border-box;
- }
- }
- </style>
|