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

View File

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

View File

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

View File

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

View File

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

View File

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