analyse.vue 25 KB

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