This commit is contained in:
JayJiaJun 2025-04-24 16:53:41 +08:00
parent 5b328629f8
commit f720ddba7a
4 changed files with 367 additions and 300 deletions

View File

@ -1,183 +1,185 @@
{ {
"name": "芯程物联", "name" : "芯程物联",
"appid": "__UNI__BEE3050", "appid" : "__UNI__BEE3050",
"description": "开源物联网平台", "description" : "开源物联网平台",
"versionName": "2.2.0", "versionName" : "2.2.0",
"versionCode": 200, "versionCode" : 200,
"transformPx": false, "transformPx" : false,
"app-plus": { "app-plus" : {
"kernel": { "kernel" : {
"ios": "WKWebview" "ios" : "WKWebview"
}, },
"usingComponents": true, "usingComponents" : true,
"nvueCompiler": "uni-app", "nvueCompiler" : "uni-app",
"compilerVersion": 3, "compilerVersion" : 3,
"splashscreen": { "splashscreen" : {
"alwaysShowBeforeRender": true, "alwaysShowBeforeRender" : true,
"waiting": true, "waiting" : true,
"autoclose": true, "autoclose" : true,
"delay": 0 "delay" : 0
}, },
"modules": { "modules" : {
"Barcode": {}, "Barcode" : {},
"OAuth": {}, "OAuth" : {},
"Camera": {} "Camera" : {}
}, },
"distribute": { "distribute" : {
"android": { "android" : {
"permissions": [ "permissions" : [
"<uses-feature android:name=\"android.hardware.camera\"/>", "<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>", "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>", "<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>", "<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>", "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>", "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.INTERNET\"/>" "<uses-permission android:name=\"android.permission.INTERNET\"/>"
], ],
"minSdkVersion": 22, "minSdkVersion" : 22,
"targetSdkVersion": 30, "targetSdkVersion" : 30,
"abiFilters": ["armeabi-v7a", "arm64-v8a"], "abiFilters" : [ "armeabi-v7a", "arm64-v8a" ],
"permissionExternalStorage": { "permissionExternalStorage" : {
"request": "none", "request" : "none",
"prompt": "应用保存运行状态等信息,需要获取读写手机存储权限,请允许。" "prompt" : "应用保存运行状态等信息,需要获取读写手机存储权限,请允许。"
}, },
"permissionPhoneState": { "permissionPhoneState" : {
"request": "none", "request" : "none",
"prompt": "为保证您正常、安全地使用,需要获取设备识别码使用权限,请允许。" "prompt" : "为保证您正常、安全地使用,需要获取设备识别码使用权限,请允许。"
} }
}, },
"ios": { "ios" : {
"idfa": true, "idfa" : true,
"privacyDescription": { "privacyDescription" : {
"NSLocationAlwaysUsageDescription": "便于您使用该功能获取当前位置天气情况、WIFI列表等场景。", "NSLocationAlwaysUsageDescription" : "便于您使用该功能获取当前位置天气情况、WIFI列表等场景。",
"NSLocationAlwaysAndWhenInUseUsageDescription": "便于您使用该功能获取当前位置天气情况、WIFI列表等场景。", "NSLocationAlwaysAndWhenInUseUsageDescription" : "便于您使用该功能获取当前位置天气情况、WIFI列表等场景。",
"NSLocalNetworkUsageDescription": "允许访问蜂窝网络,用于扫码/关联式添加设备", "NSLocalNetworkUsageDescription" : "允许访问蜂窝网络,用于扫码/关联式添加设备",
"NSLocationWhenInUseUsageDescription": "便于您使用该功能获取当前位置天气情况、WIFI列表等场景。" "NSLocationWhenInUseUsageDescription" : "便于您使用该功能获取当前位置天气情况、WIFI列表等场景。"
}, },
"dSYMs": false "dSYMs" : false
}, },
"sdkConfigs": { "sdkConfigs" : {
"push": {}, "push" : {},
"statics": {}, "statics" : {},
"maps": {}, "maps" : {},
"ad": {}, "ad" : {},
"oauth": { "oauth" : {
"weixin": { "weixin" : {
"appid": "wx6be3f0d7bf7154e1", "appid" : "wx6be3f0d7bf7154e1",
"appsecret": "b6c1d0da60bd5250857d211cdc64fdc9", "appsecret" : "b6c1d0da60bd5250857d211cdc64fdc9",
"UniversalLinks": "" "UniversalLinks" : ""
} }
} }
}, },
"splashscreen": { "splashscreen" : {
"iosStyle": "common", "iosStyle" : "common",
"androidStyle": "common", "androidStyle" : "common",
"alwaysShowBeforeRender": false, "alwaysShowBeforeRender" : false,
"waiting": true, "waiting" : true,
"autoclose": false, "autoclose" : false,
"delay": 0, "delay" : 0,
"android": { "android" : {
"hdpi": "./static/logo.9.png", "hdpi" : "./static/logo.9.png",
"xhdpi": "./static/logo.9.png", "xhdpi" : "./static/logo.9.png",
"xxhdpi": "./static/logo.9.png" "xxhdpi" : "./static/logo.9.png"
} }
}, },
"icons": { "icons" : {
"android": { "android" : {
"hdpi": "unpackage/res/icons/72x72.png", "hdpi" : "unpackage/res/icons/72x72.png",
"xhdpi": "unpackage/res/icons/96x96.png", "xhdpi" : "unpackage/res/icons/96x96.png",
"xxhdpi": "unpackage/res/icons/144x144.png", "xxhdpi" : "unpackage/res/icons/144x144.png",
"xxxhdpi": "unpackage/res/icons/192x192.png" "xxxhdpi" : "unpackage/res/icons/192x192.png"
}, },
"ios": { "ios" : {
"appstore": "unpackage/res/icons/1024x1024.png", "appstore" : "unpackage/res/icons/1024x1024.png",
"ipad": { "ipad" : {
"app": "unpackage/res/icons/76x76.png", "app" : "unpackage/res/icons/76x76.png",
"app@2x": "unpackage/res/icons/152x152.png", "app@2x" : "unpackage/res/icons/152x152.png",
"notification": "unpackage/res/icons/20x20.png", "notification" : "unpackage/res/icons/20x20.png",
"notification@2x": "unpackage/res/icons/40x40.png", "notification@2x" : "unpackage/res/icons/40x40.png",
"proapp@2x": "unpackage/res/icons/167x167.png", "proapp@2x" : "unpackage/res/icons/167x167.png",
"settings": "unpackage/res/icons/29x29.png", "settings" : "unpackage/res/icons/29x29.png",
"settings@2x": "unpackage/res/icons/58x58.png", "settings@2x" : "unpackage/res/icons/58x58.png",
"spotlight": "unpackage/res/icons/40x40.png", "spotlight" : "unpackage/res/icons/40x40.png",
"spotlight@2x": "unpackage/res/icons/80x80.png" "spotlight@2x" : "unpackage/res/icons/80x80.png"
}, },
"iphone": { "iphone" : {
"app@2x": "unpackage/res/icons/120x120.png", "app@2x" : "unpackage/res/icons/120x120.png",
"app@3x": "unpackage/res/icons/180x180.png", "app@3x" : "unpackage/res/icons/180x180.png",
"notification@2x": "unpackage/res/icons/40x40.png", "notification@2x" : "unpackage/res/icons/40x40.png",
"notification@3x": "unpackage/res/icons/60x60.png", "notification@3x" : "unpackage/res/icons/60x60.png",
"settings@2x": "unpackage/res/icons/58x58.png", "settings@2x" : "unpackage/res/icons/58x58.png",
"settings@3x": "unpackage/res/icons/87x87.png", "settings@3x" : "unpackage/res/icons/87x87.png",
"spotlight@2x": "unpackage/res/icons/80x80.png", "spotlight@2x" : "unpackage/res/icons/80x80.png",
"spotlight@3x": "unpackage/res/icons/120x120.png" "spotlight@3x" : "unpackage/res/icons/120x120.png"
} }
} }
} }
}, },
"uniStatistics": { "uniStatistics" : {
"enable": false "enable" : false
}, },
"nativePlugins": {} "nativePlugins" : {}
}, },
"quickapp": {}, "quickapp" : {},
"mp-weixin": { "mp-weixin" : {
"appid": "wx5bfbadf52adc17f3", "appid" : "wx5bfbadf52adc17f3",
"setting": { "setting" : {
"urlCheck": false, "urlCheck" : false,
"minified": true "minified" : true
}, },
"usingComponents": true, "usingComponents" : true,
"uniStatistics": { "uniStatistics" : {
"enable": false "enable" : false
}, },
"optimization": { "optimization" : {
"subPackages": true "subPackages" : true
}, },
"permission": { "permission" : {
"scope.userLocation": { "scope.userLocation" : {
"desc": "便于您使用该功能获取当前位置天气情况、WIFI列表等场景。" "desc" : "便于您使用该功能获取当前位置天气情况、WIFI列表等场景。"
} }
}, },
"requiredPrivateInfos": ["getLocation"], "requiredPrivateInfos" : [ "getLocation" ],
"lazyCodeLoading": "requiredComponents" "lazyCodeLoading" : "requiredComponents"
}, },
"mp-alipay": { "mp-alipay" : {
"usingComponents": true "usingComponents" : true
}, },
"mp-baidu": { "mp-baidu" : {
"usingComponents": true "usingComponents" : true
}, },
"mp-toutiao": { "mp-toutiao" : {
"usingComponents": true "usingComponents" : true
}, },
"uniStatistics": { "uniStatistics" : {
"enable": false "enable" : false
}, },
"sassImplementationName": "node-sass", "sassImplementationName" : "node-sass",
"h5": { "h5" : {
"title": "芯程物联", "title" : "芯程物联",
"router": { "router" : {
"mode": "hash", "mode" : "hash",
"base": "./" "base" : "./"
}, },
"devServer": { "devServer" : {
"port": 8090 "port" : 8090
}, },
"optimization": { "optimization" : {
"treeShaking": { "treeShaking" : {
"enable": false "enable" : false
} }
}, },
"template": "uni_modules/jessibuca/hybrid/index.html", "template" : "uni_modules/jessibuca/hybrid/index.html",
"sdkConfigs": { "sdkConfigs" : {
"maps": { "maps" : {
"qqmap": { "qqmap" : {
"key": "4PDBZ-4KQKU-AX6VO-GU7NB-INDZJ-YBFXC" "key" : "4PDBZ-4KQKU-AX6VO-GU7NB-INDZJ-YBFXC"
} }
} }
} }
} },
} "vueVersion" : "3",
"fallbackLocale" : "zh-Hans"
}

