analyse.vue 27 KB

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