analyse.vue 25 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060
  1. <template>
  2. <view class="anabox">
  3. <view class="timebox">
  4. <view class="schedulebox">
  5. <view class="schedule" @click="pickertfone=!pickertfone">
  6. <p class="schedule_value">{{yservalue}}</p>
  7. <!-- {{titletext[indexone]}} -->
  8. <p class="schedule_icon">
  9. <u-icon name="arrow-down"></u-icon>
  10. </p>
  11. </view>
  12. <u-picker v-model="pickertfone" mode="selector" @confirm="confirmFun" :default-selector="[yserindex]"
  13. :range="yearlist"></u-picker>
  14. <view class="schedule" @click="pickertfworm=!pickertfworm">
  15. <p class="schedule_value">{{wormvalue}}</p>
  16. <!-- {{titletext[indexone]}} -->
  17. <p class="schedule_icon">
  18. <u-icon name="arrow-down"></u-icon>
  19. </p>
  20. </view>
  21. <u-picker v-model="pickertfworm" mode="selector" @confirm="confirmFun2" :default-selector="[wormindex]"
  22. :range="wormlist"></u-picker>
  23. </view>
  24. <view class="wormtime">
  25. <view class="wormtime_item">
  26. <image src="../../../static/images/cb/shijianqi.png" mode="" class="img"></image>
  27. <p>始见期</p>
  28. <p>{{timeobj.startTime}}</p>
  29. </view>
  30. <view class="wormtime_item">
  31. <image src="../../../static/images/cb/gaofengqi.png" mode="" class="img"></image>
  32. <p>高峰期</p>
  33. <p>{{timeobj.highTime}}</p>
  34. <p>数量:{{timeobj.highNum}}头</p>
  35. </view>
  36. <view class="wormtime_item">
  37. <image src="../../../static/images/cb/zhongjianqi.png" mode="" class="img"></image>
  38. <p>终见期</p>
  39. <p>{{timeobj.endTime}}</p>
  40. </view>
  41. </view>
  42. <view class="selecttimes" @click="tiemshow=!tiemshow">
  43. <view class="" style="line-height: 28px;">
  44. 日期
  45. </view>
  46. <view class="timesbox">
  47. <!-- <image
  48. :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/prevention/1acfe2751c01d3786cdc49b83d7e505.png'"
  49. mode=""></image> -->
  50. <p>{{oldtime}}</p>
  51. <p class="or">至</p>
  52. <p>{{newtime}}</p>
  53. <!-- <u-icon name="rili" custom-prefix="custom-icon" class="icon"></u-icon> -->
  54. </view>
  55. <u-calendar v-model="tiemshow" mode="range" @change="tiemchange"></u-calendar>
  56. <u-button type="primary" text="归档时间" size="mini" @click="timeshow = true">归档时间</u-button>
  57. <u-select v-model="timeshow" mode="mutil-column" :list="list" @confirm="Hourchange" :default-value="defaultValue"></u-select>
  58. </view>
  59. <view class="tendency">
  60. <canvas canvas-id="canvasColumnA" id="canvasColumnA" class="charts" @touchstart="touchLineA($event)"
  61. @touchmove="moveLineA($event)" @touchend="touchEndLineA($event)" disable-scroll=true
  62. :style="{'width':cWidth*pixelRatio+'px','height':cHeight*pixelRatio+'px', 'transform': 'scale('+(1/pixelRatio)+')','margin-left':-cWidth*(pixelRatio-1)/2+'px','margin-top':-cHeight*(pixelRatio-1)/2+'px'}"></canvas>
  63. </view>
  64. <view class="tendency">
  65. <canvas canvas-id="canvasRing" id="canvasRing" class="charts" @touchstart="touchRing"
  66. :style="{'width':cWidth*pixelRatio+'px','height':cHeight*pixelRatio+'px', 'transform': 'scale('+(1/pixelRatio)+')','margin-left':-cWidth*(pixelRatio-1)/2+'px','margin-top':-cHeight*(pixelRatio-1)/2+'px'}"></canvas>
  67. </view>
  68. <view class="tendency_pro">
  69. <view class="" v-for="(item,index) in progresslist">
  70. <span>{{index+1}}、{{item.name}}</span>
  71. <u-line-progress :active-color="colorlist[index%6]"
  72. :percent="Number((item.data/pestsum*100).toFixed(2))" :show-percent="false"></u-line-progress>
  73. <span>{{Number((item.data/pestsum*100).toFixed(2))}}%</span>
  74. </view>
  75. </view>
  76. <view class="tablebox">
  77. <view class="top_text">
  78. <view :class="topindex==index?'title_text_color':'tltle_text'" v-for="(item,index) in toptext"
  79. :key="index" @click="changeindex(index)">
  80. <span class="title_item">
  81. {{item}}
  82. </span>
  83. </view>
  84. </view>
  85. <scroll-view scroll-top="0" scroll-x="true" class="scroll-X">
  86. <table class="table" v-if="topindex==0">
  87. <tr class="tr">
  88. <th class="th" v-for="(item,index) in thdata" :key="'a'+index">{{item}}</th>
  89. </tr>
  90. <tr class="tr" v-for="(items,indexs) in eqlistdata" :key="indexs">
  91. <td class="td">{{items.deviceId}}</td>
  92. <td class="td">{{items.deviceName}}</td>
  93. <td class="td" @click="wormdetails(items.pest_dict)">{{items.pestName}}</td>
  94. <td class="td">{{items.addtime|timeFormat()}}</td>
  95. <td class="td">{{items.location}}</td>
  96. <td class="td" @click="examine(items.indentify_photo)">查看</td>
  97. </tr>
  98. <tr class="tr" v-if="forbidden1">
  99. <td class="td" v-for="item in 6">暂无数据</td>
  100. </tr>
  101. </table>
  102. <table class="table2" v-else>
  103. <tr class="tr">
  104. <th class="th" v-for="(item,index) in thdata2" :key="'a'+index">{{item}}</th>
  105. </tr>
  106. <tr class="tr" v-for="(items,indexs) in eqlistdata" :key="indexs">
  107. <td class="td">{{items.pest_name}}</td>
  108. <td class="td">{{items.pest_num}}</td>
  109. <td class="td">{{items.addtime|timeFormat()}}</td>
  110. </tr>
  111. <tr class="tr" v-if="forbidden2">
  112. <td class="td" v-for="item in 6">暂无数据</td>
  113. </tr>
  114. </table>
  115. </scroll-view>
  116. <view class="pagenumber">
  117. <button @click="prev" :disabled=" page == 1 ">上一页</button>
  118. <view class="pagenumber_page">
  119. 第{{page}}页
  120. </view>
  121. <view class="pagenumber_page">
  122. 共 {{pagesum}} 页
  123. </view>
  124. <button @click="next" :disabled=" page == pagesum ">下一页</button>
  125. </view>
  126. </view>
  127. <u-modal v-model="show" :mask-close-able="true" title="24小时数据">
  128. <view class="modalbox">
  129. <p v-for="(item,key) in pest_dict">{{key}}--{{pest_dict[key]}}头</p>
  130. </view>
  131. </u-modal>
  132. </view>
  133. </view>
  134. </template>
  135. <script>
  136. import uCharts from '../../../components/js_sdk/u-charts/u-charts/u-charts.js';
  137. var canvaColumnA = null;
  138. var canvasRing = null;
  139. export default {
  140. data() {
  141. return {
  142. d_id: "",
  143. oldtime: "",
  144. newtime: "",
  145. sp_hour_st: '00:00', // 归档开始时间
  146. sp_hour_ed: '00:00', // 归档结束时间
  147. timeshow: false, // 归档时间设置弹框
  148. defaultValue:[0,0],
  149. list: [
  150. [{
  151. value: '00:00',
  152. label: '00时'
  153. },
  154. {
  155. value: '01:00',
  156. label: '01时'
  157. },
  158. {
  159. value: '02:00',
  160. label: '02时'
  161. },
  162. {
  163. value: '03:00',
  164. label: '03时'
  165. },
  166. {
  167. value: '04:00',
  168. label: '04时'
  169. },
  170. {
  171. value: '05:00',
  172. label: '05时'
  173. },
  174. {
  175. value: '06:00',
  176. label: '06时'
  177. },
  178. {
  179. value: '07:00',
  180. label: '07时'
  181. },
  182. {
  183. value: '08:00',
  184. label: '08时'
  185. },
  186. {
  187. value: '09:00',
  188. label: '09时'
  189. },
  190. {
  191. value: '10:00',
  192. label: '10时'
  193. },
  194. {
  195. value: '11:00',
  196. label: '11时'
  197. },
  198. {
  199. value: '12:00',
  200. label: '12时'
  201. },
  202. {
  203. value: '13:00',
  204. label: '13时'
  205. },
  206. {
  207. value: '14:00',
  208. label: '14时'
  209. },
  210. {
  211. value: '15:00',
  212. label: '15时'
  213. },
  214. {
  215. value: '16:00',
  216. label: '16时'
  217. },
  218. {
  219. value: '17:00',
  220. label: '17时'
  221. },
  222. {
  223. value: '18:00',
  224. label: '18时'
  225. },
  226. {
  227. value: '19:00',
  228. label: '19时'
  229. },
  230. {
  231. value: '20:00',
  232. label: '20时'
  233. },
  234. {
  235. value: '21:00',
  236. label: '21时'
  237. },
  238. {
  239. value: '22:00',
  240. label: '22时'
  241. },
  242. {
  243. value: '23:00',
  244. label: '23时'
  245. },
  246. ],
  247. [{
  248. value: '00:00',
  249. label: '00时'
  250. },
  251. {
  252. value: '01:00',
  253. label: '01时'
  254. },
  255. {
  256. value: '02:00',
  257. label: '02时'
  258. },
  259. {
  260. value: '03:00',
  261. label: '03时'
  262. },
  263. {
  264. value: '04:00',
  265. label: '04时'
  266. },
  267. {
  268. value: '05:00',
  269. label: '05时'
  270. },
  271. {
  272. value: '06:00',
  273. label: '06时'
  274. },
  275. {
  276. value: '07:00',
  277. label: '07时'
  278. },
  279. {
  280. value: '08:00',
  281. label: '08时'
  282. },
  283. {
  284. value: '09:00',
  285. label: '09时'
  286. },
  287. {
  288. value: '10:00',
  289. label: '10时'
  290. },
  291. {
  292. value: '11:00',
  293. label: '11时'
  294. },
  295. {
  296. value: '12:00',
  297. label: '12时'
  298. },
  299. {
  300. value: '13:00',
  301. label: '13时'
  302. },
  303. {
  304. value: '14:00',
  305. label: '14时'
  306. },
  307. {
  308. value: '15:00',
  309. label: '15时'
  310. },
  311. {
  312. value: '16:00',
  313. label: '16时'
  314. },
  315. {
  316. value: '17:00',
  317. label: '17时'
  318. },
  319. {
  320. value: '18:00',
  321. label: '18时'
  322. },
  323. {
  324. value: '19:00',
  325. label: '19时'
  326. },
  327. {
  328. value: '20:00',
  329. label: '20时'
  330. },
  331. {
  332. value: '21:00',
  333. label: '21时'
  334. },
  335. {
  336. value: '22:00',
  337. label: '22时'
  338. },
  339. {
  340. value: '23:00',
  341. label: '23时'
  342. },
  343. ],
  344. ],
  345. tiemshow: false,
  346. cWidth: '350',
  347. cHeight: '350',
  348. pixelRatio: 1,
  349. pickertfone: false,
  350. yservalue: "",
  351. yearlist: [],
  352. yserindex: "",
  353. pickertfworm: false,
  354. wormvalue: "",
  355. wormlist: [],
  356. wormindex: "",
  357. timeobj: {
  358. endTime: "",
  359. highNum: "",
  360. highTime: "",
  361. startTime: "",
  362. },
  363. progresslist: [],
  364. reslist: {
  365. char_data: {},
  366. at_ah_info: []
  367. },
  368. pestsum: 0,
  369. colorlist: ["rgb(24, 144, 255)", "rgb(47, 194, 91)", "rgb(250, 204, 20)", "rgb(240, 72, 100)",
  370. "rgb(133, 67, 224)", "rgb(144, 237, 125)"
  371. ],
  372. page: 1,
  373. pagesum: 1,
  374. eqlistdata: [],
  375. thdata: [
  376. "设备ID", "设备名称", "害虫名称", "上报时间", "设备位置", "图像"
  377. ],
  378. thdata2: [
  379. "害虫名称", "害虫数量", "上报时间"
  380. ],
  381. topindex: 0,
  382. toptext: ["图像溯源", "虫害基础数据"],
  383. forbidden1: false,
  384. forbidden2: false,
  385. show: false,
  386. pest_dict: {}
  387. }
  388. },
  389. methods: {
  390. getyear() {
  391. var Year = new Date().getFullYear();
  392. var num = Year - 2019;
  393. for (var i = 0; i < num + 1; i++) {
  394. this.yearlist.push(2019 + i);
  395. }
  396. this.yservalue = this.yearlist[this.yearlist.length - 1];
  397. this.yserindex = this.yearlist.length - 1
  398. this.getwormtime()
  399. },
  400. async getwormtime() {
  401. const res = await this.$myRequest({
  402. url: '/api/api_gateway?method=forecast.worm_lamp.pest_raise_info',
  403. data: {
  404. d_ids: this.d_id,
  405. identify_model: 'A',
  406. year: this.yservalue,
  407. device_type: 'xct'
  408. }
  409. })
  410. console.log(res)
  411. this.wormlist = res.pest_list
  412. this.wormtimelist = res.pest_info
  413. this.wormvalue = this.wormlist[0]
  414. this.wormindex = 0
  415. if (this.wormvalue) {
  416. this.timeobj = this.wormtimelist[this.wormvalue]
  417. }
  418. console.log(this.timeobj)
  419. },
  420. confirmFun(e) {
  421. console.log(e)
  422. this.yserindex = e[0]
  423. this.yservalue = this.yearlist[e[0]]
  424. this.getwormtime()
  425. },
  426. confirmFun2(e) {
  427. console.log(e)
  428. this.wormindex = e[0]
  429. this.wormvalue = this.wormlist[e[0]]
  430. this.timeobj = this.wormtimelist[this.wormvalue]
  431. this.setlineoption()
  432. },
  433. async getwormline() {
  434. const res = await this.$myRequest({
  435. url: '/api/api_gateway?method=forecast.worm_lamp.pest_statistics_char_new',
  436. data: {
  437. d_ids: this.d_id,
  438. identify_model: 'A',
  439. start_time: this.oldtime,
  440. end_time: this.newtime,
  441. sp_hour_st: this.sp_hour_st,
  442. sp_hour_ed: this.sp_hour_ed,
  443. device_type: 'xct'
  444. }
  445. })
  446. // console.log(res)
  447. this.reslist.char_data = res.char_data
  448. this.reslist.at_ah_info = res.at_ah_info
  449. var ringarr = []
  450. if (this.checkObj(res.pest_total)) {
  451. for (var key in res.pest_total) {
  452. var nameobj = {
  453. name: '',
  454. data: "",
  455. }
  456. // console.log(key)
  457. nameobj.name = key
  458. nameobj.data = res.pest_total[key]
  459. ringarr.push(nameobj)
  460. }
  461. }
  462. this.setlineoption()
  463. // this.showRing(ringarr)
  464. var num = 0
  465. for (var i = 0; i < ringarr.length - 5; i++) {
  466. console.log(ringarr[i].name)
  467. num += ringarr[i].data
  468. }
  469. this.pestsum = 0
  470. for (var i = 0; i < ringarr.length; i++) {
  471. this.pestsum += ringarr[i].data
  472. }
  473. var sumobj = {
  474. name: "其他",
  475. data: num,
  476. }
  477. var ringarr2 = ringarr.slice(ringarr.length - 5)
  478. ringarr2.unshift(sumobj)
  479. // console.log(ringarr2)
  480. this.showRing(ringarr2)
  481. console.log(ringarr)
  482. this.progresslist = ringarr
  483. },
  484. setlineoption() {
  485. var res = this.reslist
  486. var xtitle = []
  487. var obj = []
  488. if (res.at_ah_info.length != 0) {
  489. var aharr = []
  490. var atarr = []
  491. var pestArr = []
  492. let indentText = 0;
  493. for (var i = 0; i < res.at_ah_info.length; i++) {
  494. var times = new Date(res.at_ah_info[i].addtime * 1000)
  495. xtitle.push(times.getMonth() + 1 + "/" + times.getDate())
  496. atarr.push(res.at_ah_info[i].at == "" ? "0" : res.at_ah_info[i].at)
  497. aharr.push(res.at_ah_info[i].ah == "" ? "0" : res.at_ah_info[i].ah)
  498. if (this.checkObj(res.char_data) && res.char_data[this.wormvalue]) {
  499. if (res.char_data[this.wormvalue][i - indentText] && (res.char_data[this.wormvalue][i -
  500. indentText
  501. ].addtime == res.at_ah_info[i].addtime)) {
  502. pestArr.push(res.char_data[this.wormvalue][i - indentText].sum)
  503. } else {
  504. indentText++
  505. pestArr.push(null)
  506. }
  507. }
  508. }
  509. // console.log(this.wormvalue)
  510. // if (this.checkObj(res.char_data)) {
  511. // for (var key in res.char_data) {
  512. // if (this.wormvalue == key) {
  513. // var wormobj = {
  514. // name: key,
  515. // data: [],
  516. // }
  517. // for (var i = 0; i < res.char_data[key].length; i++) {
  518. // wormobj.data.push(res.char_data[key][i].ah == "" ? "0" : res.char_data[key][i].sum)
  519. // }
  520. // obj.push(wormobj)
  521. // }
  522. // }
  523. // }
  524. var atobj = {
  525. name: '温度',
  526. data: atarr,
  527. color: '#00E29D'
  528. }
  529. var ahobj = {
  530. name: '湿度',
  531. data: aharr,
  532. color: '#6CBBFF'
  533. }
  534. var pestObj = {
  535. name: this.wormvalue,
  536. data: pestArr,
  537. }
  538. obj.push(atobj)
  539. obj.push(ahobj)
  540. obj.push(pestObj)
  541. }
  542. this.showColumn("canvasColumnA", xtitle, obj)
  543. },
  544. checkObj(obj) {
  545. for (let i in obj) {
  546. return true;
  547. }
  548. return false;
  549. },
  550. tiemchange(e) {
  551. console.log(e)
  552. // this.oldtime = +new Date(e.startDate) / 1000 - 8 * 60 * 60
  553. // this.newtime = +new Date(e.endDate) / 1000 + 16 * 60 * 60 - 1
  554. this.newtime = e.endDate;
  555. this.oldtime = e.startDate;
  556. // newtime: "",
  557. console.log(this.oldtime, this.newtime)
  558. this.page = 1
  559. this.getwormline()
  560. if (this.topindex == 0) {
  561. this.gettabledata()
  562. } else if (this.topindex == 1) {
  563. this.gettabledata2()
  564. }
  565. },
  566. Hourchange(e) {
  567. this.sp_hour_st = e[0].value;
  568. this.sp_hour_ed = e[1].value;
  569. // 本地缓存
  570. uni.setStorageSync('sp_hour_st_xc', this.sp_hour_st);
  571. uni.setStorageSync('sp_hour_ed_xc', this.sp_hour_ed);
  572. this.getyear();
  573. console.log(e)
  574. },
  575. timetab(e) {
  576. e = new Date(e * 1000)
  577. var year = e.getFullYear()
  578. var month = e.getMonth() + 1 < 10 ? "0" + (e.getMonth() + 1) : e.getMonth() + 1
  579. var day = e.getDate() < 10 ? "0" + e.getDate() : e.getDate()
  580. var time = year + "/" + month + "/" + day
  581. return time
  582. },
  583. showColumn(id, xtitle, xinfo) {
  584. var _self = this
  585. canvaColumnA = new uCharts({
  586. canvasId: id,
  587. type: 'line',
  588. legend: {
  589. position: "top"
  590. },
  591. fontSize: 11,
  592. background: '#FFFFFF',
  593. pixelRatio: 1,
  594. animation: true,
  595. dataLabel: false,
  596. categories: xtitle,
  597. series: xinfo,
  598. enableScroll: true, //开启图表拖拽功能
  599. xAxis: {
  600. disableGrid: true,
  601. type: 'grid',
  602. gridType: 'dash',
  603. itemCount: 5, //x轴单屏显示数据的数量,默认为5个
  604. scrollShow: true, //新增是否显示滚动条,默认false
  605. // scrollAlign: 'left', //滚动条初始位置
  606. scrollBackgroundColor: '#F7F7FF', //默认为 #EFEBEF
  607. scrollColor: '#DEE7F7', //默认为 #A6A6A6
  608. },
  609. yAxis: {},
  610. width: _self.cWidth * 1,
  611. height: _self.cHeight * 1,
  612. extra: {
  613. line: {
  614. type: 'curve'
  615. }
  616. }
  617. });
  618. },
  619. touchLineA(e) {
  620. console.log(e)
  621. canvaColumnA.scrollStart(e);
  622. },
  623. moveLineA(e) {
  624. canvaColumnA.scroll(e);
  625. },
  626. touchEndLineA(e) {
  627. canvaColumnA.scrollEnd(e);
  628. //下面是toolTip事件,如果滚动后不需要显示,可不填写
  629. canvaColumnA.showToolTip(e, {
  630. format: function(item, category) {
  631. return category + ' ' + item.name + ':' + item.data
  632. }
  633. });
  634. },
  635. showRing(data) {
  636. var _self = this
  637. canvasRing = new uCharts({
  638. canvasId: "canvasRing",
  639. type: 'ring',
  640. fontSize: 11,
  641. legend: {
  642. show: true,
  643. },
  644. extra: {
  645. pie: {
  646. offsetAngle: -45,
  647. ringWidth: 40 * _self.pixelRatio,
  648. labelWidth: 15
  649. }
  650. },
  651. background: '#FFFFFF',
  652. pixelRatio: _self.pixelRatio,
  653. series: data,
  654. animation: true,
  655. width: _self.cWidth * _self.pixelRatio,
  656. height: _self.cHeight * _self.pixelRatio,
  657. disablePieStroke: true,
  658. dataLabel: true,
  659. });
  660. },
  661. touchRing(e) {
  662. canvasRing.showToolTip(e, {
  663. format: function(item) {
  664. return item.name + ':' + item.data
  665. }
  666. });
  667. },
  668. tap(e) {
  669. canvasgroup[e.target.id].touchLegend(e);
  670. canvasgroup[e.target.id].showToolTip(e);
  671. },
  672. async gettabledata() {
  673. const res = await this.$myRequest({
  674. url: '/api/api_gateway?method=forecast.worm_lamp.pest_image_source',
  675. data: {
  676. d_ids: this.d_id,
  677. identify_model: 'A',
  678. start_time: this.oldtime,
  679. end_time: this.newtime,
  680. sp_hour_st: this.sp_hour_st,
  681. sp_hour_ed: this.sp_hour_ed,
  682. page: this.page,
  683. device_type: 'xct'
  684. }
  685. })
  686. this.pagesum = Math.ceil(res.total_count / 10)
  687. this.eqlistdata = res.pest_image_data
  688. if (this.eqlistdata.length == 0) {
  689. this.forbidden1 = true
  690. } else {
  691. this.forbidden1 = false
  692. }
  693. console.log(res)
  694. },
  695. async gettabledata2() {
  696. const res = await this.$myRequest({
  697. url: '/api/api_gateway?method=forecast.worm_lamp.pest_base_data',
  698. data: {
  699. d_ids: this.d_id,
  700. identify_model: 'A',
  701. start_time: this.oldtime,
  702. end_time: this.newtime,
  703. sp_hour_st: this.sp_hour_st,
  704. sp_hour_ed: this.sp_hour_ed,
  705. page: this.page
  706. }
  707. })
  708. this.pagesum = Math.ceil(res.total_count / 10)
  709. this.eqlistdata = res.pest_image_data
  710. if (this.eqlistdata.length == 0) {
  711. this.forbidden2 = true
  712. } else {
  713. this.forbidden2 = false
  714. }
  715. console.log(res)
  716. },
  717. changeindex(e) {
  718. this.topindex = e
  719. this.page = 1
  720. if (e == 0) {
  721. this.gettabledata()
  722. } else if (e == 1) {
  723. this.gettabledata2()
  724. }
  725. },
  726. prev() {
  727. this.page--
  728. if (this.topindex == 0) {
  729. this.gettabledata()
  730. } else if (this.topindex == 1) {
  731. this.gettabledata2()
  732. }
  733. },
  734. next() {
  735. this.page++
  736. if (this.topindex == 0) {
  737. this.gettabledata()
  738. } else if (this.topindex == 1) {
  739. this.gettabledata2()
  740. }
  741. },
  742. wormdetails(data) {
  743. console.log(data)
  744. this.show = true
  745. this.pest_dict = data
  746. },
  747. examine(url) {
  748. var imgarr = [url]
  749. uni.previewImage({
  750. urls: imgarr,
  751. current: 0
  752. });
  753. },
  754. },
  755. onLoad(option) {
  756. this.d_id = option.d_id
  757. var date = +new Date()
  758. this.oldtime = this.formatTime(date, 'yyyy-MM-dd');
  759. this.newtime = this.formatTime(date, 'yyyy-MM-dd');
  760. this.sp_hour_st = uni.getStorageSync('sp_hour_st_xc') == '' ? '00:00' : uni.getStorageSync('sp_hour_st_xc');
  761. this.sp_hour_ed = uni.getStorageSync('sp_hour_ed_xc') == '' ? '00:00' : uni.getStorageSync('sp_hour_ed_xc');
  762. this.defaultValue=[this.sp_hour_st.substring(0, 1) == '0' ? this.sp_hour_st.substring(1, 2): this.sp_hour_st.substring(0, 2), this.sp_hour_ed.substring(0, 1) == '0' ? this.sp_hour_ed.substring(1, 2): this.sp_hour_ed.substring(0, 2)]
  763. this.cWidth = uni.upx2px(650);
  764. this.cHeight = uni.upx2px(500);
  765. this.getyear()
  766. this.$nextTick(() => {
  767. this.getwormline()
  768. if (this.topindex == 0) {
  769. this.gettabledata()
  770. } else if (this.topindex == 1) {
  771. this.gettabledata2()
  772. }
  773. }, 500)
  774. }
  775. }
  776. </script>
  777. <style lang="scss">
  778. .anabox {
  779. background-color: #f1f4ff;
  780. padding-top: 10px;
  781. }
  782. .selecttimes {
  783. // box-shadow: 0 0 10rpx #bcb9ca;
  784. // padding: 10rpx 20rpx;
  785. padding: 10px;
  786. box-sizing: border-box;
  787. margin: 10px auto 0;
  788. display: flex;
  789. background-color: #fff;
  790. width: 95%;
  791. .timesbox {
  792. display: flex;
  793. justify-content: space-around;
  794. width: 60%;
  795. margin-left: 10px;
  796. border: 1px solid #CCCCCC;
  797. padding: 5px;
  798. font-size: 12px;
  799. border-radius: 5px;
  800. image {
  801. width: 30rpx;
  802. height: 30rpx;
  803. margin-top: 6rpx;
  804. }
  805. .icon {
  806. color: #949494;
  807. text-align: right;
  808. margin-left: 30rpx;
  809. }
  810. }
  811. }
  812. .wormtime {
  813. width: 95%;
  814. padding: 10px;
  815. box-sizing: border-box;
  816. margin: 0 auto;
  817. // margin-top: 10px;
  818. display: flex;
  819. justify-content: space-around;
  820. background-color: #fff;
  821. .wormtime_item {
  822. width: 25%;
  823. margin-top: 10px;
  824. padding: 10px;
  825. .img {
  826. width: 50px;
  827. height: 50px;
  828. }
  829. p:nth-child(2) {
  830. font-size: 16px;
  831. font-weight: 700;
  832. }
  833. p:nth-child(3) {
  834. font-size: 12px;
  835. margin-top: 5px;
  836. }
  837. p:last-child {
  838. font-size: 12px;
  839. margin-top: 5px;
  840. }
  841. }
  842. .wormtime_item:first-child {
  843. background-color: #F9FAFE;
  844. }
  845. .wormtime_item:nth-child(2) {
  846. background-color: #FFFCF9;
  847. }
  848. .wormtime_item:last-child {
  849. background-color: #FCF8FF;
  850. }
  851. }
  852. .schedulebox {
  853. display: flex;
  854. padding: 10px 10px;
  855. box-sizing: border-box;
  856. width: 95%;
  857. // justify-content: space-around;
  858. margin: 0px auto;
  859. background-color: #fff;
  860. .schedule {
  861. display: flex;
  862. width: 240rpx;
  863. height: 50rpx;
  864. // border: 2rpx solid #F0F0F0;
  865. margin-right: 20rpx;
  866. background-color: #F9FAFC;
  867. border-radius: 25px;
  868. .schedule_value {
  869. width: 70%;
  870. text-align: center;
  871. line-height: 50rpx;
  872. font-size: 24rpx;
  873. }
  874. .schedule_icon {
  875. width: 30%;
  876. // background-color: #F2F2F2;
  877. text-align: center;
  878. line-height: 50rpx;
  879. /deep/.u-icon__icon{
  880. color: rgba(0,0,0,0.3);
  881. }
  882. }
  883. }
  884. }
  885. .tendency {
  886. width: 95%;
  887. display: flex;
  888. justify-content: space-around;
  889. margin: 0 auto;
  890. background-color: #fff;
  891. }
  892. .tendency_pro {
  893. width: 95%;
  894. padding: 0 20px;
  895. box-sizing: border-box;
  896. height: 140px;
  897. overflow-y: auto;
  898. margin: 0 auto;
  899. background-color: #fff;
  900. span:first-child {
  901. display: inline-block;
  902. width: 100px;
  903. overflow: hidden; //溢出隐藏
  904. white-space: nowrap; //禁止换行
  905. text-overflow: ellipsis; //...
  906. }
  907. .u-progress {
  908. width: calc(100% - 150px);
  909. }
  910. span:last-child {
  911. display: inline-block;
  912. width: 30px;
  913. margin-left: 10px;
  914. }
  915. }
  916. .tablebox {
  917. display: flex;
  918. flex-wrap: wrap;
  919. width: 95%;
  920. margin: 10px auto 20px;
  921. // box-shadow: 0 0 10rpx #bcb9ca;
  922. background-color: #fff;
  923. .top_text {
  924. width: 100%;
  925. display: flex;
  926. height: 30px;
  927. line-height: 30px;
  928. .tltle_text {
  929. width: 30%;
  930. text-align: center;
  931. // border: 2rpx solid #F0F0F0;
  932. // text-align: center;
  933. // background-color: #F0F0F0;
  934. // color: #000;
  935. }
  936. .title_text_color {
  937. width: 30%;
  938. text-align: center;
  939. .title_item{
  940. border-bottom: 2px solid #64CC82;
  941. color: #64CC82;
  942. }
  943. // width: 50%;
  944. // border: 2rpx solid #64CC82;
  945. // background-color: #64CC82;
  946. // color: #fff;
  947. // text-align: center;
  948. }
  949. }
  950. .scroll-X {
  951. width: 95%;
  952. margin: 20rpx auto;
  953. .table {
  954. width: 1800rpx;
  955. .td:nth-child(3),
  956. .td:last-child {
  957. color: #37aed8;
  958. }
  959. }
  960. .tr {
  961. display: flex;
  962. overflow: hidden;
  963. .th,
  964. .td {
  965. display: inline-block;
  966. padding: 5rpx;
  967. text-align: center;
  968. height: 52rpx;
  969. line-height: 52rpx;
  970. width: 320rpx;
  971. }
  972. }
  973. .tr:nth-child(2n-1) {
  974. background-color: #f5fff8;
  975. }
  976. .tr:first-child {
  977. background-color: #57c878;
  978. color: #fff;
  979. }
  980. }
  981. .pagenumber {
  982. display: flex;
  983. margin: 20rpx auto;
  984. button {
  985. width: 150rpx;
  986. height: 50rpx;
  987. line-height: 50rpx;
  988. font-size: 26rpx;
  989. text-align: center;
  990. background-color: #57c878;
  991. color: #FFFFFF;
  992. }
  993. .pagenumber_page {
  994. width: 150rpx;
  995. height: 50rpx;
  996. line-height: 50rpx;
  997. font-size: 26rpx;
  998. text-align: center;
  999. }
  1000. }
  1001. }
  1002. .modalbox {
  1003. width: 100%;
  1004. // display: flex;
  1005. // flex-wrap: wrap;
  1006. height: 120px;
  1007. padding-left: 30px;
  1008. margin-top: 10px;
  1009. overflow-y: auto;
  1010. p {
  1011. // width: 50%;
  1012. }
  1013. }
  1014. /deep/.u-calendar__action {
  1015. display: flex;
  1016. justify-content: space-around;
  1017. .u-calendar__action__text {
  1018. line-height: 25px;
  1019. }
  1020. }
  1021. </style>