mainStatistics.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898
  1. <template>
  2. <view>
  3. <view class="head">
  4. <view class="">
  5. <image class="userFlagimg" src="../../static/img/userFlag.png" mode=""></image>
  6. </view>
  7. <view class="pname">
  8. <font class="wenzi" style="color: #BDD6F3;font-size:28upx"> {{$t('mainStatistics.name')}}: {{pnameData}}</font>
  9. </view>
  10. <view class="company">
  11. <font style="color: #BDD6F3;font-size:28upx">{{$t('mainStatistics.company')}}</font>
  12. </view>
  13. </view>
  14. <view class="ri">
  15. <view class="riShell">
  16. <view class="riImg">
  17. <image style="width: 64upx;height: 64upx;padding-top: 20upx;" :src="$t('mainStatistics.dayImg')"></image>
  18. </view>
  19. <view class="riTitle">
  20. <view style="text-align:left;font-size:28upx;font-family:PingFang-SC-Medium">
  21. <font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.dayTotalMoney')}}:</font>
  22. <font style="color: #ED341F;">{{dayRandomTimes}}</font>
  23. </view>
  24. <view style="text-align:left;font-size:28upx;font-family:PingFang-SC-Medium">
  25. <font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.dayTotalNum')}}:</font>
  26. <font style="color: #ED341F;">{{dayRegularTimes}}</font>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="riqi">
  31. <view style="text-align:right" class="tody">
  32. <font style="color: #596D83;">{{today}}</font>
  33. </view>
  34. <view style="text-align:right" class="xingqi">
  35. <font style="color: #596D83;">{{week}}</font>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="fourTitle">
  40. <view class="four">
  41. <view class="fourImg">
  42. <image style="width: 54upx;height: 54upx;padding-top: 20upx;" :src="$t('mainStatistics.weekImg')" mode=""></image>
  43. </view>
  44. <view class="fourShell">
  45. <view class="one">
  46. <font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.weekTotalMoney')}}:</font>
  47. <font style="color: #ED341F;">{{weekRandomTimes}}</font>
  48. </view>
  49. <view class="two">
  50. <font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.weekTotalNum')}}:</font>
  51. <font style="color: #ED341F;">{{weekRegularTimes}}</font>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="four">
  56. <view class="fourImg">
  57. <image style="width: 54upx;height: 54upx;padding-top: 20upx;" :src="$t('mainStatistics.monthImg')" mode=""></image>
  58. </view>
  59. <view class="fourShell">
  60. <view class="one">
  61. <font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.monthTotalMoney')}}:</font>
  62. <font style="color: #ED341F;">{{monthRandomTimes}}</font>
  63. </view>
  64. <view class="two">
  65. <font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.monthTotalNum')}}:</font>
  66. <font style="color: #ED341F;">{{monthRegularTimes}}</font>
  67. </view>
  68. </view>
  69. </view>
  70. <view class="four">
  71. <view class="fourImg">
  72. <image style="width: 54upx;height: 54upx;padding-top: 20upx;" :src="$t('mainStatistics.yearImg')" mode=""></image>
  73. </view>
  74. <view class="fourShell">
  75. <view class="one">
  76. <font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.yearTotalMoney')}}:</font>
  77. <font style="color: #ED341F;">{{yearRandomTimes}}</font>
  78. </view>
  79. <view class="two">
  80. <font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.yearTotalNum')}}:</font>
  81. <font style="color: #ED341F;">{{yearRegularTimes}}</font>
  82. </view>
  83. </view>
  84. </view>
  85. <view class="four">
  86. <view class="fourImg">
  87. <image style="width: 54upx;height: 54upx;padding-top: 20upx;" :src="$t('mainStatistics.allImg')" mode=""></image>
  88. </view>
  89. <view class="fourShell">
  90. <view class="one">
  91. <font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.machineTotalNum')}}:</font>
  92. <font style="color: #ED341F;">{{machineTotalNum}}</font>
  93. </view>
  94. <view class="two">
  95. <font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.machineUseNum')}}:</font>
  96. <font style="color: #ED341F;">{{machineUseNum}}</font>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. <!-- <view class="qiun-columns">
  102. <view class="qiun-bg-white qiun-title-bar qiun-common-mt">
  103. <view class="qiun-title-dot-light">
  104. <view class="dis">{{$t('mainStatistics.day')}}</view>
  105. </view>
  106. <view class="shijian" style="text-align: center;position: relative;">
  107. <image @click="pre('day')" class="preImg" src="/static/img/leftTriangle.png"></image>
  108. <span>{{startDate1}}</span>
  109. <image @click="next('day')" class="nextImg" src="/static/img/rightTriangle.png"></image>
  110. </view>
  111. </view>
  112. <view class="qiun-charts" style="background-color: #FFFFFF;">
  113. <canvas canvas-id="canvaColumn1" id="canvaColumn1" class="charts" disable-scroll=true @touchstart="touchLine1"
  114. @touchmove="moveLine1" @touchend="touchEndLine1" style="background-color: #FFFFFF;"></canvas>
  115. </view>
  116. </view>
  117. <view class="line"></view> -->
  118. <!-- <view class="qiun-columns">
  119. <view class="qiun-bg-white qiun-title-bar qiun-common-mt">
  120. <view class="qiun-title-dot-light">
  121. <view class="dis">{{$t('mainStatistics.week')}}</view>
  122. </view>
  123. <view class="shijian" style="text-align: center;position: relative;">
  124. <image @click="pre('week')" class="preImg" src="/static/img/leftTriangle.png"></image>
  125. <span>{{startDate2}} -- {{endDate2}}</span>
  126. <image @click="next('week')" class="nextImg" src="/static/img/rightTriangle.png"></image>
  127. </view>
  128. </view>
  129. <view class="qiun-charts" style="background-color: #FFFFFF;">
  130. <canvas canvas-id="canvaColumn2" id="canvaColumn2" class="charts" disable-scroll=true @touchstart="touchLine2"
  131. @touchmove="moveLine2" @touchend="touchEndLine2" style="background-color: #FFFFFF;"></canvas>
  132. </view>
  133. </view>
  134. <view class="line"></view> -->
  135. <!-- <view class="qiun-columns">
  136. <view class="qiun-bg-white qiun-title-bar qiun-common-mt">
  137. <view class="qiun-title-dot-light">
  138. <view class="dis">{{$t('mainStatistics.month')}}</view>
  139. </view>
  140. <view class="shijian" style="text-align: center;position: relative;">
  141. <image @click="pre('month')" class="preImg" src="/static/img/leftTriangle.png"></image>
  142. <span>{{startDate3}} -- {{endDate3}}</span>
  143. <image @click="next('month')" class="nextImg" src="/static/img/rightTriangle.png"></image>
  144. </view>
  145. </view>
  146. <view class="qiun-charts" style="background-color: #FFFFFF;">
  147. <canvas canvas-id="canvaColumn3" id="canvaColumn3" class="charts" disable-scroll=true @touchstart="touchLine3"
  148. @touchmove="moveLine3" @touchend="touchEndLine3" style="background-color: #FFFFFF;"></canvas>
  149. </view>
  150. </view>
  151. <view class="line"></view> -->
  152. <!-- <view class="qiun-columns">
  153. <view class="qiun-bg-white qiun-title-bar qiun-common-mt">
  154. <view class="qiun-title-dot-light">
  155. <view class="dis">{{$t('mainStatistics.year')}}</view>
  156. </view>
  157. <view class="shijian" style="text-align: center;position: relative;">
  158. <image @click="pre('year')" class="preImg" src="/static/img/leftTriangle.png"></image>
  159. <span>{{startDate4}} -- {{endDate4}}</span>
  160. <image @click="next('year')" class="nextImg" src="/static/img/rightTriangle.png"></image>
  161. </view>
  162. </view>
  163. <view class="qiun-charts" style="background-color: #FFFFFF;">
  164. <canvas canvas-id="canvaColumn4" id="canvaColumn4" class="charts" disable-scroll=true @touchstart="touchLine4"
  165. @touchmove="moveLine4" @touchend="touchEndLine4" style="background-color: #FFFFFF;"></canvas>
  166. </view>
  167. </view> -->
  168. </view>
  169. </template>
  170. <script>
  171. import {
  172. mapState,
  173. mapActions,
  174. mapMutations
  175. } from 'vuex';
  176. import uCharts from '@/components/u-charts/u-charts.js';
  177. import {
  178. dateUtils
  179. } from '@/common/util.js';
  180. var _self;
  181. // var canvaColumn1 = null;
  182. // var canvaColumn2 = null;
  183. // var canvaColumn3 = null;
  184. // var canvaColumn4 = null;
  185. export default {
  186. name: 'mainStatistics',
  187. props: {
  188. equipmentId: '',
  189. adminId: '',
  190. pname: '',
  191. },
  192. data() {
  193. return {
  194. machineTotalNum: 0,
  195. machineUseNum: 0,
  196. dayRandomTimes: 0,
  197. dayRegularTimes: 0,
  198. weekRandomTimes: 0,
  199. weekRegularTimes: 0,
  200. monthRandomTimes: 0,
  201. monthRegularTimes: 0,
  202. yearRandomTimes: 0,
  203. yearRegularTimes: 0,
  204. cWidth: '',
  205. cHeight: '',
  206. pixelRatio: 1,
  207. startDate1: '',
  208. startDate2: '',
  209. endDate2: '',
  210. startDate3: '',
  211. endDate3: '',
  212. startDate4: '',
  213. endDate4: '',
  214. today: '',
  215. week: ''
  216. }
  217. },
  218. computed: {
  219. ...mapState(['loginUser']),
  220. pnameData: {
  221. get() {
  222. return this.pname;
  223. }
  224. },
  225. },
  226. onShow() {
  227. uni.setNavigationBarTitle({
  228. title: this.$t('mainStatistics.title')
  229. });
  230. uni.setTabBarItem({
  231. index: 0,
  232. text: this.$t('tabs.tab1')
  233. });
  234. var token = uni.getStorageSync("token");
  235. if (token.toString().length > 1) {
  236. this.init();
  237. }else{
  238. uni.reLaunch({
  239. url: '../Login/Login',
  240. });
  241. }
  242. // console.log("onShow");
  243. var test = uni.getStorageSync('test');
  244. var globalUser = uni.getStorageSync("globalUser");
  245. if (globalUser.toString().length > 1) {
  246. //判断是不是初次登陆
  247. if (test == 2) {
  248. this.init();
  249. }
  250. }
  251. var id = this.adminId;
  252. this.day();
  253. // this.equipmentStatus();
  254. },
  255. mounted() {
  256. var token = uni.getStorageSync("token");
  257. if (token.toString().length > 1) {
  258. this.init();
  259. }else{
  260. uni.reLaunch({
  261. url: '../Login/Login',
  262. });
  263. }
  264. // this.day();
  265. this.equipmentStatus();
  266. },
  267. methods: {
  268. ...mapActions('chart', ['getStatistics', 'getMainStatistics', 'getMachineNum']),
  269. async init() {
  270. if (!this.pname) {
  271. this.pname = this.loginUser.name;
  272. }
  273. _self = this;
  274. //图表中图
  275. this.cWidth = uni.upx2px(690);
  276. this.cHeight = uni.upx2px(370);
  277. await this.getMainStatisticsData();
  278. // await this.initDateRang(new Date(), 'day');
  279. // await this.initDateRang(new Date(), 'week');
  280. // await this.initDateRang(new Date(), 'month');
  281. // await this.initDateRang(new Date(), 'year');
  282. //初次登陆跳转后,把test变成2
  283. uni.setStorageSync('test', '2');
  284. },
  285. day() {
  286. var date = new Date();
  287. // var daystr = dateUtils.formateDate(date, 'yyyy年MM月dd日');
  288. var daystr = dateUtils.formateDate(date, 'yyyy-MM-dd');
  289. this.today = daystr;
  290. // var str= '星期'+'日一二三四五六'.charAt(date.getDay());
  291. this.week = this.$t('mainStatistics.week' + date.getDay());
  292. },
  293. equipmentStatus(){
  294. var id = uni.getStorageSync("globalUser").id;
  295. var token = uni.getStorageSync("token");
  296. uni.request({
  297. url: this.serverurl + '/TEquipment/equipmentStatus',
  298. data: {
  299. "adminId": id
  300. },
  301. header:{
  302. 'token':token
  303. },
  304. method: "POST",
  305. success: (res) => {
  306. },
  307. });
  308. },
  309. // initDateRang(day, chartType) {
  310. // const daystr = dateUtils.formateDate(day, 'yyyy/MM/dd');
  311. // if (chartType === 'day') {
  312. // this.startDate1 = dateUtils.formateDate(day, 'yyyy/MM/dd');
  313. // }
  314. // if (chartType === 'week') {
  315. // this.startDate2 = dateUtils.formateDate(dateUtils.getFirstDayOfWeek(day), 'yyyy/MM/dd');
  316. // this.endDate2 = dateUtils.formateDate(dateUtils.getLastDayOfWeek(day), 'yyyy/MM/dd');
  317. // }
  318. // if (chartType === 'month') {
  319. // this.startDate3 = dateUtils.formateDate(dateUtils.getCurrentMonFirstDate(day), 'yyyy/MM/dd');
  320. // this.endDate3 = dateUtils.formateDate(dateUtils.getCurrentMonLastDate(day), 'yyyy/MM/dd');
  321. // }
  322. // if (chartType === 'year') {
  323. // this.startDate4 = dateUtils.formateDate(dateUtils.getCurrentYearFirstDate(day), 'yyyy/MM/dd');
  324. // this.endDate4 = dateUtils.formateDate(dateUtils.getCurrentYearLastDate(day), 'yyyy/MM/dd');
  325. // }
  326. // return this.getStatisticsData(chartType);
  327. // },
  328. /**上一个 */
  329. // pre(chartType) {
  330. // let day;
  331. // if (chartType === 'day') { // 日
  332. // day = new Date(this.startDate1);
  333. // day.setDate(day.getDate() - 1);
  334. // }
  335. // if (chartType === 'week') { // 周
  336. // day = new Date(this.startDate2);
  337. // day.setDate(day.getDate() - 7);
  338. // }
  339. // if (chartType === 'month') { // 月
  340. // day = new Date(this.startDate3);
  341. // day.setMonth(day.getMonth() - 1);
  342. // }
  343. // if (chartType === 'year') { // 年
  344. // day = new Date(this.startDate4);
  345. // day.setFullYear(day.getFullYear() - 1);
  346. // }
  347. // this.initDateRang(day, chartType);
  348. // },
  349. // /**下一个 */
  350. // next(chartType) {
  351. // let day;
  352. // if (chartType === 'day') { // 日
  353. // day = new Date(this.startDate1);
  354. // day.setDate(day.getDate() + 1);
  355. // }
  356. // if (chartType === 'week') { // 周
  357. // day = new Date(this.startDate2);
  358. // day.setDate(day.getDate() + 7);
  359. // }
  360. // if (chartType === 'month') { // 月
  361. // day = new Date(this.startDate3);
  362. // day.setMonth(day.getMonth() + 1);
  363. // }
  364. // if (chartType === 'year') { // 年
  365. // day = new Date(this.startDate4);
  366. // day.setFullYear(day.getFullYear() + 1);
  367. // }
  368. // this.initDateRang(day, chartType);
  369. // },
  370. // getStatisticsData(chartType) {
  371. // const param = {
  372. // 'chartType': chartType
  373. // };
  374. // if (chartType == 'day') {
  375. // param['startDate'] = this.startDate1;
  376. // param['endDate'] = this.startDate1;
  377. // }
  378. // if (chartType == 'week') {
  379. // param['startDate'] = this.startDate2;
  380. // param['endDate'] = this.endDate2;
  381. // }
  382. // if (chartType == 'month') {
  383. // param['startDate'] = this.startDate3;
  384. // param['endDate'] = this.endDate3;
  385. // }
  386. // if (chartType == 'year') {
  387. // param['startDate'] = this.startDate4;
  388. // param['endDate'] = this.endDate4;
  389. // }
  390. // if (this.adminId) { // 子组件,则拿传过来的参
  391. // param['adminId'] = this.adminId;
  392. // } else if ('admin' !== this.loginUser['username']) { //否则为主页,拿登录用户
  393. // param['adminId'] = this.loginUser['id'];
  394. // }
  395. // var globalUser = uni.getStorageSync("globalUser");
  396. // if (globalUser.id != 1) {
  397. // if (param.adminId == null || param.adminId == undefined) {
  398. // param['adminId'] = globalUser.id;
  399. // }
  400. // }
  401. // if (this.equipmentId) {
  402. // param['equipmentId'] = this.equipmentId;
  403. // }
  404. // return this.getStatistics(param)
  405. // .then(data => {
  406. // uni.stopPullDownRefresh();
  407. // if (param['chartType'] == 'day') {
  408. // canvaColumn1 = this.initChart('canvaColumn1', data);
  409. // }
  410. // if (param['chartType'] == 'week') {
  411. // canvaColumn2 = this.initChart('canvaColumn2', data);
  412. // }
  413. // if (param['chartType'] == 'month') {
  414. // canvaColumn3 = this.initChart('canvaColumn3', data);
  415. // }
  416. // if (param['chartType'] == 'year') {
  417. // canvaColumn4 = this.initChart('canvaColumn4', data);
  418. // }
  419. // }, _ => {
  420. // uni.stopPullDownRefresh();
  421. // if (param['chartType'] == 'day') {
  422. // canvaColumn1 = this.initChart('canvaColumn1', {
  423. // categories: ['暂无数据'],
  424. // series: [{
  425. // name: '销售个数',
  426. // data: [0]
  427. // }]
  428. // });
  429. // }
  430. // if (param['chartType'] == 'week') {
  431. // canvaColumn2 = this.initChart('canvaColumn2', {
  432. // categories: ['暂无数据'],
  433. // series: [{
  434. // name: '销售个数',
  435. // data: [0]
  436. // }]
  437. // });
  438. // }
  439. // if (param['chartType'] == 'month') {
  440. // canvaColumn3 = this.initChart('canvaColumn3', {
  441. // categories: ['暂无数据'],
  442. // series: [{
  443. // name: '销售个数',
  444. // data: [0]
  445. // }]
  446. // });
  447. // }
  448. // if (param['chartType'] == 'year') {
  449. // canvaColumn4 = this.initChart('canvaColumn4', {
  450. // categories: ['暂无数据'],
  451. // series: [{
  452. // name: '销售个数',
  453. // data: [0]
  454. // }]
  455. // });
  456. // }
  457. // });
  458. // },
  459. // initChart(canvasId, chartData) {
  460. // if (this.$t('lang') != 'zh') {
  461. // chartData.categories = chartData.categories.map(e => {
  462. // if (e.indexOf('点') >= 0) {
  463. // return e.replace('点', this.$t('mainStatistics.oclock'));
  464. // }
  465. // if (e.indexOf('周') >= 0) {
  466. // const weekNum = e.substring(e.length - 1) == '日' ? '0' : e.substring(e.length - 1);
  467. // return this.$t('mainStatistics.week' + weekNum);
  468. // }
  469. // if (e.indexOf('月') >= 0) {
  470. // var res = e.toString();
  471. // if (res.length > 3) {
  472. // return e.replace('月', this.$t('mainStatistics.mon'));
  473. // } else {
  474. // return e.replace('月', this.$t('mainStatistics.y'));
  475. // }
  476. // }
  477. // return e;
  478. // });
  479. // chartData.series = chartData.series.map(e => {
  480. // if (e['name'] == '销售个数') {
  481. // e['name'] = this.$t('mainStatistics.saleNum');
  482. // }
  483. // if (e['name'] == '销售额') {
  484. // e['name'] = this.$t('mainStatistics.saleroom');
  485. // }
  486. // return e;
  487. // });
  488. // }
  489. // return new uCharts({
  490. // $this: _self,
  491. // canvasId: canvasId,
  492. // enableScroll: true,
  493. // type: 'column',
  494. // legend: true,
  495. // fontSize: 10,
  496. // background: '#FFFFFF', //y轴颜色
  497. // pixelRatio: 1,
  498. // animation: true,
  499. // categories: chartData.categories,
  500. // series: chartData.series,
  501. // xAxis: {
  502. // type: 'grid',
  503. // gridType: 'dash',
  504. // itemCount: 5, //x轴单屏显示数据的数量,默认为5个
  505. // scrollShow: true, //新增是否显示滚动条,默认false
  506. // scrollAlign: 'left', //滚动条初始位置
  507. // scrollBackgroundColor: '#F7F7FF', //默认为 #EFEBEF 滚动条颜色底色
  508. // scrollColor: '#DEE7F7', //默认为 #A6A6A6 滚动条颜色
  509. // disableGrid: true,
  510. // },
  511. // yAxis: {
  512. // type: 'grid',
  513. // gridType: 'soild',
  514. // // disabled:true
  515. // // disableGrid:true,
  516. // },
  517. // dataLabel: true,
  518. // width: _self.cWidth * _self.pixelRatio,
  519. // height: _self.cHeight * _self.pixelRatio,
  520. // extra: {
  521. // column: {
  522. // // width: _self.cWidth*_self.pixelRatio*0.45/chartData.categories.length
  523. // width: 18
  524. // }
  525. // }
  526. // });
  527. // },
  528. getMainStatisticsData() {
  529. const param = {};
  530. if (this.adminId) { // 子组件,则拿传过来的参
  531. param['adminId'] = this.adminId;
  532. } else if ('admin' !== this.loginUser['username']) { //否则为主页,拿登录用户
  533. param['adminId'] = this.loginUser['id'];
  534. }
  535. var globalUser = uni.getStorageSync("globalUser");
  536. if (globalUser.id != 1) {
  537. if (param.adminId == null || param.adminId == undefined) {
  538. param['adminId'] = globalUser.id;
  539. }
  540. }
  541. if (this.equipmentId) {
  542. param['equipmentId'] = this.equipmentId;
  543. }
  544. // console.log('getMainStatisticsData:{}', param);
  545. var adminId = param.adminId;
  546. var equipmentId = this.equipmentId;
  547. var serverurl = this.serverurl;
  548. var token = uni.getStorageSync("token");
  549. uni.request({
  550. url: serverurl + '/TEquipment/getMachineNum',
  551. data: {
  552. "adminId": adminId,
  553. "equipmentId": equipmentId
  554. },
  555. method: "POST",
  556. header:{'token':token},
  557. success: (res) => {
  558. var list = res.data.data;
  559. this.machineTotalNum = list[0];
  560. this.machineUseNum = list[1];
  561. }
  562. });
  563. return this.getMainStatistics(param)
  564. .then(data => {
  565. for (let bean of data) {
  566. if (bean['categorie'] === 'day') {
  567. this.dayRandomTimes = bean['randomTimes'];
  568. this.dayRegularTimes = bean['regularTimes'];
  569. }
  570. if (bean['categorie'] === 'week') {
  571. this.weekRandomTimes = bean['randomTimes'];
  572. this.weekRegularTimes = bean['regularTimes'];
  573. }
  574. if (bean['categorie'] === 'month') {
  575. this.monthRandomTimes = bean['randomTimes'];
  576. this.monthRegularTimes = bean['regularTimes'];
  577. }
  578. if (bean['categorie'] === 'year') {
  579. this.yearRandomTimes = bean['randomTimes'];
  580. this.yearRegularTimes = bean['regularTimes'];
  581. }
  582. }
  583. uni.stopPullDownRefresh();
  584. }, _ => void uni.stopPullDownRefresh());
  585. },
  586. // touchLine1(e) {
  587. // if (canvaColumn1) {
  588. // canvaColumn1.scrollStart(e);
  589. // }
  590. // },
  591. // moveLine1(e) {
  592. // if (canvaColumn1) {
  593. // canvaColumn1.scroll(e);
  594. // }
  595. // },
  596. // touchEndLine1(e) {
  597. // if (canvaColumn1) {
  598. // canvaColumn1.scrollEnd(e);
  599. // //下面是toolTip事件,如果滚动后不需要显示,可不填写
  600. // canvaColumn1.showToolTip(e, {
  601. // format: function(item, category) {
  602. // return category + ' ' + item.name + ':' + item.data
  603. // }
  604. // });
  605. // }
  606. // },
  607. // touchLine2(e) {
  608. // if (canvaColumn2) {
  609. // canvaColumn2.scrollStart(e);
  610. // }
  611. // },
  612. // moveLine2(e) {
  613. // if (canvaColumn2) {
  614. // canvaColumn2.scroll(e);
  615. // }
  616. // },
  617. // touchEndLine2(e) {
  618. // if (canvaColumn2) {
  619. // canvaColumn2.scrollEnd(e);
  620. // //下面是toolTip事件,如果滚动后不需要显示,可不填写
  621. // canvaColumn2.showToolTip(e, {
  622. // format: function(item, category) {
  623. // return category + ' ' + item.name + ':' + item.data
  624. // }
  625. // });
  626. // }
  627. // },
  628. // touchLine3(e) {
  629. // if (canvaColumn3) {
  630. // canvaColumn3.scrollStart(e);
  631. // }
  632. // },
  633. // moveLine3(e) {
  634. // if (canvaColumn3) {
  635. // canvaColumn3.scroll(e);
  636. // }
  637. // },
  638. // touchEndLine3(e) {
  639. // if (canvaColumn3) {
  640. // canvaColumn3.scrollEnd(e);
  641. // //下面是toolTip事件,如果滚动后不需要显示,可不填写
  642. // canvaColumn3.showToolTip(e, {
  643. // format: function(item, category) {
  644. // return category + ' ' + item.name + ':' + item.data
  645. // }
  646. // });
  647. // }
  648. // },
  649. // touchLine4(e) {
  650. // if (canvaColumn4) {
  651. // canvaColumn4.scrollStart(e);
  652. // }
  653. // },
  654. // moveLine4(e) {
  655. // if (canvaColumn4) {
  656. // canvaColumn4.scroll(e);
  657. // }
  658. // },
  659. // touchEndLine4(e) {
  660. // if (canvaColumn4) {
  661. // canvaColumn4.scrollEnd(e);
  662. // //下面是toolTip事件,如果滚动后不需要显示,可不填写
  663. // canvaColumn4.showToolTip(e, {
  664. // format: function(item, category) {
  665. // return category + ' ' + item.name + ':' + item.data
  666. // }
  667. // });
  668. // }
  669. // },
  670. }
  671. }
  672. </script>
  673. <style>
  674. page {
  675. /* background: #F2F2F2; */
  676. background: #FFFFFF;
  677. width: 750upx;
  678. overflow-x: hidden;
  679. }
  680. .head {
  681. display: flex;
  682. flex-direction: row;
  683. background: #206DC3;
  684. width: 750upx;
  685. height: 180upx;
  686. }
  687. .company {
  688. width: 48%;
  689. text-align: right;
  690. }
  691. .pname {
  692. display: flex;
  693. flex-direction: row;
  694. width: 40%;
  695. }
  696. .userFlagimg {
  697. padding-left: 30upx;
  698. padding-top: 10upx;
  699. width: 26upx;
  700. height: 28upx;
  701. }
  702. .wenzi {
  703. padding-left: 5upx;
  704. /* text-align:right; */
  705. white-space: nowrap;
  706. overflow: hidden;
  707. /* text-overflow: ellipsis; */
  708. }
  709. .ri {
  710. width: 690upx;
  711. height: 180upx;
  712. background: #FFFFFF;
  713. border-radius: 15upx;
  714. /* 上移 */
  715. transform: translateY(-90upx);
  716. text-align: center;
  717. margin: auto;
  718. display: flex;
  719. flex-direction: row;
  720. /* 阴影 */
  721. box-shadow: 0upx -1upx 20upx #D3D3D3;
  722. /* box-shadow:0px 0px 10px 5px #aaa; */
  723. }
  724. .riShell {
  725. display: flex;
  726. flex-direction: row;
  727. margin: auto;
  728. }
  729. .riTitle {
  730. display: flex;
  731. flex-direction: column;
  732. margin: auto;
  733. }
  734. .riqi {
  735. display: flex;
  736. flex-direction: column;
  737. margin: auto;
  738. }
  739. .fourTitle {
  740. width: 690upx;
  741. height: 294upx;
  742. display: flex;
  743. flex-direction: row;
  744. flex-wrap: wrap;
  745. background: #FFFFFF;
  746. box-shadow: 0upx 0upx 20upx #D3D3D3;
  747. margin: auto;
  748. border-radius: 15upx;
  749. transform: translateY(-60upx);
  750. }
  751. .four {
  752. display: flex;
  753. flex-direction: row;
  754. margin: auto;
  755. width: 48%;
  756. }
  757. .fourImg {
  758. width: 54upx;
  759. height: 54upx;
  760. }
  761. .qiun-padding {
  762. padding: 2%;
  763. width: 96%;
  764. }
  765. .qiun-wrap {
  766. display: flex;
  767. flex-wrap: wrap;
  768. }
  769. .qiun-rows {
  770. display: flex;
  771. flex-direction: row !important;
  772. }
  773. /* .qiun-columns {
  774. display: flex;
  775. flex-direction: column !important;
  776. } */
  777. /* .qiun-common-mt {
  778. margin-top: 0upx;
  779. height: 160upx;
  780. }
  781. */
  782. /* .qiun-bg-white {
  783. background: #FFFFFF;
  784. } */
  785. /* .qiun-title-bar {
  786. width: 100%;
  787. /* padding: 10upx 2%; */
  788. /* flex-wrap: nowrap;
  789. border-radius: 15upx;
  790. } */
  791. /* .qiun-title-dot-light {
  792. width: 92%;
  793. border-left: 20upx;
  794. border-left: 10upx solid #206DC3;
  795. padding-left: 10upx;
  796. height: 32upx;
  797. /* padding-bottom: 40upx; */
  798. /* font-family: "PingFang-SC-Bold";
  799. font-weight: bold;
  800. margin: auto;
  801. font-size: 32upx;
  802. color: #363D44;
  803. transform: translateY(20upx);
  804. } */
  805. /* .dis {
  806. transform: translateY(-13upx);
  807. font-size: 32upx;
  808. font-family: "PingFang-SC-Bold";
  809. color: #363D44;
  810. } */
  811. /* .shijian {
  812. transform: translateY(40upx);
  813. padding-top: 30upx;
  814. height: 80upx;
  815. width: 690upx;
  816. margin: auto;
  817. box-shadow: 0upx 0upx 10upx #D3D3D3;
  818. } */
  819. .line {
  820. background: #ECECEC;
  821. height: 20upx;
  822. }
  823. /* .qiun-charts {
  824. width: 690upx;
  825. height: 370upx;
  826. padding-top: 50upx;
  827. background-color: #FFFFFF;
  828. margin: auto;
  829. }
  830. */
  831. /* .charts {
  832. width: 690upx;
  833. height: 370upx;
  834. background-color: #FFFFFF;
  835. margin: auto;
  836. } */
  837. /* .preImg {
  838. position: absolute;
  839. left: 30upx;
  840. width: 71upx;
  841. height: 57upx;
  842. }
  843. */
  844. /* .nextImg {
  845. position: absolute;
  846. right: 30upx;
  847. width: 71upx;
  848. height: 57upx;
  849. } */
  850. .fontLeft {
  851. margin-right: 6upx;
  852. }
  853. </style>