new-analyse.vue 26 KB

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