detail.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. <template>
  2. <view class="bigBox">
  3. <u-tabs :list="list" :is-scroll="false" :current="current" @change="change" active-color="#14A478"></u-tabs>
  4. <view class="infoBox">
  5. <view :class="['info',equipInfo.is_online==1?'on':'off']">
  6. <p @click="copy(equipInfo.imei)">设备ID:{{equipInfo.imei}}
  7. <image src="http://www.hnyfwlw.com:8006/bigdata_app/image/environment/fuzhi.png" mode=""
  8. class="tishi">
  9. </image>
  10. </p>
  11. <p>设备名称:{{equipInfo.device_name==""?"无":equipInfo.device_name}}</p>
  12. <p>最新上报时间:{{equipInfo.uptime | timeFormat}}</p>
  13. <p>最新地址:{{equipInfo.address}}</p>
  14. <p class="fillin">诱芯名称:{{equipInfo.decoy}}</p>
  15. <!-- <p @click="glass_show=true">诱芯更换时间:<span style="margin:0 20rpx;">{{yxchangetime}}</span><u-icon
  16. name="edit-pen" color="#f0ad4e" size="28"></u-icon></p> -->
  17. <p>诱芯到期时间:{{equipInfo.xy_expire}}</p>
  18. <!-- <u-calendar v-model="glass_show" mode="date" :max-date="date" @change="timeChange"></u-calendar>
  19. <u-calendar v-model="glass_showtwo" mode="date" :max-date="date" @change="timeChangetwo"></u-calendar> -->
  20. </view>
  21. <view class="cardInfo">
  22. <text class="title">设备控制</text>
  23. <view class="controlCard">
  24. <view class="preBtn" v-for="btn in btnList" :key="btn.class">
  25. <view :class="`btnBox ${btn.class}`">
  26. <text :class="btn.icon"></text>
  27. </view>
  28. <view>{{btn.text}}</view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="cardInfo">
  33. <text class="title">监测数据</text>
  34. <view class="controlCard noBg">
  35. <u-row gutter="30" justify="between">
  36. <u-col span="5.8" class="preInfo" v-for="btn in dataList" :key="btn.icon">
  37. <view class="btnBox">
  38. <text :class="btn.icon"></text>
  39. </view>
  40. <view class="textBox">
  41. <view>
  42. {{newDataObj[btn.unit]}}
  43. </view>
  44. <view class="name">{{btn.text}}</view>
  45. </view>
  46. </u-col>
  47. </u-row>
  48. </view>
  49. </view>
  50. <view class="cardInfo">
  51. <text class="title">设备信息</text>
  52. <view class="controlCard noBg">
  53. <u-cell-group>
  54. <u-cell-item v-for="btn in deviceDataList" :key="btn.icon" :title="btn.text" :value="deviceObj[btn.key]" :arrow="false" :border-bottom="true"></u-cell-item>
  55. </u-cell-group>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="">
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. export default {
  65. data() {
  66. return {
  67. btnList:[{
  68. text:'更换信息素',
  69. icon:'yficonfont icon-weimingming-34',
  70. class:'green'
  71. },
  72. {
  73. text:'设备清虫',
  74. icon:'yficonfont icon-chouchongbug',
  75. class:'danger'
  76. },
  77. {
  78. text:'拍照定时',
  79. icon:'yficonfont icon-dingshi',
  80. class:'blue'
  81. },
  82. {
  83. text:'一键拍照',
  84. icon:'yficonfont icon-paizhao-xianxing',
  85. class:'yellow'
  86. }],
  87. list: [{
  88. name: '基本信息'
  89. }, {
  90. name: '数据分析'
  91. }, {
  92. name: '图片列表',
  93. }, {
  94. name: '设备控制',
  95. }],
  96. current: 0,
  97. equipInfo: {},
  98. dataList: [{
  99. text: '空气温度', // 中文
  100. unit: 'air_temp', // 对应字段
  101. data: '',
  102. icon: 'yficonfont icon-kongqiwendu', // iconclass名称
  103. },
  104. {
  105. text: '空气湿度',
  106. unit: 'air_humi',
  107. data: '',
  108. icon: 'yficonfont icon-shuizhi',
  109. },
  110. {
  111. text: '风力',
  112. unit: 'wind_force',
  113. isSmall: true,
  114. data: '',
  115. icon: 'yficonfont icon-fengli',
  116. },
  117. {
  118. text: '风向',
  119. unit: 'wind_dir',
  120. isSmall: true,
  121. data: '',
  122. icon: 'yficonfont icon-fengxiang',
  123. },
  124. {
  125. text: '虫数',
  126. unit: 'bugcnt',
  127. data: '',
  128. icon: 'yficonfont icon-chouchongbug',
  129. },
  130. {
  131. text: '光照强度',
  132. unit: 'light',
  133. data: '',
  134. isSmall: true,
  135. icon: 'yficonfont icon-qingtian',
  136. },
  137. {
  138. text: '降雨',
  139. unit: 'rain_status',
  140. data: '',
  141. icon: 'yficonfont icon-yu',
  142. },
  143. {
  144. text: '电池电量',
  145. unit: 'bat_level',
  146. data: '',
  147. icon: 'yficonfont icon-80dianliang',
  148. },
  149. {
  150. text: '信号强度',
  151. unit: 'gprs',
  152. data: '',
  153. icon: 'yficonfont icon-wifi',
  154. },
  155. {
  156. text: '定位信噪比',
  157. unit: 'cn0',
  158. data: '',
  159. isSmall: true,
  160. icon: 'yficonfont icon-dingwei1',
  161. },
  162. {
  163. text: '太阳能电压',
  164. unit: 'solar_voltage',
  165. data: '',
  166. icon: 'yficonfont icon-guangfuzujianshuliang',
  167. },
  168. {
  169. text: '蓄电池电压',
  170. unit: 'bat_val',
  171. data: '',
  172. icon: 'yficonfont icon-xudianchi',
  173. },
  174. ],
  175. dataLoading: true,
  176. newDataObj: {},
  177. deviceDataList: [{
  178. text: '设备名',
  179. key: 'devname',
  180. },
  181. {
  182. text: '设备版本号',
  183. key: 'version',
  184. },
  185. {
  186. text: '心跳间隔',
  187. key: 'heart_time',
  188. },
  189. {
  190. text: '太阳能电压阀值',
  191. key: 'solar_threshold',
  192. },
  193. {
  194. text: '太阳能电压最大值',
  195. key: 'solarmax',
  196. },
  197. {
  198. text: '数据上传频率',
  199. key: 'upload_time',
  200. },
  201. {
  202. text: '工作模式',
  203. key: 'dev_work_mode',
  204. },
  205. {
  206. text: '定时模式时间',
  207. key: 'dev_work_time',
  208. },
  209. {
  210. text: '高压包开关状态',
  211. key: 'dev_work_onoff',
  212. },
  213. {
  214. text: 'SIM卡号',
  215. key: 'sim',
  216. },
  217. ],
  218. deviceLoading: true,
  219. deviceObj: {},
  220. };
  221. },
  222. onLoad(option) {
  223. this.equipInfo = JSON.parse(option.detail);
  224. console.log(this.equipInfo);
  225. this.getData();
  226. this.getDeviceData();
  227. },
  228. methods: {
  229. async getData() {
  230. let res = await this.$myRequest({
  231. method: 'post',
  232. url: '/api/api_gateway?method=lpsxy.views.monitor_data',
  233. data: {
  234. device_id: this.equipInfo.imei,
  235. },
  236. })
  237. console.log(res);
  238. // console.log(res.data.data);
  239. this.newDataObj = res;
  240. },
  241. async getDeviceData() {
  242. let res = await this.$myRequest({
  243. method: 'post',
  244. url: '/api/api_gateway?method=lpsxy.views.device_config',
  245. data: {
  246. d_id: this.equipInfo.d_id,
  247. },
  248. })
  249. console.log(res);
  250. // console.log(res.data.data);
  251. this.deviceObj = res;
  252. },
  253. change(index) {
  254. this.current = index;
  255. },
  256. copy(item) {
  257. console.log(item)
  258. uni.setClipboardData({
  259. data: item,
  260. success: function() {
  261. console.log('success');
  262. }
  263. });
  264. },
  265. }
  266. }
  267. </script>
  268. <style lang="less">
  269. .bigBox {
  270. position: relative;
  271. width: 100vw;
  272. height: 100vh;
  273. background: #f7f7f7;
  274. overflow: auto;
  275. }
  276. .info {
  277. padding: 20rpx 40rpx;
  278. color: #fff;
  279. line-height: 50rpx;
  280. font-size: 26rpx;
  281. background-size: 100% auto;
  282. background-repeat: no-repeat;
  283. background-color: #0DC6B6;
  284. background-position: top left;
  285. box-sizing: border-box;
  286. width: 100%;
  287. border-radius: 5rpx;
  288. margin: 0 auto;
  289. p:first-child {
  290. font-size: 32rpx;
  291. }
  292. .expiretishi {
  293. font-size: 24rpx;
  294. color: #FF0000;
  295. }
  296. .tishi {
  297. width: 28rpx;
  298. height: 28rpx;
  299. margin: 0rpx 0 0 20rpx;
  300. }
  301. .fillin {
  302. display: flex;
  303. input {
  304. width: 200rpx;
  305. font-size: 24rpx;
  306. height: 50rpx;
  307. line-height: 50rpx;
  308. text-indent: 1em;
  309. }
  310. }
  311. }
  312. .on {
  313. background-image: url('http://www.hnyfwlw.com:8006/bigdata_app/image/cb/onBg.png')
  314. }
  315. .off {
  316. background-image: url('http://www.hnyfwlw.com:8006/bigdata_app/image/cb/offBg.png')
  317. }
  318. .infoBox {
  319. width: 100%;
  320. padding: 10rpx 24rpx;
  321. box-sizing: border-box;
  322. }
  323. .cardInfo {
  324. margin-top: 24rpx;
  325. .title {
  326. font-size: 28rpx;
  327. color: #999;
  328. }
  329. .controlCard {
  330. display: flex;
  331. align-items: center;
  332. justify-content: space-between;
  333. width: 100%;
  334. margin-top: 30rpx;
  335. background: #fff;
  336. box-sizing: border-box;
  337. .preBtn{
  338. display: flex;
  339. align-items: center;
  340. justify-content: space-around;
  341. flex-direction: column;
  342. width: 22%;
  343. padding: 20rpx;
  344. height: 80px;
  345. font-size: 24rpx;
  346. }
  347. .btnBox {
  348. display: flex;
  349. align-items: center;
  350. justify-content: center;
  351. height: 96rpx;
  352. width: 96rpx;
  353. border-radius: 96rpx;
  354. color: #fff;
  355. text{
  356. font-size: 20px;
  357. }
  358. }
  359. .preInfo{
  360. display: flex;
  361. align-items: center;
  362. box-sizing: border-box;
  363. padding: 32rpx !important;
  364. background: #fff;
  365. margin-bottom: 32rpx;
  366. .btnBox{
  367. width: 72rpx;
  368. height: 72rpx;
  369. background: #14a478;
  370. }
  371. .textBox{
  372. margin-left: 40rpx;
  373. font-size: 32rpx;
  374. .name{
  375. font-size: 24rpx;
  376. color: #999;
  377. }
  378. }
  379. }
  380. .green {
  381. background: #14a478;
  382. }
  383. .yellow {
  384. background: #f4a72f;
  385. }
  386. .danger {
  387. background: #ff5951;
  388. }
  389. .blue{
  390. background: #1890FF;
  391. }
  392. }
  393. .noBg{
  394. background: none;
  395. }
  396. .u-border-bottom:after, .u-border-left:after, .u-border-right:after, .u-border-top-bottom:after, .u-border-top:after, .u-border:after{
  397. content: " ";
  398. position: absolute;
  399. left: 0;
  400. top: 0;
  401. pointer-events: none;
  402. box-sizing: border-box;
  403. -webkit-transform-origin: 0 0;
  404. transform-origin: 0 0;
  405. width: 199.8%;
  406. height: 199.7%;
  407. -webkit-transform: scale(.5);
  408. transform: scale(.5);
  409. border: .5px solid #E5EBE9;
  410. z-index: 2;
  411. }
  412. }
  413. </style>