Commit 74e7ede35bd0335ae979d4872c2ebf7dad070dc2

Authored by xp.Huang
2 parents 51316321 a50e0c90

Merge branch 'sqy_dev' into 'main'

fix:调整设备的命令记录和修复bug

See merge request huang/thingskit-app!36
@@ -4,8 +4,8 @@ import { @@ -4,8 +4,8 @@ import {
4 let baseUrl = ""; 4 let baseUrl = "";
5 if (process.env.NODE_ENV === 'development') { 5 if (process.env.NODE_ENV === 'development') {
6 // 开发环境 6 // 开发环境
7 - baseUrl = 'http://192.168.10.115:8080/api'  
8 - // baseUrl = 'https://dev.thingskit.com/api' 7 + // baseUrl = 'http://192.168.10.115:8080/api'
  8 + baseUrl = 'https://dev.thingskit.com/api'
9 9
10 } else if (process.env.NODE_ENV === 'production') { 10 } else if (process.env.NODE_ENV === 'production') {
11 // 生产环境 11 // 生产环境
@@ -14,6 +14,7 @@ @@ -14,6 +14,7 @@
14 :inactiveStyle="{ 14 :inactiveStyle="{
15 color: '#999' 15 color: '#999'
16 }" 16 }"
  17 + :scrollable="isScrollable"
17 /> 18 />
18 </u-sticky> 19 </u-sticky>
19 <view style="margin-top:30rpx;"> 20 <view style="margin-top:30rpx;">
@@ -46,6 +47,7 @@ import historyData from './tabDetail/historyData.vue'; @@ -46,6 +47,7 @@ import historyData from './tabDetail/historyData.vue';
46 import commondRecord from './tabDetail/CommandRecord.vue'; 47 import commondRecord from './tabDetail/CommandRecord.vue';
47 import { getDeviceKeys, getHistoryData } from './api/index.js'; 48 import { getDeviceKeys, getHistoryData } from './api/index.js';
48 import { formatToDate } from '@/plugins/utils.js'; 49 import { formatToDate } from '@/plugins/utils.js';
  50 +import moment from 'moment';
49 export default { 51 export default {
50 components: { 52 components: {
51 fTabbar, 53 fTabbar,
@@ -57,7 +59,7 @@ export default { @@ -57,7 +59,7 @@ export default {
57 }, 59 },
58 data() { 60 data() {
59 return { 61 return {
60 - list: [{ name: '基础信息' }, { name: '实时数据' }, { name: '历史数据' }, { name: '告警记录' }, { name: '命令记录' }], 62 + list: [{ name: '基础信息' }, { name: '实时数据' }, { name: '历史数据' }, { name: '告警记录' }],
61 currentTab: 0, 63 currentTab: 0,
62 deviceId: '', 64 deviceId: '',
63 deviceDetail: {}, 65 deviceDetail: {},
@@ -69,10 +71,11 @@ export default { @@ -69,10 +71,11 @@ export default {
69 entityId: '', 71 entityId: '',
70 startTs: '', 72 startTs: '',
71 endTs: '', 73 endTs: '',
72 - recordList: [] 74 + recordList: [],
  75 + isScrollable: false
73 }; 76 };
74 }, 77 },
75 - onUnload(){ 78 + onUnload() {
76 // 页面关闭时,销毁webSocket连接,否则第二次会存在连接不到的情况 79 // 页面关闭时,销毁webSocket连接,否则第二次会存在连接不到的情况
77 uni.closeSocket(); 80 uni.closeSocket();
78 }, 81 },
@@ -81,6 +84,14 @@ export default { @@ -81,6 +84,14 @@ export default {
81 this.deviceId = id; 84 this.deviceId = id;
82 const res = await uni.$u.http.get(`/yt/device/${id}`); 85 const res = await uni.$u.http.get(`/yt/device/${id}`);
83 this.deviceDetail = { ...res, alarmStatus, lastOnlineTime }; 86 this.deviceDetail = { ...res, alarmStatus, lastOnlineTime };
  87 +
  88 + // 设备类型不是网关子设备的添加一个命令记录的选项卡
  89 + if (this.deviceDetail.deviceType !== 'SENSOR') {
  90 + this.list.push({
  91 + name: '命令记录'
  92 + });
  93 + }
  94 + this.isScrollable = this.list.length > 4;
84 // 连接webSockte 95 // 连接webSockte
85 const socketTask = uni.connectSocket({ 96 const socketTask = uni.connectSocket({
86 url: 'wss://dev.thingskit.com/api/ws/plugins/telemetry?token=' + uni.getStorageSync('userInfo').isToken, //仅为示例,并非真实接口地址。 97 url: 'wss://dev.thingskit.com/api/ws/plugins/telemetry?token=' + uni.getStorageSync('userInfo').isToken, //仅为示例,并非真实接口地址。
@@ -144,22 +155,24 @@ export default { @@ -144,22 +155,24 @@ export default {
144 155
145 const keys = await getDeviceKeys(tbDeviceId); 156 const keys = await getDeviceKeys(tbDeviceId);
146 this.keys = [keys]; 157 this.keys = [keys];
147 - const date = new Date();  
148 - const year = date.getFullYear(); //获取完整的年份(4位)  
149 - const month = date.getMonth() + 1; //获取当前月份(0-11,0代表1月)  
150 - const day = date.getDate(); //获取当前日(1-31)  
151 - const yesterday = `${year}-${month}-${day - 1}`;  
152 - const today = `${year}-${month}-${day}`;  
153 - this.yesterday = yesterday;  
154 - this.today = today;  
155 - this.startTs = formatToDate(yesterday, 'x');  
156 - this.endTs = formatToDate(today, 'x'); 158 + // 昨天
  159 + this.yesterday = moment()
  160 + .subtract(1, 'days')
  161 + .format('YYYY-MM-DD');
  162 + // 今天
  163 + this.today = moment().format('YYYY-MM-DD');
  164 + // 开始时间
  165 + this.startTs = moment()
  166 + .subtract(1, 'days')
  167 + .format('x');
  168 + // 结束时间
  169 + this.endTs = moment().format('x');
157 this.entityId = tbDeviceId; 170 this.entityId = tbDeviceId;
158 - console.log(this.entityId) 171 +
159 const data = await getHistoryData({ 172 const data = await getHistoryData({
160 entityId: tbDeviceId, 173 entityId: tbDeviceId,
161 - startTs: formatToDate(yesterday, 'x'),  
162 - endTs: formatToDate(today, 'x'), 174 + startTs: this.startTs,
  175 + endTs: this.endTs,
163 keys: keys[0], 176 keys: keys[0],
164 interval: 1800000 177 interval: 1800000
165 }); 178 });
1 <template> 1 <template>
2 <view class="command-detail"> 2 <view class="command-detail">
3 - <view class="detail-top">网关设备1</view> 3 + <view class="detail-top">{{ commandDetail.deviceName }}</view>
4 <view class="detail"> 4 <view class="detail">
5 <view class="detail-item"> 5 <view class="detail-item">
6 <view class="detail-label">设备类型</view> 6 <view class="detail-label">设备类型</view>
7 - <view class="detail-value">网关子设备</view> 7 + <view class="detail-value">{{ commandDetail.deviceType }}</view>
8 </view> 8 </view>
9 <u-line length="90%" margin="0 auto"></u-line> 9 <u-line length="90%" margin="0 auto"></u-line>
10 <view class="detail-item"> 10 <view class="detail-item">
11 <view class="detail-label">设备编号</view> 11 <view class="detail-label">设备编号</view>
12 - <view class="detail-value">SN98489123471829</view> 12 + <view class="detail-value">{{ commandDetail.deviceSn }}</view>
13 </view> 13 </view>
14 <u-line length="90%" margin="0 auto"></u-line> 14 <u-line length="90%" margin="0 auto"></u-line>
15 <view class="detail-item"> 15 <view class="detail-item">
16 <view class="detail-label">所属组织</view> 16 <view class="detail-label">所属组织</view>
17 - <view class="detail-value">云腾汽车</view> 17 + <view class="detail-value">{{ commandDetail.organizationName }}</view>
18 </view> 18 </view>
19 <u-line length="90%" margin="0 auto"></u-line> 19 <u-line length="90%" margin="0 auto"></u-line>
20 <view class="detail-item"> 20 <view class="detail-item">
21 <view class="detail-label">命令下发时间</view> 21 <view class="detail-label">命令下发时间</view>
22 - <view class="detail-value">2022-01-25 12:44:22</view> 22 + <view class="detail-value">{{ commandDetail.createTime }}</view>
23 </view> 23 </view>
24 <u-line length="90%" margin="0 auto"></u-line> 24 <u-line length="90%" margin="0 auto"></u-line>
25 - <view class="detail-item"> 25 + <view class="detail-item" v-if="commandDetail.additionalInfo.cmdType">
26 <view class="detail-label">命令类型</view> 26 <view class="detail-label">命令类型</view>
27 - <view class="detail-value">Mqtt命令</view> 27 + <view class="detail-value">{{ commandDetail.additionalInfo.cmdType }}</view>
28 </view> 28 </view>
29 - <u-line length="90%" margin="0 auto"></u-line> 29 + <u-line length="90%" margin="0 auto" v-if="commandDetail.additionalInfo.cmdType"></u-line>
30 <view class="detail-item"> 30 <view class="detail-item">
31 <view class="detail-label">响应类型</view> 31 <view class="detail-label">响应类型</view>
32 - <view class="detail-value">OneWay</view> 32 + <view class="detail-value"></view>
33 </view> 33 </view>
34 <u-line length="90%" margin="0 auto"></u-line> 34 <u-line length="90%" margin="0 auto"></u-line>
35 <view class="detail-item"> 35 <view class="detail-item">
@@ -47,7 +47,20 @@ @@ -47,7 +47,20 @@
47 </view> 47 </view>
48 </template> 48 </template>
49 49
50 -<script></script> 50 +<script>
  51 +export default {
  52 + data() {
  53 + return {
  54 + commandDetail: {}
  55 + };
  56 + },
  57 + onLoad(options) {
  58 + const { data } = options;
  59 + this.commandDetail = JSON.parse(data);
  60 + console.log(this.commandDetail, '---------');
  61 + }
  62 +};
  63 +</script>
51 64
52 <style lang="scss" scoped> 65 <style lang="scss" scoped>
53 .command-detail { 66 .command-detail {
@@ -84,7 +97,7 @@ @@ -84,7 +97,7 @@
84 } 97 }
85 } 98 }
86 } 99 }
87 - .command{ 100 + .command {
88 margin: 30rpx 0; 101 margin: 30rpx 0;
89 } 102 }
90 } 103 }
@@ -12,21 +12,21 @@ @@ -12,21 +12,21 @@
12 </view> 12 </view>
13 </view> 13 </view>
14 <mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback"> 14 <mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback">
15 - <view @click="openDeviceDetail(item)" class="list-item" v-for="(item, index) in list" :key="index"> 15 + <view @click="openCommandDetail(item)" class="list-item" v-for="(item, index) in list" :key="index">
16 <view class="item"> 16 <view class="item">
17 <view class="item-first"> 17 <view class="item-first">
18 <text>{{ item.deviceName }}</text> 18 <text>{{ item.deviceName }}</text>
19 - <view class="item-right">响应成功</view> 19 + <!-- <view class="item-right">响应成功</view> -->
20 </view> 20 </view>
21 - <view> 21 + <view v-if="item.additionalInfo.cmdType">
22 命令类型: 22 命令类型:
23 - <text style="margin-left: 16rpx;">MQTT命令</text> 23 + <text style="margin-left: 16rpx;">{{ item.additionalInfo.cmdType }}</text>
24 </view> 24 </view>
25 - <view> 25 + <view v-if="item.statusName">
26 命令状态: 26 命令状态:
27 - <text style="margin-left: 16rpx;">下发成功</text> 27 + <text style="margin-left: 16rpx;">{{ item.statusName }}</text>
28 </view> 28 </view>
29 - <view class="time">{{ item.createdTime }}</view> 29 + <view class="time">{{ format(item.createTime) }}</view>
30 </view> 30 </view>
31 </view> 31 </view>
32 </mescroll-body> 32 </mescroll-body>
@@ -34,10 +34,8 @@ @@ -34,10 +34,8 @@
34 <u-popup @close="close" closeable bgColor="#fff" :show="show" mode="bottom" :round="20"> 34 <u-popup @close="close" closeable bgColor="#fff" :show="show" mode="bottom" :round="20">
35 <view class="filter"> 35 <view class="filter">
36 <view class="filter-title"><text>筛选条件</text></view> 36 <view class="filter-title"><text>筛选条件</text></view>
37 - <FilterItem :filterList="alarmStatus" title="告警状态" @clickTag="currentIndex => handleClickTag(currentIndex, alarmStatus)"></FilterItem>  
38 - <FilterItem :filterList="typeStatus" title="设备类型" @clickTag="currentIndex => handleClickTag(currentIndex, typeStatus)"></FilterItem>  
39 - <FilterItem :filterList="alarmLevelStatus" title="告警等级" @clickTag="currentIndex => handleClickTag(currentIndex, alarmLevelStatus)"></FilterItem>  
40 - <FilterItem :filterList="timeStatus" title="选择时间" @clickTag="currentIndex => handleClickTag(currentIndex, timeStatus)"></FilterItem> 37 + <FilterItem :filterList="issueStatus" title="下发状态" @clickTag="currentIndex => handleClickTag(currentIndex, issueStatus)"></FilterItem>
  38 + <FilterItem :filterList="responseWay" title="响应方式" @clickTag="currentIndex => handleClickTag(currentIndex, responseWay)"></FilterItem>
41 <view class="button-group"> 39 <view class="button-group">
42 <view><u-button :customStyle="{ color: '#333' }" color="#e3e3e5" shape="circle" text="重置" @click="resetFilter"></u-button></view> 40 <view><u-button :customStyle="{ color: '#333' }" color="#e3e3e5" shape="circle" text="重置" @click="resetFilter"></u-button></view>
43 <view><u-button color="#3388ff" shape="circle" text="确认" @click="confirmFilter"></u-button></view> 41 <view><u-button color="#3388ff" shape="circle" text="确认" @click="confirmFilter"></u-button></view>
@@ -59,6 +57,7 @@ @@ -59,6 +57,7 @@
59 <script> 57 <script>
60 import FilterItem from '@/pages/device/FilterItem.vue'; 58 import FilterItem from '@/pages/device/FilterItem.vue';
61 import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js'; 59 import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js';
  60 +import { formatToDate } from '@/plugins/utils.js';
62 export default { 61 export default {
63 mixins: [MescrollMixin], 62 mixins: [MescrollMixin],
64 components: { 63 components: {
@@ -70,11 +69,6 @@ export default { @@ -70,11 +69,6 @@ export default {
70 default: '' 69 default: ''
71 } 70 }
72 }, 71 },
73 - // mounted() {  
74 - // this.loadData(1, {  
75 - // tbDeviceId: this.tbDeviceId  
76 - // });  
77 - // },  
78 data() { 72 data() {
79 return { 73 return {
80 show: false, 74 show: false,
@@ -85,7 +79,7 @@ export default { @@ -85,7 +79,7 @@ export default {
85 getTimeGap: '' 79 getTimeGap: ''
86 }, 80 },
87 showCalendar: false, 81 showCalendar: false,
88 - alarmStatus: [ 82 + issueStatus: [
89 { 83 {
90 checked: true, 84 checked: true,
91 name: '全部', 85 name: '全部',
@@ -93,80 +87,16 @@ export default { @@ -93,80 +87,16 @@ export default {
93 }, 87 },
94 { 88 {
95 checked: false, 89 checked: false,
96 - name: '激活未确认',  
97 - type: 'ACTIVE_UNACK' 90 + name: '成功',
  91 + type: 'success'
98 }, 92 },
99 { 93 {
100 checked: false, 94 checked: false,
101 - name: '激活已确认',  
102 - type: 'ACTIVE_ACK'  
103 - },  
104 - {  
105 - checked: false,  
106 - name: '清除未确认',  
107 - type: 'CLEARED_UNACK'  
108 - },  
109 - {  
110 - checked: false,  
111 - name: '清除已确认',  
112 - type: 'CLEARED_ACK'  
113 - }  
114 - ],  
115 - typeStatus: [  
116 - {  
117 - checked: true,  
118 - name: '全部',  
119 - type: ''  
120 - },  
121 - {  
122 - checked: false,  
123 - name: '网关设备',  
124 - type: 'GATEWAY'  
125 - },  
126 - {  
127 - checked: false,  
128 - name: '网关子设备',  
129 - type: 'SENSOR'  
130 - },  
131 - {  
132 - checked: false,  
133 - name: '直连设备',  
134 - type: 'DIRECT_CONNECTION'  
135 - }  
136 - ],  
137 - alarmLevelStatus: [  
138 - {  
139 - checked: true,  
140 - name: '全部',  
141 - type: ''  
142 - },  
143 - {  
144 - checked: false,  
145 - name: '危险',  
146 - type: 'CRITICAL'  
147 - },  
148 - {  
149 - checked: false,  
150 - name: '重要',  
151 - type: 'MAJOR'  
152 - },  
153 - {  
154 - checked: false,  
155 - name: '次要',  
156 - type: 'MINOR'  
157 - },  
158 - {  
159 - checked: false,  
160 - name: '警告',  
161 - type: 'WARNING'  
162 - },  
163 - {  
164 - checked: false,  
165 - name: '不确定',  
166 - type: 'INDETERMINATE' 95 + name: '失败',
  96 + type: 'fail'
167 } 97 }
168 ], 98 ],
169 - timeStatus: [ 99 + responseWay: [
170 { 100 {
171 checked: true, 101 checked: true,
172 name: '全部', 102 name: '全部',
@@ -174,23 +104,13 @@ export default { @@ -174,23 +104,13 @@ export default {
174 }, 104 },
175 { 105 {
176 checked: false, 106 checked: false,
177 - name: '30分钟',  
178 - type: '1800000'  
179 - },  
180 - {  
181 - checked: false,  
182 - name: '一小时',  
183 - type: '3600000'  
184 - },  
185 - {  
186 - checked: false,  
187 - name: '2小时',  
188 - type: '7200000' 107 + name: 'OneWay',
  108 + type: 'OneWay'
189 }, 109 },
190 { 110 {
191 checked: false, 111 checked: false,
192 - name: '近一天',  
193 - type: '1440000' 112 + name: 'TowWay',
  113 + type: 'TowWay'
194 } 114 }
195 ], 115 ],
196 downOption: { 116 downOption: {
@@ -212,6 +132,9 @@ export default { @@ -212,6 +132,9 @@ export default {
212 tbDeviceId: this.tbDeviceId 132 tbDeviceId: this.tbDeviceId
213 }); 133 });
214 }, 134 },
  135 + format(date) {
  136 + return formatToDate(date, 'YYYY-MM-DD HH:mm:ss');
  137 + },
215 /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */ 138 /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
216 upCallback() { 139 upCallback() {
217 //联网加载数据 140 //联网加载数据
@@ -257,8 +180,8 @@ export default { @@ -257,8 +180,8 @@ export default {
257 }); 180 });
258 }, 181 },
259 resetFilter() { 182 resetFilter() {
260 - const { alarmStatus, typeStatus, alarmLevelStatus, timeStatus } = this;  
261 - [alarmStatus, typeStatus, alarmLevelStatus, timeStatus].forEach(item => item.map((item, index) => (item.checked = index === 0))); 183 + const { issueStatus, responseWay } = this;
  184 + [issueStatus, responseWay].forEach(item => item.map((item, index) => (item.checked = index === 0)));
262 }, 185 },
263 close() { 186 close() {
264 this.show = false; 187 this.show = false;
@@ -274,18 +197,11 @@ export default { @@ -274,18 +197,11 @@ export default {
274 this.timeData.selectTime = `${e[0]} / ${e[e.length - 1]}`; 197 this.timeData.selectTime = `${e[0]} / ${e[e.length - 1]}`;
275 }, 198 },
276 confirmFilter() { 199 confirmFilter() {
277 - const alarmState = this.alarmStatus.find(item => item.checked);  
278 - const typeState = this.typeStatus.find(item => item.checked);  
279 - const alarmLevelState = this.alarmLevelStatus.find(item => item.checked);  
280 - const timeState = this.timeStatus.find(item => item.checked);  
281 - const endTs = Date.now();  
282 - const startTs = endTs - timeState.type; 200 + const issueStatus = this.issueStatus.find(item => item.checked);
  201 + const responseWay = this.responseWay.find(item => item.checked);
283 this.loadData(1, { 202 this.loadData(1, {
284 - status: alarmState.type ? alarmState.type : undefined,  
285 - deviceType: typeState.type ? typeState.type : undefined,  
286 - alarmType: alarmLevelState.type ? alarmLevelState.type : undefined,  
287 - startTime: timeState.type ? startTs : undefined,  
288 - endTime: timeState.type ? endTs : undefined, 203 + status: issueStatus.type ? issueStatus.type : undefined,
  204 + responseWay: responseWay.type ? responseWay.type : undefined,
289 deviceId: this.deviceId 205 deviceId: this.deviceId
290 }); 206 });
291 this.show = false; 207 this.show = false;
@@ -293,19 +209,9 @@ export default { @@ -293,19 +209,9 @@ export default {
293 calendarClose() { 209 calendarClose() {
294 this.showCalendar = false; 210 this.showCalendar = false;
295 }, 211 },
296 - openDeviceDetail(item) {  
297 - const { id, deviceName, severity, originatorType, details, createdTime, status } = item;  
298 - let obj = {  
299 - id,  
300 - deviceName,  
301 - severity,  
302 - originatorType,  
303 - details,  
304 - createdTime,  
305 - status  
306 - }; 212 + openCommandDetail(item) {
307 uni.navigateTo({ 213 uni.navigateTo({
308 - url: '/deviceSubPage/deviceDetailPage/tabDetail/CommandDetail' 214 + url: '/deviceSubPage/deviceDetailPage/tabDetail/CommandDetail?data=' + JSON.stringify(item)
309 }); 215 });
310 } 216 }
311 } 217 }
@@ -301,7 +301,7 @@ export default { @@ -301,7 +301,7 @@ export default {
301 this.loadData(1, { 301 this.loadData(1, {
302 status: alarmState.type ? alarmState.type : undefined, 302 status: alarmState.type ? alarmState.type : undefined,
303 deviceType: typeState.type ? typeState.type : undefined, 303 deviceType: typeState.type ? typeState.type : undefined,
304 - alarmType: alarmLevelState.type ? alarmLevelState.type : undefined, 304 + severity: alarmLevelState.type ? alarmLevelState.type : undefined,
305 startTime: timeState.type ? startTs : undefined, 305 startTime: timeState.type ? startTs : undefined,
306 endTime: timeState.type ? endTs : undefined, 306 endTime: timeState.type ? endTs : undefined,
307 deviceId: this.deviceId 307 deviceId: this.deviceId
@@ -12,7 +12,9 @@ @@ -12,7 +12,9 @@
12 {{ deviceDetail.deviceState === 'INACTIVE' ? '待激活' : deviceDetail.deviceState === 'ONLINE' ? '在线' : '离线' }} 12 {{ deviceDetail.deviceState === 'INACTIVE' ? '待激活' : deviceDetail.deviceState === 'ONLINE' ? '在线' : '离线' }}
13 </view> 13 </view>
14 </view> 14 </view>
15 - <view style="margin-right: 20rpx;" v-if="deviceDetail.deviceState==='ONLINE'"><u-button type="primary" shape="circle" size="mini" text="下发命令" @click="showModal" /></view> 15 + <view style="margin-right: 20rpx;" v-if="deviceDetail.deviceState === 'ONLINE' && deviceDetail.deviceType !== 'SENSOR'">
  16 + <u-button type="primary" shape="circle" size="mini" text="下发命令" @click="showModal" />
  17 + </view>
16 </view> 18 </view>
17 <view class="detail"> 19 <view class="detail">
18 <view class="detail-item"> 20 <view class="detail-item">
@@ -126,7 +128,7 @@ export default { @@ -126,7 +128,7 @@ export default {
126 async confirmCommand() { 128 async confirmCommand() {
127 try { 129 try {
128 await issueCommand(this.commandType, this.deviceDetail.tbDeviceId, JSON.parse(this.commandValue)); 130 await issueCommand(this.commandType, this.deviceDetail.tbDeviceId, JSON.parse(this.commandValue));
129 - this.hiddenModal() 131 + this.hiddenModal();
130 } catch (e) { 132 } catch (e) {
131 uni.$u.toast('下发失败~'); 133 uni.$u.toast('下发失败~');
132 } 134 }
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 </view> 34 </view>
35 <mescroll-empty v-if="!historyData.length"/> 35 <mescroll-empty v-if="!historyData.length"/>
36 </view> 36 </view>
37 - <view class="historyData-bottom"> 37 + <view class="historyData-bottom" v-show="historyData.length">
38 <view class="table"> 38 <view class="table">
39 <view class="tr bg-w" v-if="historyData.length"> 39 <view class="tr bg-w" v-if="historyData.length">
40 <view class="th">变量值</view> 40 <view class="th">变量值</view>
@@ -44,7 +44,6 @@ @@ -44,7 +44,6 @@
44 <view class="td">{{ item.value }}</view> 44 <view class="td">{{ item.value }}</view>
45 <view class="td">{{ item.ts }}</view> 45 <view class="td">{{ item.ts }}</view>
46 </view> 46 </view>
47 - <mescroll-empty v-if="!historyData.length"/>  
48 </view> 47 </view>
49 </view> 48 </view>
50 <u-calendar 49 <u-calendar
@@ -134,11 +133,11 @@ export default { @@ -134,11 +133,11 @@ export default {
134 maxDate: `${year}-${month}-${date + 1}`, 133 maxDate: `${year}-${month}-${date + 1}`,
135 defaultDate: [this.yesterday, this.today], 134 defaultDate: [this.yesterday, this.today],
136 chartData: { 135 chartData: {
137 - categories: this.historyData.map(item => item.ts), 136 + categories: this.historyData.length && this.historyData.map(item => item.ts),
138 series: [ 137 series: [
139 { 138 {
140 name: this.keys[0][0], 139 name: this.keys[0][0],
141 - data: this.historyData.map(item => Number(item.value)) 140 + data: this.historyData.length && this.historyData.map(item => Number(item.value))
142 } 141 }
143 ] 142 ]
144 }, 143 },
@@ -187,7 +186,7 @@ export default { @@ -187,7 +186,7 @@ export default {
187 this.chartData.series = [ 186 this.chartData.series = [
188 { 187 {
189 name: this.keys[0][0], 188 name: this.keys[0][0],
190 - data: this.getHistoryData.map(item => Number(item.value)) 189 + data: newValue.map(item => Number(item.value))
191 } 190 }
192 ]; 191 ];
193 } 192 }
1 <template> 1 <template>
2 <view class="device-page"> 2 <view class="device-page">
3 - <!-- 公共组件-每个页面必须引入 -->  
4 - <public-module></public-module>  
5 <u-sticky> 3 <u-sticky>
6 <view class="device-top"> 4 <view class="device-top">
7 <view class="search"> 5 <view class="search">
@@ -27,7 +25,7 @@ @@ -27,7 +25,7 @@
27 </view> 25 </view>
28 </view> 26 </view>
29 </u-sticky> 27 </u-sticky>
30 - <mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback"> 28 + <mescroll-body ref="mescrollRef" @init="mescrollInit" :upOption="upOption" :down="downOption" @down="downCallback" @up="upCallback">
31 <view class="device-list"> 29 <view class="device-list">
32 <view @click="openDeviceDetail(item.id, item.alarmStatus, item.lastOnlineTime, item.tbDeviceId)" class="list-item" v-for="item in list" :key="item.id"> 30 <view @click="openDeviceDetail(item.id, item.alarmStatus, item.lastOnlineTime, item.tbDeviceId)" class="list-item" v-for="item in list" :key="item.id">
33 <view 31 <view
@@ -106,7 +104,6 @@ import fTabbar from '@/components/module/f-tabbar/f-tabbar'; @@ -106,7 +104,6 @@ import fTabbar from '@/components/module/f-tabbar/f-tabbar';
106 import fNavbar from '@/components/module/f-navbar/f-navbar'; 104 import fNavbar from '@/components/module/f-navbar/f-navbar';
107 import FilterItem from './FilterItem.vue'; 105 import FilterItem from './FilterItem.vue';
108 import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js'; 106 import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js';
109 -  
110 import { debounce } from '@/plugins/throttle.js'; 107 import { debounce } from '@/plugins/throttle.js';
111 export default { 108 export default {
112 mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件) 109 mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件)
@@ -197,7 +194,9 @@ export default { @@ -197,7 +194,9 @@ export default {
197 onLoad(e) { 194 onLoad(e) {
198 // 隐藏原生的tabbar 195 // 隐藏原生的tabbar
199 uni.hideTabBar(); 196 uni.hideTabBar();
  197 + console.log('e', e);
200 if (e.type !== undefined) { 198 if (e.type !== undefined) {
  199 + console.log(123)
201 const statusT = JSON.parse(e.type); 200 const statusT = JSON.parse(e.type);
202 this.loadData(1, { 201 this.loadData(1, {
203 deviceState: statusT 202 deviceState: statusT