analyse.vue 27 KB

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