new-analyse.vue 27 KB

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