提交app

This commit is contained in:
guanj
2026-04-13 10:12:04 +08:00
parent db097bc64a
commit bac0f83f64
26 changed files with 2344 additions and 1901 deletions

204
App.vue
View File

@@ -4,6 +4,7 @@ import { getImageUrl } from '@/common/api/basic'
export default { export default {
onLaunch: function () { onLaunch: function () {
// this.checkAppUpdate()
// uni.onPushMessage((res) => { // uni.onPushMessage((res) => {
// console.log("收到推送消息:",res) //监听推送消息 // console.log("收到推送消息:",res) //监听推送消息
// }) // })
@@ -39,6 +40,209 @@ export default {
onHide: function () { onHide: function () {
console.log('App Hide') console.log('App Hide')
}, },
methods: {
// 1. 检查应用更新(已分平台:安卓 + iOS
checkAppUpdate() {
// 开发环境跳过检查
const isDev = process.env.NODE_ENV === 'development'
if (isDev) {
return console.log('开发环境,不执行更新检查')
}
let isforce = 1
// uni.showModal({
// title: '更新提示',
// content: '发现新版本,是否立即更新?',
// showCancel: isforce == '0', // 强制更新隐藏取消按钮
// confirmText: '去更新',
// success: (modalRes) => {
// if (modalRes.confirm) {
// this.downloadAndInstallApk('http://112.4.144.18:8040/shiningCloud/file/canneng_wulian.apk')
// } else {
// }
// },
// })
// 获取当前应用信息
plus.runtime.getProperty(plus.runtime.appid, (info) => {
const currentVersion = info.version // 当前本地版本号
// 调用 API 获取服务器上的最新版本信息
getLastestVersion()
.then((res) => {
if (!res.data) {
return
}
const { version, appFileList, iosUrl } = res?.data || {}
// let isforce = 1
// 版本不一样才更新
if (currentVersion != version) {
// ==============================================
// 🔴 关键:判断手机系统(安卓 / iOS
// ==============================================
const isAndroid = plus.os.name === 'Android'
const isIos = plus.os.name === 'iOS'
// ----------------------
// ① iOS跳 App Store
// ----------------------
if (isIos) {
uni.showModal({
title: '更新提示',
content: '发现新版本,请前往 App Store 更新',
showCancel: isforce === '0', // 强制更新隐藏取消按钮
confirmText: '去更新',
success: (modalRes) => {
if (modalRes.confirm) {
// 跳转到 App Store 链接
plus.runtime.openURL(iosUrl)
// 强制更新:退出 App
if (isforce !== '0') {
plus.runtime.quit()
}
} else {
// 不更新直接退出 App强制
if (isforce !== '0') {
plus.runtime.quit()
}
}
},
})
return
}
// ----------------------
// ② Android下载安装
// ----------------------
if (isAndroid) {
uni.showModal({
title: '更新提示',
content: '发现新版本,是否立即更新?',
showCancel: isforce === '0', // 强制更新隐藏取消按钮
confirmText: '去更新',
success: (modalRes) => {
if (modalRes.confirm) {
// 跳转到 App Store 链接
this.downloadAndInstallApk(appFileList[0].filePath)
}
},
})
return
}
}
})
.catch((err) => {
console.log('获取版本接口失败', err)
})
})
},
// 2. 安卓专用:下载并安装 APK
downloadAndInstallApk(url) {
// 防止重复点击下载
if (this.downloadLoading) return
this.downloadLoading = true
uni.showLoading({
title: '正在下载更新...',
mask: true, // 加遮罩,防止重复点
})
// 下载配置(修复路径、覆盖安装)
const options = {
filename: '_doc/update/canneng_wulian.apk', // 固定文件名,更稳定
timeout: 120, // 超时时间
}
// 创建下载任务
const downloadTask = plus.downloader.createDownload(url, options, (downloadedFile, status) => {
this.downloadLoading = false
uni.hideLoading()
if (status === 200) {
// 开始安装
plus.runtime.install(
downloadedFile.filename,
{
force: true, // 强制覆盖安装
},
() => {
uni.showModal({
title: '安装成功',
content: '请重启APP',
showCancel: false,
confirmText: '确定',
success() {
plus.runtime.restart()
},
})
},
(e) => {
console.error('安装失败', e)
uni.showModal({
title: '安装失败',
content: '请开启安装权限后重试:' + e.message,
confirmText: '重试',
success: () => {
this.downloadAndInstallApk(url)
},
})
},
)
} else {
uni.showModal({
title: '下载失败',
content: '网络异常或下载链接失效',
confirmText: '重试',
success: () => {
this.downloadAndInstallApk(url)
},
})
}
})
// 下载进度(优化体验)
downloadTask.addEventListener('statechanged', (task) => {
if (task.state === 3 && task.totalSize > 0) {
const percent = ((task.downloadedSize / task.totalSize) * 100).toFixed(0)
uni.showLoading({
title: `正在下载更新 ${percent}%`,
mask: true,
})
}
})
// 开始下载
downloadTask.start()
},
// downloadAndInstallApk(url) {
// uni.showLoading({ title: '下载新版本...' })
// const downloadTask = plus.downloader.createDownload(
// url,
// { filename: '_doc/update/' },
// (downloadedFile, status) => {
// uni.hideLoading()
// if (status === 200) {
// plus.runtime.install(
// downloadedFile.filename,
// { force: true },
// () => {
// // 安装成功
// },
// (e) => {
// uni.showToast({ title: '安装失败: ' + e.message, icon: 'none' })
// },
// )
// } else {
// uni.showToast({ title: '下载失败', icon: 'none' })
// }
// },
// )
// downloadTask.start()
// },
},
} }
</script> </script>

View File

@@ -1,7 +1,7 @@
const debug = true // true 是连地服务端本地false 是连接线上 const debug = true // true 是连地服务端本地false 是连接线上
const development = { const development = {
domain: 'http://192.168.2.126:10215', domain: 'http://192.168.1.103:10215',
} }
const production = { const production = {

View File

@@ -228,8 +228,8 @@ export default {
// 在线 // 在线
.zx-tag { .zx-tag {
background-color: #67c23a20; background-color: #10b98120;
color: #67c23a; color: #10b981;
} }
.lx-tag { .lx-tag {
background-color: #ff3b3020; background-color: #ff3b3020;

View File

@@ -20,7 +20,7 @@
class="uni-input" class="uni-input"
radius="5" radius="5"
placeholder="请输入关键字搜索" placeholder="请输入关键字搜索"
clearButton="none" clearButton="none"
@input="input" @input="input"
/> />
@@ -212,6 +212,12 @@ export default {
} }
}) })
this._hide() this._hide()
console.log('🚀 ~ rt:', rt)
if (rt.length == 0) return
if (this.singleChoice) {
if (rt[0].rank != 3) return
}
this.$emit('confirm', rt) this.$emit('confirm', rt)
}, },
//扁平化树结构 //扁平化树结构

View File

@@ -139,7 +139,7 @@
"/api" : { "/api" : {
"https" : true, "https" : true,
// "target" : "https://pqmcn.com:8092/api", // "target" : "https://pqmcn.com:8092/api",
"target" : "http://192.168.2.126:10215", "target" : "http://192.168.1.103:10215",
"changOrigin" : true, "changOrigin" : true,
"pathRewrite" : { "pathRewrite" : {
"/api" : "" "/api" : ""

View File

@@ -46,7 +46,13 @@
{ {
"path": "pages/index/report", "path": "pages/index/report",
"style": { "style": {
"navigationBarTitleText": "报表" "navigationBarTitleText": "报表",
"enablePullDownRefresh": true, // 开启下拉刷新
"pullToRefresh": {
"support":true,
"style": "circle",
"color":"#007aff"
}
} }
}, },
{ {
@@ -161,7 +167,12 @@
"path": "pages/device/APF/detail", "path": "pages/device/APF/detail",
"style": { "style": {
"navigationBarTitleText": "APF 设备名称 + 型号", "navigationBarTitleText": "APF 设备名称 + 型号",
"enablePullDownRefresh": true "enablePullDownRefresh": true,
"pullToRefresh": {
"support":true,
"style": "circle",
"color":"#007aff"
}
} }
}, },
{ {

View File

@@ -1,151 +1,164 @@
<template> <template>
<view class="basic"> <view>
<view class="grid-card"> <uni-load-more status="loading" v-if="IOData.length == 0"></uni-load-more>
<view class="grid-card-title">温度</view> <view class="basic" v-else>
<view class="grid-card-content-4"> <view class="grid-card">
<template v-for="item in renderData"> <view class="grid-card-title">温度</view>
<view class="item item-title">{{ item[0].clDid }} <view class="grid-card-content-4">
<template v-if="item[0].clDid"> (°C)</template> <template v-for="item in renderData">
</view> <view class="item item-title"
<view class="item item-title">{{ item[1].clDid }} >{{ item[0].clDid }}
<template v-if="item[1].clDid"> (°C)</template> <template v-if="item[0].clDid"> (°C)</template>
</view> </view>
<view class="item item-title">{{ item[2].clDid }} <view class="item item-title"
<template v-if="item[2].clDid"> (°C)</template> >{{ item[1].clDid }}
</view> <template v-if="item[1].clDid"> (°C)</template>
<view class="item item-title">{{ item[3].clDid }} </view>
<template v-if="item[3].clDid"> (°C)</template> <view class="item item-title"
</view> >{{ item[2].clDid }}
<view class="item">{{ item[0].clDid ? Math.round(item[0].value) || '-' : '' }}</view> <template v-if="item[2].clDid"> (°C)</template>
<view class="item">{{ item[1].clDid ? Math.round(item[1].value) || '-' : '' }}</view> </view>
<view class="item">{{ item[2].clDid ? Math.round(item[2].value) || '-' : '' }}</view> <view class="item item-title"
<view class="item">{{ item[3].clDid ? Math.round(item[3].value) || '-' : '' }}</view> >{{ item[3].clDid }}
</template> <template v-if="item[3].clDid"> (°C)</template>
</view> </view>
</view> <view class="item">{{ item[0].clDid ? Math.round(item[0].value) || '-' : '' }}</view>
<!-- 运维管理员工程用户 可看 --> <view class="item">{{ item[1].clDid ? Math.round(item[1].value) || '-' : '' }}</view>
<view class="grid-card" v-if="userInfo.authorities=='operation_manager'||userInfo.authorities=='engineering_user'"> <view class="item">{{ item[2].clDid ? Math.round(item[2].value) || '-' : '' }}</view>
<view class="grid-card-title">状态</view> <view class="item">{{ item[3].clDid ? Math.round(item[3].value) || '-' : '' }}</view>
<view class="grid-card-content-4"> </template>
<template v-for="(item, index) in moduleData"> </view>
<view class="item item-title">{{ item[0].moduleName }} </view>
<template v-if="item[0].moduleName"></template> <!-- 运维管理员工程用户 可看 -->
</view> <view
<view class="item item-title">{{ item[1].moduleName }} class="grid-card"
<template v-if="item[1].moduleName"></template> v-if="userInfo.authorities == 'operation_manager' || userInfo.authorities == 'engineering_user'"
</view> >
<view class="item item-title">{{ item[2].moduleName }} <view class="grid-card-title">状态</view>
<template v-if="item[2].moduleName"></template> <view class="grid-card-content-4">
</view> <template v-for="(item, index) in moduleData">
<view class="item item-title">{{ item[3].moduleName }} <view class="item item-title"
<template v-if="item[3].moduleName"></template> >{{ item[0].moduleName }}
</view> <template v-if="item[0].moduleName"></template>
<!-- <uni-tag :text="item[0].moduleState" :type=" item[0].moduleState=='离线'?'error' : 'success'" /> --> </view>
<view class="item">{{ item[0].moduleState }}</view> <view class="item item-title"
<view class="item">{{ item[1].moduleState }}</view> >{{ item[1].moduleName }}
<view class="item">{{ item[2].moduleState }}</view> <template v-if="item[1].moduleName"></template>
<view class="item">{{ item[3].moduleState }}</view> </view>
</template> <view class="item item-title"
</view> >{{ item[2].moduleName }}
</view> <template v-if="item[2].moduleName"></template>
<!-- <view class="grid-card">--> </view>
<!-- <view class="grid-card-title">干接点</view>--> <view class="item item-title"
<!-- <view class="grid-card-content-4">--> >{{ item[3].moduleName }}
<!-- <view class="item item-title">干接点1</view>--> <template v-if="item[3].moduleName"></template>
<!-- <view class="item item-title">干接点2</view>--> </view>
<!-- <view class="item item-title"></view>--> <!-- <uni-tag :text="item[0].moduleState" :type=" item[0].moduleState=='离线'?'error' : 'success'" /> -->
<!-- <view class="item item-title"></view>--> <view class="item">{{ item[0].moduleState }}</view>
<!-- <view class="item">正常</view>--> <view class="item">{{ item[1].moduleState }}</view>
<!-- <view class="item">正常</view>--> <view class="item">{{ item[2].moduleState }}</view>
<!-- <view class="item"></view>--> <view class="item">{{ item[3].moduleState }}</view>
<!-- <view class="item"></view>--> </template>
<!-- </view>--> </view>
<!-- </view>--> </view>
</view> <!-- <view class="grid-card">-->
<!-- <view class="grid-card-title">干接点</view>-->
<!-- <view class="grid-card-content-4">-->
<!-- <view class="item item-title">干接点1</view>-->
<!-- <view class="item item-title">干接点2</view>-->
<!-- <view class="item item-title"></view>-->
<!-- <view class="item item-title"></view>-->
<!-- <view class="item">正常</view>-->
<!-- <view class="item">正常</view>-->
<!-- <view class="item"></view>-->
<!-- <view class="item"></view>-->
<!-- </view>-->
<!-- </view>-->
</view>
</view>
</template> </template>
<script> <script>
import { import { getModuleState } from '@/common/api/harmonic.js'
getModuleState export default {
} from '@/common/api/harmonic.js' props: {
export default { IOData: {
type: Array,
default: () => {
return []
},
},
ndid: {
type: String,
},
},
data() {
return {
list: [],
userInfo: {},
flag: false,
}
},
computed: {
renderData() {
let arr = []
// 把IOData转换成每4个一组的二维数组
for (let i = 0; i < this.IOData.length; i += 4) {
this.IOData.slice(i, i + 4).forEach((item) => {
if (Number.isInteger(item.value) || item.value == '') {
} else {
item.value = (item.value - 0).toFixed(2)
}
})
arr.push(this.IOData.slice(i, i + 4))
}
// 把每组的长度补齐到4
arr.forEach((item) => {
if (item.length < 4) {
let length = 4 - item.length
for (let i = 0; i < length; i++) {
item.push({})
}
}
})
console.warn(arr)
return arr
},
moduleData() {
let arr = []
// 把IOData转换成每4个一组的二维数组
for (let i = 0; i < this.list.length; i += 4) {
arr.push(this.list.slice(i, i + 4))
}
// 把每组的长度补齐到4
arr.forEach((item) => {
if (item.length < 4) {
let length = 4 - item.length
for (let i = 0; i < length; i++) {
item.push({})
}
}
})
console.warn(arr)
return arr
},
},
methods: {
info() {
getModuleState({
id: this.ndid,
}).then((res) => {
this.list = res.data
})
},
},
mounted() {
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
props: { this.info()
IOData: { },
type: Array, }
default: () => {
return []
},
},
ndid: {
type: String,
},
},
data() {
return {
list: [],
userInfo: {},
flag: false
}
},
computed: {
renderData() {
let arr = []
// 把IOData转换成每4个一组的二维数组
for (let i = 0; i < this.IOData.length; i += 4) {
this.IOData.slice(i, i + 4).forEach((item) => {
if (Number.isInteger(item.value) || item.value == '') {} else {
item.value = (item.value - 0).toFixed(2)
}
})
arr.push(this.IOData.slice(i, i + 4))
}
// 把每组的长度补齐到4
arr.forEach((item) => {
if (item.length < 4) {
let length = 4 - item.length
for (let i = 0; i < length; i++) {
item.push({})
}
}
})
console.warn(arr)
return arr
},
moduleData() {
let arr = []
// 把IOData转换成每4个一组的二维数组
for (let i = 0; i < this.list.length; i += 4) {
arr.push(this.list.slice(i, i + 4))
}
// 把每组的长度补齐到4
arr.forEach((item) => {
if (item.length < 4) {
let length = 4 - item.length
for (let i = 0; i < length; i++) {
item.push({})
}
}
})
console.warn(arr)
return arr
},
},
methods: {
info() {
getModuleState({
id: this.ndid
}).then((res) => {
this.list = res.data
})
},
},
mounted() {
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
this.info()
},
}
</script> </script>
<style lang="scss"> <style lang="scss">
.basic {} .basic {
}
</style> </style>

View File

@@ -1,79 +1,90 @@
<template> <template>
<view class="basic"> <view>
<view class="grid-card"> <uni-load-more status="loading" v-if="basicData.length == 0"></uni-load-more>
<view class="grid-card-title">电网电流</view> <view class="basic" v-else>
<view class="grid-card-content-3"> <view class="grid-card">
<view class="item item-title">名称</view> <view class="grid-card-title">电网电流</view>
<view class="item item-title">有效值(A)</view> <view class="grid-card-content-3">
<view class="item item-title">畸变率(%)</view> <view class="item item-title">名称</view>
<template v-for="(item, index) in renderData.电网电流"> <view class="item item-title">有效值(A)</view>
<view class="item">{{ item.phase }}</view> <view class="item item-title">畸变率(%)</view>
<view class="item">{{ <template v-for="(item, index) in renderData.电网电流">
item['Apf_RmsI_Sys(A)'] > 0 ? item['Apf_RmsI_Sys(A)'].toFixed(2) : item['Apf_RmsI_Sys(A)'] <view class="item">{{ item.phase }}</view>
<view class="item">{{
item['Apf_RmsI_Sys(A)'] > 0 ? item['Apf_RmsI_Sys(A)'].toFixed(2) : item['Apf_RmsI_Sys(A)']
}}</view> }}</view>
<view class="item">{{ <view class="item">{{
item['Apf_ThdA_Sys(%)'] > 0 ? item['Apf_ThdA_Sys(%)'].toFixed(2) : item['Apf_ThdA_Sys(%)'] item['Apf_ThdA_Sys(%)'] > 0 ? item['Apf_ThdA_Sys(%)'].toFixed(2) : item['Apf_ThdA_Sys(%)']
}}</view> }}</view>
</template> </template>
</view>
</view> </view>
</view> <view class="grid-card">
<view class="grid-card"> <view class="grid-card-title">电网电压</view>
<view class="grid-card-title">电网电压</view> <view class="grid-card-content-4">
<view class="grid-card-content-4"> <view class="item item-title">名称</view>
<view class="item item-title">名称</view> <view class="item item-title">电压(V)</view>
<view class="item item-title">电压(V)</view> <view class="item item-title">频率(Hz)</view>
<view class="item item-title">(Hz)</view> <view class="item item-title">畸变(%)</view>
<view class="item item-title">畸变率(%)</view> <template v-for="(item, index) in renderData.电网电压">
<template v-for="(item, index) in renderData.电网电压"> <view class="item">{{ item.phase }}</view>
<view class="item">{{ item.phase }}</view> <view class="item">{{
<view class="item">{{ item['Apf_PhV_Sys(V)'] > 0 ? item['Apf_PhV_Sys(V)'].toFixed(2) : item['Apf_PhV_Sys(V)']
item['Apf_PhV_Sys(V)'] > 0 ? item['Apf_PhV_Sys(V)'].toFixed(2) : item['Apf_PhV_Sys(V)']
}}</view> }}</view>
<view class="item">{{ <view class="item">{{
item['Apf_Freq(Hz)'] > 0 ? item['Apf_Freq(Hz)'].toFixed(2) : item['Apf_Freq(Hz)'] item['Apf_Freq(Hz)'] > 0 ? item['Apf_Freq(Hz)'].toFixed(2) : item['Apf_Freq(Hz)']
}}</view> }}</view>
<view class="item">{{ <view class="item">{{
item['Apf_ThdU_Sys(%)'] > 0 ? item['Apf_ThdU_Sys(%)'].toFixed(2) : item['Apf_ThdU_Sys(%)'] item['Apf_ThdU_Sys(%)'] > 0 ? item['Apf_ThdU_Sys(%)'].toFixed(2) : item['Apf_ThdU_Sys(%)']
}}</view> }}</view>
</template> </template>
</view>
</view> </view>
</view> <view class="grid-card">
<view class="grid-card"> <view class="grid-card-title">负载电流</view>
<view class="grid-card-title">负载电流</view> <view class="grid-card-content-3">
<view class="grid-card-content-3"> <view class="item item-title">名称</view>
<view class="item item-title">名称</view> <view class="item item-title">有效值(A)</view>
<view class="item item-title">有效值(A)</view> <view class="item item-title">畸变率(%)</view>
<view class="item item-title">畸变率(%)</view> <template v-for="(item, index) in renderData.负载电流">
<template v-for="(item, index) in renderData.负载电流"> <view class="item">{{ item.phase }}</view>
<view class="item">{{ item.phase }}</view> <view class="item">{{
<view class="item">{{ item['Apf_RmsI_Load(A)'] > 0
item['Apf_RmsI_Load(A)'] > 0 ? item['Apf_RmsI_Load(A)'].toFixed(2) : item['Apf_RmsI_Load(A)'] ? item['Apf_RmsI_Load(A)'].toFixed(2)
: item['Apf_RmsI_Load(A)']
}}</view> }}</view>
<view class="item">{{ <view class="item">{{
item['Apf_ThdA_Load(%)'] > 0 ? item['Apf_ThdA_Load(%)'].toFixed(2) : item['Apf_ThdA_Load(%)'] item['Apf_ThdA_Load(%)'] > 0
? item['Apf_ThdA_Load(%)'].toFixed(2)
: item['Apf_ThdA_Load(%)']
}}</view> }}</view>
</template> </template>
</view>
</view> </view>
</view> <view class="grid-card">
<view class="grid-card"> <view class="grid-card-title">补偿电流</view>
<view class="grid-card-title">补偿电流</view> <view class="grid-card-content-3">
<view class="grid-card-content-3"> <view class="item item-title">名称</view>
<view class="item item-title">名称</view> <view class="item item-title">有效值(A)</view>
<view class="item item-title">有效值(A)</view> <view class="item item-title">负载率(%)</view>
<view class="item item-title">负载率(%)</view> <template v-for="(item, index) in renderData.补偿电流">
<template v-for="(item, index) in renderData.补偿电流"> <view class="item">{{ item.phase }}</view>
<view class="item">{{ item.phase }}</view> <view class="item">{{
<view class="item">{{ item['Apf_RmsI_TolOut(A)'] == 3.1415926
item['Apf_RmsI_TolOut(A)'] == 3.1415926 ? '-' : ? '-'
item['Apf_RmsI_TolOut(A)'] > 0 : item['Apf_RmsI_TolOut(A)'] > 0
? item['Apf_RmsI_TolOut(A)'].toFixed(2) ? item['Apf_RmsI_TolOut(A)'].toFixed(2)
: item['Apf_RmsI_TolOut(A)'] : item['Apf_RmsI_TolOut(A)']
}}</view>
<view class="item">{{
item['load_Rate'] == 3.1415926 ? '-' : item['load_Rate'] > 0 ? item['load_Rate'].toFixed(2) :
item['load_Rate']
}}</view> }}</view>
</template> <view class="item">{{
item['load_Rate'] == 3.1415926
? '-'
: item['load_Rate'] > 0
? item['load_Rate'].toFixed(2)
: item['load_Rate']
}}</view>
</template>
</view>
</view> </view>
</view> </view>
</view> </view>
@@ -168,5 +179,6 @@ export default {
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.basic {} .basic {
}
</style> </style>

View File

@@ -1,125 +1,135 @@
<template> <template>
<view class="basic"> <view>
<view class="grid-card"> <uni-load-more status="loading" v-if="basicData.length == 0"></uni-load-more>
<view class="grid-card-title">电网侧</view> <view class="basic" v-else>
<view class="grid-card-content-5"> <view class="grid-card">
<view class="item item-title">名称</view> <view class="grid-card-title">电网侧</view>
<view class="item item-title">有功功率(kW)</view> <view class="grid-card-content-5">
<view class="item item-title">无功功率(kVar)</view> <view class="item item-title">名称</view>
<view class="item item-title">视在功率(kVA)</view> <view class="item item-title">有功功率(kW)</view>
<view class="item item-title">功率因数</view> <view class="item item-title">无功功率(kVar)</view>
<template v-for="(item, index) in renderData.电网侧"> <view class="item item-title">视在功率(kVA)</view>
<view class="item">{{ item.phase }}</view> <view class="item item-title">功率因数</view>
<view class="item">{{ item['Apf_P_Sys(W)'] == '-' ? '-' : (item['Apf_P_Sys(W)'] / 1000).toFixed(2) }} <template v-for="(item, index) in renderData.电网侧">
</view> <view class="item">{{ item.phase }}</view>
<view class="item">{{ item['Apf_Q_Sys(Var)'] == '-' ? '-' : (item['Apf_Q_Sys(Var)'] / 1000).toFixed(2) }} <view class="item"
</view> >{{ item['Apf_P_Sys(W)'] == '-' ? '-' : (item['Apf_P_Sys(W)'] / 1000).toFixed(2) }}
<view class="item">{{ item['Apf_S_Sys(VA)'] == '-' ? '-' : (item['Apf_S_Sys(VA)'] / 1000).toFixed(2) }} </view>
</view> <view class="item"
<view class="item">{{ item['Apf_PF_Sys(null)'] || '-' }}</view> >{{ item['Apf_Q_Sys(Var)'] == '-' ? '-' : (item['Apf_Q_Sys(Var)'] / 1000).toFixed(2) }}
</template> </view>
</view> <view class="item"
</view> >{{ item['Apf_S_Sys(VA)'] == '-' ? '-' : (item['Apf_S_Sys(VA)'] / 1000).toFixed(2) }}
<view class="grid-card"> </view>
<view class="grid-card-title">负载侧</view> <view class="item">{{ item['Apf_PF_Sys(null)'] || '-' }}</view>
<view class="grid-card-content-5"> </template>
<view class="item item-title">名称</view> </view>
<view class="item item-title">有功功率(kW)</view> </view>
<view class="item item-title">无功功率(kVar)</view> <view class="grid-card">
<view class="item item-title">视在功率(kVA)</view> <view class="grid-card-title">负载侧</view>
<view class="item item-title">功率因数</view> <view class="grid-card-content-5">
<template v-for="(item, index) in renderData.负载侧"> <view class="item item-title">名称</view>
<view class="item">{{ item.phase }}</view> <view class="item item-title">有功功率(kW)</view>
<view class="item">{{ item['Apf_P_Load(W)'] == '-' ? '-' : (item['Apf_P_Load(W)'] / 1000).toFixed(2) }} <view class="item item-title">无功功率(kVar)</view>
</view> <view class="item item-title">视在功率(kVA)</view>
<view class="item">{{ item['Apf_Q_Load(Var)'] == '-' ? '-' : (item['Apf_Q_Load(Var)'] / 1000).toFixed(2) <view class="item item-title">功率因数</view>
}}</view> <template v-for="(item, index) in renderData.负载侧">
<view class="item">{{ item['Apf_S_Load(VA)'] == '-' ? '-' : (item['Apf_S_Load(VA)'] / 1000).toFixed(2) }} <view class="item">{{ item.phase }}</view>
</view> <view class="item"
<view class="item">{{ item['Apf_PF_Load(null)'] || '-' }}</view> >{{ item['Apf_P_Load(W)'] == '-' ? '-' : (item['Apf_P_Load(W)'] / 1000).toFixed(2) }}
</template> </view>
</view> <view class="item">{{
</view> item['Apf_Q_Load(Var)'] == '-' ? '-' : (item['Apf_Q_Load(Var)'] / 1000).toFixed(2)
</view> }}</view>
<view class="item"
>{{ item['Apf_S_Load(VA)'] == '-' ? '-' : (item['Apf_S_Load(VA)'] / 1000).toFixed(2) }}
</view>
<view class="item">{{ item['Apf_PF_Load(null)'] || '-' }}</view>
</template>
</view>
</view>
</view>
</view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
renderData: { renderData: {
电网侧: [], 电网侧: [],
负载侧: [], 负载侧: [],
未知: [], 未知: [],
}, },
} }
}, },
props: { props: {
basicData: { basicData: {
type: Array, type: Array,
default: () => { default: () => {
return [] return []
}, },
}, },
}, },
watch: { watch: {
basicData: { basicData: {
handler: function (newVal, oldVal) { handler: function (newVal, oldVal) {
newVal.forEach((item) => { newVal.forEach((item) => {
if (item.phase === 'avg') { if (item.phase === 'avg') {
return return
} }
let key = '' let key = ''
switch (item.statisticalName) { switch (item.statisticalName) {
case 'Apf_P_Sys(W)': case 'Apf_P_Sys(W)':
key = '电网侧' key = '电网侧'
break break
case 'Apf_Q_Sys(Var)': case 'Apf_Q_Sys(Var)':
key = '电网侧' key = '电网侧'
break break
case 'Apf_S_Sys(VA)': case 'Apf_S_Sys(VA)':
key = '电网侧' key = '电网侧'
break break
case 'Apf_PF_Sys(null)': case 'Apf_PF_Sys(null)':
key = '电网侧' key = '电网侧'
break break
case 'Apf_P_Load(W)': case 'Apf_P_Load(W)':
key = '负载侧' key = '负载侧'
break break
case 'Apf_Q_Load(Var)': case 'Apf_Q_Load(Var)':
key = '负载侧' key = '负载侧'
break break
case 'Apf_S_Load(VA)': case 'Apf_S_Load(VA)':
key = '负载侧' key = '负载侧'
break break
case 'Apf_PF_Load(null)': case 'Apf_PF_Load(null)':
key = '负载侧' key = '负载侧'
break break
default: default:
key = '未知' key = '未知'
break break
} }
let index = this.renderData[key].findIndex((item2) => { let index = this.renderData[key].findIndex((item2) => {
return item2.phase === item.phase return item2.phase === item.phase
}) })
if (index > -1) { if (index > -1) {
this.renderData[key][index][item.statisticalName] = item.statisticalData || '-' this.renderData[key][index][item.statisticalName] = item.statisticalData || '-'
} else { } else {
this.renderData[key].push({ this.renderData[key].push({
phase: item.phase, phase: item.phase,
[item.statisticalName]: item.statisticalData || '-', [item.statisticalName]: item.statisticalData || '-',
}) })
} }
}) })
console.log(this.renderData) console.log(this.renderData)
}, },
deep: true, deep: true,
immediate: true, immediate: true,
}, },
}, },
methods: {}, methods: {},
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.basic {} .basic {
}
</style> </style>

View File

@@ -1,375 +1,385 @@
<template> <template>
<view> <view>
<div class="header-form"> <uni-load-more status="loading" v-if="basicData.length == 0"></uni-load-more>
<uni-data-select
v-model="parity" <view v-else>
:localdata="parityOption" <div class="header-form">
@change="initEcharts" <uni-data-select
style="flex: 1" v-model="parity"
:clear="false" :localdata="parityOption"
></uni-data-select> @change="initEcharts"
<!-- <uni-data-checkbox v-model="dataRadio" :localdata="dataOptions" @change="initEcharts"></uni-data-checkbox> --> style="flex: 1"
<uni-data-select :clear="false"
v-model="dataRadio" ></uni-data-select>
:localdata="dataOptions" <!-- <uni-data-checkbox v-model="dataRadio" :localdata="dataOptions" @change="initEcharts"></uni-data-checkbox> -->
@change="initEcharts" <uni-data-select
style="flex: 2; margin-left: 20rpx" v-model="dataRadio"
:clear="false" :localdata="dataOptions"
></uni-data-select> @change="initEcharts"
</div> style="flex: 2; margin-left: 20rpx"
<view class="charts-box"> :clear="false"
<!-- <view class="data-time">{{ time }}</view> --> ></uni-data-select>
<!-- <qiun-data-charts type="bar" :ontouch="true" :opts="opts" :chartData="chartData" /> --> </div>
<view style="width: 100%; height: 100%"><l-echart ref="chartRef" @finished="init"></l-echart></view> <view class="charts-box">
</view> <!-- <view class="data-time">{{ time }}</view> -->
</view> <!-- <qiun-data-charts type="bar" :ontouch="true" :opts="opts" :chartData="chartData" /> -->
<view style="width: 100%; height: 100%"><l-echart ref="chartRef" @finished="init"></l-echart></view>
</view>
</view>
</view>
</template> </template>
<script> <script>
import * as echarts from '@/uni_modules/lime-echart/static/echarts.min' import * as echarts from '@/uni_modules/lime-echart/static/echarts.min'
export default { export default {
props: { props: {
basicData: { basicData: {
type: Array, type: Array,
default: () => [], default: () => [],
}, },
dataTime: { dataTime: {
type: [String, Number], type: [String, Number],
default: '', default: '',
}, },
}, },
data() { data() {
return { return {
parityOption: [ parityOption: [
{ {
text: '奇次', text: '奇次',
value: 2, value: 2,
}, },
{ {
text: '偶次', text: '偶次',
value: 1, value: 1,
}, },
], ],
parity: 2, parity: 2,
time: '', time: '',
dataOptions: [], dataOptions: [],
dataRadio: 0, dataRadio: 0,
renderData: { renderData: {
电网侧: { 电网侧: {
Apf_HarmI: {}, Apf_HarmI: {},
Apf_HarmUR: {}, Apf_HarmUR: {},
}, },
负载侧: { 负载侧: {
Apf_HarmI: {}, Apf_HarmI: {},
Apf_HarmUR: {}, Apf_HarmUR: {},
}, },
}, },
chartData: {}, chartData: {},
//您可以通过修改 config-ucharts.js 文件中下标为 ['column'] 的节点来配置全局默认参数,如都是默认参数,此处可以不传 opts 。实际应用过程中 opts 只需传入与全局默认参数中不一致的【某一个属性】即可实现同类型的图表显示不同的样式,达到页面简洁的需求。 //您可以通过修改 config-ucharts.js 文件中下标为 ['column'] 的节点来配置全局默认参数,如都是默认参数,此处可以不传 opts 。实际应用过程中 opts 只需传入与全局默认参数中不一致的【某一个属性】即可实现同类型的图表显示不同的样式,达到页面简洁的需求。
option: { option: {
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
axisPointer: { axisPointer: {
type: 'shadow', type: 'shadow',
}, },
confine: true, confine: true,
}, },
color: [ color: [
'#1890FF', '#1890FF',
'#91CB74', '#91CB74',
'#FAC858', '#FAC858',
'#EE6666', '#EE6666',
'#73C0DE', '#73C0DE',
'#3CA272', '#3CA272',
'#FC8452', '#FC8452',
'#9A60B4', '#9A60B4',
'#ea7ccc', '#ea7ccc',
], ],
legend: { legend: {
data: ['电网侧', '负载侧'], data: ['电网侧', '负载侧'],
left: 0, left: 0,
}, },
grid: { grid: {
left: 10, left: 10,
right: 10, right: 10,
bottom: 15, bottom: 15,
top: 30, top: 30,
containLabel: true, containLabel: true,
}, },
xAxis: [ xAxis: [
{ {
type: 'value', type: 'value',
axisLine: { axisLine: {
show: true, show: true,
}, },
minInterval: 0.5, minInterval: 0.5,
position: 'top', // 设置 x 轴在顶部 position: 'top', // 设置 x 轴在顶部
}, },
], ],
yAxis: [ yAxis: [
{ {
type: 'category', type: 'category',
axisTick: { show: false }, axisTick: { show: false },
data: [], data: [],
splitLine: { show: true }, splitLine: { show: true },
axisLine: { axisLine: {
lineStyle: { lineStyle: {
color: '#999999', color: '#999999',
}, },
}, },
axisLabel: { axisLabel: {
color: '#666666', color: '#666666',
}, },
}, },
], ],
series: [ series: [
{ {
name: '电网侧', name: '电网侧',
type: 'bar', type: 'bar',
label: { label: {
normal: { normal: {
color: '#666', color: '#666',
show: true, show: true,
position: 'right', position: 'right',
fontSize: '8px', fontSize: '8px',
},
},
barGap: '10%',
data: [],
},
{
name: '负载侧',
type: 'bar',
barCateGoryGap: 20,
label: {
normal: {
color: '#666',
show: true,
position: 'right',
fontSize: '8px',
},
},
}, data: [],
}, },
barGap: '10%', ],
data: [], },
}, opts: {
{ // enableScroll: true,
name: '负载侧', dataLabel: false,
type: 'bar', color: [
barCateGoryGap:20, '#1890FF',
label: { '#91CB74',
normal: { '#FAC858',
color: '#666', '#EE6666',
show: true, '#73C0DE',
position: 'right', '#3CA272',
fontSize: '8px', '#FC8452',
}, '#9A60B4',
}, '#ea7ccc',
],
padding: [0, 20, 0, 0],
legend: {
position: 'top',
float: 'left',
},
xAxis: {
// disableGrid: true,
boundaryGap: 'justify',
itemCount: 8,
// scrollShow: true,
data: [
{
min: 0,
},
],
min: 0,
// max: 10,
data: [], position: 'top',
}, formatter: (value, index, opts) => {
], console.log(123, value, index, opts)
}, },
opts: { },
// enableScroll: true, yAxis: {},
dataLabel: false, extra: {
color: [ bar: {
'#1890FF', type: 'group',
'#91CB74', width: 30,
'#FAC858', meterBorde: 1,
'#EE6666', meterFillColor: '#FFFFFF',
'#73C0DE', activeBgColor: '#000000',
'#3CA272', activeBgOpacity: 0.08,
'#FC8452', barBorderCircle: true,
'#9A60B4', seriesGap: 2,
'#ea7ccc', categoryGap: 6,
], },
padding: [0, 20, 0, 0], },
legend: { },
position: 'top', }
float: 'left', },
}, watch: {
xAxis: { basicData: {
// disableGrid: true, handler(newVal, oldVal) {
boundaryGap: 'justify', console.log(this.basicData)
itemCount: 8, let basicData = JSON.parse(JSON.stringify(this.basicData))
// scrollShow: true, // this.dataRadio = 0
data: [ this.renderData = {
{ 电网侧: {
min: 0, Apf_HarmI: {},
}, Apf_HarmUR: {},
], },
min: 0, 负载侧: {
// max: 10, Apf_HarmI: {},
Apf_HarmUR: {},
},
}
let arr = [
{
name: '电网侧',
key: 'Apf_HarmI_Sys',
},
{
name: '电网侧',
key: 'Apf_HarmUR_Sys',
},
{
name: '负载侧',
key: 'Apf_HarmI_Load',
},
{
name: '负载侧',
key: 'Apf_HarmUR_Load',
},
]
basicData.forEach((item) => {
let have = arr.find((item2) => {
return item.statisticalName.indexOf(item2.key) > -1
})
if (!have) return
let name1 = have['name']
let name2 = have.key.split('_')[0] + '_' + have.key.split('_')[1]
if (this.renderData[name1][name2][item.phase]) {
this.renderData[name1][name2][item.phase][item.statisticalName] = item.statisticalData || 0
} else {
this.renderData[name1][name2][item.phase] = {
[item.statisticalName]: item.statisticalData || 0,
}
}
})
console.log(this.renderData)
let dataOptions = []
let type = [
{
name: '谐波电流幅值',
key: 'Apf_HarmI',
},
{
name: '谐波电压含有率',
key: 'Apf_HarmUR',
},
]
Object.keys(this.renderData['电网侧']['Apf_HarmI']).forEach((item, index) => {
type.forEach((item2) => {
dataOptions.push({
text: item + '相' + item2.name,
pointer: item2.key + '_' + item,
value: dataOptions.length,
})
})
})
this.dataOptions = dataOptions
console.log(dataOptions)
this.initEcharts()
position: 'top', this.time = this.$util.parseTime(this.dataTime - 8 * 60 * 60)
formatter: (value, index, opts) => { },
console.log(123, value, index, opts) deep: true,
}, immediate: true,
}, },
yAxis: {}, },
extra: { methods: {
bar: { async init() {
type: 'group', // chart 图表实例不能存在data里
width: 30, const chart = await this.$refs.chartRef.init(echarts)
meterBorde: 1, chart.setOption(this.option)
meterFillColor: '#FFFFFF', },
activeBgColor: '#000000', initEcharts() {
activeBgOpacity: 0.08, setTimeout(() => {
barBorderCircle: true, if (
seriesGap: 2, this.renderData['电网侧']['Apf_HarmI'][Object.keys(this.renderData['电网侧']['Apf_HarmI'])[0]] ==
categoryGap: 6, undefined
}, )
}, return
}, let obj = JSON.parse(
} JSON.stringify(
}, this.renderData['电网侧']['Apf_HarmI'][Object.keys(this.renderData['电网侧']['Apf_HarmI'])[0]],
watch: { ),
basicData: { )
handler(newVal, oldVal) { let key = this.dataOptions[this.dataRadio].pointer.split('_')
console.log(this.basicData) console.log(key)
let basicData = JSON.parse(JSON.stringify(this.basicData)) let name1 = key[0] + '_' + key[1]
// this.dataRadio = 0 let name2 = key[2]
this.renderData = { this.chartData = {
电网侧: { categories: Object.keys(obj)
Apf_HarmI: {}, .map((item) => {
Apf_HarmUR: {}, // Apf_HarmI_Sys_36(A) 匹配36
}, return Number(item.match(/\d+/)[0])
负载侧: { })
Apf_HarmI: {}, .filter((item) => {
Apf_HarmUR: {}, return item % 2 === this.parity - 1
}, }),
} series: [
let arr = [ {
{ name: '电网侧',
name: '电网侧', data: Object.values(this.renderData['电网侧'][name1][name2]).filter((item, index) => {
key: 'Apf_HarmI_Sys', return index % 2 === this.parity - 1
}, }),
{ },
name: '电网侧', {
key: 'Apf_HarmUR_Sys', name: '负载侧',
}, data: Object.values(this.renderData['负载侧'][name1][name2]).filter((item, index) => {
{ return index % 2 === this.parity - 1
name: '负载侧', }),
key: 'Apf_HarmI_Load', },
}, ],
{ }
name: '负载侧', // /传值到echart
key: 'Apf_HarmUR_Load', this.option.yAxis[0].data = Object.keys(obj)
}, .map((item) => {
] // Apf_HarmI_Sys_36(A) 匹配36
basicData.forEach((item) => { return Number(item.match(/\d+/)[0])
let have = arr.find((item2) => { })
return item.statisticalName.indexOf(item2.key) > -1 .filter((item) => {
}) return item % 2 === this.parity - 1
if (!have) return })
let name1 = have['name'] .reverse()
let name2 = have.key.split('_')[0] + '_' + have.key.split('_')[1] this.option.series[0].data = Object.values(this.renderData['电网侧'][name1][name2])
if (this.renderData[name1][name2][item.phase]) { .filter((item, index) => {
this.renderData[name1][name2][item.phase][item.statisticalName] = item.statisticalData || 0 return index % 2 === this.parity - 1
} else { })
this.renderData[name1][name2][item.phase] = { .reverse()
[item.statisticalName]: item.statisticalData || 0, .map((item) => item.toFixed(2))
} this.option.series[1].data = Object.values(this.renderData['负载侧'][name1][name2])
} .filter((item, index) => {
}) return index % 2 === this.parity - 1
console.log(this.renderData) })
let dataOptions = [] .reverse()
let type = [ .map((item) => item.toFixed(2))
{ this.init()
name: '谐波电流幅值', }, 100)
key: 'Apf_HarmI', },
}, },
{
name: '谐波电压含有率',
key: 'Apf_HarmUR',
},
]
Object.keys(this.renderData['电网侧']['Apf_HarmI']).forEach((item, index) => {
type.forEach((item2) => {
dataOptions.push({
text: item + '相' + item2.name,
pointer: item2.key + '_' + item,
value: dataOptions.length,
})
})
})
this.dataOptions = dataOptions
console.log(dataOptions)
this.initEcharts()
this.time = this.$util.parseTime(this.dataTime - 8 * 60 * 60)
},
deep: true,
immediate: true,
},
},
methods: {
async init() {
// chart 图表实例不能存在data里
const chart = await this.$refs.chartRef.init(echarts)
chart.setOption(this.option)
},
initEcharts() {
setTimeout(() => {
if(this.renderData['电网侧']['Apf_HarmI'][Object.keys(this.renderData['电网侧']['Apf_HarmI'])[0]] == undefined) return
let obj = JSON.parse(
JSON.stringify(
this.renderData['电网侧']['Apf_HarmI'][Object.keys(this.renderData['电网侧']['Apf_HarmI'])[0]],
),
)
let key = this.dataOptions[this.dataRadio].pointer.split('_')
console.log(key)
let name1 = key[0] + '_' + key[1]
let name2 = key[2]
this.chartData = {
categories: Object.keys(obj)
.map((item) => {
// Apf_HarmI_Sys_36(A) 匹配36
return Number(item.match(/\d+/)[0])
})
.filter((item) => {
return item % 2 === this.parity - 1
}),
series: [
{
name: '电网侧',
data: Object.values(this.renderData['电网侧'][name1][name2]).filter((item, index) => {
return index % 2 === this.parity - 1
}),
},
{
name: '负载侧',
data: Object.values(this.renderData['负载侧'][name1][name2]).filter((item, index) => {
return index % 2 === this.parity - 1
}),
},
],
}
// /传值到echart
this.option.yAxis[0].data = Object.keys(obj)
.map((item) => {
// Apf_HarmI_Sys_36(A) 匹配36
return Number(item.match(/\d+/)[0])
})
.filter((item) => {
return item % 2 === this.parity - 1
}).reverse()
this.option.series[0].data = Object.values(this.renderData['电网侧'][name1][name2]).filter(
(item, index) => {
return index % 2 === this.parity - 1
},
).reverse().map(item=>item.toFixed(2))
this.option.series[1].data = Object.values(this.renderData['负载侧'][name1][name2]).filter(
(item, index) => {
return index % 2 === this.parity - 1
},
).reverse().map(item=>item.toFixed(2))
this.init()
}, 100)
},
},
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.charts-box { .charts-box {
margin-top: 20rpx; margin-top: 20rpx;
height: 100vh; height: 100vh;
.data-time { .data-time {
position: absolute; position: absolute;
right: 20rpx; right: 20rpx;
margin-top: 18rpx; margin-top: 18rpx;
font-size: 24rpx; font-size: 24rpx;
} }
} }
.header-form { .header-form {
display: flex; display: flex;
} }
</style> </style>

View File

@@ -186,7 +186,7 @@ export default {
content: [ content: [
{ {
iconPath: '/static/report.png', iconPath: '/static/report.png',
text: '告警', text: '详情',
}, },
// { // {
// iconPath: '/static/record.png', // iconPath: '/static/record.png',
@@ -196,10 +196,10 @@ export default {
iconPath: '/static/about.png', iconPath: '/static/about.png',
text: '关于', text: '关于',
}, },
{ // {
iconPath: '/static/access.png', // iconPath: '/static/access.png',
text: '接入', // text: '接入',
}, // },
], ],
client: null, client: null,
timer: null, timer: null,
@@ -243,7 +243,7 @@ export default {
this.$util.toast('下载成功') this.$util.toast('下载成功')
} else if (e.text === '记录') { } else if (e.text === '记录') {
uni.navigateTo({ url: '/pages/device/APF/record' }) uni.navigateTo({ url: '/pages/device/APF/record' })
} else if (e.text === '告警') { } else if (e.text === '详情') {
uni.navigateTo({ url: '/pages/device/APF/report?id=' + this.devId }) uni.navigateTo({ url: '/pages/device/APF/report?id=' + this.devId })
} else if (e.text === '关于') { } else if (e.text === '关于') {
uni.navigateTo({ url: '/pages/device/APF/about?id=' + this.devId }) uni.navigateTo({ url: '/pages/device/APF/about?id=' + this.devId })
@@ -353,7 +353,7 @@ export default {
this.downloadImg() this.downloadImg()
uni.setNavigationBarTitle({ title: this.deviceInfo.devName || '设备详情' }) uni.setNavigationBarTitle({ title: this.deviceInfo.devName || '设备详情' })
this.topolodyData = this.topolodyData.filter((item) => { this.topolodyData = this.topolodyData.filter((item) => {
let index = this.deviceInfo.appsLineTopologyDiagramPO.findIndex((element) => { let index = this.deviceInfo.appsLineTopologyDiagramPO?.findIndex((element) => {
element.label = element.name element.label = element.name
item.label = element.name item.label = element.name
return element.linePostion === item.linePostion return element.linePostion === item.linePostion
@@ -577,6 +577,12 @@ export default {
text: '用户', text: '用户',
}) })
} }
if (this.userInfo.authorities === 'operation_manager') {
this.content.push({
iconPath: '/static/access.png',
text: '接入',
})
}
} }
this.$util.getDictData('Line_Position').then((res) => { this.$util.getDictData('Line_Position').then((res) => {
this.topolodyData = res.map((item) => { this.topolodyData = res.map((item) => {

View File

@@ -90,20 +90,20 @@ export default {
content: [ content: [
{ {
iconPath: '/static/report.png', iconPath: '/static/report.png',
text: '告警', text: '详情',
},
{
iconPath: '/static/record.png',
text: '记录',
}, },
// {
// iconPath: '/static/record.png',
// text: '记录',
// },
{ {
iconPath: '/static/about.png', iconPath: '/static/about.png',
text: '关于', text: '关于',
}, },
{ // {
iconPath: '/static/access.png', // iconPath: '/static/access.png',
text: '接入', // text: '接入',
}, // },
], ],
} }
}, },
@@ -128,7 +128,7 @@ export default {
this.$util.toast('下载成功') this.$util.toast('下载成功')
} else if (e.text === '记录') { } else if (e.text === '记录') {
uni.navigateTo({ url: '/pages/device/DVR/record' }) uni.navigateTo({ url: '/pages/device/DVR/record' })
} else if (e.text === '告警') { } else if (e.text === '详情') {
uni.navigateTo({ url: '/pages/device/DVR/report' }) uni.navigateTo({ url: '/pages/device/DVR/report' })
} else if (e.text === '关于') { } else if (e.text === '关于') {
uni.navigateTo({ url: '/pages/device/DVR/about' }) uni.navigateTo({ url: '/pages/device/DVR/about' })
@@ -196,6 +196,12 @@ export default {
default: default:
break break
} }
if (this.userInfo.authorities === 'operation_manager') {
this.content.push({
iconPath: '/static/access.png',
text: '接入',
})
}
setTimeout(() => { setTimeout(() => {
// 获取nav高度 // 获取nav高度
uni.createSelectorQuery() uni.createSelectorQuery()

View File

@@ -69,7 +69,7 @@
@finished="initChart('echartV3', 'echartsDataV3')" @finished="initChart('echartV3', 'echartsDataV3')"
></l-echart> ></l-echart>
</view> </view>
<view class="text"> 电压有效值 </view> <view class="text"> 电压有效值(kV) </view>
</view> </view>
<view class="middle" style="width: 100%"> <view class="middle" style="width: 100%">
<l-echart <l-echart
@@ -103,7 +103,7 @@
@finished="initChart('echartA3', 'echartsDataA3')" @finished="initChart('echartA3', 'echartsDataA3')"
></l-echart> ></l-echart>
</view> </view>
<view class="text"> 有效值 </view> <view class="text"> 有效值(A) </view>
</view> </view>
</view> </view>
</view> </view>
@@ -125,6 +125,7 @@
</view> </view>
</view> </view>
</view> </view>
<hover-menu :btnList="content" @trigger="trigger"></hover-menu>
</view> </view>
</Cn-page> </Cn-page>
</template> </template>
@@ -133,12 +134,14 @@ const echarts = require('../../../uni_modules/lime-echart/static/echarts.min')
import { MQTT_IP, MQTT_OPTIONS } from '@/common/js/mqtt.js' import { MQTT_IP, MQTT_OPTIONS } from '@/common/js/mqtt.js'
import mqtt from 'mqtt/dist/mqtt.js' import mqtt from 'mqtt/dist/mqtt.js'
import { getBaseRealData } from '@/common/api/harmonic.js' import { getBaseRealData } from '@/common/api/harmonic.js'
import hoverMenu from '@/hover-menu/components/hover-menu/hover-menu.vue'
export default { export default {
components: {}, components: { hoverMenu },
props: {}, props: {},
data() { data() {
return { return {
loading: true, loading: true,
devId: '',
// 使用上面定义的图表配置项 // 使用上面定义的图表配置项
option: {}, option: {},
echartsData0: {}, echartsData0: {},
@@ -183,30 +186,72 @@ export default {
equipmentName: '', equipmentName: '',
runStatus: 1, runStatus: 1,
connection: false, connection: false,
content: [
{
iconPath: '/static/report.png',
text: '详情',
},
{
iconPath: '/static/about.png',
text: '关于',
},
],
isPrimaryUser: 0,
} }
}, },
onLoad(options) { onLoad(options) {
console.log('🚀 ~ options:', options)
this.lineKey = 0 this.lineKey = 0
this.devId = options.id
this.lineList = JSON.parse(options.lineList) this.lineList = JSON.parse(options.lineList)
this.lineId = this.lineList[0].lineId this.lineId = this.lineList[0].lineId
this.engineeringName = options.engineeringName this.engineeringName = options.engineeringName
this.equipmentName = options.equipmentName this.equipmentName = options.equipmentName
this.runStatus = options.runStatus this.runStatus = options.runStatus
this.isPrimaryUser = options.isPrimaryUser
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo) this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
this.echartsData0 = this.initEcharts0() this.echartsData0 = this.initEcharts0()
this.echartsData1 = this.initEcharts1() this.echartsData1 = this.initEcharts1()
this.echartsDataV1 = this.initEcharts('#DAA520', 0, 'A相(kV)') this.echartsDataV1 = this.initEcharts('#DAA520', 0, 'A相')
this.echartsDataV2 = this.initEcharts('#2E8B57', 0, 'B相(kV)') this.echartsDataV2 = this.initEcharts('#2E8B57', 0, 'B相')
this.echartsDataV3 = this.initEcharts('#A52a2a', 0, 'C相(kV)') this.echartsDataV3 = this.initEcharts('#A52a2a', 0, 'C相')
this.echartsDataA1 = this.initEcharts('#DAA520', 1, 'A相(A)') this.echartsDataA1 = this.initEcharts('#DAA520', 1, 'A相')
this.echartsDataA2 = this.initEcharts('#2E8B57', 1, 'B相(A)') this.echartsDataA2 = this.initEcharts('#2E8B57', 1, 'B相')
this.echartsDataA3 = this.initEcharts('#A52a2a', 1, 'C相(A)') this.echartsDataA3 = this.initEcharts('#A52a2a', 1, 'C相')
this.loading = false this.loading = false
this.$nextTick(() => { this.$nextTick(() => {
this.setMqtt(0) this.setMqtt(0)
this.initMqtt() this.initMqtt()
}) })
if (this.isPrimaryUser == 1) {
this.content.splice(
0,
0,
{
iconPath: '/static/transfer.png',
text: '移交',
},
{
iconPath: '/static/feedback.png',
text: '编辑',
},
{
iconPath: '/static/delate.png',
text: '删除',
},
)
if (this.userInfo.authorities === 'app_vip_user') {
this.content.splice(3, 0, {
iconPath: '/static/share.png',
text: '分享',
})
}
}
if (this.userInfo.authorities !== 'tourist') {
this.content.splice(0, 0, {
iconPath: '/static/subordinate.png',
text: '用户',
})
}
}, },
onUnload() { onUnload() {
const charts = [ const charts = [
@@ -623,7 +668,9 @@ export default {
.then((res) => { .then((res) => {
if (res.code == 'A0000') { if (res.code == 'A0000') {
this.connection = true this.connection = true
this.$util.toast(e == 0 ? '连接成功!' : '刷新成功!') setTimeout(() => {
this.$util.toast(e == 0 ? '连接成功!' : '刷新成功!')
}, 3000)
if (this.timer) { if (this.timer) {
clearInterval(this.timer) clearInterval(this.timer)
this.timer = null this.timer = null
@@ -878,6 +925,46 @@ export default {
await this.setMqtt(0) await this.setMqtt(0)
await this.initMqtt() await this.initMqtt()
}, },
trigger(e) {
console.log(e)
if (e.text === '分享') {
uni.navigateTo({ url: '/pages/device/share?id=' + this.lineId })
} else if (e.text === '删除') {
uni.showModal({
title: '提示',
content: '确定删除该设备吗?',
success: (res) => {
if (res.confirm) {
console.log('用户点击确定')
deleteDevice(this.devId).then((res) => {
uni.showToast({
title: '删除成功',
icon: 'none',
})
setTimeout(() => {
uni.navigateBack()
}, 1500)
})
} else if (res.cancel) {
console.log('用户点击取消')
}
},
})
} else if (e.text === '记录') {
uni.navigateTo({ url: '/pages/device/APF/record' })
} else if (e.text === '详情') {
uni.navigateTo({ url: '/pages/device/APF/report?id=' + this.devId })
} else if (e.text === '关于') {
uni.navigateTo({ url: '/pages/device/APF/about?id=' + this.devId })
} else if (e.text === '移交') {
uni.navigateTo({ url: '/pages/device/transfer?id=' + this.devId })
} else if (e.text === '反馈') {
uni.navigateTo({ url: '/pages/device/feedback' })
} else if (e.text === '用户') {
uni.navigateTo({ url: '/pages/device/user?id=' + this.devId + '&isPrimaryUser=' + this.isPrimaryUser })
}
// this.$refs.fab.close()
},
}, },
computed: {}, computed: {},
@@ -990,7 +1077,7 @@ export default {
} }
.text { .text {
text-align: center; text-align: center;
font-size: 30rpx; font-size: 28rpx;
} }
.text_center { .text_center {
position: absolute; position: absolute;

View File

@@ -42,7 +42,7 @@
<script> <script>
import list from '../../common/js/list' import list from '../../common/js/list'
import {queryAllEnginner, csMarketDataAdd, queryEngineering} from '@/common/api/engineering' import { queryAllEnginner, csMarketDataAdd, queryEngineering } from '@/common/api/engineering'
export default { export default {
data() { data() {
@@ -70,12 +70,6 @@ export default {
} else { } else {
this.selectList.push(e.engineerId) this.selectList.push(e.engineerId)
} }
csMarketDataAdd({
engineerIds: this.selectList,
}).then((res) => {
console.log(res)
})
}, },
init() { init() {
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo) this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
@@ -108,15 +102,22 @@ export default {
}) })
}, },
}, },
onUnload() {
csMarketDataAdd({
engineerIds: this.selectList,
}).then((res) => {
console.log(res)
})
},
onBackPress() { onBackPress() {
console.log('onBackPress') console.log('onBackPress')
let engineering = uni.getStorageSync('engineering') let engineering = uni.getStorageSync('engineering')
queryEngineering().then(res => { queryEngineering().then((res) => {
if (res.data.length === 0) { if (res.data.length === 0) {
uni.removeStorage({ uni.removeStorage({
key: this.$cacheKey.engineering, key: this.$cacheKey.engineering,
}) })
} else if (engineering && !res.data.some(item => item.id = engineering.id)) { } else if (engineering && !res.data.some((item) => (item.id = engineering.id))) {
uni.removeStorage({ uni.removeStorage({
key: this.$cacheKey.engineering, key: this.$cacheKey.engineering,
}) })

View File

@@ -107,9 +107,7 @@ export default {
array: ['发生时间', '暂降深度', '持续时间'], array: ['发生时间', '暂降深度', '持续时间'],
} }
}, },
mounted() { mounted() {},
this.setHeight()
},
methods: { methods: {
setHeight() { setHeight() {
@@ -118,10 +116,10 @@ export default {
.boundingClientRect((rect) => { .boundingClientRect((rect) => {
// //
// #ifdef H5 // #ifdef H5
this.height = rect?.height + 100 || 0 this.height = rect?.height + 170 || 0
// #endif // #endif
// #ifdef APP-PLUS // #ifdef APP-PLUS
this.height = rect?.height + 90 || 0 this.height = rect?.height + 100 || 0
// #endif // #endif
}) })
.exec() .exec()
@@ -129,7 +127,9 @@ export default {
async select(val) { async select(val) {
this.selectValue = val this.selectValue = val
await this.init() await this.init()
this.setHeight() setTimeout(() => {
this.setHeight()
}, 200)
}, },
init() { init() {
this.store = this.DataSource('/cs-harmonic-boot/eventUser/queryEventpage') this.store = this.DataSource('/cs-harmonic-boot/eventUser/queryEventpage')

View File

@@ -35,13 +35,12 @@
<view class="header-item-label">离线设备</view> <view class="header-item-label">离线设备</view>
</view> </view>
</view> </view>
<view style="padding: 20rpx 20rpx 0"> <!-- <view style="padding: 20rpx 20rpx 0">
<Cn-grid title=""> <Cn-grid title="">
<Cn-grid-item src="/static/device2.png" text="设备注册" @click="registerDevice"></Cn-grid-item> <Cn-grid-item src="/static/device2.png" text="设备注册" @click="registerDevice"></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> </view> -->
</view> </view>
</template> </template>

View File

@@ -35,11 +35,11 @@
<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" @click="jumpMessage('0')">
<view class="header-item-value">{{ devCount.eventCount || 0 }}</view> <view class="header-item-value">{{ devCount.currentEventCount || 0 }}</view>
<view class="header-item-label">暂态事件数</view> <view class="header-item-label">暂态事件数</view>
</view> </view>
<view class="header-item" @click="jumpMessage('1')"> <view class="header-item" @click="jumpMessage('1')">
<view class="header-item-value">{{ devCount.harmonicCount || 0 }}</view> <view class="header-item-value">{{ devCount.currentHarmonicCount || 0 }}</view>
<view class="header-item-label">稳态事件数</view> <view class="header-item-label">稳态事件数</view>
</view> </view>
</view> </view>

View File

@@ -1,5 +1,6 @@
<template> <template>
<view class="dateReport"> <view class="dateReport">
<!-- {{ height }} -->
<!-- <view class="pd20"> <!-- <view class="pd20">
<uni-segmented-control <uni-segmented-control
:current="curSub" :current="curSub"
@@ -97,7 +98,7 @@ export default {
}, },
created() {}, created() {},
mounted() { mounted() {
this.setHeight() // this.setHeight()
}, },
methods: { methods: {
setHeight() { setHeight() {
@@ -106,7 +107,7 @@ export default {
.boundingClientRect((rect) => { .boundingClientRect((rect) => {
// //
// #ifdef H5 // #ifdef H5
this.height = rect?.height + 20 || 0 this.height = rect?.height + 80 || 0
// #endif // #endif
// #ifdef APP-PLUS // #ifdef APP-PLUS
this.height = rect?.height + 30 || 0 this.height = rect?.height + 30 || 0
@@ -136,10 +137,11 @@ export default {
select(value) { select(value) {
this.selectValue = value this.selectValue = value
this.init() setTimeout(() => {
setTimeout(() => {
this.setHeight() this.setHeight()
}, 100) }, 200)
this.init()
}, },
// 下载 // 下载
download(item) { download(item) {

View File

@@ -13,7 +13,7 @@
<!-- 申请报告 --> <!-- 申请报告 -->
<view v-show="curSub == 0"> <view v-show="curSub == 0">
<!-- apply --> <!-- apply -->
<Apply :navHeight="navHeight" /> <Apply ref="applyRef" :navHeight="navHeight" />
</view> </view>
<!-- 申请记录 --> <!-- 申请记录 -->
@@ -158,10 +158,10 @@ export default {
.boundingClientRect((rect) => { .boundingClientRect((rect) => {
// //
// #ifdef H5 // #ifdef H5
this.height = rect?.height + 115 || 0 this.height = rect?.height + 180 || 0
// #endif // #endif
// #ifdef APP-PLUS // #ifdef APP-PLUS
this.height = rect?.height + 10 || 0 this.height = rect?.height + 110 || 0
// #endif // #endif
}) })
.exec() .exec()
@@ -174,9 +174,11 @@ export default {
this.store.reload() this.store.reload()
}, },
async select(val) { async select(val) {
setTimeout(() => {
this.setHeight()
}, 200)
this.selectValue = val this.selectValue = val
await this.init() await this.init()
this.setHeight()
}, },
sectionChange(index) { sectionChange(index) {
@@ -270,6 +272,19 @@ export default {
}) })
}) })
}, },
// 刷新
reload() {
console.log(123, this.curSub)
switch (this.curSub) {
case 0:
this.$refs.applyRef.store.reload()
break
case 1:
this.store && this.store.reload()
break
}
},
}, },
watch: {}, watch: {},
} }
@@ -340,4 +355,9 @@ export default {
color: #fff; color: #fff;
} }
} }
.segmented-control {
flex: 1;
margin-right: 24rpx;
height: 60rpx;
}
</style> </style>

View File

@@ -1,64 +1,64 @@
<template> <template>
<view :loading="loading"> <view :loading="loading">
<view class="mine"> <view class="mine">
<view class="mine-header" @click="jump('basic')"> <view class="mine-header" @click="jump('basic')">
<image mode="aspectFill" class="mine-header-head" :src="userInfo.avatar" v-if="userInfo.avatar" /> <image mode="aspectFill" class="mine-header-head" :src="userInfo.avatar" v-if="userInfo.avatar" />
<image mode="aspectFill" class="mine-header-head" src="/static/head.png" v-else /> <image mode="aspectFill" class="mine-header-head" src="/static/head.png" v-else />
<view class="mine-header-name hide-txt"> <view class="mine-header-name hide-txt">
<view>{{ userInfo.nickname }}</view> <view>{{ userInfo.nickname }}</view>
<view></view> <view></view>
<view class="tag">{{ roleName }}</view> <view class="tag">{{ roleName }}</view>
</view> </view>
<image <image
src="/static/erweima.png" src="/static/erweima.png"
style="height: 50rpx; width: 50rpx; border-radius: 12rpx" style="height: 50rpx; width: 50rpx; border-radius: 12rpx"
mode="scaleToFill" mode="scaleToFill"
/> />
<uni-icons type="forward" color="#aaa" size="16"></uni-icons> <uni-icons type="forward" color="#aaa" size="16"></uni-icons>
</view> </view>
<view class="mine-nav" v-if="userInfo.authorities === 'tourist'" @click="jump('upgrade')"> <view class="mine-nav" v-if="userInfo.authorities === 'tourist'" @click="jump('upgrade')">
<image mode="aspectFill" class="mine-nav-icon" src="/static/server.png" /> <image mode="aspectFill" class="mine-nav-icon" src="/static/server.png" />
<view class="mine-nav-label">角色升级</view> <view class="mine-nav-label">角色升级</view>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons> <uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view> </view>
<!-- <view class="mine-nav" @click="jump('audit')" v-if="userInfo.authorities === 'app_vip_user'"> <!-- <view class="mine-nav" @click="jump('audit')" v-if="userInfo.authorities === 'app_vip_user'">
<image mode="aspectFill" class="mine-nav-icon" src="/static/server.png" /> <image mode="aspectFill" class="mine-nav-icon" src="/static/server.png" />
<view class="mine-nav-label">角色审核</view> <view class="mine-nav-label">角色审核</view>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons> <uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view> --> </view> -->
<!-- <view class="mine-nav" @click="jump('user')" v-if="userInfo.authorities === 'app_vip_user'"> <!-- <view class="mine-nav" @click="jump('user')" v-if="userInfo.authorities === 'app_vip_user'">
<image mode="aspectFill" class="mine-nav-icon" src="/static/subordinate.png" /> <image mode="aspectFill" class="mine-nav-icon" src="/static/subordinate.png" />
<view class="mine-nav-label">分享用户列表</view> <view class="mine-nav-label">分享用户列表</view>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons> <uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view> --> </view> -->
<view <view
class="mine-nav" class="mine-nav"
@click="jump('scan')" @click="jump('scan')"
v-if="userInfo.authorities === 'app_vip_user' || userInfo.authorities === 'engineering_user'" v-if="userInfo.authorities === 'app_vip_user' || userInfo.authorities === 'engineering_user'"
> >
<image mode="aspectFill" class="mine-nav-icon" src="/static/scan.png" /> <image mode="aspectFill" class="mine-nav-icon" src="/static/scan.png" />
<view class="mine-nav-label">扫一扫</view> <view class="mine-nav-label">扫一扫</view>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons> <uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view> </view>
<view class="mine-nav" @click="jump('engineering')"> <view class="mine-nav" @click="jump('engineering')" v-if="userInfo.authorities !== 'tourist'">
<image mode="aspectFill" class="mine-nav-icon" src="/static/gongcheng.png" /> <image mode="aspectFill" class="mine-nav-icon" src="/static/gongcheng.png" />
<view class="mine-nav-label">工程管理</view> <view class="mine-nav-label">工程管理</view>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons> <uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view> </view>
<view class="mine-nav" @click="jump('project')"> <view class="mine-nav" @click="jump('project')" v-if="userInfo.authorities !== 'tourist'">
<image mode="aspectFill" class="mine-nav-icon" src="/static/project.png" /> <image mode="aspectFill" class="mine-nav-icon" src="/static/project.png" />
<view class="mine-nav-label">项目管理</view> <view class="mine-nav-label">项目管理</view>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons> <uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view> </view>
<view class="mine-nav" @click="jump('feedback')"> <view class="mine-nav" @click="jump('feedback')" v-if="userInfo.authorities !== 'tourist'">
<image mode="aspectFill" class="mine-nav-icon" src="/static/feedback.png" /> <image mode="aspectFill" class="mine-nav-icon" src="/static/feedback.png" />
<view class="mine-nav-label">反馈列表</view> <view class="mine-nav-label">反馈列表</view>
<uni-badge :text="messageCount.feedBackCount"></uni-badge> <uni-badge :text="messageCount.feedBackCount"></uni-badge>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons> <uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view> </view>
<!-- <view <!-- <view
class="mine-nav" class="mine-nav"
@click="jump('gateway')" @click="jump('gateway')"
style="border-bottom: none; box-shadow: 0 4rpx 8rpx #e7e7e74c" style="border-bottom: none; box-shadow: 0 4rpx 8rpx #e7e7e74c"
@@ -67,317 +67,315 @@
<view class="mine-nav-label">网关列表</view> <view class="mine-nav-label">网关列表</view>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons> <uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view> --> </view> -->
<view class="mine-nav" @click="jump('setupMessage')"> <view class="mine-nav" @click="jump('setupMessage')" v-if="userInfo.authorities !== 'tourist'">
<image mode="aspectFill" class="mine-nav-icon" src="/static/message4.png" /> <image mode="aspectFill" class="mine-nav-icon" src="/static/message4.png" />
<view class="mine-nav-label">推送通知</view> <view class="mine-nav-label">推送通知</view>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons> <uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view> </view>
<view <view
class="mine-nav" class="mine-nav"
@click="jump('engineering/setting')" @click="jump('engineering/setting')"
v-if="userInfo.authorities === 'engineering_user'" v-if="userInfo.authorities === 'engineering_user' || userInfo.authorities !== 'tourist'"
> >
<image mode="aspectFill" class="mine-nav-icon" src="/static/like.png" /> <image mode="aspectFill" class="mine-nav-icon" src="/static/like.png" />
<view class="mine-nav-label">关注工程配置</view> <view class="mine-nav-label">关注工程配置</view>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons> <uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view> </view>
<view class="mine-nav" @click="jump('transientSetting')" > <view class="mine-nav" @click="jump('transientSetting')" v-if="userInfo.authorities !== 'tourist'">
<!-- 调试内容配置 serverSetting--> <!-- 调试内容配置 serverSetting-->
<image mode="aspectFill" class="mine-nav-icon" src="/static/server2.png" /> <image mode="aspectFill" class="mine-nav-icon" src="/static/server2.png" />
<view class="mine-nav-label">暂态事件</view> <view class="mine-nav-label">暂态统计配置</view>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons> <uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view> </view>
<view class="mine-nav" @click="jump('setup')" style="border-bottom: none"> <view class="mine-nav" @click="jump('setup')" style="border-bottom: none">
<image mode="aspectFill" class="mine-nav-icon" src="/static/setup.png" /> <image mode="aspectFill" class="mine-nav-icon" src="/static/setup.png" />
<view class="mine-nav-label">设置</view> <view class="mine-nav-label">设置</view>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons> <uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view> </view>
<uni-popup ref="inputDialog" type="dialog"> <uni-popup ref="inputDialog" type="dialog">
<uni-popup-dialog <uni-popup-dialog
ref="inputClose" ref="inputClose"
mode="input" mode="input"
title="角色升级" title="角色升级"
placeholder="请输入六位邀请码" placeholder="请输入六位邀请码"
@confirm="upgrade" @confirm="upgrade"
></uni-popup-dialog> ></uni-popup-dialog>
</uni-popup> </uni-popup>
</view> </view>
<uni-popup ref="alertDialog" type="dialog"> <uni-popup ref="alertDialog" type="dialog">
<uni-popup-dialog <uni-popup-dialog
style="width: 90%; margin: 5%" style="width: 90%; margin: 5%"
type="info" type="info"
cancelText="禁止" cancelText="禁止"
confirmText="允许" confirmText="允许"
title="权限说明" title="权限说明"
content='是否允许"灿能物联"使用相机?' content='是否允许"灿能物联"使用相机?'
@confirm="handleScon('camera')" @confirm="handleScon('camera')"
@close="dialogClose" @close="dialogClose"
></uni-popup-dialog> ></uni-popup-dialog>
</uni-popup> </uni-popup>
<uni-popup ref="message" type="message"> <uni-popup ref="message" type="message">
<uni-popup-message type="info" :duration="0" style="width: 90%; margin: 5%"> <uni-popup-message type="info" :duration="0" style="width: 90%; margin: 5%">
<view style="color: #909399; font-style: 16px">相机权限使用说明:</view> <view style="color: #909399; font-style: 16px">相机权限使用说明:</view>
<view style="color: #6c6c6c; margin-top: 3rpx; "> 用于相机扫描二维码!</view> <view style="color: #6c6c6c; margin-top: 3rpx"> 用于相机扫描二维码!</view>
</uni-popup-message> </uni-popup-message>
</uni-popup> </uni-popup>
<yk-authpup ref="authpup" type="top" @changeAuth="changeAuth" permissionID="CAMERA"></yk-authpup> <yk-authpup ref="authpup" type="top" @changeAuth="changeAuth" permissionID="CAMERA"></yk-authpup>
</view>
</view>
</template> </template>
<script> <script>
import { roleUpdate, autoLogin } from '@/common/api/user' import { roleUpdate, autoLogin } from '@/common/api/user'
import { transferDevice, shareDevice } from '@/common/api/device' import { transferDevice, shareDevice } from '@/common/api/device'
import ykAuthpup from "@/components/yk-authpup/yk-authpup"; import ykAuthpup from '@/components/yk-authpup/yk-authpup'
export default { export default {
components: { components: {
ykAuthpup ykAuthpup,
}, },
data() { data() {
return { return {
loading: true, loading: true,
userInfo: {}, userInfo: {},
messageCount: {}, messageCount: {},
timer: null, timer: null,
} }
}, },
computed: { computed: {
roleName() { roleName() {
let roleName = '' let roleName = ''
switch (this.userInfo.authorities) { switch (this.userInfo.authorities) {
case 'tourist': case 'tourist':
roleName = '游客' roleName = '游客'
break break
case 'engineering_user': case 'engineering_user':
roleName = '工程用户' roleName = '工程用户'
break break
case 'app_vip_user': case 'app_vip_user':
roleName = '正式用户' roleName = '正式用户'
break break
case 'market_user': case 'market_user':
roleName = '营销用户' roleName = '营销用户'
break break
case 'operation_manager': case 'operation_manager':
roleName = '运维管理员' roleName = '运维管理员'
break break
} }
return roleName return roleName
}, },
}, },
onLoad(options) { onLoad(options) {
this.init() this.init()
}, },
methods: { methods: {
init() {}, init() {},
upgrade(code) { upgrade(code) {
console.log(code) console.log(code)
roleUpdate({ roleUpdate({
referralCode: code, referralCode: code,
userId: this.userInfo.userIndex, userId: this.userInfo.userIndex,
}).then((res) => { }).then((res) => {
uni.showToast({ uni.showToast({
title: '升级成功', title: '升级成功',
icon: 'none', icon: 'none',
}) })
uni.removeStorageSync('access_token') uni.removeStorageSync('access_token')
// 直接登录 // 直接登录
autoLogin(this.userInfo.user_name).then((res) => { autoLogin(this.userInfo.user_name).then((res) => {
this.$util.loginSuccess(res.data).then((userInfo) => { this.$util.loginSuccess(res.data).then((userInfo) => {
this.userInfo = userInfo this.userInfo = userInfo
}) })
}) })
}) })
}, },
changeAuth(){ changeAuth() {
//这里是权限通过后执行自己的代码逻辑 //这里是权限通过后执行自己的代码逻辑
console.log('权限已授权,可执行自己的代码逻辑了'); console.log('权限已授权,可执行自己的代码逻辑了')
// this.handleScon() // this.handleScon()
this.handleScon() this.handleScon()
}, },
jump(type) { jump(type) {
switch (type) { switch (type) {
case 'scan': case 'scan':
if ( if (
plus.os.name == 'Android' plus.os.name == 'Android'
// && plus.navigator.checkPermission('android.permission.CAMERA') === 'undetermined' // && plus.navigator.checkPermission('android.permission.CAMERA') === 'undetermined'
) { ) {
//未授权 //未授权
// this.$refs.alertDialog.open('bottom') // this.$refs.alertDialog.open('bottom')
this.$refs['authpup'].open() this.$refs['authpup'].open()
// this.$refs.message.open() // this.$refs.message.open()
} else {
console.log(2)
this.handleScon()
}
} else { break
console.log(2) case 'login':
this.handleScon() uni.navigateTo({
} url: `/pages/user/login`,
})
break
break case 'gateway':
case 'login': uni.navigateTo({
uni.navigateTo({ url: `/pages/gateway/list`,
url: `/pages/user/login`, })
}) break
break case 'upgrade':
case 'gateway': this.$refs.inputDialog.open()
uni.navigateTo({ break
url: `/pages/gateway/list`, case 'basic':
}) uni.navigateTo({
break url: `/pages/user/basic`,
case 'upgrade': })
this.$refs.inputDialog.open() break
break case 'project':
case 'basic': uni.navigateTo({
uni.navigateTo({ url: `/pages/project/list`,
url: `/pages/user/basic`, })
}) break
break case 'engineering':
case 'project': uni.navigateTo({
uni.navigateTo({ url: `/pages/engineering/list`,
url: `/pages/project/list`, })
}) break
break case 'engineering/setting':
case 'engineering': uni.navigateTo({
uni.navigateTo({ url: `/pages/engineering/setting`,
url: `/pages/engineering/list`, })
}) break
break case 'feedback':
case 'engineering/setting': uni.navigateTo({
uni.navigateTo({ url: `/pages/message/feedback`,
url: `/pages/engineering/setting`, })
}) break
break default:
case 'feedback': uni.navigateTo({
uni.navigateTo({ url: `/pages/mine/${type}`,
url: `/pages/message/feedback`, })
}) break
break }
default: },
uni.navigateTo({ handleScon() {
url: `/pages/mine/${type}`, this.$refs.message.close()
}) uni.scanCode({
break onlyFromCamera: true,
} success: (res) => {
}, console.log('条码类型:' + res.scanType)
handleScon(){ console.log('条码内容:' + res.result)
this.$refs.message.close() let content = JSON.parse(res.result)
uni.scanCode({ switch (content.type) {
onlyFromCamera:true, case 'transferDevice':
success: (res) => { this.transferDevice(content.id.split(','))
console.log('条码类型:' + res.scanType) break
console.log('条码内容:' + res.result) case 'shareDevice':
let content = JSON.parse(res.result) this.shareDevice(content.id.split(','))
switch (content.type) { break
case 'transferDevice': default:
this.transferDevice(content.id.split(',')) this.$util.toast('无效二维码')
break break
case 'shareDevice': }
this.shareDevice(content.id.split(',')) },
break })
default: },
this.$util.toast('无效二维码') dialogClose() {
break this.$refs.message.close()
} },
}, transferDevice(id) {
}) transferDevice(id).then((res) => {
}, uni.navigateTo({ url: '/pages/mine/result?type=transferDevice&id=' + id })
dialogClose(){this.$refs.message.close()}, })
transferDevice(id) { },
transferDevice(id).then((res) => { shareDevice(id) {
uni.navigateTo({ url: '/pages/mine/result?type=transferDevice&id=' + id }) shareDevice(id).then((res) => {
}) uni.navigateTo({ url: '/pages/mine/result?type=shareDevice&id=' + id })
}, })
shareDevice(id) { },
shareDevice(id).then((res) => { },
uni.navigateTo({ url: '/pages/mine/result?type=shareDevice&id=' + id }) onShow() {
}) this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
}, this.loading = false
}, this.messageCount = uni.getStorageSync(this.$cacheKey.messageCount) || {}
onShow() { this.timer = setInterval(() => {
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo) this.messageCount = uni.getStorageSync(this.$cacheKey.messageCount) || {}
this.loading = false }, 1000) // 定时请求
this.messageCount = uni.getStorageSync(this.$cacheKey.messageCount) || {} },
this.timer = setInterval(() => { onHide() {
this.messageCount = uni.getStorageSync(this.$cacheKey.messageCount) || {} clearInterval(this.timer)
}, 1000) // 定时请求 },
},
onHide() {
clearInterval(this.timer)
},
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.mine { .mine {
.mine-header { .mine-header {
padding: 200rpx 34rpx 34rpx; padding: 200rpx 34rpx 34rpx;
display: flex; display: flex;
align-items: center; align-items: center;
background: $uni-theme-white; background: $uni-theme-white;
margin-bottom: 20rpx; margin-bottom: 20rpx;
box-shadow: 0 4rpx 8rpx #e7e7e74c; box-shadow: 0 4rpx 8rpx #e7e7e74c;
.mine-header-head { .mine-header-head {
margin-right: 30rpx; margin-right: 30rpx;
height: 128rpx; height: 128rpx;
width: 128rpx; width: 128rpx;
border-radius: $uni-theme-radius; border-radius: $uni-theme-radius;
overflow: hidden; overflow: hidden;
} }
.mine-header-name { .mine-header-name {
margin-right: 30rpx; margin-right: 30rpx;
flex: 1; flex: 1;
font-size: 36rpx; font-size: 36rpx;
color: #111; color: #111;
font-weight: 700; font-weight: 700;
.tag { .tag {
display: flex; display: flex;
align-items: center; align-items: center;
margin-top: 10rpx; margin-top: 10rpx;
font-size: 24rpx; font-size: 24rpx;
color: #aaa; color: #aaa;
.engineering-button { .engineering-button {
margin-left: 10rpx; margin-left: 10rpx;
font-size: 24rpx; font-size: 24rpx;
padding: 5rpx 12rpx; padding: 5rpx 12rpx;
color: #fff; color: #fff;
font-weight: 400; font-weight: 400;
border-radius: 16rpx; border-radius: 16rpx;
background: $uni-theme-color; background: $uni-theme-color;
} }
} }
} }
} }
.mine-nav { .mine-nav {
padding: 34rpx; padding: 34rpx;
display: flex; display: flex;
align-items: center; align-items: center;
background: $uni-theme-white; background: $uni-theme-white;
border-bottom: 1rpx solid #e8e8e8; border-bottom: 1rpx solid #e8e8e8;
&-icon { &-icon {
margin-right: 30rpx; margin-right: 30rpx;
height: 44rpx; height: 44rpx;
width: 44rpx; width: 44rpx;
border-radius: $uni-theme-radius; border-radius: $uni-theme-radius;
overflow: hidden; overflow: hidden;
} }
&-label { &-label {
margin-right: 30rpx; margin-right: 30rpx;
flex: 1; flex: 1;
font-size: 28rpx; font-size: 28rpx;
color: #111; color: #111;
} }
} }
} }
/deep/ .uni-popup-message__box { /deep/ .uni-popup-message__box {
border-radius: 10rpx !important; border-radius: 10rpx !important;
background-color: #fff; background-color: #fff;
} }
</style> </style>

View File

@@ -1,5 +1,6 @@
<template> <template>
<view :loading="loading" class="report" style="padding-top: 10px"> <view :loading="loading" class="report" style="padding-top: 10px">
<view class="navReport"> <view class="navReport">
<view class="tabsBox"> <view class="tabsBox">
<uni-segmented-control <uni-segmented-control
@@ -14,6 +15,7 @@
<!-- 稳态报表 --> <!-- 稳态报表 -->
<SteadyState <SteadyState
v-if="curTabs == 0" v-if="curTabs == 0"
ref="SteadyStateRef"
:indexList="indexList" :indexList="indexList"
:total="total" :total="total"
:status="status" :status="status"
@@ -23,6 +25,7 @@
<!-- 暂态报表 --> <!-- 暂态报表 -->
<Transient <Transient
v-if="curTabs == 1" v-if="curTabs == 1"
ref="TransientRef"
:indexList="indexList" :indexList="indexList"
:total="total" :total="total"
:status="status" :status="status"
@@ -51,58 +54,25 @@ export default {
navHeight: 0, navHeight: 0,
indexList: [ indexList: [],
{
name: '测试监测点',
item: '2022-01-01至2022-01-01',
type: '1',
status: '1',
},
{
name: '测试监测点',
item: '2022-01-01至2022-01-01',
type: '2',
status: '1',
},
{
name: '测试监测点',
item: '2022-01-01至2022-01-01',
type: '1',
status: '1',
},
{
name: '测试监测点',
item: '2022-01-01至2022-01-01',
type: '1',
status: '0',
},
{
name: '测试监测点',
item: '2022-01-01至2022-01-01',
type: '1',
status: '0',
},
{
name: '测试监测点',
item: '2022-01-01至2022-01-01',
type: '1',
status: '0',
},
],
} }
}, },
created() {}, created() {},
onPullDownRefresh() {
this.refresh()
},
mounted() { mounted() {
uni.createSelectorQuery() uni.createSelectorQuery()
.select('.navReport') .select('.navReport')
.boundingClientRect((rect) => { .boundingClientRect((rect) => {
// //
// #ifdef H5 this.navHeight = rect.height
this.navHeight = rect.height + 65 // // #ifdef H5
// #endif
// #ifdef APP-PLUS // // #endif
this.navHeight = rect.height + 25 // // #ifdef APP-PLUS
// #endif // this.navHeight = rect.height
// // #endif
}) })
.exec() .exec()
}, },
@@ -127,6 +97,16 @@ export default {
this.status = 'more' this.status = 'more'
}, 1000) }, 1000)
}, },
refresh() {
switch (this.curTabs) {
case 0:
this.$refs.SteadyStateRef.store.reload()
break
case 1:
this.$refs.TransientRef.reload()
break
}
},
}, },
computed: {}, computed: {},

View File

@@ -11,9 +11,9 @@
<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"> 持续时间{{ detail.evtParamTm }}</view> <view class="mb5"> 持续时间{{ detail.evtParamTm || '-' }}%</view>
<view class="mb5"> 幅值{{ detail.evtParamVVaDepth }}</view> <view class="mb5"> 幅值{{ detail.evtParamVVaDepth || '-' }}s</view>
<view class="mb5"> 相别{{ detail.evtParamPhase }}</view> <view class="mb5"> 相别{{ detail.evtParamPhase || '-' }}</view>
<!-- <view class="mb5" v-for="(item, textIndex) in detail.dataSet" :key="textIndex"> <!-- <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 File

@@ -3,14 +3,20 @@
<!-- 稳态 --> <!-- 稳态 -->
<view class="transientBox"> <view class="transientBox">
<view class="statistics pd20"> <view class="statistics pd20">
<view class="box" :class="{ boxClick: item.label == '稳态数量' }" v-for="item in list"> <view
class="box"
:class="{ boxClick: item.label == filterValue }"
v-for="item in list"
@click="filterValue = item.label"
>
<text class="num">{{ item.value }}</text> <text class="num">{{ item.value }}</text>
<text class="label">{{ item.label }}</text> <text class="label">{{ item.label }}</text>
</view> </view>
</view> </view>
</view> </view>
<!-- 卡片 --> <!-- 稳态数量 -->
<scroll-view <scroll-view
v-if="filterValue == '稳态数量'"
scroll-y="true" scroll-y="true"
@refresherrefresh="refresherrefresh" @refresherrefresh="refresherrefresh"
:refresher-triggered="triggered" :refresher-triggered="triggered"
@@ -66,6 +72,17 @@
></uni-load-more> ></uni-load-more>
<Cn-empty v-else style="top: 20%"></Cn-empty> <Cn-empty v-else style="top: 20%"></Cn-empty>
</scroll-view> </scroll-view>
<!-- 越限天数 -->
<view v-if="filterValue == '越限天数'">
<uni-calendar
:insert="true"
:lunar="false"
:date="startData"
:selected="selected"
:start-date="startData"
:end-date="endData"
/>
</view>
</view> </view>
</template> </template>
<script> <script>
@@ -86,11 +103,20 @@ export default {
data() { data() {
return { return {
height: 0, height: 0,
filterValue: '稳态数量',
list: [ list: [
{ value: 0, label: '稳态数量' }, { value: 0, label: '稳态数量' },
{ value: 0, label: '越限天数' }, { value: 0, label: '越限天数' },
{ value: 0, label: '越限测点数' }, { value: 0, label: '越限测点数' },
], ],
startData: '',
endData: '',
selected: [
{ date: '2026-04-10', info: '' },
{ date: '2026-04-11', info: '' },
{ date: '2026-04-12', info: '' },
// { date: '2026-04-13', info: '' },
],
triggered: true, triggered: true,
status: 'noMore', //more加载前 loading加载中 noMore加载后 status: 'noMore', //more加载前 loading加载中 noMore加载后
} }
@@ -125,11 +151,14 @@ export default {
this.store.params.devId = this.selectValue.deviceId this.store.params.devId = this.selectValue.deviceId
this.store.params.lineId = this.selectValue.lineId this.store.params.lineId = this.selectValue.lineId
this.store.params.time = this.selectValue.date this.store.params.time = this.selectValue.date
this.store.loadedCallback = () => { this.store.loadedCallback = () => {
this.list[0].value = this.store.copyData.harmonicNums this.list[0].value = this.store.copyData.harmonicNums
this.list[1].value = this.store.copyData.overDays this.list[1].value = this.store.copyData.overDays
this.list[2].value = this.store.copyData.overLineNums this.list[2].value = this.store.copyData.overLineNums
this.loading = false this.loading = false
this.startData = this.$util.getMonthFirstAndLastDay(this.selectValue.date).firstDay
this.endData = this.$util.getMonthFirstAndLastDay(this.selectValue.date).lastDay
} }
this.store.reload() this.store.reload()
}, },
@@ -202,4 +231,44 @@ export default {
text-overflow: ellipsis; text-overflow: ellipsis;
word-break: break-all; word-break: break-all;
} }
/deep/ .uni-calendar-item--checked {
background-color: #ffffff00;
color: #000000e6;
opacity: 1;
}
/deep/ .uni-calendar-item--isDay {
background-color: #ffffff00;
color: #000000e6;
opacity: 1;
.uni-calendar-item__weeks-lunar-text {
background-color: #ffffff00;
color: #000000e6;
opacity: 1;
}
}
/deep/ .uni-calendar-item__weeks-box-text {
z-index: 1;
}
/deep/ .uni-calendar-item__weeks-box-circle {
position: absolute;
top: 9px;
right: 9px;
width: 39px;
height: 39px;
border-radius: 50%;
z-index: 0;
background-color: #e43d33;
}
/* 核心:选中圆圈下的 子元素(日期数字) */
/deep/ .uni-calendar-item__weeks-box-circle + .uni-calendar-item__weeks-box-text {
color: #fff !important; /* 改成你想要的颜色 */
}
/deep/ .uni-calendar__backtoday,
/deep/ .uni-calendar__header-btn-box {
display: none;
}
/deep/ .uni-calendar__header {
pointer-events: none !important;
}
</style> </style>

View File

@@ -95,9 +95,9 @@
<!-- 详情区域 --> <!-- 详情区域 -->
<view class="event-detail"> <view class="event-detail">
<text> <text>
发生时间:{{ item.startTime }},幅值:{{ item.evtParamVVaDepth }},持续时间:{{ 发生时间:{{ item.startTime }},幅值:{{ item.evtParamVVaDepth || '-' }}%,持续时间:{{
item.evtParamTm item.evtParamTm || '-'
}},相别:{{ item.evtParamPhase }} }}s,相别:{{ item.evtParamPhase || '-' }}
</text> </text>
</view> </view>
</uni-card> </uni-card>

View File

@@ -48,7 +48,7 @@
<!-- @click="jump('about')" --> <!-- @click="jump('about')" -->
<view class="mine-nav" style="border-bottom: none"> <view class="mine-nav" style="border-bottom: none">
<view class="mine-nav-label">版本信息</view> <view class="mine-nav-label">版本信息</view>
<view style="color: #828282; font-size: 14rpx">当前版本V<1.6.7</view> <view style="color: #828282; font-size: 14rpx">当前版本V{{ version }}</view>
<!-- <uni-icons type="forward" color="#aaa" size="20"></uni-icons> --> <!-- <uni-icons type="forward" color="#aaa" size="20"></uni-icons> -->
</view> </view>
<view class="mine-nav" @click="jump('layout')" style="margin-top: 20rpx; border-bottom: none"> <view class="mine-nav" @click="jump('layout')" style="margin-top: 20rpx; border-bottom: none">
@@ -64,10 +64,19 @@ export default {
data() { data() {
return { return {
loading: false, loading: false,
version: '1.0.0',
} }
}, },
methods: { methods: {
async init() {}, async init() {
const isDev = process.env.NODE_ENV === 'development'
if (isDev) {
return console.log('开发环境,不执行更新检查')
}
plus.runtime.getProperty(plus.runtime.appid, (info) => {
this.version = info.version // 当前本地版本号
})
},
jump(type) { jump(type) {
switch (type) { switch (type) {
case 'changePwd': case 'changePwd':