equip-detail.vue 22 KB

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