123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439 |
- <template>
- <view>
- <u-navbar title="异常告警记录" title-color="#101010"></u-navbar>
- <view class="dropdown">
- <view class="dropdown-item" @click="show1=true">
- {{time}} <u-icon name="arrow-down" color="#999999"></u-icon>
- </view>
- <view class="dropdown-item" @click="show2=true">
- {{state}} <u-icon name="arrow-down" color="#999999"></u-icon>
- </view>
- <view class="dropdown-item" @click="tabsFrom.show1=true">
- {{device}} <u-icon name="arrow-down" color="#999999"></u-icon>
- </view>
- </view>
- <u-picker mode="time" :defaultTime="defaultTime" v-model="show1" :params="params" @confirm="timeChange"></u-picker>
-
- <u-select v-model="show2" mode="single-column" :list="stateList" @confirm="stateChange"></u-select>
-
- <u-select v-model="show3" mode="single-column" :list="deviceList" @confirm="deviceChange"></u-select>
- <u-select title="" v-model="tabsFrom.show1" :defaultValue="current2"
-
- :list="companyList" value-name="id" label-name="name"
- child-name="childList"
- mode="mutil-column-auto"
- @confirm="selector1confirm" >
- </u-select>
- <view class="records">
- <view class="records-item" v-for="(item, index) in abnormalRecordsList" :key="index"
- @click="gotoUrl('/pages/abnormal/abnormalAlarmDetails?id='+item.id)">
- <view class="icon icon1">
- <image class="img" src="@/assets/img/riFill-temp-cold-fill.svg" mode=""></image>
- </view>
- <!-- <view class="icon icon2">
- <image class="img" src="@/assets/img/riFill-cloud-off-fill.svg" mode=""></image>
- </view>
- <view class="icon icon3">
- <image class="img" src="@/assets/img/outputVoltage.svg" mode=""></image>
- </view> -->
- <view class="title">
- <view class="name">
- {{item.configName}}
- </view>
- <view class="date">
- {{item.createTime}}
- </view>
- </view>
- <view class="equipment">
- <view class="equipment1">
- {{item.meterName}}
- </view>
- <view class="equipment2">
- {{item.installationAddressSimple}}
- </view>
- </view>
- <view class="more">
- <u-icon name="arrow-right" color="#acacac"></u-icon>
- </view>
- </view>
- </view>
-
- <u-divider :isnone="abnormalRecordsList.length==0" nonetext="暂无异常告警记录" border-color="#CFD2D5">
- </u-divider>
- </view>
- </template>
- <script>
- import {
- parseUnixTime,
- beforeTimeStamp,
- getWeek
- } from '@/apis/utils'
- import * as API from '@/apis/pagejs/index.js'
-
- export default {
- data() {
- return {
- abnormalRecordsList: [], // 异常告警记录
- queryDate: '',
- configId: '',
- pageIndex: 1,
- recordsTotal: 0,
- companyId: '',
- show1: false, // 时间选择
- defaultTime: '',
- params: {
- year: true,
- month: true,
- day: false,
- hour: false,
- minute: false,
- second: false,
- timestamp: false
- },
- time: '全部时间',
- show2: false, // 状态选择
- state: '全部状态',
- stateList: [],
- show3: false, // 设备选择
- device: '全部设备',
- deviceList: [],
- value1: 1,
- value2: 1,
- value3: 1,
- current2:[0,0],
- tabsFrom: {
- show1: false,
- show1Index: 0,
- show2Index: '',
- show2: false,
- show1Text: "全部类型",
- show2Text: "全部时间",
-
- },
- companyList:[],
- options1: [{
- label: '2024年2月',
- value: 1,
- },
- {
- label: '2024年3月',
- value: 2,
- },
- {
- label: '2024年4月',
- value: 3,
- }
- ],
- options2: [{
- label: '设备离线',
- value: 1,
- },
- {
- label: '温度异常',
- value: 2,
- },
- {
- label: '电压异常',
- value: 3,
- },
- {
- label: '功率因数异常',
- value: 4,
- },
- ],
- options3: [{
- label: '荆鹏集团',
- value: 1,
- },
- {
- label: '青少年宫',
- value: 2,
- },
- {
- label: '荆州院子',
- value: 3,
- },
- ],
- }
- },
- onLoad(op) {
- if(op.id) {
- this.companyId = op.id;
- }
-
- var date = new Date();
- var year = date.getFullYear();
- var month = date.getMonth()+1 >= 10 ? date.getMonth()+1 : '0'+(date.getMonth()+1);
- this.defaultTime = year + '-' + month;
- this.queryDate = year + '-' + month;
- this.time = year + '年' + parseInt(month) + '月';
-
- this.getCompanyInfoList();
- this.getAlarmConfiguration();
- this.getAbnormalAlarmRecord();
- },
- onReady() {
-
- },
- onReachBottom() {
- if (this.abnormalRecordsList.length < this.recordsTotal) {
- this.myLoadmore();
- }
- },
- methods: {
- getCompanyInfoList() {
- this.companyKwhList = [];
-
- API.deviceCompanyList().then((response) => {
- var list = response.data.companyInfoList;
- this.companyListMain=response.data.companyInfoList;
- // if(list.length==1&&list[0].childList&&list[0].childList.length){
- // list=list[0].childList
- // }
- for(var i in list){
- var obj=list[i]
- if(!list.childList){
- list.childList=[]
- }
-
- list[i].childList.unshift({
- id:obj.id,
- name:obj.name,
- sp:1
- })
- }
- list.unshift({
- id:'',
- name:"全部",
- childList:[
- {
- id:'',
- name:"全部设备"
- }
- ]
- })
-
- this.companyList = list;
-
-
-
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- // 异常告警记录
- getAbnormalAlarmRecord(bl) {
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- if (bl) {
- this.abnormalRecordsList = [];
- this.pageIndex = 1;
- }
- API.alarmRecord({
- queryDate: this.queryDate,
- configId: this.configId,
- pageIndex: this.pageIndex,
- pageSize: 20,
- companyId: this.companyId,
- classify: '2'
- }).then((res) => {
- uni.hideLoading();
- this.abnormalRecordsList = [
- ...this.abnormalRecordsList,
- ...res.data.data
- ];
- this.recordsTotal = res.data.recordsTotal;
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- myLoadmore() {
- this.pageIndex += 1;
- this.getAbnormalAlarmRecord();
- },
- // 异常查询条件
- getAlarmConfiguration() {
- // uni.showLoading({
- // title: "加载中",
- // mask: true,
- // })
- API.alarmConfiguration({classify: '2'}).then((response) => {
- //uni.hideLoading();
- var list1 = [];
- var list2 = [];
- if(response.data.alarmConfigList && response.data.alarmConfigList.length != 0) {
- list1 = response.data.alarmConfigList.map(item => {
- return {
- label: item.name,
- value: item.id
- }
- });
- }
- list1.unshift({
- value: '',
- label: '全部状态'
- });
-
- if(response.data.companyInfoList && response.data.companyInfoList.length != 0) {
- list2 = response.data.companyInfoList.map(item => {
- if(item.id == this.companyId) {
- this.device = item.name;
- }
- return {
- label: item.name,
- value: item.id
- }
- });
- }
- list2.unshift({
- value: '',
- label: '全部设备'
- });
-
- this.stateList = list1;
- this.deviceList = list2;
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- // 时间查询
- timeChange(params) {
- console.log(params)
- this.time = params.year + '年' + parseInt(params.month) + '月';
- this.queryDate = params.year + '-' + params.month;
-
- this.getAbnormalAlarmRecord(true);
- },
- // 状态查询
- stateChange(e) {
- console.log(e);
- this.configId = e[0].value;
- this.state = e[0].label;
-
- this.getAbnormalAlarmRecord(true);
- },
- selector1confirm(e){
- var index = [e[0].i,e[1].i]
-
- console.log(e)
- this.companyId=e[1].value
- this.device=e[1].label
-
- this.current2=index
- this.getAbnormalAlarmRecord(true);
- },
- // 设备查询
- deviceChange(e) {
- console.log(e);
- this.companyId = e[0].value;
- this.device = e[0].label;
-
- this.getAbnormalAlarmRecord(true);
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .dropdown {
- background-color: #fff;
- position: sticky;
- top: 88rpx;
- z-index: 999;
- padding: 18rpx 46rpx;
- display: flex;
- border-bottom: 1px solid rgba(245, 245, 245, 1);
- .dropdown-item{
- width: 33.33%;
- text-align: center;
- height: 60rpx;
- line-height: 60rpx;
- }
- }
- // 记录
- .records {
- background-color: #fff;
- // margin-top: 80rpx;
- .records-item {
- display: flex;
- align-items: center;
- padding: 24rpx 40rpx;
- border-top: 1px solid rgba(245, 245, 245, 1);
- .icon {
- min-width: 72rpx;
- width: 72rpx;
- height: 72rpx;
- border-radius: 4px;
- display: flex;
- align-items: center;
- justify-content: center;
- .img {
- width: 48rpx;
- height: 48rpx;
- }
- }
- .icon1 {
- background-color: rgba(255, 227, 218, 1);
- }
- .icon2 {
- background-color: rgba(230, 230, 230, 1);
- }
- .icon3 {
- background-color: rgba(212, 251, 220, 1);
- }
- .title {
- margin-left: 16rpx;
- white-space: pre;
- .name {
- color: rgba(51, 51, 51, 1);
- font-weight: bold;
- }
- .date {
- color: rgba(119, 119, 119, 1);
- font-size: 24rpx;
- margin-top: 4rpx;
- }
- }
- .equipment {
- margin-left: auto;
- margin-right: 24rpx;
- .equipment1 {
- color: rgba(51, 51, 51, 1);
- font-weight: bold;
- }
- .equipment2 {
- color: rgba(119, 119, 119, 1);
- font-size: 24rpx;
- text-align: right;
- margin-top: 4rpx;
- }
- }
- }
- }
- </style>
|