analyse.vue 25 KB

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