优化强制更新功能
This commit is contained in:
4
App.vue
4
App.vue
@@ -1,11 +1,11 @@
|
|||||||
<script>
|
<script>
|
||||||
import { queryDictDataCache } from './common/api/dictionary.js'
|
import { queryDictDataCache } from './common/api/dictionary.js'
|
||||||
import { getImageUrl } from '@/common/api/basic'
|
import { getImageUrl } from '@/common/api/basic'
|
||||||
import { checkAppUpdate } from './common/js/update.js'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
onLaunch: function () {
|
onLaunch: function () {
|
||||||
checkAppUpdate()
|
|
||||||
// uni.onPushMessage((res) => {
|
// uni.onPushMessage((res) => {
|
||||||
// console.log("收到推送消息:",res) //监听推送消息
|
// console.log("收到推送消息:",res) //监听推送消息
|
||||||
// })
|
// })
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
const debug = true // true 是连地服务端本地,false 是连接线上
|
const debug = true // true 是连地服务端本地,false 是连接线上
|
||||||
|
|
||||||
const development = {
|
const development = {
|
||||||
domain: 'http://192.168.2.126:10215',
|
domain: 'http://192.168.1.103:10215',
|
||||||
}
|
}
|
||||||
|
|
||||||
const production = {
|
const production = {
|
||||||
|
|||||||
@@ -1,20 +1,69 @@
|
|||||||
import { getLastData } from '../api/user.js'
|
import { getLastData } from '../api/user.js'
|
||||||
|
|
||||||
|
/** 规范化版本号,如 v1.6.83 → [1, 6, 83] */
|
||||||
|
const normalizeVersion = (version) => {
|
||||||
|
if (!version) return []
|
||||||
|
return String(version)
|
||||||
|
.replace(/^v/i, '')
|
||||||
|
.split('.')
|
||||||
|
.map((part) => parseInt(part, 10) || 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 比较版本号
|
||||||
|
* @returns 1 远端较新需更新 | 0 相同 | -1 本地较新
|
||||||
|
*/
|
||||||
|
const compareVersion = (remote, local) => {
|
||||||
|
const remoteParts = normalizeVersion(remote)
|
||||||
|
const localParts = normalizeVersion(local)
|
||||||
|
const len = Math.max(remoteParts.length, localParts.length)
|
||||||
|
|
||||||
|
for (let i = 0; i < len; i++) {
|
||||||
|
const rv = remoteParts[i] || 0
|
||||||
|
const lv = localParts[i] || 0
|
||||||
|
if (rv > lv) return 1
|
||||||
|
if (rv < lv) return -1
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 自定义调试基座 / HBuilder 标准基座,不走线上更新 */
|
||||||
|
const isCustomDebugBase = (appName = '') => {
|
||||||
|
return /自定义基座|custom debug|HBuilder|DCloud/i.test(appName)
|
||||||
|
}
|
||||||
|
|
||||||
export const checkAppUpdate = () => {
|
export const checkAppUpdate = () => {
|
||||||
|
// #ifndef APP-PLUS
|
||||||
|
return
|
||||||
|
// #endif
|
||||||
|
|
||||||
// 开发环境跳过检查
|
// 开发环境跳过检查
|
||||||
const isDev = process.env.NODE_ENV === 'development'
|
const isDev = process.env.NODE_ENV === 'development'
|
||||||
// if (isDev) {
|
if (isDev) {
|
||||||
console.log('开发环境,不执行更新检查')
|
console.log('开发环境,不执行更新检查')
|
||||||
return
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 自定义基座调试,跳过更新检查
|
||||||
|
// try {
|
||||||
|
// const { appName } = uni.getSystemInfoSync()
|
||||||
|
// if (isCustomDebugBase(appName)) {
|
||||||
|
// console.log('自定义基座调试中,不执行更新检查')
|
||||||
|
// return
|
||||||
// }
|
// }
|
||||||
|
// } catch (e) {}
|
||||||
|
|
||||||
// 获取当前应用信息
|
// 获取当前应用信息
|
||||||
plus.runtime.getProperty(plus.runtime.appid, (info) => {
|
plus.runtime.getProperty(plus.runtime.appid, (info) => {
|
||||||
|
// if (isCustomDebugBase(info?.name)) {
|
||||||
|
// console.log('自定义基座调试中,不执行更新检查')
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
|
||||||
const currentVersion = info.version
|
const currentVersion = info.version
|
||||||
|
|
||||||
getLastData()
|
getLastData()
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
||||||
// let res = {
|
// let res = {
|
||||||
// data: {
|
// data: {
|
||||||
// versionName: 'v1.6.83',
|
// versionName: 'v1.6.83',
|
||||||
@@ -29,16 +78,17 @@ export const checkAppUpdate = () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 适配新的接口返回格式
|
// 适配新的接口返回格式,默认强制更新
|
||||||
const { versionName, androidPath, iosPath, forceUpdate = '1' } = res.data
|
const { versionName, androidPath, iosPath, forceUpdate = '1' } = res.data
|
||||||
|
console.log('🚀 ~ checkAppUpdate ~ versionName, currentVersion:', versionName, currentVersion)
|
||||||
|
|
||||||
// 版本相同则不需要更新
|
// 版本相同或本地较新则不需要更新
|
||||||
if (versionName.includes(currentVersion)) {
|
if (compareVersion(versionName, currentVersion) <= 0) {
|
||||||
console.log('已是最新版本')
|
console.log('已是最新版本')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const isForce = forceUpdate === '1' // 字符串 '1' 表示强制更新
|
const isForce = forceUpdate !== '0' // 默认强制更新,'0' 为可选更新
|
||||||
|
|
||||||
const iosUrl = iosPath
|
const iosUrl = iosPath
|
||||||
|
|
||||||
@@ -58,9 +108,9 @@ const handleUpdate = ({ version, androidPath, iosUrl, isForce }) => {
|
|||||||
const isIOS = plus.os.name === 'iOS'
|
const isIOS = plus.os.name === 'iOS'
|
||||||
|
|
||||||
if (isAndroid) {
|
if (isAndroid) {
|
||||||
handleAndroidUpdate({ androidPath, isForce })
|
handleAndroidUpdate({ version, androidPath, isForce })
|
||||||
} else if (isIOS) {
|
} else if (isIOS) {
|
||||||
handleIOSUpdate({ iosUrl, isForce })
|
handleIOSUpdate({ version, iosUrl, isForce })
|
||||||
} else {
|
} else {
|
||||||
console.warn('未知操作系统')
|
console.warn('未知操作系统')
|
||||||
}
|
}
|
||||||
@@ -69,7 +119,7 @@ const handleUpdate = ({ version, androidPath, iosUrl, isForce }) => {
|
|||||||
/**
|
/**
|
||||||
* 处理安卓更新
|
* 处理安卓更新
|
||||||
*/
|
*/
|
||||||
const handleAndroidUpdate = ({ androidPath, isForce }) => {
|
const handleAndroidUpdate = ({ version, androidPath, isForce }) => {
|
||||||
if (!androidPath?.length) {
|
if (!androidPath?.length) {
|
||||||
console.error('未找到安卓安装包')
|
console.error('未找到安卓安装包')
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@@ -80,18 +130,18 @@ const handleAndroidUpdate = ({ androidPath, isForce }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const downloadUrl = androidPath
|
const downloadUrl = androidPath
|
||||||
|
const content = isForce ? `发现新版本 ${version},请立即更新后继续使用` : `发现新版本 ${version},是否立即更新?`
|
||||||
|
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '更新提示',
|
title: '更新提示',
|
||||||
content: '发现新版本,是否立即更新?',
|
content,
|
||||||
showCancel: !isForce, // 强制更新隐藏取消按钮
|
showCancel: false,
|
||||||
confirmText: '去更新',
|
confirmText: '去更新',
|
||||||
cancelText: '暂不更新',
|
|
||||||
success: (modalRes) => {
|
success: (modalRes) => {
|
||||||
if (modalRes.confirm) {
|
if (modalRes.confirm) {
|
||||||
downloadAndInstallApk(downloadUrl)
|
downloadAndInstallApk(downloadUrl)
|
||||||
} else if (isForce) {
|
} else if (isForce) {
|
||||||
// 强制更新且用户取消,退出应用
|
// 强制更新:用户按返回键关闭弹窗时退出
|
||||||
plus.runtime.quit()
|
plus.runtime.quit()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -101,7 +151,7 @@ const handleAndroidUpdate = ({ androidPath, isForce }) => {
|
|||||||
/**
|
/**
|
||||||
* 处理iOS更新
|
* 处理iOS更新
|
||||||
*/
|
*/
|
||||||
const handleIOSUpdate = ({ iosUrl, isForce }) => {
|
const handleIOSUpdate = ({ version, iosUrl, isForce }) => {
|
||||||
if (!iosUrl) {
|
if (!iosUrl) {
|
||||||
console.error('未找到iOS下载链接')
|
console.error('未找到iOS下载链接')
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@@ -111,22 +161,23 @@ const handleIOSUpdate = ({ iosUrl, isForce }) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const content = isForce
|
||||||
|
? `发现新版本 ${version},请前往 App Store 更新后继续使用`
|
||||||
|
: `发现新版本 ${version},请前往 App Store 更新`
|
||||||
|
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '更新提示',
|
title: '更新提示',
|
||||||
content: '发现新版本,请前往 App Store 更新',
|
content,
|
||||||
showCancel: !isForce,
|
showCancel: false,
|
||||||
confirmText: '去更新',
|
confirmText: '去更新',
|
||||||
cancelText: '暂不更新',
|
|
||||||
success: (modalRes) => {
|
success: (modalRes) => {
|
||||||
if (modalRes.confirm) {
|
if (modalRes.confirm) {
|
||||||
plus.runtime.openURL(iosUrl)
|
plus.runtime.openURL(iosUrl)
|
||||||
}
|
|
||||||
|
|
||||||
// 强制更新时,无论确认还是取消都退出应用
|
|
||||||
if (isForce) {
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
plus.runtime.quit()
|
plus.runtime.quit()
|
||||||
}, 300) // 给跳转留一点时间
|
}, 300)
|
||||||
|
} else if (isForce) {
|
||||||
|
// 强制更新且用户取消,退出应用
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -143,14 +194,22 @@ const downloadAndInstallApk = (url) => {
|
|||||||
close: false, // 不允许用户关闭
|
close: false, // 不允许用户关闭
|
||||||
padlock: true, // 锁定屏幕
|
padlock: true, // 锁定屏幕
|
||||||
})
|
})
|
||||||
|
let progressClosed = false
|
||||||
|
|
||||||
|
const closeProgress = () => {
|
||||||
|
if (progressClosed) return
|
||||||
|
progressClosed = true
|
||||||
|
progressWaiting.close()
|
||||||
|
}
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
filename: '_doc/update/canneng_wulian.apk',
|
filename: '_doc/update/canneng_wulian.apk',
|
||||||
timeout: 120,
|
timeout: 300,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('🚀 ~ downloadAndInstallApk ~ url:', url)
|
||||||
const downloadTask = plus.downloader.createDownload(url, options, (downloadedFile, status) => {
|
const downloadTask = plus.downloader.createDownload(url, options, (downloadedFile, status) => {
|
||||||
progressWaiting.close()
|
closeProgress()
|
||||||
|
|
||||||
if (status === 200) {
|
if (status === 200) {
|
||||||
installApk(downloadedFile.filename, url)
|
installApk(downloadedFile.filename, url)
|
||||||
@@ -161,9 +220,10 @@ const downloadAndInstallApk = (url) => {
|
|||||||
|
|
||||||
// // 更新进度
|
// // 更新进度
|
||||||
downloadTask.addEventListener('statechanged', (task) => {
|
downloadTask.addEventListener('statechanged', (task) => {
|
||||||
|
if (progressClosed) return
|
||||||
if (task.state === 3 && task.totalSize > 0) {
|
if (task.state === 3 && task.totalSize > 0) {
|
||||||
const percent = ((task.downloadedSize / task.totalSize) * 100).toFixed(0)
|
const percent = ((task.downloadedSize / task.totalSize) * 100).toFixed(0)
|
||||||
console.log("🚀 ~ downloadAndInstallApk ~ percent:", percent)
|
console.log('🚀 ~ downloadAndInstallApk ~ percent:', percent)
|
||||||
// 直接更新 waiting 的标题,不会闪烁
|
// 直接更新 waiting 的标题,不会闪烁
|
||||||
progressWaiting.setTitle(`正在下载更新 ${percent}%`)
|
progressWaiting.setTitle(`正在下载更新 ${percent}%`)
|
||||||
}
|
}
|
||||||
@@ -197,11 +257,13 @@ const installApk = (filePath, downloadUrl) => {
|
|||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '安装失败',
|
title: '安装失败',
|
||||||
content: `安装失败:${error.message}\n请检查是否已开启安装权限`,
|
content: `安装失败:${error.message}\n请检查是否已开启安装权限`,
|
||||||
|
showCancel: false,
|
||||||
confirmText: '重试',
|
confirmText: '重试',
|
||||||
cancelText: '取消',
|
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
downloadAndInstallApk(downloadUrl)
|
downloadAndInstallApk(downloadUrl)
|
||||||
|
} else {
|
||||||
|
plus.runtime.quit()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -216,11 +278,13 @@ const handleDownloadError = (downloadUrl) => {
|
|||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '下载失败',
|
title: '下载失败',
|
||||||
content: '网络异常或下载链接失效,是否重试?',
|
content: '网络异常或下载链接失效,是否重试?',
|
||||||
|
showCancel: false,
|
||||||
confirmText: '重试',
|
confirmText: '重试',
|
||||||
cancelText: '取消',
|
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
downloadAndInstallApk(downloadUrl)
|
downloadAndInstallApk(downloadUrl)
|
||||||
|
} else {
|
||||||
|
plus.runtime.quit()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -16,15 +16,15 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
svgHtml() {
|
svgHtml() {
|
||||||
if (this.name == '电压暂降') {
|
if (this.name == '暂降') {
|
||||||
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="100" height="100">
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="100" height="100">
|
||||||
<path d="M8,50 L15,50 L18,38 L21,28 L24,38 L27,50 L30,62 L33,72 L36,62 L39,50 L42,38 L45,28 L48,38 L51,50 L54,56 L56,54 L58,55 L60,54 L63,56 L66,60 L68,62 L70,60 L72,56 L75,54 L77,52 L79,54 L81,56 L84,50 L87,38 L90,28 L93,38 L96,50" fill="none" stroke="#2563eb" stroke-width="4"/>
|
<path d="M8,50 L15,50 L18,38 L21,28 L24,38 L27,50 L30,62 L33,72 L36,62 L39,50 L42,38 L45,28 L48,38 L51,50 L54,56 L56,54 L58,55 L60,54 L63,56 L66,60 L68,62 L70,60 L72,56 L75,54 L77,52 L79,54 L81,56 L84,50 L87,38 L90,28 L93,38 L96,50" fill="none" stroke="#2563eb" stroke-width="4"/>
|
||||||
</svg>`
|
</svg>`
|
||||||
} else if (this.name == '电压暂升') {
|
} else if (this.name == '暂升') {
|
||||||
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="100" height="100">
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="100" height="100">
|
||||||
<path d="M8,50 L15,50 L18,38 L21,28 L24,38 L27,50 L30,62 L33,72 L36,62 L39,50 L42,38 L45,28 L48,38 L51,50 L54,43 L56,34 L58,26 L60,34 L63,43 L66,54 L68,60 L70,54 L72,43 L75,34 L77,26 L79,34 L81,43 L84,50 L87,38 L90,28 L93,38 L96,50" fill="none" stroke="#e6a23c" stroke-width="4"/>
|
<path d="M8,50 L15,50 L18,38 L21,28 L24,38 L27,50 L30,62 L33,72 L36,62 L39,50 L42,38 L45,28 L48,38 L51,50 L54,43 L56,34 L58,26 L60,34 L63,43 L66,54 L68,60 L70,54 L72,43 L75,34 L77,26 L79,34 L81,43 L84,50 L87,38 L90,28 L93,38 L96,50" fill="none" stroke="#e6a23c" stroke-width="4"/>
|
||||||
</svg>`
|
</svg>`
|
||||||
} else if (this.name == '电压中断') {
|
} else if (this.name == '中断') {
|
||||||
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="100" height="100">
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="100" height="100">
|
||||||
<path d="M8,50 L15,50 L18,38 L21,28 L24,38 L27,50 L30,62 L33,72 L36,62 L39,50 L42,38 L45,28 L48,38 L51,50 L54,50 L57,50 L60,50 L63,50 L66,50 L69,50 L72,50 L75,50 L78,50 L81,50 L84,50 L87,38 L90,28 L93,38 L96,50" fill="none" stroke="#6b7280" stroke-width="4"/>
|
<path d="M8,50 L15,50 L18,38 L21,28 L24,38 L27,50 L30,62 L33,72 L36,62 L39,50 L42,38 L45,28 L48,38 L51,50 L54,50 L57,50 L60,50 L63,50 L66,50 L69,50 L72,50 L75,50 L78,50 L81,50 L84,50 L87,38 L90,28 L93,38 L96,50" fill="none" stroke="#6b7280" stroke-width="4"/>
|
||||||
</svg>`
|
</svg>`
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.INTERNET\"/>",
|
"<uses-permission android:name=\"android.permission.INTERNET\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.REQUEST_INSTALL_PACKAGES\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||||
@@ -124,7 +125,10 @@
|
|||||||
"setting" : {
|
"setting" : {
|
||||||
"urlCheck" : false
|
"urlCheck" : false
|
||||||
},
|
},
|
||||||
"usingComponents" : true
|
"usingComponents" : true,
|
||||||
|
"unipush" : {
|
||||||
|
"enable" : false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"mp-alipay" : {
|
"mp-alipay" : {
|
||||||
"usingComponents" : true
|
"usingComponents" : true
|
||||||
@@ -139,7 +143,7 @@
|
|||||||
"/api" : {
|
"/api" : {
|
||||||
"https" : true,
|
"https" : true,
|
||||||
// "target" : "https://pqmcn.com:8092/api",
|
// "target" : "https://pqmcn.com:8092/api",
|
||||||
"target" : "http://192.168.2.126:10215",
|
"target" : "http://192.168.1.103:10215",
|
||||||
"changOrigin" : true,
|
"changOrigin" : true,
|
||||||
"pathRewrite" : {
|
"pathRewrite" : {
|
||||||
"/api" : ""
|
"/api" : ""
|
||||||
@@ -152,7 +156,7 @@
|
|||||||
"base" : ""
|
"base" : ""
|
||||||
},
|
},
|
||||||
"unipush" : {
|
"unipush" : {
|
||||||
"enable" : false
|
"enable" : true
|
||||||
},
|
},
|
||||||
"sdkConfigs" : {
|
"sdkConfigs" : {
|
||||||
"maps" : {}
|
"maps" : {}
|
||||||
|
|||||||
@@ -118,7 +118,7 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/mine/setupMessage",
|
"path": "pages/mine/setupMessage",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "个性化推荐"
|
"navigationBarTitleText": "推送通知配置"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -5,14 +5,8 @@
|
|||||||
<view class="transfer">
|
<view class="transfer">
|
||||||
<!-- <div class="transfer-img" ref="qrCodeUrl" /> -->
|
<!-- <div class="transfer-img" ref="qrCodeUrl" /> -->
|
||||||
<!-- <uqrcode ref="uqrcode" canvas-id="qrcode" :value="content" :options="{ margin: 10 }"></uqrcode> -->
|
<!-- <uqrcode ref="uqrcode" canvas-id="qrcode" :value="content" :options="{ margin: 10 }"></uqrcode> -->
|
||||||
<uqrcode
|
<uqrcode ref="uqrcode" canvas-id="qrcode" :value="content" size="200" @complete="complete"
|
||||||
ref="uqrcode"
|
:loading="false"></uqrcode>
|
||||||
canvas-id="qrcode"
|
|
||||||
:value="content"
|
|
||||||
size="200"
|
|
||||||
@complete="complete"
|
|
||||||
:loading="false"
|
|
||||||
></uqrcode>
|
|
||||||
<view style="height: 200rpx"></view>
|
<view style="height: 200rpx"></view>
|
||||||
<view class="transfer-text">请让接收人员扫码接收</view>
|
<view class="transfer-text">请让接收人员扫码接收</view>
|
||||||
<view class="transfer-btn">
|
<view class="transfer-btn">
|
||||||
@@ -25,16 +19,8 @@
|
|||||||
</view>
|
</view>
|
||||||
</Cn-page>
|
</Cn-page>
|
||||||
<uni-popup ref="alertDialog" type="dialog">
|
<uni-popup ref="alertDialog" type="dialog">
|
||||||
<uni-popup-dialog
|
<uni-popup-dialog style="width: 90%; margin: 5%" type="info" cancelText="禁止" confirmText="允许" title="权限说明"
|
||||||
style="width: 90%; margin: 5%"
|
content='是否允许"灿能物联"使用相机?' @confirm="handleScon('camera')" @close="dialogClose"></uni-popup-dialog>
|
||||||
type="info"
|
|
||||||
cancelText="禁止"
|
|
||||||
confirmText="允许"
|
|
||||||
title="权限说明"
|
|
||||||
content='是否允许"灿能物联"使用相机?'
|
|
||||||
@confirm="handleScon('camera')"
|
|
||||||
@close="dialogClose"
|
|
||||||
></uni-popup-dialog>
|
|
||||||
</uni-popup>
|
</uni-popup>
|
||||||
<uni-popup ref="message" type="message">
|
<uni-popup ref="message" type="message">
|
||||||
<uni-popup-message type="info" :duration="0" style="width: 90%; margin: 5%">
|
<uni-popup-message type="info" :duration="0" style="width: 90%; margin: 5%">
|
||||||
@@ -92,7 +78,7 @@ export default {
|
|||||||
handleScon() {
|
handleScon() {
|
||||||
this.$refs.message.close()
|
this.$refs.message.close()
|
||||||
uni.scanCode({
|
uni.scanCode({
|
||||||
onlyFromCamera:true,
|
// onlyFromCamera:false,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
let data = JSON.parse(res.result)
|
let data = JSON.parse(res.result)
|
||||||
@@ -125,8 +111,7 @@ export default {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.transfer-img {
|
.transfer-img {}
|
||||||
}
|
|
||||||
|
|
||||||
.transfer-text {
|
.transfer-text {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
|
|||||||
@@ -222,21 +222,21 @@ export default {
|
|||||||
},
|
},
|
||||||
judgment(val, key) {
|
judgment(val, key) {
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case '电压暂降':
|
case '暂降':
|
||||||
return {
|
return {
|
||||||
type: 'sag',
|
type: 'sag',
|
||||||
icon: 'icon-a-svg4',
|
icon: 'icon-a-svg4',
|
||||||
color: '#2563eb',
|
color: '#2563eb',
|
||||||
size: '25',
|
size: '25',
|
||||||
}
|
}
|
||||||
case '电压暂升':
|
case '暂升':
|
||||||
return {
|
return {
|
||||||
type: 'swell',
|
type: 'swell',
|
||||||
icon: 'icon-a-svg5',
|
icon: 'icon-a-svg5',
|
||||||
color: '#e6a23c',
|
color: '#e6a23c',
|
||||||
size: '25',
|
size: '25',
|
||||||
}
|
}
|
||||||
case '电压中断':
|
case '中断':
|
||||||
return {
|
return {
|
||||||
type: 'interrupt',
|
type: 'interrupt',
|
||||||
icon: 'icon-zhongduan2',
|
icon: 'icon-zhongduan2',
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="index-zhuyonghu">
|
<view class="index-zhuyonghu">
|
||||||
<template v-if="devCount.engineeringListLength > 0">
|
<template v-if="devCount.engineeringListLength > 0">
|
||||||
<view class="canneng-index-title mb20 canneng-index-title-with-icon">
|
<view class="canneng-index-title mb20 ml20 canneng-index-title-with-icon">
|
||||||
<uni-icons custom-prefix="iconfont" type="icon-gongcheng" size="18" color="#376cf3" />
|
<uni-icons custom-prefix="iconfont" type="icon-gongcheng" size="18" color="#376cf3" />
|
||||||
<text>所有工程设备统计</text>
|
<text>所有工程设备统计</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<!-- <view class="mt20"></view> -->
|
<!-- <view class="mt20"></view> -->
|
||||||
</template>
|
</template>
|
||||||
<!-- <view class="canneng-index-title mb20">当前工程设备统计</view>
|
<!-- <view class="canneng-index-title mb20 ml20">当前工程设备统计</view>
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<view class="header-item" @click="jump('nowEngineering')">
|
<view class="header-item" @click="jump('nowEngineering')">
|
||||||
<view class="header-item-value"
|
<view class="header-item-value"
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
<view class="header-item-label">离线设备</view>
|
<view class="header-item-label">离线设备</view>
|
||||||
</view>
|
</view>
|
||||||
</view> -->
|
</view> -->
|
||||||
<view class="canneng-index-title mt20 canneng-index-title-with-icon">
|
<view class="canneng-index-title mt20 ml20 canneng-index-title-with-icon">
|
||||||
<uni-icons type="settings" size="18" color="#376cf3" />
|
<uni-icons type="settings" size="18" color="#376cf3" />
|
||||||
<text>常用功能</text>
|
<text>常用功能</text>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="index-zhuyonghu">
|
<view class="index-zhuyonghu">
|
||||||
<template v-if="devCount.engineeringListLength > 1">
|
<template v-if="devCount.engineeringListLength > 1">
|
||||||
<view class="canneng-index-title mb20 canneng-index-title-with-icon">
|
<view class="canneng-index-title mb20 ml20 canneng-index-title-with-icon">
|
||||||
<uni-icons custom-prefix="iconfont" type="icon-gongcheng" size="18" color="#376cf3" />
|
<uni-icons custom-prefix="iconfont" type="icon-gongcheng" size="18" color="#376cf3" />
|
||||||
<text>所有工程设备统计</text>
|
<text>所有工程设备统计</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="mt20"></view>
|
<view class="mt20"></view>
|
||||||
</template>
|
</template>
|
||||||
<view class="canneng-index-title mb20 canneng-index-title-with-icon">
|
<view class="canneng-index-title mb20 ml20 canneng-index-title-with-icon">
|
||||||
<uni-icons custom-prefix="iconfont" type="icon-zaixianjianceshebei" size="18" color="#376cf3" />
|
<uni-icons custom-prefix="iconfont" type="icon-zaixianjianceshebei" size="18" color="#376cf3" />
|
||||||
<text>当前工程设备统计</text>
|
<text>当前工程设备统计</text>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="index-zhuanzhi">
|
<view class="index-zhuanzhi">
|
||||||
<template v-if="devCount.engineeringListLength > 1">
|
<template v-if="devCount.engineeringListLength > 1">
|
||||||
<view class="canneng-index-title mb20 canneng-index-title-with-icon">
|
<view class="canneng-index-title mb20 ml20 canneng-index-title-with-icon">
|
||||||
<uni-icons custom-prefix="iconfont" type="icon-gongcheng" size="18" color="#376cf3" />
|
<uni-icons custom-prefix="iconfont" type="icon-gongcheng" size="18" color="#376cf3" />
|
||||||
<text>所有工程设备统计</text>
|
<text>所有工程设备统计</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="mt20"></view>
|
<view class="mt20"></view>
|
||||||
</template>
|
</template>
|
||||||
<view class="canneng-index-title mb20 canneng-index-title-with-icon">
|
<view class="canneng-index-title mb20 ml20 canneng-index-title-with-icon">
|
||||||
<uni-icons custom-prefix="iconfont" type="icon-zaixianjianceshebei" size="18" color="#376cf3" />
|
<uni-icons custom-prefix="iconfont" type="icon-zaixianjianceshebei" size="18" color="#376cf3" />
|
||||||
<text>当前工程设备统计</text>
|
<text>当前工程设备统计</text>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="index-zhuyonghu">
|
<view class="index-zhuyonghu">
|
||||||
<template v-if="devCount.engineeringListLength > 1">
|
<template v-if="devCount.engineeringListLength > 1">
|
||||||
<view class="canneng-index-title mb20 canneng-index-title-with-icon">
|
<view class="canneng-index-title mb20 ml20 canneng-index-title-with-icon">
|
||||||
<uni-icons custom-prefix="iconfont" type="icon-gongcheng" size="18" color="#376cf3" />
|
<uni-icons custom-prefix="iconfont" type="icon-gongcheng" size="18" color="#376cf3" />
|
||||||
<text>所有工程设备统计</text>
|
<text>所有工程设备统计</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="mt20"></view>
|
<view class="mt20"></view>
|
||||||
</template>
|
</template>
|
||||||
<view class="canneng-index-title mb20 canneng-index-title-with-icon">
|
<view class="canneng-index-title mb20 ml20 canneng-index-title-with-icon">
|
||||||
<uni-icons custom-prefix="iconfont" type="icon-zaixianjianceshebei" size="18" color="#376cf3" />
|
<uni-icons custom-prefix="iconfont" type="icon-zaixianjianceshebei" size="18" color="#376cf3" />
|
||||||
<text>当前工程设备统计</text>
|
<text>当前工程设备统计</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
<view class="header-item-label">稳态事件数</view>
|
<view class="header-item-label">稳态事件数</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="canneng-index-title mt20 canneng-index-title-with-icon">
|
<view class="canneng-index-title mt20 ml20 canneng-index-title-with-icon">
|
||||||
<uni-icons type="settings" size="18" color="#376cf3" />
|
<uni-icons type="settings" size="18" color="#376cf3" />
|
||||||
<text>常用功能</text>
|
<text>常用功能</text>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="index-zhuanzhi">
|
<view class="index-zhuanzhi">
|
||||||
<template v-if="devCount.engineeringListLength > 1">
|
<template v-if="devCount.engineeringListLength > 1">
|
||||||
<view class="canneng-index-title mb20 canneng-index-title-with-icon">
|
<view class="canneng-index-title mb20 ml20 canneng-index-title-with-icon">
|
||||||
<uni-icons custom-prefix="iconfont" type="icon-gongcheng" size="18" color="#376cf3" />
|
<uni-icons custom-prefix="iconfont" type="icon-gongcheng" size="18" color="#376cf3" />
|
||||||
<text>所有工程设备统计</text>
|
<text>所有工程设备统计</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="mt20"></view>
|
<view class="mt20"></view>
|
||||||
</template>
|
</template>
|
||||||
<view class="canneng-index-title mb20 canneng-index-title-with-icon">
|
<view class="canneng-index-title mb20 ml20 canneng-index-title-with-icon">
|
||||||
<uni-icons custom-prefix="iconfont" type="icon-zaixianjianceshebei" size="18" color="#376cf3" />
|
<uni-icons custom-prefix="iconfont" type="icon-zaixianjianceshebei" size="18" color="#376cf3" />
|
||||||
<text>当前工程设备统计</text>
|
<text>当前工程设备统计</text>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<page-meta :page-style="'overflow:' + (indicatorPopupShow ? 'hidden' : 'visible')"></page-meta>
|
||||||
<view class="itic2-page">
|
<view class="itic2-page">
|
||||||
<view class="itic2-content">
|
<view class="itic2-content">
|
||||||
<view class="project-header card">
|
<view class="project-header card">
|
||||||
@@ -60,7 +61,10 @@
|
|||||||
<Cn-icon-transient name="监测点" />
|
<Cn-icon-transient name="监测点" />
|
||||||
</view>
|
</view>
|
||||||
<view class="card-header-info">
|
<view class="card-header-info">
|
||||||
|
<view class="point-name-row">
|
||||||
<text class="point-name ellipsis">{{ point.pointName }}</text>
|
<text class="point-name ellipsis">{{ point.pointName }}</text>
|
||||||
|
|
||||||
|
</view>
|
||||||
<view class="meta-row">
|
<view class="meta-row">
|
||||||
<text class="meta-item ellipsis">项目:{{ point.projectName }}</text>
|
<text class="meta-item ellipsis">项目:{{ point.projectName }}</text>
|
||||||
<text class="meta-item ellipsis">设备:{{ point.deviceName }}</text>
|
<text class="meta-item ellipsis">设备:{{ point.deviceName }}</text>
|
||||||
@@ -100,7 +104,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="more-btn" @click="onMoreIndicators(point)">
|
<view class="more-btn" v-if="shouldShowMoreBtn(point)" @click="onMoreIndicators(point)">
|
||||||
<uni-icons type="list" size="16" color="#376cf3" />
|
<uni-icons type="list" size="16" color="#376cf3" />
|
||||||
<text>更多指标</text>
|
<text>更多指标</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -116,13 +120,13 @@
|
|||||||
<uni-icons type="arrow-up" size="22" color="#fff"></uni-icons>
|
<uni-icons type="arrow-up" size="22" color="#fff"></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<uni-popup ref="indicatorPopup" type="bottom">
|
<uni-popup ref="indicatorPopup" type="bottom" :safe-area="false" @change="onIndicatorPopupChange">
|
||||||
<view class="indicator-popup">
|
<view class="indicator-popup">
|
||||||
<view class="indicator-popup-header">
|
<view class="indicator-popup-header" @touchmove.stop.prevent>
|
||||||
<text class="indicator-popup-cancel" @click="closeIndicatorPopup">取消</text>
|
<text class="indicator-popup-cancel" @click="closeIndicatorPopup">取消</text>
|
||||||
<text class="indicator-popup-confirm" @click="confirmIndicatorPopup">确定</text>
|
<text class="indicator-popup-confirm" @click="confirmIndicatorPopup">确定</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="indicator-popup-list" scroll-y>
|
<scroll-view class="indicator-popup-list" scroll-y :show-scrollbar="false" @touchmove.stop>
|
||||||
<view v-if="targetLists.length === 0" class="indicator-popup-empty">
|
<view v-if="targetLists.length === 0" class="indicator-popup-empty">
|
||||||
<text>暂无指标数据</text>
|
<text>暂无指标数据</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -133,7 +137,7 @@
|
|||||||
<uni-icons v-if="popupSelectedIndicators.includes(item.name)" type="checkmarkempty" size="18"
|
<uni-icons v-if="popupSelectedIndicators.includes(item.name)" type="checkmarkempty" size="18"
|
||||||
color="#376cf3" />
|
color="#376cf3" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
</uni-popup>
|
</uni-popup>
|
||||||
</view>
|
</view>
|
||||||
@@ -144,8 +148,17 @@ import { queryByCode, queryCsDictTree } from '@/common/api/dictionary'
|
|||||||
import { getLineDataByEngineer } from '@/common/api/harmonic'
|
import { getLineDataByEngineer } from '@/common/api/harmonic'
|
||||||
import { getDevCount } from '@/common/api/device.js'
|
import { getDevCount } from '@/common/api/device.js'
|
||||||
|
|
||||||
|
/** 无本地缓存时的默认展示指标:电压、电流 */
|
||||||
const DEFAULT_INDICATOR_CODES = ['Key_Power_Quality_V', 'Key_Power_Quality_I']
|
const DEFAULT_INDICATOR_CODES = ['Key_Power_Quality_V', 'Key_Power_Quality_I']
|
||||||
|
|
||||||
|
/** 治理测点(lineType=0)卡片默认展示的指标 */
|
||||||
|
const GOVERNANCE_DEFAULT_INDICATORS = [
|
||||||
|
'电网电流',
|
||||||
|
'电网电压',
|
||||||
|
'负载电流',
|
||||||
|
'总输出电流',
|
||||||
|
]
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -168,6 +181,7 @@ export default {
|
|||||||
listStatus: 'noMore',
|
listStatus: 'noMore',
|
||||||
lineDataRequestId: 0,
|
lineDataRequestId: 0,
|
||||||
showBackTop: false,
|
showBackTop: false,
|
||||||
|
indicatorPopupShow: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onPageScroll(e) {
|
onPageScroll(e) {
|
||||||
@@ -248,6 +262,7 @@ export default {
|
|||||||
deviceName: point.deviceName || '',
|
deviceName: point.deviceName || '',
|
||||||
pointName: point.pointName || '',
|
pointName: point.pointName || '',
|
||||||
dataTime: point.dataTime || '',
|
dataTime: point.dataTime || '',
|
||||||
|
lineType: point.lineType,
|
||||||
children: this.groupChildren(point.children || []),
|
children: this.groupChildren(point.children || []),
|
||||||
}))
|
}))
|
||||||
},
|
},
|
||||||
@@ -278,7 +293,9 @@ export default {
|
|||||||
},
|
},
|
||||||
formatPhaseValue(value) {
|
formatPhaseValue(value) {
|
||||||
if (value === null || value === undefined || value === '') return '-'
|
if (value === null || value === undefined || value === '') return '-'
|
||||||
return String(value)
|
const num = Number(value)
|
||||||
|
if (Number.isNaN(num)) return String(value)
|
||||||
|
return num.toFixed(2)
|
||||||
},
|
},
|
||||||
hasTPhaseData(child) {
|
hasTPhaseData(child) {
|
||||||
return child.T !== undefined && child.T !== null && child.T !== '-'
|
return child.T !== undefined && child.T !== null && child.T !== '-'
|
||||||
@@ -358,6 +375,9 @@ export default {
|
|||||||
this.$refs.indicatorPopup.close()
|
this.$refs.indicatorPopup.close()
|
||||||
this.popupSelectedIndicators = []
|
this.popupSelectedIndicators = []
|
||||||
},
|
},
|
||||||
|
onIndicatorPopupChange(e) {
|
||||||
|
this.indicatorPopupShow = !!e.show
|
||||||
|
},
|
||||||
// 切换弹窗内指标勾选状态
|
// 切换弹窗内指标勾选状态
|
||||||
togglePopupIndicator(name) {
|
togglePopupIndicator(name) {
|
||||||
const idx = this.popupSelectedIndicators.indexOf(name)
|
const idx = this.popupSelectedIndicators.indexOf(name)
|
||||||
@@ -377,23 +397,43 @@ export default {
|
|||||||
this.saveSelectedIndicators()
|
this.saveSelectedIndicators()
|
||||||
this.closeIndicatorPopup()
|
this.closeIndicatorPopup()
|
||||||
},
|
},
|
||||||
// 查看更多指标
|
// 跳转指标详情页;治理测点展示全部指标,普通测点展示未选中的指标
|
||||||
onMoreIndicators(point) {
|
onMoreIndicators(point) {
|
||||||
uni.setStorageSync('monitorPointDetail', {
|
uni.setStorageSync('monitorPointDetail', {
|
||||||
...point,
|
...point,
|
||||||
engineeringName: this.engineeringName,
|
engineeringName: this.engineeringName,
|
||||||
selectedIndicators: [...this.selectedIndicators],
|
selectedIndicators:
|
||||||
|
point.lineType === 0
|
||||||
|
? [...GOVERNANCE_DEFAULT_INDICATORS]
|
||||||
|
: [...this.selectedIndicators],
|
||||||
|
showAllIndicators: point.lineType === 0,
|
||||||
})
|
})
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/index/comp/targetInfo',
|
url: '/pages/index/comp/targetInfo',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 获取监测点当前展示的指标数据
|
// 治理测点默认 4 项;普通测点按顶部已选指标过滤
|
||||||
getDisplayChildren(point) {
|
getDisplayChildren(point) {
|
||||||
return (point.children || []).filter((child) =>
|
const children = point.children || []
|
||||||
|
if (point.lineType === 0) {
|
||||||
|
return GOVERNANCE_DEFAULT_INDICATORS.map((name) =>
|
||||||
|
children.find((child) => this.matchIndicator(child.name, name)),
|
||||||
|
).filter(Boolean)
|
||||||
|
}
|
||||||
|
return children.filter((child) =>
|
||||||
this.selectedIndicators.some((name) => this.matchIndicator(child.name, name)),
|
this.selectedIndicators.some((name) => this.matchIndicator(child.name, name)),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
// 治理测点存在默认四项以外的指标时显示「更多指标」
|
||||||
|
shouldShowMoreBtn(point) {
|
||||||
|
if (point.lineType !== 0) return true
|
||||||
|
const children = point.children || []
|
||||||
|
return children.some(
|
||||||
|
(child) =>
|
||||||
|
!GOVERNANCE_DEFAULT_INDICATORS.some((name) => this.matchIndicator(child.name, name)),
|
||||||
|
)
|
||||||
|
},
|
||||||
|
|
||||||
// 将指标列表按每行两个分组
|
// 将指标列表按每行两个分组
|
||||||
chunkedChildren(children) {
|
chunkedChildren(children) {
|
||||||
const result = []
|
const result = []
|
||||||
@@ -421,7 +461,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.itic2-content {
|
.itic2-content {
|
||||||
padding: 20rpx 0 40rpx;
|
padding: 20rpx 0 0rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -642,12 +682,30 @@ export default {
|
|||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.point-name-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12rpx;
|
||||||
|
margin-bottom: 8rpx;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.point-name {
|
.point-name {
|
||||||
display: block;
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
margin-bottom: 8rpx;
|
}
|
||||||
|
|
||||||
|
.point-type-tag {
|
||||||
|
flex-shrink: 0;
|
||||||
|
padding: 4rpx 12rpx;
|
||||||
|
font-size: 22rpx;
|
||||||
|
color: #2ba471;
|
||||||
|
background: #2ba47115;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
line-height: 1.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.meta-row {
|
.meta-row {
|
||||||
@@ -784,7 +842,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.indicator-popup-list {
|
.indicator-popup-list {
|
||||||
max-height: 60vh;
|
height: 60vh;
|
||||||
padding: 16rpx 0;
|
padding: 16rpx 0;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,12 +27,9 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-if="moreChildren.length" class="params-section">
|
<view v-if="moreChildren.length" class="params-section">
|
||||||
<view
|
<view v-for="(rowItems, rowIdx) in chunkedChildren(moreChildren)" :key="rowIdx" class="double-row">
|
||||||
v-for="(rowItems, rowIdx) in chunkedChildren(moreChildren)"
|
<view v-for="(child, childIdx) in rowItems" :key="child.targetId || childIdx"
|
||||||
:key="rowIdx"
|
class="param-group">
|
||||||
class="double-row"
|
|
||||||
>
|
|
||||||
<view v-for="(child, childIdx) in rowItems" :key="child.targetId || childIdx" class="param-group">
|
|
||||||
<view class="param-title">
|
<view class="param-title">
|
||||||
<text>{{ child.name }}{{ child.unit ? ` (${child.unit})` : '' }}</text>
|
<text>{{ child.name }}{{ child.unit ? ` (${child.unit})` : '' }}</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -41,15 +38,18 @@
|
|||||||
</view>
|
</view>
|
||||||
<view v-else class="phase-vertical">
|
<view v-else class="phase-vertical">
|
||||||
<view class="phase-item-vertical">
|
<view class="phase-item-vertical">
|
||||||
<text class="phase-value-vertical" :style="{ color: phaseColors[0].color }">{{ child.A }}</text>
|
<text class="phase-value-vertical" :style="{ color: phaseColors[0].color }">{{
|
||||||
|
child.A }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="phase-divider" />
|
<view class="phase-divider" />
|
||||||
<view class="phase-item-vertical">
|
<view class="phase-item-vertical">
|
||||||
<text class="phase-value-vertical" :style="{ color: phaseColors[1].color }">{{ child.B }}</text>
|
<text class="phase-value-vertical" :style="{ color: phaseColors[1].color }">{{
|
||||||
|
child.B }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="phase-divider" />
|
<view class="phase-divider" />
|
||||||
<view class="phase-item-vertical">
|
<view class="phase-item-vertical">
|
||||||
<text class="phase-value-vertical" :style="{ color: phaseColors[2].color }">{{ child.C }}</text>
|
<text class="phase-value-vertical" :style="{ color: phaseColors[2].color }">{{
|
||||||
|
child.C }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -78,6 +78,10 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
moreChildren() {
|
moreChildren() {
|
||||||
const children = this.pointInfo.children || []
|
const children = this.pointInfo.children || []
|
||||||
|
// 治理测点「更多指标」页展示全部
|
||||||
|
if (this.pointInfo.lineType === 0 && this.pointInfo.showAllIndicators) {
|
||||||
|
return children
|
||||||
|
}
|
||||||
const selected = this.getSelectedIndicators()
|
const selected = this.getSelectedIndicators()
|
||||||
return children.filter(
|
return children.filter(
|
||||||
(child) => !selected.some((name) => this.matchIndicator(child.name, name)),
|
(child) => !selected.some((name) => this.matchIndicator(child.name, name)),
|
||||||
@@ -210,6 +214,7 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
gap: 20rpx;
|
gap: 20rpx;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
justify-content: end;
|
||||||
padding: 16rpx 20rpx;
|
padding: 16rpx 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ import Engineering from './comp/engineering.vue'
|
|||||||
import list from '../../common/js/list'
|
import list from '../../common/js/list'
|
||||||
import { getDevCount } from '../../common/api/device.js'
|
import { getDevCount } from '../../common/api/device.js'
|
||||||
import { queryEngineering } from '@/common/api/engineering.js'
|
import { queryEngineering } from '@/common/api/engineering.js'
|
||||||
|
import { checkAppUpdate } from '@/common/js/update.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [list],
|
mixins: [list],
|
||||||
@@ -252,6 +253,11 @@ export default {
|
|||||||
this.showBackTop = e.scrollTop > 200
|
this.showBackTop = e.scrollTop > 200
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
checkAppUpdate()
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
// 页面加载时,动态配置导航栏按钮
|
// 页面加载时,动态配置导航栏按钮
|
||||||
if (!uni.getStorageSync(this.$cacheKey.access_token)) {
|
if (!uni.getStorageSync(this.$cacheKey.access_token)) {
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
@@ -289,6 +295,8 @@ export default {
|
|||||||
// #endif
|
// #endif
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
|
|
||||||
|
|
||||||
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
|
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
|
||||||
|
|
||||||
let access_token = uni.getStorageSync(this.$cacheKey.access_token)
|
let access_token = uni.getStorageSync(this.$cacheKey.access_token)
|
||||||
@@ -319,7 +327,7 @@ export default {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
.popup-content {
|
.popup-content {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ export default {
|
|||||||
this.getDevCount()
|
this.getDevCount()
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if (params.type !== '') {
|
if (params.type !== '') {
|
||||||
this.current = params.type - 0
|
this.current = (params.type - 0)||0
|
||||||
}
|
}
|
||||||
if (params.engineeringName != '') {
|
if (params.engineeringName != '') {
|
||||||
this.$refs.cnFilterCriteria && this.$refs.cnFilterCriteria.external(params)
|
this.$refs.cnFilterCriteria && this.$refs.cnFilterCriteria.external(params)
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ export default {
|
|||||||
handleScon() {
|
handleScon() {
|
||||||
this.$refs.message.close()
|
this.$refs.message.close()
|
||||||
uni.scanCode({
|
uni.scanCode({
|
||||||
onlyFromCamera: true,
|
// onlyFromCamera: false,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log('条码类型:' + res.scanType)
|
console.log('条码类型:' + res.scanType)
|
||||||
console.log('条码内容:' + res.result)
|
console.log('条码内容:' + res.result)
|
||||||
|
|||||||
@@ -76,11 +76,11 @@
|
|||||||
|
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
}
|
}
|
||||||
/* 电压暂降 - 蓝色系 */
|
/* 暂降 - 蓝色系 */
|
||||||
.sag .event-icon {
|
.sag .event-icon {
|
||||||
background-color: #2563eb20;
|
background-color: #2563eb20;
|
||||||
}
|
}
|
||||||
/* 电压暂升 - 橙色系 */
|
/* 暂升 - 橙色系 */
|
||||||
.swell .event-icon {
|
.swell .event-icon {
|
||||||
background-color: #e6a23c20;
|
background-color: #e6a23c20;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,9 +115,9 @@ export default {
|
|||||||
filterValue: 0,
|
filterValue: 0,
|
||||||
dataList: [
|
dataList: [
|
||||||
{ value: 0, label: '暂态数量', key: '' },
|
{ value: 0, label: '暂态数量', key: '' },
|
||||||
{ value: 0, label: '暂降', key: '电压暂降' },
|
{ value: 0, label: '暂降', key: '暂降' },
|
||||||
{ value: 0, label: '中断', key: '电压中断' },
|
{ value: 0, label: '中断', key: '中断' },
|
||||||
{ value: 0, label: '暂升', key: '电压暂升' },
|
{ value: 0, label: '暂升', key: '暂升' },
|
||||||
],
|
],
|
||||||
status: 'noMore', //more加载前 loading加载中 noMore加载后
|
status: 'noMore', //more加载前 loading加载中 noMore加载后
|
||||||
sort: 0,
|
sort: 0,
|
||||||
@@ -177,21 +177,21 @@ export default {
|
|||||||
},
|
},
|
||||||
judgment(val, key) {
|
judgment(val, key) {
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case '电压暂降':
|
case '暂降':
|
||||||
return {
|
return {
|
||||||
type: 'sag',
|
type: 'sag',
|
||||||
icon: 'icon-a-svg4',
|
icon: 'icon-a-svg4',
|
||||||
color: '#2563eb',
|
color: '#2563eb',
|
||||||
size: '25',
|
size: '25',
|
||||||
}
|
}
|
||||||
case '电压暂升':
|
case '暂升':
|
||||||
return {
|
return {
|
||||||
type: 'swell',
|
type: 'swell',
|
||||||
icon: 'icon-a-svg5',
|
icon: 'icon-a-svg5',
|
||||||
color: '#e6a23c',
|
color: '#e6a23c',
|
||||||
size: '25',
|
size: '25',
|
||||||
}
|
}
|
||||||
case '电压中断':
|
case '中断':
|
||||||
return {
|
return {
|
||||||
type: 'interrupt',
|
type: 'interrupt',
|
||||||
icon: 'icon-zhongduan2',
|
icon: 'icon-zhongduan2',
|
||||||
|
|||||||
Reference in New Issue
Block a user