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. range-color="#999"
  77. btn-type="success"
  78. active-bg-color="#0BBC58"
  79. range-bg-color="rgba(11,188,88,0.13)"
  80. ></u-calendar>
  81. <u-button
  82. type="primary"
  83. text="归档时间"
  84. size="mini"
  85. @click="timeshow = true"
  86. >归档时间</u-button
  87. >
  88. <u-select
  89. v-model="timeshow"
  90. mode="mutil-column"
  91. :list="list"
  92. @confirm="Hourchange"
  93. :default-value="defaultValue"
  94. ></u-select>
  95. </view>
  96. <view class="tendency">
  97. <canvas
  98. canvas-id="canvasColumnA"
  99. id="canvasColumnA"
  100. class="charts"
  101. @touchstart="touchLineA($event)"
  102. @touchmove="moveLineA($event)"
  103. @touchend="touchEndLineA($event)"
  104. disable-scroll="true"
  105. :style="{
  106. width: cWidth * pixelRatio + 'px',
  107. height: cHeight * pixelRatio + 'px',
  108. transform: 'scale(' + 1 / pixelRatio + ')',
  109. 'margin-left': (-cWidth * (pixelRatio - 1)) / 2 + 'px',
  110. 'margin-top': (-cHeight * (pixelRatio - 1)) / 2 + 'px',
  111. }"
  112. ></canvas>
  113. </view>
  114. <view class="tendency">
  115. <canvas
  116. canvas-id="canvasRing"
  117. id="canvasRing"
  118. class="charts"
  119. @touchstart="touchRing"
  120. :style="{
  121. width: cWidth * pixelRatio + 'px',
  122. height: cHeight * pixelRatio + 'px',
  123. transform: 'scale(' + 1 / pixelRatio + ')',
  124. 'margin-left': (-cWidth * (pixelRatio - 1)) / 2 + 'px',
  125. 'margin-top': (-cHeight * (pixelRatio - 1)) / 2 + 'px',
  126. }"
  127. ></canvas>
  128. </view>
  129. <view class="tendency_pro">
  130. <view class="" v-for="(item, index) in progresslist">
  131. <span>{{ index + 1 }}、{{ item.name }}</span>
  132. <u-line-progress
  133. :active-color="colorlist[index % 6]"
  134. :percent="Number(((item.data / pestsum) * 100).toFixed(2))"
  135. :show-percent="false"
  136. ></u-line-progress>
  137. <span>{{ Number(((item.data / pestsum) * 100).toFixed(2)) }}%</span>
  138. </view>
  139. </view>
  140. <view class="tablebox">
  141. <view class="top_text">
  142. <view
  143. :class="topindex == index ? 'title_text_color' : 'tltle_text'"
  144. v-for="(item, index) in toptext"
  145. :key="index"
  146. @click="changeindex(index)"
  147. >
  148. <span class="title_item">
  149. {{ item }}
  150. </span>
  151. </view>
  152. </view>
  153. <scroll-view scroll-top="0" scroll-x="true" class="scroll-X">
  154. <table class="table" v-if="topindex == 0">
  155. <tr class="tr">
  156. <th class="th" v-for="(item, index) in thdata" :key="'a' + index">
  157. {{ item }}
  158. </th>
  159. </tr>
  160. <tr class="tr" v-for="(items, indexs) in eqlistdata" :key="indexs">
  161. <td class="td">{{ items.deviceId }}</td>
  162. <td class="td">{{ items.deviceName }}</td>
  163. <td class="td" @click="wormdetails(items.pest_dict)">
  164. {{ items.pestName }}
  165. </td>
  166. <td class="td">{{ items.addtime | timeFormat() }}</td>
  167. <td class="td">{{ items.location }}</td>
  168. <td class="td" @click="examine(items.indentify_photo)">查看</td>
  169. </tr>
  170. <tr class="tr" v-if="forbidden1">
  171. <td class="td" v-for="item in 6">暂无数据</td>
  172. </tr>
  173. </table>
  174. <table class="table2" v-else>
  175. <tr class="tr">
  176. <th
  177. class="th"
  178. v-for="(item, index) in thdata2"
  179. :key="'a' + index"
  180. >
  181. {{ item }}
  182. </th>
  183. </tr>
  184. <tr class="tr" v-for="(items, indexs) in eqlistdata" :key="indexs">
  185. <td class="td">{{ items.pest_name }}</td>
  186. <td class="td">{{ items.pest_num }}</td>
  187. <td class="td">{{ items.addtime | timeFormat() }}</td>
  188. </tr>
  189. <tr class="tr" v-if="forbidden2">
  190. <td class="td" v-for="item in 6">暂无数据</td>
  191. </tr>
  192. </table>
  193. </scroll-view>
  194. <view class="pagenumber">
  195. <button @click="prev" :disabled="page == 1">上一页</button>
  196. <view class="pagenumber_page"> 第{{ page }}页 </view>
  197. <view class="pagenumber_page"> 共 {{ pagesum }} 页 </view>
  198. <button @click="next" :disabled="page == pagesum">下一页</button>
  199. </view>
  200. </view>
  201. <u-modal v-model="show" :mask-close-able="true" title="24小时数据">
  202. <view class="modalbox">
  203. <p v-for="(item, key) in pest_dict">
  204. {{ key }}--{{ pest_dict[key] }}头
  205. </p>
  206. </view>
  207. </u-modal>
  208. </view>
  209. </view>
  210. </template>
  211. <script>
  212. import uCharts from '../../../components/js_sdk/u-charts/u-charts/u-charts.js';
  213. var canvaColumnA = null;
  214. var canvasRing = null;
  215. export default {
  216. data() {
  217. return {
  218. d_id: '',
  219. oldtime: '',
  220. newtime: '',
  221. sp_hour_st: '00:00', // 归档开始时间
  222. sp_hour_ed: '00:00', // 归档结束时间
  223. timeshow: false, // 归档时间设置弹框
  224. defaultValue: [0, 0],
  225. list: [
  226. [
  227. {
  228. value: '00:00',
  229. label: '00时',
  230. },
  231. {
  232. value: '01:00',
  233. label: '01时',
  234. },
  235. {
  236. value: '02:00',
  237. label: '02时',
  238. },
  239. {
  240. value: '03:00',
  241. label: '03时',
  242. },
  243. {
  244. value: '04:00',
  245. label: '04时',
  246. },
  247. {
  248. value: '05:00',
  249. label: '05时',
  250. },
  251. {
  252. value: '06:00',
  253. label: '06时',
  254. },
  255. {
  256. value: '07:00',
  257. label: '07时',
  258. },
  259. {
  260. value: '08:00',
  261. label: '08时',
  262. },
  263. {
  264. value: '09:00',
  265. label: '09时',
  266. },
  267. {
  268. value: '10:00',
  269. label: '10时',
  270. },
  271. {
  272. value: '11:00',
  273. label: '11时',
  274. },
  275. {
  276. value: '12:00',
  277. label: '12时',
  278. },
  279. {
  280. value: '13:00',
  281. label: '13时',
  282. },
  283. {
  284. value: '14:00',
  285. label: '14时',
  286. },
  287. {
  288. value: '15:00',
  289. label: '15时',
  290. },
  291. {
  292. value: '16:00',
  293. label: '16时',
  294. },
  295. {
  296. value: '17:00',
  297. label: '17时',
  298. },
  299. {
  300. value: '18:00',
  301. label: '18时',
  302. },
  303. {
  304. value: '19:00',
  305. label: '19时',
  306. },
  307. {
  308. value: '20:00',
  309. label: '20时',
  310. },
  311. {
  312. value: '21:00',
  313. label: '21时',
  314. },
  315. {
  316. value: '22:00',
  317. label: '22时',
  318. },
  319. {
  320. value: '23:00',
  321. label: '23时',
  322. },
  323. ],
  324. [
  325. {
  326. value: '00:00',
  327. label: '00时',
  328. },
  329. {
  330. value: '01:00',
  331. label: '01时',
  332. },
  333. {
  334. value: '02:00',
  335. label: '02时',
  336. },
  337. {
  338. value: '03:00',
  339. label: '03时',
  340. },
  341. {
  342. value: '04:00',
  343. label: '04时',
  344. },
  345. {
  346. value: '05:00',
  347. label: '05时',
  348. },
  349. {
  350. value: '06:00',
  351. label: '06时',
  352. },
  353. {
  354. value: '07:00',
  355. label: '07时',
  356. },
  357. {
  358. value: '08:00',
  359. label: '08时',
  360. },
  361. {
  362. value: '09:00',
  363. label: '09时',
  364. },
  365. {
  366. value: '10:00',
  367. label: '10时',
  368. },
  369. {
  370. value: '11:00',
  371. label: '11时',
  372. },
  373. {
  374. value: '12:00',
  375. label: '12时',
  376. },
  377. {
  378. value: '13:00',
  379. label: '13时',
  380. },
  381. {
  382. value: '14:00',
  383. label: '14时',
  384. },
  385. {
  386. value: '15:00',
  387. label: '15时',
  388. },
  389. {
  390. value: '16:00',
  391. label: '16时',
  392. },
  393. {
  394. value: '17:00',
  395. label: '17时',
  396. },
  397. {
  398. value: '18:00',
  399. label: '18时',
  400. },
  401. {
  402. value: '19:00',
  403. label: '19时',
  404. },
  405. {
  406. value: '20:00',
  407. label: '20时',
  408. },
  409. {
  410. value: '21:00',
  411. label: '21时',
  412. },
  413. {
  414. value: '22:00',
  415. label: '22时',
  416. },
  417. {
  418. value: '23:00',
  419. label: '23时',
  420. },
  421. ],
  422. ],
  423. tiemshow: false,
  424. cWidth: '350',
  425. cHeight: '350',
  426. pixelRatio: 1,
  427. pickertfone: false,
  428. yservalue: '',
  429. yearlist: [],
  430. yserindex: '',
  431. pickertfworm: false,
  432. wormvalue: '',
  433. wormlist: [],
  434. wormindex: '',
  435. timeobj: {
  436. endTime: '',
  437. highNum: '',
  438. highTime: '',
  439. startTime: '',
  440. },
  441. progresslist: [],
  442. reslist: {
  443. char_data: {},
  444. at_ah_info: [],
  445. },
  446. pestsum: 0,
  447. colorlist: [
  448. 'rgb(24, 144, 255)',
  449. 'rgb(47, 194, 91)',
  450. 'rgb(250, 204, 20)',
  451. 'rgb(240, 72, 100)',
  452. 'rgb(133, 67, 224)',
  453. 'rgb(144, 237, 125)',
  454. ],
  455. page: 1,
  456. pagesum: 1,
  457. eqlistdata: [],
  458. thdata: [
  459. '设备ID',
  460. '设备名称',
  461. '害虫名称',
  462. '上报时间',
  463. '设备位置',
  464. '图像',
  465. ],
  466. thdata2: ['害虫名称', '害虫数量', '上报时间'],
  467. topindex: 0,
  468. toptext: ['图像溯源', '虫害基础数据'],
  469. forbidden1: false,
  470. forbidden2: false,
  471. show: false,
  472. pest_dict: {},
  473. };
  474. },
  475. methods: {
  476. getyear() {
  477. var Year = new Date().getFullYear();
  478. var num = Year - 2019;
  479. for (var i = 0; i < num + 1; i++) {
  480. this.yearlist.push(2019 + i);
  481. }
  482. this.yservalue = this.yearlist[this.yearlist.length - 1];
  483. this.yserindex = this.yearlist.length - 1;
  484. this.getwormtime();
  485. },
  486. async getwormtime() {
  487. const res = await this.$myRequest({
  488. url: '/api/api_gateway?method=forecast.worm_lamp.pest_raise_info',
  489. data: {
  490. d_ids: this.d_id,
  491. identify_model: 'A',
  492. year: this.yservalue,
  493. device_type: 'xct',
  494. },
  495. });
  496. console.log(res);
  497. this.wormlist = res.pest_list;
  498. this.wormtimelist = res.pest_info;
  499. this.wormvalue = this.wormlist[0];
  500. this.wormindex = 0;
  501. if (this.wormvalue) {
  502. this.timeobj = this.wormtimelist[this.wormvalue];
  503. }
  504. console.log(this.timeobj);
  505. },
  506. confirmFun(e) {
  507. console.log(e);
  508. this.yserindex = e[0];
  509. this.yservalue = this.yearlist[e[0]];
  510. this.getwormtime();
  511. },
  512. confirmFun2(e) {
  513. console.log(e);
  514. this.wormindex = e[0];
  515. this.wormvalue = this.wormlist[e[0]];
  516. this.timeobj = this.wormtimelist[this.wormvalue];
  517. this.setlineoption();
  518. },
  519. async getwormline() {
  520. const res = await this.$myRequest({
  521. url: '/api/api_gateway?method=forecast.worm_lamp.pest_statistics_char_new',
  522. data: {
  523. d_ids: this.d_id,
  524. identify_model: 'A',
  525. start_time: this.oldtime,
  526. end_time: this.newtime,
  527. sp_hour_st: this.sp_hour_st,
  528. sp_hour_ed: this.sp_hour_ed,
  529. device_type: 'xct',
  530. },
  531. });
  532. // console.log(res)
  533. this.reslist.char_data = res.char_data;
  534. this.reslist.at_ah_info = res.at_ah_info;
  535. var ringarr = [];
  536. if (this.checkObj(res.pest_total)) {
  537. for (var key in res.pest_total) {
  538. var nameobj = {
  539. name: '',
  540. data: '',
  541. };
  542. // console.log(key)
  543. nameobj.name = key;
  544. nameobj.data = res.pest_total[key];
  545. ringarr.push(nameobj);
  546. }
  547. }
  548. this.setlineoption();
  549. // this.showRing(ringarr)
  550. var num = 0;
  551. for (var i = 0; i < ringarr.length - 5; i++) {
  552. console.log(ringarr[i].name);
  553. num += ringarr[i].data;
  554. }
  555. this.pestsum = 0;
  556. for (var i = 0; i < ringarr.length; i++) {
  557. this.pestsum += ringarr[i].data;
  558. }
  559. var sumobj = {
  560. name: '其他',
  561. data: num,
  562. };
  563. var ringarr2 = ringarr.slice(ringarr.length - 5);
  564. ringarr2.unshift(sumobj);
  565. // console.log(ringarr2)
  566. this.showRing(ringarr2);
  567. console.log(ringarr);
  568. this.progresslist = ringarr;
  569. },
  570. setlineoption() {
  571. var res = this.reslist;
  572. var xtitle = [];
  573. var obj = [];
  574. if (res.at_ah_info.length != 0) {
  575. var aharr = [];
  576. var atarr = [];
  577. var pestArr = [];
  578. let indentText = 0;
  579. for (var i = 0; i < res.at_ah_info.length; i++) {
  580. var times = new Date(res.at_ah_info[i].addtime * 1000);
  581. xtitle.push(times.getMonth() + 1 + '/' + times.getDate());
  582. atarr.push(res.at_ah_info[i].at == '' ? '0' : res.at_ah_info[i].at);
  583. aharr.push(res.at_ah_info[i].ah == '' ? '0' : res.at_ah_info[i].ah);
  584. if (this.checkObj(res.char_data) && res.char_data[this.wormvalue]) {
  585. if (
  586. res.char_data[this.wormvalue][i - indentText] &&
  587. res.char_data[this.wormvalue][i - indentText].addtime ==
  588. res.at_ah_info[i].addtime
  589. ) {
  590. pestArr.push(res.char_data[this.wormvalue][i - indentText].sum);
  591. } else {
  592. indentText++;
  593. pestArr.push(null);
  594. }
  595. }
  596. }
  597. // console.log(this.wormvalue)
  598. // if (this.checkObj(res.char_data)) {
  599. // for (var key in res.char_data) {
  600. // if (this.wormvalue == key) {
  601. // var wormobj = {
  602. // name: key,
  603. // data: [],
  604. // }
  605. // for (var i = 0; i < res.char_data[key].length; i++) {
  606. // wormobj.data.push(res.char_data[key][i].ah == "" ? "0" : res.char_data[key][i].sum)
  607. // }
  608. // obj.push(wormobj)
  609. // }
  610. // }
  611. // }
  612. var atobj = {
  613. name: '温度',
  614. data: atarr,
  615. color: '#00E29D',
  616. };
  617. var ahobj = {
  618. name: '湿度',
  619. data: aharr,
  620. color: '#6CBBFF',
  621. };
  622. var pestObj = {
  623. name: this.wormvalue,
  624. data: pestArr,
  625. };
  626. obj.push(atobj);
  627. obj.push(ahobj);
  628. obj.push(pestObj);
  629. }
  630. this.showColumn('canvasColumnA', xtitle, obj);
  631. },
  632. checkObj(obj) {
  633. for (let i in obj) {
  634. return true;
  635. }
  636. return false;
  637. },
  638. tiemchange(e) {
  639. console.log(e);
  640. // this.oldtime = +new Date(e.startDate) / 1000 - 8 * 60 * 60
  641. // this.newtime = +new Date(e.endDate) / 1000 + 16 * 60 * 60 - 1
  642. this.newtime = e.endDate;
  643. this.oldtime = e.startDate;
  644. // newtime: "",
  645. console.log(this.oldtime, this.newtime);
  646. this.page = 1;
  647. this.getwormline();
  648. if (this.topindex == 0) {
  649. this.gettabledata();
  650. } else if (this.topindex == 1) {
  651. this.gettabledata2();
  652. }
  653. },
  654. Hourchange(e) {
  655. this.sp_hour_st = e[0].value;
  656. this.sp_hour_ed = e[1].value;
  657. // 本地缓存
  658. uni.setStorageSync('sp_hour_st_xc', this.sp_hour_st);
  659. uni.setStorageSync('sp_hour_ed_xc', this.sp_hour_ed);
  660. this.getyear();
  661. console.log(e);
  662. },
  663. timetab(e) {
  664. e = new Date(e * 1000);
  665. var year = e.getFullYear();
  666. var month =
  667. e.getMonth() + 1 < 10 ? '0' + (e.getMonth() + 1) : e.getMonth() + 1;
  668. var day = e.getDate() < 10 ? '0' + e.getDate() : e.getDate();
  669. var time = year + '/' + month + '/' + day;
  670. return time;
  671. },
  672. showColumn(id, xtitle, xinfo) {
  673. var _self = this;
  674. const ctx = uni.createCanvasContext(id, this);
  675. canvaColumnA = new uCharts({
  676. context: ctx,
  677. type: 'line',
  678. legend: {
  679. position: 'top',
  680. },
  681. fontSize: 11,
  682. background: '#FFFFFF',
  683. pixelRatio: 1,
  684. animation: true,
  685. dataLabel: false,
  686. categories: xtitle,
  687. series: xinfo,
  688. enableScroll: true, //开启图表拖拽功能
  689. xAxis: {
  690. disableGrid: true,
  691. type: 'grid',
  692. gridType: 'dash',
  693. itemCount: 5, //x轴单屏显示数据的数量,默认为5个
  694. scrollShow: true, //新增是否显示滚动条,默认false
  695. // scrollAlign: 'left', //滚动条初始位置
  696. scrollBackgroundColor: '#F7F7FF', //默认为 #EFEBEF
  697. scrollColor: '#DEE7F7', //默认为 #A6A6A6
  698. },
  699. yAxis: {},
  700. width: _self.cWidth * 1,
  701. height: _self.cHeight * 1,
  702. extra: {
  703. line: {
  704. type: 'curve',
  705. },
  706. },
  707. });
  708. },
  709. touchLineA(e) {
  710. console.log(e);
  711. canvaColumnA.scrollStart(e);
  712. },
  713. moveLineA(e) {
  714. canvaColumnA.scroll(e);
  715. },
  716. touchEndLineA(e) {
  717. canvaColumnA.scrollEnd(e);
  718. //下面是toolTip事件,如果滚动后不需要显示,可不填写
  719. canvaColumnA.showToolTip(e, {
  720. format: function (item, category) {
  721. return category + ' ' + item.name + ':' + item.data;
  722. },
  723. });
  724. },
  725. showRing(data) {
  726. var _self = this;
  727. const ctx = uni.createCanvasContext('canvasRing', this);
  728. canvasRing = new uCharts({
  729. context: ctx,
  730. type: 'ring',
  731. fontSize: 11,
  732. legend: {
  733. show: true,
  734. },
  735. extra: {
  736. ring: {
  737. offsetAngle: -45,
  738. ringWidth: 40 * _self.pixelRatio,
  739. labelWidth: 15,
  740. },
  741. },
  742. background: '#FFFFFF',
  743. pixelRatio: _self.pixelRatio,
  744. series: data,
  745. animation: true,
  746. width: _self.cWidth * _self.pixelRatio,
  747. height: _self.cHeight * _self.pixelRatio,
  748. disablePieStroke: true,
  749. dataLabel: true,
  750. });
  751. },
  752. touchRing(e) {
  753. canvasRing.showToolTip(e, {
  754. format: function (item) {
  755. return item.name + ':' + item.data;
  756. },
  757. });
  758. },
  759. tap(e) {
  760. canvasgroup[e.target.id].touchLegend(e);
  761. canvasgroup[e.target.id].showToolTip(e);
  762. },
  763. async gettabledata() {
  764. const res = await this.$myRequest({
  765. url: '/api/api_gateway?method=forecast.worm_lamp.pest_image_source',
  766. data: {
  767. d_ids: this.d_id,
  768. identify_model: 'A',
  769. start_time: this.oldtime,
  770. end_time: this.newtime,
  771. sp_hour_st: this.sp_hour_st,
  772. sp_hour_ed: this.sp_hour_ed,
  773. page: this.page,
  774. device_type: 'xct',
  775. },
  776. });
  777. this.pagesum = Math.ceil(res.total_count / 10);
  778. this.eqlistdata = res.pest_image_data;
  779. if (this.eqlistdata.length == 0) {
  780. this.forbidden1 = true;
  781. } else {
  782. this.forbidden1 = false;
  783. }
  784. console.log(res);
  785. },
  786. async gettabledata2() {
  787. const res = await this.$myRequest({
  788. url: '/api/api_gateway?method=forecast.worm_lamp.pest_base_data',
  789. data: {
  790. d_ids: this.d_id,
  791. identify_model: 'A',
  792. start_time: this.oldtime,
  793. end_time: this.newtime,
  794. sp_hour_st: this.sp_hour_st,
  795. sp_hour_ed: this.sp_hour_ed,
  796. page: this.page,
  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_xc') == ''
  853. ? '00:00'
  854. : uni.getStorageSync('sp_hour_st_xc');
  855. this.sp_hour_ed =
  856. uni.getStorageSync('sp_hour_ed_xc') == ''
  857. ? '00:00'
  858. : uni.getStorageSync('sp_hour_ed_xc');
  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>