View File

@ -23,6 +23,6 @@
"author": "fastbee", "author": "fastbee",
"license": "ISC", "license": "ISC",
"devDependencies": { "devDependencies": {
"code-inspector-plugin": "^0.18.0" "code-inspector-plugin": "^0.18.3"
} }
} }

View File

@ -572,7 +572,16 @@
</view> </view>
<view class="wrapper"> <view class="wrapper">
<view class="item" v-for="(chart, index) in monitorChart" :key="index"> <view class="item" v-for="(chart, index) in monitorChart" :key="index">
<view class="dashboard"> <!-- 机械压力表显示输入框 -->
<view class="monitor-item" v-if="deviceInfo.productName && deviceInfo.productName.includes('机械压力表')">
<view class="monitor-label">{{chart.opts.subtitle.name}}:</view>
<view class="monitor-value">
<u-input v-model="chart.displayValue" disabled :placeholder="chart.opts.subtitle.name"></u-input>
</view>
<view class="monitor-unit" v-if="chart.unit">{{chart.unit}}</view>
</view>
<!-- 其他产品显示仪表盘 -->
<view class="dashboard" v-else>
<qiun-data-charts type="gauge" :opts="chart.opts" :chartData="chart.data" :canvas2d="false" /> <qiun-data-charts type="gauge" :opts="chart.opts" :chartData="chart.data" :canvas2d="false" />
</view> </view>
</view> </view>
@ -1017,20 +1026,19 @@
for (let m = 0; m < this.monitorChart.length; m++) { for (let m = 0; m < this.monitorChart.length; m++) {
if (this.deviceInfo.chartList[k].id == this if (this.deviceInfo.chartList[k].id == this
.monitorChart[m].id) { .monitorChart[m].id) {
// uchartdata0-1+ if (this.deviceInfo.productName && this.deviceInfo.productName.includes('机械压力表')) {
let value = (Number(message.message[j].value) + Math //
.abs(this this.monitorChart[m].data.series[0].data = Number(message.message[j].value) || 0;
.deviceInfo.chartList[k].datatype this.monitorChart[m].displayValue = message.message[j].value;
.min)) / (Math.abs( this.monitorChart[m].opts.title.name = message.message[j].value;
this.deviceInfo.chartList[k] } else {
.datatype.min) + Math //
.abs(this.deviceInfo.chartList[k] // uchartdata0-1+
.datatype.max)); let value = (Number(message.message[j].value) + Math.abs(this.deviceInfo.chartList[k].datatype.min)) /
this.monitorChart[m].data.series[0].data = (Math.abs(this.deviceInfo.chartList[k].datatype.min) + Math.abs(this.deviceInfo.chartList[k].datatype.max));
value; this.monitorChart[m].data.series[0].data = value;
this.monitorChart[m].opts.title.name = message.message[ this.monitorChart[m].opts.title.name = message.message[j].value + ' ' + this.deviceInfo.chartList[k].datatype.unit;
j].value + ' ' + }
this.deviceInfo.chartList[k].datatype.unit;
break; break;
} }
} }
@ -1045,20 +1053,9 @@
for (let m = 0; m < this.monitorChart.length; m++) { for (let m = 0; m < this.monitorChart.length; m++) {
if (this.deviceInfo.chartList[k].id == this if (this.deviceInfo.chartList[k].id == this
.monitorChart[m].id) { .monitorChart[m].id) {
// uchartdata0-1+ this.monitorChart[m].data.series[0].data = Number(message.message[j].value) || 0;
let value = (Number(message.message[j].value) + Math this.monitorChart[m].displayValue = message.message[j].value;
.abs(this this.monitorChart[m].opts.title.name = message.message[j].value;
.deviceInfo.chartList[k].datatype
.min)) / (Math.abs(
this.deviceInfo.chartList[k]
.datatype.min) + Math
.abs(this.deviceInfo.chartList[k]
.datatype.max));
this.monitorChart[m].data.series[0].data =
value;
this.monitorChart[m].opts.title.name = message.message[
j].value + ' ' +
this.deviceInfo.chartList[k].datatype.unit;
break; break;
} }
} }
@ -1239,98 +1236,125 @@
this.monitorChart = []; this.monitorChart = [];
if (this.deviceInfo.chartList && this.deviceInfo.chartList.length !== 0) { if (this.deviceInfo.chartList && this.deviceInfo.chartList.length !== 0) {
for (let i = 0; i < this.deviceInfo.chartList.length; i++) { for (let i = 0; i < this.deviceInfo.chartList.length; i++) {
//
const value = !this.deviceInfo.chartList[i].shadow || this.deviceInfo.chartList[i].shadow == ' ' ? 0 : this.deviceInfo.chartList[i].shadow;
const unit = this.deviceInfo.chartList[i].datatype.unit || '';
//
const isMechanicalPressureGauge = this.deviceInfo.productName && this.deviceInfo.productName.includes('机械压力表');
let data = {}; let data = {};
let res = { let opts = {};
categories: [{
value: 0.2, if (isMechanicalPressureGauge) {
color: '#409EFF' // 使
}, { data = {
value: 0.8, categories: [],
color: '#12d09f' series: [{
}, { name: this.deviceInfo.chartList[i].name,
value: 1, data: Number(value) || 0
color: '#F56C6C' }]
}], };
series: [{
name: this.deviceInfo.chartList[i].name, opts = {
// uchartdata0-1+ subtitle: {
data: (Number(this.deviceInfo.chartList[i].shadow) + Math.abs( name: this.deviceInfo.chartList[i].name,
this.deviceInfo fontSize: 14,
.chartList[i].datatype.min)) / color: '#333',
(Math.abs(this.deviceInfo.chartList[i].datatype.min) + Math },
.abs(this title: {
.deviceInfo name: `${value}`,
.chartList[i].datatype.max)) fontSize: 24,
}] color: '#2fc25b',
};
data = JSON.parse(JSON.stringify(res));
// opts type="gauge" config-ucharts.js ['gauge'] opts
let opts = {
update: true,
timing: 'easeOut',
duration: 1000,
rotate: false,
rotateLock: false,
color: ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272',
'#FC8452',
'#9A60B4',
'#ea7ccc'
],
padding: undefined,
fontSize: 13,
fontColor: '#666666',
dataLabel: true,
dataPointShape: true,
dataPointShapeType: 'solid',
touchMoveLimit: 60,
enableScroll: false,
enableMarkLine: false,
title: {
name: `${!this.deviceInfo.chartList[i].shadow || this.deviceInfo.chartList[i].shadow == ' ' ? 0 : this.deviceInfo.chartList[i].shadow} ${this.deviceInfo.chartList[i].datatype.unit}`,
fontSize: 24,
color: '#2fc25b',
offsetY: 95,
offsetX: 0
},
subtitle: {
name: this.deviceInfo.chartList[i].name,
fontSize: 14,
color: '#333',
offsetY: 10,
offsetX: 0
},
extra: {
gauge: {
type: 'default',
width: 10,
labelColor: '#666666',
startAngle: 0.75,
endAngle: 0.25,
startNumber: this.deviceInfo.chartList[i].datatype.min,
endNumber: this.deviceInfo.chartList[i].datatype.max,
format: 'dashboardKeepTwoDecimals',
labelFormat: '',
splitLine: {
fixRadius: 0,
splitNumber: 10,
width: 30,
color: '#FFFFFF',
childNumber: 5,
childWidth: 10
},
pointer: {
width: 12,
color: 'auto'
},
labelOffset: 16
} }
} };
}; } else {
// 使
data = {
categories: [{
value: 0.2,
color: '#409EFF'
}, {
value: 0.8,
color: '#12d09f'
}, {
value: 1,
color: '#F56C6C'
}],
series: [{
name: this.deviceInfo.chartList[i].name,
// uchartdata0-1+
data: (Number(value) + Math.abs(this.deviceInfo.chartList[i].datatype.min)) /
(Math.abs(this.deviceInfo.chartList[i].datatype.min) + Math.abs(this.deviceInfo.chartList[i].datatype.max))
}]
};
opts = {
update: true,
timing: 'easeOut',
duration: 1000,
rotate: false,
rotateLock: false,
color: ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc'],
padding: undefined,
fontSize: 13,
fontColor: '#666666',
dataLabel: true,
dataPointShape: true,
dataPointShapeType: 'solid',
touchMoveLimit: 60,
enableScroll: false,
enableMarkLine: false,
title: {
name: `${value} ${unit}`,
fontSize: 24,
color: '#2fc25b',
offsetY: 95,
offsetX: 0
},
subtitle: {
name: this.deviceInfo.chartList[i].name,
fontSize: 14,
color: '#333',
offsetY: 10,
offsetX: 0
},
extra: {
gauge: {
type: 'default',
width: 10,
labelColor: '#666666',
startAngle: 0.75,
endAngle: 0.25,
startNumber: this.deviceInfo.chartList[i].datatype.min,
endNumber: this.deviceInfo.chartList[i].datatype.max,
format: 'dashboardKeepTwoDecimals',
labelFormat: '',
splitLine: {
fixRadius: 0,
splitNumber: 10,
width: 30,
color: '#FFFFFF',
childNumber: 5,
childWidth: 10
},
pointer: {
width: 12,
color: 'auto'
},
labelOffset: 16
}
}
};
}
this.monitorChart.push({ this.monitorChart.push({
opts: opts, opts: opts,
data: data, data: data,
id: this.deviceInfo.chartList[i].id id: this.deviceInfo.chartList[i].id,
unit: unit,
displayValue: value,
isMechanicalPressureGauge: isMechanicalPressureGauge
}); });
} }
}; };
@ -1376,16 +1400,42 @@
.wrapper .item { .wrapper .item {
width: 100%; width: 100%;
height: 250px;
text-align: center; text-align: center;
padding: 10px 0;
border-top: 1px solid #efefef; border-top: 1px solid #efefef;
} }
.wrapper .item .dashboard { .wrapper .item .dashboard {
width: 60%; width: 60%;
height: 250px;
margin: auto; margin: auto;
} }
.wrapper .item .monitor-item {
display: flex;
align-items: center;
padding: 0 20px;
}
.wrapper .item .monitor-label {
width: 120px;
text-align: left;
font-size: 14px;
color: #606266;
}
.wrapper .item .monitor-value {
flex: 1;
}
.wrapper .item .monitor-unit {
margin-left: 10px;
font-size: 14px;
color: #909399;
width: 40px;
text-align: left;
}
.card { .card {
box-shadow: 0 1px 0px 0 rgba(0, 0, 0, 0.1); box-shadow: 0 1px 0px 0 rgba(0, 0, 0, 0.1);
border-radius: 6px; border-radius: 6px;

View File

@ -0,0 +1,15 @@
// vue.config.js
const {
codeInspectorPlugin
} = require('code-inspector-plugin');
module.exports = {
// ...other code
chainWebpack: (config) => {
config.plugin('code-inspector-plugin').use(
codeInspectorPlugin({
bundler: 'webpack',
})
);
},
};