diff --git a/pages.json b/pages.json index 1adc2a6..643c880 100644 --- a/pages.json +++ b/pages.json @@ -515,11 +515,11 @@ "text": "消息" }, { - "pagePath": "pages/index/report", - "iconPath": "static/reportIco.png", - "selectedIconPath": "static/reportIco1.png", - "text": "报表" - }, + "pagePath": "pages/index/report", + "iconPath": "static/reportIco.png", + "selectedIconPath": "static/reportIco1.png", + "text": "报表" + }, { "pagePath": "pages/index/mine", "iconPath": "static/mine.png", diff --git a/pages/device/realTime/index.vue b/pages/device/realTime/index.vue index 86f4f82..f057d26 100644 --- a/pages/device/realTime/index.vue +++ b/pages/device/realTime/index.vue @@ -182,6 +182,7 @@ export default { engineeringName: '', equipmentName: '', runStatus: 1, + connection: false, } }, onLoad(options) { @@ -617,10 +618,11 @@ export default { mask: true, }) this.clear() - + this.connection = false await getBaseRealData(this.lineId) .then((res) => { if (res.code == 'A0000') { + this.connection = true this.$util.toast(e == 0 ? '连接成功!' : '刷新成功!') if (this.timer) { clearInterval(this.timer) @@ -628,16 +630,24 @@ export default { } this.timer = setInterval(() => { - getBaseRealData(this.lineId).then((res) => { - console.log(res, '获取基础实时数据') - }) + getBaseRealData(this.lineId) + .then((res) => { + this.connection = true + console.log(res, '获取基础实时数据') + }) + .catch(() => { + this.connection = false + this.clear() + }) }, 30000) - } else { - this.countdown = 60 // 重置倒计时 - this.disabled = false } }) - .catch(() => {}) + .catch(() => { + this.countdown = 60 // 重置倒计时 + this.disabled = false + this.connection = false + this.clear() + }) }, initMqtt() { @@ -690,6 +700,8 @@ export default { .on('message', (topic, message) => { // console.log('接收推送信息:', JSON.parse(message.toString()), topic) // console.log('🚀 ~ .on ~ topic:', topic) + if (!this.connection) return + if (topic === `/Web/RealData/${this.userInfo.userIndex}`) { let list = JSON.parse(message.toString()) if (list.lineId == this.lineId) { @@ -857,6 +869,9 @@ export default { // 监测点变化 async lineChange(e) { await this.clear() + this.disabled = false + this.countdown = 60 + this.lineKey = e.detail.value this.lineId = this.lineList[e.detail.value].lineId await (this.client && this.client.end()) diff --git a/pages/index/comp/engineering.vue b/pages/index/comp/engineering.vue index 120fef5..454c549 100644 --- a/pages/index/comp/engineering.vue +++ b/pages/index/comp/engineering.vue @@ -152,6 +152,7 @@ export default { uni.setStorageSync('messageParams', { name: item.engineeringName, id: item.engineeringId, + type: '', }) uni.switchTab({ url: '/pages/index/message1', diff --git a/pages/index/comp/indexGongCheng.vue b/pages/index/comp/indexGongCheng.vue index 2d9d86b..3ee91a8 100644 --- a/pages/index/comp/indexGongCheng.vue +++ b/pages/index/comp/indexGongCheng.vue @@ -53,7 +53,7 @@ - - - + > --> + + + - diff --git a/pages/index/comp/indexZhuYongHu.vue b/pages/index/comp/indexZhuYongHu.vue index 2fd7088..88fa145 100644 --- a/pages/index/comp/indexZhuYongHu.vue +++ b/pages/index/comp/indexZhuYongHu.vue @@ -34,6 +34,14 @@ {{ devCount.currentOffLineDevCount || 0 }} 离线设备 + + {{ devCount.eventCount || 0 }} + 暂态事件 + + + {{ devCount.harmonicCount || 0 }} + 稳态事件 + 常用功能 @@ -113,9 +121,9 @@ export default { }, confirm(value) { // if (this.devCount.engineeringListLength > 0) { - uni.navigateTo({ - url: '/pages/device/new?type=4', - }) + uni.navigateTo({ + url: '/pages/device/new?type=4', + }) // } else { // uni.navigateTo({ // url: '/pages/engineering/new?from=index', @@ -134,6 +142,16 @@ export default { url: '/pages/device/list?type=' + type, }) }, + jumpMessage(type) { + uni.setStorageSync('messageParams', { + name:'', + id: '', + type: type, + }) + uni.switchTab({ + url: '/pages/index/message1', + }) + }, }, } diff --git a/pages/index/comp/steadyState.vue b/pages/index/comp/steadyState.vue index 57f84ce..ae19e43 100644 --- a/pages/index/comp/steadyState.vue +++ b/pages/index/comp/steadyState.vue @@ -22,7 +22,7 @@ refresher-enabled="true" class="event-list mt20" v-if="eventList.length != 0" - :style="{ height: 'calc(100vh - ' + height + 'px)', overflow: 'auto' }" + :style="{ height: 'calc(100vh - ' + (navHeight + height) + 'px)', overflow: 'auto' }" > @@ -106,10 +106,10 @@ export default { .boundingClientRect((rect) => { // // #ifdef H5 - this.height = rect?.height + 130 || 0 + this.height = rect?.height + 20 || 0 // #endif // #ifdef APP-PLUS - this.height = rect?.height + 75 || 0 + this.height = rect?.height + 30 || 0 // #endif }) .exec() @@ -157,58 +157,67 @@ export default { startTime: item.startTime, time: '', timeType: this.selectValue.report, - }).then((res) => { - // 下载文件资源到本地 - uni.downloadFile({ - url: res.data, // 后端返回的线上文件路径 - success: function (res) { - if (res.statusCode === 200) { - // 文件到本地 - uni.saveFile({ - tempFilePath: res.tempFilePath, //临时路径 - success: function (data) { - var savedFilePath = data.savedFilePath - // 在app端执行 - // #ifdef APP-PLUS - let osname = plus.os.name - // 如果是安卓的话弹出提示 - - uni.showToast({ - icon: 'success', - mask: true, - title: '下载成功!', - duration: 1000, - }) - - // #endif - //ios手机直接打开文件,手动存储文件到手机,Android手机从根目录创建文件夹,保存文件并改名 - setTimeout(() => { - //打开文档查看 - uni.openDocument({ - filePath: data.savedFilePath, - success: function (ress) { - console.log('成功打开文件') - }, - fail() { - console.log('打开文件失败') - }, - }) - }, 500) - }, - }) - console.log('下载成功') - } else { - uni.showToast({ - icon: 'error', - mask: true, - title: '下载失败!', - duration: 1000, - }) - } - }, - fail: function (res) {}, - }) }) + .then((res) => { + // 下载文件资源到本地 + uni.downloadFile({ + url: res.data, // 后端返回的线上文件路径 + success: function (res) { + if (res.statusCode === 200) { + // 文件到本地 + uni.saveFile({ + tempFilePath: res.tempFilePath, //临时路径 + success: function (data) { + var savedFilePath = data.savedFilePath + // 在app端执行 + // #ifdef APP-PLUS + let osname = plus.os.name + // 如果是安卓的话弹出提示 + + uni.showToast({ + icon: 'success', + mask: true, + title: '下载成功!', + duration: 1000, + }) + + // #endif + //ios手机直接打开文件,手动存储文件到手机,Android手机从根目录创建文件夹,保存文件并改名 + setTimeout(() => { + //打开文档查看 + uni.openDocument({ + filePath: data.savedFilePath, + success: function (ress) { + console.log('成功打开文件') + }, + fail() { + console.log('打开文件失败') + }, + }) + }, 500) + }, + }) + console.log('下载成功') + } else { + uni.showToast({ + icon: 'none', + mask: true, + title: '下载失败!', + duration: 1000, + }) + } + }, + fail: function (res) {}, + }) + }) + .catch((err) => { + uni.showToast({ + icon: 'none', + mask: true, + title: err.message, + duration: 1000, + }) + }) }, // 下拉 refresherrefresh() { @@ -233,7 +242,7 @@ export default { .event-tags { display: flex; font-size: 27rpx !important ; - line-height: 50rpx; + line-height: 50rpx; } .event-detail { diff --git a/pages/index/comp/transient.vue b/pages/index/comp/transient.vue index add69cc..5d3be6b 100644 --- a/pages/index/comp/transient.vue +++ b/pages/index/comp/transient.vue @@ -208,58 +208,67 @@ export default { }) downloadEventReport({ id: item.eventId, - }).then((res) => { - // 下载文件资源到本地 - uni.downloadFile({ - url: res.data, // 后端返回的线上文件路径 - success: function (res) { - if (res.statusCode === 200) { - // 文件到本地 - uni.saveFile({ - tempFilePath: res.tempFilePath, //临时路径 - success: function (data) { - var savedFilePath = data.savedFilePath - // 在app端执行 - // #ifdef APP-PLUS - let osname = plus.os.name - // 如果是安卓的话弹出提示 - - uni.showToast({ - icon: 'success', - mask: true, - title: '下载成功!', - duration: 1000, - }) - - // #endif - //ios手机直接打开文件,手动存储文件到手机,Android手机从根目录创建文件夹,保存文件并改名 - setTimeout(() => { - //打开文档查看 - uni.openDocument({ - filePath: data.savedFilePath, - success: function (ress) { - console.log('成功打开文件') - }, - fail() { - console.log('打开文件失败') - }, - }) - }, 500) - }, - }) - console.log('下载成功') - } else { - uni.showToast({ - icon: 'error', - mask: true, - title: '下载失败!', - duration: 1000, - }) - } - }, - fail: function (res) {}, - }) }) + .then((res) => { + // 下载文件资源到本地 + uni.downloadFile({ + url: res.data, // 后端返回的线上文件路径 + success: function (res) { + if (res.statusCode === 200) { + // 文件到本地 + uni.saveFile({ + tempFilePath: res.tempFilePath, //临时路径 + success: function (data) { + var savedFilePath = data.savedFilePath + // 在app端执行 + // #ifdef APP-PLUS + let osname = plus.os.name + // 如果是安卓的话弹出提示 + + uni.showToast({ + icon: 'success', + mask: true, + title: '下载成功!', + duration: 1000, + }) + + // #endif + //ios手机直接打开文件,手动存储文件到手机,Android手机从根目录创建文件夹,保存文件并改名 + setTimeout(() => { + //打开文档查看 + uni.openDocument({ + filePath: data.savedFilePath, + success: function (ress) { + console.log('成功打开文件') + }, + fail() { + console.log('打开文件失败') + }, + }) + }, 500) + }, + }) + console.log('下载成功') + } else { + uni.showToast({ + icon: 'none', + mask: true, + title: '下载失败!', + duration: 1000, + }) + } + }, + fail: function (res) {}, + }) + }) + .catch((err) => { + uni.showToast({ + icon: 'none', + mask: true, + title: err.message, + duration: 1000, + }) + }) }, }, watch: {}, diff --git a/pages/index/index.vue b/pages/index/index.vue index 296b77b..543c877 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -44,7 +44,7 @@