equip-detail.vue 25 KB

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