equip-detail.vue 25 KB

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