analyse.vue 27 KB

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