equip-detail.vue 24 KB

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