初次提交
This commit is contained in:
152
pages/home-page/alarm/components/alarmevent.vue
Normal file
152
pages/home-page/alarm/components/alarmevent.vue
Normal file
@ -0,0 +1,152 @@
|
||||
<template>
|
||||
<view class="event-card">
|
||||
<u-checkbox-group @change="checkboxGroupChange" size="28">
|
||||
<view class="flex_row">
|
||||
<view class="state">
|
||||
<view class="alarm-content"> {{ formatValue("string", alarmContent) }} </view>
|
||||
<view class="status">
|
||||
{{ title }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="flex_row">
|
||||
<view class="state">
|
||||
<text class="text-label">{{ $t('homePage.alarm.status') }}:</text>
|
||||
<text :style="{ color: state === '未确认' ? '#FF0000' : '#4C9CE7' }">{{ state }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="flex_row">
|
||||
<view class="alarm-time">
|
||||
<text class="text-label">{{ $t('homePage.alarm.station') }}:</text>
|
||||
{{ formatValue("string", belongs) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex_row">
|
||||
<view class="alarm-time">
|
||||
<text class="text-label">{{ $t('homePage.alarm.device') }}:</text>
|
||||
{{ formatValue("string", name) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex_row">
|
||||
<text class="text-label">{{ $t('homePage.alarm.alarmTime') }}:</text>
|
||||
{{ formatValue("string", alarmTime) }}
|
||||
</view>
|
||||
<view class="flex_row">
|
||||
<text class="text-label">{{ $t('homePage.alarm.confirmTime') }}:</text>
|
||||
{{ formatValue("string", confirmTime) }}
|
||||
</view>
|
||||
<view class="flex_row">
|
||||
|
||||
<view class="alarm-time">
|
||||
<text class="text-label">{{ $t('homePage.alarm.confirmer') }}:</text>
|
||||
|
||||
<text>{{ formatValue("string", confirmPeople) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</u-checkbox-group>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
check: false,
|
||||
choice: [],
|
||||
transfer: {
|
||||
width: "110rpx",
|
||||
height: "35rpx",
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
fontSize: "24rpx",
|
||||
color: "#4C9CE7",
|
||||
backgroundColor: "white",
|
||||
marginRight: "10rpx",
|
||||
},
|
||||
formatValue: this.$formatValue
|
||||
|
||||
}
|
||||
},
|
||||
created() { },
|
||||
props: [
|
||||
"title",
|
||||
"state",
|
||||
"alarmTime",
|
||||
"deviceType",
|
||||
"belongs",
|
||||
"confirmPeople",
|
||||
"confirmTime",
|
||||
"alarmContent",
|
||||
"conversionStatus",
|
||||
"pid",
|
||||
"name"
|
||||
],
|
||||
methods: {
|
||||
// 选中某个复选框时,由checkbox时触发
|
||||
checkboxChange(e) {
|
||||
this.$emit("choice", e.name)
|
||||
},
|
||||
// 选中任一checkbox时,由checkbox-group触发
|
||||
checkboxGroupChange(e) { },
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.event-card {
|
||||
width: 100%;
|
||||
margin-top: 30rpx;
|
||||
padding: 20rpx;
|
||||
|
||||
box-sizing: border-box;
|
||||
background: #ffffff !important;
|
||||
box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.08);
|
||||
border-radius: 8px;
|
||||
|
||||
.state {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
|
||||
.alarm-content {
|
||||
flex: 1;
|
||||
font-weight: 700;
|
||||
color: #282828;
|
||||
}
|
||||
.status {
|
||||
width: 80px;
|
||||
text-align: right;
|
||||
color: #009C77;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.flex_row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
margin-bottom: 10rpx;
|
||||
color: #333333;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
text {
|
||||
color: #979797;
|
||||
}
|
||||
|
||||
.text-label {
|
||||
color: #999999;
|
||||
display: inline-block;
|
||||
// width: 140rpx;
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
151
pages/home-page/alarm/components/tki-tree/style.css
Normal file
151
pages/home-page/alarm/components/tki-tree/style.css
Normal file
@ -0,0 +1,151 @@
|
||||
.tki-tree-mask {
|
||||
position: fixed;
|
||||
top: 0rpx;
|
||||
right: 0rpx;
|
||||
bottom: 0rpx;
|
||||
left: 0rpx;
|
||||
z-index: 9998;
|
||||
background-color: rgba(0, 0, 0, 0.6);
|
||||
opacity: 0;
|
||||
transition: all 0.3s ease;
|
||||
visibility: hidden;
|
||||
}
|
||||
.tki-tree-mask.show {
|
||||
visibility: visible;
|
||||
opacity: 1;
|
||||
}
|
||||
.tki-tree-cnt {
|
||||
position: fixed;
|
||||
top: 0rpx;
|
||||
right: 0rpx;
|
||||
bottom: 0rpx;
|
||||
left: 0rpx;
|
||||
z-index: 9999;
|
||||
top: 160rpx;
|
||||
transition: all 0.3s ease;
|
||||
transform: translateY(100%);
|
||||
}
|
||||
.tki-tree-cnt.show {
|
||||
transform: translateY(0);
|
||||
}
|
||||
.tki-tree-bar {
|
||||
background-color: #fff;
|
||||
height: 72rpx;
|
||||
padding-left: 20rpx;
|
||||
padding-right: 20rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
border-bottom-width: 1rpx !important;
|
||||
border-bottom-style: solid;
|
||||
border-bottom-color: #f5f5f5;
|
||||
font-size: 32rpx;
|
||||
color: #757575;
|
||||
line-height: 1;
|
||||
}
|
||||
.tki-tree-bar-confirm {
|
||||
color: #07bb07;
|
||||
}
|
||||
.tki-tree-view {
|
||||
position: absolute;
|
||||
top: 0rpx;
|
||||
right: 0rpx;
|
||||
bottom: 0rpx;
|
||||
left: 0rpx;
|
||||
top: 72rpx;
|
||||
background-color: #fff;
|
||||
padding-top: 20rpx;
|
||||
padding-right: 20rpx;
|
||||
padding-bottom: 20rpx;
|
||||
padding-left: 20rpx;
|
||||
}
|
||||
.tki-tree-view-sc {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.tki-tree-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 26rpx;
|
||||
color: #757575;
|
||||
line-height: 1;
|
||||
height: 0;
|
||||
opacity: 0;
|
||||
transition: 0.2s;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.tki-tree-item.show {
|
||||
height: 80rpx;
|
||||
opacity: 1;
|
||||
}
|
||||
.tki-tree-item.showchild:before {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
.tki-tree-item.last:before {
|
||||
opacity: 0;
|
||||
}
|
||||
.tki-tree-icon {
|
||||
width: 26rpx;
|
||||
height: 26rpx;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
.tki-tree-label {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
line-height: 1.2;
|
||||
}
|
||||
.tki-tree-check {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.tki-tree-check-yes,
|
||||
.tki-tree-check-no {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-top-left-radius: 20%;
|
||||
border-top-right-radius: 20%;
|
||||
border-bottom-right-radius: 20%;
|
||||
border-bottom-left-radius: 20%;
|
||||
border-top-width: 1rpx;
|
||||
border-left-width: 1rpx;
|
||||
border-bottom-width: 1rpx;
|
||||
border-right-width: 1rpx;
|
||||
border-style: solid;
|
||||
border-color: #07bb07;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.tki-tree-check-yes-b {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-top-left-radius: 20%;
|
||||
border-top-right-radius: 20%;
|
||||
border-bottom-right-radius: 20%;
|
||||
border-bottom-left-radius: 20%;
|
||||
background-color: #07bb07;
|
||||
}
|
||||
.tki-tree-check .radio {
|
||||
border-top-left-radius: 50%;
|
||||
border-top-right-radius: 50%;
|
||||
border-bottom-right-radius: 50%;
|
||||
border-bottom-left-radius: 50%;
|
||||
}
|
||||
.tki-tree-check .radio .tki-tree-check-yes-b {
|
||||
border-top-left-radius: 50%;
|
||||
border-top-right-radius: 50%;
|
||||
border-bottom-right-radius: 50%;
|
||||
border-bottom-left-radius: 50%;
|
||||
}
|
||||
.hover-c {
|
||||
opacity: 0.6;
|
||||
}
|
||||
329
pages/home-page/alarm/components/tki-tree/tki-tree.vue
Normal file
329
pages/home-page/alarm/components/tki-tree/tki-tree.vue
Normal file
@ -0,0 +1,329 @@
|
||||
<template xlang="wxml">
|
||||
<view class="tki-tree" v-if="showTree" >
|
||||
<view class="tki-tree-mask" :class="{'show':showTree}" @tap="_cancel"></view>
|
||||
<view class="tki-tree-cnt" :class="{'show':showTree}">
|
||||
<view class="tki-tree-bar">
|
||||
<view class="tki-tree-bar-cancel" :style="{'color':cancelColor}" hover-class="hover-c" @tap="_cancel">{{$t('homePage.mine.cancel')}}</view>
|
||||
<view class="tki-tree-bar-title" :style="{'color':titleColor}">{{title}}</view>
|
||||
<view class="tki-tree-bar-confirm" :style="{'color':confirmColor}" hover-class="hover-c" @tap="_confirm">{{$t('homePage.price.sure')}}</view>
|
||||
</view>
|
||||
<view class="tki-tree-view">
|
||||
<scroll-view class="tki-tree-view-sc" :scroll-y="true">
|
||||
<block v-for="(item, index) in treeList" :key="index">
|
||||
<view class="tki-tree-item" :style="[{
|
||||
paddingLeft: item.rank*15 + 'px',
|
||||
zIndex: item.rank*-1 +50
|
||||
}]"
|
||||
:class="{
|
||||
border: border === true,
|
||||
show: item.show,
|
||||
last: item.lastRank,
|
||||
showchild: item.showChild,
|
||||
open: item.open,
|
||||
}">
|
||||
<view class="tki-tree-label" @tap.stop="_treeItemTap(item, index)">
|
||||
<image class="tki-tree-icon" :src="item.lastRank ? lastIcon : item.showChild ? currentIcon : defaultIcon"></image>
|
||||
{{item.name}}
|
||||
</view>
|
||||
<!-- 1 vif 删除了 && item.type === 'person' 为了设备控制业使用 在使用工单时 可以添加上 -->
|
||||
<view class="tki-tree-check" @tap.stop="_treeItemSelect(item, index)" v-if="(selectParent?true:item.lastRank) &&item.category !== 1 && item.category !== 2 ">
|
||||
<view class="tki-tree-check-yes" v-if="item.checked" :class="{'radio':!multiple}" :style="{'border-color':confirmColor}">
|
||||
<view class="tki-tree-check-yes-b" :style="{'background-color':confirmColor}"></view>
|
||||
</view>
|
||||
<view class="tki-tree-check-no" v-else :class="{'radio':!multiple}" :style="{'border-color':confirmColor}"></view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "tki-tree",
|
||||
props: {
|
||||
range: {
|
||||
type: Array,
|
||||
default: function() {
|
||||
return []
|
||||
}
|
||||
},
|
||||
idKey: {
|
||||
type: String,
|
||||
default: 'id'
|
||||
},
|
||||
rangeKey: {
|
||||
type: String,
|
||||
default: 'label'
|
||||
},
|
||||
childrenKey:{
|
||||
type: String,
|
||||
default: 'children'
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
multiple: { // 是否可以多选
|
||||
type: Boolean,
|
||||
default: false
|
||||
// default: true
|
||||
},
|
||||
selectParent: { //是否可以选父级
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
foldAll: { //折叠时关闭所有已经打开的子集,再次打开时需要一级一级打开
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
confirmColor: { // 确定按钮颜色
|
||||
type: String,
|
||||
default: '#07bb07' // #07bb07
|
||||
},
|
||||
cancelColor: { // 取消按钮颜色
|
||||
type: String,
|
||||
default: '' // #757575
|
||||
},
|
||||
titleColor: { // 标题颜色
|
||||
type: String,
|
||||
default: '' // #757575
|
||||
},
|
||||
currentIcon: { // 展开时候的ic
|
||||
type: String,
|
||||
default: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFEAAABRCAYAAACqj0o2AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MEQ0QTM0MzQ1Q0RBMTFFOUE0MjY4NzI1Njc1RjI1ODIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MEQ0QTM0MzU1Q0RBMTFFOUE0MjY4NzI1Njc1RjI1ODIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDowRDRBMzQzMjVDREExMUU5QTQyNjg3MjU2NzVGMjU4MiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDowRDRBMzQzMzVDREExMUU5QTQyNjg3MjU2NzVGMjU4MiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PidwepsAAAK0SURBVHja7JxbTsJAFIYHww7ciStgCeoGvGxAiOsgURegoL5720AXYLiIr0aJviq3Zx3PhIEnKG3ndtr+f3KixrSUj/ZjzjClIqUUiFm2gAAQAREQEUAEREAERAQQAREQAREBREAEREBEEqa67h9RFDWllDv0awWYlqlQHmu1WjMRRMoV1QFttA12y3xRtdNczq8EsE4/f8FumX2q77ROvNXk8UGMEKdUz6tYJHljaZAbuyUH+UR1to5BEohTuqwPCeS4pAA/qY6o/kyHOAMCeRK3owJnj+rH1jjxhqpVsstaebCz6TmnHWyXyY+xHjSBWBY/bvSgadtXBj9u9KCN3rnIfkzkQVsTEEX0Y2IP2oKo/HhMICcFAThUcwVZNGU6FdbX/XURzkbVF4+ybGhjPrFdgP66QdXNurGtSdk6Xdb9nAJ8oDo3OQlsQZzkdPw41ONBo6vI5scDefRjZg+6gpg3Pxp50CXEvPjR2IOuIXL3oxUPuobI3Y9WPOgDIlc/WvOgL4iL/vqFCcD7LH0xB4hj7cfQ/fWH9qCT+FhG0tN+DBk1PzjOM0SVllixcsBT1AvYc/kAPhc0hRg/3uvxoCgKRN9+dOrBUBB9+9GpB0NC9OVH5x4MDdG1H714kANEV3705kEOEBf9dcPi/lQnsuvLg1wgSu3Ha0v7Uh4MMgUXeuG71H407a+VBy9CPQkOdw+MtB+nGbd/D+FBbhBNxo9SjwcngJjNj0E9yBFiFj8G9SBXiGn8GNyDnCEm8SMLD3KHGOdHNh7kDjHOj2w8mAeIi/5arX+c6b/fxHz9oADEdGdjR/fXCw/OOB5oVfCOgnepz8IB14PMw03jCmTE+QBx5z0gAmKSqK9OUF+hcAeIhu/QYr4Qie8rjW83hhMBERARQAREQAREBBABERCLnH8BBgA+TQI7U4t53AAAAABJRU5ErkJggg=='
|
||||
},
|
||||
defaultIcon: { // 折叠时候的ic
|
||||
type: String,
|
||||
default: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFEAAABRCAYAAACqj0o2AAACE0lEQVR4Xu3c200DMRCF4XEltJAOkEugA+ggpUAHoQMqiFMCdEAJUMEiS4mEELlIO7bPOeN9i6K1rG/952myyea1WiCtXmEuYBPR4RBMxInoIOCwhOtJLKVszWyXc/5y2BvNEq6I+/3+kFK6M7OHnPM7jcLKjbZAvD/uaZtzflm5P4rbWyJWgDcze1LPuzVihfxUz7sH4ilJ2bx7Isrm3RtRMu8RiHJ5j0SUyXs0okTeCIj0eSMh0uaNhkiZNyIiXd7IiDR5oyNS5M2ACJ83EyJs3myIkHkzIsLlzYwIkzc7IkTeCojD81ZCHJa3GuKQvBURu+etjNgtb3XELnlHQGyedyTEZnlHQ2ySd0RE97wjI7rlHR3RJe+JeIrbLOecD6ePpZQ6W1kn2epo4MUrPOKyLN8ppYq1+y1VStncOjIdGnFZlo+U0uOtWOeOY2TE12Ouq//pEA7xXL7XfvcufR8K0Svfv6CREN3yDYfYIt9QiK3yjYTYLF95xB75SiP2ylcZsVu+cogj8pVCHJWvEuKwfOkREfKlRkTJlxkRJl86RMR8qRBR82VChM0XHpEhX2hElnyREWnyhUNkzBcKkTVfJETafIcjKuQ7FFEl35GIMvl2R1TMtyuiar49EWXzbY5oZpv/hibXTF2h3+s60FRKeT6+3TjMS3nrA3ZFRD8xrfY3ER1kJ+JEdBBwWGKeRAfEH1wS5WFZSDB/AAAAAElFTkSuQmCC'
|
||||
},
|
||||
lastIcon: { // 没有子集的ic
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
border: { // 是否有分割线
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
selectData:{//默认选择的数据
|
||||
type: Array,
|
||||
default: function() {
|
||||
return []
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showTree: false,
|
||||
treeList: [],
|
||||
selectIndex: -1,
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
methods: {
|
||||
_show() {
|
||||
this.showTree = true
|
||||
this._changeSelect()
|
||||
},
|
||||
_hide() {
|
||||
this.showTree = false
|
||||
this._changeSelect()
|
||||
},
|
||||
_cancel() {
|
||||
this._hide()
|
||||
this.$emit("cancel", '');
|
||||
},
|
||||
_confirm() {
|
||||
// 处理所选数据
|
||||
let rt = [],
|
||||
obj = {};
|
||||
this.treeList.forEach((v, i) => {
|
||||
if (this.treeList[i].checked) {
|
||||
obj = {}
|
||||
obj.parents = this.treeList[i].parents
|
||||
obj = Object.assign(obj, this.treeList[i].source)
|
||||
// 移除子元素
|
||||
delete obj[this.childrenKey]
|
||||
rt.push(obj)
|
||||
}
|
||||
})
|
||||
this._hide()
|
||||
this.$emit("confirm", rt);
|
||||
},
|
||||
//扁平化树结构
|
||||
_renderTreeList(list = [], rank = 0, parentId = [], parents = []) {
|
||||
list.forEach(item => {
|
||||
this.treeList.push({
|
||||
id: item[this.idKey],
|
||||
name: item[this.rangeKey],
|
||||
type:item.type,
|
||||
source: item,
|
||||
userId:item.userId,
|
||||
parentId, // 父级id数组
|
||||
parents, // 父级id数组
|
||||
rank, // 层级
|
||||
showChild: false, //子级是否显示
|
||||
open: false, //是否打开
|
||||
show: rank === 0, // 自身是否显示
|
||||
hideArr: [],
|
||||
category:item.category,
|
||||
orChecked: item.checked ? item.checked : false,
|
||||
checked: item.checked ? item.checked : false,
|
||||
})
|
||||
if (Array.isArray(item[this.childrenKey]) && item[this.childrenKey].length > 0) {
|
||||
let parentid = [...parentId],
|
||||
parentArr = [...parents],
|
||||
childrenid = [...childrenid];
|
||||
delete parentArr[this.childrenKey]
|
||||
parentid.push(item[this.idKey]);
|
||||
parentArr.push({
|
||||
[this.idKey]: item[this.idKey],
|
||||
[this.rangeKey]: item[this.rangeKey]
|
||||
})
|
||||
this._renderTreeList(item[this.childrenKey], rank + 1, parentid, parentArr);
|
||||
} else {
|
||||
this.treeList[this.treeList.length - 1].lastRank = true;
|
||||
this.treeList[this.treeList.length - 1].type = 'person';
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
// 处理默认选择
|
||||
_defaultSelect() {
|
||||
this.treeList.forEach((v, i) => {
|
||||
if (v.checked) {
|
||||
this.treeList.forEach((v2, i2) => {
|
||||
if (v.parentId.toString().indexOf(v2.parentId.toString()) >= 0) {
|
||||
v2.show = true
|
||||
if (v.parentId.includes(v2.id)) {
|
||||
v2.showChild = true;
|
||||
v2.open = true;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 点击
|
||||
_treeItemTap(item, index) {
|
||||
if (item.lastRank === true) {
|
||||
//点击最后一级时触发事件
|
||||
this.treeList[index].checked = !this.treeList[index].checked
|
||||
this._fixMultiple(index)
|
||||
return;
|
||||
}
|
||||
let list = this.treeList;
|
||||
let id = item.id;
|
||||
item.showChild = !item.showChild;
|
||||
item.open = item.showChild ? true : !item.open;
|
||||
list.forEach((childItem, i) => {
|
||||
if (item.showChild === false) {
|
||||
//隐藏所有子级
|
||||
if (!childItem.parentId.includes(id)) {
|
||||
return;
|
||||
}
|
||||
if (!this.foldAll) {
|
||||
if (childItem.lastRank !== true && !childItem.open) {
|
||||
childItem.showChild = false;
|
||||
}
|
||||
// 为隐藏的内容添加一个标记
|
||||
if (childItem.show) {
|
||||
childItem.hideArr[item.rank] = id
|
||||
}
|
||||
} else {
|
||||
if (childItem.lastRank !== true) {
|
||||
childItem.showChild = false;
|
||||
}
|
||||
}
|
||||
childItem.show = false;
|
||||
} else {
|
||||
// 打开子集
|
||||
if (childItem.parentId[childItem.parentId.length - 1] === id) {
|
||||
childItem.show = true;
|
||||
}
|
||||
// 打开被隐藏的子集
|
||||
if (childItem.parentId.includes(id) && !this.foldAll) {
|
||||
if (childItem.hideArr[item.rank] === id) {
|
||||
childItem.show = true;
|
||||
if (childItem.open && childItem.showChild) {
|
||||
childItem.showChild = true
|
||||
} else {
|
||||
childItem.showChild = false
|
||||
}
|
||||
childItem.hideArr[item.rank] = null
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
_treeItemSelect(item, index) {
|
||||
this.treeList[index].checked = !this.treeList[index].checked
|
||||
this._fixMultiple(index)
|
||||
},
|
||||
// 处理单选多选
|
||||
_fixMultiple(index) {
|
||||
if (!this.multiple) {
|
||||
// 如果是单选
|
||||
this.treeList.forEach((v, i) => {
|
||||
if (i != index) {
|
||||
this.treeList[i].checked = false
|
||||
} else {
|
||||
this.treeList[i].checked = true
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
// 重置数据
|
||||
_reTreeList() {
|
||||
this.treeList.forEach((v, i) => {
|
||||
this.treeList[i].checked = v.orChecked
|
||||
})
|
||||
},
|
||||
_initTree(range = this.range){
|
||||
this.treeList = [];
|
||||
this._renderTreeList(range);
|
||||
this.$nextTick(() => {
|
||||
this._defaultSelect(range)
|
||||
})
|
||||
},
|
||||
_changeSelect(val = this.selectData){
|
||||
this.treeList.map((v, i) => {
|
||||
if(val.findIndex(n=>+n[this.idKey] === +v.id) !== -1){
|
||||
|
||||
v.checked = true
|
||||
}else{
|
||||
v.checked = false
|
||||
}
|
||||
return v
|
||||
})
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
range(list) {
|
||||
this._initTree(list);
|
||||
},
|
||||
selectData(val){
|
||||
this._changeSelect(val)
|
||||
},
|
||||
multiple() {
|
||||
if (this.range.length) {
|
||||
this._reTreeList();
|
||||
}
|
||||
},
|
||||
selectParent() {
|
||||
if (this.range.length) {
|
||||
this._reTreeList();
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this._initTree();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@import "./style.css";
|
||||
</style>
|
||||
723
pages/home-page/alarm/index.vue
Normal file
723
pages/home-page/alarm/index.vue
Normal file
@ -0,0 +1,723 @@
|
||||
<template>
|
||||
<view class="warp">
|
||||
|
||||
<u-toast ref="uToast" />
|
||||
<!-- 搜索框 -->
|
||||
<u-navbar :is-back="true" :background="background" :border-bottom="false" :custom-back="toback">
|
||||
<view class="slot-wrap">
|
||||
<stationDropdow disabled style="width: 100%" ref="dropdow" />
|
||||
</view>
|
||||
</u-navbar>
|
||||
<zero-loading v-if="loading" active-color="#ff9900" />
|
||||
|
||||
<view v-else class="alarm-warp">
|
||||
<view class="search-warp" style="margin-top: 20rpx">
|
||||
<Search :placeholder="$t('homePage.alarm.placeholderInput')" class="Search" @custom="showPopup"
|
||||
ref="search" @blur="decSearch" />
|
||||
</view>
|
||||
<view class="clear-alarm">
|
||||
<u-popup v-model="popupShow" mode="bottom" border-radius="20" height="75%" placement="top-end"
|
||||
@close="closePop">
|
||||
<view class="sift">{{$t('homePage.alarm.sift')}}</view>
|
||||
|
||||
<!-- 设备类型下拉框 -->
|
||||
<view class="s-station">
|
||||
<u-section :title="$t('homePage.alarm.device')" line-color="#009C77" color="#2A2A2A"
|
||||
class="s-title" :right="false"></u-section>
|
||||
<!-- <view class="s-title">设备</view> -->
|
||||
<view class="s-content">
|
||||
<view class="s-button" v-if="!deviceList.length">
|
||||
<view class="selectbox" @click="addTags">
|
||||
<view class="select-title">
|
||||
<view style="font-size: 24rpx" class="choice" @click="openSelectDevice">
|
||||
{{$t('homePage.alarm.placeSelect')}}
|
||||
</view>
|
||||
<!-- {{ devType }} -->
|
||||
</view>
|
||||
|
||||
<!-- <i class="iconfont icon-xiala"></i> -->
|
||||
</view>
|
||||
</view>
|
||||
<block v-if="deviceNameList.length">
|
||||
<u-tag style="margin-right: 10rpx; margin-bottom: 10rpx"
|
||||
v-for="(item, index) in deviceNameList" :key="item.srcId" closeable type="success"
|
||||
class="tag" :text="item.name" @close="handleDel(item, index)" />
|
||||
<u-icon name="plus" color="#2979ff" size="28" @click="addTags"></u-icon>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 事件 -->
|
||||
<view class="s-station">
|
||||
<u-section :title="$t('homePage.alarm.event')" line-color="#009C77" color="#2A2A2A"
|
||||
class="s-title" :right="false"></u-section>
|
||||
<!-- <view class="s-title">事件</view> -->
|
||||
<view class="s-content">
|
||||
<block v-for="item in newEventTypes" :key="item.value">
|
||||
<view class="s-button" :class="{ 'checked-class': item.isActive }"
|
||||
@click="choiceEvent(item)">
|
||||
{{ item.label }}
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 告警等级 -->
|
||||
<view class="s-station">
|
||||
<u-section :title="$t('homePage.alarm.level')" line-color="#009C77" color="#2A2A2A"
|
||||
class="s-title" :right="false"></u-section>
|
||||
<!-- <view class="s-title">告警等级</view> -->
|
||||
<view class="s-content">
|
||||
<block v-for="(item, index) in newEventLevels" :key="index">
|
||||
<view class="s-button" :class="{ 'checked-class': item.isActive }"
|
||||
@click="choiceLevel(item, index)">{{
|
||||
item.label }}</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 时间范围 -->
|
||||
<view class="s-station" v-show="currentType === 1">
|
||||
<u-section :title="$t('homePage.alarm.timeRange')" line-color="#009C77" color="#2A2A2A"
|
||||
class="s-title" :right="false"></u-section>
|
||||
<!-- <view class="s-title">告警等级</view> -->
|
||||
<view class="s-content" style="width: 100%;margin-top: 6px;">
|
||||
<u-input style="width: 90%;" v-model="dateRange" :disabled="true"
|
||||
:placeholder="$t('homePage.alarm.placeholderDate')" :type="'text'" :border="true"
|
||||
clearable @click="calendarShow=true" />
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<view class="other-button">
|
||||
<u-button type="warning" :custom-style="{
|
||||
backgroundColor: 'rgba(191, 228, 159, 1)',
|
||||
width: '280rpx',
|
||||
height: '70rpx',
|
||||
fontSize: '28rpx',
|
||||
color: 'rgba(40, 40, 40, 1)'
|
||||
}" @click="clearText()">{{$t('homePage.alarm.reset')}}</u-button>
|
||||
<u-button type="primary" :custom-style="{
|
||||
backgroundColor: 'rgba(0, 156, 119, 1)',
|
||||
width: '280rpx',
|
||||
height: '70rpx',
|
||||
fontSize: '28rpx',
|
||||
color: 'rgba(255, 255, 255, 1)'
|
||||
}" @click="search()">{{$t('homePage.alarm.sure')}}</u-button>
|
||||
</view>
|
||||
<tki-tree :select-data="deviceShowList" ref="tkitree" :range="devTreeOption" idKey="srcId" multiple
|
||||
:rangeKey="'name'" selectParent childrenKey="children" confirmColor="#07bb07"
|
||||
@confirm="confirmDevice" />
|
||||
<u-calendar v-model="calendarShow" :mode="'range'" @change="calendarChange"></u-calendar>
|
||||
|
||||
</u-popup>
|
||||
</view>
|
||||
<view class="subsection-alarm">
|
||||
<u-subsection :list="alarmTypeList" :current="currentType" :animation="true" @change="sectionChange" :active-color="'#3D9F7F'">
|
||||
</u-subsection>
|
||||
</view>
|
||||
|
||||
<view class="no_data" v-if="eventList.length === 0">
|
||||
<u-empty :text="$t('homePage.alarm.noData')" mode="list"></u-empty>
|
||||
</view>
|
||||
<view class="loading" style="position: relative">
|
||||
<Alarmevent v-for="(item, index) in eventList" :key="index" class="eventList-item"
|
||||
@choice="choice($event)" :title="getEventname(item)"
|
||||
:state="item.status === 1 ? $t('homePage.alarm.confirm') : $t('homePage.alarm.noConfirmed')"
|
||||
:alarm-time="item.timeStamp" :name="item.name" :device-type="item.deviceName"
|
||||
:belongs="item.stationName" :confirm-people="item.confirmMan ? item.confirmMan : ''"
|
||||
:confirm-time="item.confirmTime ? item.confirmTime : ''" :alarm-content="item.description"
|
||||
:conversionStatus="item.conversionStatus" :pid="item.id"></Alarmevent>
|
||||
<view v-if="total > 10">
|
||||
<u-loadmore :status="status" icon-type="iconType" :load-text="loadText" v-if="loadmoreshow" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import tkiTree from "./components/tki-tree/tki-tree.vue";
|
||||
import stationDropdow from "@/components/station-dropdow/index.vue";
|
||||
import Search from "@/components/Search/index";
|
||||
import Alarmevent from "./components/alarmevent.vue";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dateRange: '',
|
||||
startTime: null,
|
||||
endTime: null,
|
||||
alarmTypeList: [],
|
||||
currentType: 0,
|
||||
nodata: true,
|
||||
calendarShow: false,
|
||||
loadmoreshow: true,
|
||||
// 事件列表
|
||||
loading: false,
|
||||
eventList: [],
|
||||
filters: {
|
||||
deviceTypeList: null,
|
||||
},
|
||||
pageSize: 5,
|
||||
pageNum: 1,
|
||||
status: "loadmore",
|
||||
iconType: "flower",
|
||||
loadText: this.$t('homePage.alarm.loadText'),
|
||||
total: 0,
|
||||
alarmid: [],
|
||||
showStations: false,
|
||||
stationList: [],
|
||||
popupShow: false,
|
||||
showDevice: false,
|
||||
devType: "",
|
||||
deviceTypeLists: [],
|
||||
deviceTypetreeList: [],
|
||||
informList: ["1", "2", "3", "4", "5"],
|
||||
event: ["2", "3", "4", "5", "6"],
|
||||
stationIds: [],
|
||||
power: "power",
|
||||
alarmContent: "",
|
||||
stationId: "",
|
||||
changeStationColor: "",
|
||||
timer: null,
|
||||
sureFlg: false,
|
||||
AlarmStatus: null,
|
||||
activeSelectLabel: this.$t('homePage.alarm.allStation'),
|
||||
background: {
|
||||
backgroundColor: "#4c9ce7",
|
||||
},
|
||||
activeSelectDevLabel: this.$t('homePage.alarm.device'),
|
||||
activeSelectEventLabel: this.$t('homePage.alarm.event'),
|
||||
activeSelectLevelsLabel: this.$t('homePage.alarm.level'),
|
||||
deviceList: [],
|
||||
devTreeOption: [],
|
||||
selectDevice: false,
|
||||
selectEvent: false,
|
||||
selectLevel: false,
|
||||
deviceShowList: [],
|
||||
EventShowList: [],
|
||||
eventShowList: [],
|
||||
LevelShowList: [],
|
||||
deviceNameList: [],
|
||||
background: {
|
||||
backgroundColor: "#0EA17E",
|
||||
},
|
||||
};
|
||||
},
|
||||
components: {
|
||||
Alarmevent,
|
||||
stationDropdow,
|
||||
tkiTree,
|
||||
Search,
|
||||
},
|
||||
|
||||
watch: {
|
||||
currentStation: {
|
||||
handler(val) {
|
||||
this.loading = true;
|
||||
this.deviceShowList = [];
|
||||
this.deviceList = [];
|
||||
this.deviceNameList = [];
|
||||
this.stationId = val.id;
|
||||
this.eventList = [];
|
||||
this.pageNum = 1;
|
||||
this.GetAlarmList();
|
||||
this.GetDeviceType();
|
||||
},
|
||||
immediate: true,
|
||||
deep: true,
|
||||
},
|
||||
language: {
|
||||
immediate: true,
|
||||
deep:true,
|
||||
handler(val) {
|
||||
if (this.language === 'zh_CN') {
|
||||
this.alarmTypeList = [{
|
||||
name: '实时告警'
|
||||
}, {
|
||||
name: '历史告警'
|
||||
}]
|
||||
} else {
|
||||
this.alarmTypeList = [{
|
||||
name: 'Real-Time Alarm'
|
||||
}, {
|
||||
name: 'History Alarm'
|
||||
}]
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
onShow() {
|
||||
// if (this.language === 'zh_CN') {
|
||||
// this.alarmTypeList = [{
|
||||
// name: '实时告警'
|
||||
// }, {
|
||||
// name: '历史告警'
|
||||
// }]
|
||||
// } else {
|
||||
// this.alarmTypeList = [{
|
||||
// name: 'Real-Time Alarm'
|
||||
// }, {
|
||||
// name: 'History Alarm'
|
||||
// }]
|
||||
// }
|
||||
},
|
||||
mounted() {},
|
||||
computed: {
|
||||
language(){
|
||||
return this.vuex_language
|
||||
},
|
||||
currentStation() {
|
||||
return this.vuex_currentStation;
|
||||
},
|
||||
// 获取vuex中的eventlevel数据(告警等级)
|
||||
eventLevels() {
|
||||
return this.vuex_dicts["eventLevel"] || [];
|
||||
},
|
||||
// 获取vuex中的eventType数据(事件类型)
|
||||
eventTypes() {
|
||||
return this.vuex_dicts["eventType"] || [];
|
||||
},
|
||||
newEventLevels() {
|
||||
if (this.eventLevels.length > 0) {
|
||||
this.eventLevels.forEach((el) => {
|
||||
el.isActive = true;
|
||||
});
|
||||
}
|
||||
return this.eventLevels;
|
||||
},
|
||||
newEventTypes() {
|
||||
if (this.eventTypes.length > 0) {
|
||||
const r = this.eventTypes.findIndex((el) => {
|
||||
if (el.label === this.$t('homePage.alarm.alarm')) {
|
||||
return el;
|
||||
}
|
||||
});
|
||||
if (r !== -1) {
|
||||
this.eventTypes.splice(r, 1);
|
||||
}
|
||||
this.eventTypes.forEach((el) => {
|
||||
el.isActive = true;
|
||||
});
|
||||
}
|
||||
return this.eventTypes;
|
||||
},
|
||||
},
|
||||
|
||||
onReachBottom() {
|
||||
if (this.eventList.length < this.total) {
|
||||
// this.pageSize += 5
|
||||
this.GetAlarmList();
|
||||
} else {
|
||||
this.status = "nomore";
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
calendarChange(val) {
|
||||
this.pageNum = 1;
|
||||
this.startTime = val.startDate
|
||||
this.endTime = val.endDate
|
||||
this.dateRange = val.startDate + ' ~ ' + val.endDate
|
||||
},
|
||||
sectionChange(val) {
|
||||
this.currentType = val
|
||||
this.pageNum = 1;
|
||||
this.eventList = [];
|
||||
this.clearText();
|
||||
setTimeout(() => {
|
||||
this.GetAlarmList()
|
||||
}, 100);
|
||||
},
|
||||
toback() {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
},
|
||||
// 设备增加
|
||||
addTags() {
|
||||
this.$refs.tkitree._show();
|
||||
},
|
||||
|
||||
// 打开下方筛选
|
||||
showPopup() {
|
||||
this.popupShow = true;
|
||||
},
|
||||
closePop() {
|
||||
|
||||
},
|
||||
// 打开设备框
|
||||
openSelectDevice() {
|
||||
if (this.devTreeOption.length === 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: this.$t('homePage.alarm.noDevice'),
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.$refs.tkitree._show();
|
||||
},
|
||||
|
||||
// 确认设备选中
|
||||
confirmDevice(val) {
|
||||
this.deviceNameList = [];
|
||||
this.deviceList = [];
|
||||
val.forEach((el) => {
|
||||
this.deviceList.push(el.srcId);
|
||||
this.deviceNameList.push(el);
|
||||
});
|
||||
this.eventList = [];
|
||||
this.pageNum = 1;
|
||||
this.deviceShowList = val;
|
||||
},
|
||||
|
||||
handleDel: function(item, index) {
|
||||
this.deviceList.splice(index, 1);
|
||||
this.deviceNameList.splice(index, 1);
|
||||
},
|
||||
|
||||
// 重置
|
||||
clearText() {
|
||||
(this.devType = ""), (this.power = ""), (this.deviceList = []);
|
||||
this.deviceNameList = [];
|
||||
this.deviceShowList = [];
|
||||
this.deviceTypeList = undefined;
|
||||
this.changeStationColor = "";
|
||||
this.startTime = null
|
||||
this.endTime = null
|
||||
this.dateRange = ''
|
||||
this.newEventLevels.forEach((el) => {
|
||||
el.isActive = true;
|
||||
this.$forceUpdate();
|
||||
});
|
||||
this.newEventTypes.forEach((el) => {
|
||||
el.isActive = true;
|
||||
this.$forceUpdate();
|
||||
});
|
||||
this.stationList.forEach((el) => {
|
||||
el.isActive = true;
|
||||
this.$forceUpdate();
|
||||
});
|
||||
},
|
||||
|
||||
// 获取设备类型
|
||||
async GetDeviceType() {
|
||||
const res = await this.$u.api.alarm.GetDeviceType({
|
||||
stationId: this.stationId,
|
||||
});
|
||||
this.devTreeOption = res.data;
|
||||
},
|
||||
|
||||
choice(e) {
|
||||
if (!this.alarmid.includes(e)) {
|
||||
this.alarmid.push(e);
|
||||
} else {
|
||||
const r = this.alarmid.findIndex((el) => el === e);
|
||||
this.alarmid.splice(r, 1);
|
||||
}
|
||||
},
|
||||
|
||||
clear() {
|
||||
this.SetAlarmConfirm();
|
||||
},
|
||||
decSearch(e) {
|
||||
this.filters.description = e;
|
||||
this.pageNum = 1;
|
||||
this.eventList = [];
|
||||
// const self = this
|
||||
this.GetAlarmList();
|
||||
// 输入框防抖
|
||||
// clearTimeout(self
|
||||
// .timer) // 每次进来的时候都将之前的清除掉,如果还没到一秒的时候就将之前的清除掉,这样就不会触发之前setTimeout绑定的事件, 如果超过一秒,之前的事件就会被触发下次进来的时候同样清除之前的timer
|
||||
// self.timer = setTimeout(function() {
|
||||
// self.GetAlarmList()
|
||||
// }, 1000)
|
||||
},
|
||||
search() {
|
||||
this.sureFlg = true;
|
||||
|
||||
this.informList = [];
|
||||
this.event = [];
|
||||
if (this.eventLevels.length) {
|
||||
this.eventLevels.forEach((el) => {
|
||||
if (el.isActive) {
|
||||
this.informList.push(el.value);
|
||||
this.informList = Array.from(new Set(this.informList));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (this.eventTypes.length) {
|
||||
this.eventTypes.forEach((el) => {
|
||||
if (el.isActive) {
|
||||
this.event.push(el.value);
|
||||
this.event = Array.from(new Set(this.event));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const params = {
|
||||
belongs: this.stationId,
|
||||
description: this.filters.description,
|
||||
eventLevels: this.informList,
|
||||
eventTypes: this.event,
|
||||
};
|
||||
this.filters.belongs = params.belongs;
|
||||
this.filters.description = params.description;
|
||||
this.filters.eventLevels = params.eventLevels;
|
||||
this.filters.eventTypes = params.eventTypes;
|
||||
this.popupShow = false;
|
||||
this.pageNum = 1;
|
||||
this.eventList = [];
|
||||
this.GetAlarmList();
|
||||
},
|
||||
|
||||
// 如果事件的类型等于1的时候则显示告警的等级
|
||||
getEventname(row) {
|
||||
if (row) {
|
||||
if (row.eventType === 1) {
|
||||
if (
|
||||
this.eventLevels.find((el) => Number(el.value) === row.eventLevel)
|
||||
) {
|
||||
return this.eventLevels.find(
|
||||
(el) => Number(el.value) === row.eventLevel
|
||||
).label;
|
||||
}
|
||||
// 否则则显示事件的类型
|
||||
} else {
|
||||
if (
|
||||
this.eventTypes.find((el) => Number(el.value) === row.eventType)
|
||||
) {
|
||||
return this.eventTypes.find(
|
||||
(el) => Number(el.value) === row.eventType
|
||||
).label;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// 选择事件
|
||||
choiceEvent(item) {
|
||||
item.isActive = !item.isActive;
|
||||
this.$forceUpdate();
|
||||
},
|
||||
// 选择告警等级
|
||||
choiceLevel(item) {
|
||||
item.isActive = !item.isActive;
|
||||
this.$forceUpdate();
|
||||
},
|
||||
|
||||
// 获取告警的数据
|
||||
async GetAlarmList() {
|
||||
// 对电站进行过滤显示
|
||||
try {
|
||||
let res = {};
|
||||
let params = {};
|
||||
if (this.currentType === 1) {
|
||||
params = {
|
||||
description: this.filters.description,
|
||||
pageNum: this.pageNum,
|
||||
pageSize: this.pageSize,
|
||||
stationIds: this.stationId ? [this.stationId] : [],
|
||||
srcIdList: this.deviceList,
|
||||
eventLevels: this.informList,
|
||||
eventTypes: this.event,
|
||||
startTime: this.startTime,
|
||||
endTime: this.endTime
|
||||
};
|
||||
res = await this.$u.api.alarm.GetHistoryAlarmList(params);
|
||||
} else {
|
||||
params = {
|
||||
description: this.filters.description,
|
||||
pageNum: this.pageNum,
|
||||
pageSize: this.pageSize,
|
||||
stationIds: this.stationId ? [this.stationId] : [],
|
||||
srcIdList: this.deviceList,
|
||||
eventLevels: this.informList,
|
||||
eventTypes: this.event
|
||||
};
|
||||
res = await this.$u.api.alarm.GetAlarmList(params);
|
||||
}
|
||||
const data = res.data
|
||||
this.total = data.totalRows;
|
||||
this.eventNums = data.eventTypes;
|
||||
let levelNums = Object.entries(data.eventLevels);
|
||||
this.levelNums = {};
|
||||
for (const [num, value] of levelNums) {
|
||||
if (num === "-1") {
|
||||
this.levelNums["all"] = value;
|
||||
} else {
|
||||
this.levelNums[num] = value;
|
||||
}
|
||||
}
|
||||
this.total = data.totalRows;
|
||||
this.eventList = this.eventList.concat(data.list);
|
||||
if (data.totalRows === 0) {
|
||||
this.eventList = [];
|
||||
}
|
||||
if (this.total) {
|
||||
this.nodata = false;
|
||||
} else {
|
||||
this.nodata = true;
|
||||
this.loadmoreshow = false;
|
||||
}
|
||||
this.pageNum += 1;
|
||||
} catch (error) {} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.warp {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.alarm-warp {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
position: relative;
|
||||
|
||||
.search-warp {
|
||||
width: 100%;
|
||||
|
||||
.Search {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.subsection-alarm {
|
||||
width: 100%;
|
||||
text-align: right;
|
||||
padding-right: 10rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
|
||||
.loading {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.eventList-item {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
}
|
||||
|
||||
.clear-alarm {
|
||||
width: 100%;
|
||||
padding: 20rpx 20rpx 0;
|
||||
text-align: right;
|
||||
|
||||
.button {
|
||||
background-color: #4c9ce7;
|
||||
width: 160rpx;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
|
||||
.sift {
|
||||
text-align: center;
|
||||
font-size: 40rpx;
|
||||
margin-bottom: 20rpx;
|
||||
margin-top: 40rpx;
|
||||
padding-left: 20rpx;
|
||||
}
|
||||
|
||||
.s-station {
|
||||
margin-bottom: 60rpx;
|
||||
|
||||
.s-title {
|
||||
font-size: 35rpx;
|
||||
text-align: left;
|
||||
margin-bottom: 10rpx;
|
||||
padding-left: 20rpx;
|
||||
}
|
||||
|
||||
.s-content {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
padding-left: 20rpx;
|
||||
|
||||
.s-button {
|
||||
margin-top: 10rpx;
|
||||
border: 1px solid;
|
||||
text-align: center;
|
||||
margin-bottom: 10rpx;
|
||||
background: #f8f8f8;
|
||||
color: #282828;
|
||||
border-radius: 4rpx;
|
||||
padding: 10rpx;
|
||||
border: 5rpx;
|
||||
width: 30%;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.checked-class {
|
||||
background-color: rgba(0, 156, 119, 0.1);
|
||||
border: 1px solid rgba(0, 156, 119, 1);
|
||||
border-radius: 4rpx;
|
||||
color: rgba(0, 156, 119, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.no_data {
|
||||
margin-top: 30vh;
|
||||
}
|
||||
|
||||
.loadmore {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.other-button {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
|
||||
.selectbox {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.slot-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
/* 如果您想让slot内容占满整个导航栏的宽度 */
|
||||
flex: 1;
|
||||
|
||||
/* 如果您想让slot内容与导航栏左右有空隙 */
|
||||
/* padding: 0 30rpx; */
|
||||
/deep/ .u-input__input {
|
||||
color: #fff !important;
|
||||
}
|
||||
}
|
||||
|
||||
::v-deep .u-subsection {
|
||||
width: 68% !important;
|
||||
}
|
||||
|
||||
::v-deep .u-item-bg {
|
||||
width: 50% !important;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user