analyse.vue 29 KB

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