提交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 {
onLaunch: function () {
// this.checkAppUpdate()
// uni.onPushMessage((res) => {
// console.log("收到推送消息:",res) //监听推送消息
// })
@@ -39,6 +40,209 @@ export default {
onHide: function () {
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>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,172 +1,184 @@
<template>
<view class="basic">
<view class="grid-card">
<view class="grid-card-title">电网电流</view>
<view class="grid-card-content-3">
<view class="item item-title">名称</view>
<view class="item item-title">有效值(A)</view>
<view class="item item-title">畸变率(%)</view>
<template v-for="(item, index) in renderData.电网电流">
<view class="item">{{ item.phase }}</view>
<view class="item">{{
item['Apf_RmsI_Sys(A)'] > 0 ? item['Apf_RmsI_Sys(A)'].toFixed(2) : item['Apf_RmsI_Sys(A)']
}}</view>
<view class="item">{{
item['Apf_ThdA_Sys(%)'] > 0 ? item['Apf_ThdA_Sys(%)'].toFixed(2) : item['Apf_ThdA_Sys(%)']
}}</view>
</template>
</view>
</view>
<view class="grid-card">
<view class="grid-card-title">电网电压</view>
<view class="grid-card-content-4">
<view class="item item-title">名称</view>
<view class="item item-title">电压(V)</view>
<view class="item item-title">频率(Hz)</view>
<view class="item item-title">畸变率(%)</view>
<template v-for="(item, index) in renderData.电网电压">
<view class="item">{{ item.phase }}</view>
<view class="item">{{
item['Apf_PhV_Sys(V)'] > 0 ? item['Apf_PhV_Sys(V)'].toFixed(2) : item['Apf_PhV_Sys(V)']
}}</view>
<view class="item">{{
item['Apf_Freq(Hz)'] > 0 ? item['Apf_Freq(Hz)'].toFixed(2) : item['Apf_Freq(Hz)']
}}</view>
<view class="item">{{
item['Apf_ThdU_Sys(%)'] > 0 ? item['Apf_ThdU_Sys(%)'].toFixed(2) : item['Apf_ThdU_Sys(%)']
}}</view>
</template>
</view>
</view>
<view class="grid-card">
<view class="grid-card-title">负载电流</view>
<view class="grid-card-content-3">
<view class="item item-title">名称</view>
<view class="item item-title">有效值(A)</view>
<view class="item item-title">畸变率(%)</view>
<template v-for="(item, index) in renderData.负载电流">
<view class="item">{{ item.phase }}</view>
<view class="item">{{
item['Apf_RmsI_Load(A)'] > 0 ? item['Apf_RmsI_Load(A)'].toFixed(2) : item['Apf_RmsI_Load(A)']
}}</view>
<view class="item">{{
item['Apf_ThdA_Load(%)'] > 0 ? item['Apf_ThdA_Load(%)'].toFixed(2) : item['Apf_ThdA_Load(%)']
}}</view>
</template>
</view>
</view>
<view class="grid-card">
<view class="grid-card-title">补偿电流</view>
<view class="grid-card-content-3">
<view class="item item-title">名称</view>
<view class="item item-title">有效值(A)</view>
<view class="item item-title">负载率(%)</view>
<template v-for="(item, index) in renderData.补偿电流">
<view class="item">{{ item.phase }}</view>
<view class="item">{{
item['Apf_RmsI_TolOut(A)'] == 3.1415926 ? '-' :
item['Apf_RmsI_TolOut(A)'] > 0
? item['Apf_RmsI_TolOut(A)'].toFixed(2)
: item['Apf_RmsI_TolOut(A)']
}}</view>
<view class="item">{{
item['load_Rate'] == 3.1415926 ? '-' : item['load_Rate'] > 0 ? item['load_Rate'].toFixed(2) :
item['load_Rate']
}}</view>
</template>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
renderData: {
电网电流: [],
电网电压: [],
负载电流: [],
补偿电流: [],
未知: [],
},
}
},
props: {
basicData: {
type: Array,
default: () => {
return []
},
},
},
watch: {
basicData: {
handler: function (newVal, oldVal) {
newVal.forEach((item) => {
if (item.phase === 'avg') {
return
}
let key = ''
switch (item.statisticalName) {
case 'Apf_RmsI_Sys(A)':
key = '电网电流'
break
case 'Apf_ThdA_Sys(%)':
key = '电网电流'
break
case 'Apf_PhV_Sys(V)':
key = '电网电压'
break
case 'Apf_Freq(Hz)':
key = '电网电压'
break
case 'Apf_ThdU_Sys(%)':
key = '电网电压'
break
case 'Apf_RmsI_Load(A)':
key = '负载电流'
break
case 'Apf_ThdA_Load(%)':
key = '负载电流'
break
case 'Apf_RmsI_TolOut(A)':
key = '补偿电流'
break
case 'Apf_PhV_Sys(V)':
key = '补偿电流'
break
case 'Apf_PhV_Sys(V)':
key = '补偿电流'
break
case 'load_Rate':
key = '补偿电流'
break
default:
key = '未知'
break
}
let index = this.renderData[key].findIndex((item2) => {
return item2.phase === item.phase
})
if (index > -1) {
this.renderData[key][index][item.statisticalName] = item.statisticalData //
} else {
this.renderData[key].push({
phase: item.phase,
[item.statisticalName]: item.statisticalData, //,
})
}
})
console.log(this.renderData)
},
deep: true,
immediate: true,
},
},
methods: {},
}
</script>
<style lang="scss">
.basic {}
</style>
<template>
<view>
<uni-load-more status="loading" v-if="basicData.length == 0"></uni-load-more>
<view class="basic" v-else>
<view class="grid-card">
<view class="grid-card-title">电网电流</view>
<view class="grid-card-content-3">
<view class="item item-title">名称</view>
<view class="item item-title">有效值(A)</view>
<view class="item item-title">畸变率(%)</view>
<template v-for="(item, index) in renderData.电网电流">
<view class="item">{{ item.phase }}</view>
<view class="item">{{
item['Apf_RmsI_Sys(A)'] > 0 ? item['Apf_RmsI_Sys(A)'].toFixed(2) : item['Apf_RmsI_Sys(A)']
}}</view>
<view class="item">{{
item['Apf_ThdA_Sys(%)'] > 0 ? item['Apf_ThdA_Sys(%)'].toFixed(2) : item['Apf_ThdA_Sys(%)']
}}</view>
</template>
</view>
</view>
<view class="grid-card">
<view class="grid-card-title">电网电压</view>
<view class="grid-card-content-4">
<view class="item item-title">名称</view>
<view class="item item-title">电压(V)</view>
<view class="item item-title">频率(Hz)</view>
<view class="item item-title">畸变率(%)</view>
<template v-for="(item, index) in renderData.电网电压">
<view class="item">{{ item.phase }}</view>
<view class="item">{{
item['Apf_PhV_Sys(V)'] > 0 ? item['Apf_PhV_Sys(V)'].toFixed(2) : item['Apf_PhV_Sys(V)']
}}</view>
<view class="item">{{
item['Apf_Freq(Hz)'] > 0 ? item['Apf_Freq(Hz)'].toFixed(2) : item['Apf_Freq(Hz)']
}}</view>
<view class="item">{{
item['Apf_ThdU_Sys(%)'] > 0 ? item['Apf_ThdU_Sys(%)'].toFixed(2) : item['Apf_ThdU_Sys(%)']
}}</view>
</template>
</view>
</view>
<view class="grid-card">
<view class="grid-card-title">负载电流</view>
<view class="grid-card-content-3">
<view class="item item-title">名称</view>
<view class="item item-title">有效值(A)</view>
<view class="item item-title">畸变率(%)</view>
<template v-for="(item, index) in renderData.负载电流">
<view class="item">{{ item.phase }}</view>
<view class="item">{{
item['Apf_RmsI_Load(A)'] > 0
? item['Apf_RmsI_Load(A)'].toFixed(2)
: item['Apf_RmsI_Load(A)']
}}</view>
<view class="item">{{
item['Apf_ThdA_Load(%)'] > 0
? item['Apf_ThdA_Load(%)'].toFixed(2)
: item['Apf_ThdA_Load(%)']
}}</view>
</template>
</view>
</view>
<view class="grid-card">
<view class="grid-card-title">补偿电流</view>
<view class="grid-card-content-3">
<view class="item item-title">名称</view>
<view class="item item-title">有效值(A)</view>
<view class="item item-title">负载率(%)</view>
<template v-for="(item, index) in renderData.补偿电流">
<view class="item">{{ item.phase }}</view>
<view class="item">{{
item['Apf_RmsI_TolOut(A)'] == 3.1415926
? '-'
: item['Apf_RmsI_TolOut(A)'] > 0
? item['Apf_RmsI_TolOut(A)'].toFixed(2)
: item['Apf_RmsI_TolOut(A)']
}}</view>
<view class="item">{{
item['load_Rate'] == 3.1415926
? '-'
: item['load_Rate'] > 0
? item['load_Rate'].toFixed(2)
: item['load_Rate']
}}</view>
</template>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
renderData: {
电网电流: [],
电网电压: [],
负载电流: [],
补偿电流: [],
未知: [],
},
}
},
props: {
basicData: {
type: Array,
default: () => {
return []
},
},
},
watch: {
basicData: {
handler: function (newVal, oldVal) {
newVal.forEach((item) => {
if (item.phase === 'avg') {
return
}
let key = ''
switch (item.statisticalName) {
case 'Apf_RmsI_Sys(A)':
key = '电网电流'
break
case 'Apf_ThdA_Sys(%)':
key = '电网电流'
break
case 'Apf_PhV_Sys(V)':
key = '电网电压'
break
case 'Apf_Freq(Hz)':
key = '电网电压'
break
case 'Apf_ThdU_Sys(%)':
key = '电网电压'
break
case 'Apf_RmsI_Load(A)':
key = '负载电流'
break
case 'Apf_ThdA_Load(%)':
key = '负载电流'
break
case 'Apf_RmsI_TolOut(A)':
key = '补偿电流'
break
case 'Apf_PhV_Sys(V)':
key = '补偿电流'
break
case 'Apf_PhV_Sys(V)':
key = '补偿电流'
break
case 'load_Rate':
key = '补偿电流'
break
default:
key = '未知'
break
}
let index = this.renderData[key].findIndex((item2) => {
return item2.phase === item.phase
})
if (index > -1) {
this.renderData[key][index][item.statisticalName] = item.statisticalData //
} else {
this.renderData[key].push({
phase: item.phase,
[item.statisticalName]: item.statisticalData, //,
})
}
})
console.log(this.renderData)
},
deep: true,
immediate: true,
},
},
methods: {},
}
</script>
<style lang="scss">
.basic {
}
</style>

