analyse.vue 25 KB

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