analyse.vue 30 KB

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