Showing
4 changed files
with
45 additions
and
33 deletions
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
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">{{ commandDetail.deviceType }}</view> | 7 | + <view class="detail-value">{{ 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"> |
@@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
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">{{ commandDetail.createTime }}</view> | 22 | + <view class="detail-value">{{ format(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" v-if="commandDetail.additionalInfo.cmdType"> | 25 | <view class="detail-item" v-if="commandDetail.additionalInfo.cmdType"> |
@@ -29,31 +29,51 @@ | @@ -29,31 +29,51 @@ | ||
29 | <u-line length="90%" margin="0 auto" v-if="commandDetail.additionalInfo.cmdType"></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"></view> | 32 | + <view class="detail-value">{{commandDetail.request.oneway?'oneway':'towway'}}</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"> |
36 | <view class="detail-label">下发结果</view> | 36 | <view class="detail-label">下发结果</view> |
37 | - <view class="detail-value">成功</view> | 37 | + <view class="detail-value">{{commandDetail.status==='SUCCESSFUL'?'成功':'失败'}}</view> |
38 | </view> | 38 | </view> |
39 | <u-line length="90%" margin="0 auto"></u-line> | 39 | <u-line length="90%" margin="0 auto"></u-line> |
40 | <view class="detail-item"> | 40 | <view class="detail-item"> |
41 | <view class="detail-label">响应结果</view> | 41 | <view class="detail-label">响应结果</view> |
42 | - <view class="detail-value">成功</view> | 42 | + <view class="detail-value">{{commandDetail.response?'成功':'失败'}}</view> |
43 | </view> | 43 | </view> |
44 | </view> | 44 | </view> |
45 | <view class="command">命令内容</view> | 45 | <view class="command">命令内容</view> |
46 | - <u-textarea></u-textarea> | 46 | + <u-textarea :value="formatValue(commandDetail.request.body)" disabled></u-textarea> |
47 | </view> | 47 | </view> |
48 | </template> | 48 | </template> |
49 | 49 | ||
50 | <script> | 50 | <script> |
51 | +import { formatToDate } from '@/plugins/utils.js'; | ||
51 | export default { | 52 | export default { |
52 | data() { | 53 | data() { |
53 | return { | 54 | return { |
54 | commandDetail: {} | 55 | commandDetail: {} |
55 | }; | 56 | }; |
56 | }, | 57 | }, |
58 | + computed: { | ||
59 | + deviceType() { | ||
60 | + return this.commandDetail.deviceType === 'DIRECT_CONNECTION' | ||
61 | + ? '直连设备' | ||
62 | + : this.commandDetail.deviceType === 'GATEWAY' | ||
63 | + ? '网关设备' | ||
64 | + : this.commandDetail.deviceType === 'SENSOR' | ||
65 | + ? '网关子设备' | ||
66 | + : ''; | ||
67 | + } | ||
68 | + }, | ||
69 | + methods: { | ||
70 | + format(date) { | ||
71 | + return formatToDate(date, 'YYYY-MM-DD HH:mm:ss'); | ||
72 | + }, | ||
73 | + formatValue(value){ | ||
74 | + return JSON.stringify(value) | ||
75 | + } | ||
76 | + }, | ||
57 | onLoad(options) { | 77 | onLoad(options) { |
58 | const { data } = options; | 78 | const { data } = options; |
59 | this.commandDetail = JSON.parse(data); | 79 | this.commandDetail = JSON.parse(data); |
@@ -16,7 +16,8 @@ | @@ -16,7 +16,8 @@ | ||
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 item-success" v-if="item.response">响应成功</view> |
20 | + <view class="item-right item-fail" v-else>响应失败</view> | ||
20 | </view> | 21 | </view> |
21 | <view v-if="item.additionalInfo.cmdType"> | 22 | <view v-if="item.additionalInfo.cmdType"> |
22 | 命令类型: | 23 | 命令类型: |
@@ -35,7 +36,6 @@ | @@ -35,7 +36,6 @@ | ||
35 | <view class="filter"> | 36 | <view class="filter"> |
36 | <view class="filter-title"><text>筛选条件</text></view> | 37 | <view class="filter-title"><text>筛选条件</text></view> |
37 | <FilterItem :filterList="issueStatus" title="下发状态" @clickTag="currentIndex => handleClickTag(currentIndex, issueStatus)"></FilterItem> | 38 | <FilterItem :filterList="issueStatus" title="下发状态" @clickTag="currentIndex => handleClickTag(currentIndex, issueStatus)"></FilterItem> |
38 | - <FilterItem :filterList="responseWay" title="响应方式" @clickTag="currentIndex => handleClickTag(currentIndex, responseWay)"></FilterItem> | ||
39 | <view class="button-group"> | 39 | <view class="button-group"> |
40 | <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> |
41 | <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> |
@@ -96,23 +96,6 @@ export default { | @@ -96,23 +96,6 @@ export default { | ||
96 | type: 'fail' | 96 | type: 'fail' |
97 | } | 97 | } |
98 | ], | 98 | ], |
99 | - responseWay: [ | ||
100 | - { | ||
101 | - checked: true, | ||
102 | - name: '全部', | ||
103 | - type: '' | ||
104 | - }, | ||
105 | - { | ||
106 | - checked: false, | ||
107 | - name: 'OneWay', | ||
108 | - type: 'OneWay' | ||
109 | - }, | ||
110 | - { | ||
111 | - checked: false, | ||
112 | - name: 'TowWay', | ||
113 | - type: 'TowWay' | ||
114 | - } | ||
115 | - ], | ||
116 | downOption: { | 99 | downOption: { |
117 | auto: false //是否在初始化后,自动执行downCallback; 默认true | 100 | auto: false //是否在初始化后,自动执行downCallback; 默认true |
118 | }, | 101 | }, |
@@ -180,8 +163,8 @@ export default { | @@ -180,8 +163,8 @@ export default { | ||
180 | }); | 163 | }); |
181 | }, | 164 | }, |
182 | resetFilter() { | 165 | resetFilter() { |
183 | - const { issueStatus, responseWay } = this; | ||
184 | - [issueStatus, responseWay].forEach(item => item.map((item, index) => (item.checked = index === 0))); | 166 | + const { issueStatus } = this; |
167 | + issueStatus.forEach(item => item.map((item, index) => (item.checked = index === 0))); | ||
185 | }, | 168 | }, |
186 | close() { | 169 | close() { |
187 | this.show = false; | 170 | this.show = false; |
@@ -198,10 +181,8 @@ export default { | @@ -198,10 +181,8 @@ export default { | ||
198 | }, | 181 | }, |
199 | confirmFilter() { | 182 | confirmFilter() { |
200 | const issueStatus = this.issueStatus.find(item => item.checked); | 183 | const issueStatus = this.issueStatus.find(item => item.checked); |
201 | - const responseWay = this.responseWay.find(item => item.checked); | ||
202 | this.loadData(1, { | 184 | this.loadData(1, { |
203 | status: issueStatus.type ? issueStatus.type : undefined, | 185 | status: issueStatus.type ? issueStatus.type : undefined, |
204 | - responseWay: responseWay.type ? responseWay.type : undefined, | ||
205 | deviceId: this.deviceId | 186 | deviceId: this.deviceId |
206 | }); | 187 | }); |
207 | this.show = false; | 188 | this.show = false; |
@@ -273,13 +254,19 @@ export default { | @@ -273,13 +254,19 @@ export default { | ||
273 | display: flex; | 254 | display: flex; |
274 | justify-content: center; | 255 | justify-content: center; |
275 | align-items: center; | 256 | align-items: center; |
276 | - color: #00c9a7; | ||
277 | width: 104rpx; | 257 | width: 104rpx; |
278 | height: 36rpx; | 258 | height: 36rpx; |
279 | font-size: 20rpx; | 259 | font-size: 20rpx; |
280 | - background-color: #00c9a725; | ||
281 | border-radius: 20rpx; | 260 | border-radius: 20rpx; |
282 | } | 261 | } |
262 | + .item-fail { | ||
263 | + color: #848383; | ||
264 | + background-color: #84838325; | ||
265 | + } | ||
266 | + .item.success { | ||
267 | + color: #00c9a7; | ||
268 | + background-color: #00c9a725; | ||
269 | + } | ||
283 | } | 270 | } |
284 | } | 271 | } |
285 | } | 272 | } |
@@ -127,7 +127,12 @@ export default { | @@ -127,7 +127,12 @@ export default { | ||
127 | }, | 127 | }, |
128 | async confirmCommand() { | 128 | async confirmCommand() { |
129 | try { | 129 | try { |
130 | - await issueCommand(this.commandType, this.deviceDetail.tbDeviceId, JSON.parse(this.commandValue)); | 130 | + const commandValue = JSON.parse(this.commandValue); |
131 | + commandValue.persistent = true; | ||
132 | + commandValue.additionalInfo = { | ||
133 | + cmdType: 'API' | ||
134 | + }; | ||
135 | + await issueCommand(this.commandType, this.deviceDetail.tbDeviceId,commandValue); | ||
131 | this.hiddenModal(); | 136 | this.hiddenModal(); |
132 | } catch (e) { | 137 | } catch (e) { |
133 | uni.$u.toast('下发失败~'); | 138 | uni.$u.toast('下发失败~'); |
@@ -19,7 +19,7 @@ const GlobalOption = { | @@ -19,7 +19,7 @@ const GlobalOption = { | ||
19 | }, | 19 | }, |
20 | empty: { | 20 | empty: { |
21 | use: true, // 是否显示空布局 | 21 | use: true, // 是否显示空布局 |
22 | - icon: "../../../../../static/empty-data.png" // 图标路径 (建议放入static目录, 如 /static/img/mescroll-empty.png ) | 22 | + icon: "../../../../../static/empty.png" // 图标路径 (建议放入static目录, 如 /static/img/mescroll-empty.png ) |
23 | } | 23 | } |
24 | }, | 24 | }, |
25 | // 国际化配置 | 25 | // 国际化配置 |