new-analyse.vue 27 KB

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