列表优化
This commit is contained in:
@@ -1,21 +1,50 @@
|
||||
<template>
|
||||
<Cn-page :loading="loading">
|
||||
<view class="content" slot="body">
|
||||
<uni-list :border="false">
|
||||
<uni-list-item
|
||||
isDot
|
||||
show-badge
|
||||
badgeType="error"
|
||||
:badge-text="item.status == 1 ? '' : '未读'"
|
||||
:title="'告警代码:'+item.code"
|
||||
:note="item.startTime"
|
||||
@click="jump(item)"
|
||||
clickable
|
||||
v-for="(item, index) in store.data"
|
||||
/>
|
||||
</uni-list>
|
||||
<view class="content-item" v-for="(item, index) in store.data" :key="index" @click="jump(item)">
|
||||
<view class="content-item-header">
|
||||
<uni-badge
|
||||
class="uni-badge-left-margin"
|
||||
:is-dot="true"
|
||||
:text="item.status == '1' ? 0 : 1"
|
||||
absolute="rightTop"
|
||||
size="small"
|
||||
>
|
||||
<view class="content-item-header-icon">
|
||||
<image mode="aspectFill" :src="staticIcon" style="height: 60rpx; width: 60rpx"></image>
|
||||
</view>
|
||||
</uni-badge>
|
||||
<view class="content-item-header-right">
|
||||
<view class="content-item-header-right-title">{{ item.equipmentName }}</view>
|
||||
<!-- <view class="content-item-header-right-des">{{ item.engineeringName }} {{ item.projectName }}</view> -->
|
||||
<view class="content-item-header-right-des">工程名称:{{ item.engineeringName }}</view>
|
||||
<view class="content-item-header-right-des">项目名称:{{ item.projectName }}</view>
|
||||
<!-- <view class="content-item-header-right-des">{{ item.subTitle }}</view> -->
|
||||
</view>
|
||||
<view class="ml10" v-if="type === '0' || item.status != '1'">🔍</view>
|
||||
</view>
|
||||
<view class="content-item-footer">{{ item.subTitle }}</view>
|
||||
</view>
|
||||
<!-- <uni-card
|
||||
:title="item.equipmentName"
|
||||
:extra="item.status == '1' ? '' : '未读'"
|
||||
:sub-title="item.subTitle"
|
||||
thumbnail="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png"
|
||||
@click="jump(item)"
|
||||
v-for="(item, index) in store.data"
|
||||
:key="index"
|
||||
>
|
||||
<view class="term-list-bottom">
|
||||
<view class="term-list-bottom-item" v-for="(item2, textIndex) in item.dataSet" :key="textIndex">
|
||||
{{ item2.showName + ':' + (item2.value == 3.1415926 ? '-' : item2.value) + (item2.unit || '') }}
|
||||
</view>
|
||||
</view>
|
||||
</uni-card> -->
|
||||
<Cn-empty v-if="store.empty" style="padding-top: 400rpx"></Cn-empty>
|
||||
<uni-load-more v-if="store.data && store.data.length > 0" :status="store.status"></uni-load-more>
|
||||
<uni-load-more
|
||||
v-if="store.status == 'loading' || (store.data && store.data.length > 0)"
|
||||
:status="store.status"
|
||||
></uni-load-more>
|
||||
</view>
|
||||
</Cn-page>
|
||||
</template>
|
||||
@@ -29,13 +58,31 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
deviceId:''
|
||||
type: '',
|
||||
staticIcon: '',
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
this.deviceId = options.id
|
||||
},
|
||||
onShow() {
|
||||
onLoad(o) {
|
||||
this.type = '3'
|
||||
this.devId = o.id
|
||||
switch (this.type) {
|
||||
case '0':
|
||||
uni.setNavigationBarTitle({ title: '暂态事件' })
|
||||
this.staticIcon = '/static/zantai2.png'
|
||||
break
|
||||
case '1':
|
||||
uni.setNavigationBarTitle({ title: '稳态事件' })
|
||||
this.staticIcon = '/static/steady2.png'
|
||||
break
|
||||
case '2':
|
||||
uni.setNavigationBarTitle({ title: '运行事件' })
|
||||
this.staticIcon = '/static/run2.png'
|
||||
break
|
||||
case '3':
|
||||
uni.setNavigationBarTitle({ title: '设备告警' })
|
||||
this.staticIcon = '/static/device_bad2.png'
|
||||
break
|
||||
}
|
||||
this.init()
|
||||
},
|
||||
onNavigationBarButtonTap(e) {
|
||||
@@ -45,9 +92,10 @@ export default {
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
updateStatus({
|
||||
type: 3,
|
||||
eventIds:[]
|
||||
type: this.type,
|
||||
eventIds: [],
|
||||
}).then(() => {
|
||||
this.loading = true
|
||||
this.store.reload()
|
||||
})
|
||||
}
|
||||
@@ -57,21 +105,48 @@ export default {
|
||||
methods: {
|
||||
async init() {
|
||||
let dictData = await this.$util.getDictData('app_event')
|
||||
console.log(dictData)
|
||||
this.store = this.DataSource('/cs-harmonic-boot/eventUser/queryEventpage')
|
||||
this.store.params.type = 3
|
||||
this.store.params.type = this.type
|
||||
this.store.params.deviceId = this.deviceId
|
||||
this.store.firstCallBack = (res) => {
|
||||
// this.store.data.forEach((item) => {
|
||||
// item.title = dictData.find((item2) => item2.code === item.tag)?.name
|
||||
// })
|
||||
// console.log(this.store.data)
|
||||
this.store.loadedCallback = () => {
|
||||
this.store.data.forEach((item) => {
|
||||
if (this.type === '3') {
|
||||
item.showName = '告警,告警码:' + item.code
|
||||
}
|
||||
if (this.type !== '0') {
|
||||
item.subTitle = `于${item.startTime}发生${item.showName}`
|
||||
} else {
|
||||
item.subTitle =
|
||||
`于${item.startTime}发生${item.showName}。` +
|
||||
item.dataSet
|
||||
.map((item2) => {
|
||||
return (
|
||||
item2.showName +
|
||||
':' +
|
||||
(item2.value == 3.1415926 ? '-' : item2.value) +
|
||||
(item2.unit || '')
|
||||
)
|
||||
})
|
||||
.join(',')
|
||||
}
|
||||
})
|
||||
this.loading = false
|
||||
}
|
||||
this.store.reload()
|
||||
},
|
||||
jump(item) {
|
||||
let str = JSON.stringify(item).replace(/%/g, '百分比')
|
||||
uni.navigateTo({ url: '/pages/message/reportDetail?detail=' + encodeURIComponent(str) })
|
||||
if (this.type === '0') {
|
||||
let str = JSON.stringify(item).replace(/%/g, '百分比')
|
||||
uni.navigateTo({ url: '/pages/message/messageDetail?detail=' + encodeURIComponent(str) })
|
||||
} else {
|
||||
if (item.status != '1') {
|
||||
item.status = '1'
|
||||
updateStatus({
|
||||
eventIds: [item.id],
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -79,6 +154,50 @@ export default {
|
||||
|
||||
<style lang="scss">
|
||||
.content {
|
||||
.content-item {
|
||||
margin: 20rpx;
|
||||
padding: 20rpx 20rpx;
|
||||
box-shadow: rgba(0, 0, 0, 0.08) 0px 0px 6rpx 2rpx;
|
||||
border-radius: 8rpx;
|
||||
border: 1px solid #ebeef5;
|
||||
background: #fff;
|
||||
.content-item-header {
|
||||
display: flex;
|
||||
padding: 20rpx 0;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
.content-item-header-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 8rpx;
|
||||
background: $uni-theme-color;
|
||||
}
|
||||
.content-item-header-right {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
height: 100rpx;
|
||||
margin-left: 20rpx;
|
||||
.content-item-header-right-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
color: #111;
|
||||
}
|
||||
.content-item-header-right-des {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
.content-item-footer {
|
||||
margin-top: 20rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
// padding-top: 20rpx;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,11 @@
|
||||
<template slot="body">
|
||||
<view class="device">
|
||||
<view class="nav" :style="{ top: navTabHeight + 'px' }">
|
||||
<view class="nav-menu" :class="{ 'nav-menu-active': select.engineeringName }"
|
||||
@click="selectEngineering"
|
||||
>{{ select.engineeringName || '全部工程' }}
|
||||
<view
|
||||
class="nav-menu"
|
||||
:class="{ 'nav-menu-active': select.engineeringName }"
|
||||
@click="selectEngineering"
|
||||
>{{ select.engineeringName || '全部工程' }}
|
||||
<uni-icons
|
||||
type="bottom"
|
||||
size="14"
|
||||
@@ -20,8 +22,11 @@
|
||||
range-key="text"
|
||||
v-if="select.engineeringId"
|
||||
>
|
||||
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectName }"
|
||||
@click="select.selectProject = true">
|
||||
<view
|
||||
class="nav-menu"
|
||||
:class="{ 'nav-menu-active': select.projectName }"
|
||||
@click="select.selectProject = true"
|
||||
>
|
||||
{{
|
||||
select.projectName
|
||||
? select.projectName.length > 6
|
||||
@@ -50,8 +55,11 @@
|
||||
:range="projectType"
|
||||
range-key="text"
|
||||
>
|
||||
<view class="nav-menu" :class="{ 'nav-menu-active': select.runStatusName }"
|
||||
@click="select.runStatusSelect = true">
|
||||
<view
|
||||
class="nav-menu"
|
||||
:class="{ 'nav-menu-active': select.runStatusName }"
|
||||
@click="select.runStatusSelect = true"
|
||||
>
|
||||
{{
|
||||
select.runStatusName
|
||||
? select.runStatusName.length > 4
|
||||
@@ -81,24 +89,21 @@
|
||||
</picker> -->
|
||||
</view>
|
||||
<view class="content device" :style="{ minHeight: minHeight }">
|
||||
<Cn-device-card v-for="(item, index) in store.data" :device="item" :key="index">
|
||||
</Cn-device-card>
|
||||
<Cn-device-card v-for="(item, index) in store.data" :device="item" :key="index"> </Cn-device-card>
|
||||
<uni-load-more
|
||||
v-if="store.status == 'loading' || store.data.length > 0"
|
||||
v-if="store.status == 'loading' || (store.data && store.data.length > 0)"
|
||||
:status="store.status"
|
||||
></uni-load-more>
|
||||
<Cn-empty v-else></Cn-empty>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</Cn-page>
|
||||
|
||||
</template>
|
||||
<script>
|
||||
import {getProjectList} from '@/common/api/project'
|
||||
import {queryDictData} from '@/common/api/dictionary'
|
||||
import list from "@/common/js/list";
|
||||
import { getProjectList } from '@/common/api/project'
|
||||
import { queryDictData } from '@/common/api/dictionary'
|
||||
import list from '@/common/js/list'
|
||||
|
||||
export default {
|
||||
mixins: [list],
|
||||
@@ -122,24 +127,29 @@ export default {
|
||||
navTabHeight: 0,
|
||||
engineeringList: [],
|
||||
projectList: [],
|
||||
projectType: [{
|
||||
text: '全部',
|
||||
value: '',
|
||||
}, {
|
||||
text: '离线',
|
||||
value: 1
|
||||
}, {
|
||||
text: '在线',
|
||||
value: 2
|
||||
}],
|
||||
pageOptions: {}
|
||||
projectType: [
|
||||
{
|
||||
text: '全部',
|
||||
value: '',
|
||||
},
|
||||
{
|
||||
text: '离线',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
text: '在线',
|
||||
value: 2,
|
||||
},
|
||||
],
|
||||
pageOptions: {},
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
select: {
|
||||
handler(val, oldVal) {
|
||||
if (this.loading) return
|
||||
this.store.params.projectId = val.projectNameIndex === 0 ? '' : this.filterProjectList[val.projectNameIndex].value
|
||||
this.store.params.projectId =
|
||||
val.projectNameIndex === 0 ? '' : this.filterProjectList[val.projectNameIndex].value
|
||||
this.store.params.runStatus = val.runStatusIndex === 0 ? '' : this.projectType[val.runStatusIndex].value
|
||||
this.store.params.engineerId = val.engineeringId || ''
|
||||
this.store.reload()
|
||||
@@ -149,8 +159,10 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
filterProjectList() {
|
||||
return this.projectList.filter(item => item.engineeringId === this.select.engineeringId || item.value === '-1')
|
||||
}
|
||||
return this.projectList.filter(
|
||||
(item) => item.engineeringId === this.select.engineeringId || item.value === '-1',
|
||||
)
|
||||
},
|
||||
},
|
||||
onLoad(options) {
|
||||
let engineering = uni.getStorageSync('engineering')
|
||||
@@ -240,9 +252,9 @@ export default {
|
||||
return
|
||||
}
|
||||
if (this.transfer) {
|
||||
uni.navigateTo({url: '/pages/device/transfer?id=' + this.checkList.join(',')})
|
||||
uni.navigateTo({ url: '/pages/device/transfer?id=' + this.checkList.join(',') })
|
||||
} else if (this.share) {
|
||||
uni.navigateTo({url: '/pages/device/share?id=' + this.checkList.join(',')})
|
||||
uni.navigateTo({ url: '/pages/device/share?id=' + this.checkList.join(',') })
|
||||
}
|
||||
this.cancel()
|
||||
},
|
||||
@@ -255,7 +267,8 @@ export default {
|
||||
getDeviceList() {
|
||||
this.store = this.DataSource('/cs-device-boot/EquipmentDelivery/queryEquipmentByProject')
|
||||
this.store.params.engineerId = this.select.engineeringId
|
||||
this.store.params.runStatus = this.select.runStatusIndex === 0 ? '' : this.projectType[this.select.runStatusIndex].value
|
||||
this.store.params.runStatus =
|
||||
this.select.runStatusIndex === 0 ? '' : this.projectType[this.select.runStatusIndex].value
|
||||
this.store.params.pageSize = 50
|
||||
this.store.firstCallBack = (res) => {
|
||||
this.loading = false
|
||||
@@ -305,7 +318,7 @@ export default {
|
||||
})
|
||||
},
|
||||
submitFeedBack() {
|
||||
uni.navigateTo({url: '/pages/home/feedback'})
|
||||
uni.navigateTo({ url: '/pages/home/feedback' })
|
||||
},
|
||||
runStatusChange(e) {
|
||||
this.select.runStatusSelect = false
|
||||
@@ -333,7 +346,7 @@ export default {
|
||||
confirmText: '直连设备',
|
||||
cancelText: '网关接入',
|
||||
cancelColor: '#007aff',
|
||||
success: ({confirm, cancel}) => {
|
||||
success: ({ confirm, cancel }) => {
|
||||
if (confirm) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/device/new',
|
||||
@@ -362,6 +375,4 @@ export default {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
|
||||
</style>
|
||||
<style lang="scss"></style>
|
||||
|
||||
Reference in New Issue
Block a user