Commit 656c27da48ccf5ffc5397afa2835c52f9d4918d0

Authored by fengtao
2 parents f463e7fe 59da99ee

Merge branch 'main' into dev-ft

@@ -87,7 +87,7 @@ export default { @@ -87,7 +87,7 @@ export default {
87 { 87 {
88 name: '首页', 88 name: '首页',
89 url: 'pages/index/index', 89 url: 'pages/index/index',
90 - icon: '../../../static/homw-un.png', 90 + icon: '../../../static/home-un.png',
91 iconFill: '../../../static/home-yes.png' 91 iconFill: '../../../static/home-yes.png'
92 }, 92 },
93 { 93 {
@@ -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('下发失败~');
@@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
25 </view> 25 </view>
26 </view> 26 </view>
27 </u-sticky> 27 </u-sticky>
28 - <mescroll-body ref="mescrollRef" @init="mescrollInit" :upOption="upOption" :down="downOption" @down="downCallback" @up="upCallback"> 28 + <mescroll-body ref="mescrollRef" @init="mescrollInit" :up="upOption" :down="downOption" @down="downCallback" @up="upCallback">
29 <view class="device-list"> 29 <view class="device-list">
30 <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">
31 <view 31 <view
@@ -101,7 +101,6 @@ @@ -101,7 +101,6 @@
101 101
102 <script> 102 <script>
103 import fTabbar from '@/components/module/f-tabbar/f-tabbar'; 103 import fTabbar from '@/components/module/f-tabbar/f-tabbar';
104 -import fNavbar from '@/components/module/f-navbar/f-navbar';  
105 import FilterItem from './FilterItem.vue'; 104 import FilterItem from './FilterItem.vue';
106 import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js'; 105 import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js';
107 import { debounce } from '@/plugins/throttle.js'; 106 import { debounce } from '@/plugins/throttle.js';
@@ -109,7 +108,6 @@ export default { @@ -109,7 +108,6 @@ export default {
109 mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件) 108 mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件)
110 components: { 109 components: {
111 fTabbar, 110 fTabbar,
112 - fNavbar,  
113 FilterItem 111 FilterItem
114 }, 112 },
115 data() { 113 data() {
@@ -188,19 +186,27 @@ export default { @@ -188,19 +186,27 @@ export default {
188 page: { 186 page: {
189 num: 0, 187 num: 0,
190 size: 10 188 size: 10
191 - } 189 + },
  190 + deviceState: ''
192 }; 191 };
193 }, 192 },
194 - onLoad(e) { 193 + async onLoad(options) {
195 // 隐藏原生的tabbar 194 // 隐藏原生的tabbar
196 uni.hideTabBar(); 195 uni.hideTabBar();
197 - console.log('e', e);  
198 - if (e.type !== undefined) {  
199 - console.log(123)  
200 - const statusT = JSON.parse(e.type);  
201 - this.loadData(1, {  
202 - deviceState: statusT 196 + const { deviceState } = options;
  197 + this.deviceState = deviceState;
  198 + if (deviceState) {
  199 + this.deviceStatus.forEach(item => {
  200 + item.type === deviceState ? (item.checked = true) : (item.checked = false);
203 }); 201 });
  202 + await this.loadData(1, {
  203 + deviceState
  204 + });
  205 + } else {
  206 + await this.loadData(1);
  207 + }
  208 + if (!this.list.length) {
  209 + this.mescroll.showEmpty();
204 } 210 }
205 }, 211 },
206 onShow() { 212 onShow() {
@@ -217,6 +223,7 @@ export default { @@ -217,6 +223,7 @@ export default {
217 this.list = []; 223 this.list = [];
218 this.page.num = 1; 224 this.page.num = 1;
219 //联网加载数据 225 //联网加载数据
  226 + this.resetFilter();
220 this.loadData(this.page.num); 227 this.loadData(this.page.num);
221 }, 228 },
222 229
@@ -224,39 +231,41 @@ export default { @@ -224,39 +231,41 @@ export default {
224 upCallback() { 231 upCallback() {
225 //联网加载数据 232 //联网加载数据
226 this.page.num += 1; 233 this.page.num += 1;
227 - this.loadData(this.page.num); 234 + const deviceState = this.deviceStatus.find(item => item.checked);
  235 + const alarmStatus = this.alarmStatus.find(item => item.checked);
  236 + const deviceType = this.typeStatus.find(item => item.checked);
  237 + this.loadData(this.page.num, {
  238 + deviceState: deviceState.type ? deviceState.type : undefined,
  239 + deviceType: deviceType.type ? deviceType.type : undefined,
  240 + alarmStatus: alarmStatus.type === '0' || alarmStatus.type === '1' ? alarmStatus.type : undefined
  241 + });
228 }, 242 },
229 243
230 //获取设备 244 //获取设备
231 - loadData(pageNo, params = {}) {  
232 - let httpData = {  
233 - page: pageNo,  
234 - pageSize: 10,  
235 - ...params  
236 - };  
237 - uni.$u.http  
238 - .get('/yt/device', { 245 + async loadData(pageNo, params = {}) {
  246 + try {
  247 + let httpData = {
  248 + page: pageNo,
  249 + pageSize: 10,
  250 + ...params
  251 + };
  252 + const { total, items } = await uni.$u.http.get('/yt/device', {
239 params: httpData, 253 params: httpData,
240 custom: { 254 custom: {
241 load: false 255 load: false
242 } 256 }
243 - })  
244 - .then(res => {  
245 - this.total = res.total;  
246 - uni.stopPullDownRefresh();  
247 - console.log('获取后端数据', res);  
248 - //方法一(推荐): 后台接口有返回列表的总页数 totalPage  
249 - this.mescroll.endByPage(res.items.length, res.total); //必传参数(当前页的数据个数, 总页数)  
250 - if (pageNo == 1) {  
251 - this.list = res.items;  
252 - } else {  
253 - this.list = this.list.concat(res.items);  
254 - }  
255 - })  
256 - .catch(() => {  
257 - //联网失败, 结束加载  
258 - this.mescroll.endErr();  
259 }); 257 });
  258 + this.total = total;
  259 + uni.stopPullDownRefresh();
  260 + this.mescroll.endByPage(items.length, total); //必传参数(当前页的数据个数, 总页数)
  261 + if (pageNo == 1) {
  262 + this.list = items;
  263 + } else {
  264 + this.list = this.list.concat(items);
  265 + }
  266 + } catch {
  267 + this.mescroll.endErr();
  268 + }
260 }, 269 },
261 openOrg() { 270 openOrg() {
262 uni.navigateTo({ 271 uni.navigateTo({
@@ -264,7 +273,6 @@ export default { @@ -264,7 +273,6 @@ export default {
264 }); 273 });
265 }, 274 },
266 close() { 275 close() {
267 - this.resetFilter();  
268 this.show = false; 276 this.show = false;
269 }, 277 },
270 openSearchDialog() { 278 openSearchDialog() {
@@ -371,4 +379,4 @@ export default { @@ -371,4 +379,4 @@ export default {
371 } 379 }
372 } 380 }
373 } 381 }
374 -</style> 382 +</style>
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 <text class="device-text">设备数:{{ deviceTotal }}</text> 10 <text class="device-text">设备数:{{ deviceTotal }}</text>
11 </view> 11 </view>
12 </view> 12 </view>
13 - <view class="org-item"><image class="image" src="../../../static/right-arrow.png"></image></view> 13 + <view class="org-item"><image class="image" src="../../../static/arrow-right.png"></image></view>
14 </view> 14 </view>
15 <view style="height: 150rpx;"></view> 15 <view style="height: 150rpx;"></view>
16 <!-- 自带分页组件 --> 16 <!-- 自带分页组件 -->
@@ -157,7 +157,7 @@ export default { @@ -157,7 +157,7 @@ export default {
157 //设备状态查询 157 //设备状态查询
158 navigatorDeviceStatus(e) { 158 navigatorDeviceStatus(e) {
159 uni.reLaunch({ 159 uni.reLaunch({
160 - url: '../device/device?type=' + JSON.stringify(e) 160 + url: `../device/device?deviceState=${e}`
161 }); 161 });
162 } 162 }
163 } 163 }
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 <view class="u-flex u-p-l-30 u-p-r-20 u-p-t-75 u-p-b-30"> 8 <view class="u-flex u-p-l-30 u-p-r-20 u-p-t-75 u-p-b-30">
9 <block v-if="userInfo.isToken || userInfo.isThirdLogin"> 9 <block v-if="userInfo.isToken || userInfo.isThirdLogin">
10 <view @click="openPersonalInfo" class="u-m-r-20"> 10 <view @click="openPersonalInfo" class="u-m-r-20">
11 - <image class="avatar" mode="aspectFill" :src="userInfo.avatar == '' ? '/static/default.png' : userInfo.avatar"></image> 11 + <image class="avatar" mode="aspectFill" :src="userInfo.avatar == '' ? '/static/logo.png' : userInfo.avatar"></image>
12 </view> 12 </view>
13 <view class="u-flex-1"> 13 <view class="u-flex-1">
14 <view class="nickName u-flex"> 14 <view class="nickName u-flex">
@@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
22 </block> 22 </block>
23 <block v-else> 23 <block v-else>
24 <view class="u-m-r-20" @click="openLoginFunc"> 24 <view class="u-m-r-20" @click="openLoginFunc">
25 - <view class="avatar u-flex"><image class="avatar" mode="aspectFill" src="../../static/default.png"></image></view> 25 + <view class="avatar u-flex"><image class="avatar" mode="aspectFill" src="../../static/logo.png"></image></view>
26 </view> 26 </view>
27 <view class="u-flex-1"><view @click="openLoginFunc" class="u-font-lg click-login login-btn ">请点击登录</view></view> 27 <view class="u-flex-1"><view @click="openLoginFunc" class="u-font-lg click-login login-btn ">请点击登录</view></view>
28 </block> 28 </block>
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 <!-- 公共组件-每个页面必须引入 --> 3 <!-- 公共组件-每个页面必须引入 -->
4 <public-module></public-module> 4 <public-module></public-module>
5 <view @click="upAvatar" class="u-flex set-main"> 5 <view @click="upAvatar" class="u-flex set-main">
6 - <view class="main-image"><image class="image" :src="avatar || '/static/default.png'"></image></view> 6 + <view class="main-image"><image class="image" :src="avatar || '/static/logo.png'"></image></view>
7 <view class="main-right-image"><image class="image" src="../../static/arrow-right.png"></image></view> 7 <view class="main-right-image"><image class="image" src="../../static/arrow-right.png"></image></view>
8 </view> 8 </view>
9 <view class="u-m-t-20 basic-text"><text class="text">基本资料</text></view> 9 <view class="u-m-t-20 basic-text"><text class="text">基本资料</text></view>

107 Bytes

static/bg.png deleted 100644 → 0

39.9 KB

34.3 KB

8.23 KB

static/home-un.png renamed from static/homw-un.png

1.4 KB

1017 Bytes

8.46 KB

@@ -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 // 国际化配置