analyse.vue 30 KB

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