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