analyse.vue 25 KB

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