联调app
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
<!-- <view class="content-item-header-right-des">暂态类型:{{ item.showName }}</view> -->
|
||||
<!-- <view class="content-item-header-right-des">{{ item.subTitle }}</view> -->
|
||||
</view>
|
||||
<view class="ml10" v-if="type === '0' || item.status != '1'">🔍</view>
|
||||
<view class="ml10" v-if="type === '0' || item.status != '1'"> <uni-icons type="search" size="25"></uni-icons></view>
|
||||
</view>
|
||||
<view class="content-item-footer">{{ item.subTitle }}</view>
|
||||
</view>
|
||||
|
||||
@@ -3,16 +3,9 @@
|
||||
<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"
|
||||
<view class="nav-menu" @click="selectEngineering"
|
||||
>{{ select.engineeringName || '全部工程' }}
|
||||
<uni-icons
|
||||
type="bottom"
|
||||
size="14"
|
||||
:color="select.engineeringName ? '#376cf3' : '#666'"
|
||||
></uni-icons>
|
||||
<uni-icons type="bottom" size="14"></uni-icons>
|
||||
</view>
|
||||
<picker
|
||||
@change="projectNameChange"
|
||||
@@ -22,30 +15,16 @@
|
||||
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" @click="select.selectProject = true">
|
||||
{{
|
||||
select.projectName
|
||||
? select.projectName.length > 6
|
||||
? select.projectName.substring(0, 6) + '...'
|
||||
? select.projectName.substring(0, 12) + '...'
|
||||
: select.projectName
|
||||
: '全部项目'
|
||||
}}
|
||||
<uni-icons
|
||||
type="top"
|
||||
size="14"
|
||||
:color="select.projectName ? '#376cf3' : '#666'"
|
||||
v-if="select.selectProject"
|
||||
></uni-icons>
|
||||
<uni-icons
|
||||
type="bottom"
|
||||
size="14"
|
||||
:color="select.projectName ? '#376cf3' : '#666'"
|
||||
v-else
|
||||
></uni-icons>
|
||||
<uni-icons type="top" size="14" v-if="select.selectProject"></uni-icons>
|
||||
<uni-icons type="bottom" size="14" v-else></uni-icons>
|
||||
</view>
|
||||
</picker>
|
||||
<picker
|
||||
@@ -55,30 +34,16 @@
|
||||
:range="projectType"
|
||||
range-key="text"
|
||||
>
|
||||
<view
|
||||
class="nav-menu"
|
||||
:class="{ 'nav-menu-active': select.runStatusName }"
|
||||
@click="select.runStatusSelect = true"
|
||||
>
|
||||
<view class="nav-menu" @click="select.runStatusSelect = true">
|
||||
{{
|
||||
select.runStatusName
|
||||
? select.runStatusName.length > 4
|
||||
? select.runStatusName.substring(0, 4) + '...'
|
||||
? select.runStatusName.length > 12
|
||||
? select.runStatusName.substring(0, 12) + '...'
|
||||
: select.runStatusName
|
||||
: '全部状态'
|
||||
}}
|
||||
<uni-icons
|
||||
type="top"
|
||||
size="14"
|
||||
:color="select.runStatusName ? '#376cf3' : '#666'"
|
||||
v-if="select.runStatusSelect"
|
||||
></uni-icons>
|
||||
<uni-icons
|
||||
type="bottom"
|
||||
size="14"
|
||||
:color="select.runStatusName ? '#376cf3' : '#666'"
|
||||
v-else
|
||||
></uni-icons>
|
||||
<uni-icons type="top" size="14" v-if="select.runStatusSelect"></uni-icons>
|
||||
<uni-icons type="bottom" size="14" v-else></uni-icons>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
@@ -108,26 +73,30 @@
|
||||
</view>
|
||||
|
||||
<view class="content device" :style="{ minHeight: minHeight }">
|
||||
<Cn-device-card v-for="(item, index) in store.data" :device="item" :key="index">
|
||||
<template v-slot:title>
|
||||
<!-- 卡片标题 -->
|
||||
<uni-swipe-action>
|
||||
<uni-swipe-action-item
|
||||
v-for="(item, index) in store.data"
|
||||
:threshold="0"
|
||||
:right-options="item.isTop == 0 ? options1 : options12"
|
||||
@click="bindClick($event, item)"
|
||||
>
|
||||
<Cn-device-card :device="item" :key="index">
|
||||
<template v-slot:title>
|
||||
<!-- 卡片标题 -->
|
||||
|
||||
<switch
|
||||
v-if="transfer || share"
|
||||
:checked="checkList.indexOf(item.equipmentId) > -1"
|
||||
style="transform: scale(0.8); position: relative; left: 20rpx"
|
||||
@change="switchChange(item)"
|
||||
/>
|
||||
<view class="star-icon" v-else @click="toggleStar(item)">
|
||||
<uni-icons
|
||||
custom-prefix="custom-icon"
|
||||
:type="item.isTop == 1 ? 'star-filled' : 'star'"
|
||||
:color="item.isTop == 1 ? '#ffcc00' : ''"
|
||||
size="25"
|
||||
></uni-icons>
|
||||
</view>
|
||||
</template>
|
||||
</Cn-device-card>
|
||||
<switch
|
||||
v-if="transfer || share"
|
||||
:checked="checkList.indexOf(item.equipmentId) > -1"
|
||||
style="transform: scale(0.8); position: relative; left: 20rpx"
|
||||
@change="switchChange(item)"
|
||||
/>
|
||||
<view class="star-icon" v-else>
|
||||
<uni-icons type="search" size="25"></uni-icons>
|
||||
</view>
|
||||
</template>
|
||||
</Cn-device-card>
|
||||
</uni-swipe-action-item>
|
||||
</uni-swipe-action>
|
||||
<uni-load-more
|
||||
v-if="store.status == 'loading' || (store.data && store.data.length > 0)"
|
||||
:status="store.status"
|
||||
@@ -181,6 +150,22 @@ export default {
|
||||
},
|
||||
],
|
||||
pageOptions: {},
|
||||
options1: [
|
||||
{
|
||||
text: '置顶',
|
||||
style: {
|
||||
backgroundColor: '#376cf3',
|
||||
},
|
||||
},
|
||||
],
|
||||
options12: [
|
||||
{
|
||||
text: '取消',
|
||||
style: {
|
||||
backgroundColor: '#ccc',
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -250,10 +235,26 @@ export default {
|
||||
this.select.engineeringId = engineering.id
|
||||
this.select.engineeringName = engineering.name
|
||||
this.select.projectNameIndex = 0
|
||||
this.select.projectName = ''
|
||||
this.getProjectList()
|
||||
}
|
||||
this.store && this.store.reload()
|
||||
},
|
||||
methods: {
|
||||
bindClick(e, item) {
|
||||
engineeringPinToTop({
|
||||
targetId: item.equipmentId,
|
||||
targetType: 1,
|
||||
userId: uni.getStorageSync(this.$cacheKey.userInfo).userIndex,
|
||||
}).then((res) => {
|
||||
if (res.code == 'A0000') {
|
||||
this.$util.toast('操作成功!')
|
||||
this.store.search()
|
||||
} else {
|
||||
this.$util.toast(res.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
selectEngineering() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/home/selectEngineering?from=once',
|
||||
@@ -459,22 +460,11 @@ export default {
|
||||
this.checkList.push(e.equipmentId)
|
||||
}
|
||||
},
|
||||
toggleStar(item) {
|
||||
engineeringPinToTop({
|
||||
targetId: item.equipmentId,
|
||||
targetType: 1,
|
||||
userId: uni.getStorageSync(this.$cacheKey.userInfo).userIndex,
|
||||
}).then((res) => {
|
||||
if (res.code == 'A0000') {
|
||||
this.$util.toast('操作成功!')
|
||||
this.store.search()
|
||||
}else{
|
||||
this.$util.toast(res.message)
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang="scss"></style>
|
||||
<style lang="scss">
|
||||
/deep/ .button-group--right {
|
||||
padding: 0 0 20rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
1282
pages/device/new.vue
1282
pages/device/new.vue
File diff suppressed because it is too large
Load Diff
@@ -201,6 +201,7 @@ export default {
|
||||
this.echartsDataA1 = this.initEcharts('#DAA520', 1, 'A相(A)')
|
||||
this.echartsDataA2 = this.initEcharts('#2E8B57', 1, 'B相(A)')
|
||||
this.echartsDataA3 = this.initEcharts('#A52a2a', 1, 'C相(A)')
|
||||
this.loading = false
|
||||
this.$nextTick(() => {
|
||||
this.setMqtt(0)
|
||||
this.initMqtt()
|
||||
@@ -224,7 +225,7 @@ export default {
|
||||
}
|
||||
})
|
||||
clearInterval(this.timer)
|
||||
this.client.end()
|
||||
this.client && this.client.end()
|
||||
},
|
||||
|
||||
methods: {
|
||||
@@ -590,7 +591,7 @@ export default {
|
||||
// 刷新
|
||||
handleRefresh() {
|
||||
this.disabled = true
|
||||
this.client.end()
|
||||
this.client && this.client.end()
|
||||
this.setMqtt(1)
|
||||
this.initMqtt()
|
||||
if (this.numTimer) {
|
||||
@@ -611,7 +612,12 @@ export default {
|
||||
}, 1000)
|
||||
},
|
||||
async setMqtt(e) {
|
||||
uni.showLoading({
|
||||
title: '连接中,请稍等...',
|
||||
mask: true,
|
||||
})
|
||||
this.clear()
|
||||
|
||||
await getBaseRealData(this.lineId)
|
||||
.then((res) => {
|
||||
if (res.code == 'A0000') {
|
||||
@@ -620,7 +626,7 @@ export default {
|
||||
clearInterval(this.timer)
|
||||
this.timer = null
|
||||
}
|
||||
this.loading = false
|
||||
|
||||
this.timer = setInterval(() => {
|
||||
getBaseRealData(this.lineId).then((res) => {
|
||||
console.log(res, '获取基础实时数据')
|
||||
@@ -629,12 +635,9 @@ export default {
|
||||
} else {
|
||||
this.countdown = 60 // 重置倒计时
|
||||
this.disabled = false
|
||||
this.loading = false
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
|
||||
initMqtt() {
|
||||
@@ -852,13 +855,13 @@ export default {
|
||||
})
|
||||
},
|
||||
// 监测点变化
|
||||
lineChange(e) {
|
||||
this.clear()
|
||||
async lineChange(e) {
|
||||
await this.clear()
|
||||
this.lineKey = e.detail.value
|
||||
this.lineId = this.lineList[e.detail.value].lineId
|
||||
this.client.end()
|
||||
this.setMqtt(0)
|
||||
this.initMqtt()
|
||||
await (this.client && this.client.end())
|
||||
await this.setMqtt(0)
|
||||
await this.initMqtt()
|
||||
},
|
||||
},
|
||||
|
||||
@@ -957,6 +960,7 @@ export default {
|
||||
display: flex;
|
||||
position: relative;
|
||||
height: 600rpx;
|
||||
margin: 0 10rpx;
|
||||
flex: 1;
|
||||
.echart1 {
|
||||
position: absolute;
|
||||
@@ -967,6 +971,7 @@ export default {
|
||||
.chart {
|
||||
width: 170rpx;
|
||||
height: 200rpx;
|
||||
margin-bottom: 5rpx;
|
||||
}
|
||||
.text {
|
||||
text-align: center;
|
||||
|
||||
Reference in New Issue
Block a user