analyse.vue 29 KB

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