analyse.vue 25 KB

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