equip-detail.vue 24 KB

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