From 8e274bba602eed34ff1235b253eb074df7b40d73 Mon Sep 17 00:00:00 2001 From: licp <lichunping@guanfang.com.cn> Date: 星期二, 17 十二月 2024 15:28:45 +0800 Subject: [PATCH] 统计增加时间筛选 --- src/components/do/b1-inspect-order-plan/humidity.vue | 49 ++++++- src/components/view/b4-daily-business-statistics.vue | 135 ++++++++++++++++++--- static/js/menu.js | 2 src/components/view/b4-inspection-item-statistics.vue | 124 ++++++++++++++++--- 4 files changed, 252 insertions(+), 58 deletions(-) diff --git a/src/components/do/b1-inspect-order-plan/humidity.vue b/src/components/do/b1-inspect-order-plan/humidity.vue index 9094738..3fc68d0 100644 --- a/src/components/do/b1-inspect-order-plan/humidity.vue +++ b/src/components/do/b1-inspect-order-plan/humidity.vue @@ -52,6 +52,15 @@ </el-select> </td> </tr> + <tr v-if="item.inspectionItemSubclass&&item.inspectionItemSubclass.includes('浣�')"> + <td>鐢佃皟缁撴灉</td> + <td v-for="(m,i) in item.list0" :key="i"> + <el-input v-model="m.value" :placeholder="'绗�'+(i+1)+'娆�'" size="small" :disabled="state>1" style="display: inline-block;width: 50%;" @change="save(item)"></el-input> + <el-button icon="el-icon-minus" circle size="mini" type="danger" + :disabled="state>1" style="margin: 5px;display: inline-block;" @click="deleteList(item.list0,i,m)" ></el-button> + <el-button icon="el-icon-plus" circle size="mini" type="primary" :disabled="state>1" style="margin: 5px;display: inline-block;" v-if="i==item.list0.length-1&&i<4" @click="addList(item.list0,item.list0.length-1)"></el-button> + </td> + </tr> <tr style="background-color: #F0F1F5;"> <td colspan="2">鏃堕棿</td> <td colspan="1">娓╁害</td> @@ -60,10 +69,10 @@ </tr> <tr v-for="(m,i) in item.list" :key="i+item.id"> <td colspan="2"> - <el-time-picker - v-model="m.time" - placeholder="鏃堕棿" size="small" editable format="HH:mm" value-format="HH:mm" style="width: 100%;" @change="save(item)" :disabled="state>1"> - </el-time-picker> + <el-date-picker + v-model="m.time" + placeholder="鏃堕棿" size="small" editable format="yyyy-MM-dd HH:mm" value-format="yyyy-MM-dd HH:mm" style="width: 100%;" @change="save(item)" :disabled="state>1" type="datetime"> + </el-date-picker> </td> <td colspan="1"> <el-input v-model="m.temperature" placeholder="娓╁害" size="small" @change ="a=>handleReplace(m,'鈩�','temperature',item)" :disabled="state>1"></el-input> @@ -74,7 +83,7 @@ <td colspan="2"> <el-button icon="el-icon-minus" circle size="mini" type="danger" @click="deleteList(item.list,i,item)" :disabled="state>1" style="margin: 5px;"></el-button> - <el-button icon="el-icon-plus" circle size="mini" type="primary" @click="addList(item.list,i)" :disabled="state>1" style="margin: 5px;"></el-button> + <el-button icon="el-icon-plus" circle size="mini" type="primary" @click="addList(item.list,i,'out')" :disabled="state>1" style="margin: 5px;"></el-button> </td> </tr> </template> @@ -113,7 +122,9 @@ if(!item.insProductResult){ // 鍒濆鍖� this.$set(item,'list',[]) + this.$set(item,'list0',[]) item.list.push({}) + item.list0.push({}) item.list.forEach(m=>{ this.$set(m,'time','') this.$set(m,'temperature','') @@ -131,6 +142,15 @@ this.$set(m,'temperature',m.temperature) this.$set(m,'humidity',m.humidity) }) + if(item.insProductResult.comValue){ + this.$set(item,'list0',JSON.parse(item.insProductResult.comValue)) + item.list0.forEach((m,i)=>{ + this.$set(m,'value',m.value) + }) + }else{ + this.$set(item,'list0',[]) + item.list0.push({}) + } this.$set(item,'equipValue',item.insProductResult.equipValue?JSON.parse(item.insProductResult.equipValue)[0].v:'') this.$set(item,'equipName',item.insProductResult.equipName?JSON.parse(item.insProductResult.equipName)[0].v:'') this.$set(item,'beforeCheck',item.insProductResult.beforeCheck) @@ -149,12 +169,18 @@ }) } }, - addList(arr,i){ - arr.splice(i+1,0,{ - time:'', - temperature:'', - humidity:'' - }) + addList(arr,i,type){ + if(type=='out'){ + arr.splice(i+1,0,{ + value:'', + }) + }else{ + arr.splice(i+1,0,{ + time:'', + temperature:'', + humidity:'' + }) + } }, async methodFocus(item){ this.equipOptions = await this.getEquipOptions(item) @@ -208,6 +234,7 @@ this.$axios.post(this.$api.insOrderPlan.saveInsContext3, { insProductId:item.id, insValue:JSON.stringify(item.list), + comValue:JSON.stringify(item.list0), equipValue:item.equipValue, equipName:item.equipName, num:this.num, diff --git a/src/components/view/b4-daily-business-statistics.vue b/src/components/view/b4-daily-business-statistics.vue index 6273cbc..797faa6 100644 --- a/src/components/view/b4-daily-business-statistics.vue +++ b/src/components/view/b4-daily-business-statistics.vue @@ -1,17 +1,39 @@ <template> <div class="daily-main" v-loading="loading"> <div class="daily-content" style="height:100%"> - <!-- <p style="font-size: 16px;padding:19.5px 0px">姣忔棩涓氬姟缁熻</p> --> + <div class="time" style="margin-bottom: 10px;"> + <el-radio-group v-model="type" size="small"> + <el-radio-button label="鍛�" ></el-radio-button> + <el-radio-button label="鏈�"></el-radio-button> + <el-radio-button label="骞�"></el-radio-button> + </el-radio-group> + <el-date-picker + v-model="time.week" + type="week" + format="yyyy-MM-dd" + placeholder="閫夋嫨鍛�" size="small" v-if="type=='鍛�'" @change="m=>changeTime(type,m)"> + </el-date-picker> + <el-date-picker + v-model="time.month" + type="month" + placeholder="閫夋嫨鏈�" format="yyyy-MM-dd" size="small" v-if="type=='鏈�'" @change="m=>changeTime(type,m)"> + </el-date-picker> + <el-date-picker + v-model="time.year" + type="year" + placeholder="閫夋嫨骞�" format="yyyy-MM-dd" size="small" v-if="type=='骞�'" @change="m=>changeTime(type,m)"> + </el-date-picker> + </div> <el-row :gutter="20"> <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;"> <div class="daily-card daily-head"> <div class="daily-head-left"> - <h4>浠婃棩浠诲姟鎺ユ敹</h4> + <h4>鏈瑊{type}}浠诲姟鎺ユ敹</h4> <span>{{ pageData.RECEIVE }}</span> <div class="daily-head-left-info"> <img :src="`../../../static/img/daliy-${pageData.RECEIVE_RATIO<0?'down':'up'}.svg`" alt=""> <span :class="{active:pageData.RECEIVE_RATIO<0}" class="num" v-html="` ${handleData(pageData.RECEIVE_RATIO)}% `"></span> - <span style="font-size: 12px;">杈冩槰澶�</span> + <span style="font-size: 12px;">杈冧笂{{type}}</span> </div> </div> <img src="../../../static/img/daliy-0.svg" alt="" srcset=""> @@ -20,12 +42,12 @@ <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;"> <div class="daily-card daily-head"> <div class="daily-head-left"> - <h4>浠婃棩浠诲姟瀹屾垚</h4> + <h4>鏈瑊{type}}浠诲姟瀹屾垚</h4> <span >{{ pageData.FINISHE }}</span> <div class="daily-head-left-info"> <img :src="`../../../static/img/daliy-${pageData.FINISHE_RATIO<0?'down':'up'}.svg`" alt=""> <span :class="{active:pageData.FINISHE_RATIO<0}" class="num" v-html="` ${handleData(pageData.FINISHE_RATIO)}% `"></span> - <span style="font-size: 12px;">杈冩槰澶�</span> + <span style="font-size: 12px;">杈冧笂{{type}}</span> </div> </div> <img src="../../../static/img/daliy-1.svg" alt="" srcset=""> @@ -34,12 +56,12 @@ <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;"> <div class="daily-card daily-head"> <div class="daily-head-left"> - <h4>浠婃棩浠诲姟鍓╀綑</h4> + <h4>鏈瑊{type}}浠诲姟鍓╀綑</h4> <span >{{ pageData.SURPLUS }}</span> <div class="daily-head-left-info"> <img :src="`../../../static/img/daliy-${pageData.SURPLUS_RATIO<0?'down':'up'}.svg`" alt=""> <span :class="{active:pageData.SURPLUS_RATIO<0}" class="num" v-html="` ${handleData(pageData.SURPLUS_RATIO)}% `"></span> - <span style="font-size: 12px;">杈冩槰澶�</span> + <span style="font-size: 12px;">杈冧笂{{type}}</span> </div> </div> <img src="../../../static/img/daliy-2.svg" alt="" srcset=""> @@ -48,12 +70,12 @@ <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;"> <div class="daily-card daily-head"> <div class="daily-head-left"> - <h4>浠婃棩妫�娴嬭垂鐢�</h4> - <span>锟{ pageData.PRICE }}</span> + <h4>鏈瑊{type}}妫�娴嬭垂鐢�</h4> + <span>锟{ handlePrice(pageData.PRICE) }}</span> <div class="daily-head-left-info"> <img :src="`../../../static/img/daliy-${pageData.PRICE_RATIO<0?'down':'up'}.svg`" alt=""> <span :class="{active:pageData.PRICE_RATIO}" class="num" v-html="` ${handleData(pageData.PRICE_RATIO)}% `"></span> - <span style="font-size: 12px;">杈冩槰澶�</span> + <span style="font-size: 12px;">杈冧笂{{type}}</span> </div> </div> <img src="../../../static/img/daliy-3.svg" alt="" srcset=""> @@ -62,12 +84,12 @@ <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;"> <div class="daily-card daily-head"> <div class="daily-head-left"> - <h4>浠婃棩妫�娴嬪伐鏃�</h4> + <h4>鏈瑊{type}}妫�娴嬪伐鏃�</h4> <span>{{pageData.COST}}</span> <div class="daily-head-left-info"> <img :src="`../../../static/img/daliy-${pageData.COST_RATIO<0?'down':'up'}.svg`" alt=""> <span :class="{active:pageData.COST_RATIO<0}" class="num" v-html="` ${handleData(pageData.COST_RATIO)}% `"></span> - <span style="font-size: 12px;">杈冩槰澶�</span> + <span style="font-size: 12px;">杈冧笂{{type}}</span> </div> </div> <img src="../../../static/img/daliy-4.svg" alt="" srcset=""> @@ -76,28 +98,28 @@ <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;"> <div class="daily-card daily-head"> <div class="daily-head-left"> - <h4>浠婃棩妫�娴嬩汉鍛�</h4> + <h4>鏈瑊{type}}妫�娴嬩汉鍛�</h4> <span >{{ pageData.PERSON }}</span> <div class="daily-head-left-info"> <img :src="`../../../static/img/daliy-${pageData.PERSON_RATIO<0?'down':'up'}.svg`" alt=""> <span :class="{active:pageData.PERSON_RATIO<0}" class="num" v-html="` ${handleData(pageData.PERSON_RATIO)}% `"></span> - <span style="font-size: 12px;">杈冩槰澶�</span> + <span style="font-size: 12px;">杈冧笂{{type}}</span> </div> </div> <img src="../../../static/img/daliy-5.svg" alt="" srcset=""> </div> </el-col> </el-row> - <el-row :gutter="20" style="height: calc(100% - 170px);"> + <el-row :gutter="20" style="height: calc(100% - 200px);"> <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" style="margin-bottom: 16px;height: 100%;"> <div class="daily-card chart-box" style="height: 100%;"> - <h4>杩�10鏃ヤ换鍔℃帴鏀堕噺</h4> + <h4>鏈瑊{type}}浠诲姟鎺ユ敹閲�</h4> <echart-module :id="'daily-left'" :config="chartConfig0" :datas="chartData0" style="height: calc(100% - 32px);"></echart-module> </div> </el-col> <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" style="margin-bottom: 16px;height: 100%;"> <div class="daily-card chart-box" style="height: 100%;"> - <h4>杩�10鏃ュ疄闄呭畬鎴愪换鍔′笌鎺ユ敹浠诲姟瀵规瘮</h4> + <h4>鏈瑊{type}}瀹為檯瀹屾垚浠诲姟涓庢帴鏀朵换鍔″姣�</h4> <echart-module :id="'daily-right'" :config="chartConfig1" :datas="chartData1" style="height: calc(100% - 32px);"></echart-module> </div> </el-col> @@ -109,6 +131,9 @@ <script> import EchartModule from '../tool/echart.vue' +import { + getYearAndMonthAndDays + } from '../../util/date' export default { components: {EchartModule}, data(){ @@ -136,11 +161,11 @@ xData:[], yData:[ { - title:'浠婃棩鎺ユ敹', + title:'鎺ユ敹', data:[] }, { - title:'浠婃棩瀹屾垚', + title:'瀹屾垚', data:[] }, ] @@ -148,19 +173,45 @@ pageData:{}, loading:false, timers:null, + type:'鍛�', + time:{ + week:'', + month:'', + year:'', + }, + startTime:'', + endTime:'' + } + }, + watch:{ + type(val){ + switch(val){ + case '鍛�': + this.time.week = new Date() + this.changeTime(val,this.time.week) + break; + case '鏈�': + this.time.month = new Date() + this.changeTime(val,this.time.month) + break; + case '骞�': + this.time.year = new Date() + this.changeTime(val,this.time.year) + break; + } } }, mounted(){ - this.init() - this.timers&&clearInterval(this.timers); - setInterval(this.init(),1000*60*5) + this.changeTime(this.type) + // this.timers&&clearInterval(this.timers); + // setInterval(this.changeTime(this.type),1000*60*5) }, methods:{ init(){ this.chartConfig0.isLoading = false this.chartConfig1.isLoading = false this.loading = true; - this.$axios.get(this.$api.report.businessStatisticsByDay).then(res => { + this.$axios.get(this.$api.report.businessStatisticsByDay+'?startTime='+this.startTime+'&endTime='+this.endTime+'&type='+this.type).then(res => { if (res.code == 201) return this.pageData = this.HaveJson(res.data) let xData = res.data.DAYS.map(m=>{ @@ -184,6 +235,44 @@ }else{ return '0' } + }, + changeTime(type,m){ + if(m){ + switch(type){ + case '鍛�': + this.startTime = getYearAndMonthAndDays(new Date(this.time.week.getTime() - 24 * 60 * 60 * 1000)) + this.endTime = getYearAndMonthAndDays(new Date(this.time.week.getTime() + 24 * 60 * 60 * 1000 * 5)) + break; + case '鏈�': + const year = new Date(this.time.month).getFullYear(); + const month = new Date(this.time.month).getMonth(); + + // 璁剧疆璧峰鏃ユ湡鍜岀粨鏉熸棩鏈� + this.startTime = new Date(year, month, 1).toISOString().slice(0, 10); // 鏈堝垵 + this.endTime = new Date(year, month + 1, 0).toISOString().slice(0, 10); // 鏈堟湯 + break; + case '骞�': + const year0 = new Date(this.time.year).getFullYear(); + this.startTime = `${year0}-01-01`; // 骞村垵 + this.endTime = `${year0}-12-31`; // 骞存湯 + break; + } + }else{ + this.startTime = getYearAndMonthAndDays(new Date((new Date).getTime() - 24 * 60 * 60 * 1000)) + this.endTime = getYearAndMonthAndDays(new Date((new Date).getTime() + 24 * 60 * 60 * 1000 * 5)) + } + this.init() + }, + handlePrice(val){ + if(val>999999){ + return (val/1000000).toFixed(2)+'鐧句竾'; + }else if(val>99999){ + return (val/100000).toFixed(2)+'鍗佷竾'; + }else if(val>9999){ + return (val/10000).toFixed(2)+'涓�'; + }else{ + return val; + } } }, deactivated(){ diff --git a/src/components/view/b4-inspection-item-statistics.vue b/src/components/view/b4-inspection-item-statistics.vue index 9b6ee8c..f7e513f 100644 --- a/src/components/view/b4-inspection-item-statistics.vue +++ b/src/components/view/b4-inspection-item-statistics.vue @@ -1,17 +1,39 @@ <template> <div class="inspection-main" v-loading="loading"> <div class="inspection-content" style="height:100%"> - <!-- <p style="font-size: 16px;padding:19.5px 0px">妫�娴嬮」鐩粺璁�</p> --> + <div class="time" style="margin-bottom: 10px;"> + <el-radio-group v-model="type" size="small"> + <el-radio-button label="鍛�" ></el-radio-button> + <el-radio-button label="鏈�"></el-radio-button> + <el-radio-button label="骞�"></el-radio-button> + </el-radio-group> + <el-date-picker + v-model="time.week" + type="week" + format="yyyy-MM-dd" + placeholder="閫夋嫨鍛�" size="small" v-if="type=='鍛�'" @change="m=>changeTime(type,m)"> + </el-date-picker> + <el-date-picker + v-model="time.month" + type="month" + placeholder="閫夋嫨鏈�" format="yyyy-MM-dd" size="small" v-if="type=='鏈�'" @change="m=>changeTime(type,m)"> + </el-date-picker> + <el-date-picker + v-model="time.year" + type="year" + placeholder="閫夋嫨骞�" format="yyyy-MM-dd" size="small" v-if="type=='骞�'" @change="m=>changeTime(type,m)"> + </el-date-picker> + </div> <el-row :gutter="20"> <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;"> <div class="inspection-card inspection-head"> <div class="inspection-head-left"> - <h4>浠婃棩椤圭洰鎺ユ敹</h4> + <h4>鏈瑊{type}}椤圭洰鎺ユ敹</h4> <span >{{ pageData.RECEVICE }}</span> <div class="inspection-head-left-info"> <img :src="`../../../static/img/daliy-${pageData.RECEIVE_RATIO<0?'down':'up'}.svg`" alt=""> <span :class="{active:pageData.RECEIVE_RATIO<0}" class="num" v-html="` ${handleData(pageData.RECEIVE_RATIO)}% `"></span> - <span style="font-size: 12px;">杈冩槰澶�</span> + <span style="font-size: 12px;">杈冧笂{{type}}</span> </div> </div> <img src="../../../static/img/daliy-0.svg" alt="" srcset=""> @@ -20,12 +42,12 @@ <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;"> <div class="inspection-card inspection-head"> <div class="inspection-head-left"> - <h4>浠婃棩椤圭洰瀹屾垚</h4> + <h4>鏈瑊{type}}椤圭洰瀹屾垚</h4> <span >{{ pageData.FINISHE }}</span> <div class="inspection-head-left-info"> <img :src="`../../../static/img/daliy-${pageData.FINISHE_RATIO<0?'down':'up'}.svg`" alt=""> <span :class="{active:pageData.FINISHE_RATIO<0}" class="num" v-html="` ${handleData(pageData.FINISHE_RATIO)}% `"></span> - <span style="font-size: 12px;">杈冩槰澶�</span> + <span style="font-size: 12px;">杈冧笂{{type}}</span> </div> </div> <img src="../../../static/img/daliy-1.svg" alt="" srcset=""> @@ -34,12 +56,12 @@ <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;"> <div class="inspection-card inspection-head"> <div class="inspection-head-left"> - <h4>浠婃棩椤圭洰鍓╀綑</h4> + <h4>鏈瑊{type}}椤圭洰鍓╀綑</h4> <span >{{ pageData.SURPLUS }}</span> <div class="inspection-head-left-info"> <img :src="`../../../static/img/daliy-${pageData.SURPLUS_RATIO<0?'down':'up'}.svg`" alt=""> <span :class="{active:pageData.SURPLUS_RATIO<0}" class="num" v-html="` ${handleData(pageData.SURPLUS_RATIO)}% `"></span> - <span style="font-size: 12px;">杈冩槰澶�</span> + <span style="font-size: 12px;">杈冧笂{{type}}</span> </div> </div> <img src="../../../static/img/daliy-2.svg" alt="" srcset=""> @@ -47,33 +69,33 @@ </el-col> <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;"> <div class="inspection-card inspection-head" style="flex-direction: column;padding-bottom: 5px;"> - <h4 style="margin-bottom: 5px;">浠婃棩椤圭洰鍚堟牸鐜�</h4> + <h4 style="margin-bottom: 5px;">鏈瑊{type}}椤圭洰鍚堟牸鐜�</h4> <echart-module :id="'inspection-qualified'" :config="chartConfig2" :datas="chartData2" style="align-self: center;"></echart-module> </div> </el-col> <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;"> <div class="inspection-card inspection-head" style="flex-direction: column;padding-bottom: 5px;"> - <h4 style="margin-bottom: 5px;">浠婃棩椤圭洰瀹屾垚鐜�</h4> + <h4 style="margin-bottom: 5px;">鏈瑊{type}}椤圭洰瀹屾垚鐜�</h4> <echart-module :id="'inspection-complete'" :config="chartConfig3" :datas="chartData3" style="align-self: center;"></echart-module> </div> </el-col> <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;"> <div class="inspection-card inspection-head" style="flex-direction: column;padding-bottom: 5px;"> - <h4 style="margin-bottom: 5px;">浠婃棩椤圭洰寤舵湡鐜�</h4> + <h4 style="margin-bottom: 5px;">鏈瑊{type}}椤圭洰寤舵湡鐜�</h4> <echart-module :id="'inspection-extension'" :config="chartConfig4" :datas="chartData4" style="align-self: center;"></echart-module> </div> </el-col> </el-row> - <el-row :gutter="20" style="height: calc(100% - 170px);"> + <el-row :gutter="20" style="height: calc(100% - 200px);"> <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" style="margin-bottom: 16px; height: 100%;"> <div class="inspection-card chart-box" style="height: 100%;"> - <h4>杩�10鏃ラ」鐩帴鏀堕噺</h4> + <h4>鏈瑊{type}}椤圭洰鎺ユ敹閲�</h4> <echart-module :id="'inspection-left'" :config="chartConfig0" :datas="chartData0" style="height: calc(100% - 32px);"></echart-module> </div> </el-col> <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" style="margin-bottom: 16px;height: 100%;"> <div class="inspection-card chart-box" style="height: 100%;"> - <h4>杩�10鏃ュ疄闄呭畬鎴愰」鐩笌鎺ユ敹椤圭洰瀵规瘮</h4> + <h4>鏈瑊{type}}瀹為檯瀹屾垚椤圭洰涓庢帴鏀堕」鐩姣�</h4> <echart-module :id="'inspection-right'" :config="chartConfig1" :datas="chartData1" style="height: calc(100% - 32px);"></echart-module> </div> </el-col> @@ -85,6 +107,9 @@ <script> import EchartModule from '../tool/echart.vue' + import { + getYearAndMonthAndDays + } from '../../util/date' export default { components: {EchartModule}, data(){ @@ -112,11 +137,11 @@ xData:[], yData:[ { - title:'浠婃棩鎺ユ敹', + title:'鎺ユ敹', data:[] }, { - title:'浠婃棩瀹屾垚', + title:'瀹屾垚', data:[] }, ] @@ -128,7 +153,7 @@ type:'pie' }, chartData2:{ - title:'浠婃棩椤圭洰鍚堟牸鐜�', + title:'椤圭洰鍚堟牸鐜�', percentage:'0', color:['#1CCAB8','#E1E4E8'], data:[ @@ -149,7 +174,7 @@ type:'pie' }, chartData3:{ - title:'浠婃棩椤圭洰瀹屾垚鐜�', + title:'椤圭洰瀹屾垚鐜�', percentage:'0', color:['#FBB647','#E1E4E8'], data:[ @@ -170,7 +195,7 @@ type:'pie' }, chartData4:{ - title:'浠婃棩椤瑰欢鏈熺巼', + title:'椤瑰欢鏈熺巼', percentage:'0', color:['#FF3838','#E1E4E8'], data:[ @@ -186,13 +211,39 @@ }, loading:false, pageData:{}, - timers:null + timers:null, + type:'鍛�', + time:{ + week:'', + month:'', + year:'', + }, + startTime:'', + endTime:'' } }, + watch:{ + type(val){ + switch(val){ + case '鍛�': + this.time.week = new Date() + this.changeTime(val,this.time.week) + break; + case '鏈�': + this.time.month = new Date() + this.changeTime(val,this.time.month) + break; + case '骞�': + this.time.year = new Date() + this.changeTime(val,this.time.year) + break; + } + } + }, mounted(){ - this.init() - this.timers&&clearInterval(this.timers); - setInterval(this.init(),1000*60*5) + this.changeTime(this.type) + // this.timers&&clearInterval(this.timers); + // setInterval(this.changeTime(this.type),1000*60*5) }, methods:{ init(){ @@ -202,7 +253,7 @@ this.chartConfig3.isLoading = false this.chartConfig4.isLoading = false this.loading = true; - this.$axios.get(this.$api.report.testProductByDay).then(res => { + this.$axios.get(this.$api.report.testProductByDay+'?startTime='+this.startTime+'&endTime='+this.endTime+'&type='+this.type).then(res => { if (res.code == 201) return this.pageData = this.HaveJson(res.data) let xData = res.data.DAYS.map(m=>{ @@ -238,6 +289,33 @@ }else{ return '0' } + }, + changeTime(type,m){ + if(m){ + switch(type){ + case '鍛�': + this.startTime = getYearAndMonthAndDays(new Date(this.time.week.getTime() - 24 * 60 * 60 * 1000)) + this.endTime = getYearAndMonthAndDays(new Date(this.time.week.getTime() + 24 * 60 * 60 * 1000 * 5)) + break; + case '鏈�': + const year = new Date(this.time.month).getFullYear(); + const month = new Date(this.time.month).getMonth(); + + // 璁剧疆璧峰鏃ユ湡鍜岀粨鏉熸棩鏈� + this.startTime = new Date(year, month, 1).toISOString().slice(0, 10); // 鏈堝垵 + this.endTime = new Date(year, month + 1, 0).toISOString().slice(0, 10); // 鏈堟湯 + break; + case '骞�': + const year0 = new Date(this.time.year).getFullYear(); + this.startTime = `${year0}-01-01`; // 骞村垵 + this.endTime = `${year0}-12-31`; // 骞存湯 + break; + } + }else{ + this.startTime = getYearAndMonthAndDays(new Date((new Date).getTime() - 24 * 60 * 60 * 1000)) + this.endTime = getYearAndMonthAndDays(new Date((new Date).getTime() + 24 * 60 * 60 * 1000 * 5)) + } + this.init() } }, deactivated(){ diff --git a/static/js/menu.js b/static/js/menu.js index ed7e16a..1a26e90 100644 --- a/static/js/menu.js +++ b/static/js/menu.js @@ -125,7 +125,7 @@ // p: "" // }, { - v: "姣忔棩涓氬姟缁熻", + v: "涓氬姟缁熻", i: "font icon-erjidaohang", u: "b4-daily-business-statistics", p: "businessStatisticsByDay" -- Gitblit v1.9.3