analyse.vue 29 KB

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