analyse.vue 25 KB

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