ucharts.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869
  1. <template>
  2. <view>
  3. <view class="status_bar"></view>
  4. <view class="" style="position: relative; top: 44px">
  5. <view style="position: fixed; z-index: 100; width: 100%; color: #ffffff">
  6. <uni-nav-bar
  7. @clickLeft="clickLeft"
  8. left-icon="back"
  9. left-text="返回"
  10. title="历史数据"
  11. ></uni-nav-bar>
  12. </view>
  13. <view class="selecttimes" @click="tiemshow = !tiemshow">
  14. <view class="timesbox">
  15. <image
  16. :src="
  17. $imageURL+ '/bigdata_app' +
  18. '/image/prevention/1acfe2751c01d3786cdc49b83d7e505.png'
  19. "
  20. mode=""
  21. ></image>
  22. <p>{{ timetab(oldtime) }}</p>
  23. <p class="or">~</p>
  24. <p>{{ timetab(newtime) }}</p>
  25. <u-icon name="rili" custom-prefix="custom-icon" class="icon"></u-icon>
  26. </view>
  27. <u-calendar
  28. v-model="tiemshow"
  29. mode="range"
  30. @change="tiemchange"
  31. ></u-calendar>
  32. </view>
  33. <view class="shuju_one">
  34. <view class="shuju_one_title">
  35. <view
  36. :class="titleidnex == index ? 'title_text_color' : 'tltle_text'"
  37. v-for="(item, index) in titletext"
  38. :key="index"
  39. @click="changeindex(index)"
  40. >
  41. {{ item }}
  42. </view>
  43. </view>
  44. <view class="canvastishi" v-if="!canvastishiTF && !dataloadingtf">
  45. 暂无数据
  46. </view>
  47. <view class="canvastishi" v-if="dataloadingtf">
  48. <p class="dataloading">加载中</p>
  49. </view>
  50. <canvas
  51. v-if="canvastishiTF"
  52. canvas-id="canvasColumnA"
  53. id="canvasColumnA"
  54. class="charts"
  55. @touchstart="touchLineA($event)"
  56. @touchmove="moveLineA($event)"
  57. @touchend="touchEndLineA($event)"
  58. disable-scroll="true"
  59. :style="{
  60. width: cWidth * pixelRatio + 'px',
  61. height: cHeight * pixelRatio + 'px',
  62. transform: 'scale(' + 1 / pixelRatio + ')',
  63. 'margin-left': (-cWidth * (pixelRatio - 1)) / 2 + 'px',
  64. 'margin-top': (-cHeight * (pixelRatio - 1)) / 2 + 'px',
  65. }"
  66. ></canvas>
  67. </view>
  68. <view class="shuju_two" v-if="allqingchong">
  69. <view class="canvastishi" v-if="!canvastishiTF && !dataloadingtf">
  70. 暂无数据
  71. </view>
  72. <view class="canvastishi" v-if="dataloadingtf">
  73. <p class="dataloading">加载中</p>
  74. </view>
  75. <canvas
  76. v-if="canvastishiTF"
  77. canvas-id="canvasColumnB"
  78. id="canvasColumnB"
  79. class="charts"
  80. @touchstart="touchLineBb($event)"
  81. @touchmove="moveLineBb($event)"
  82. @touchend="touchEndLineBb($event)"
  83. disable-scroll="true"
  84. :style="{
  85. width: cWidth * pixelRatio + 'px',
  86. height: cHeight * pixelRatio + 'px',
  87. transform: 'scale(' + 1 / pixelRatio + ')',
  88. 'margin-left': (-cWidth * (pixelRatio - 1)) / 2 + 'px',
  89. 'margin-top': (-cHeight * (pixelRatio - 1)) / 2 + 'px',
  90. }"
  91. ></canvas>
  92. </view>
  93. <view
  94. class="refresh"
  95. @click="refresh"
  96. :style="{ top: allqingchong ? '1380rpx' : '790rpx' }"
  97. >
  98. 刷 新
  99. </view>
  100. <view
  101. class="condition"
  102. :style="{ top: allqingchong ? '1450rpx' : '870rpx' }"
  103. >
  104. <scroll-view scroll-top="0" scroll-x="true" class="scroll-X">
  105. <table
  106. class="table"
  107. v-if="$QueryPermission(264) || $QueryPermission(323)"
  108. >
  109. <tr class="tr">
  110. <th class="th" v-for="(item, index) in thdata" :key="'a' + index">
  111. {{ item }}
  112. </th>
  113. </tr>
  114. <tr
  115. class="tr"
  116. v-for="(items, indexs) in eqlistdata"
  117. :key="'b' + indexs"
  118. v-if="forbidden"
  119. >
  120. <td class="td">{{ items.d_h_t.addtime | timeFormat() }}</td>
  121. <td class="td">{{ items.d_h_t.ds }}</td>
  122. <td class="td">{{ items.d_h_t.ws }}</td>
  123. <td class="td">{{ items.d_h_t.rps }}</td>
  124. <td class="td">{{ items.d_h_t.tps }}</td>
  125. <td class="td">{{ items.d_h_t.dps }}</td>
  126. <td class="td">{{ items.d_h_t.tt }}</td>
  127. <td class="td">{{ items.d_h_t.ct }}</td>
  128. <td class="td">
  129. {{ items.d_h_t.at == '' ? '--' : items.d_h_t.at }}
  130. </td>
  131. <td class="td">
  132. {{ items.d_h_t.ah == '' ? '--' : items.d_h_t.ah }}
  133. </td>
  134. <td class="td">{{ items.d_h_t.cv }}</td>
  135. <td class="td">
  136. {{
  137. items.d_h_t.vps == 0
  138. ? '正常'
  139. : items.d_h_t.vps == 1
  140. ? '欠压'
  141. : items.d_h_t.vps == 2
  142. ? '过压'
  143. : items.d_h_t.vps
  144. }}
  145. </td>
  146. <td class="td">{{ items.d_h_t.bv }}</td>
  147. <td class="td">{{ items.d_h_t.csq }}</td>
  148. </tr>
  149. <tr class="tr" v-if="!forbidden">
  150. <td class="td" v-for="item in 14">暂无数据</td>
  151. </tr>
  152. </table>
  153. <table class="table2" v-else-if="!allqingchong">
  154. <tr class="tr">
  155. <th
  156. class="th"
  157. v-for="(item, index) in thdata3"
  158. :key="'a' + index"
  159. >
  160. {{ item }}
  161. </th>
  162. </tr>
  163. <tr
  164. class="tr"
  165. v-for="(items, indexs) in eqlistdata"
  166. :key="'b' + indexs"
  167. v-if="forbidden"
  168. >
  169. <td class="td">{{ items.d_h_t.addtime | timeFormat() }}</td>
  170. <td class="td">{{ items.d_h_t.ds }}</td>
  171. <td class="td">{{ items.d_h_t.ws }}</td>
  172. <td class="td">{{ items.d_h_t.tps }}</td>
  173. <td class="td">{{ items.d_h_t.tt }}</td>
  174. <td class="td">
  175. {{ items.d_h_t.at == '' ? '--' : items.d_h_t.at }}
  176. </td>
  177. <td class="td">
  178. {{ items.d_h_t.ah == '' ? '--' : items.d_h_t.ah }}
  179. </td>
  180. </tr>
  181. <tr class="tr" v-if="!forbidden">
  182. <td class="td" v-for="item in 7">暂无数据</td>
  183. </tr>
  184. </table>
  185. <table class="table2" v-else>
  186. <tr class="tr">
  187. <th
  188. class="th"
  189. v-for="(item, index) in thdata2"
  190. :key="'a' + index"
  191. >
  192. {{ item }}
  193. </th>
  194. </tr>
  195. <tr
  196. class="tr"
  197. v-for="(items, indexs) in eqlistdata"
  198. :key="'b' + indexs"
  199. v-if="forbidden"
  200. >
  201. <td class="td">{{ items.d_h_t.addtime | timeFormat() }}</td>
  202. <td class="td">{{ items.d_h_t.ds }}</td>
  203. <td class="td">{{ items.d_h_t.ws }}</td>
  204. <td class="td">{{ items.d_h_t.rps }}</td>
  205. <td class="td">{{ items.d_h_t.tps }}</td>
  206. <td class="td">{{ items.d_h_t.dps }}</td>
  207. <td class="td">{{ items.d_h_t.tt }}</td>
  208. <td class="td">{{ items.d_h_t.ct }}</td>
  209. <td class="td">
  210. {{ items.d_h_t.at == '' ? '--' : items.d_h_t.at }}
  211. </td>
  212. <td class="td">
  213. {{ items.d_h_t.ah == '' ? '--' : items.d_h_t.ah }}
  214. </td>
  215. </tr>
  216. <tr class="tr" v-if="!forbidden">
  217. <td class="td" v-for="item in 10">暂无数据</td>
  218. </tr>
  219. </table>
  220. </scroll-view>
  221. <view class="pagenumber">
  222. <button @click="prev">上一页</button>
  223. <view class="pagenumber_page"> 第{{ page }}页 </view>
  224. <view class="pagenumber_page"> 共 {{ pagesum }} 页 </view>
  225. <button @click="next" :disabled="!forbidden">下一页</button>
  226. </view>
  227. </view>
  228. </view>
  229. </view>
  230. </template>
  231. <style lang="scss"></style>
  232. <script>
  233. import uCharts from '../../components/js_sdk/u-charts/u-charts/u-charts.js';
  234. var canvaColumnA = null;
  235. var canvaColumnB = null;
  236. var presenttime = null;
  237. // var oldpresenttime = presenttime - 24*60*60*1000
  238. export default {
  239. data() {
  240. return {
  241. thdata: [
  242. '上报时间',
  243. '设备开关',
  244. '工作状态',
  245. '雨控状态',
  246. '温控状态',
  247. '倾倒状态',
  248. '定时(h)',
  249. '电击次数',
  250. '温度(℃)',
  251. '湿度(%)',
  252. '充电电压(v)',
  253. '电压状态',
  254. '电池电压(v)',
  255. '信号强度',
  256. ],
  257. thdata2: [
  258. '上报时间',
  259. '设备开关',
  260. '工作状态',
  261. '雨控状态',
  262. '温控状态',
  263. '倾倒状态',
  264. '定时(h)',
  265. '电击次数',
  266. '温度(℃)',
  267. '湿度(%)',
  268. ],
  269. thdata3: [
  270. '上报时间',
  271. '设备开关',
  272. '工作状态',
  273. '温控状态',
  274. '定时(h)',
  275. '温度(℃)',
  276. '湿度(%)',
  277. ],
  278. eqlistdata: [],
  279. cWidth: '400',
  280. cHeight: '400',
  281. pixelRatio: 1,
  282. titletext: ['24小时', '近一个月', '近半年', '近一年'],
  283. titleidnex: 0,
  284. oldtime: '',
  285. newtime: '',
  286. page: 1,
  287. forbidden: false, //暂无数据
  288. times: {
  289. d_id: null,
  290. start_time: null,
  291. end_time: null,
  292. device_id: null,
  293. },
  294. canvastishiTF: false, //折线图暂无数据提示
  295. dataloadingtf: true, //加载中提示
  296. pagesum: 1,
  297. tiemshow: false, //日历选择器
  298. allqingchong: false,
  299. };
  300. },
  301. // 页面加载执行的函数
  302. onLoad(option) {
  303. this.times.d_id = option.d_id;
  304. this.times.imei = option.imei;
  305. this.cWidth = uni.upx2px(650);
  306. this.cHeight = uni.upx2px(500);
  307. this.getworm();
  308. },
  309. onShow() {
  310. presenttime = +new Date();
  311. this.oldtime = parseInt((presenttime - 24 * 60 * 60 * 1000) / 1000);
  312. this.newtime = parseInt(presenttime / 1000);
  313. setTimeout(() => {
  314. this.getServerData(
  315. parseInt(presenttime / 1000),
  316. parseInt((presenttime - 24 * 60 * 60 * 1000) / 1000)
  317. );
  318. this.historydata(
  319. parseInt(presenttime / 1000),
  320. parseInt((presenttime - 24 * 60 * 60 * 1000) / 1000)
  321. );
  322. }, 1000);
  323. },
  324. onPullDownRefresh() {
  325. console.log('refresh');
  326. this.getServerData(
  327. parseInt(presenttime / 1000),
  328. parseInt((presenttime - 24 * 60 * 60 * 1000) / 1000)
  329. );
  330. this.historydata(
  331. parseInt(presenttime / 1000),
  332. parseInt((presenttime - 24 * 60 * 60 * 1000) / 1000)
  333. );
  334. setTimeout(function () {
  335. uni.stopPullDownRefresh();
  336. }, 1000);
  337. },
  338. methods: {
  339. //
  340. //forecast.worm_lamp.device_polyline_data
  341. // 获取数据,发请求
  342. async getServerData(newtime, oldtimes) {
  343. //设备折线图
  344. this.dataloadingtf = true;
  345. const res = await this.$myRequest({
  346. url: '/api/api_gateway?method=forecast.worm_lamp.device_polyline_data',
  347. data: {
  348. device_type_id: 2,
  349. d_id: this.times.d_id,
  350. end_time: newtime,
  351. start_time: oldtimes,
  352. },
  353. });
  354. this.dataloadingtf = false;
  355. if (res.length == 0) {
  356. this.canvastishiTF = false;
  357. } else {
  358. this.canvastishiTF = true;
  359. var xtitle = [];
  360. var arr = [];
  361. var arr1 = [];
  362. var arr2 = [];
  363. var arr3 = [];
  364. var arr4 = [];
  365. var arr5 = [];
  366. for (var i = 0; i < res.length; i++) {
  367. var times = new Date(res[i].addtime * 1000);
  368. xtitle.unshift(
  369. times.getMonth() +
  370. 1 +
  371. '/' +
  372. times.getDate() +
  373. '-' +
  374. times.getHours() +
  375. ':' +
  376. times.getMinutes()
  377. );
  378. arr1.unshift(res[i].temperature);
  379. arr2.unshift(res[i].humidity);
  380. arr3.unshift(Number(res[i].others.bv));
  381. arr4.unshift(Number(res[i].others.cv));
  382. arr5.unshift(res[i].others.ct);
  383. }
  384. arr.unshift(arr1, arr2, arr3, arr4);
  385. var obj = [
  386. {
  387. name: '温度',
  388. data: arr[0],
  389. color: '#F97000',
  390. },
  391. {
  392. name: '湿度',
  393. data: arr[1],
  394. color: '#00E29D',
  395. },
  396. {
  397. name: '电池电压',
  398. data: arr[2],
  399. color: '#FF3F3F',
  400. },
  401. {
  402. name: '充电电压',
  403. data: arr[3],
  404. color: '#6CBBFF',
  405. },
  406. ];
  407. var obj2 = [
  408. {
  409. name: '击虫次数',
  410. data: arr5,
  411. color: '#00E29D',
  412. },
  413. ];
  414. // console.log(obj)
  415. this.showColumn('canvasColumnA', xtitle, obj);
  416. this.showColumnb('canvasColumnB', xtitle, obj2);
  417. }
  418. },
  419. changeindex(index) {
  420. //选择日期
  421. this.titleidnex = index;
  422. var now = new Date();
  423. if (index == 0) {
  424. this.newtime = parseInt(+new Date(now) / 1000);
  425. this.oldtime = parseInt((presenttime - 24 * 60 * 60 * 1000) / 1000);
  426. this.getServerData(
  427. parseInt(presenttime / 1000),
  428. parseInt((presenttime - 24 * 60 * 60 * 1000) / 1000)
  429. );
  430. this.historydata(
  431. parseInt(presenttime / 1000),
  432. parseInt((presenttime - 24 * 60 * 60 * 1000) / 1000)
  433. );
  434. } else if (index == 1) {
  435. this.newtime = parseInt(+new Date(now) / 1000);
  436. var oldtime = now.setMonth(now.getMonth() - 1) / 1000;
  437. this.oldtime = parseInt(oldtime);
  438. this.getServerData(parseInt(presenttime / 1000), parseInt(oldtime));
  439. this.historydata(parseInt(presenttime / 1000), parseInt(oldtime));
  440. } else if (index == 2) {
  441. this.newtime = parseInt(+new Date(now) / 1000);
  442. var oldtime = now.setMonth(now.getMonth() - 6) / 1000;
  443. this.oldtime = parseInt(oldtime);
  444. this.getServerData(parseInt(presenttime / 1000), parseInt(oldtime));
  445. this.historydata(parseInt(presenttime / 1000), parseInt(oldtime));
  446. } else if (index == 3) {
  447. this.newtime = parseInt(+new Date(now) / 1000);
  448. var oldtime = now.setFullYear(now.getFullYear() - 1) / 1000;
  449. this.oldtime = parseInt(oldtime);
  450. this.getServerData(parseInt(presenttime / 1000), parseInt(oldtime));
  451. this.historydata(parseInt(presenttime / 1000), parseInt(oldtime));
  452. }
  453. },
  454. async historydata(newtime, oldtimes) {
  455. //设备表格数据
  456. const res = await this.$myRequest({
  457. url: '/api/api_gateway?method=forecast.worm_lamp.device_history_data',
  458. data: {
  459. device_type_id: 2,
  460. device_id: this.times.imei,
  461. page: this.page,
  462. page_size: 10,
  463. start_time: oldtimes,
  464. end_time: newtime,
  465. },
  466. });
  467. console.log(res.data);
  468. this.pagesum = Math.ceil(res.counts / 10) || 1;
  469. this.eqlistdata = res.data;
  470. if (res.data.length == 0) {
  471. this.forbidden = false;
  472. } else {
  473. this.forbidden = true;
  474. }
  475. },
  476. prev() {
  477. //上一页
  478. if (this.page != 1) {
  479. this.page--;
  480. this.historydata(this.newtime, this.oldtime);
  481. }
  482. },
  483. next() {
  484. //下一页
  485. if (this.page < this.pagesum) {
  486. this.page++;
  487. this.historydata(this.newtime, this.oldtime);
  488. }
  489. },
  490. tiemchange(e) {
  491. console.log(e);
  492. this.oldtime = +new Date(e.startDate) / 1000;
  493. this.newtime = +new Date(e.endDate) / 1000 + 16 * 60 * 60;
  494. this.getServerData(this.newtime, this.oldtime);
  495. this.historydata(this.newtime, this.oldtime);
  496. },
  497. timetab(e) {
  498. e = new Date(e * 1000);
  499. var year = e.getFullYear();
  500. var month =
  501. e.getMonth() + 1 < 10 ? '0' + (e.getMonth() + 1) : e.getMonth() + 1;
  502. var day = e.getDate() < 10 ? '0' + e.getDate() : e.getDate();
  503. var time = year + '/' + month + '/' + day;
  504. return time;
  505. },
  506. clickLeft() {
  507. uni.navigateBack({
  508. delta: 1,
  509. });
  510. },
  511. showColumn(id, xtitle, xinfo) {
  512. var _self = this;
  513. const ctx = uni.createCanvasContext(id, this);
  514. canvaColumnA = new uCharts({
  515. context: ctx,
  516. type: 'line',
  517. legend: {
  518. position: 'top',
  519. },
  520. fontSize: 11,
  521. background: '#FFFFFF',
  522. pixelRatio: 1,
  523. animation: true,
  524. dataLabel: false,
  525. categories: xtitle,
  526. series: xinfo,
  527. enableScroll: true, //开启图表拖拽功能
  528. xAxis: {
  529. disableGrid: true,
  530. type: 'grid',
  531. gridType: 'dash',
  532. itemCount: 4, //x轴单屏显示数据的数量,默认为5个
  533. scrollShow: true, //新增是否显示滚动条,默认false
  534. // scrollAlign: 'left', //滚动条初始位置
  535. scrollBackgroundColor: '#F7F7FF', //默认为 #EFEBEF
  536. scrollColor: '#DEE7F7', //默认为 #A6A6A6
  537. },
  538. yAxis: {},
  539. width: _self.cWidth * 1,
  540. height: _self.cHeight * 1,
  541. extra: {
  542. line: {
  543. type: 'curve',
  544. },
  545. },
  546. });
  547. },
  548. showColumnb(id, xtitle, xinfo) {
  549. var _self = this;
  550. const ctx = uni.createCanvasContext(id, this);
  551. canvaColumnB = new uCharts({
  552. context: ctx,
  553. type: 'line',
  554. legend: {
  555. position: 'top',
  556. },
  557. fontSize: 11,
  558. background: '#FFFFFF',
  559. pixelRatio: 1,
  560. animation: true,
  561. dataLabel: false,
  562. categories: xtitle,
  563. series: xinfo,
  564. enableScroll: true, //开启图表拖拽功能
  565. xAxis: {
  566. disableGrid: true,
  567. type: 'grid',
  568. gridType: 'dash',
  569. itemCount: 4, //x轴单屏显示数据的数量,默认为5个
  570. scrollShow: true, //新增是否显示滚动条,默认false
  571. // scrollAlign: 'left', //滚动条初始位置
  572. scrollBackgroundColor: '#F7F7FF', //默认为 #EFEBEF
  573. scrollColor: '#DEE7F7', //默认为 #A6A6A6
  574. },
  575. yAxis: {},
  576. width: _self.cWidth * 1,
  577. height: _self.cHeight * 1,
  578. extra: {
  579. line: {
  580. type: 'curve',
  581. },
  582. },
  583. });
  584. },
  585. touchLineA(e) {
  586. console.log(e);
  587. canvaColumnA.scrollStart(e);
  588. },
  589. moveLineA(e) {
  590. canvaColumnA.scroll(e);
  591. },
  592. touchEndLineA(e) {
  593. canvaColumnA.scrollEnd(e);
  594. //下面是toolTip事件,如果滚动后不需要显示,可不填写
  595. canvaColumnA.showToolTip(e, {
  596. format: function (item, category) {
  597. return (
  598. category + ' ' + item.name + ':' + Number(item.data).toFixed(3)
  599. );
  600. },
  601. });
  602. },
  603. touchLineBb(e) {
  604. console.log(e);
  605. canvaColumnB.scrollStart(e);
  606. },
  607. moveLineBb(e) {
  608. canvaColumnB.scroll(e);
  609. },
  610. touchEndLineBb(e) {
  611. canvaColumnB.scrollEnd(e);
  612. //下面是toolTip事件,如果滚动后不需要显示,可不填写
  613. canvaColumnB.showToolTip(e, {
  614. format: function (item, category) {
  615. return category + ' ' + item.name + ':' + item.data;
  616. },
  617. });
  618. },
  619. async newdata() {
  620. const res = await this.$myRequest({
  621. url: '/api/api_gateway?method=forecast.send_control.get_device_config',
  622. data: {
  623. device_type_id: 2,
  624. d_id: this.times.d_id,
  625. control_type: 'data',
  626. },
  627. });
  628. if (res) {
  629. uni.showToast({
  630. title: '刷新成功',
  631. duration: 2000,
  632. icon: 'none',
  633. });
  634. } else {
  635. uni.showToast({
  636. title: '刷新失败',
  637. duration: 2000,
  638. icon: 'none',
  639. });
  640. }
  641. },
  642. refresh() {
  643. //获取当前时间的数据
  644. this.newdata();
  645. },
  646. async getworm() {
  647. const res = await this.$myRequest({
  648. url: '/api/api_gateway?method=forecast.send_control.clear_insects_permission',
  649. data: {},
  650. });
  651. console.log(res);
  652. this.allqingchong = res[2] == 1 ? false : true;
  653. },
  654. },
  655. };
  656. </script>
  657. <style lang="scss">
  658. /*样式的width和height一定要与定义的cWidth和cHeight相对应*/
  659. .shuju_one,
  660. .shuju_two {
  661. position: absolute;
  662. top: 190rpx;
  663. width: 90%;
  664. left: 5%;
  665. box-shadow: 0 0 10rpx #bcb9ca;
  666. padding-top: 20rpx;
  667. height: 550rpx;
  668. .canvastishi {
  669. font-size: 32rpx;
  670. position: absolute;
  671. top: 50%;
  672. left: 50%;
  673. margin-left: -64rpx;
  674. margin-top: -21rpx;
  675. .dataloading:after {
  676. overflow: hidden;
  677. display: inline-block;
  678. vertical-align: bottom;
  679. animation: ellipsis 2s infinite;
  680. content: '\2026';
  681. }
  682. @keyframes ellipsis {
  683. from {
  684. width: 2px;
  685. }
  686. to {
  687. width: 15px;
  688. }
  689. }
  690. }
  691. .shuju_one_title {
  692. width: 70%;
  693. margin: 0 auto;
  694. display: flex;
  695. .tltle_text {
  696. width: 25%;
  697. border: 2rpx solid #b2b2b2;
  698. color: #57c878;
  699. text-align: center;
  700. font-size: 24rpx;
  701. height: 50rpx;
  702. line-height: 50rpx;
  703. }
  704. .title_text_color {
  705. width: 25%;
  706. border: 2rpx solid #57c878;
  707. background-color: #57c878;
  708. color: #fff;
  709. text-align: center;
  710. font-size: 24rpx;
  711. height: 50rpx;
  712. line-height: 50rpx;
  713. }
  714. }
  715. .qiun-columns {
  716. .qiun-charts {
  717. width: 650upx;
  718. height: 400upx;
  719. background-color: #ffffff;
  720. }
  721. .charts {
  722. width: 650upx;
  723. height: 400upx;
  724. background-color: #ffffff;
  725. }
  726. }
  727. }
  728. .shuju_two {
  729. top: 790rpx;
  730. }
  731. .selecttimes {
  732. position: absolute;
  733. top: 54px;
  734. width: 90%;
  735. box-shadow: 0 0 10rpx #bcb9ca;
  736. left: 5%;
  737. padding: 10rpx 20rpx;
  738. box-sizing: border-box;
  739. .timesbox {
  740. display: flex;
  741. justify-content: space-around;
  742. image {
  743. width: 30rpx;
  744. height: 30rpx;
  745. margin-top: 6rpx;
  746. }
  747. .icon {
  748. color: #949494;
  749. text-align: right;
  750. margin-left: 30rpx;
  751. }
  752. }
  753. }
  754. .refresh {
  755. position: absolute;
  756. left: 5%;
  757. width: 160rpx;
  758. height: 50rpx;
  759. background-color: #57c878;
  760. color: #ffffff;
  761. line-height: 50rpx;
  762. text-align: center;
  763. box-shadow: 0 0 10rpx #bcb9ca;
  764. }
  765. .condition {
  766. position: absolute;
  767. display: flex;
  768. flex-wrap: wrap;
  769. width: 90%;
  770. left: 5%;
  771. box-shadow: 0 0 10rpx #bcb9ca;
  772. margin-bottom: 30rpx;
  773. .scroll-X {
  774. width: 95%;
  775. margin: 20rpx auto;
  776. .table {
  777. width: 1056px;
  778. }
  779. .tr {
  780. display: flex;
  781. overflow: hidden;
  782. .th,
  783. .td {
  784. display: inline-block;
  785. padding: 5rpx;
  786. width: 140rpx;
  787. text-align: center;
  788. height: 52rpx;
  789. line-height: 52rpx;
  790. // border: 2rpx solid #F1F1F1;
  791. }
  792. .th:first-child,
  793. .td:first-child {
  794. width: 300rpx;
  795. }
  796. .th:nth-last-child(1),
  797. .th:nth-last-child(2),
  798. .td:nth-last-child(1),
  799. .td:nth-last-child(2) {
  800. width: 200rpx;
  801. }
  802. }
  803. .tr:nth-child(2n-1) {
  804. background-color: #f5fff8;
  805. }
  806. .tr:first-child {
  807. background-color: #57c878;
  808. color: #fff;
  809. }
  810. }
  811. .pagenumber {
  812. display: flex;
  813. margin: 20rpx auto;
  814. button {
  815. width: 150rpx;
  816. height: 50rpx;
  817. line-height: 50rpx;
  818. font-size: 26rpx;
  819. text-align: center;
  820. background-color: #57c878;
  821. color: #ffffff;
  822. }
  823. .pagenumber_page {
  824. width: 150rpx;
  825. height: 50rpx;
  826. line-height: 50rpx;
  827. font-size: 26rpx;
  828. text-align: center;
  829. }
  830. }
  831. }
  832. ::v-deep .u-calendar__action {
  833. display: flex;
  834. justify-content: space-around;
  835. .u-calendar__action__text {
  836. line-height: 25px;
  837. }
  838. }
  839. </style>