equipmentdetails.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. <template>
  2. <view>
  3. <view class="status_bar"></view>
  4. <view class="" style="position: relative;top: 64px;">
  5. <view style="position: fixed;z-index: 100;width: 100%;">
  6. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="设备详情"></uni-nav-bar>
  7. </view>
  8. <view class="info">
  9. <view class="info_item">
  10. <image :src="eqinfo.item.is_online==1?'http://static.yfpyx.com/bigdata_app/image/cb/onBg.png':'http://static.yfpyx.com/bigdata_app/image/cb/offBg.png'"
  11. mode="" class="bgi"></image>
  12. <p style="font-size: 32rpx;" @click="copy(eqinfo.item.imei)">设备 ID:{{eqinfo.item.imei}}
  13. <image src="http://static.yfpyx.com/bigdata_app/image/environment/fuzhi.png" mode="" class="tishi"></image>
  14. </p>
  15. <p>设备名称:{{eqinfo.item.device_name}}</p>
  16. <p>设备型号:{{eqinfo.item.dtype}}</p>
  17. <p>最近上报时间:{{eqinfo.item.addtime|timeFormat()}}</p>
  18. <p>设备地址:{{eqinfo.item.address}}</p>
  19. </view>
  20. </view>
  21. <view class="control">
  22. <view class="control_item" v-if="kongtf" @click="control">
  23. <image :src="'http://static.yfpyx.com/bigdata_app'+'/image/environment/8.png'" mode=""></image>
  24. <p>设备控制</p>
  25. </view>
  26. <view class="control_item" v-if="shujutf" @click="charts">
  27. <image :src="'http://static.yfpyx.com/bigdata_app'+'/image/environment/10.png'" mode=""></image>
  28. <p>历史数据</p>
  29. </view>
  30. <view class="control_item" v-if="simtf" @click="sim">
  31. <image :src="'http://static.yfpyx.com/bigdata_app'+'/image/environment/9.png'" mode=""></image>
  32. <p>SIM卡详情</p>
  33. </view>
  34. <view class="control_item" @click="repairs">
  35. <image :src="'http://static.yfpyx.com/bigdata_app'+'/image/environment/7.png'" mode=""></image>
  36. <p>一键报修</p>
  37. </view>
  38. </view>
  39. <view class="realtime">
  40. <p class="realtime_title">实时数据</p>
  41. <view class="realtime_text" v-if="newdatesTF">
  42. <view class="realtime_text_item">
  43. <view class="realtime_text_item_info" v-for="item,index in olddatas" :key="index">
  44. <view class="item_info_img">
  45. <image :src="'http://static.yfpyx.com/bigdata_app'+item.icon" mode=""></image>
  46. </view>
  47. <view class="item_info_text">
  48. <p>{{item.txt}}</p>
  49. <p style="margin-top: 20rpx;">{{item.value}}</p>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="realtime_tishi" v-else>
  55. 暂无数据
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. export default {
  63. data() {
  64. return {
  65. eqinfo: {},
  66. olddata: {},
  67. olddatas: [],
  68. newdatesTF: false,
  69. work: "",
  70. shujutf: false,
  71. kongtf: false,
  72. simtf: false
  73. }
  74. },
  75. methods: {
  76. modification() {
  77. this.olddatas = [{
  78. icon: '/image/cb/icon02.png',
  79. txt: '设备开关',
  80. value: Number(this.olddata.ds) == 1 ? '开机' : "关机",
  81. },
  82. {
  83. icon: '/image/cb/icon05.png',
  84. txt: '工作状态',
  85. value: this.work
  86. },
  87. {
  88. icon: '/image/prevention/44.png',
  89. txt: '电击次数',
  90. value: this.olddata.ct
  91. },
  92. {
  93. icon: '/image/prevention/33.png',
  94. txt: '定时时长',
  95. value: this.olddata.tt
  96. }, {
  97. icon: '/image/cb/icon08.png',
  98. txt: '环境温度(℃)',
  99. value: this.olddata.new_tem
  100. }, {
  101. icon: '/image/cb/icon07.png',
  102. txt: '环境湿度(%)',
  103. value: this.olddata.new_hum
  104. }, {
  105. icon: '/image/prevention/icon16.png',
  106. txt: '信号强度',
  107. value: this.olddata.csq
  108. }, {
  109. icon: '/image/prevention/100.png',
  110. txt: '清虫间隔(min)',
  111. value: this.olddata.clt_t
  112. }, {
  113. icon: '/image/prevention/101.png',
  114. txt: '雨控状态',
  115. value: Number(this.olddata.rps) == 1 ? "雨控" : '正常'
  116. }, {
  117. icon: '/image/prevention/102.png',
  118. txt: '温控状态',
  119. value: Number(this.olddata.tps) == 1 ? "温控" : '正常'
  120. },
  121. {
  122. icon: '/image/prevention/105.png',
  123. txt: '充电电压',
  124. value: this.olddata.cv
  125. },
  126. {
  127. icon: '/image/prevention/106.png',
  128. txt: '电池电压',
  129. value: Number(this.olddata.bv)
  130. }
  131. ]
  132. },
  133. async history() { //设备列表
  134. const res = await this.$myRequest({
  135. url: '/api/api_gateway?method=forecast.worm_lamp.device_history_data',
  136. data: {
  137. device_type_id: 2,
  138. device_id: this.eqinfo.item.imei
  139. }
  140. })
  141. if (res.data.length != 0) {
  142. this.olddata = res.data[0].d_h_t
  143. this.newdatesTF = true
  144. if (Number(this.olddata.ws) == 0) {
  145. this.work = "待机"
  146. } else if (Number(this.olddata.ws) == 1) {
  147. this.work = "工作"
  148. } else {
  149. this.work = "充电"
  150. }
  151. } else {
  152. this.newdatesTF = false
  153. }
  154. this.modification()
  155. },
  156. clickLeft() {
  157. uni.navigateBack({
  158. delta: 1
  159. })
  160. },
  161. sim() {
  162. // sim卡详情
  163. uni.navigateTo({
  164. url: "./sim?id=" + this.eqinfo.item.d_id
  165. })
  166. },
  167. repairs(){
  168. console.log(this.eqinfo.item)
  169. var device_id = this.eqinfo.item.equip_id||this.eqinfo.item.device_id
  170. uni.navigateTo({
  171. url: "../afterSale/addafter?device_id="+ device_id +"&device_type="+ 5
  172. })
  173. },
  174. control() { //设备控制
  175. uni.navigateTo({
  176. url: "./control?id=" + this.eqinfo.item.d_id
  177. })
  178. },
  179. charts() { //历史数据
  180. uni.navigateTo({
  181. url: "./ucharts?d_id=" + this.eqinfo.item.d_id + "&imei=" + this.eqinfo.item.imei
  182. })
  183. },
  184. copy(item){
  185. uni.setClipboardData({
  186. data: item ,
  187. success: function () {
  188. console.log('success');
  189. }
  190. });
  191. },
  192. },
  193. onLoad(option) {
  194. this.$forceUpdate()
  195. this.eqinfo.item = JSON.parse(option.shebei)
  196. console.log(JSON.parse(option.shebei))
  197. this.history()
  198. uni.getStorage({
  199. key: "jurisdiction",
  200. success: (res) => {
  201. console.log(JSON.parse(res.data))
  202. let items = JSON.parse(res.data).filter((item) => {
  203. return item.purview_name == "防治系统"
  204. })
  205. let items2 = items[0].children.filter((item) => {
  206. return item.purview_name == "杀虫灯"
  207. })
  208. var arr = items2[0].children
  209. console.log(arr)
  210. for (var i = 0; i < arr.length; i++) {
  211. switch (arr[i].purview_name) {
  212. case "设备操作":
  213. this.kongtf = true
  214. break
  215. case "设备控制":
  216. this.kongtf = true
  217. break
  218. case "SIM卡状态":
  219. this.simtf = true
  220. break
  221. case "SIM卡":
  222. this.simtf = true
  223. break
  224. case "数据详情":
  225. this.shujutf = true
  226. break
  227. }
  228. }
  229. },
  230. })
  231. }
  232. }
  233. </script>
  234. <style lang="scss">
  235. .info {
  236. width: 100%;
  237. position: absolute;
  238. top: 44px;
  239. .info_item {
  240. width: 90%;
  241. margin: 0 auto;
  242. height: 260rpx;
  243. padding: 26rpx 50rpx;
  244. position: relative;
  245. box-sizing: border-box;
  246. .bgi {
  247. width: 100%;
  248. height: 260rpx;
  249. position: absolute;
  250. top: 0;
  251. left: 0;
  252. z-index: -1;
  253. }
  254. p {
  255. font-size: 24rpx;
  256. color: #FFFFFF;
  257. margin-bottom: 10rpx;
  258. .tishi{
  259. width: 30rpx;
  260. height: 30rpx;
  261. margin: 0rpx 0 0 20rpx;
  262. }
  263. }
  264. }
  265. }
  266. .control {
  267. width: 90%;
  268. position: absolute;
  269. top: 372rpx;
  270. left: 5%;
  271. display: flex;
  272. justify-content: space-between;
  273. text-align: center;
  274. padding: 0 30rpx;
  275. box-sizing: border-box;
  276. .control_item {
  277. width: 120rpx;
  278. height: 120rpx;
  279. image {
  280. width: 70rpx;
  281. height: 70rpx;
  282. }
  283. p {
  284. font-size: 24rpx;
  285. }
  286. }
  287. }
  288. .realtime {
  289. width: 100%;
  290. position: absolute;
  291. top: 500rpx;
  292. .realtime_title {
  293. font-weight: 700;
  294. width: 90%;
  295. margin: 0 auto;
  296. }
  297. .realtime_tishi {
  298. width: 90%;
  299. margin: 0 auto;
  300. text-align: center;
  301. font-size: 32rpx;
  302. padding-top: 40rpx;
  303. }
  304. .realtime_text {
  305. width: 90%;
  306. margin: 0 auto;
  307. .realtime_text_item {
  308. width: 100%;
  309. display: flex;
  310. justify-content: space-between;
  311. flex-wrap: wrap;
  312. margin-bottom: 50rpx;
  313. .realtime_text_item_info {
  314. width: 48%;
  315. box-shadow: 0 0 10rpx #bcb9ca;
  316. margin-top: 20rpx;
  317. display: flex;
  318. padding: 20rpx 20rpx;
  319. box-sizing: border-box;
  320. .item_info_img {
  321. width: 30%;
  322. text-align: center;
  323. margin-right: 30rpx;
  324. image {
  325. width: 64rpx;
  326. height: 64rpx;
  327. margin-top: 10rpx;
  328. }
  329. }
  330. .item_info_text {
  331. font-size: 24rpx;
  332. }
  333. }
  334. }
  335. }
  336. }
  337. </style>