analyse.vue 25 KB

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