Commit 6e2bc13832be7495f865dc2e970063584c944049

Authored by xp.Huang
2 parents 431b4f84 2bfbcd19

Merge branch 'local_dev_ft' into 'main'

pref:修改设备分页请求方式

See merge request yunteng/thingskit-app!99
1 -//获取设备分页API  
2 -const getDeviceApi = (params = {}) => {  
3 - return uni.$u.http.get('/yt/device', params); 1 +//获取设备分页API 修改为post
  2 +/**
  3 + * params ((page,pageSize))
  4 + * data ((deviceProfileIds))
  5 + */
  6 +const getDeviceApi = (urlParams, data) => {
  7 + const {
  8 + page,
  9 + pageSize,
  10 + } = urlParams
  11 + return uni.$u.http.post(`/yt/device?page=${page}&pageSize=${pageSize}`, data);
4 }; 12 };
5 13
6 export default { 14 export default {
@@ -9,10 +9,10 @@ import { @@ -9,10 +9,10 @@ import {
9 * socketPrefix websocket前缀 ((https, wss),( http, ws)) 9 * socketPrefix websocket前缀 ((https, wss),( http, ws))
10 */ 10 */
11 11
12 -const baseUrl = "http://222.180.200.114:48080/api";  
13 -const baseDrawioUrl = "http://222.180.200.114:9527/thingskit-scada";  
14 -const baseWebSocketUrl = "222.180.200.114:48080";  
15 -const socketPrefix = "ws"; 12 +const baseUrl = "https://demo.thingskit.com/api";
  13 +const baseDrawioUrl = "https://demo.thingskit.com/thingskit-scada";
  14 +const baseWebSocketUrl = "demo.thingskit.com";
  15 +const socketPrefix = "wss";
16 16
17 let systemInfo = { 17 let systemInfo = {
18 ...getTabbarHeight(), 18 ...getTabbarHeight(),
@@ -33,97 +33,125 @@ @@ -33,97 +33,125 @@
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>  
37 - <view class="detail-value">{{ commandDetail.status === 'SUCCESSFUL' ? '成功' : '失败' }}</view> 36 + <view class="detail-label">命令状态</view>
  37 + <view class="detail-value">{{ commandDetail.statusName }}</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" v-if="!commandDetail.request.oneway">
41 <view class="detail-label">响应结果</view> 41 <view class="detail-label">响应结果</view>
42 - <view class="detail-value">{{ commandDetail.response ? '成功' : '失败' }}</view> 42 + <view class="detail-value">{{ commandDetail.response.status==='SUCCESS' ? '成功' : '失败' }}</view>
  43 + </view>
  44 + <view class="detail-item" v-if="!commandDetail.request.oneway">
  45 + <view class="detail-label">响应失败内容</view>
  46 + <view class="detail-value" style="width: 400rpx;" v-if="commandDetail.response.status!=='SUCCESS'">
  47 + <u--textarea placeholder="响应失败内容" v-model="failContent" />
  48 + </view>
43 </view> 49 </view>
44 </view> 50 </view>
45 <view class="command">命令内容</view> 51 <view class="command">命令内容</view>
46 <u-textarea :value="formatValue(commandDetail.request.body)" disabled></u-textarea> 52 <u-textarea :value="formatValue(commandDetail.request.body)" disabled></u-textarea>
  53 + <view style="height: 50rpx;"></view>
47 </view> 54 </view>
48 </template> 55 </template>
49 56
50 <script> 57 <script>
51 -import { formatToDate } from '@/plugins/utils.js';  
52 -export default {  
53 - data() {  
54 - return {  
55 - commandDetail: {}  
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'); 58 + import {
  59 + formatToDate
  60 + } from '@/plugins/utils.js';
  61 + export default {
  62 + data() {
  63 + return {
  64 + commandDetail: {},
  65 + failContent: ""
  66 + };
72 }, 67 },
73 - formatValue(value) {  
74 - const val = JSON.stringify(value);  
75 - return val  
76 - .replace(/\\"/g, '"')  
77 - .replace(/]"/g, ']')  
78 - .replace(/"\[/g, '['); 68 + computed: {
  69 + deviceType() {
  70 + return this.commandDetail.deviceType === 'DIRECT_CONNECTION' ?
  71 + '直连设备' :
  72 + this.commandDetail.deviceType === 'GATEWAY' ?
  73 + '网关设备' :
  74 + this.commandDetail.deviceType === 'SENSOR' ?
  75 + '网关子设备' :
  76 + '';
  77 + }
  78 + },
  79 + methods: {
  80 + format(date) {
  81 + return formatToDate(date, 'YYYY-MM-DD HH:mm:ss');
  82 + },
  83 + formatValue(value) {
  84 + try {
  85 + const val = JSON.parse(value['params']);
  86 + //微信小程序端object无法显示,格式化为字符串
  87 + const stringifyVal = JSON.stringify(val['params'])
  88 + const formatVal = stringifyVal
  89 + .replace(/\\"/g, '"')
  90 + .replace(/]"/g, ']')
  91 + .replace(/"\[/g, '[');
  92 + return formatVal
  93 + } catch (e) {
  94 + console.error("命令记录页面格式化无返回值", e);
  95 + return value['params']
  96 + }
  97 + }
  98 + },
  99 + onLoad(options) {
  100 + const {
  101 + data
  102 + } = options;
  103 + this.commandDetail = JSON.parse(data);
  104 + if (this.commandDetail.response.status === 'SUCCESS') return
  105 + this.failContent = JSON.stringify(this.commandDetail.response.error)
79 } 106 }
80 - },  
81 - onLoad(options) {  
82 - const { data } = options;  
83 - this.commandDetail = JSON.parse(data);  
84 - }  
85 -}; 107 + };
86 </script> 108 </script>
87 109
88 <style lang="scss" scoped> 110 <style lang="scss" scoped>
89 -.command-detail {  
90 - padding: 0 30rpx;  
91 - height: 100vh;  
92 - background-color: #f8f9fa;  
93 - .detail-top {  
94 - height: 118rpx;  
95 - width: 690rpx;  
96 - display: flex;  
97 - align-items: center;  
98 - background-color: #fff;  
99 - color: #333;  
100 - border-radius: 20rpx;  
101 - font-size: 15px;  
102 - margin-top: 30rpx;  
103 - padding: 30rpx;  
104 - }  
105 - .detail {  
106 - background-color: #fff;  
107 - margin-top: 30rpx;  
108 - border-radius: 20rpx;  
109 - width: 690rpx;  
110 - .detail-item {  
111 - padding: 30rpx; 111 + .command-detail {
  112 + padding: 0 30rpx;
  113 + height: 100vh;
  114 + background-color: #f8f9fa;
  115 +
  116 + .detail-top {
  117 + height: 118rpx;
  118 + width: 690rpx;
112 display: flex; 119 display: flex;
113 align-items: center; 120 align-items: center;
114 - .detail-label {  
115 - color: #333;  
116 - font-size: 15px;  
117 - }  
118 - .detail-value {  
119 - color: #666;  
120 - font-size: 14px;  
121 - margin-left: 30rpx; 121 + background-color: #fff;
  122 + color: #333;
  123 + border-radius: 20rpx;
  124 + font-size: 15px;
  125 + margin-top: 30rpx;
  126 + padding: 30rpx;
  127 + }
  128 +
  129 + .detail {
  130 + background-color: #fff;
  131 + margin-top: 30rpx;
  132 + border-radius: 20rpx;
  133 + width: 690rpx;
  134 +
  135 + .detail-item {
  136 + padding: 30rpx;
  137 + display: flex;
  138 + align-items: center;
  139 +
  140 + .detail-label {
  141 + color: #333;
  142 + font-size: 15px;
  143 + }
  144 +
  145 + .detail-value {
  146 + color: #666;
  147 + font-size: 14px;
  148 + margin-left: 30rpx;
  149 + }
122 } 150 }
123 } 151 }
  152 +
  153 + .command {
  154 + margin: 30rpx 0;
  155 + }
124 } 156 }
125 - .command {  
126 - margin: 30rpx 0;  
127 - }  
128 -}  
129 </style> 157 </style>
1 <template> 1 <template>
  2 + <!-- 单向没有响应失败状态 -->
  3 + <!-- 响应类型 -->
2 <view class="command-record"> 4 <view class="command-record">
3 <view class="filter-button" @click="openSearchDialog"> 5 <view class="filter-button" @click="openSearchDialog">
4 <text>筛选</text> 6 <text>筛选</text>
5 <image src="../../../static/shaixuan.png" /> 7 <image src="../../../static/shaixuan.png" />
6 </view> 8 </view>
7 9
8 - <mescroll-uni ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback" height="700px"> 10 + <mescroll-uni ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback"
  11 + height="700px">
9 <view @click="openCommandDetail(item)" class="list-item" v-for="(item, index) in list" :key="index"> 12 <view @click="openCommandDetail(item)" class="list-item" v-for="(item, index) in list" :key="index">
10 <view class="item"> 13 <view class="item">
11 <view class="item-first"> 14 <view class="item-first">
12 <text>{{ item.deviceName }}</text> 15 <text>{{ item.deviceName }}</text>
13 - <view class="item-right item-success" v-if="item.response">响应成功</view>  
14 - <view class="item-right item-fail" v-else>响应失败</view> 16 + <view v-if="!item.request.oneway">
  17 + <view class="item-right item-success" v-if="item.response.status==='SUCCESS'">响应成功</view>
  18 + <view class="item-right item-fail" v-else>响应失败</view>
  19 + </view>
15 </view> 20 </view>
16 <view v-if="item.additionalInfo.cmdType"> 21 <view v-if="item.additionalInfo.cmdType">
17 命令类型: 22 命令类型:
@@ -19,8 +24,7 @@ @@ -19,8 +24,7 @@
19 </view> 24 </view>
20 <view v-if="item.statusName"> 25 <view v-if="item.statusName">
21 命令状态: 26 命令状态:
22 - <text  
23 - :style="{ 27 + <text :style="{
24 color: 28 color:
25 item.status == 'EXPIRED' 29 item.status == 'EXPIRED'
26 ? 'red' 30 ? 'red'
@@ -33,271 +37,292 @@ @@ -33,271 +37,292 @@
33 : item.status == 'SENT' 37 : item.status == 'SENT'
34 ? '#00C9A7' 38 ? '#00C9A7'
35 : '' 39 : ''
36 - }"  
37 - style="margin-left: 16rpx;"  
38 - > 40 + }" style="margin-left: 16rpx;">
39 {{ item.statusName }} 41 {{ item.statusName }}
40 </text> 42 </text>
41 </view> 43 </view>
42 - <view class="time">{{ format(item.createTime) }}</view> 44 + <view class="item-first">
  45 + <view v-if="item.additionalInfo.cmdType">
  46 + 响应类型:
  47 + <text style="margin-left: 16rpx;">{{ !item.request.oneway?'双向':'单向' }}</text>
  48 + </view>
  49 + <view class="time">{{ format(item.createTime) }}</view>
  50 + </view>
43 </view> 51 </view>
44 </view> 52 </view>
45 </mescroll-uni> 53 </mescroll-uni>
46 <!-- 告警筛选 --> 54 <!-- 告警筛选 -->
47 - <u-popup @close="close" closeable bgColor="#fff" :show="show" mode="bottom" :round="20" @touchmove.stop.prevent="disabledScroll"> 55 + <u-popup @close="close" closeable bgColor="#fff" :show="show" mode="bottom" :round="20"
  56 + @touchmove.stop.prevent="disabledScroll">
48 <view class="filter" @touchmove.stop.prevent="disabledScroll"> 57 <view class="filter" @touchmove.stop.prevent="disabledScroll">
49 <view class="filter-title"><text>筛选条件</text></view> 58 <view class="filter-title"><text>筛选条件</text></view>
50 - <FilterItem :filterList="issueStatus" title="下发状态" @clickTag="currentIndex => handleClickTag(currentIndex, issueStatus)"></FilterItem> 59 + <FilterItem :filterList="issueStatus" title="下发状态"
  60 + @clickTag="currentIndex => handleClickTag(currentIndex, issueStatus)"></FilterItem>
51 <view class="button-group"> 61 <view class="button-group">
52 - <view><u-button :customStyle="{ color: '#333' }" color="#e3e3e5" shape="circle" text="重置" @click="resetFilter"></u-button></view>  
53 - <view><u-button color="#3388ff" shape="circle" text="确认" @click="confirmFilter"></u-button></view> 62 + <view>
  63 + <u-button :customStyle="{ color: '#333' }" color="#e3e3e5" shape="circle" text="重置"
  64 + @click="resetFilter"></u-button>
  65 + </view>
  66 + <view>
  67 + <u-button color="#3388ff" shape="circle" text="确认" @click="confirmFilter"></u-button>
  68 + </view>
54 </view> 69 </view>
55 </view> 70 </view>
56 </u-popup> 71 </u-popup>
57 - <u-calendar  
58 - :show="showCalendar"  
59 - mode="range"  
60 - @confirm="calendarConfirm"  
61 - @close="calendarClose"  
62 - startText="开始时间"  
63 - endText="结束时间"  
64 - confirmDisabledText="请选择日期"  
65 - :formatter="formatter"  
66 - ></u-calendar> 72 + <u-calendar :show="showCalendar" mode="range" @confirm="calendarConfirm" @close="calendarClose" startText="开始时间"
  73 + endText="结束时间" confirmDisabledText="请选择日期" :formatter="formatter"></u-calendar>
67 </view> 74 </view>
68 </template> 75 </template>
69 <script> 76 <script>
70 -import FilterItem from '@/pages/device/FilterItem.vue';  
71 -import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js';  
72 -import { formatToDate } from '@/plugins/utils.js';  
73 -import { debounce } from '@/plugins/throttle.js';  
74 -export default {  
75 - mixins: [MescrollMixin],  
76 - components: {  
77 - FilterItem  
78 - },  
79 - props: {  
80 - tbDeviceId: {  
81 - type: String,  
82 - default: ''  
83 - }  
84 - },  
85 - data() {  
86 - return {  
87 - show: false,  
88 - list: [],  
89 - total: '',  
90 - timeData: {  
91 - selectTime: '',  
92 - getTimeGap: ''  
93 - },  
94 - showCalendar: false,  
95 - issueStatus: [  
96 - {  
97 - checked: true,  
98 - name: '全部',  
99 - type: '' 77 + import FilterItem from '@/pages/device/FilterItem.vue';
  78 + import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js';
  79 + import {
  80 + formatToDate
  81 + } from '@/plugins/utils.js';
  82 + import {
  83 + debounce
  84 + } from '@/plugins/throttle.js';
  85 + export default {
  86 + mixins: [MescrollMixin],
  87 + components: {
  88 + FilterItem
  89 + },
  90 + props: {
  91 + tbDeviceId: {
  92 + type: String,
  93 + default: ''
  94 + }
  95 + },
  96 + data() {
  97 + return {
  98 + show: false,
  99 + list: [],
  100 + total: '',
  101 + timeData: {
  102 + selectTime: '',
  103 + getTimeGap: ''
100 }, 104 },
101 - {  
102 - checked: false,  
103 - name: '成功',  
104 - type: 'SUCCESSFUL' 105 + showCalendar: false,
  106 + issueStatus: [{
  107 + checked: true,
  108 + name: '全部',
  109 + type: ''
  110 + },
  111 + {
  112 + checked: false,
  113 + name: '成功',
  114 + type: 'SUCCESSFUL'
  115 + },
  116 + {
  117 + checked: false,
  118 + name: '失败',
  119 + type: 'FAILED'
  120 + }
  121 + ],
  122 + downOption: {
  123 + auto: false //是否在初始化后,自动执行downCallback; 默认true
105 }, 124 },
106 - {  
107 - checked: false,  
108 - name: '失败',  
109 - type: 'FAILED' 125 + page: {
  126 + num: 0,
  127 + size: 10
110 } 128 }
111 - ],  
112 - downOption: {  
113 - auto: false //是否在初始化后,自动执行downCallback; 默认true  
114 - },  
115 - page: {  
116 - num: 0,  
117 - size: 10  
118 - }  
119 - };  
120 - },  
121 - methods: {  
122 - /*下拉刷新的回调 */  
123 - downCallback() {  
124 - //联网加载数据  
125 - this.list = [];  
126 - this.page.num = 1;  
127 - this.loadData(this.page.num, {  
128 - tbDeviceId: this.tbDeviceId  
129 - });  
130 - },  
131 - format(date) {  
132 - return formatToDate(date, 'YYYY-MM-DD HH:mm:ss');  
133 - },  
134 - disabledScroll() {  
135 - return;  
136 - },  
137 - /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */  
138 - upCallback() {  
139 - //联网加载数据  
140 - this.page.num += 1;  
141 - this.loadData(this.page.num, {  
142 - tbDeviceId: this.tbDeviceId  
143 - });  
144 - },  
145 - //获取告警数据  
146 - loadData(pageNo, params = {}) {  
147 - let httpData = {  
148 - ...params,  
149 - page: pageNo,  
150 - pageSize: 10  
151 }; 129 };
152 - uni.$u.http  
153 - .get('/yt/rpc', {  
154 - params: httpData,  
155 - custom: {  
156 - load: false  
157 - }  
158 - })  
159 - .then(res => {  
160 - this.total = res.total;  
161 - uni.stopPullDownRefresh();  
162 - //方法一(推荐): 后台接口有返回列表的总页数 totalPage  
163 - this.mescroll.endByPage(res.items.length, res.total); //必传参数(当前页的数据个数, 总页数)  
164 - if (pageNo == 1) {  
165 - this.list = res.items;  
166 - } else {  
167 - this.list = this.list.concat(res.items);  
168 - }  
169 - })  
170 - .catch(() => {  
171 - //联网失败, 结束加载  
172 - this.mescroll.endErr();  
173 - });  
174 - },  
175 - handleClickTag(currentIndex, list) {  
176 - list.map((item, index) => {  
177 - item.checked = index === currentIndex;  
178 - });  
179 - },  
180 - resetFilter() {  
181 - const { issueStatus } = this;  
182 - issueStatus.forEach(item => item.map((item, index) => (item.checked = index === 0)));  
183 }, 130 },
184 - close() {  
185 - this.show = false;  
186 - },  
187 - openSearchDialog() {  
188 - this.show = true;  
189 - },  
190 - hideKeyboard() {  
191 - uni.hideKeyboard();  
192 - },  
193 - calendarConfirm(e) {  
194 - this.showCalendar = false;  
195 - this.timeData.selectTime = `${e[0]} / ${e[e.length - 1]}`;  
196 - },  
197 - confirmFilter() {  
198 - const issueStatus = this.issueStatus.find(item => item.checked);  
199 - this.loadData(1, {  
200 - status: issueStatus.type ? issueStatus.type : undefined,  
201 - tbDeviceId: this.tbDeviceId  
202 - });  
203 - this.show = false;  
204 - },  
205 - calendarClose() {  
206 - this.showCalendar = false;  
207 - },  
208 - openCommandDetail(item) {  
209 - uni.navigateTo({  
210 - url: '/deviceSubPage/deviceDetailPage/tabDetail/CommandDetail?data=' + JSON.stringify(item)  
211 - }); 131 + methods: {
  132 + /*下拉刷新的回调 */
  133 + downCallback() {
  134 + //联网加载数据
  135 + this.list = [];
  136 + this.page.num = 1;
  137 + this.loadData(this.page.num, {
  138 + tbDeviceId: this.tbDeviceId
  139 + });
  140 + },
  141 + format(date) {
  142 + return formatToDate(date, 'YYYY-MM-DD HH:mm:ss');
  143 + },
  144 + disabledScroll() {
  145 + return;
  146 + },
  147 + /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  148 + upCallback() {
  149 + //联网加载数据
  150 + this.page.num += 1;
  151 + this.loadData(this.page.num, {
  152 + tbDeviceId: this.tbDeviceId
  153 + });
  154 + },
  155 + //获取告警数据
  156 + loadData(pageNo, params = {}) {
  157 + let httpData = {
  158 + ...params,
  159 + page: pageNo,
  160 + pageSize: 10
  161 + };
  162 + uni.$u.http
  163 + .get('/yt/rpc', {
  164 + params: httpData,
  165 + custom: {
  166 + load: false
  167 + }
  168 + })
  169 + .then(res => {
  170 + this.total = res.total;
  171 + uni.stopPullDownRefresh();
  172 + //方法一(推荐): 后台接口有返回列表的总页数 totalPage
  173 + this.mescroll.endByPage(res.items.length, res.total); //必传参数(当前页的数据个数, 总页数)
  174 + if (pageNo == 1) {
  175 + this.list = res.items;
  176 + } else {
  177 + this.list = this.list.concat(res.items);
  178 + }
  179 + })
  180 + .catch(() => {
  181 + //联网失败, 结束加载
  182 + this.mescroll.endErr();
  183 + });
  184 + },
  185 + handleClickTag(currentIndex, list) {
  186 + list.map((item, index) => {
  187 + item.checked = index === currentIndex;
  188 + });
  189 + },
  190 + resetFilter() {
  191 + const {
  192 + issueStatus
  193 + } = this;
  194 + issueStatus.forEach(item => item.map((item, index) => (item.checked = index === 0)));
  195 + },
  196 + close() {
  197 + this.show = false;
  198 + },
  199 + openSearchDialog() {
  200 + this.show = true;
  201 + },
  202 + hideKeyboard() {
  203 + uni.hideKeyboard();
  204 + },
  205 + calendarConfirm(e) {
  206 + this.showCalendar = false;
  207 + this.timeData.selectTime = `${e[0]} / ${e[e.length - 1]}`;
  208 + },
  209 + confirmFilter() {
  210 + const issueStatus = this.issueStatus.find(item => item.checked);
  211 + this.loadData(1, {
  212 + status: issueStatus.type ? issueStatus.type : undefined,
  213 + tbDeviceId: this.tbDeviceId
  214 + });
  215 + this.show = false;
  216 + },
  217 + calendarClose() {
  218 + this.showCalendar = false;
  219 + },
  220 + openCommandDetail(item) {
  221 + uni.navigateTo({
  222 + url: '/deviceSubPage/deviceDetailPage/tabDetail/CommandDetail?data=' + JSON.stringify(item)
  223 + });
  224 + }
212 } 225 }
213 - }  
214 -}; 226 + };
215 </script> 227 </script>
216 228
217 <style lang="scss" scoped> 229 <style lang="scss" scoped>
218 -.command-record {  
219 - padding: 0 30rpx;  
220 - background: #f8f9fa;  
221 - .filter-button {  
222 - font-size: 12px;  
223 - width: 160rpx;  
224 - height: 64rpx;  
225 - border-radius: 32rpx;  
226 - display: flex;  
227 - justify-content: center;  
228 - align-items: center;  
229 - background: #f0f1f2;  
230 - color: #666;  
231 - image {  
232 - width: 28rpx;  
233 - height: 28rpx;  
234 - margin-left: 4rpx;  
235 - }  
236 - }  
237 -} 230 + .command-record {
  231 + padding: 0 30rpx;
  232 + background: #f8f9fa;
238 233
239 -.list-item {  
240 - width: 690rpx;  
241 - background-color: #fff;  
242 - border-radius: 20rpx;  
243 - margin: 20rpx auto;  
244 - color: #333;  
245 - .item {  
246 - .delivered-color {  
247 - color: blue;  
248 - }  
249 - padding: 30rpx;  
250 - view {  
251 - font-size: 14px;  
252 - margin-bottom: 10rpx;  
253 - }  
254 - .time {  
255 - margin-top: 20rpx;  
256 - color: #999;  
257 - }  
258 - .item-first { 234 + .filter-button {
  235 + font-size: 12px;
  236 + width: 160rpx;
  237 + height: 64rpx;
  238 + border-radius: 32rpx;
259 display: flex; 239 display: flex;
260 - justify-content: space-between; 240 + justify-content: center;
261 align-items: center; 241 align-items: center;
262 - font-size: 15px;  
263 - font-weight: 500;  
264 - align-items: center;  
265 - .item-right {  
266 - display: flex;  
267 - justify-content: center;  
268 - align-items: center;  
269 - width: 104rpx;  
270 - height: 36rpx;  
271 - font-size: 10px;  
272 - border-radius: 20rpx; 242 + background: #f0f1f2;
  243 + color: #666;
  244 +
  245 + image {
  246 + width: 28rpx;
  247 + height: 28rpx;
  248 + margin-left: 4rpx;
  249 + }
  250 + }
  251 + }
  252 +
  253 + .list-item {
  254 + width: 690rpx;
  255 + background-color: #fff;
  256 + border-radius: 20rpx;
  257 + margin: 20rpx auto;
  258 + color: #333;
  259 +
  260 + .item {
  261 + .delivered-color {
  262 + color: blue;
  263 + }
  264 +
  265 + padding: 30rpx;
  266 +
  267 + view {
  268 + font-size: 14px;
  269 + margin-bottom: 10rpx;
273 } 270 }
274 - .item-fail {  
275 - color: #848383;  
276 - background-color: #84838325; 271 +
  272 + .time {
  273 + margin-top: 20rpx;
  274 + color: #999;
277 } 275 }
278 - .item.success {  
279 - color: #00c9a7;  
280 - background-color: #00c9a725; 276 +
  277 + .item-first {
  278 + display: flex;
  279 + justify-content: space-between;
  280 + align-items: center;
  281 + font-size: 15px;
  282 + font-weight: 500;
  283 + align-items: center;
  284 +
  285 + .item-right {
  286 + display: flex;
  287 + justify-content: center;
  288 + align-items: center;
  289 + width: 104rpx;
  290 + height: 36rpx;
  291 + font-size: 10px;
  292 + border-radius: 20rpx;
  293 + }
  294 +
  295 + .item-fail {
  296 + color: #848383;
  297 + background-color: #84838325;
  298 + }
  299 +
  300 + .item.success {
  301 + color: #00c9a7;
  302 + background-color: #00c9a725;
  303 + }
281 } 304 }
282 } 305 }
283 } 306 }
284 -}  
285 307
286 -.filter {  
287 - padding: 0 30rpx;  
288 - .filter-title {  
289 - text-align: center;  
290 - margin-top: 14px;  
291 - font-size: 16px;  
292 - font-weight: 700;  
293 - }  
294 - .button-group {  
295 - display: flex;  
296 - margin-top: 40rpx;  
297 - justify-content: space-between;  
298 - view {  
299 - width: 330rpx; 308 + .filter {
  309 + padding: 0 30rpx;
  310 +
  311 + .filter-title {
  312 + text-align: center;
  313 + margin-top: 14px;
  314 + font-size: 16px;
  315 + font-weight: 700;
  316 + }
  317 +
  318 + .button-group {
  319 + display: flex;
  320 + margin-top: 40rpx;
  321 + justify-content: space-between;
  322 +
  323 + view {
  324 + width: 330rpx;
  325 + }
300 } 326 }
301 } 327 }
302 -}  
303 </style> 328 </style>
@@ -8,7 +8,9 @@ @@ -8,7 +8,9 @@
8 <u-icon v-if="deviceDetail.deviceInfo.longitude !== ''" @click="handleClick" name="map-fill"> 8 <u-icon v-if="deviceDetail.deviceInfo.longitude !== ''" @click="handleClick" name="map-fill">
9 </u-icon> 9 </u-icon>
10 </view> 10 </view>
11 - <view class="text-clip" style="margin-left: 20rpx;width:370rpx">{{ deviceDetail.alias? deviceDetail.alias: deviceDetail.name }}</view> 11 + <view class="text-clip" style="margin-left: 20rpx;width:370rpx">
  12 + {{ deviceDetail.alias? deviceDetail.alias: deviceDetail.name }}
  13 + </view>
12 <view style="margin-left: 20rpx; font-size: 14px;" 14 <view style="margin-left: 20rpx; font-size: 14px;"
13 :style="{ color: deviceDetail.deviceState === 'INACTIVE' ? '#666' : deviceDetail.deviceState === 'ONLINE' ? '#377DFF' : '#DE4437' }"> 15 :style="{ color: deviceDetail.deviceState === 'INACTIVE' ? '#666' : deviceDetail.deviceState === 'ONLINE' ? '#377DFF' : '#DE4437' }">
14 {{ deviceDetail.deviceState === 'INACTIVE' ? '待激活' : deviceDetail.deviceState === 'ONLINE' ? '在线' : '离线' }} 16 {{ deviceDetail.deviceState === 'INACTIVE' ? '待激活' : deviceDetail.deviceState === 'ONLINE' ? '在线' : '离线' }}
@@ -123,7 +125,12 @@ @@ -123,7 +125,12 @@
123 </u-radio-group> 125 </u-radio-group>
124 </view> 126 </view>
125 <view style="margin-top: 28rpx;width: 100%;"> 127 <view style="margin-top: 28rpx;width: 100%;">
126 - <u--textarea placeholder="请输入下发内容(json格式)" v-model="inputCommandVal" /> 128 + <div class="u-flex u-row-between">
  129 + <u--textarea placeholder="请输入下发内容(json格式)" v-model="inputCommandVal" />
  130 + <u-icon @click="handleCopy(copyTextValue)" name="question-circle" color="#2979ff" size="28"
  131 + class="ml-10">
  132 + </u-icon>
  133 + </div>
127 </view> 134 </view>
128 135
129 <view class="button-group"> 136 <view class="button-group">
@@ -157,6 +164,13 @@ @@ -157,6 +164,13 @@
157 }, 164 },
158 data() { 165 data() {
159 return { 166 return {
  167 + copyTextValue: {
  168 + "method": "methodThingskit",
  169 + "params": {
  170 + "pin": 7,
  171 + "value": 1
  172 + }
  173 + },
160 showNodal: false, 174 showNodal: false,
161 items: [{ 175 items: [{
162 value: 'OneWay', 176 value: 'OneWay',
@@ -202,6 +216,22 @@ @@ -202,6 +216,22 @@
202 this.modalName = null 216 this.modalName = null
203 }, 217 },
204 methods: { 218 methods: {
  219 + handleCopy(value) {
  220 + uni.showModal({
  221 + content: JSON.stringify(value), //模板中提示的内容
  222 + confirmText: '复制内容',
  223 + success: () => { //点击复制内容的后调函数
  224 + uni.setClipboardData({
  225 + data: JSON.stringify(value), //要被复制的内容
  226 + success: () => { //复制成功的回调函数
  227 + uni.showToast({ //提示
  228 + title: '复制成功'
  229 + })
  230 + }
  231 + });
  232 + }
  233 + });
  234 + },
205 radioChange: function(evt) { 235 radioChange: function(evt) {
206 for (let i = 0; i < this.items.length; i++) { 236 for (let i = 0; i < this.items.length; i++) {
207 if (this.items[i].value === evt.detail.value) { 237 if (this.items[i].value === evt.detail.value) {
@@ -247,9 +277,7 @@ @@ -247,9 +277,7 @@
247 cmdType: 'API' 277 cmdType: 'API'
248 }; 278 };
249 this.commandValue.method = 'methodThingskit'; 279 this.commandValue.method = 'methodThingskit';
250 - this.commandValue.params = {  
251 - params: commandJsonValue  
252 - }; 280 + this.commandValue.params = commandJsonValue
253 await issueCommand(this.commandType, this.deviceDetail.tbDeviceId, this.commandValue); 281 await issueCommand(this.commandType, this.deviceDetail.tbDeviceId, this.commandValue);
254 this.hiddenModal(); 282 this.hiddenModal();
255 uni.$u.toast('下发成功~'); 283 uni.$u.toast('下发成功~');
1 { 1 {
2 - "name": "ThingsKit",  
3 - "appid": "__UNI__AD0D64F",  
4 - "description": "thingskit",  
5 - "versionName": "1.0.0",  
6 - "versionCode": 100,  
7 - "transformPx": false,  
8 - "app-plus": {  
9 - "usingComponents": true,  
10 - "nvueStyleCompiler": "uni-app",  
11 - "compilerVersion": 3,  
12 - "splashscreen": {  
13 - "alwaysShowBeforeRender": false,  
14 - "waiting": false,  
15 - "autoclose": true,  
16 - "delay": 0  
17 - },  
18 - "modules": {  
19 - "VideoPlayer": {},  
20 - "Maps": {},  
21 - "Contacts": {},  
22 - "FaceID": {},  
23 - "Messaging": {},  
24 - "OAuth": {},  
25 - "Camera": {}  
26 - },  
27 - "compatible": {  
28 - "ignoreVersion": true  
29 - },  
30 - "distribute": {  
31 - "android": {  
32 - "permissions": [  
33 - "<uses-feature android:name=\"android.hardware.camera\"/>",  
34 - "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",  
35 - "<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",  
36 - "<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",  
37 - "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",  
38 - "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",  
39 - "<uses-permission android:name=\"android.permission.CAMERA\"/>",  
40 - "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",  
41 - "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",  
42 - "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",  
43 - "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",  
44 - "<uses-permission android:name=\"android.permission.INSTALL_PACKAGES\"/>",  
45 - "<uses-permission android:name=\"android.permission.INTERNET\"/>",  
46 - "<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",  
47 - "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",  
48 - "<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>",  
49 - "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",  
50 - "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",  
51 - "<uses-permission android:name=\"android.permission.READ_SMS\"/>",  
52 - "<uses-permission android:name=\"android.permission.REQUEST_INSTALL_PACKAGES\"/>",  
53 - "<uses-permission android:name=\"android.permission.SEND_SMS\"/>",  
54 - "<uses-permission android:name=\"android.permission.VIBRATE\"/>",  
55 - "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",  
56 - "<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>",  
57 - "<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",  
58 - "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",  
59 - "<uses-permission android:name=\"android.permission.WRITE_SMS\"/>"  
60 - ],  
61 - "autoSdkPermissions": false  
62 - },  
63 - "ios": {  
64 - "dSYMs": false  
65 - },  
66 - "sdkConfigs": {  
67 - "ad": {},  
68 - "geolocation": {  
69 - "system": {  
70 - "__platform__": ["ios", "android"]  
71 - },  
72 - "amap": {  
73 - "__platform__": ["ios", "android"],  
74 - "appkey_ios": "",  
75 - "appkey_android": ""  
76 - }  
77 - },  
78 - "maps": {  
79 - "amap": {  
80 - "appkey_ios": "5221d1373233c782efac82fb176f7f7d",  
81 - "appkey_android": "5221d1373233c782efac82fb176f7f7d"  
82 - }  
83 - },  
84 - "oauth": {  
85 - "weixin": {  
86 - "appid": "wx0ad61d7bf6808e02",  
87 - "UniversalLinks": ""  
88 - }  
89 - }  
90 - },  
91 - "splashscreen": {  
92 - "androidStyle": "default",  
93 - "android": {},  
94 - "useOriginalMsgbox": false  
95 - },  
96 - "icons": {  
97 - "android": {  
98 - "xxhdpi": "static/logo.png",  
99 - "xhdpi": "static/logo.png",  
100 - "hdpi": "static/logo.png",  
101 - "xxxhdpi": "static/logo.png"  
102 - }  
103 - }  
104 - }  
105 - },  
106 - "quickapp": {},  
107 - "mp-weixin": {  
108 - "appid": "wx99c411dc3c5571ef",  
109 - "setting": {  
110 - "urlCheck": false,  
111 - "minified": true,  
112 - "es6": false,  
113 - "postcss": true  
114 - },  
115 - "usingComponents": true,  
116 - "permission": {  
117 - "scope.userLocation": {  
118 - "desc": "你的位置信息将用于小程序位置接口的效果展示"  
119 - }  
120 - },  
121 - "lazyCodeLoading": "requiredComponents",  
122 - "optimization": {  
123 - "subPackages": true  
124 - }  
125 - },  
126 - "mp-alipay": {  
127 - "usingComponents": true  
128 - },  
129 - "mp-baidu": {  
130 - "usingComponents": true  
131 - },  
132 - "mp-toutiao": {  
133 - "usingComponents": true  
134 - },  
135 - "uniStatistics": {  
136 - "enable": false  
137 - },  
138 - "vueVersion": "2",  
139 - "h5": {  
140 - "sdkConfigs": {  
141 - "maps": {}  
142 - },  
143 - "router": {  
144 - "base": "minImage/h5/"  
145 - }  
146 - },  
147 - "locale": "zh-Hans" 2 + "name" : "ThingsKit",
  3 + "appid" : "__UNI__AD0D64F",
  4 + "description" : "thingskit",
  5 + "versionName" : "1.0.0",
  6 + "versionCode" : 100,
  7 + "transformPx" : false,
  8 + "app-plus" : {
  9 + "usingComponents" : true,
  10 + "nvueStyleCompiler" : "uni-app",
  11 + "compilerVersion" : 3,
  12 + "splashscreen" : {
  13 + "alwaysShowBeforeRender" : false,
  14 + "waiting" : false,
  15 + "autoclose" : true,
  16 + "delay" : 0
  17 + },
  18 + "modules" : {
  19 + "VideoPlayer" : {},
  20 + "Maps" : {},
  21 + "Contacts" : {},
  22 + "FaceID" : {},
  23 + "Messaging" : {},
  24 + "OAuth" : {},
  25 + "Camera" : {}
  26 + },
  27 + "compatible" : {
  28 + "ignoreVersion" : true
  29 + },
  30 + "distribute" : {
  31 + "android" : {
  32 + "permissions" : [
  33 + "<uses-feature android:name=\"android.hardware.camera\"/>",
  34 + "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
  35 + "<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
  36 + "<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
  37 + "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
  38 + "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
  39 + "<uses-permission android:name=\"android.permission.CAMERA\"/>",
  40 + "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
  41 + "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
  42 + "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
  43 + "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
  44 + "<uses-permission android:name=\"android.permission.INSTALL_PACKAGES\"/>",
  45 + "<uses-permission android:name=\"android.permission.INTERNET\"/>",
  46 + "<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
  47 + "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
  48 + "<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>",
  49 + "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
  50 + "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
  51 + "<uses-permission android:name=\"android.permission.READ_SMS\"/>",
  52 + "<uses-permission android:name=\"android.permission.REQUEST_INSTALL_PACKAGES\"/>",
  53 + "<uses-permission android:name=\"android.permission.SEND_SMS\"/>",
  54 + "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
  55 + "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
  56 + "<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>",
  57 + "<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
  58 + "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
  59 + "<uses-permission android:name=\"android.permission.WRITE_SMS\"/>"
  60 + ],
  61 + "autoSdkPermissions" : false
  62 + },
  63 + "ios" : {
  64 + "dSYMs" : false
  65 + },
  66 + "sdkConfigs" : {
  67 + "ad" : {},
  68 + "geolocation" : {
  69 + "system" : {
  70 + "__platform__" : [ "ios", "android" ]
  71 + },
  72 + "amap" : {
  73 + "__platform__" : [ "ios", "android" ],
  74 + "appkey_ios" : "",
  75 + "appkey_android" : ""
  76 + }
  77 + },
  78 + "maps" : {
  79 + "amap" : {
  80 + "appkey_ios" : "5221d1373233c782efac82fb176f7f7d",
  81 + "appkey_android" : "5221d1373233c782efac82fb176f7f7d"
  82 + }
  83 + },
  84 + "oauth" : {
  85 + "weixin" : {
  86 + "appid" : "wx0ad61d7bf6808e02",
  87 + "UniversalLinks" : ""
  88 + }
  89 + }
  90 + },
  91 + "splashscreen" : {
  92 + "androidStyle" : "default",
  93 + "android" : {},
  94 + "useOriginalMsgbox" : false
  95 + },
  96 + "icons" : {
  97 + "android" : {
  98 + "xxhdpi" : "static/logo.png",
  99 + "xhdpi" : "static/logo.png",
  100 + "hdpi" : "static/logo.png",
  101 + "xxxhdpi" : "static/logo.png"
  102 + }
  103 + }
  104 + }
  105 + },
  106 + "quickapp" : {},
  107 + "mp-weixin" : {
  108 + "appid" : "wxd5d018355f38262b",
  109 + "setting" : {
  110 + "urlCheck" : false,
  111 + "minified" : true,
  112 + "es6" : false,
  113 + "postcss" : true
  114 + },
  115 + "usingComponents" : true,
  116 + "permission" : {
  117 + "scope.userLocation" : {
  118 + "desc" : "你的位置信息将用于小程序位置接口的效果展示"
  119 + }
  120 + },
  121 + "lazyCodeLoading" : "requiredComponents",
  122 + "optimization" : {
  123 + "subPackages" : true
  124 + }
  125 + },
  126 + "mp-alipay" : {
  127 + "usingComponents" : true
  128 + },
  129 + "mp-baidu" : {
  130 + "usingComponents" : true
  131 + },
  132 + "mp-toutiao" : {
  133 + "usingComponents" : true
  134 + },
  135 + "uniStatistics" : {
  136 + "enable" : false
  137 + },
  138 + "vueVersion" : "2",
  139 + "h5" : {
  140 + "sdkConfigs" : {
  141 + "maps" : {}
  142 + },
  143 + "router" : {
  144 + "base" : "minImage/h5/"
  145 + }
  146 + },
  147 + "locale" : "zh-Hans"
148 } 148 }
@@ -168,12 +168,12 @@ @@ -168,12 +168,12 @@
168 { 168 {
169 checked: false, 169 checked: false,
170 name: '告警', 170 name: '告警',
171 - type: '1' 171 + type: 1
172 }, 172 },
173 { 173 {
174 checked: false, 174 checked: false,
175 name: '正常', 175 name: '正常',
176 - type: '0' 176 + type: 0
177 } 177 }
178 ], 178 ],
179 typeStatus: [{ 179 typeStatus: [{
@@ -263,7 +263,7 @@ @@ -263,7 +263,7 @@
263 this.loadData(this.page.num, { 263 this.loadData(this.page.num, {
264 deviceState: deviceState.type ? deviceState.type : undefined, 264 deviceState: deviceState.type ? deviceState.type : undefined,
265 deviceType: deviceType.type ? deviceType.type : undefined, 265 deviceType: deviceType.type ? deviceType.type : undefined,
266 - alarmStatus: alarmStatus.type === '0' || alarmStatus.type === '1' ? alarmStatus.type : 266 + alarmStatus: alarmStatus.type === 0 || alarmStatus.type === 1 ? alarmStatus.type :
267 undefined, 267 undefined,
268 name: this.deviceName == null ? null : this.deviceName, 268 name: this.deviceName == null ? null : this.deviceName,
269 organizationId: this.orgId == null ? null : this.orgId 269 organizationId: this.orgId == null ? null : this.orgId
@@ -276,17 +276,18 @@ @@ -276,17 +276,18 @@
276 let httpData = { 276 let httpData = {
277 page: pageNo, 277 page: pageNo,
278 pageSize: 10, 278 pageSize: 10,
279 - ...params 279 + custom: {
  280 + load: false
  281 + },
280 }; 282 };
  283 + const httpPostData = {
  284 + "deviceProfileIds": null,
  285 + ...params
  286 + }
281 const { 287 const {
282 total, 288 total,
283 items 289 items
284 - } = await api.deviceApi.getDeviceApi({  
285 - params: httpData,  
286 - custom: {  
287 - load: false  
288 - }  
289 - }) 290 + } = await api.deviceApi.getDeviceApi(httpData, httpPostData)
290 this.total = total; 291 this.total = total;
291 uni.stopPullDownRefresh(); 292 uni.stopPullDownRefresh();
292 this.mescroll.endByPage(items.length, total); //必传参数(当前页的数据个数, 总页数) 293 this.mescroll.endByPage(items.length, total); //必传参数(当前页的数据个数, 总页数)
@@ -336,7 +337,7 @@ @@ -336,7 +337,7 @@
336 this.loadData(1, { 337 this.loadData(1, {
337 deviceState: deviceState.type ? deviceState.type : undefined, 338 deviceState: deviceState.type ? deviceState.type : undefined,
338 deviceType: deviceType.type ? deviceType.type : undefined, 339 deviceType: deviceType.type ? deviceType.type : undefined,
339 - alarmStatus: alarmStatus.type === '0' || alarmStatus.type === '1' ? alarmStatus.type : 340 + alarmStatus: alarmStatus.type === 0 || alarmStatus.type === 1 ? alarmStatus.type :
340 undefined 341 undefined
341 }); 342 });
342 this.show = false; 343 this.show = false;