提交app代码

This commit is contained in:
guanj
2026-04-01 10:00:04 +08:00
parent 66cee2922d
commit 966d6d342c
12 changed files with 234 additions and 149 deletions

View File

@@ -182,6 +182,7 @@ export default {
engineeringName: '', engineeringName: '',
equipmentName: '', equipmentName: '',
runStatus: 1, runStatus: 1,
connection: false,
} }
}, },
onLoad(options) { onLoad(options) {
@@ -617,10 +618,11 @@ export default {
mask: true, mask: true,
}) })
this.clear() this.clear()
this.connection = false
await getBaseRealData(this.lineId) await getBaseRealData(this.lineId)
.then((res) => { .then((res) => {
if (res.code == 'A0000') { if (res.code == 'A0000') {
this.connection = true
this.$util.toast(e == 0 ? '连接成功!' : '刷新成功!') this.$util.toast(e == 0 ? '连接成功!' : '刷新成功!')
if (this.timer) { if (this.timer) {
clearInterval(this.timer) clearInterval(this.timer)
@@ -628,16 +630,24 @@ export default {
} }
this.timer = setInterval(() => { this.timer = setInterval(() => {
getBaseRealData(this.lineId).then((res) => { getBaseRealData(this.lineId)
.then((res) => {
this.connection = true
console.log(res, '获取基础实时数据') console.log(res, '获取基础实时数据')
}) })
.catch(() => {
this.connection = false
this.clear()
})
}, 30000) }, 30000)
} else {
this.countdown = 60 // 重置倒计时
this.disabled = false
} }
}) })
.catch(() => {}) .catch(() => {
this.countdown = 60 // 重置倒计时
this.disabled = false
this.connection = false
this.clear()
})
}, },
initMqtt() { initMqtt() {
@@ -690,6 +700,8 @@ export default {
.on('message', (topic, message) => { .on('message', (topic, message) => {
// console.log('接收推送信息:', JSON.parse(message.toString()), topic) // console.log('接收推送信息:', JSON.parse(message.toString()), topic)
// console.log('🚀 ~ .on ~ topic:', topic) // console.log('🚀 ~ .on ~ topic:', topic)
if (!this.connection) return
if (topic === `/Web/RealData/${this.userInfo.userIndex}`) { if (topic === `/Web/RealData/${this.userInfo.userIndex}`) {
let list = JSON.parse(message.toString()) let list = JSON.parse(message.toString())
if (list.lineId == this.lineId) { if (list.lineId == this.lineId) {
@@ -857,6 +869,9 @@ export default {
// 监测点变化 // 监测点变化
async lineChange(e) { async lineChange(e) {
await this.clear() await this.clear()
this.disabled = false
this.countdown = 60
this.lineKey = e.detail.value this.lineKey = e.detail.value
this.lineId = this.lineList[e.detail.value].lineId this.lineId = this.lineList[e.detail.value].lineId
await (this.client && this.client.end()) await (this.client && this.client.end())

View File

@@ -152,6 +152,7 @@ export default {
uni.setStorageSync('messageParams', { uni.setStorageSync('messageParams', {
name: item.engineeringName, name: item.engineeringName,
id: item.engineeringId, id: item.engineeringId,
type: '',
}) })
uni.switchTab({ uni.switchTab({
url: '/pages/index/message1', url: '/pages/index/message1',

View File

@@ -53,7 +53,7 @@
<view style="padding: 20rpx 20rpx 0"> <view style="padding: 20rpx 20rpx 0">
<Cn-grid title="" :auto-fill="false"> <Cn-grid title="" :auto-fill="false">
<Cn-grid-item src="/static/device2.png" text="设备注册" @click="registerDevice(4)"></Cn-grid-item> <Cn-grid-item src="/static/device2.png" text="设备注册" @click="registerDevice(4)"></Cn-grid-item>
<Cn-grid-item <!-- <Cn-grid-item
src="/static/device2.png" src="/static/device2.png"
text="功能调试" text="功能调试"
@click="registerDevice(2)" @click="registerDevice(2)"
@@ -64,12 +64,12 @@
text="出厂调试" text="出厂调试"
@click="registerDevice(3)" @click="registerDevice(3)"
v-if="config.factory" v-if="config.factory"
></Cn-grid-item> ></Cn-grid-item> -->
<Cn-grid-item background="#fff" v-if="!config.feature"></Cn-grid-item> <!-- <Cn-grid-item background="#fff" v-if="!config.feature"></Cn-grid-item>
<Cn-grid-item background="#fff" v-if="!config.factory"></Cn-grid-item> <Cn-grid-item background="#fff" v-if="!config.factory"></Cn-grid-item> -->
<Cn-grid-item background="#fff"></Cn-grid-item>
<Cn-grid-item background="#fff"></Cn-grid-item>
<Cn-grid-item background="#fff"></Cn-grid-item> <Cn-grid-item background="#fff"></Cn-grid-item>
<!-- <Cn-grid-item background="#fff"></Cn-grid-item>
<Cn-grid-item background="#fff"></Cn-grid-item> -->
<!-- <Cn-grid-item src="/static/gateway2.png" text="网关注册" @click="registerGateway"></Cn-grid-item> --> <!-- <Cn-grid-item src="/static/gateway2.png" text="网关注册" @click="registerGateway"></Cn-grid-item> -->
<!-- <Cn-grid-item src="/static/feedback2.png" text="问题反馈" @click="submitFeedBack"></Cn-grid-item>--> <!-- <Cn-grid-item src="/static/feedback2.png" text="问题反馈" @click="submitFeedBack"></Cn-grid-item>-->
</Cn-grid> </Cn-grid>

View File

@@ -34,6 +34,14 @@
<view class="header-item-value">{{ devCount.currentOffLineDevCount || 0 }}</view> <view class="header-item-value">{{ devCount.currentOffLineDevCount || 0 }}</view>
<view class="header-item-label">离线设备</view> <view class="header-item-label">离线设备</view>
</view> </view>
<view class="header-item" @click="jumpMessage('0')">
<view class="header-item-value">{{ devCount.eventCount || 0 }}</view>
<view class="header-item-label">暂态事件</view>
</view>
<view class="header-item" @click="jumpMessage('1')">
<view class="header-item-value">{{ devCount.harmonicCount || 0 }}</view>
<view class="header-item-label">稳态事件</view>
</view>
</view> </view>
<view class="canneng-index-title mt20">常用功能</view> <view class="canneng-index-title mt20">常用功能</view>
<view style="padding: 20rpx 20rpx 0"> <view style="padding: 20rpx 20rpx 0">
@@ -134,6 +142,16 @@ export default {
url: '/pages/device/list?type=' + type, url: '/pages/device/list?type=' + type,
}) })
}, },
jumpMessage(type) {
uni.setStorageSync('messageParams', {
name:'',
id: '',
type: type,
})
uni.switchTab({
url: '/pages/index/message1',
})
},
}, },
} }
</script> </script>

View File

@@ -22,7 +22,7 @@
refresher-enabled="true" refresher-enabled="true"
class="event-list mt20" class="event-list mt20"
v-if="eventList.length != 0" v-if="eventList.length != 0"
:style="{ height: 'calc(100vh - ' + height + 'px)', overflow: 'auto' }" :style="{ height: 'calc(100vh - ' + (navHeight + height) + 'px)', overflow: 'auto' }"
> >
<!-- 循环渲染事件项 --> <!-- 循环渲染事件项 -->
<uni-card class="event-item" :class="item.type" v-for="(item, index) in store.data" :key="index"> <uni-card class="event-item" :class="item.type" v-for="(item, index) in store.data" :key="index">
@@ -106,10 +106,10 @@ export default {
.boundingClientRect((rect) => { .boundingClientRect((rect) => {
// //
// #ifdef H5 // #ifdef H5
this.height = rect?.height + 130 || 0 this.height = rect?.height + 20 || 0
// #endif // #endif
// #ifdef APP-PLUS // #ifdef APP-PLUS
this.height = rect?.height + 75 || 0 this.height = rect?.height + 30 || 0
// #endif // #endif
}) })
.exec() .exec()
@@ -157,7 +157,8 @@ export default {
startTime: item.startTime, startTime: item.startTime,
time: '', time: '',
timeType: this.selectValue.report, timeType: this.selectValue.report,
}).then((res) => { })
.then((res) => {
// 下载文件资源到本地 // 下载文件资源到本地
uni.downloadFile({ uni.downloadFile({
url: res.data, // 后端返回的线上文件路径 url: res.data, // 后端返回的线上文件路径
@@ -199,7 +200,7 @@ export default {
console.log('下载成功') console.log('下载成功')
} else { } else {
uni.showToast({ uni.showToast({
icon: 'error', icon: 'none',
mask: true, mask: true,
title: '下载失败!', title: '下载失败!',
duration: 1000, duration: 1000,
@@ -209,6 +210,14 @@ export default {
fail: function (res) {}, fail: function (res) {},
}) })
}) })
.catch((err) => {
uni.showToast({
icon: 'none',
mask: true,
title: err.message,
duration: 1000,
})
})
}, },
// 下拉 // 下拉
refresherrefresh() { refresherrefresh() {

View File

@@ -208,7 +208,8 @@ export default {
}) })
downloadEventReport({ downloadEventReport({
id: item.eventId, id: item.eventId,
}).then((res) => { })
.then((res) => {
// 下载文件资源到本地 // 下载文件资源到本地
uni.downloadFile({ uni.downloadFile({
url: res.data, // 后端返回的线上文件路径 url: res.data, // 后端返回的线上文件路径
@@ -250,7 +251,7 @@ export default {
console.log('下载成功') console.log('下载成功')
} else { } else {
uni.showToast({ uni.showToast({
icon: 'error', icon: 'none',
mask: true, mask: true,
title: '下载失败!', title: '下载失败!',
duration: 1000, duration: 1000,
@@ -260,6 +261,14 @@ export default {
fail: function (res) {}, fail: function (res) {},
}) })
}) })
.catch((err) => {
uni.showToast({
icon: 'none',
mask: true,
title: err.message,
duration: 1000,
})
})
}, },
}, },
watch: {}, watch: {},

View File

@@ -271,6 +271,22 @@ export default {
this.init() this.init()
} }
}, },
mounted() {
uni.setTabBarItem({
index: 2,
visible: true,
})
if (uni.getStorageSync(this.$cacheKey.userInfo).authorities === 'tourist') {
uni.setTabBarItem({
index: 2,
visible: false,
})
uni.showToast({
title: '已同步设备历史数据',
icon: 'none',
})
}
},
} }
</script> </script>
<style lang="scss"> <style lang="scss">

View File

@@ -117,10 +117,15 @@ export default {
}, },
onShow() { onShow() {
if (uni.getStorageSync(this.$cacheKey.userInfo).authorities === 'operation_manager') {
this.items = ['暂态事件', '稳态事件', '运行告警', '运行事件']
}
const params = uni.getStorageSync('messageParams') const params = uni.getStorageSync('messageParams')
console.log('🚀 ~ params:', params)
this.getDevCount() this.getDevCount()
this.$nextTick(() => { this.$nextTick(() => {
if (params.type != '') {
this.current = params.type - 0
}
if (params.name != '') { if (params.name != '') {
this.$refs.cnFilterCriteria && this.$refs.cnFilterCriteria.external(params.name, params.id) this.$refs.cnFilterCriteria && this.$refs.cnFilterCriteria.external(params.name, params.id)
} }
@@ -133,6 +138,7 @@ export default {
uni.setStorageSync('messageParams', { uni.setStorageSync('messageParams', {
name: '', name: '',
id: '', id: '',
type: '',
}) })
}, },
methods: { methods: {
@@ -244,9 +250,13 @@ export default {
position: relative; position: relative;
background-color: #fff; background-color: #fff;
.segmented-control { .segmented-control {
height: 49px; // height: 40px;
background-color: #fff; background-color: #fff;
border-bottom: 1px solid #cccccc70; border-bottom: 1px solid #cccccc70;
.segmented-control__item {
align-items: baseline;
margin-top: 5px;
}
} }
.segmented-control__text { .segmented-control__text {
@@ -255,6 +265,7 @@ export default {
} }
.segmented-control__item--text { .segmented-control__item--text {
font-weight: bold; font-weight: bold;
padding: 0 0 5rpx;
} }
.choose { .choose {
// padding: 20rpx; // padding: 20rpx;

View File

@@ -10,7 +10,6 @@
@clickItem="onClickItem" @clickItem="onClickItem"
/> />
</view> </view>
</view> </view>
<!-- 稳态报表 --> <!-- 稳态报表 -->
<SteadyState <SteadyState
@@ -102,7 +101,7 @@ export default {
this.navHeight = rect.height + 65 this.navHeight = rect.height + 65
// #endif // #endif
// #ifdef APP-PLUS // #ifdef APP-PLUS
this.navHeight = rect.height + 10 this.navHeight = rect.height + 25
// #endif // #endif
}) })
.exec() .exec()
@@ -115,7 +114,6 @@ export default {
} }
}, },
scrolltolower() { scrolltolower() {
if (this.total != this.indexList.length) { if (this.total != this.indexList.length) {
this.status = 'loading' this.status = 'loading'
@@ -153,10 +151,14 @@ export default {
width: 80% !important; width: 80% !important;
} }
/deep/.tabsBox { /deep/.tabsBox {
border-bottom: 1px solid #cccccc70;
.segmented-control { .segmented-control {
height: 49px; // height: 40px;
background-color: #fff; background-color: #fff;
border-bottom: 1px solid #cccccc70;
.segmented-control__item {
align-items: baseline;
margin-top: 5px;
}
} }
.segmented-control__text { .segmented-control__text {
@@ -165,6 +167,7 @@ export default {
} }
.segmented-control__item--text { .segmented-control__item--text {
font-weight: bold; font-weight: bold;
padding: 0 0 5rpx;
} }
} }
} }

View File

@@ -51,13 +51,7 @@
</uni-collapse-item> </uni-collapse-item>
</uni-collapse> --> </uni-collapse> -->
<view class="event-list"> <view class="event-list">
<uni-card <uni-card class="event-item" :class="item.type" v-for="(item, index) in list" :key="index">
class="event-item"
:class="item.type"
v-for="(item, index) in list"
:key="index"
@click="jump(item)"
>
<!-- 头部图标 + 信息 + 操作 --> <!-- 头部图标 + 信息 + 操作 -->
<view class="event-header"> <view class="event-header">
<view class="event-icon"> <view class="event-icon">
@@ -83,13 +77,17 @@
</view> </view>
<!-- 详情区域 --> <!-- 详情区域 -->
<view class="event-detail"> <view class="event-detail">
<uni-collapse accordion> <uni-collapse>
<uni-collapse-item <uni-collapse-item
:title=" :title="
item.interruptCounts == 0 ? '通讯正常' : `通讯中断 ${item.interruptCounts} 次` item.interruptCounts == 0 ? '通讯正常' : `通讯中断 ${item.interruptCounts} 次`
" "
> >
<view v-for="date in item.interruptDetails" class="textBox mb10">{{ date }}</view> <view
v-for="date in String(item.interruptDetails || '').split('')"
class="textBox mb10"
>{{ date }}</view
>
</uni-collapse-item> </uni-collapse-item>
<uni-collapse-item <uni-collapse-item
:title=" :title="
@@ -185,9 +183,11 @@ export default {
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
font-size: 26rpx; font-size: 26rpx;
color: #666666; color: #666666;
text-indent: 2em;
} }
.event-list { .event-list {
background: #fff; background: #fff;
padding-bottom: 10rpx;
.event-icon { .event-icon {
width: 90rpx; width: 90rpx;
height: 90rpx; height: 90rpx;

View File

@@ -11,9 +11,12 @@
<view class="mb5"> 项目名称{{ detail.projectName }} </view> <view class="mb5"> 项目名称{{ detail.projectName }} </view>
<view class="mb5"> 工程名称{{ detail.engineeringName }} </view> <view class="mb5"> 工程名称{{ detail.engineeringName }} </view>
<view class="mb5"> 暂态类型{{ detail.showName }}</view> <view class="mb5"> 暂态类型{{ detail.showName }}</view>
<view class="mb5" v-for="(item, textIndex) in detail.dataSet" :key="textIndex"> <view class="mb5"> 持续时间{{ detail.evtParamTm }}</view>
<view class="mb5"> 幅值{{ detail.evtParamVVaDepth }}</view>
<view class="mb5"> 相别{{ detail.evtParamPhase }}</view>
<!-- <view class="mb5" v-for="(item, textIndex) in detail.dataSet" :key="textIndex">
{{ item.showName + '' + (item.value == 3.1415926 ? '-' : item.value) + (item.unit || '') }} {{ item.showName + '' + (item.value == 3.1415926 ? '-' : item.value) + (item.unit || '') }}
</view> </view> -->
</view> </view>
<view class="detail-content"> <view class="detail-content">
<view class="detail-content-title mb20">瞬时波形图</view> <view class="detail-content-title mb20">瞬时波形图</view>