equip-detail.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865
  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"></image>
  7. </view>
  8. <view class="">
  9. 设备名称:{{equipInfo.device_name?equipInfo.device_name:"无"}}
  10. </view>
  11. <view class="">
  12. 设备类型:<span v-if="equipInfo.type">{{equipInfo.type|equipType}}</span><span v-else>{{equipInfo.type_name}}</span>
  13. </view>
  14. <view class="">
  15. 最新上报时间:{{equipInfo.addtime||equipInfo.uptime | timeFormat}}
  16. </view>
  17. <view class="">
  18. 设备地址:{{equipInfo.address?equipInfo.address:"--"}}
  19. </view>
  20. <view v-if="type==7" @click="setTime(equipInfo.d_id)">
  21. <text space="emsp">载玻片、培养液更换时间</text>
  22. <u-icon name="edit-pen" color="#f0ad4e" size="28"></u-icon>
  23. </view>
  24. <view v-if="type==4" @click="addYx(equipInfo.d_id)">
  25. <text space="emsp">添加诱芯</text>
  26. <u-icon name="edit-pen" color="#f0ad4e" size="28"></u-icon>
  27. </view>
  28. <u-popup v-model="setTimeShow" mode="center" width="600rpx">
  29. <u-field label="载玻片更换时间" placeholder="选择日期" label-width='240' required :error-message="glassErr" v-model="glass_slide_time"
  30. @click="glass_show=true" :field-style="fieldstyle">
  31. </u-field>
  32. <u-field label="培养液更换时间" placeholder="选择日期" label-width='240' required :error-message="culErr" v-model="cultivate_time"
  33. @click="cultivate_show=true" :field-style="fieldstyle">
  34. </u-field>
  35. <view class="btn-box">
  36. <u-button @click="setTimeSubmit" size="mini" type="success">确定</u-button>
  37. </view>
  38. <u-calendar v-model="glass_show" mode="date" :max-date="date" @change="timeChange($event,'glass')"></u-calendar>
  39. <u-calendar v-model="cultivate_show" mode="date" :max-date="date" @change="timeChange($event,'cultivate')"></u-calendar>
  40. </u-popup>
  41. <u-popup v-model="yxShow" mode="center" width="600rpx">
  42. <u-field label="监测害虫名称" label-width='240' required :error-message="xyErr" v-model="decoy" class="field"
  43. :field-style="fieldstyle" placeholder="请填写害虫名称">
  44. </u-field>
  45. <view class="btn-box">
  46. <u-button @click="yxSubmit" size="mini" type="success">确定</u-button>
  47. </view>
  48. </u-popup>
  49. <u-toast ref="toast" />
  50. </view>
  51. <view class="equip_part">
  52. <template v-if="equipInfo.type==7">
  53. <view class="item1" v-for="item in bzy" v-if="item.tf" @click="partClick(item.path)">
  54. <image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+item.icon" mode="widthFix"></image>
  55. <view class="">
  56. {{item.tex}}
  57. </view>
  58. </view>
  59. </template>
  60. <template v-else-if="equipInfo.type==3">
  61. <view class="item2" v-for="item in curEquip" v-if="item.tf" @click="partClick(item.path)">
  62. <image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+item.icon" mode="widthFix"></image>
  63. <view class="">
  64. {{item.tex}}
  65. </view>
  66. </view>
  67. </template>
  68. <template v-else>
  69. <view class="item3" v-for="item in curEquip" v-if="item.tf" @click="partClick(item.path)">
  70. <image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+item.icon" mode="widthFix"></image>
  71. <view class="">
  72. {{item.tex}}
  73. </view>
  74. </view>
  75. </template>
  76. </view>
  77. <view class="tit">
  78. <p>实时数据</p>
  79. <p class="span" @click="partClicks" v-if="equipInfo.type!=4">历史数据>>></p>
  80. </view>
  81. <view class="newtishi" v-if="dataloadingtf">
  82. <p class="dataloading">加载中</p>
  83. </view>
  84. <view class="newtishi" v-else-if="newtishitf">
  85. 暂无数据
  86. </view>
  87. <view class="newState" v-else>
  88. <view class="item" v-for="item in curState">
  89. <view class="item_info_img">
  90. <image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+item.icon" mode="widthFix"></image>
  91. </view>
  92. <view class="info-con">
  93. <view class="active">
  94. {{item.txt}}
  95. </view>
  96. <view class="val">
  97. {{item.value | formatValue(item.txt,type)}}
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. </template>
  104. <script>
  105. import equipState from "../../../static/js/equipState_dict.json"
  106. export default {
  107. data() {
  108. return {
  109. fieldstyle: {
  110. border: "2rpx solid #f6f6f6",
  111. "border-radius": "24px",
  112. "padding-left": "20rpx",
  113. "background-color": "#f6f6f6"
  114. },
  115. city: "",
  116. type: null, //设备类型
  117. device_status: null,
  118. equipInfo: {},
  119. cbd: [{
  120. icon: '/image/cb/1.png',
  121. tex: '查看图片',
  122. path: '/pages/cb/cbd/equip-set/imgpage',
  123. tf: false
  124. },
  125. // {
  126. // icon: '/image/cb/2.png',
  127. // tex: '历史数据',
  128. // path: '/pages/cb/cbd/equip-set/historyfile',
  129. // tf:false
  130. // },
  131. {
  132. icon: '/image/cb/3.png',
  133. tex: '害虫统计',
  134. path: '/pages/cb/cbd/equip-set/statistics',
  135. tf: false
  136. }, {
  137. icon: '/image/cb/4.png',
  138. tex: '设备控制',
  139. path: '/pages/cb/cbd/equip-set/equip-set',
  140. tf: false
  141. }, {
  142. icon: '/image/cb/5.png',
  143. tex: '短信预警',
  144. path: '/pages/cb/cbd/equip-set/note',
  145. tf: false
  146. }, {
  147. icon: '/image/cb/6.png',
  148. tex: 'sim卡详情',
  149. path: '/pages/cb/sim/sim',
  150. tf: true
  151. }, {
  152. icon: '/image/environment/7.png',
  153. tex: '一键报修',
  154. path: '/pages/afterSale/addafter',
  155. tf: true
  156. }
  157. ],
  158. bzy: [{
  159. icon: '/image/cb/4.png',
  160. tex: '设备控制',
  161. path: '/pages/cb/bzy/equip-set/equip-set',
  162. tf: false
  163. }, {
  164. icon: '/image/cb/1.png',
  165. tex: '查看图片',
  166. path: '/pages/cb/cbd/equip-set/imgpage',
  167. tf: false
  168. },
  169. // {
  170. // icon: '/image/cb/2.png',
  171. // tex: '历史数据',
  172. // path: '/pages/cb/bzy/equip-set/bzyhistoryile',
  173. // tf:false
  174. // },
  175. {
  176. icon: '/image/cb/6.png',
  177. tex: 'sim卡详情',
  178. path: '/pages/cb/sim/sim',
  179. tf: false
  180. }, {
  181. icon: '/image/environment/7.png',
  182. tex: '一键报修',
  183. path: '/pages/afterSale/addafter',
  184. tf: true
  185. }
  186. ],
  187. xy: [{
  188. icon: '/image/cb/4.png',
  189. tex: '设备控制',
  190. path: '/pages/cb/xy/equip-set/equip-set',
  191. tf: false
  192. }, {
  193. icon: '/image/cb/6.png',
  194. tex: 'sim卡详情',
  195. path: '/pages/cb/sim/sim',
  196. tf: false
  197. }, {
  198. icon: '/image/cb/2.png',
  199. tex: '历史数据',
  200. path: '/pages/cb/xy/equip-set/xyhistoryile',
  201. tf: false
  202. }, {
  203. icon: '/image/environment/7.png',
  204. tex: '一键报修',
  205. path: '/pages/afterSale/addafter',
  206. tf: true
  207. }],
  208. newState: {}, //设备最新状态
  209. setTimeShow: false,
  210. glass_show: false,
  211. cultivate_show: false,
  212. cultivate_time: "",
  213. glass_slide_time: "",
  214. glassErr: '',
  215. culErr: '',
  216. yxShow: false, //诱芯弹框
  217. xyErr: '',
  218. decoy: '',
  219. newtishitf: false,//暂无数据提示
  220. dataloadingtf:true,//加载中提示
  221. date: "", //日历最大可选日期
  222. }
  223. },
  224. computed: {
  225. curEquip() {
  226. switch (this.type) {
  227. case 3:
  228. return this.cbd;
  229. case 7:
  230. return this.bzy;
  231. case 4:
  232. return this.xy
  233. }
  234. },
  235. curState() {
  236. switch (this.type) {
  237. case 3:
  238. let blbs = "" //灯管状态
  239. if (this.newState.lamp != undefined) {
  240. if (this.newState.ws == 1) {
  241. if (this.newState.lamp == 1) {
  242. blbs = "工作中";
  243. } else if (equipState.lux == 0) {
  244. blbs = "N/A(未检测到传感器)";
  245. } else {
  246. blbs = "异常";
  247. }
  248. } else {
  249. blbs = "关闭";
  250. }
  251. } else {
  252. blbs = "--";
  253. }
  254. return [{
  255. icon: '/image/cb/icon02.png',
  256. txt: '在线状态',
  257. value: Number(this.device_status) == 1 ? '在线' : '离线',
  258. },
  259. {
  260. icon: '/image/cb/icon05.png',
  261. txt: '开关状态',
  262. value: Number(this.newState.ds) == 1 ? '开机' : '关机'
  263. },
  264. {
  265. icon: '/image/cb/icon13.png',
  266. txt: '通道状态',
  267. value: Number(this.newState.upds) == 1 ? '落虫' : '排水'
  268. },
  269. {
  270. icon: '/image/cb/icon10.png',
  271. txt: '加热状态',
  272. value: Number(this.newState.hs) == 1 ? '加热' : '正常'
  273. }, {
  274. icon: '/image/cb/icon08.png',
  275. txt: '环境温度(℃)',
  276. value: this.newState.at == "2.5" || this.newState.at == "25" || this.newState.at == "" || this.newState.at ==
  277. "25.0" ? this.newState.new_tem : this.newState.at
  278. }, {
  279. icon: '/image/cb/icon07.png',
  280. txt: '环境湿度(%)',
  281. value: this.newState.ah == "30" || this.newState.ah == "3.0" || this.newState.ah == "" || this.newState.ah ==
  282. "30.0" ? this.newState.new_hum : this.newState.ah
  283. }, {
  284. icon: '/image/prevention/icon16.png',
  285. txt: '信号强度',
  286. value: this.newState.csq
  287. }, {
  288. icon: '/image/cb/icon12.png',
  289. txt: '设备版本',
  290. value: this.newState.dver
  291. },
  292. {
  293. icon: '/image/cb/icon17.png',
  294. txt: '雨控状态',
  295. value: Number(this.newState.rps) == 1 ? "雨控" : '正常'
  296. }, {
  297. icon: '/image/cb/icon14.png',
  298. txt: '温控状态',
  299. value: Number(this.newState.tps) == 1 ? "温控" : '正常'
  300. }, {
  301. icon: '/image/cb/icon06.png',
  302. txt: '光控状态',
  303. value: Number(this.newState.lps) == 1 ? "光控" : '正常'
  304. }, {
  305. icon: '/image/cb/icon01.png',
  306. txt: '灯管状态',
  307. value: blbs
  308. }, {
  309. icon: '/image/cb/icon11.png',
  310. txt: '上仓门',
  311. value: Number(this.newState.upds) == 1 ? "打开" : '关闭'
  312. }, {
  313. icon: '/image/cb/icon15.png',
  314. txt: '下仓门',
  315. value: Number(this.newState.dnds) == 1 ? "打开" : '关闭'
  316. }
  317. ]
  318. case 7:
  319. return [{
  320. icon: '/image/cb/icon02.png',
  321. txt: '在线状态',
  322. value: Number(this.device_status) == 1 ? '在线' : '离线',
  323. },
  324. {
  325. icon: '/image/cb/icon05.png',
  326. txt: '设备开关',
  327. value: Number(this.newState.ds) == 1 ? '开启' : '关闭'
  328. },
  329. {
  330. icon: '/image/cb/bzy/3.png',
  331. txt: '摄像头状态',
  332. value: this.newState.usb_sta == 1 ? '异常' : '正常'
  333. },
  334. {
  335. icon: '/image/prevention/44.png',
  336. txt: '当前电压',
  337. value: this.newState.v_bat
  338. }, {
  339. icon: '/image/cb/icon08.png',
  340. txt: '环境温度(℃)',
  341. value: this.newState.at == "2.5" || this.newState.at == "25" || this.newState.at == "" || this.newState.at ==
  342. "25.0" ? this.newState.new_tem : this.newState.at
  343. }, {
  344. icon: '/image/prevention/66.png',
  345. txt: '环境湿度(%)',
  346. value: this.newState.ah == "30" || this.newState.ah == "3.0" || this.newState.ah == "" || this.newState.ah ==
  347. "30.0" ? this.newState.new_hum : this.newState.ah
  348. }, {
  349. icon: '/image/prevention/icon16.png',
  350. txt: '信号强度',
  351. value: this.newState.csq
  352. }, {
  353. icon: '/image/cb/bzy/8.png',
  354. txt: '已培养时间',
  355. value: this.newState.staytime
  356. }, {
  357. icon: '/image/cb/icon12.png',
  358. txt: '设备版本',
  359. value: this.newState.dver
  360. }, {
  361. icon: '/image/cb/icon09.png',
  362. txt: '保温仓当前温度',
  363. value: this.newState.pre_temp
  364. }, {
  365. icon: '/image/cb/icon08.png',
  366. txt: '保温仓设定温度',
  367. value: this.newState.set_temp
  368. }
  369. ];
  370. case 4:
  371. return [{
  372. icon: '/image/cb/icon02.png',
  373. txt: '在线状态',
  374. value: Number(this.device_status) == 1 ? '在线' : '离线',
  375. },
  376. {
  377. icon: '/image/cb/icon05.png',
  378. txt: '设备开关',
  379. value: this.newState.ds == 1 ? '开启' : '关闭'
  380. },
  381. {
  382. icon: '/image/cb/icon02.png',
  383. txt: '工作状态',
  384. value: this.newState.ws == 1 ? '工作' : ' 待机'
  385. },
  386. {
  387. icon: '/image/cb/icon12.png',
  388. txt: '设备版本',
  389. value: this.newState.dver
  390. },
  391. {
  392. icon: '/image/cb/icon08.png',
  393. txt: '环境温度(℃)',
  394. value: this.newState.at == "2.5" || this.newState.at == "25" || this.newState.at == "" || this.newState.at ==
  395. "25.0" ? this.newState.new_tem : this.newState.at
  396. },
  397. {
  398. icon: '/image/cb/icon07.png',
  399. txt: '环境湿度(%)',
  400. value: this.newState.ah == "30" || this.newState.ah == "3.0" || this.newState.ah == "" || this.newState.ah ==
  401. "30.0" ? this.newState.new_hum : this.newState.ah
  402. },
  403. {
  404. icon: '/image/prevention/105.png',
  405. txt: '充电电压',
  406. value: this.newState.cv
  407. },
  408. {
  409. icon: '/image/prevention/106.png',
  410. txt: '电池电压',
  411. value: this.newState.bv
  412. },
  413. {
  414. icon: '/image/prevention/icon16.png',
  415. txt: '信号强度',
  416. value: this.newState.csq
  417. },
  418. {
  419. icon: '/image/cb/xy/9.png',
  420. txt: '充电状态',
  421. value: Number(this.newState.cs) == 1 ? '充电' : '正常'
  422. },
  423. {
  424. icon: '/image/cb/xy/10.png',
  425. txt: '电池状态',
  426. value: this.newState.bs
  427. },
  428. ]
  429. }
  430. }
  431. },
  432. filters: {
  433. equipType(type) {
  434. switch (type) {
  435. case 3:
  436. return "虫情测报灯";
  437. case 7:
  438. return "孢子仪";
  439. case 4:
  440. return "性诱测报"
  441. }
  442. },
  443. formatValue(val, a1, a2) {
  444. if (a2 == 4 && a1 == "电池状态") {
  445. switch (Number(val)) {
  446. case 0:
  447. return '正常';
  448. break;
  449. case 1:
  450. return '欠压';
  451. break;
  452. case 2:
  453. return '过压';
  454. break;
  455. }
  456. } else {
  457. return val ? val : '无'
  458. }
  459. }
  460. },
  461. onLoad(option) {
  462. this.equipInfo = JSON.parse(option.info)
  463. this.type = Number(this.equipInfo.type) || Number(this.equipInfo.equip_type) || Number(this.equipInfo.device_type_id)
  464. this.equipInfo.type = this.type
  465. this.device_status = this.equipInfo.is_online
  466. this.getState()
  467. console.log(this.equipInfo)
  468. this.selectaddress(Number(this.equipInfo.lat), Number(this.equipInfo.lng))
  469. var times = new Date()
  470. this.date = times.getFullYear() + 1 + "-" + Number(times.getMonth() + 1) + "-" + times.getDate()
  471. uni.getStorage({
  472. key: "jurisdiction",
  473. success: (res) => {
  474. console.log(JSON.parse(res.data))
  475. let items = JSON.parse(res.data).filter((item) => {
  476. return item.purview_name == "测报系统"
  477. })
  478. console.log(items)
  479. let items2 = items[0].children.filter((item) => {
  480. return item.purview_name == "虫情测报灯"
  481. })
  482. let items3 = items[0].children.filter((item) => {
  483. return item.purview_name == "性诱测报"
  484. })
  485. let items4 = items[0].children.filter((item) => {
  486. return item.purview_name == "孢子仪"
  487. })
  488. console.log(items2)
  489. var arr = items2[0].children
  490. for (var i = 0; i < arr.length; i++) {
  491. switch (arr[i].purview_name) {
  492. case "数据详情":
  493. this.cbd[1].tf = true
  494. break
  495. case "查看图片":
  496. this.cbd[0].tf = true
  497. break
  498. case "设备控制":
  499. this.cbd[3].tf = true
  500. break
  501. case "害虫统计":
  502. this.cbd[2].tf = true
  503. this.cbd[4].tf = true
  504. break
  505. case "SIM卡":
  506. this.cbd[5].tf = true
  507. break
  508. }
  509. }
  510. console.log(items3[0].children)
  511. var arr2 = items3[0].children
  512. for (var i = 0; i < arr2.length; i++) {
  513. switch (arr2[i].purview_name) {
  514. case "设备控制":
  515. this.xy[0].tf = true
  516. break;
  517. case "SIM卡":
  518. this.xy[1].tf = true
  519. break;
  520. case "数据详情":
  521. this.xy[2].tf = true
  522. break;
  523. }
  524. }
  525. console.log(items4[0].children)
  526. var arr3 = items4[0].children
  527. for (var i = 0; i < arr3.length; i++) {
  528. switch (arr3[i].purview_name) {
  529. case "设备控制":
  530. this.bzy[0].tf = true
  531. break;
  532. case "查看图片":
  533. this.bzy[1].tf = true
  534. break;
  535. case "数据详情":
  536. this.bzy[2].tf = true
  537. break;
  538. case "SIM卡":
  539. this.bzy[3].tf = true
  540. break;
  541. }
  542. }
  543. }
  544. })
  545. },
  546. methods: {
  547. async getState() {
  548. this.dataloadingtf =true
  549. const res = await this.$myRequest({
  550. url: '/api/api_gateway?method=forecast.worm_lamp.device_history_data',
  551. data: {
  552. device_type_id: this.equipInfo.type || this.equipInfo.equip_type || this.equipInfo.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. this.dataloadingtf = false
  561. if (res.counts != 0) {
  562. this.newState = res.data[0].d_h_t
  563. this.newtishitf = false
  564. } else {
  565. this.newtishitf = true
  566. }
  567. },
  568. partClick(path) {
  569. console.log(path)
  570. var device_id = this.equipInfo.device_id || this.equipInfo.imei
  571. uni.navigateTo({
  572. url: path + '?d_id=' + this.equipInfo.d_id + "&device_id=" + device_id + "&device_type=" + this.type
  573. });
  574. },
  575. partClicks() {
  576. var path = ""
  577. var device_id = this.equipInfo.device_id || this.equipInfo.imei
  578. if (this.type == 3) {
  579. path = "/pages/cb/cbd/equip-set/historyfile"
  580. } else if (this.type == 7) {
  581. path = "/pages/cb/bzy/equip-set/bzyhistoryile"
  582. } else if (this.type == 4) {
  583. path = "/pages/cb/xy/equip-set/xyhistoryile"
  584. }
  585. uni.navigateTo({
  586. url: path + '?d_id=' + this.equipInfo.d_id + "&device_id=" + device_id + "&device_type=" + this.type
  587. });
  588. },
  589. async setTime(d_id) {
  590. const res = await this.$myRequest({
  591. url: '/api/api_gateway?method=device.device_manage.get_spore_time',
  592. data: {
  593. device_type_id: this.type,
  594. d_id
  595. }
  596. })
  597. this.glass_slide_time = res.glass_slide_time ? this.formatTime(res.glass_slide_time * 1000, 'yyyy-MM-dd') : ''
  598. this.cultivate_time = res.cultivate_time ? this.formatTime(res.cultivate_time * 1000, 'yyyy-MM-dd') : ''
  599. this.setTimeShow = true
  600. },
  601. timeChange(e, a) {
  602. if (a == 'glass') {
  603. this.glass_slide_time = e.result
  604. this.glassErr = ''
  605. } else {
  606. this.cultivate_time = e.result
  607. this.culErr = ''
  608. }
  609. },
  610. async setTimeSubmit() {
  611. if (!this.glass_slide_time) {
  612. this.glassErr = "请填写载玻片更换时间"
  613. }
  614. if (!this.cultivate_time) {
  615. this.culErr = "请填写培养液更换时间"
  616. return
  617. }
  618. let glass = parseInt(
  619. new Date(this.glass_slide_time).getTime() / 1000
  620. );
  621. let cultivate = parseInt(
  622. new Date(this.cultivate_time).getTime() / 1000
  623. );
  624. const res = await this.$myRequest({
  625. url: '/api/api_gateway?method=device.device_manage.updata_spore_time',
  626. data: {
  627. device_type_id: this.type,
  628. d_id: this.equipInfo.d_id,
  629. glass_slide_time: glass,
  630. cultivate_time: cultivate
  631. }
  632. })
  633. if (res) {
  634. this.$refs.toast.show({
  635. title: '修改成功!',
  636. type: 'success',
  637. })
  638. }
  639. this.setTimeShow = false
  640. },
  641. async addYx(d_id) {
  642. const res = await this.$myRequest({
  643. url: '/api/api_gateway?method=device.device_manage.get_spore_time',
  644. data: {
  645. device_type_id: this.type,
  646. d_id
  647. }
  648. })
  649. this.decoy = res.decoy;
  650. this.yxShow = true
  651. },
  652. async yxSubmit() {
  653. if (!this.decoy) {
  654. this.xyErr = "请填写监测害虫名称";
  655. return false
  656. }
  657. const res = await this.$myRequest({
  658. url: '/api/api_gateway?method=device.device_manage.updata_spore_time',
  659. data: {
  660. device_type_id: this.type,
  661. d_id: this.equipInfo.d_id,
  662. decoy: this.decoy
  663. }
  664. })
  665. if (res) {
  666. this.xyErr = ""
  667. this.yxShow = false
  668. }
  669. },
  670. selectaddress(lat, lng) { //获取分布位置
  671. uni.request({
  672. type: "GET",
  673. url: "https://restapi.amap.com/v3/geocode/regeo?output=JSON&location=" + lng + "," + lat +
  674. "&key=27273b81090f78759e4057f94474516f&radius=1000&extensions=all",
  675. dataType: "json",
  676. complete: ress => {
  677. console.log(ress)
  678. this.city = ress.data.regeocode.formatted_address
  679. }
  680. });
  681. },
  682. copy(item) {
  683. console.log(item)
  684. uni.setClipboardData({
  685. data: item.imei || item.device_id,
  686. success: function() {
  687. console.log('success');
  688. }
  689. });
  690. },
  691. },
  692. }
  693. </script>
  694. <style lang='scss'>
  695. page {
  696. padding: 20rpx;
  697. box-sizing: border-box;
  698. .info {
  699. padding: 20rpx 40rpx;
  700. color: #fff;
  701. line-height: 50rpx;
  702. font-size: 26rpx;
  703. background-size: 100% auto;
  704. background-repeat: no-repeat;
  705. background-color: #0DC6B6;
  706. background-position: top left;
  707. box-sizing: border-box;
  708. width: 100%;
  709. .tishi {
  710. width: 28rpx;
  711. height: 28rpx;
  712. margin: 0rpx 0 0 20rpx;
  713. }
  714. }
  715. .on {
  716. background-image: url('http://www.hnyfwlw.com:8006/bigdata_app/image/cb/onBg.png')
  717. }
  718. .off {
  719. background-image: url('http://www.hnyfwlw.com:8006/bigdata_app/image/cb/offBg.png')
  720. }
  721. .equip_part {
  722. display: flex;
  723. flex-wrap: wrap;
  724. text-align: center;
  725. font-size: 28rpx;
  726. color: #666;
  727. line-height: 50rpx;
  728. image {
  729. width: 52rpx;
  730. }
  731. .item1 {
  732. padding: 20rpx 0;
  733. box-sizing: border-box;
  734. flex-basis: 25%;
  735. }
  736. .item2 {
  737. padding: 20rpx 10rpx;
  738. box-sizing: border-box;
  739. flex-basis: 33%;
  740. /* flex-grow: 1; */
  741. }
  742. .item3 {
  743. padding: 20rpx 0;
  744. box-sizing: border-box;
  745. flex-basis: 25%;
  746. }
  747. }
  748. .tit {
  749. font-weight: 800;
  750. height: 50rpx;
  751. font-size: 30rpx;
  752. margin-bottom: 20rpx;
  753. display: flex;
  754. justify-content: space-between;
  755. .span {
  756. color: #6e6c76;
  757. font-size: 24rpx;
  758. display: flex;
  759. justify-content: space-between;
  760. /* margin-top: 12rpx; */
  761. }
  762. }
  763. .newtishi {
  764. width: 90%;
  765. margin: 0 auto;
  766. text-align: center;
  767. padding-top: 40rpx;
  768. font-size: 32rpx;
  769. .dataloading:after {
  770. overflow: hidden;
  771. display: inline-block;
  772. vertical-align: bottom;
  773. animation: ellipsis 2s infinite;
  774. content: "\2026";
  775. }
  776. @keyframes ellipsis {
  777. from {
  778. width: 2px;
  779. }
  780. to {
  781. width: 15px;
  782. }
  783. }
  784. }
  785. .newState {
  786. display: flex;
  787. flex-wrap: wrap;
  788. text-align: center;
  789. margin: 0 -10rpx;
  790. .item {
  791. display: flex;
  792. flex-wrap: nowrap;
  793. margin: 10rpx;
  794. width: 345rpx;
  795. justify-content: flex-start;
  796. padding: 20rpx 10rpx;
  797. box-sizing: border-box;
  798. border-radius: 4px;
  799. box-shadow: 0px 0px 5px 3px rgba(136, 136, 136, .1);
  800. font-size: 24rpx;
  801. .info-con {
  802. padding-left: 30rpx;
  803. text-align: left;
  804. line-height: 40rpx;
  805. }
  806. .item_info_img {
  807. width: 30%;
  808. text-align: center;
  809. image {
  810. width: 64rpx;
  811. height: 64rpx;
  812. margin-top: 10rpx;
  813. }
  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. </style>