analyse.vue 24 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066
  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. }
  408. })
  409. console.log(res)
  410. this.wormlist = res.pest_list
  411. this.wormtimelist = res.pest_info
  412. this.wormvalue = this.wormlist[0]
  413. this.wormindex = 0
  414. if (this.wormvalue) {
  415. this.timeobj = this.wormtimelist[this.wormvalue]
  416. }
  417. this.$nextTick(() => {
  418. this.getwormline()
  419. if (this.topindex == 0) {
  420. this.gettabledata()
  421. } else if (this.topindex == 1) {
  422. this.gettabledata2()
  423. }
  424. }, 500)
  425. console.log(this.timeobj)
  426. },
  427. confirmFun(e) {
  428. console.log(e)
  429. this.yserindex = e[0]
  430. this.yservalue = this.yearlist[e[0]]
  431. this.getwormtime()
  432. },
  433. confirmFun2(e) {
  434. console.log(e)
  435. this.wormindex = e[0]
  436. this.wormvalue = this.wormlist[e[0]]
  437. this.timeobj = this.wormtimelist[this.wormvalue]
  438. this.setlineoption()
  439. },
  440. async getwormline() {
  441. const res = await this.$myRequest({
  442. url: '/api/api_gateway?method=forecast.worm_lamp.pest_statistics_char_new',
  443. data: {
  444. d_ids: this.d_id,
  445. identify_model: 'A',
  446. start_time: this.oldtime,
  447. end_time: this.newtime,
  448. sp_hour_st: this.sp_hour_st,
  449. sp_hour_ed: this.sp_hour_ed,
  450. }
  451. })
  452. // console.log(res)
  453. this.reslist.char_data = res.char_data
  454. this.reslist.at_ah_info = res.at_ah_info
  455. var ringarr = []
  456. if (this.checkObj(res.pest_total)) {
  457. for (var key in res.pest_total) {
  458. var nameobj = {
  459. name: '',
  460. data: "",
  461. }
  462. // console.log(key)
  463. nameobj.name = key
  464. nameobj.data = res.pest_total[key]
  465. ringarr.push(nameobj)
  466. }
  467. }
  468. this.setlineoption()
  469. // this.showRing(ringarr)
  470. var num = 0
  471. for (var i = 0; i < ringarr.length - 5; i++) {
  472. console.log(ringarr[i].name)
  473. num += ringarr[i].data
  474. }
  475. this.pestsum = 0
  476. for (var i = 0; i < ringarr.length; i++) {
  477. this.pestsum += ringarr[i].data
  478. }
  479. var sumobj = {
  480. name: "其他",
  481. data: num,
  482. }
  483. var ringarr2 = ringarr.slice(ringarr.length - 5)
  484. ringarr2.unshift(sumobj)
  485. // console.log(ringarr2)
  486. this.showRing(ringarr2)
  487. console.log(ringarr)
  488. this.progresslist = ringarr
  489. },
  490. setlineoption() {
  491. var res = this.reslist
  492. var xtitle = []
  493. var obj = []
  494. if (res.at_ah_info.length != 0) {
  495. var aharr = []
  496. var atarr = []
  497. var pestArr = []
  498. let indentText = 0;
  499. for (var i = 0; i < res.at_ah_info.length; i++) {
  500. var times = new Date(res.at_ah_info[i].addtime * 1000)
  501. xtitle.push(times.getMonth() + 1 + "/" + times.getDate())
  502. atarr.push(res.at_ah_info[i].at == "" ? "0" : res.at_ah_info[i].at)
  503. aharr.push(res.at_ah_info[i].ah == "" ? "0" : res.at_ah_info[i].ah)
  504. if (this.checkObj(res.char_data) && res.char_data[this.wormvalue]) {
  505. if (res.char_data[this.wormvalue][i - indentText] && (res.char_data[this.wormvalue][i -
  506. indentText
  507. ].addtime == res.at_ah_info[i].addtime)) {
  508. pestArr.push(res.char_data[this.wormvalue][i - indentText].sum)
  509. } else {
  510. indentText++
  511. pestArr.push(null)
  512. }
  513. }
  514. }
  515. // console.log(this.wormvalue)
  516. // if (this.checkObj(res.char_data)) {
  517. // for (var key in res.char_data) {
  518. // if (this.wormvalue == key) {
  519. // var wormobj = {
  520. // name: key,
  521. // data: [],
  522. // }
  523. // for (var i = 0; i < res.char_data[key].length; i++) {
  524. // wormobj.data.push(res.char_data[key][i].ah == "" ? "0" : res.char_data[key][i].sum)
  525. // }
  526. // obj.push(wormobj)
  527. // }
  528. // }
  529. // }
  530. var atobj = {
  531. name: '温度',
  532. data: atarr,
  533. color: '#00E29D'
  534. }
  535. var ahobj = {
  536. name: '湿度',
  537. data: aharr,
  538. color: '#6CBBFF'
  539. }
  540. var pestObj = {
  541. name: this.wormvalue,
  542. data: pestArr,
  543. }
  544. obj.push(atobj)
  545. obj.push(ahobj)
  546. obj.push(pestObj)
  547. }
  548. this.showColumn("canvasColumnA", xtitle, obj)
  549. },
  550. checkObj(obj) {
  551. for (let i in obj) {
  552. return true;
  553. }
  554. return false;
  555. },
  556. tiemchange(e) {
  557. console.log(e)
  558. // this.oldtime = +new Date(e.startDate) / 1000 - 8 * 60 * 60
  559. // this.newtime = +new Date(e.endDate) / 1000 + 16 * 60 * 60 - 1
  560. this.newtime = e.endDate;
  561. this.oldtime = e.startDate;
  562. // newtime: "",
  563. console.log(this.oldtime, this.newtime)
  564. this.page = 1
  565. this.getwormline()
  566. if (this.topindex == 0) {
  567. this.gettabledata()
  568. } else if (this.topindex == 1) {
  569. this.gettabledata2()
  570. }
  571. },
  572. Hourchange(e) {
  573. this.sp_hour_st = e[0].value;
  574. this.sp_hour_ed = e[1].value;
  575. // 本地缓存
  576. uni.setStorageSync('sp_hour_st', this.sp_hour_st);
  577. uni.setStorageSync('sp_hour_ed', this.sp_hour_ed);
  578. this.getyear();
  579. console.log(e)
  580. },
  581. timetab(e) {
  582. // e = new Date(e * 1000)
  583. // var year = e.getFullYear()
  584. // var month = e.getMonth() + 1 < 10 ? "0" + (e.getMonth() + 1) : e.getMonth() + 1
  585. // var day = e.getDate() < 10 ? "0" + e.getDate() : e.getDate()
  586. // var time = year + "/" + month + "/" + day
  587. // return time
  588. },
  589. showColumn(id, xtitle, xinfo) {
  590. var _self = this
  591. canvaColumnA = new uCharts({
  592. canvasId: id,
  593. type: 'line',
  594. legend: {
  595. position: "top"
  596. },
  597. fontSize: 11,
  598. background: '#FFFFFF',
  599. pixelRatio: 1,
  600. animation: true,
  601. dataLabel: false,
  602. categories: xtitle,
  603. series: xinfo,
  604. enableScroll: true, //开启图表拖拽功能
  605. xAxis: {
  606. disableGrid: true,
  607. type: 'grid',
  608. gridType: 'dash',
  609. itemCount: 5, //x轴单屏显示数据的数量,默认为5个
  610. scrollShow: true, //新增是否显示滚动条,默认false
  611. // scrollAlign: 'left', //滚动条初始位置
  612. scrollBackgroundColor: '#F7F7FF', //默认为 #EFEBEF
  613. scrollColor: '#DEE7F7', //默认为 #A6A6A6
  614. },
  615. yAxis: {},
  616. width: _self.cWidth * 1,
  617. height: _self.cHeight * 1,
  618. extra: {
  619. line: {
  620. type: 'curve'
  621. }
  622. }
  623. });
  624. },
  625. touchLineA(e) {
  626. console.log(e)
  627. canvaColumnA.scrollStart(e);
  628. },
  629. moveLineA(e) {
  630. canvaColumnA.scroll(e);
  631. },
  632. touchEndLineA(e) {
  633. canvaColumnA.scrollEnd(e);
  634. //下面是toolTip事件,如果滚动后不需要显示,可不填写
  635. canvaColumnA.showToolTip(e, {
  636. format: function(item, category) {
  637. return category + ' ' + item.name + ':' + item.data
  638. }
  639. });
  640. },
  641. showRing(data) {
  642. var _self = this
  643. canvasRing = new uCharts({
  644. canvasId: "canvasRing",
  645. type: 'ring',
  646. fontSize: 11,
  647. legend: {
  648. show: true,
  649. },
  650. extra: {
  651. pie: {
  652. offsetAngle: -45,
  653. ringWidth: 40 * _self.pixelRatio,
  654. labelWidth: 15
  655. }
  656. },
  657. background: '#FFFFFF',
  658. pixelRatio: _self.pixelRatio,
  659. series: data,
  660. animation: true,
  661. width: _self.cWidth * _self.pixelRatio,
  662. height: _self.cHeight * _self.pixelRatio,
  663. disablePieStroke: true,
  664. dataLabel: true,
  665. });
  666. },
  667. touchRing(e) {
  668. canvasRing.showToolTip(e, {
  669. format: function(item) {
  670. return item.name + ':' + item.data
  671. }
  672. });
  673. },
  674. tap(e) {
  675. canvasgroup[e.target.id].touchLegend(e);
  676. canvasgroup[e.target.id].showToolTip(e);
  677. },
  678. async gettabledata() {
  679. const res = await this.$myRequest({
  680. url: '/api/api_gateway?method=forecast.worm_lamp.pest_image_source',
  681. data: {
  682. d_ids: this.d_id,
  683. identify_model: 'A',
  684. start_time: this.oldtime,
  685. end_time: this.newtime,
  686. sp_hour_st: this.sp_hour_st,
  687. sp_hour_ed: this.sp_hour_ed,
  688. page: this.page
  689. }
  690. })
  691. this.pagesum = Math.ceil(res.total_count / 10)
  692. this.eqlistdata = res.pest_image_data
  693. if (this.eqlistdata.length == 0) {
  694. this.forbidden1 = true
  695. } else {
  696. this.forbidden1 = false
  697. }
  698. console.log(res)
  699. },
  700. async gettabledata2() {
  701. const res = await this.$myRequest({
  702. url: '/api/api_gateway?method=forecast.worm_lamp.pest_base_data',
  703. data: {
  704. d_ids: this.d_id,
  705. identify_model: 'A',
  706. start_time: this.oldtime,
  707. end_time: this.newtime,
  708. page: this.page
  709. }
  710. })
  711. this.pagesum = Math.ceil(res.total_count / 10)
  712. this.eqlistdata = res.pest_image_data
  713. if (this.eqlistdata.length == 0) {
  714. this.forbidden2 = true
  715. } else {
  716. this.forbidden2 = false
  717. }
  718. console.log(res)
  719. },
  720. changeindex(e) {
  721. this.topindex = e
  722. this.page = 1
  723. if (e == 0) {
  724. this.gettabledata()
  725. } else if (e == 1) {
  726. this.gettabledata2()
  727. }
  728. },
  729. prev() {
  730. this.page--
  731. if (this.topindex == 0) {
  732. this.gettabledata()
  733. } else if (this.topindex == 1) {
  734. this.gettabledata2()
  735. }
  736. },
  737. next() {
  738. this.page++
  739. if (this.topindex == 0) {
  740. this.gettabledata()
  741. } else if (this.topindex == 1) {
  742. this.gettabledata2()
  743. }
  744. },
  745. wormdetails(data) {
  746. console.log(data)
  747. this.show = true
  748. this.pest_dict = data
  749. },
  750. examine(url) {
  751. var imgarr = [url]
  752. uni.previewImage({
  753. urls: imgarr,
  754. current: 0
  755. });
  756. },
  757. },
  758. onLoad(option) {
  759. this.d_id = option.d_id
  760. var date = +new Date()
  761. this.oldtime = this.formatTime(date, 'yyyy-MM-dd');
  762. this.newtime = this.formatTime(date, 'yyyy-MM-dd');
  763. this.sp_hour_st = uni.getStorageSync('sp_hour_st') == '' ? '00:00' : uni.getStorageSync('sp_hour_st');
  764. this.sp_hour_ed = uni.getStorageSync('sp_hour_ed') == '' ? '00:00' : uni.getStorageSync('sp_hour_ed');
  765. 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)]
  766. this.cWidth = uni.upx2px(650);
  767. this.cHeight = uni.upx2px(500);
  768. this.getyear()
  769. }
  770. }
  771. </script>
  772. <style lang="scss">
  773. .anabox {
  774. background-color: #f1f4ff;
  775. padding-top: 10px;
  776. }
  777. .selecttimes {
  778. // box-shadow: 0 0 10rpx #bcb9ca;
  779. // padding: 10rpx 20rpx;
  780. padding: 10px;
  781. box-sizing: border-box;
  782. margin: 10px auto 0;
  783. display: flex;
  784. background-color: #fff;
  785. width: 95%;
  786. .timesbox {
  787. display: flex;
  788. justify-content: space-around;
  789. width: 60%;
  790. margin-left: 10px;
  791. border: 1px solid #CCCCCC;
  792. padding: 5px;
  793. font-size: 12px;
  794. border-radius: 5px;
  795. image {
  796. width: 30rpx;
  797. height: 30rpx;
  798. margin-top: 6rpx;
  799. }
  800. .icon {
  801. color: #949494;
  802. text-align: right;
  803. margin-left: 30rpx;
  804. }
  805. }
  806. }
  807. .wormtime {
  808. width: 95%;
  809. padding: 10px;
  810. box-sizing: border-box;
  811. margin: 0 auto;
  812. // margin-top: 10px;
  813. display: flex;
  814. justify-content: space-around;
  815. background-color: #fff;
  816. .wormtime_item {
  817. width: 25%;
  818. margin-top: 10px;
  819. padding: 10px;
  820. .img {
  821. width: 50px;
  822. height: 50px;
  823. }
  824. p:nth-child(2) {
  825. font-size: 16px;
  826. font-weight: 700;
  827. }
  828. p:nth-child(3) {
  829. font-size: 12px;
  830. margin-top: 5px;
  831. }
  832. p:last-child {
  833. font-size: 12px;
  834. margin-top: 5px;
  835. }
  836. }
  837. .wormtime_item:first-child {
  838. background-color: #F9FAFE;
  839. }
  840. .wormtime_item:nth-child(2) {
  841. background-color: #FFFCF9;
  842. }
  843. .wormtime_item:last-child {
  844. background-color: #FCF8FF;
  845. }
  846. }
  847. .schedulebox {
  848. display: flex;
  849. padding: 10px 10px;
  850. box-sizing: border-box;
  851. width: 95%;
  852. // justify-content: space-around;
  853. margin: 0px auto;
  854. background-color: #fff;
  855. .schedule {
  856. display: flex;
  857. width: 240rpx;
  858. height: 50rpx;
  859. // border: 2rpx solid #F0F0F0;
  860. margin-right: 20rpx;
  861. background-color: #F9FAFC;
  862. border-radius: 25px;
  863. .schedule_value {
  864. width: 70%;
  865. text-align: center;
  866. line-height: 50rpx;
  867. font-size: 24rpx;
  868. }
  869. .schedule_icon {
  870. width: 30%;
  871. // background-color: #F2F2F2;
  872. text-align: center;
  873. line-height: 50rpx;
  874. /deep/.u-icon__icon {
  875. color: rgba(0, 0, 0, 0.3);
  876. }
  877. }
  878. }
  879. }
  880. .tendency {
  881. width: 95%;
  882. display: flex;
  883. justify-content: space-around;
  884. margin: 0 auto;
  885. background-color: #fff;
  886. }
  887. .tendency_pro {
  888. width: 95%;
  889. padding: 0 20px;
  890. box-sizing: border-box;
  891. height: 140px;
  892. overflow-y: auto;
  893. margin: 0 auto;
  894. background-color: #fff;
  895. span:first-child {
  896. display: inline-block;
  897. width: 100px;
  898. overflow: hidden; //溢出隐藏
  899. white-space: nowrap; //禁止换行
  900. text-overflow: ellipsis; //...
  901. }
  902. .u-progress {
  903. width: calc(100% - 150px);
  904. }
  905. span:last-child {
  906. display: inline-block;
  907. width: 30px;
  908. margin-left: 10px;
  909. }
  910. }
  911. .tablebox {
  912. display: flex;
  913. flex-wrap: wrap;
  914. width: 95%;
  915. margin: 10px auto 20px;
  916. // box-shadow: 0 0 10rpx #bcb9ca;
  917. background-color: #fff;
  918. .top_text {
  919. width: 100%;
  920. display: flex;
  921. height: 30px;
  922. line-height: 30px;
  923. .tltle_text {
  924. width: 30%;
  925. text-align: center;
  926. // border: 2rpx solid #F0F0F0;
  927. // text-align: center;
  928. // background-color: #F0F0F0;
  929. // color: #000;
  930. }
  931. .title_text_color {
  932. width: 30%;
  933. text-align: center;
  934. .title_item {
  935. border-bottom: 2px solid #64CC82;
  936. color: #64CC82;
  937. }
  938. // width: 50%;
  939. // border: 2rpx solid #64CC82;
  940. // background-color: #64CC82;
  941. // color: #fff;
  942. // text-align: center;
  943. }
  944. }
  945. .scroll-X {
  946. width: 95%;
  947. margin: 20rpx auto;
  948. .table {
  949. width: 1800rpx;
  950. .td:nth-child(3),
  951. .td:last-child {
  952. color: #37aed8;
  953. }
  954. }
  955. .tr {
  956. display: flex;
  957. overflow: hidden;
  958. .th,
  959. .td {
  960. display: inline-block;
  961. padding: 5rpx;
  962. text-align: center;
  963. height: 52rpx;
  964. line-height: 52rpx;
  965. width: 320rpx;
  966. }
  967. }
  968. .tr:nth-child(2n-1) {
  969. background-color: #f5fff8;
  970. }
  971. .tr:first-child {
  972. background-color: #57c878;
  973. color: #fff;
  974. }
  975. }
  976. .pagenumber {
  977. display: flex;
  978. margin: 20rpx auto;
  979. button {
  980. width: 150rpx;
  981. height: 50rpx;
  982. line-height: 50rpx;
  983. font-size: 26rpx;
  984. text-align: center;
  985. background-color: #57c878;
  986. color: #FFFFFF;
  987. }
  988. .pagenumber_page {
  989. width: 150rpx;
  990. height: 50rpx;
  991. line-height: 50rpx;
  992. font-size: 26rpx;
  993. text-align: center;
  994. }
  995. }
  996. }
  997. .modalbox {
  998. width: 100%;
  999. // display: flex;
  1000. // flex-wrap: wrap;
  1001. height: 120px;
  1002. padding-left: 30px;
  1003. margin-top: 10px;
  1004. overflow-y: auto;
  1005. p {
  1006. // width: 50%;
  1007. }
  1008. }
  1009. /deep/.u-calendar__action {
  1010. display: flex;
  1011. justify-content: space-around;
  1012. .u-calendar__action__text {
  1013. line-height: 25px;
  1014. }
  1015. }
  1016. </style>