analyse.vue 25 KB

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