This commit is contained in:
JayJiaJun 2025-03-27 14:23:27 +08:00
parent d9766f43e8
commit 5b328629f8
6 changed files with 329 additions and 282 deletions

View File

@ -1,31 +1,31 @@
{ {
"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\"/>",
@ -36,145 +36,146 @@
"<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
}, },
"h5" : { "sassImplementationName": "node-sass",
"title" : "芯程物联", "h5": {
"router" : { "title": "芯程物联",
"mode" : "hash", "router": {
"base" : "./" "mode": "hash",
"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"
} }
} }
} }

View File

@ -113,14 +113,14 @@
} from '@/apis/modules/scene'; } from '@/apis/modules/scene';
export default { export default {
beforeRouteEnter (to, from, next) { beforeRouteEnter(to, from, next) {
// //
next(vm => { next(vm => {
// 访 `vm` // 访 `vm`
vm.onLoad() // vm.onLoad() //
}) })
}, },
data () { data() {
return { return {
deleteId: '', deleteId: '',
isDelete: false, isDelete: false,
@ -152,13 +152,13 @@
loadmoreStatus: 'loadmore', // loadmoreStatus: 'loadmore', //
}; };
}, },
onLoad () { onLoad() {
this.getToken(); this.getToken();
if (this.token != '' && this.token != null) { if (this.token != '' && this.token != null) {
this.getList(); this.getList();
} }
}, },
onShow () { onShow() {
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
// //
if (!this.isLogin()) { if (!this.isLogin()) {
@ -183,7 +183,7 @@
// #endif // #endif
}, },
methods: { methods: {
getToken () { getToken() {
// token // token
this.token = uni.getStorageSync('token'); this.token = uni.getStorageSync('token');
// vuextoken // vuextoken
@ -191,13 +191,13 @@
console.log(this.token) console.log(this.token)
}, },
// //
handleDelete (item) { handleDelete(item) {
this.isDelete = true; this.isDelete = true;
this.deleteId = item.sceneId; this.deleteId = item.sceneId;
this.deleteContent = `确定删除“${item.sceneName}”?` this.deleteContent = `确定删除“${item.sceneName}”?`
}, },
// //
handleConfirmDelete () { handleConfirmDelete() {
delScene(this.deleteId).then(res => { delScene(this.deleteId).then(res => {
if (res.code === 200) { if (res.code === 200) {
this.list = []; this.list = [];
@ -215,7 +215,7 @@
}); });
}, },
// //
isLogin () { isLogin() {
if (this.token == '' || this.token == null) { if (this.token == '' || this.token == null) {
return false; return false;
} else { } else {
@ -223,21 +223,21 @@
} }
}, },
// //
handleStatusChange (item) { handleStatusChange(item) {
this.list = []; this.list = [];
this.queryParams.enable = item.id; this.queryParams.enable = item.id;
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
this.getList(); this.getList();
}, },
// //
goToSceneList () { goToSceneList() {
uni.navigateTo({ uni.navigateTo({
url: '/pagesA/scene/list' url: '/pagesA/scene/list'
}); });
this.isMenu = false; this.isMenu = false;
}, },
// //
handleAddScene () { handleAddScene() {
// 使vuex // 使vuex
let sceneData = { let sceneData = {
sceneId: null, sceneId: null,
@ -264,7 +264,7 @@
}); });
}, },
// //
handleSceneDetail (id) { handleSceneDetail(id) {
const storage = uni.getStorageSync('sceneData'); const storage = uni.getStorageSync('sceneData');
if (storage) { if (storage) {
uni.removeStorageSync('sceneData'); uni.removeStorageSync('sceneData');
@ -290,7 +290,7 @@
}); });
}, },
// //
getCondName (cond) { getCondName(cond) {
if (cond === 1) { if (cond === 1) {
return this.$tt('scene.anyCondition') return this.$tt('scene.anyCondition')
} else if (cond === 2) { } else if (cond === 2) {
@ -301,7 +301,7 @@
return this.$tt('scene.unknown') return this.$tt('scene.unknown')
} }
}, },
getExecuteModeName (mode) { getExecuteModeName(mode) {
if (mode === 1) { if (mode === 1) {
return this.$tt('scene.serial') return this.$tt('scene.serial')
} else if (mode === 2) { } else if (mode === 2) {
@ -311,7 +311,7 @@
} }
}, },
// //
getList () { getList() {
listScene(this.queryParams) listScene(this.queryParams)
.then(res => { .then(res => {
const { const {
@ -327,16 +327,16 @@
}); });
}, },
// //
handleSearch () { handleSearch() {
this.list = []; this.list = [];
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
this.getList(); this.getList();
}, },
handleClearSearch () { handleClearSearch() {
this.handleSearch(); this.handleSearch();
}, },
// //
onPullDownRefresh () { onPullDownRefresh() {
console.log('下拉刷新'); console.log('下拉刷新');
this.list = []; this.list = [];
this.total = 0; this.total = 0;
@ -348,7 +348,7 @@
}, 1000); }, 1000);
}, },
// //
onReachBottom () { onReachBottom() {
console.log('上拉加载'); console.log('上拉加载');
this.loadmoreStatus = 'loading'; this.loadmoreStatus = 'loading';
this.queryParams.pageNum = ++this.queryParams.pageNum; this.queryParams.pageNum = ++this.queryParams.pageNum;
@ -363,7 +363,7 @@
}, 1000); }, 1000);
}, },
// //
handleRunOnce (data) { handleRunOnce(data) {
const params = { const params = {
sceneId: data.sceneId sceneId: data.sceneId
}; };
@ -375,7 +375,7 @@
}); });
}, },
// //
handleSwitchStatus (data) { handleSwitchStatus(data) {
const params = { const params = {
sceneId: data.sceneId, sceneId: data.sceneId,
enable: data.enable, enable: data.enable,
@ -488,7 +488,7 @@
} }
// popup // popup
/deep/ .u-safe-bottom { ::v-deep .u-safe-bottom {
display: none; display: none;
} }
} }

