new-analyse.vue 26 KB

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