提交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,128 +1,128 @@
import request from '../js/request' import request from '../js/request'
import config from '../js/config' import config from '../js/config'
export function addAppProject(params, files) { export function addAppProject(params, files) {
if (files.length === 0) { if (files.length === 0) {
return request({ return request({
url: '/cs-device-boot/project/addAppProject', url: '/cs-device-boot/project/addAppProject',
method: 'post', method: 'post',
data: params, data: params,
}) })
} else { } else {
return uni.uploadFile({ return uni.uploadFile({
url: config.domain + '/cs-device-boot/project/addAppProject', //仅为示例,非真实的接口地址 url: config.domain + '/cs-device-boot/project/addAppProject', //仅为示例,非真实的接口地址
files: files, files: files,
header: { header: {
Authorization: uni.getStorageSync('access_token'), Authorization: uni.getStorageSync('access_token'),
}, },
formData: params, formData: params,
}) })
} }
} }
// 修改项目 // 修改项目
export function updateAppProject(params, files) { export function updateAppProject(params, files) {
if (files.length === 0) { if (files.length === 0) {
return request({ return request({
url: '/cs-device-boot/project/auditAppProject', url: '/cs-device-boot/project/auditAppProject',
method: 'post', method: 'post',
data: params, data: params,
}) })
} else { } else {
return uni.uploadFile({ return uni.uploadFile({
url: config.domain + '/cs-device-boot/project/auditAppProject', //仅为示例,非真实的接口地址 url: config.domain + '/cs-device-boot/project/auditAppProject', //仅为示例,非真实的接口地址
files: files, files: files,
header: { header: {
Authorization: uni.getStorageSync('access_token'), Authorization: uni.getStorageSync('access_token'),
}, },
formData: params, formData: params,
}) })
} }
} }
export function getProjectList(params) { export function getProjectList(params) {
return request({ return request({
url: '/cs-device-boot/project/queryProject', url: '/cs-device-boot/project/queryProject',
method: 'post', method: 'post',
data: params, data: params,
header: { header: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
}) })
} }
// 删除项目 // 删除项目
export function deleteProject(id) { export function deleteProject(id) {
return request({ return request({
url: '/cs-device-boot/project/auditAppProject', url: '/cs-device-boot/project/auditAppProject',
method: 'post', method: 'post',
data: { data: {
id, id,
status: 0, status: 0,
}, },
}) })
} }
// 查询拓扑图 // 查询拓扑图
export function queryTopologyDiagramPage(params) { export function queryTopologyDiagramPage(params) {
return request({ return request({
url: '/cs-device-boot/topologyDiagram/queryTopologyDiagramPage', url: '/cs-device-boot/topologyDiagram/queryTopologyDiagramPage',
method: 'post', method: 'post',
data: Object.assign( data: Object.assign(
{ {
pageNum: 1, pageNum: 1,
pageSize: 999, pageSize: 999,
projectId: '', projectId: '',
searchValue: '', searchValue: '',
}, },
params, params,
), ),
header: { header: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
}) })
} }
// 删除拓扑图 // 删除拓扑图
export function deleteAppTopologyDiagram(id) { export function deleteAppTopologyDiagram(id) {
return request({ return request({
url: '/cs-device-boot/topologyDiagram/AuditAppTopologyDiagram', url: '/cs-device-boot/topologyDiagram/AuditAppTopologyDiagram',
method: 'post', method: 'post',
data: { data: {
id, id,
status: 0, status: 0,
}, },
}) })
} }
// 删除拓扑图 // 删除拓扑图
export function checkCanDelete(id) { export function checkCanDelete(id) {
return request({ return request({
url: '/cs-device-boot/topologyDiagram/checkCanDelete', url: '/cs-device-boot/topologyDiagram/checkCanDelete',
method: 'post', method: 'post',
data: { data: {
id, id,
}, },
}) })
} }
// 新增拓扑图 // 新增拓扑图
export function addAppTopologyDiagram(params, filePath) { export function addAppTopologyDiagram(params, filePath) {
return uni.uploadFile({ return uni.uploadFile({
url: config.domain + '/cs-device-boot/topologyDiagram/addAppTopologyDiagram', //仅为示例,非真实的接口地址 url: config.domain + '/cs-device-boot/topologyDiagram/addAppTopologyDiagram', //仅为示例,非真实的接口地址
filePath, filePath,
name: 'file', name: 'file',
header: { header: {
Authorization: uni.getStorageSync('access_token'), Authorization: uni.getStorageSync('access_token'),
}, },
formData: Object.assign( formData: Object.assign(
{ {
topologyDiagramName: '', topologyDiagramName: '',
projectId: '', projectId: '',
}, },
params, params,
), ),
}) })
} }

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">-->
</template> <!-- <view class="grid-card-title">干接点</view>-->
<script> <!-- <view class="grid-card-content-4">-->
import { <!-- <view class="item item-title">干接点1</view>-->
getModuleState <!-- <view class="item item-title">干接点2</view>-->
} from '@/common/api/harmonic.js' <!-- <view class="item item-title"></view>-->
export default { <!-- <view class="item item-title"></view>-->
<!-- <view class="item">正常</view>-->
props: { <!-- <view class="item">正常</view>-->
IOData: { <!-- <view class="item"></view>-->
type: Array, <!-- <view class="item"></view>-->
default: () => { <!-- </view>-->
return [] <!-- </view>-->
}, </view>
}, </view>
ndid: { </template>
type: String, <script>
}, import { getModuleState } from '@/common/api/harmonic.js'
}, export default {
data() { props: {
return { IOData: {
list: [], type: Array,
userInfo: {}, default: () => {
flag: false return []
} },
}, },
computed: { ndid: {
renderData() { type: String,
let arr = [] },
// 把IOData转换成每4个一组的二维数组 },
for (let i = 0; i < this.IOData.length; i += 4) { data() {
this.IOData.slice(i, i + 4).forEach((item) => { return {
if (Number.isInteger(item.value) || item.value == '') {} else { list: [],
item.value = (item.value - 0).toFixed(2) userInfo: {},
} flag: false,
}) }
arr.push(this.IOData.slice(i, i + 4)) },
} computed: {
// 把每组的长度补齐到4 renderData() {
arr.forEach((item) => { let arr = []
if (item.length < 4) { // 把IOData转换成每4个一组的二维数组
let length = 4 - item.length for (let i = 0; i < this.IOData.length; i += 4) {
for (let i = 0; i < length; i++) { this.IOData.slice(i, i + 4).forEach((item) => {
item.push({}) if (Number.isInteger(item.value) || item.value == '') {
} } else {
} item.value = (item.value - 0).toFixed(2)
}) }
console.warn(arr) })
return arr arr.push(this.IOData.slice(i, i + 4))
}, }
moduleData() { // 把每组的长度补齐到4
let arr = [] arr.forEach((item) => {
// 把IOData转换成每4个一组的二维数组 if (item.length < 4) {
for (let i = 0; i < this.list.length; i += 4) { let length = 4 - item.length
arr.push(this.list.slice(i, i + 4)) for (let i = 0; i < length; i++) {
} item.push({})
// 把每组的长度补齐到4 }
arr.forEach((item) => { }
if (item.length < 4) { })
let length = 4 - item.length console.warn(arr)
for (let i = 0; i < length; i++) { return arr
item.push({}) },
} moduleData() {
} let arr = []
}) // 把IOData转换成每4个一组的二维数组
console.warn(arr) for (let i = 0; i < this.list.length; i += 4) {
return arr arr.push(this.list.slice(i, i + 4))
}, }
}, // 把每组的长度补齐到4
methods: { arr.forEach((item) => {
info() { if (item.length < 4) {
getModuleState({ let length = 4 - item.length
id: this.ndid for (let i = 0; i < length; i++) {
}).then((res) => { item.push({})
this.list = res.data }
}) }
}, })
}, console.warn(arr)
mounted() { return arr
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo) },
},
this.info() methods: {
}, info() {
} getModuleState({
</script> id: this.ndid,
<style lang="scss"> }).then((res) => {
.basic {} this.list = res.data
</style> })
},
},
mounted() {
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
this.info()
},
}
</script>
<style lang="scss">
.basic {
}
</style>

View File

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

@@ -1,286 +1,292 @@
<template> <template>
<Cn-page :loading="loading" noPadding> <Cn-page :loading="loading" noPadding>
<view slot="body"> <view slot="body">
<view class="detail"> <view class="detail">
<view class="detail-header"> <view class="detail-header">
<view class="header"> <view class="header">
<image <image
src="http://localhost:8088/api/system-boot/file/download?filePath=topology/1aca98ceb22a1fc33b81d9101275ef1.png" src="http://localhost:8088/api/system-boot/file/download?filePath=topology/1aca98ceb22a1fc33b81d9101275ef1.png"
mode="widthFix" style="width: 100%" /> mode="widthFix" style="width: 100%" />
</view> </view>
<!-- <view class="des"> <!-- <view class="des">
<text>设备基础信息</text> <text>设备基础信息</text>
<text class="ml10">设备状态</text> <text class="ml10">设备状态</text>
</view> --> </view> -->
<view class="nav"> <view class="nav">
<view class="nav-menu" :class="{ 'nav-menu-active': navMenuActive == index }" <view class="nav-menu" :class="{ 'nav-menu-active': navMenuActive == index }"
v-for="(item, index) in navMenuList" :key="index" @click="navMenuClick(index)">{{ item.text v-for="(item, index) in navMenuList" :key="index" @click="navMenuClick(index)">{{ item.text
}} }}
</view> </view>
</view> </view>
</view> </view>
<view class="content"> <view class="content">
<DianWang v-if="navMenuActive == 0"></DianWang> <DianWang v-if="navMenuActive == 0"></DianWang>
<NiBian v-else-if="navMenuActive == 1"></NiBian> <NiBian v-else-if="navMenuActive == 1"></NiBian>
<ShuChu v-else-if="navMenuActive == 2"></ShuChu> <ShuChu v-else-if="navMenuActive == 2"></ShuChu>
<GanJieDian v-else-if="navMenuActive == 3"></GanJieDian> <GanJieDian v-else-if="navMenuActive == 3"></GanJieDian>
<ZhuangTaiLiang v-else-if="navMenuActive == 4"> </ZhuangTaiLiang> <ZhuangTaiLiang v-else-if="navMenuActive == 4"> </ZhuangTaiLiang>
<QiTa v-else-if="navMenuActive == 5"></QiTa> <QiTa v-else-if="navMenuActive == 5"></QiTa>
<view style="height: 20rpx"></view> <view style="height: 20rpx"></view>
</view> </view>
<!-- <uni-fab <!-- <uni-fab
ref="fab" ref="fab"
direction="vertical" direction="vertical"
horizontal="right" horizontal="right"
vertical="bottom" vertical="bottom"
:content="content" :content="content"
@trigger="trigger" @trigger="trigger"
/> --> /> -->
<hover-menu :btnList="content" @trigger='trigger'></hover-menu> <hover-menu :btnList="content" @trigger='trigger'></hover-menu>
</view> </view>
</view> </view>
</Cn-page> </Cn-page>
</template> </template>
<script> <script>
import DianWang from './comp/dianWang.vue' import DianWang from './comp/dianWang.vue'
import NiBian from './comp/niBian.vue' import NiBian from './comp/niBian.vue'
import ShuChu from './comp/shuChu.vue' import ShuChu from './comp/shuChu.vue'
import GanJieDian from './comp/ganJieDian.vue' import GanJieDian from './comp/ganJieDian.vue'
import ZhuangTaiLiang from './comp/zhuangTaiLiang.vue' import ZhuangTaiLiang from './comp/zhuangTaiLiang.vue'
import QiTa from './comp/qiTa.vue' import QiTa from './comp/qiTa.vue'
import { manualAccess } from '@/common/api/accessBoot' import { manualAccess } from '@/common/api/accessBoot'
import hoverMenu from '@/hover-menu/components/hover-menu/hover-menu.vue'; import hoverMenu from '@/hover-menu/components/hover-menu/hover-menu.vue';
export default { export default {
components: { components: {
DianWang, DianWang,
NiBian, NiBian,
ShuChu, ShuChu,
GanJieDian, GanJieDian,
ZhuangTaiLiang, ZhuangTaiLiang,
QiTa, QiTa,
hoverMenu hoverMenu
}, },
data() { data() {
return { return {
loading: false, loading: false,
navMenuActive: 0, navMenuActive: 0,
navHeight: 0, navHeight: 0,
pageOptions: {}, pageOptions: {},
navMenuList: [ navMenuList: [
{ {
text: '电网数据', text: '电网数据',
}, },
{ {
text: '逆变数据', text: '逆变数据',
}, },
{ {
text: '输出数据', text: '输出数据',
}, },
{ {
text: '干接点', text: '干接点',
}, },
{ {
text: '状态量', text: '状态量',
}, },
{ {
text: '其他', text: '其他',
}, },
], ],
content: [ content: [
{ {
iconPath: '/static/report.png', iconPath: '/static/report.png',
text: '告警', text: '详情',
}, },
{ // {
iconPath: '/static/record.png', // iconPath: '/static/record.png',
text: '记录', // text: '记录',
}, // },
{ {
iconPath: '/static/about.png', iconPath: '/static/about.png',
text: '关于', text: '关于',
}, },
{ // {
iconPath: '/static/access.png', // iconPath: '/static/access.png',
text: '接入', // text: '接入',
}, // },
], ],
} }
}, },
methods: { methods: {
trigger(e) { trigger(e) {
console.log(e) console.log(e)
if (e.text === '分享') { if (e.text === '分享') {
this.$refs.share.open() this.$refs.share.open()
} else if (e.text === '删除') { } else if (e.text === '删除') {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '确定删除该设备吗?', content: '确定删除该设备吗?',
success: function (res) { success: function (res) {
if (res.confirm) { if (res.confirm) {
console.log('用户点击确定') console.log('用户点击确定')
} else if (res.cancel) { } else if (res.cancel) {
console.log('用户点击取消') console.log('用户点击取消')
} }
}, },
}) })
} else if (e.text === '下载') { } else if (e.text === '下载') {
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' })
} else if (e.text === '移交') { } else if (e.text === '移交') {
uni.navigateTo({ url: '/pages/device/transfer' }) uni.navigateTo({ url: '/pages/device/transfer' })
} else if (e.text === '反馈') { } else if (e.text === '反馈') {
uni.navigateTo({ url: '/pages/device/feedback' }) uni.navigateTo({ url: '/pages/device/feedback' })
} else if (e.text === '用户') { } else if (e.text === '用户') {
uni.navigateTo({ url: '/pages/device/user' }) uni.navigateTo({ url: '/pages/device/user' })
} else if (e.text === '接入') { } else if (e.text === '接入') {
manualAccess({ nDid: this.pageOptions.ndid }).then((res) => { manualAccess({ nDid: this.pageOptions.ndid }).then((res) => {
this.$util.toast(res.message) this.$util.toast(res.message)
}) })
} }
// this.$refs.fab.close() // this.$refs.fab.close()
}, },
navMenuClick(idx) { navMenuClick(idx) {
this.navMenuActive = idx this.navMenuActive = idx
uni.pageScrollTo({ scrollTop: 0, duration: 0 }) uni.pageScrollTo({ scrollTop: 0, duration: 0 })
}, },
init() { init() {
let userInfo = uni.getStorageSync(this.$cacheKey.userInfo) let userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
console.log(userInfo.authorities) console.log(userInfo.authorities)
switch (userInfo.authorities) { switch (userInfo.authorities) {
case 1: case 1:
this.content.splice( this.content.splice(
0, 0,
0, 0,
{ {
iconPath: '/static/version.png', iconPath: '/static/version.png',
text: '版本', text: '版本',
}, },
{ {
iconPath: '/static/template.png', iconPath: '/static/template.png',
text: '模版', text: '模版',
}, },
) )
break break
case 3: case 3:
this.content.splice(1, 0, { this.content.splice(1, 0, {
iconPath: '/static/transfer.png', iconPath: '/static/transfer.png',
text: '移交', text: '移交',
}) })
break break
case 4: case 4:
this.content.splice( this.content.splice(
0, 0,
0, 0,
{ {
iconPath: '/static/subordinate.png', iconPath: '/static/subordinate.png',
text: '用户', text: '用户',
}, },
{ {
iconPath: '/static/delate.png', iconPath: '/static/delate.png',
text: '删除', text: '删除',
}, },
) )
break break
case 5: case 5:
this.content.push({ this.content.push({
iconPath: '/static/feedback.png', iconPath: '/static/feedback.png',
text: '反馈', text: '反馈',
}) })
break break
default: default:
break break
} }
setTimeout(() => { if (this.userInfo.authorities === 'operation_manager') {
// 获取nav高度 this.content.push({
uni.createSelectorQuery() iconPath: '/static/access.png',
.select('.nav') text: '接入',
.boundingClientRect((rect) => { })
this.navHeight = rect.height }
}) setTimeout(() => {
.exec() // 获取nav高度
}, 1000) uni.createSelectorQuery()
}, .select('.nav')
}, .boundingClientRect((rect) => {
onLoad(options) { this.navHeight = rect.height
this.pageOptions = options })
this.init() .exec()
}, }, 1000)
} },
</script> },
<style lang="scss"> onLoad(options) {
.detail { this.pageOptions = options
this.init()
// background: $uni-theme-white; },
.header {} }
</script>
.des { <style lang="scss">
padding: 20rpx 20rpx 0; .detail {
font-size: 28rpx;
color: #999; // background: $uni-theme-white;
} .header {}
// .nav { .des {
// position: sticky; padding: 20rpx 20rpx 0;
// top: 0; font-size: 28rpx;
// left: 0; color: #999;
// padding-top: 20rpx; }
// display: flex;
// flex-wrap: wrap; // .nav {
// background: rgb(243, 244, 245); // position: sticky;
// top: 0;
// .nav-menu { // left: 0;
// padding: 10rpx 20rpx; // padding-top: 20rpx;
// margin-left: 20rpx; // display: flex;
// margin-bottom: 20rpx; // flex-wrap: wrap;
// font-size: 28rpx; // background: rgb(243, 244, 245);
// border-radius: 8rpx;
// background: $uni-theme-white; // .nav-menu {
// padding: 10rpx 20rpx;
// &-active { // margin-left: 20rpx;
// background: $uni-theme-color; // margin-bottom: 20rpx;
// color: #fff; // font-size: 28rpx;
// } // border-radius: 8rpx;
// } // background: $uni-theme-white;
// } // &-active {
// background: $uni-theme-color;
.content { // color: #fff;
box-sizing: border-box; // }
padding: 0 20rpx; // }
}
// }
.detail-header {
position: sticky; .content {
top: 0; box-sizing: border-box;
left: 0; padding: 0 20rpx;
z-index: 2; }
background: #f3f4f5;
} .detail-header {
} position: sticky;
top: 0;
/deep/ .uni-fab__circle--rightBottom { left: 0;
right: 8px !important; z-index: 2;
bottom: 8px !important; background: #f3f4f5;
} }
}
/deep/ .uni-fab--rightBottom {
right: 8px !important; /deep/ .uni-fab__circle--rightBottom {
bottom: 8px !important; right: 8px !important;
} bottom: 8px !important;
}
/deep/ .uni-fab__circle {
width: 50px; /deep/ .uni-fab--rightBottom {
height: 54px; right: 8px !important;
} bottom: 8px !important;
}
/deep/ .uni-fab__content--flexDirectionEnd {
width: 50px !important; /deep/ .uni-fab__circle {
// height: 50px !important; width: 50px;
} height: 54px;
</style> }
/deep/ .uni-fab__content--flexDirectionEnd {
width: 50px !important;
// height: 50px !important;
}
</style>

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

