analyse.vue 25 KB

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