|
@@ -5,17 +5,9 @@
|
|
|
<view class="main">
|
|
|
<!-- 标签 -->
|
|
|
<view class="tabs">
|
|
|
- <view class="tabs-item item-checked">
|
|
|
- 当天
|
|
|
- </view>
|
|
|
- <view class="tabs-item">
|
|
|
- 一周
|
|
|
- </view>
|
|
|
- <view class="tabs-item">
|
|
|
- 当天
|
|
|
- </view>
|
|
|
- <view class="tabs-item">
|
|
|
- 自定义
|
|
|
+ <view class="tabs-item" v-for="(item,index) in tabsList" :key="index"
|
|
|
+ :class="tabsIndex==index ? 'item-checked' : ''" @click="tabsClick(item,index)">
|
|
|
+ {{item}}
|
|
|
</view>
|
|
|
</view>
|
|
|
<!-- 数据统计 -->
|
|
@@ -125,20 +117,67 @@
|
|
|
|
|
|
<script>
|
|
|
import * as echarts from 'echarts';
|
|
|
+ import {
|
|
|
+ parseUnixTime,
|
|
|
+ beforeTimeStamp,
|
|
|
+ getWeek
|
|
|
+ } from '@/apis/utils'
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ workForm: {
|
|
|
+ qkey: '',
|
|
|
+ startDate: '',
|
|
|
+ endDate: ''
|
|
|
+ }, //工单数据查询
|
|
|
+ today: '', //当天
|
|
|
+ weekStart: '', //一周
|
|
|
+ weekEnd: '',
|
|
|
+ monthStart: '', //一月
|
|
|
+ monthEnd: '',
|
|
|
+ show: false,
|
|
|
+ tabsList: ['当天','一周','一月','自定义'], //时间标签list
|
|
|
+ tabsIndex: 0,
|
|
|
myChart: null,
|
|
|
background: {
|
|
|
backgroundColor: '#1677FF'
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ onLoad() {
|
|
|
+ this.today = parseUnixTime(new Date(), '{y}-{m}-{d}');
|
|
|
+
|
|
|
+ const today = new Date();
|
|
|
+ const firstDay = new Date(today.setDate(today.getDate() - today.getDay() + 1));
|
|
|
+ const lastDay = new Date(today.setDate(today.getDate() - today.getDay() + 7));
|
|
|
+ this.weekStart = parseUnixTime(firstDay, '{y}-{m}-{d}');
|
|
|
+ this.weekEnd = parseUnixTime(lastDay, '{y}-{m}-{d}');
|
|
|
+
|
|
|
+ console.log('当天:'+this.today+'\n'+'一周:'+this.weekStart+'至'+this.weekEnd+'\n'
|
|
|
+ +'一月:'+this.monthStart+'至'+this.monthEnd)
|
|
|
+ },
|
|
|
onReady() {
|
|
|
this.getBarCharts();
|
|
|
},
|
|
|
methods: {
|
|
|
+ //选择时间
|
|
|
+ tabsClick(item,index) {
|
|
|
+ this.tabsIndex = index;
|
|
|
+ if(index == 0) {
|
|
|
+ this.workForm.startDate = this.today;
|
|
|
+ this.workForm.endDate = this.today;
|
|
|
+ } else if(index == 1) {
|
|
|
+ this.workForm.startDate = this.weekStart;
|
|
|
+ this.workForm.endDate = this.weekEnd;
|
|
|
+ } else if(index == 2) {
|
|
|
+ this.workForm.startDate = this.monthStart;
|
|
|
+ this.workForm.endDate = this.monthEnd;
|
|
|
+ } else {
|
|
|
+ this.show = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //每月工单数量图
|
|
|
getBarCharts(list) {
|
|
|
if (!this.myChart) {
|
|
|
this.myChart = echarts.init(document.getElementById('barEcharts'), null, {
|