equip-detail.vue 26 KB

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