new-analyse.vue 30 KB

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