equip-detail.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860
  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="https://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?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="'https://www.hnyfwlw.com:8006/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="'https://www.hnyfwlw.com:8006/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="'https://www.hnyfwlw.com:8006/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="'https://www.hnyfwlw.com:8006/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 {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 {
  253. blbs = "工作";
  254. }
  255. } else {
  256. blbs = "待机";
  257. }
  258. } else {
  259. blbs = "--";
  260. }
  261. return [{
  262. icon: '/image/cb/icon02.png',
  263. txt: '在线状态',
  264. value: Number(this.device_status) == 1 ? '在线' : '离线',
  265. },
  266. {
  267. icon: '/image/cb/icon05.png',
  268. txt: '开关状态',
  269. value: Number(this.newState.ds) == 1 ? '开机' : '关机'
  270. },
  271. {
  272. icon: '/image/cb/icon13.png',
  273. txt: '通道状态',
  274. value: Number(this.newState.upds) == 1 ? '落虫' : '排水'
  275. },
  276. {
  277. icon: '/image/cb/icon10.png',
  278. txt: '加热状态',
  279. value: Number(this.newState.hs) == 1 ? '加热' : '正常'
  280. }, {
  281. icon: '/image/cb/icon08.png',
  282. txt: '环境温度(℃)',
  283. value: this.newState.at == "2.5" || this.newState.at == "25" || this.newState.at ==
  284. "" || this.newState.at ==
  285. "25.0" ? this.newState.new_tem : this.newState.at
  286. }, {
  287. icon: '/image/cb/icon07.png',
  288. txt: '环境湿度(%)',
  289. value: this.newState.ah == "30" || this.newState.ah == "3.0" || this.newState.ah ==
  290. "" || this.newState.ah ==
  291. "30.0" ? this.newState.new_hum : this.newState.ah
  292. }, {
  293. icon: '/image/prevention/icon16.png',
  294. txt: '信号强度',
  295. value: this.newState.csq
  296. }, {
  297. icon: '/image/cb/icon12.png',
  298. txt: '设备版本',
  299. value: this.newState.dver
  300. },
  301. {
  302. icon: '/image/cb/icon17.png',
  303. txt: '雨控状态',
  304. value: Number(this.newState.rps) == 1 ? "雨控" : '正常'
  305. }, {
  306. icon: '/image/cb/icon14.png',
  307. txt: '温控状态',
  308. value: Number(this.newState.tps) == 1 ? "温控" : '正常'
  309. }, {
  310. icon: '/image/cb/icon06.png',
  311. txt: '光控状态',
  312. value: Number(this.newState.lps) == 1 ? "光控" : '正常'
  313. }, {
  314. icon: '/image/cb/icon01.png',
  315. txt: '灯管状态',
  316. value: blbs
  317. }, {
  318. icon: '/image/cb/icon11.png',
  319. txt: '上仓门',
  320. value: Number(this.newState.upds) == 1 ? "打开" : '关闭'
  321. }, {
  322. icon: '/image/cb/icon15.png',
  323. txt: '下仓门',
  324. value: Number(this.newState.dnds) == 1 ? "打开" : '关闭'
  325. }
  326. ]
  327. case 7:
  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 ==
  352. "25.0" ? this.newState.new_tem : this.newState.at
  353. }, {
  354. icon: '/image/prevention/66.png',
  355. txt: '环境湿度(%)',
  356. value: this.newState.ah == "30" || this.newState.ah == "3.0" || this.newState.ah ==
  357. "" || this.newState.ah ==
  358. "30.0" ? this.newState.new_hum : this.newState.ah
  359. }, {
  360. icon: '/image/prevention/icon16.png',
  361. txt: '信号强度',
  362. value: this.newState.csq
  363. }, {
  364. icon: '/image/cb/bzy/8.png',
  365. txt: '已培养时间',
  366. value: this.newState.staytime
  367. }, {
  368. icon: '/image/cb/icon12.png',
  369. txt: '设备版本',
  370. value: this.newState.dver
  371. }, {
  372. icon: '/image/cb/icon09.png',
  373. txt: '保温仓当前温度',
  374. value: this.newState.pre_temp
  375. }, {
  376. icon: '/image/cb/icon08.png',
  377. txt: '保温仓设定温度',
  378. value: this.newState.set_temp
  379. }
  380. ];
  381. case 4:
  382. return [{
  383. icon: '/image/cb/icon02.png',
  384. txt: '在线状态',
  385. value: Number(this.device_status) == 1 ? '在线' : '离线',
  386. },
  387. {
  388. icon: '/image/cb/icon05.png',
  389. txt: '设备开关',
  390. value: this.newState.ds == 1 ? '开启' : '关闭'
  391. },
  392. {
  393. icon: '/image/cb/icon02.png',
  394. txt: '工作状态',
  395. value: this.newState.ws == 1 ? '工作' : ' 待机'
  396. },
  397. {
  398. icon: '/image/cb/icon12.png',
  399. txt: '设备版本',
  400. value: this.newState.dver
  401. },
  402. {
  403. icon: '/image/cb/icon08.png',
  404. txt: '环境温度(℃)',
  405. value: this.newState.at == "2.5" || this.newState.at == "25" || this.newState.at ==
  406. "" || this.newState.at ==
  407. "25.0" ? this.newState.new_tem : this.newState.at
  408. },
  409. {
  410. icon: '/image/cb/icon07.png',
  411. txt: '环境湿度(%)',
  412. value: this.newState.ah == "30" || this.newState.ah == "3.0" || this.newState.ah ==
  413. "" || this.newState.ah ==
  414. "30.0" ? this.newState.new_hum : this.newState.ah
  415. },
  416. {
  417. icon: '/image/prevention/105.png',
  418. txt: '充电电压',
  419. value: this.newState.cv
  420. },
  421. {
  422. icon: '/image/prevention/106.png',
  423. txt: '电池电压',
  424. value: this.newState.bv
  425. },
  426. {
  427. icon: '/image/prevention/icon16.png',
  428. txt: '信号强度',
  429. value: this.newState.csq
  430. },
  431. {
  432. icon: '/image/cb/xy/9.png',
  433. txt: '充电状态',
  434. value: Number(this.newState.cs) == 1 ? '充电' : '正常'
  435. },
  436. {
  437. icon: '/image/cb/xy/10.png',
  438. txt: '电池状态',
  439. value: this.newState.bs
  440. },
  441. {
  442. icon: '/image/cb/xy2.0/yujing.png',
  443. txt: '诱虫次数',
  444. value: this.newState.yc
  445. },
  446. ]
  447. }
  448. }
  449. },
  450. filters: {
  451. equipType(type) {
  452. switch (type) {
  453. case 3:
  454. return "虫情测报灯";
  455. case 7:
  456. return "孢子仪";
  457. case 4:
  458. return "性诱测报"
  459. }
  460. },
  461. formatValue(val, a1, a2) {
  462. if (a2 == 4 && a1 == "电池状态") {
  463. switch (Number(val)) {
  464. case 0:
  465. return '正常';
  466. break;
  467. case 1:
  468. return '欠压';
  469. break;
  470. case 2:
  471. return '过压';
  472. break;
  473. }
  474. } else {
  475. return val ? val : '无'
  476. }
  477. }
  478. },
  479. onLoad(option) {
  480. this.equipInfo = JSON.parse(option.info)
  481. this.type = Number(this.equipInfo.type) || Number(this.equipInfo.equip_type) || Number(this.equipInfo
  482. .device_type_id)
  483. this.equipInfo.type = this.type
  484. this.device_status = this.equipInfo.is_online
  485. this.getState()
  486. console.log(this.equipInfo)
  487. this.selectaddress(Number(this.equipInfo.lat), Number(this.equipInfo.lng))
  488. var times = new Date()
  489. this.date = times.getFullYear() + 1 + "-" + Number(times.getMonth() + 1) + "-" + times.getDate()
  490. },
  491. methods: {
  492. async getState() {
  493. this.dataloadingtf = true
  494. const res = await this.$myRequest({
  495. url: '/api/api_gateway?method=forecast.worm_lamp.device_history_data',
  496. data: {
  497. device_type_id: this.equipInfo.type || this.equipInfo.equip_type || this.equipInfo
  498. .device_type_id,
  499. device_id: this.equipInfo.imei || this.equipInfo.device_id,
  500. page: 1,
  501. page_size: 1,
  502. start_time: Math.floor((+new Date() - 24 * 60 * 60 * 1000) / 1000),
  503. end_time: Math.floor((+new Date()) / 1000)
  504. }
  505. })
  506. // this.dataloadingtf = false
  507. if (res.counts != 0) {
  508. this.newState = res.data[0].d_h_t
  509. this.newtishitf = false
  510. } else {
  511. this.newtishitf = true
  512. }
  513. this.getxyyc()
  514. },
  515. async getxyyc() {
  516. const res = await this.$myRequest({
  517. url: '/api/api_gateway?method=forecast.worm_lamp.xycb_pest_chart',
  518. data: {
  519. device_type_id: this.equipInfo.type || this.equipInfo.equip_type || this.equipInfo
  520. .device_type_id,
  521. d_id: this.equipInfo.d_id,
  522. page: 1,
  523. page_size: 1,
  524. start_time: Math.floor((+new Date() - 30*24 * 60 * 60 * 1000) / 1000),
  525. end_time: Math.floor((+new Date()) / 1000)
  526. }
  527. })
  528. this.$set(this.newState,"yc",res.total_num)
  529. this.dataloadingtf = false
  530. },
  531. partClick(path) {
  532. console.log(path)
  533. var device_id = this.equipInfo.device_id || this.equipInfo.imei
  534. uni.navigateTo({
  535. url: path + '?d_id=' + this.equipInfo.d_id + "&device_id=" + device_id + "&device_type=" + this
  536. .type + "&disable=" + this.equipInfo.disable
  537. });
  538. },
  539. partClicks() {
  540. var path = ""
  541. var device_id = this.equipInfo.device_id || this.equipInfo.imei
  542. if (this.type == 3) {
  543. path = "/pages/cb/cbd/equip-set/historyfile"
  544. } else if (this.type == 7) {
  545. path = "/pages/cb/bzy/equip-set/bzyhistoryile"
  546. } else if (this.type == 4) {
  547. path = "/pages/cb/xy/equip-set/xyhistoryile"
  548. }
  549. uni.navigateTo({
  550. url: path + '?d_id=' + this.equipInfo.d_id + "&device_id=" + device_id + "&device_type=" + this
  551. .type
  552. });
  553. },
  554. async setTime(d_id) {
  555. const res = await this.$myRequest({
  556. url: '/api/api_gateway?method=device.device_manage.get_spore_time',
  557. data: {
  558. device_type_id: this.type,
  559. d_id
  560. }
  561. })
  562. this.glass_slide_time = res.glass_slide_time ? this.formatTime(res.glass_slide_time * 1000,
  563. 'yyyy-MM-dd') : ''
  564. this.cultivate_time = res.cultivate_time ? this.formatTime(res.cultivate_time * 1000, 'yyyy-MM-dd') :
  565. ''
  566. this.setTimeShow = true
  567. },
  568. timeChange(e, a) {
  569. if (a == 'glass') {
  570. this.glass_slide_time = e.result
  571. this.glassErr = ''
  572. } else {
  573. this.cultivate_time = e.result
  574. this.culErr = ''
  575. }
  576. },
  577. async setTimeSubmit() {
  578. if (!this.glass_slide_time) {
  579. this.glassErr = "请填写载玻片更换时间"
  580. }
  581. if (!this.cultivate_time) {
  582. this.culErr = "请填写培养液更换时间"
  583. return
  584. }
  585. let glass = parseInt(
  586. new Date(this.glass_slide_time).getTime() / 1000
  587. );
  588. let cultivate = parseInt(
  589. new Date(this.cultivate_time).getTime() / 1000
  590. );
  591. const res = await this.$myRequest({
  592. url: '/api/api_gateway?method=device.device_manage.updata_spore_time',
  593. data: {
  594. device_type_id: this.type,
  595. d_id: this.equipInfo.d_id,
  596. glass_slide_time: glass,
  597. cultivate_time: cultivate
  598. }
  599. })
  600. if (res) {
  601. this.$refs.toast.show({
  602. title: '修改成功!',
  603. type: 'success',
  604. })
  605. }
  606. this.setTimeShow = false
  607. },
  608. async addYx(d_id) {
  609. const res = await this.$myRequest({
  610. url: '/api/api_gateway?method=device.device_manage.get_spore_time',
  611. data: {
  612. device_type_id: this.type,
  613. d_id
  614. }
  615. })
  616. this.decoy = res.decoy;
  617. this.yxShow = true
  618. },
  619. async yxSubmit() {
  620. if (!this.decoy) {
  621. this.xyErr = "请填写监测害虫名称";
  622. return false
  623. }
  624. const res = await this.$myRequest({
  625. url: '/api/api_gateway?method=device.device_manage.updata_spore_time',
  626. data: {
  627. device_type_id: this.type,
  628. d_id: this.equipInfo.d_id,
  629. decoy: this.decoy
  630. }
  631. })
  632. if (res) {
  633. this.xyErr = ""
  634. this.yxShow = false
  635. }
  636. },
  637. selectaddress(lat, lng) { //获取分布位置
  638. uni.request({
  639. type: "GET",
  640. url: "https://restapi.amap.com/v3/geocode/regeo?output=JSON&location=" + lng + "," + lat +
  641. "&key=27273b81090f78759e4057f94474516f&radius=1000&extensions=all",
  642. dataType: "json",
  643. complete: ress => {
  644. console.log(ress)
  645. this.city = ress.data.regeocode.formatted_address
  646. }
  647. });
  648. },
  649. copy(item) {
  650. console.log(item)
  651. uni.setClipboardData({
  652. data: item.imei || item.device_id,
  653. success: function() {
  654. console.log('success');
  655. }
  656. });
  657. },
  658. glass_slide_timeTime(date) {
  659. if (date === 0) {
  660. return "载玻片未到期";
  661. } else if (date == 1) {
  662. return "载玻片已到期";
  663. } else if (date == 2) {
  664. return "载玻片即将到期";
  665. } else if (date === "") {
  666. return "请设置培养液时间";
  667. }
  668. },
  669. cultivateTime(date) {
  670. console.log(date);
  671. if (date === 0) {
  672. return "培养液未到期";
  673. } else if (date == 1) {
  674. return "培养液已到期";
  675. } else if (date == 2) {
  676. return "培养液即将到期";
  677. } else if (date === "") {
  678. return "请设置培养液时间";
  679. }
  680. }
  681. },
  682. }
  683. </script>
  684. <style lang='scss'>
  685. page {
  686. padding: 20rpx;
  687. box-sizing: border-box;
  688. .info {
  689. padding: 20rpx 40rpx;
  690. color: #fff;
  691. line-height: 50rpx;
  692. font-size: 26rpx;
  693. background-size: 100% auto;
  694. background-repeat: no-repeat;
  695. background-color: #0DC6B6;
  696. background-position: top left;
  697. box-sizing: border-box;
  698. width: 100%;
  699. .tishi {
  700. width: 28rpx;
  701. height: 28rpx;
  702. margin: 0rpx 0 0 20rpx;
  703. }
  704. }
  705. .on {
  706. background-image: url('https://www.hnyfwlw.com:8006/bigdata_app/image/cb/onBg.png')
  707. }
  708. .off {
  709. background-image: url('https://www.hnyfwlw.com:8006/bigdata_app/image/cb/offBg.png')
  710. }
  711. .equip_part {
  712. display: flex;
  713. flex-wrap: wrap;
  714. text-align: center;
  715. font-size: 28rpx;
  716. color: #666;
  717. line-height: 50rpx;
  718. image {
  719. width: 52rpx;
  720. }
  721. .item1 {
  722. padding: 20rpx 0;
  723. box-sizing: border-box;
  724. flex-basis: 25%;
  725. }
  726. .item2 {
  727. padding: 20rpx 10rpx;
  728. box-sizing: border-box;
  729. flex-basis: 33%;
  730. /* flex-grow: 1; */
  731. }
  732. .item3 {
  733. padding: 20rpx 0;
  734. box-sizing: border-box;
  735. flex-basis: 25%;
  736. }
  737. }
  738. .tit {
  739. font-weight: 800;
  740. height: 50rpx;
  741. font-size: 30rpx;
  742. margin-bottom: 20rpx;
  743. display: flex;
  744. justify-content: space-between;
  745. .span {
  746. color: #6e6c76;
  747. font-size: 24rpx;
  748. display: flex;
  749. justify-content: space-between;
  750. /* margin-top: 12rpx; */
  751. }
  752. }
  753. .newtishi {
  754. width: 90%;
  755. margin: 0 auto;
  756. text-align: center;
  757. padding-top: 40rpx;
  758. font-size: 32rpx;
  759. .dataloading:after {
  760. overflow: hidden;
  761. display: inline-block;
  762. vertical-align: bottom;
  763. animation: ellipsis 2s infinite;
  764. content: "\2026";
  765. }
  766. @keyframes ellipsis {
  767. from {
  768. width: 2px;
  769. }
  770. to {
  771. width: 15px;
  772. }
  773. }
  774. }
  775. .newState {
  776. display: flex;
  777. flex-wrap: wrap;
  778. text-align: center;
  779. margin: 0 -10rpx;
  780. .item {
  781. display: flex;
  782. flex-wrap: nowrap;
  783. margin: 10rpx;
  784. width: 345rpx;
  785. justify-content: flex-start;
  786. padding: 20rpx 10rpx;
  787. box-sizing: border-box;
  788. border-radius: 4px;
  789. box-shadow: 0px 0px 5px 3px rgba(136, 136, 136, .1);
  790. font-size: 24rpx;
  791. .info-con {
  792. padding-left: 30rpx;
  793. text-align: left;
  794. line-height: 40rpx;
  795. }
  796. .item_info_img {
  797. width: 30%;
  798. text-align: center;
  799. image {
  800. width: 64rpx;
  801. height: 64rpx;
  802. margin-top: 10rpx;
  803. }
  804. }
  805. }
  806. }
  807. .btn-box {
  808. text-align: center;
  809. padding: 30rpx;
  810. }
  811. .field {
  812. /deep/.uni-input-input {
  813. border: 2rpx solid #FF0000;
  814. border-radius: 24rpx;
  815. width: 140px;
  816. padding-left: 10rpx;
  817. box-sizing: border-box;
  818. }
  819. }
  820. }
  821. /deep/.u-calendar__action {
  822. display: flex;
  823. justify-content: space-around;
  824. .u-calendar__action__text {
  825. line-height: 25px;
  826. }
  827. }
  828. .red {
  829. color: rgb(235, 103, 101);
  830. }
  831. </style>