analyse.vue 29 KB

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