analyse.vue 26 KB

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