ucharts.vue 23 KB

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