equip-detail.vue 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123
  1. <template>
  2. <view>
  3. <view :class="['info', equipInfo.is_online == 1 ? 'on' : 'off']">
  4. <view class="" @click="copy(equipInfo)">
  5. 设备ID:{{ equipInfo.imei || equipInfo.device_id }}
  6. <image
  7. :src="$imageURL+'/bigdata_app/image/environment/fuzhi.png'"
  8. mode=""
  9. class="tishi"
  10. >
  11. </image>
  12. </view>
  13. <view class="">
  14. 设备名称:{{
  15. equipInfo.device_name == '' ? '无' : equipInfo.device_name
  16. }}
  17. </view>
  18. <view class="">
  19. 设备类型:<span v-if="equipInfo.type">{{
  20. equipInfo.type | equipType
  21. }}</span
  22. ><span v-else>{{ equipInfo.type_name }}</span>
  23. </view>
  24. <view v-if="type == 4" class="">
  25. 组号:{{ equipInfo.group_id }}
  26. </view>
  27. <view v-if="type == 4" class="">
  28. 诱捕器编号:{{ equipInfo.serial_id }}
  29. </view>
  30. <view class="">
  31. 最新上报时间:{{ equipInfo.addtime || equipInfo.uptime | timeFormat }}
  32. </view>
  33. <view class=""> 设备地址:{{ equipInfo.address || city }} </view>
  34. <view v-if="type == 7" @click="setTime(equipInfo.d_id)">
  35. <text space="emsp">载玻片、培养液更换时间</text>
  36. <u-icon name="edit-pen" color="#f0ad4e" size="28"></u-icon>
  37. </view>
  38. <view v-if="type == 7">
  39. <text space="emsp">
  40. <span
  41. :class="{
  42. red: equipInfo.status_glass == 2 || equipInfo.status_glass == 1,
  43. }"
  44. >
  45. {{ glass_slide_timeTime(equipInfo.status_glass) }}
  46. </span>
  47. <span style="margin: 0 10px">|</span>
  48. <span
  49. :class="{
  50. red: equipInfo.status_cul == 2 || equipInfo.status_cul == 1,
  51. }"
  52. >
  53. {{ cultivateTime(equipInfo.status_cul) }}
  54. </span>
  55. </text>
  56. </view>
  57. <view v-if="type == 4" @click="addYx(equipInfo.d_id)">
  58. <text space="emsp">添加诱芯</text>
  59. <text style="margin: 0 10px">{{ equipInfo.decoy || '暂无' }}</text>
  60. <u-icon name="edit-pen" color="#f0ad4e" size="28"></u-icon>
  61. </view>
  62. <view v-if="type == 4">
  63. <text space="emsp">诱芯更新时间</text>
  64. <text style="margin: 0 10px">{{ equipInfo.xy_uptime }}</text>
  65. </view>
  66. <view v-if="type == 4">
  67. <text space="emsp">诱芯到期时间</text>
  68. <text style="margin: 0 10px">{{ equipInfo.xy_expire }}</text>
  69. </view>
  70. <u-popup v-model="setTimeShow" mode="center" width="600rpx">
  71. <u-field
  72. label="载玻片更换时间"
  73. placeholder="选择日期"
  74. label-width="240"
  75. required
  76. :error-message="glassErr"
  77. v-model="glass_slide_time"
  78. @click="glass_show = true"
  79. :field-style="fieldstyle"
  80. disabled
  81. >
  82. </u-field>
  83. <u-field
  84. label="培养液更换时间"
  85. placeholder="选择日期"
  86. label-width="240"
  87. required
  88. :error-message="culErr"
  89. v-model="cultivate_time"
  90. @click="cultivate_show = true"
  91. :field-style="fieldstyle"
  92. disabled
  93. >
  94. </u-field>
  95. <view class="btn-box">
  96. <u-button @click="setTimeSubmit" size="mini" type="success"
  97. >确定</u-button
  98. >
  99. </view>
  100. <u-calendar
  101. v-model="glass_show"
  102. mode="date"
  103. :max-date="date"
  104. @change="timeChange($event, 'glass')"
  105. >
  106. </u-calendar>
  107. <u-calendar
  108. v-model="cultivate_show"
  109. mode="date"
  110. :max-date="date"
  111. @change="timeChange($event, 'cultivate')"
  112. ></u-calendar>
  113. </u-popup>
  114. <u-popup v-model="yxShow" mode="center" width="600rpx">
  115. <u-field
  116. label="监测害虫名称"
  117. label-width="240"
  118. required
  119. :error-message="xyErr"
  120. v-model="decoy"
  121. :field-style="fieldstyle"
  122. >
  123. </u-field>
  124. <view class="btn-box">
  125. <u-button @click="yxSubmit" size="mini" type="success">确定</u-button>
  126. </view>
  127. </u-popup>
  128. <u-toast ref="toast" />
  129. </view>
  130. <view class="equip_part">
  131. <template v-for="item in curEquip">
  132. <view
  133. :class="[equipInfo.type == 3 ? 'item2' : 'item1']"
  134. v-show="item.tf"
  135. @click="partClick(item.path)"
  136. >
  137. <image
  138. :src="$imageURL+'/bigdata_app' + item.icon"
  139. mode="widthFix"
  140. ></image>
  141. <view class="">
  142. {{ item.tex }}
  143. </view>
  144. </view>
  145. </template>
  146. </view>
  147. <view class="tit">
  148. <p>实时数据</p>
  149. <p
  150. class="span"
  151. @click="partClicks"
  152. v-if="
  153. equipInfo.type != 4 && $QueryPermission(60) && equipInfo.type == 3
  154. "
  155. >
  156. 历史数据>>>
  157. </p>
  158. <p
  159. class="span"
  160. @click="partClicks"
  161. v-if="
  162. equipInfo.type != 4 && $QueryPermission(71) && equipInfo.type == 7
  163. "
  164. >
  165. 历史数据>>>
  166. </p>
  167. </view>
  168. <view class="newtishi" v-if="dataloadingtf">
  169. <p class="dataloading">加载中</p>
  170. </view>
  171. <view class="newtishi" v-else-if="newtishitf"> 暂无数据 </view>
  172. <view class="newState" v-else>
  173. <view class="item" v-for="item in curState">
  174. <image
  175. :src="$imageURL+'/bigdata_app' + item.icon"
  176. mode="widthFix"
  177. ></image>
  178. <view class="info-con">
  179. <view class="active">
  180. {{ item.txt }}
  181. </view>
  182. <view class="val">
  183. {{ item.value | formatValue(item.txt, type) }}
  184. </view>
  185. </view>
  186. </view>
  187. </view>
  188. </view>
  189. </template>
  190. <script>
  191. import equipState from '../../../static/js/equipState_dict.json';
  192. import { QueryPermission } from '../../../util/QueryPermission.js';
  193. export default {
  194. data() {
  195. return {
  196. fieldstyle: {
  197. border: '2rpx solid #f6f6f6',
  198. 'border-radius': '24px',
  199. 'padding-left': '20rpx',
  200. 'background-color': '#f6f6f6',
  201. },
  202. city: '',
  203. type: null, //设备类型
  204. device_status: null,
  205. equipInfo: {},
  206. cbd: [
  207. {
  208. icon: '/image/cb/1.png',
  209. tex: '查看图片',
  210. path: '/pages/cb/cbd/equip-set/imgpage',
  211. tf: QueryPermission(61),
  212. },
  213. {
  214. icon: '/image/cb/3.png',
  215. tex: '害虫分析',
  216. path: '/pages/cb/cbd/equip-set/analyse',
  217. tf: QueryPermission(163),
  218. },
  219. {
  220. icon: '/image/cb/4.png',
  221. tex: '设备控制',
  222. path: '/pages/cb/cbd/equip-set/equip-set',
  223. tf: QueryPermission(62),
  224. },
  225. {
  226. icon: '/image/cb/6.png',
  227. tex: 'sim卡详情',
  228. path: '/pages/prevention/sim',
  229. tf: QueryPermission(274),
  230. },
  231. {
  232. icon: '/image/environment/7.png',
  233. tex: '一键报修',
  234. path: '/pages/afterSale/addafter',
  235. tf: true,
  236. },
  237. ],
  238. bzy: [
  239. {
  240. icon: '/image/cb/4.png',
  241. tex: '设备控制',
  242. path: '/pages/cb/bzy/equip-set/equip-set',
  243. tf: QueryPermission(69),
  244. },
  245. {
  246. icon: '/image/cb/1.png',
  247. tex: '查看图片',
  248. path: '/pages/cb/cbd/equip-set/imgpage',
  249. tf: QueryPermission(68),
  250. },
  251. {
  252. icon: '/image/cb/6.png',
  253. tex: 'sim卡详情',
  254. path: '/pages/prevention/sim',
  255. tf: QueryPermission(70),
  256. },
  257. {
  258. icon: '/image/environment/7.png',
  259. tex: '一键报修',
  260. path: '/pages/afterSale/addafter',
  261. tf: true,
  262. },
  263. ],
  264. xy: [
  265. {
  266. icon: '/image/cb/4.png',
  267. tex: '设备控制',
  268. path: '/pages/cb/xy/equip-set/equip-set',
  269. tf: QueryPermission(65),
  270. },
  271. {
  272. icon: '/image/cb/6.png',
  273. tex: 'sim卡详情',
  274. path: '/pages/prevention/sim',
  275. tf: QueryPermission(66),
  276. },
  277. {
  278. icon: '/image/cb/2.png',
  279. tex: '历史数据',
  280. path: '/pages/cb/xy/equip-set/xyhistoryile',
  281. tf: QueryPermission(67),
  282. },
  283. {
  284. icon: '/image/environment/7.png',
  285. tex: '一键报修',
  286. path: '/pages/afterSale/addafter',
  287. tf: true,
  288. },
  289. ],
  290. newState: {}, //设备最新状态
  291. setTimeShow: false,
  292. glass_show: false,
  293. cultivate_show: false,
  294. cultivate_time: '',
  295. glass_slide_time: '',
  296. glassErr: '',
  297. culErr: '',
  298. yxShow: false, //诱芯弹框
  299. xyErr: '',
  300. decoy: '',
  301. newtishitf: false, //暂无数据提示
  302. dataloadingtf: true, //加载中提示
  303. date: '', //最大可选时间
  304. };
  305. },
  306. computed: {
  307. curEquip() {
  308. switch (this.type) {
  309. case 3:
  310. if (this.equipInfo.device_model == 11) {
  311. // 虫情信息采集设备
  312. let permission = [
  313. QueryPermission(294),
  314. QueryPermission(296),
  315. QueryPermission(295),
  316. QueryPermission(293),
  317. true,
  318. ];
  319. this.cbd.map((cb, index) => {
  320. cb.tf = permission[index];
  321. });
  322. console.log(this.cbd);
  323. }
  324. return this.cbd;
  325. case 7:
  326. if (this.equipInfo.device_model == 51) {
  327. // 孢子仪1.0
  328. let permission = [
  329. QueryPermission(301),
  330. QueryPermission(302),
  331. QueryPermission(303),
  332. true,
  333. ];
  334. this.bzy.map((cb, index) => {
  335. cb.tf = permission[index];
  336. });
  337. } else if (this.equipInfo.device_model == 52) {
  338. // 孢子仪2.0
  339. let permission = [
  340. QueryPermission(308),
  341. QueryPermission(309),
  342. QueryPermission(310),
  343. true,
  344. ];
  345. this.bzy.map((cb, index) => {
  346. cb.tf = permission[index];
  347. });
  348. }
  349. return this.bzy;
  350. case 4:
  351. return this.xy;
  352. }
  353. },
  354. curState() {
  355. switch (this.type) {
  356. case 3:
  357. let blbs = ''; //灯管状态
  358. if (this.newState.lamp != undefined) {
  359. if (this.newState.ws == 1) {
  360. if (this.newState.lamp == 1) {
  361. blbs = '异常';
  362. } else if (equipState.lux == 0) {
  363. blbs = 'N/A(未检测到传感器)';
  364. } else if (this.newState.lamp == 0) {
  365. blbs = '工作';
  366. }
  367. } else {
  368. blbs = '待机';
  369. }
  370. } else {
  371. blbs = '--';
  372. }
  373. console.log('新状态:::::', this.newState);
  374. return [
  375. {
  376. icon: '/image/cb/icon02.png',
  377. txt: '在线状态',
  378. value: Number(this.device_status) == 1 ? '在线' : '离线',
  379. },
  380. {
  381. icon: '/image/cb/icon05.png',
  382. txt: '开关状态',
  383. value: Number(this.newState.ds) == 1 ? '开机' : '关机',
  384. },
  385. {
  386. icon: '/image/cb/icon13.png',
  387. txt: '通道状态',
  388. value: Number(this.newState.upds) == 1 ? '落虫' : '排水',
  389. },
  390. {
  391. icon: '/image/cb/icon10.png',
  392. txt: '加热状态',
  393. value: Number(this.newState.hs) == 1 ? '加热' : '正常',
  394. },
  395. {
  396. icon: '/image/cb/icon08.png',
  397. txt: '环境温度(℃)',
  398. value:
  399. this.newState.at == '2.5' ||
  400. this.newState.at == '25.0' ||
  401. this.newState.at == '' ||
  402. this.newState.at == '25'
  403. ? this.newState.new_tem
  404. : this.newState.at,
  405. },
  406. {
  407. icon: '/image/cb/icon07.png',
  408. txt: '环境湿度(%)',
  409. value:
  410. this.newState.ah == '30.0' ||
  411. this.newState.ah == '30.0' ||
  412. this.newState.ah == '' ||
  413. this.newState.ah == '30'
  414. ? this.newState.new_hum
  415. : this.newState.ah,
  416. },
  417. {
  418. icon: '/image/cb/icon16.png',
  419. txt: '信号强度',
  420. value: this.newState.csq,
  421. },
  422. {
  423. icon: '/image/cb/icon12.png',
  424. txt: '设备版本',
  425. value: this.newState.dver,
  426. },
  427. {
  428. icon: '/image/cb/icon17.png',
  429. txt: '雨控状态',
  430. value: Number(this.newState.rps) == 1 ? '雨控' : '正常',
  431. },
  432. {
  433. icon: '/image/cb/icon14.png',
  434. txt: '温控状态',
  435. value: Number(this.newState.tps) == 1 ? '温控' : '正常',
  436. },
  437. {
  438. icon: '/image/cb/icon06.png',
  439. txt: '光控状态',
  440. value: Number(this.newState.lps) == 1 ? '光控' : '正常',
  441. },
  442. {
  443. icon: '/image/cb/icon01.png',
  444. txt: '灯管状态',
  445. value: blbs,
  446. },
  447. {
  448. icon: '/image/cb/icon11.png',
  449. txt: '上仓门',
  450. value: Number(this.newState.upds) == 1 ? '打开' : '关闭',
  451. },
  452. {
  453. icon: '/image/cb/icon15.png',
  454. txt: '下仓门',
  455. value: Number(this.newState.dnds) == 1 ? '打开' : '关闭',
  456. },
  457. ];
  458. case 7:
  459. if (this.newState.pre_temp) {
  460. return [
  461. {
  462. icon: '/image/cb/icon02.png',
  463. txt: '在线状态',
  464. value: Number(this.device_status) == 1 ? '在线' : '离线',
  465. },
  466. {
  467. icon: '/image/cb/icon05.png',
  468. txt: '设备开关',
  469. value: Number(this.newState.ds) == 1 ? '开启' : '关闭',
  470. },
  471. {
  472. icon: '/image/cb/bzy/3.png',
  473. txt: '摄像头状态',
  474. value: this.newState.usb_sta == 1 ? '异常' : '正常',
  475. },
  476. {
  477. icon: '/image/prevention/44.png',
  478. txt: '当前电压',
  479. value: this.newState.v_bat,
  480. },
  481. {
  482. icon: '/image/cb/icon08.png',
  483. txt: '环境温度(℃)',
  484. value:
  485. this.newState.at == '2.5' ||
  486. this.newState.at == '25' ||
  487. this.newState.at == '' ||
  488. this.newState.at == '25.0'
  489. ? this.newState.new_tem
  490. : this.newState.at,
  491. },
  492. {
  493. icon: '/image/prevention/66.png',
  494. txt: '环境湿度(%)',
  495. value:
  496. this.newState.ah == '30' ||
  497. this.newState.ah == '3.0' ||
  498. this.newState.ah == '' ||
  499. this.newState.ah == '30.0'
  500. ? this.newState.new_hum
  501. : this.newState.ah,
  502. },
  503. {
  504. icon: '/image/cb/icon16.png',
  505. txt: '信号强度',
  506. value: this.newState.csq,
  507. },
  508. {
  509. icon: '/image/cb/bzy/8.png',
  510. txt: '已培养时间',
  511. value: this.newState.staytime,
  512. },
  513. {
  514. icon: '/image/cb/icon12.png',
  515. txt: '设备版本',
  516. value: this.newState.dver,
  517. },
  518. {
  519. icon: '/image/cb/icon09.png',
  520. txt: '保温仓当前温度',
  521. value: this.newState.pre_temp,
  522. },
  523. {
  524. icon: '/image/cb/icon08.png',
  525. txt: '保温仓设定温度',
  526. value: this.newState.set_temp,
  527. },
  528. ];
  529. } else {
  530. return [
  531. {
  532. icon: '/image/cb/icon02.png',
  533. txt: '在线状态',
  534. value: Number(this.device_status) == 1 ? '在线' : '离线',
  535. },
  536. {
  537. icon: '/image/cb/icon05.png',
  538. txt: '设备开关',
  539. value: Number(this.newState.ds) == 1 ? '开启' : '关闭',
  540. },
  541. {
  542. icon: '/image/cb/bzy/3.png',
  543. txt: '摄像头状态',
  544. value: this.newState.usb_sta == 1 ? '异常' : '正常',
  545. },
  546. {
  547. icon: '/image/prevention/44.png',
  548. txt: '当前电压',
  549. value: this.newState.v_bat,
  550. },
  551. {
  552. icon: '/image/cb/icon08.png',
  553. txt: '环境温度(℃)',
  554. value:
  555. this.newState.at == '2.5' ||
  556. this.newState.at == '25' ||
  557. this.newState.at == '' ||
  558. this.newState.at == '25.0'
  559. ? this.newState.new_tem
  560. : this.newState.at,
  561. },
  562. {
  563. icon: '/image/prevention/66.png',
  564. txt: '环境湿度(%)',
  565. value:
  566. this.newState.ah == '30' ||
  567. this.newState.ah == '3.0' ||
  568. this.newState.ah == '' ||
  569. this.newState.ah == '30.0'
  570. ? this.newState.new_hum
  571. : this.newState.ah,
  572. },
  573. {
  574. icon: '/image/cb/icon16.png',
  575. txt: '信号强度',
  576. value: this.newState.csq,
  577. },
  578. {
  579. icon: '/image/cb/bzy/8.png',
  580. txt: '已培养时间',
  581. value: this.newState.staytime,
  582. },
  583. {
  584. icon: '/image/cb/icon12.png',
  585. txt: '设备版本',
  586. value: this.newState.dver,
  587. },
  588. ];
  589. }
  590. case 4:
  591. return [
  592. {
  593. icon: '/image/cb/icon02.png',
  594. txt: '在线状态',
  595. value: Number(this.device_status) == 1 ? '在线' : '离线',
  596. },
  597. {
  598. icon: '/image/cb/icon05.png',
  599. txt: '设备开关',
  600. value: this.newState.ds == 1 ? '开启' : '关闭',
  601. },
  602. {
  603. icon: '/image/cb/icon02.png',
  604. txt: '工作状态',
  605. value: this.newState.ws == 1 ? '工作' : ' 待机',
  606. },
  607. {
  608. icon: '/image/cb/icon12.png',
  609. txt: '设备版本',
  610. value: this.newState.dver,
  611. },
  612. {
  613. icon: '/image/cb/icon08.png',
  614. txt: '环境温度(℃)',
  615. value:
  616. this.newState.at == '2.5' ||
  617. this.newState.at == '25' ||
  618. this.newState.at == '' ||
  619. this.newState.at == '25.0'
  620. ? this.newState.new_tem
  621. : this.newState.at,
  622. },
  623. {
  624. icon: '/image/cb/icon07.png',
  625. txt: '环境湿度(%)',
  626. value:
  627. this.newState.ah == '30' ||
  628. this.newState.ah == '3.0' ||
  629. this.newState.ah == '' ||
  630. this.newState.ah == '30.0'
  631. ? this.newState.new_hum
  632. : this.newState.ah,
  633. },
  634. {
  635. icon: '/image/prevention/105.png',
  636. txt: '充电电压',
  637. value: this.newState.cv,
  638. },
  639. {
  640. icon: '/image/prevention/106.png',
  641. txt: '电池电压',
  642. value: this.newState.bv,
  643. },
  644. {
  645. icon: '/image/cb/icon16.png',
  646. txt: '信号强度',
  647. value: this.newState.csq,
  648. },
  649. {
  650. icon: '/image/cb/xy/9.png',
  651. txt: '充电状态',
  652. value: Number(this.newState.cs) == 1 ? '充电' : '正常',
  653. },
  654. {
  655. icon: '/image/cb/xy/10.png',
  656. txt: '电池状态',
  657. value: this.newState.bs,
  658. },
  659. {
  660. icon: '/image/cb/xy2.0/yujing.png',
  661. txt: '诱虫次数',
  662. value: this.newState.yc,
  663. },
  664. ];
  665. }
  666. },
  667. },
  668. filters: {
  669. equipType(type) {
  670. switch (type) {
  671. case 3:
  672. return '虫情测报灯';
  673. case 7:
  674. return '孢子仪';
  675. case 4:
  676. return '性诱测报';
  677. }
  678. },
  679. formatValue(val, a1, a2) {
  680. if (a2 == 4 && a1 == '电池状态') {
  681. switch (Number(val)) {
  682. case 0:
  683. return '正常';
  684. break;
  685. case 1:
  686. return '欠压';
  687. break;
  688. case 2:
  689. return '过压';
  690. break;
  691. }
  692. } else {
  693. return val ? val : '无';
  694. }
  695. },
  696. },
  697. onLoad(option) {
  698. this.equipInfo = JSON.parse(option.info);
  699. this.type =
  700. Number(this.equipInfo.type) ||
  701. Number(this.equipInfo.equip_type) ||
  702. Number(this.equipInfo.device_type_id);
  703. this.equipInfo.type = this.type;
  704. this.device_status = this.equipInfo.is_online;
  705. this.getState();
  706. console.log(this.equipInfo);
  707. if (this.equipInfo.disable) {
  708. if (this.equipInfo.disable == 0) {
  709. this.cbd[3].tf = false;
  710. } else {
  711. this.cbd[3].tf = true;
  712. }
  713. }
  714. this.selectaddress(Number(this.equipInfo.lat), Number(this.equipInfo.lng));
  715. var times = new Date();
  716. this.date =
  717. times.getFullYear() +
  718. 1 +
  719. '-' +
  720. Number(times.getMonth() + 1) +
  721. '-' +
  722. times.getDate();
  723. },
  724. methods: {
  725. async getState() {
  726. this.dataloadingtf = true;
  727. const res = await this.$myRequest({
  728. url: '/api/api_gateway?method=forecast.worm_lamp.device_history_data',
  729. data: {
  730. device_type_id:
  731. this.equipInfo.type ||
  732. this.equipInfo.equip_type ||
  733. this.equipInfo.device_type_id,
  734. device_id: this.equipInfo.imei || this.equipInfo.device_id,
  735. page: 1,
  736. page_size: 1,
  737. start_time: Math.floor((+new Date() - 24 * 60 * 60 * 1000) / 1000),
  738. end_time: Math.floor(+new Date() / 1000),
  739. },
  740. });
  741. if (res.counts != 0) {
  742. this.newState = res.data[0].d_h_t;
  743. this.newtishitf = false;
  744. } else {
  745. this.newtishitf = true;
  746. }
  747. this.getxyyc();
  748. },
  749. async getxyyc() {
  750. const res = await this.$myRequest({
  751. url: '/api/api_gateway?method=forecast.worm_lamp.xycb_pest_chart',
  752. data: {
  753. device_type_id:
  754. this.equipInfo.type ||
  755. this.equipInfo.equip_type ||
  756. this.equipInfo.device_type_id,
  757. d_id: this.equipInfo.d_id,
  758. page: 1,
  759. page_size: 1,
  760. start_time: Math.floor(
  761. (+new Date() - 30 * 24 * 60 * 60 * 1000) / 1000
  762. ),
  763. end_time: Math.floor(+new Date() / 1000),
  764. },
  765. });
  766. this.newState.yc = res.total_num;
  767. this.dataloadingtf = false;
  768. },
  769. partClick(path) {
  770. console.log(path);
  771. var device_id = this.equipInfo.device_id || this.equipInfo.imei;
  772. uni.navigateTo({
  773. url:
  774. path +
  775. '?d_id=' +
  776. this.equipInfo.d_id +
  777. '&device_id=' +
  778. device_id +
  779. '&device_type=' +
  780. this.type +
  781. '&disable=' +
  782. this.equipInfo.disable,
  783. });
  784. },
  785. partClicks() {
  786. var path = '';
  787. var device_id = this.equipInfo.device_id || this.equipInfo.imei;
  788. if (this.type == 3) {
  789. path = '/pages/cb/cbd/equip-set/historyfile';
  790. } else if (this.type == 7) {
  791. path = '/pages/cb/bzy/equip-set/bzyhistoryile';
  792. }
  793. uni.navigateTo({
  794. url:
  795. path +
  796. '?d_id=' +
  797. this.equipInfo.d_id +
  798. '&device_id=' +
  799. device_id +
  800. '&device_type=' +
  801. this.type,
  802. });
  803. },
  804. async setTime(d_id) {
  805. const res = await this.$myRequest({
  806. url: '/api/api_gateway?method=device.device_manage.get_spore_time',
  807. data: {
  808. device_type_id: this.type,
  809. d_id,
  810. },
  811. });
  812. this.glass_slide_time = res.glass_slide_time
  813. ? this.formatTime(res.glass_slide_time * 1000, 'yyyy-MM-dd')
  814. : '';
  815. this.cultivate_time = res.cultivate_time
  816. ? this.formatTime(res.cultivate_time * 1000, 'yyyy-MM-dd')
  817. : '';
  818. this.setTimeShow = true;
  819. },
  820. timeChange(e, a) {
  821. if (a == 'glass') {
  822. this.glass_slide_time = e.result;
  823. this.glassErr = '';
  824. } else {
  825. this.cultivate_time = e.result;
  826. this.culErr = '';
  827. }
  828. },
  829. async setTimeSubmit() {
  830. if (!this.glass_slide_time) {
  831. this.glassErr = '请填写载玻片更换时间';
  832. }
  833. if (!this.cultivate_time) {
  834. this.culErr = '请填写培养液更换时间';
  835. return;
  836. }
  837. let glass = parseInt(new Date(this.glass_slide_time).getTime() / 1000);
  838. let cultivate = parseInt(new Date(this.cultivate_time).getTime() / 1000);
  839. const res = await this.$myRequest({
  840. url: '/api/api_gateway?method=device.device_manage.updata_spore_time',
  841. data: {
  842. device_type_id: this.type,
  843. d_id: this.equipInfo.d_id,
  844. glass_slide_time: glass,
  845. cultivate_time: cultivate,
  846. },
  847. });
  848. if (res) {
  849. this.$refs.toast.show({
  850. title: '修改成功!',
  851. type: 'success',
  852. });
  853. }
  854. this.setTimeShow = false;
  855. },
  856. async addYx(d_id) {
  857. const res = await this.$myRequest({
  858. url: '/api/api_gateway?method=device.device_manage.get_spore_time',
  859. data: {
  860. device_type_id: this.type,
  861. d_id,
  862. },
  863. });
  864. this.decoy = res.decoy;
  865. this.yxShow = true;
  866. },
  867. async cbnote(d_id) {
  868. const res = await this.$myRequest({
  869. url: '/api/api_gateway?method=device.device_manage.get_spore_time',
  870. data: {
  871. device_type_id: this.type,
  872. d_id,
  873. },
  874. });
  875. this.decoy = res.decoy;
  876. this.yxShow = true;
  877. },
  878. async yxSubmit() {
  879. if (!this.decoy) {
  880. this.xyErr = '请填写监测害虫名称';
  881. return false;
  882. }
  883. const res = await this.$myRequest({
  884. url: '/api/api_gateway?method=device.device_manage.updata_spore_time',
  885. data: {
  886. device_type_id: this.type,
  887. d_id: this.equipInfo.d_id,
  888. decoy: this.decoy,
  889. },
  890. });
  891. if (res) {
  892. this.xyErr = '';
  893. this.yxShow = false;
  894. }
  895. },
  896. selectaddress(lat, lng) {
  897. //获取分布位置
  898. uni.request({
  899. type: 'GET',
  900. url:
  901. 'https://restapi.amap.com/v3/geocode/regeo?output=JSON&location=' +
  902. lng +
  903. ',' +
  904. lat +
  905. '&key=27273b81090f78759e4057f94474516f&radius=1000&extensions=all',
  906. dataType: 'json',
  907. complete: (ress) => {
  908. console.log(ress);
  909. // this.city = ress.data.regeocode.formatted_address
  910. if (ress.data.regeocode.formatted_address.length == 0) {
  911. this.city = '--';
  912. } else {
  913. this.city = ress.data.regeocode.formatted_address;
  914. }
  915. },
  916. });
  917. },
  918. copy(item) {
  919. console.log(item);
  920. uni.setClipboardData({
  921. data: item.imei || item.device_id,
  922. success: function () {
  923. console.log('success');
  924. },
  925. });
  926. },
  927. glass_slide_timeTime(date) {
  928. if (date === 0) {
  929. return '载玻片未到期';
  930. } else if (date == 1) {
  931. return '载玻片已到期';
  932. } else if (date == 2) {
  933. return '载玻片即将到期';
  934. } else if (date === '') {
  935. return '请设置培养液时间';
  936. }
  937. },
  938. cultivateTime(date) {
  939. console.log(date);
  940. if (date === 0) {
  941. return '培养液未到期';
  942. } else if (date == 1) {
  943. return '培养液已到期';
  944. } else if (date == 2) {
  945. return '培养液即将到期';
  946. } else if (date === '') {
  947. return '请设置培养液时间';
  948. }
  949. },
  950. },
  951. };
  952. </script>
  953. <style lang="scss">
  954. page {
  955. padding: 20rpx;
  956. box-sizing: border-box;
  957. .info {
  958. padding: 20rpx 40rpx;
  959. color: #fff;
  960. line-height: 50rpx;
  961. font-size: 26rpx;
  962. background-size: 100% auto;
  963. background-repeat: no-repeat;
  964. background-color: #0dc6b6;
  965. background-position: top left;
  966. box-sizing: border-box;
  967. width: 100%;
  968. .tishi {
  969. width: 28rpx;
  970. height: 28rpx;
  971. margin: 0rpx 0 0 20rpx;
  972. }
  973. }
  974. .on {
  975. background-image: url('https://s3.hnyfwlw.com/webstaticimg/bigdata_app/image/cb/onBg.png');
  976. }
  977. .off {
  978. background-image: url('https://s3.hnyfwlw.com/webstaticimg/bigdata_app/image/cb/offBg.png');
  979. }
  980. .equip_part {
  981. display: flex;
  982. flex-wrap: wrap;
  983. text-align: center;
  984. font-size: 28rpx;
  985. color: #666;
  986. line-height: 50rpx;
  987. image {
  988. width: 52rpx;
  989. }
  990. .item1 {
  991. padding: 20rpx 0;
  992. box-sizing: border-box;
  993. flex-basis: 25%;
  994. }
  995. .item2 {
  996. padding: 20rpx 10rpx;
  997. box-sizing: border-box;
  998. flex-basis: 33%;
  999. /* flex-grow: 1; */
  1000. }
  1001. .item3 {
  1002. padding: 20rpx 0;
  1003. box-sizing: border-box;
  1004. flex-basis: 25%;
  1005. }
  1006. }
  1007. .tit {
  1008. font-weight: 800;
  1009. height: 50rpx;
  1010. font-size: 30rpx;
  1011. margin-bottom: 20rpx;
  1012. display: flex;
  1013. justify-content: space-between;
  1014. .span {
  1015. color: #6e6c76;
  1016. font-size: 24rpx;
  1017. display: flex;
  1018. justify-content: space-between;
  1019. /* margin-top: 12rpx; */
  1020. }
  1021. }
  1022. .newtishi {
  1023. width: 90%;
  1024. margin: 0 auto;
  1025. text-align: center;
  1026. padding-top: 40rpx;
  1027. font-size: 32rpx;
  1028. .dataloading:after {
  1029. overflow: hidden;
  1030. display: inline-block;
  1031. vertical-align: bottom;
  1032. animation: ellipsis 2s infinite;
  1033. content: '\2026';
  1034. }
  1035. @keyframes ellipsis {
  1036. from {
  1037. width: 2px;
  1038. }
  1039. to {
  1040. width: 15px;
  1041. }
  1042. }
  1043. }
  1044. .newState {
  1045. display: flex;
  1046. flex-wrap: wrap;
  1047. text-align: center;
  1048. margin: 0 -10rpx;
  1049. .item {
  1050. display: flex;
  1051. flex-wrap: nowrap;
  1052. margin: 10rpx;
  1053. width: 345rpx;
  1054. justify-content: flex-start;
  1055. padding: 20rpx 20rpx 20rpx 30rpx;
  1056. box-sizing: border-box;
  1057. border-radius: 4px;
  1058. box-shadow: 0px 0px 5px 3px rgba(136, 136, 136, 0.1);
  1059. font-size: 24rpx;
  1060. .info-con {
  1061. padding-left: 30rpx;
  1062. text-align: left;
  1063. line-height: 40rpx;
  1064. }
  1065. image {
  1066. width: 70rpx;
  1067. height: 72rpx;
  1068. }
  1069. }
  1070. }
  1071. .btn-box {
  1072. text-align: center;
  1073. padding: 30rpx;
  1074. }
  1075. .field {
  1076. ::v-deep .uni-input-input {
  1077. border: 2rpx solid #ff0000;
  1078. border-radius: 24rpx;
  1079. width: 140px;
  1080. padding-left: 10rpx;
  1081. box-sizing: border-box;
  1082. }
  1083. }
  1084. }
  1085. ::v-deep .u-calendar__action {
  1086. display: flex;
  1087. justify-content: space-around;
  1088. .u-calendar__action__text {
  1089. line-height: 25px;
  1090. }
  1091. }
  1092. .red {
  1093. color: rgb(235, 103, 101);
  1094. }
  1095. </style>