equip-detail.vue 24 KB

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