@@ -1,224 +1,225 @@
<template> <template>
<view :loading="loading"> <view :loading="loading">
<uni-search-bar v-model="keyWord" bgColor="#fff" placeholder="请输入关键词"></uni-search-bar> <uni-search-bar v-model="keyWord" bgColor="#fff" placeholder="请输入关键词"></uni-search-bar>
<view class="message"> <view class="message">
<!-- <uni-card <!-- <uni-card
:title="item.engineerName" :title="item.engineerName"
:extra="item.mac" :extra="item.mac"
@click="jump(item)" @click="jump(item)"
v-for="(item, index) in list" v-for="(item, index) in list"
:key="index" :key="index"
> >
<view class="term-list-bottom"> <view class="term-list-bottom">
<view class="term-list-bottom-item"> <view class="term-list-bottom-item">
<view>区域</view> <view>区域</view>
<view>{{ item.provinceName + item.cityName }}</view> <view>{{ item.provinceName + item.cityName }}</view>
</view> </view>
<view class="term-list-bottom-item"> <view class="term-list-bottom-item">
<view>创建时间</view> <view>创建时间</view>
<view>{{ item.createTime }}</view> <view>{{ item.createTime }}</view>
</view> </view>
</view> </view>
</uni-card> --> </uni-card> -->
<uni-list> <uni-list>
<uni-list-item @click="jump(item)" v-for="(item, index) in filterList" :key="index"> <uni-list-item @click="jump(item)" v-for="(item, index) in filterList" :key="index">
<template v-slot:header> <template v-slot:header>
<view class="slot-box"> <view class="slot-box">
<view class="slot-box-left hide-txt mr20">{{ item.engineerName }}</view> <view class="slot-box-left hide-txt mr20">{{ item.engineerName }}</view>
<switch <switch
:checked="selectList.indexOf(item.engineerId) > -1" :checked="selectList.indexOf(item.engineerId) > -1"
style="transform: scale(0.8)" style="transform: scale(0.8)"
@change="switchChange(item)" @change="switchChange(item)"
/> />
</view> </view>
</template> </template>
</uni-list-item> </uni-list-item>
</uni-list> </uni-list>
<uni-load-more v-if="list && list.length > 0" status="nomore"></uni-load-more> <uni-load-more v-if="list && list.length > 0" status="nomore"></uni-load-more>
<Cn-empty v-else style="padding-top: 300rpx"></Cn-empty> <Cn-empty v-else style="padding-top: 300rpx"></Cn-empty>
</view> </view>
</view> </view>
</template> </template>
<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() {
return { return {
loading: true, loading: true,
userInfo: {}, userInfo: {},
list: [], list: [],
selectList: [], selectList: [],
keyWord: '', keyWord: '',
} }
}, },
computed: { computed: {
filterList() { filterList() {
return this.list.filter((item) => { return this.list.filter((item) => {
return item.engineerName.indexOf(this.keyWord) > -1 return item.engineerName.indexOf(this.keyWord) > -1
}) })
}, },
}, },
methods: { methods: {
switchChange(e) { switchChange(e) {
console.log(e) console.log(e)
let index = this.selectList.indexOf(e.engineerId) let index = this.selectList.indexOf(e.engineerId)
if (index > -1) { if (index > -1) {
this.selectList.splice(index, 1) this.selectList.splice(index, 1)
} else { } else {
this.selectList.push(e.engineerId) this.selectList.push(e.engineerId)
} }
},
csMarketDataAdd({ init() {
engineerIds: this.selectList, this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
}).then((res) => { queryAllEnginner().then((res) => {
console.log(res) this.list = res.data
}) console.log(this.list)
}, this.selectList = res.data.filter((item) => item.isSelect === '1').map((item) => item.engineerId)
init() { console.log(this.selectList)
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo) this.loading = false
queryAllEnginner().then((res) => { })
this.list = res.data },
console.log(this.list) back() {
this.selectList = res.data.filter((item) => item.isSelect === '1').map((item) => item.engineerId) uni.navigateBack()
console.log(this.selectList) },
this.loading = false add() {
}) uni.navigateTo({
}, url: `/pages/engineering/new`,
back() { })
uni.navigateBack() },
}, upgrade(code) {
add() { console.log(code)
uni.navigateTo({ uni.showToast({
url: `/pages/engineering/new`, title: '升级成功',
}) icon: 'none',
}, })
upgrade(code) { },
console.log(code) jump(engineering) {
uni.showToast({ uni.navigateTo({
title: '升级成功', url: `/pages/engineering/detail?engineering=${encodeURIComponent(JSON.stringify(engineering))}`,
icon: 'none', })
}) },
}, },
jump(engineering) { onUnload() {
uni.navigateTo({ csMarketDataAdd({
url: `/pages/engineering/detail?engineering=${encodeURIComponent(JSON.stringify(engineering))}`, engineerIds: this.selectList,
}) }).then((res) => {
}, console.log(res)
}, })
onBackPress() { },
console.log('onBackPress') onBackPress() {
let engineering = uni.getStorageSync('engineering') console.log('onBackPress')
queryEngineering().then(res => { let engineering = uni.getStorageSync('engineering')
if (res.data.length === 0) { queryEngineering().then((res) => {
uni.removeStorage({ if (res.data.length === 0) {
key: this.$cacheKey.engineering, uni.removeStorage({
}) key: this.$cacheKey.engineering,
} else if (engineering && !res.data.some(item => item.id = engineering.id)) { })
uni.removeStorage({ } else if (engineering && !res.data.some((item) => (item.id = engineering.id))) {
key: this.$cacheKey.engineering, uni.removeStorage({
}) key: this.$cacheKey.engineering,
} else { })
uni.setStorage({ } else {
key: this.$cacheKey.engineering, uni.setStorage({
data: res.data[0], key: this.$cacheKey.engineering,
}) data: res.data[0],
} })
}) }
}, })
onLoad() { },
this.init() onLoad() {
}, this.init()
} },
</script> }
</script>
<style lang="scss">
.message { <style lang="scss">
/deep/ .slot-box { .message {
width: 100%; /deep/ .slot-box {
display: flex; width: 100%;
align-items: center; display: flex;
align-items: center;
&-left {
flex: 1; &-left {
margin-right: 20rpx; flex: 1;
} margin-right: 20rpx;
} }
}
/deep/ .uni-list-item__content {
padding-right: 0; /deep/ .uni-list-item__content {
} padding-right: 0;
}
.message-header {
padding: 200rpx 34rpx 34rpx; .message-header {
display: flex; padding: 200rpx 34rpx 34rpx;
align-items: center; display: flex;
background: $uni-theme-white; align-items: center;
margin-bottom: 20rpx; background: $uni-theme-white;
box-shadow: 0 4rpx 8rpx #e7e7e74c; margin-bottom: 20rpx;
box-shadow: 0 4rpx 8rpx #e7e7e74c;
.message-header-head {
margin-right: 30rpx; .message-header-head {
height: 128rpx; margin-right: 30rpx;
width: 128rpx; height: 128rpx;
border-radius: $uni-theme-radius; width: 128rpx;
overflow: hidden; border-radius: $uni-theme-radius;
} overflow: hidden;
}
.message-header-name {
margin-right: 30rpx; .message-header-name {
flex: 1; margin-right: 30rpx;
font-size: 36rpx; flex: 1;
color: #111; font-size: 36rpx;
font-weight: 700; color: #111;
font-weight: 700;
.tag {
margin-top: 10rpx; .tag {
font-size: 24rpx; margin-top: 10rpx;
color: #aaa; font-size: 24rpx;
} color: #aaa;
} }
} }
}
.message-nav {
padding: 34rpx; .message-nav {
display: flex; padding: 34rpx;
align-items: center; display: flex;
background: $uni-theme-white; align-items: center;
border-bottom: 1rpx solid #e8e8e8; background: $uni-theme-white;
border-bottom: 1rpx solid #e8e8e8;
&-icon {
margin-right: 30rpx; &-icon {
height: 44rpx; margin-right: 30rpx;
width: 44rpx; height: 44rpx;
border-radius: $uni-theme-radius; width: 44rpx;
overflow: hidden; border-radius: $uni-theme-radius;
} overflow: hidden;
}
&-label {
margin-right: 30rpx; &-label {
flex: 1; margin-right: 30rpx;
font-size: 28rpx; flex: 1;
color: #111; font-size: 28rpx;
} color: #111;
} }
} }
}
.term-list-bottom {
.term-list-bottom-item { .term-list-bottom {
font-size: 28rpx; .term-list-bottom-item {
margin-bottom: 20rpx; font-size: 28rpx;
display: flex; margin-bottom: 20rpx;
justify-content: space-between; display: flex;
// view:first-of-type{ justify-content: space-between;
// color: #111; // view:first-of-type{
// } // color: #111;
} // }
}
.term-list-bottom-item:last-of-type {
margin-bottom: 0; .term-list-bottom-item:last-of-type {
} margin-bottom: 0;
} }
</style> }
</style>

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-dialog
style="width: 90%; margin: 5%"
type="info"
cancelText="禁止"
confirmText="允许"
title="权限说明"
content='是否允许"灿能物联"使用相机?'
@confirm="handleScon('camera')"
@close="dialogClose"
></uni-popup-dialog>
</uni-popup>
<uni-popup ref="message" type="message">
<uni-popup-message type="info" :duration="0" style="width: 90%; margin: 5%">
<view style="color: #909399; font-style: 16px">相机权限使用说明:</view>
<view style="color: #6c6c6c; margin-top: 3rpx; "> 用于相机扫描二维码!</view>
</uni-popup-message>
</uni-popup>
<yk-authpup ref="authpup" type="top" @changeAuth="changeAuth" permissionID="CAMERA"></yk-authpup>
</view> <uni-popup ref="alertDialog" type="dialog">
<uni-popup-dialog
style="width: 90%; margin: 5%"
type="info"
cancelText="禁止"
confirmText="允许"
title="权限说明"
content='是否允许"灿能物联"使用相机?'
@confirm="handleScon('camera')"
@close="dialogClose"
></uni-popup-dialog>
</uni-popup>
<uni-popup ref="message" type="message">
<uni-popup-message type="info" :duration="0" style="width: 90%; margin: 5%">
<view style="color: #909399; font-style: 16px">相机权限使用说明:</view>
<view style="color: #6c6c6c; margin-top: 3rpx"> 用于相机扫描二维码!</view>
</uni-popup-message>
</uni-popup>
<yk-authpup ref="authpup" type="top" @changeAuth="changeAuth" permissionID="CAMERA"></yk-authpup>
</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 {
} else { console.log(2)
console.log(2) this.handleScon()
this.handleScon() }
}
break
break case 'login':
case 'login': uni.navigateTo({
uni.navigateTo({ url: `/pages/user/login`,
url: `/pages/user/login`, })
}) break
break case 'gateway':
case 'gateway': uni.navigateTo({
uni.navigateTo({ url: `/pages/gateway/list`,
url: `/pages/gateway/list`, })
}) break
break case 'upgrade':
case 'upgrade': this.$refs.inputDialog.open()
this.$refs.inputDialog.open() break
break case 'basic':
case 'basic': uni.navigateTo({
uni.navigateTo({ url: `/pages/user/basic`,
url: `/pages/user/basic`, })
}) break
break case 'project':
case 'project': uni.navigateTo({
uni.navigateTo({ url: `/pages/project/list`,
url: `/pages/project/list`, })
}) break
break case 'engineering':
case 'engineering': uni.navigateTo({
uni.navigateTo({ url: `/pages/engineering/list`,
url: `/pages/engineering/list`, })
}) break
break case 'engineering/setting':
case 'engineering/setting': uni.navigateTo({
uni.navigateTo({ url: `/pages/engineering/setting`,
url: `/pages/engineering/setting`, })
}) break
break case 'feedback':
case 'feedback': uni.navigateTo({
uni.navigateTo({ url: `/pages/message/feedback`,
url: `/pages/message/feedback`, })
}) break
break default:
default: uni.navigateTo({
uni.navigateTo({ url: `/pages/mine/${type}`,
url: `/pages/mine/${type}`, })
}) break
break }
} },
}, handleScon() {
handleScon(){ this.$refs.message.close()
this.$refs.message.close() uni.scanCode({
uni.scanCode({ onlyFromCamera: true,
onlyFromCamera:true, success: (res) => {
success: (res) => { console.log('条码类型:' + res.scanType)
console.log('条码类型' + res.scanType) console.log('条码内容' + res.result)
console.log('条码内容:' + res.result) let content = JSON.parse(res.result)
let content = JSON.parse(res.result) switch (content.type) {
switch (content.type) { case 'transferDevice':
case 'transferDevice': this.transferDevice(content.id.split(','))
this.transferDevice(content.id.split(',')) break
break case 'shareDevice':
case 'shareDevice': this.shareDevice(content.id.split(','))
this.shareDevice(content.id.split(',')) break
break default:
default: this.$util.toast('无效二维码')
this.$util.toast('无效二维码') break
break }
} },
}, })
}) },
}, dialogClose() {
dialogClose(){this.$refs.message.close()}, this.$refs.message.close()
transferDevice(id) { },
transferDevice(id).then((res) => { transferDevice(id) {
uni.navigateTo({ url: '/pages/mine/result?type=transferDevice&id=' + id }) transferDevice(id).then((res) => {
}) uni.navigateTo({ url: '/pages/mine/result?type=transferDevice&id=' + id })
}, })
shareDevice(id) { },
shareDevice(id).then((res) => { shareDevice(id) {
uni.navigateTo({ url: '/pages/mine/result?type=shareDevice&id=' + id }) shareDevice(id).then((res) => {
}) uni.navigateTo({ url: '/pages/mine/result?type=shareDevice&id=' + id })
}, })
}, },
onShow() { },
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo) onShow() {
this.loading = false this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
this.messageCount = uni.getStorageSync(this.$cacheKey.messageCount) || {} this.loading = false
this.timer = setInterval(() => { this.messageCount = uni.getStorageSync(this.$cacheKey.messageCount) || {}
this.messageCount = uni.getStorageSync(this.$cacheKey.messageCount) || {} this.timer = setInterval(() => {
}, 1000) // 定时请求 this.messageCount = uni.getStorageSync(this.$cacheKey.messageCount) || {}
}, }, 1000) // 定时请求
onHide() { },
clearInterval(this.timer) 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':