new-analyse.vue 26 KB

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