View File

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

View File

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

View File

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

View File

@@ -69,7 +69,7 @@
@finished="initChart('echartV3', 'echartsDataV3')"
></l-echart>
</view>
<view class="text"> 电压有效值 </view>
<view class="text"> 电压有效值(kV) </view>
</view>
<view class="middle" style="width: 100%">
<l-echart
@@ -103,7 +103,7 @@
@finished="initChart('echartA3', 'echartsDataA3')"
></l-echart>
</view>
<view class="text"> 有效值 </view>
<view class="text"> 有效值(A) </view>
</view>
</view>
</view>
@@ -125,6 +125,7 @@
</view>
</view>
</view>
<hover-menu :btnList="content" @trigger="trigger"></hover-menu>
</view>
</Cn-page>
</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 from 'mqtt/dist/mqtt.js'
import { getBaseRealData } from '@/common/api/harmonic.js'
import hoverMenu from '@/hover-menu/components/hover-menu/hover-menu.vue'
export default {
components: {},
components: { hoverMenu },
props: {},
data() {
return {
loading: true,
devId: '',
// 使用上面定义的图表配置项
option: {},
echartsData0: {},
@@ -183,30 +186,72 @@ export default {
equipmentName: '',
runStatus: 1,
connection: false,
content: [
{
iconPath: '/static/report.png',
text: '详情',
},
{
iconPath: '/static/about.png',
text: '关于',
},
],
isPrimaryUser: 0,
}
},
onLoad(options) {
console.log('🚀 ~ options:', options)
this.lineKey = 0
this.devId = options.id
this.lineList = JSON.parse(options.lineList)
this.lineId = this.lineList[0].lineId
this.engineeringName = options.engineeringName
this.equipmentName = options.equipmentName
this.runStatus = options.runStatus
this.isPrimaryUser = options.isPrimaryUser
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
this.echartsData0 = this.initEcharts0()
this.echartsData1 = this.initEcharts1()
this.echartsDataV1 = this.initEcharts('#DAA520', 0, 'A相(kV)')
this.echartsDataV2 = this.initEcharts('#2E8B57', 0, 'B相(kV)')
this.echartsDataV3 = this.initEcharts('#A52a2a', 0, 'C相(kV)')
this.echartsDataA1 = this.initEcharts('#DAA520', 1, 'A相(A)')
this.echartsDataA2 = this.initEcharts('#2E8B57', 1, 'B相(A)')
this.echartsDataA3 = this.initEcharts('#A52a2a', 1, 'C相(A)')
this.echartsDataV1 = this.initEcharts('#DAA520', 0, 'A相')
this.echartsDataV2 = this.initEcharts('#2E8B57', 0, 'B相')
this.echartsDataV3 = this.initEcharts('#A52a2a', 0, 'C相')
this.echartsDataA1 = this.initEcharts('#DAA520', 1, 'A相')
this.echartsDataA2 = this.initEcharts('#2E8B57', 1, 'B相')
this.echartsDataA3 = this.initEcharts('#A52a2a', 1, 'C相')
this.loading = false
this.$nextTick(() => {
this.setMqtt(0)
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() {
const charts = [
@@ -623,7 +668,9 @@ export default {
.then((res) => {
if (res.code == 'A0000') {
this.connection = true
this.$util.toast(e == 0 ? '连接成功!' : '刷新成功!')
setTimeout(() => {
this.$util.toast(e == 0 ? '连接成功!' : '刷新成功!')
}, 3000)
if (this.timer) {
clearInterval(this.timer)
this.timer = null
@@ -878,6 +925,46 @@ export default {
await this.setMqtt(0)
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: {},
@@ -990,7 +1077,7 @@ export default {
}
.text {
text-align: center;
font-size: 30rpx;
font-size: 28rpx;
}
.text_center {
position: absolute;

View File

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

View File

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

View File

@@ -35,13 +35,12 @@
<view class="header-item-label">离线设备</view>
</view>
</view>
<view style="padding: 20rpx 20rpx 0">
<!-- <view style="padding: 20rpx 20rpx 0">
<Cn-grid title="">
<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>
</view>
</view> -->
</view>
</template>

View File

@@ -35,11 +35,11 @@
<view class="header-item-label">离线设备</view>
</view>
<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>
<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>
</view>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -3,14 +3,20 @@
<!-- 稳态 -->
<view class="transientBox">
<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="label">{{ item.label }}</text>
</view>
</view>
</view>
<!-- 卡片 -->
<!-- 稳态数量 -->
<scroll-view
v-if="filterValue == '稳态数量'"
scroll-y="true"
@refresherrefresh="refresherrefresh"
:refresher-triggered="triggered"
@@ -66,6 +72,17 @@
></uni-load-more>
<Cn-empty v-else style="top: 20%"></Cn-empty>
</scroll-view>
<!-- 越限天数 -->
<view v-if="filterValue == '越限天数'">
<uni-calendar
:insert="true"
:lunar="false"
:date="startData"
:selected="selected"
:start-date="startData"
:end-date="endData"
/>
</view>
</view>
</template>
<script>
@@ -86,11 +103,20 @@ export default {
data() {
return {
height: 0,
filterValue: '稳态数量',
list: [
{ 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,
status: 'noMore', //more加载前 loading加载中 noMore加载后
}
@@ -125,11 +151,14 @@ export default {
this.store.params.devId = this.selectValue.deviceId
this.store.params.lineId = this.selectValue.lineId
this.store.params.time = this.selectValue.date
this.store.loadedCallback = () => {
this.list[0].value = this.store.copyData.harmonicNums
this.list[1].value = this.store.copyData.overDays
this.list[2].value = this.store.copyData.overLineNums
this.loading = false
this.startData = this.$util.getMonthFirstAndLastDay(this.selectValue.date).firstDay
this.endData = this.$util.getMonthFirstAndLastDay(this.selectValue.date).lastDay
}
this.store.reload()
},
@@ -202,4 +231,44 @@ export default {
text-overflow: ellipsis;
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>

View File

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

View File

@@ -48,7 +48,7 @@
<!-- @click="jump('about')" -->
<view class="mine-nav" style="border-bottom: none">
<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> -->
</view>
<view class="mine-nav" @click="jump('layout')" style="margin-top: 20rpx; border-bottom: none">
@@ -64,10 +64,19 @@ export default {
data() {
return {
loading: false,
version: '1.0.0',
}
},
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) {
switch (type) {
case 'changePwd':