ucharts.vue 24 KB

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