analyse.vue 29 KB

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