equip-detail.vue 23 KB

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