View File

@ -144,13 +144,22 @@
<script> <script>
import projectConfig from '@/env.config.js'; import projectConfig from '@/env.config.js';
import { mapState, mapMutations } from 'vuex'; import {
import { logout, secureBind, wechatBind } from '@/apis/modules/common'; mapState,
import { deviceRelateUser } from '@/apis/modules/device'; mapMutations
} from 'vuex';
import {
logout,
secureBind,
wechatBind
} from '@/apis/modules/common';
import {
deviceRelateUser
} from '@/apis/modules/device';
export default { export default {
components: {}, components: {},
data () { data() {
return { return {
avatarUrl: '', // avatarUrl: '', //
// //
@ -171,7 +180,7 @@
token: '', token: '',
}; };
}, },
onShow () { onShow() {
//tabBar //tabBar
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
uni.setTabBarItem({ uni.setTabBarItem({
@ -199,7 +208,7 @@
computed: { computed: {
...mapState(['isLoggedIn']) // ...mapState(['isLoggedIn']) //
}, },
onLoad () { onLoad() {
this.getToken(); this.getToken();
if (this.token != '' && this.token != null) { if (this.token != '' && this.token != null) {
this.getProfile(); this.getProfile();
@ -207,7 +216,7 @@
}, },
methods: { methods: {
getToken () { getToken() {
// token // token
this.token = uni.getStorageSync('token'); this.token = uni.getStorageSync('token');
// vuextoken // vuextoken
@ -215,15 +224,15 @@
}, },
...mapMutations(['setLoggedIn']), ...mapMutations(['setLoggedIn']),
// 退 // 退
handleExit () { handleExit() {
this.show = true; this.show = true;
}, },
// 退 // 退
cancelExit () { cancelExit() {
this.show = false; this.show = false;
}, },
// 退 // 退
confirmExit () { confirmExit() {
logout().then(() => { logout().then(() => {
this.clearToken(); this.clearToken();
this.setLoggedIn(false); this.setLoggedIn(false);
@ -234,16 +243,16 @@
}); });
}, },
// //
handleAppSecureBind () { handleAppSecureBind() {
uni.navigateTo({ uni.navigateTo({
url: '/pagesB/user/secureBind' url: '/pagesB/user/secureBind'
}); });
}, },
gotoAccount () { gotoAccount() {
uni.$u.route('/pagesB/user/account'); uni.$u.route('/pagesB/user/account');
}, },
// //
gotoMessageList () { gotoMessageList() {
if (this.token != '' && this.token != null) { if (this.token != '' && this.token != null) {
uni.navigateTo({ uni.navigateTo({
url: '/pagesB/list/user/message' url: '/pagesB/list/user/message'
@ -252,13 +261,13 @@
this.showModel = true; this.showModel = true;
} }
}, },
gotoLanguage () { gotoLanguage() {
//this.clearToken() //this.clearToken()
uni.navigateTo({ uni.navigateTo({
url: '/pagesB/language/index' url: '/pagesB/language/index'
}) })
}, },
gotoEmulator () { gotoEmulator() {
if (this.token != '' && this.token != null) { if (this.token != '' && this.token != null) {
uni.navigateTo({ uni.navigateTo({
url: '/pagesB/list/user/message' url: '/pagesB/list/user/message'
@ -267,7 +276,7 @@
this.showModel = true; this.showModel = true;
} }
}, },
gotoScene () { gotoScene() {
if (this.token != '' && this.token != null) { if (this.token != '' && this.token != null) {
uni.switchTab({ uni.switchTab({
url: '/pages/tabBar/scene/index' url: '/pages/tabBar/scene/index'
@ -277,18 +286,18 @@
} }
}, },
// //
confirmGotoLogin () { confirmGotoLogin() {
// this.clearToken(); // this.clearToken();
uni.reLaunch({ uni.reLaunch({
url: '/pagesB/login/waitLogin' url: '/pagesB/login/waitLogin'
}); });
this.showModel = false; this.showModel = false;
}, },
handleGotoLogin () { handleGotoLogin() {
this.showModel = true; this.showModel = true;
}, },
// //
gotoGroup () { gotoGroup() {
if (this.token != '' && this.token != null) { if (this.token != '' && this.token != null) {
uni.navigateTo({ uni.navigateTo({
url: '/pagesB/user/deviceGroup/index' url: '/pagesB/user/deviceGroup/index'
@ -298,10 +307,10 @@
} }
}, },
// token // token
clearToken () { clearToken() {
uni.setStorageSync('token', ''); uni.setStorageSync('token', '');
}, },
getProfile () { getProfile() {
// //
this.$api.common.getProfile().then(res => { this.$api.common.getProfile().then(res => {
//,TODO //,TODO
@ -313,29 +322,29 @@
}); });
}, },
// //
handleUnsubscribe () { handleUnsubscribe() {
this.isUnsubscribe = true; this.isUnsubscribe = true;
}, },
// //
gotoResetPsd () { gotoResetPsd() {
/*uni.navigateTo({ /*uni.navigateTo({
url:"/pagesB/user/resetPsd" url:"/pagesB/user/resetPsd"
})*/ })*/
uni.$u.route('/pagesB/user/resetPsd'); uni.$u.route('/pagesB/user/resetPsd');
}, },
openhpLink () { openhpLink() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/common/webview/index?url=http://www.hpiot.cn/' url: '/pages/common/webview/index?url=http://www.hpiot.cn/'
}); });
}, },
gotoAbout () { gotoAbout() {
uni.navigateTo({ uni.navigateTo({
url: '/pagesB/user/about' url: '/pagesB/user/about'
}) })
}, },
confirmUnsubscribe () { confirmUnsubscribe() {
logout().then(() => { logout().then(() => {
this.clearToken(); this.clearToken();
// //
@ -345,7 +354,7 @@
}); });
}, },
// //
handleToAvatar () { handleToAvatar() {
if (this.token != '' && this.token != null) { if (this.token != '' && this.token != null) {
const source = { const source = {
album: '从手机相册选择', album: '从手机相册选择',
@ -393,11 +402,11 @@
} }
}, },
// //
handleVipUpgrade () { handleVipUpgrade() {
this.isVipModel = true; this.isVipModel = true;
}, },
// //
gotoScada () { gotoScada() {
if (this.token != '' && this.token != null) { if (this.token != '' && this.token != null) {
uni.navigateTo({ uni.navigateTo({
url: '/pagesB/user/scada/indeScada' url: '/pagesB/user/scada/indeScada'
@ -406,27 +415,27 @@
this.showModel = true; this.showModel = true;
} }
}, },
openappLink () { openappLink() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/common/webview/index?url=https://gitee.com/beecue/fastbee-app/tree/master/app' url: '/pages/common/webview/index?url=https://gitee.com/beecue/fastbee-app/tree/master/app'
}); });
}, },
// //
handleUnbindWeChart () { handleUnbindWeChart() {
uni.navigateTo({ uni.navigateTo({
url: '/pagesB/user/secureBind' url: '/pagesB/user/secureBind'
}); });
}, },
// //
handleBindWeChart () { handleBindWeChart() {
this.isBindWeChart = true; this.isBindWeChart = true;
}, },
confirmBindWeChart () { confirmBindWeChart() {
this.isBindWeChart = false; this.isBindWeChart = false;
let that = this; let that = this;
uni.login({ uni.login({
provider: 'weixin', provider: 'weixin',
success: function (res) { success: function(res) {
if (res) { if (res) {
console.log('用户授权成功'); console.log('用户授权成功');
// #ifdef APP-PLUS // #ifdef APP-PLUS
@ -705,14 +714,14 @@
/* 设置文字颜色 */ /* 设置文字颜色 */
} }
/deep/.uni-list-item__content-title[data-v-296a3d7e] { ::v-deep.uni-list-item__content-title[data-v-296a3d7e] {
font-size: 30rpx; font-size: 30rpx;
color: #333; color: #333;
overflow: hidden; overflow: hidden;
font-weight: 500; font-weight: 500;
} }
/deep/.uni-list-item__container { ::v-deep .uni-list-item__container {
padding: 30rpx; padding: 30rpx;
} }

View File

@ -78,9 +78,15 @@
import moment from 'moment'; import moment from 'moment';
import uniDataCheckbox from '@/pagesA/components/uni-data-checkbox/index.vue'; import uniDataCheckbox from '@/pagesA/components/uni-data-checkbox/index.vue';
import uniPagination from '@/pagesA/components/uni-pagination/index.vue'; import uniPagination from '@/pagesA/components/uni-pagination/index.vue';
import { getSubGatewayList } from '@/apis/modules/gateway.js'; import {
import { listThingsModel } from '@/apis/modules/device.js'; getSubGatewayList
import { getHistoryList } from '@/apis/modules/deviceLog.js'; } from '@/apis/modules/gateway.js';
import {
listThingsModel
} from '@/apis/modules/device.js';
import {
getHistoryList
} from '@/apis/modules/deviceLog.js';
export default { export default {
name: 'deviceHistory', name: 'deviceHistory',
@ -97,10 +103,10 @@
type: Number type: Number
}, },
watch: { watch: {
device: function (newVal, oldVal) { device: function(newVal, oldVal) {
this.deviceInfo = newVal; this.deviceInfo = newVal;
}, },
type (val) { type(val) {
if (val === 3) { if (val === 3) {
// const { deviceType } = this.deviceInfo || {}; // const { deviceType } = this.deviceInfo || {};
// if (deviceType === 2) { // if (deviceType === 2) {
@ -110,7 +116,7 @@
} }
} }
}, },
data () { data() {
const beginTime = new Date().getTime() - 3600 * 1000 * 24; const beginTime = new Date().getTime() - 3600 * 1000 * 24;
const endTime = new Date().getTime(); const endTime = new Date().getTime();
@ -193,7 +199,7 @@
}; };
}, },
computed: { computed: {
tableCom () { tableCom() {
const start = (this.devPageNum - 1) * this.devPageSize; const start = (this.devPageNum - 1) * this.devPageSize;
const end = start + this.devPageSize; const end = start + this.devPageSize;
return this.tableComTemp.slice(start, end); return this.tableComTemp.slice(start, end);
@ -201,7 +207,7 @@
}, },
methods: { methods: {
// //
handleTimeShortcutChange (val) { handleTimeShortcutChange(val) {
if (val === 3) { if (val === 3) {
return; return;
} }
@ -220,7 +226,7 @@
this.getHistory(); this.getHistory();
}, },
// //
formatDate (strTime) { formatDate(strTime) {
const times = strTime.split('-'); const times = strTime.split('-');
const beginTime = new Date(Number(times[0])); const beginTime = new Date(Number(times[0]));
const endTime = new Date(Number(times[1])); const endTime = new Date(Number(times[1]));
@ -235,8 +241,11 @@
return `${beginMonth}-${beginDay} ${beginHours}:${beginMinutes} - ${endMonth}-${endDay} ${endHours}:${endMinutes}`; return `${beginMonth}-${beginDay} ${beginHours}:${beginMinutes} - ${endMonth}-${endDay} ${endHours}:${endMinutes}`;
}, },
// //
handleDateTimeClick () { handleDateTimeClick() {
const { beginTime, endTime } = this.queryParams; const {
beginTime,
endTime
} = this.queryParams;
if (this.dateTimeIndex === 1) { if (this.dateTimeIndex === 1) {
this.$refs.datetimePicker.innerValue = beginTime; this.$refs.datetimePicker.innerValue = beginTime;
} else { } else {
@ -245,8 +254,11 @@
this.isDateTime = true; this.isDateTime = true;
}, },
// / // /
handleConfirmDateTime (e) { handleConfirmDateTime(e) {
const { beginTime, endTime } = this.queryParams; const {
beginTime,
endTime
} = this.queryParams;
if (this.dateTimeIndex === 1) { if (this.dateTimeIndex === 1) {
this.queryParams.beginTime = e.value; this.queryParams.beginTime = e.value;
this.dateTimeIndex = this.dateTimeIndex + 1; this.dateTimeIndex = this.dateTimeIndex + 1;
@ -266,19 +278,19 @@
} }
}, },
// //
handleCancelDateTime () { handleCancelDateTime() {
this.isDateTime = false; this.isDateTime = false;
}, },
// //
handleCloseDateTime () { handleCloseDateTime() {
this.isDateTime = false; this.isDateTime = false;
}, },
// //
handleFilterClick () { handleFilterClick() {
this.isFilter = true; this.isFilter = true;
}, },
// //
handleIdentifierCheck (e) { handleIdentifierCheck(e) {
const value = e.detail.value; const value = e.detail.value;
const length = value.length; const length = value.length;
if (length > 9) { if (length > 9) {
@ -290,8 +302,10 @@
} }
}, },
// //
handleConfirmFilter () { handleConfirmFilter() {
const { identifiers } = this.queryParams; const {
identifiers
} = this.queryParams;
if (identifiers.length === 0) { if (identifiers.length === 0) {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
@ -303,15 +317,20 @@
} }
}, },
// //
getSlaveDatas () { getSlaveDatas() {
const { deviceId } = this.deviceInfo; const {
deviceId
} = this.deviceInfo;
const params = { const params = {
gwDeviceId: deviceId, gwDeviceId: deviceId,
pageNum: 1, pageNum: 1,
pageSize: 9999, pageSize: 9999,
}; };
getSubGatewayList(params).then(res => { getSubGatewayList(params).then(res => {
const { code, rows } = res; const {
code,
rows
} = res;
if (code === 200) { if (code === 200) {
this.slaveList = rows.map(item => ({ this.slaveList = rows.map(item => ({
text: item.subDeviceName, text: item.subDeviceName,
@ -322,15 +341,20 @@
}); });
}, },
// //
getIdentifierList () { getIdentifierList() {
const { deviceId } = this.deviceInfo; const {
deviceId
} = this.deviceInfo;
const params = { const params = {
deviceId: deviceId, deviceId: deviceId,
pageNum: 1, pageNum: 1,
pageSize: 9999, pageSize: 9999,
}; };
listThingsModel(params).then((res) => { listThingsModel(params).then((res) => {
const { code, rows } = res; const {
code,
rows
} = res;
if (code === 200) { if (code === 200) {
this.identifierList = rows.map(item => ({ this.identifierList = rows.map(item => ({
text: item.modelName, text: item.modelName,
@ -342,14 +366,22 @@
}); });
}, },
// //
getData () { getData() {
this.getIdentifierList(); this.getIdentifierList();
this.getHistory(); // this.getHistory(); //
}, },
// //
getHistory () { getHistory() {
const { identifiers, beginTime, endTime, slaveId } = this.queryParams; const {
const { deviceId, serialNumber } = this.deviceInfo; identifiers,
beginTime,
endTime,
slaveId
} = this.queryParams;
const {
deviceId,
serialNumber
} = this.deviceInfo;
if (identifiers.length !== 0) { if (identifiers.length !== 0) {
const idenList = identifiers.map((item) => { const idenList = identifiers.map((item) => {
const iden = this.identifierList.find((chil) => chil.value === item); const iden = this.identifierList.find((chil) => chil.value === item);
@ -374,7 +406,7 @@
} }
}, },
// 线 // 线
getChartDatas () { getChartDatas() {
const categories = this.historys.map((item) => Object.keys(item)[0]); const categories = this.historys.map((item) => Object.keys(item)[0]);
const series = this.queryParams.identifiers.map((item) => { const series = this.queryParams.identifiers.map((item) => {
return { return {
@ -391,7 +423,7 @@
} }
}, },
// //
getTableDatas () { getTableDatas() {
this.tableHeaders = this.queryParams.identifiers.map((item) => ({ this.tableHeaders = this.queryParams.identifiers.map((item) => ({
name: this.identifierList.find((chil) => chil.value === item).text, name: this.identifierList.find((chil) => chil.value === item).text,
value: item, value: item,
@ -410,7 +442,7 @@
this.devTotal = this.historys.length; this.devTotal = this.historys.length;
}, },
// //
getTableComsList (e) { getTableComsList(e) {
this.devPageNum = e.current; this.devPageNum = e.current;
}, },
}, },
@ -434,7 +466,7 @@
.time-shortcut { .time-shortcut {
width: 190rpx; width: 190rpx;
/deep/ .uni-select { ::v-deep .uni-select {
height: 70rpx; height: 70rpx;
} }
} }

View File

@ -1410,7 +1410,7 @@
padding: 0px 18px; padding: 0px 18px;
border-radius: 5px; border-radius: 5px;
/deep/ .u-line:first-child { ::v-deep .u-line:first-child {
border-bottom: transparent !important; border-bottom: transparent !important;
} }
} }

View File

@ -19,10 +19,12 @@
</template> </template>
<script> <script>
import { updateDevice } from '@/apis/modules/device'; import {
updateDevice
} from '@/apis/modules/device';
export default { export default {
data () { data() {
return { return {
model: { model: {
name: '', name: '',
@ -45,25 +47,28 @@
data: null data: null
}; };
}, },
onReady () { onReady() {
//setRules //setRules
this.$refs.form.setRules(this.rules) this.$refs.form.setRules(this.rules)
}, },
onLoad (option) { onLoad(option) {
this.data = JSON.parse(decodeURIComponent(option.item)); this.data = JSON.parse(decodeURIComponent(option.item));
const { deviceName, firmwareVersion } = this.data; const {
deviceName,
firmwareVersion
} = this.data;
this.model.name = deviceName; this.model.name = deviceName;
this.model.version = firmwareVersion; this.model.version = firmwareVersion;
}, },
methods: { methods: {
handleSaveClick () { handleSaveClick() {
this.$refs.form.validate().then(res => { this.$refs.form.validate().then(res => {
this.updateDeviceData(); this.updateDeviceData();
}).catch(errors => { }).catch(errors => {
console.log('校验失败'); console.log('校验失败');
}) })
}, },
updateDeviceData () { updateDeviceData() {
let device = { let device = {
...this.data, ...this.data,
deviceId: this.data.deviceId, deviceId: this.data.deviceId,
@ -102,7 +107,7 @@
.modbus-edit-wrap { .modbus-edit-wrap {
padding: 10px; padding: 10px;
/deep/ .u-form-item__body__left__content__required { ::v-deep .u-form-item__body__left__content__required {
left: 5px; left: 5px;
} }