From 0eb17fa08b16bea65122dffd3cf57282acb72047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98937886381=E2=80=99?= <‘937886381@qq.com’> Date: Thu, 20 Jun 2024 20:54:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/components/produceLineBar.vue | 4 +- .../components/produceLineBarTarget.vue | 4 +- .../components/produceLineBarYearTarget.vue | 4 +- src/views/report/comprehensiveData.vue | 165 +++++++---------- src/views/report/productionSituationMW.vue | 9 +- .../report/productionSituationTablets.vue | 107 +++++------ src/views/report/productionYield.vue | 167 +++++++----------- 7 files changed, 183 insertions(+), 277 deletions(-) diff --git a/src/views/report/components/produceLineBar.vue b/src/views/report/components/produceLineBar.vue index aea2cb5..4b63baa 100644 --- a/src/views/report/components/produceLineBar.vue +++ b/src/views/report/components/produceLineBar.vue @@ -1,7 +1,7 @@ @@ -58,7 +58,7 @@ export default { "
" + `` + `${params[i].seriesName}` + - `${params[i].name.search('率') === "综合良率" + `${params[i].seriesName === "综合良率" ? (params[i].value ? params[i].value.toFixed(2) : 0.0) + "%" : params[i].seriesName === "转化效率" ? (params[i].value ? params[i].value.toFixed(2) : 0.0) + "%" diff --git a/src/views/report/components/produceLineBarTarget.vue b/src/views/report/components/produceLineBarTarget.vue index 2bea640..434f875 100644 --- a/src/views/report/components/produceLineBarTarget.vue +++ b/src/views/report/components/produceLineBarTarget.vue @@ -1,7 +1,7 @@ @@ -65,7 +65,7 @@ export default { "
" + `` + `${params[i].seriesName}` + - `${params[i].seriesName.search('率') === "综合良率" + `${params[i].seriesName === "综合良率" ? (params[i].value ? params[i].value.toFixed(2) : 0.0) + "%" : params[i].seriesName === "转化效率" ? (params[i].value ? params[i].value.toFixed(2) : 0.0) + "%" diff --git a/src/views/report/components/produceLineBarYearTarget.vue b/src/views/report/components/produceLineBarYearTarget.vue index 8fb9c80..b0e9d86 100644 --- a/src/views/report/components/produceLineBarYearTarget.vue +++ b/src/views/report/components/produceLineBarYearTarget.vue @@ -1,7 +1,7 @@ @@ -58,7 +58,7 @@ export default { "
" + `` + `${params[i].seriesName}` + - `${params[i].seriesName.search('率') === "综合良率" + `${params[i].seriesName === "综合良率" ? (params[i].value ? params[i].value.toFixed(2) : 0.0) + "%" : params[i].seriesName === "转化效率" ? params[i].value+ "%" diff --git a/src/views/report/comprehensiveData.vue b/src/views/report/comprehensiveData.vue index 416d87c..e3529a6 100644 --- a/src/views/report/comprehensiveData.vue +++ b/src/views/report/comprehensiveData.vue @@ -1,7 +1,7 @@ @@ -13,58 +13,48 @@
- + - + - + 至 - + + + + + + - - - - - - + ~ - - - 查询 - - 导出 - 10) { + if (this.listQuery.end - this.listQuery.start > 10 * 365 * 24 * 60 * 60 * 1000) { this.$message({ message: '年份起止时间不能超过十年', type: 'warning' }); - this.start = undefined - this.end = undefined + this.listQuery.reportTime = [] + this.listQuery.start = undefined + this.listQuery.end = undefined // console.log(); } else { - if (Number(this.end) < Number(this.start)) { - this.$message({ - message: '结束年份不能小于开始年份', - type: 'warning' - }); - this.start = undefined - this.end = undefined - } else { - this.listQuery.startDate = Number(this.start) - this.listQuery.endDate = Number(this.end) - } + this.listQuery.startDate = this.listQuery.start + this.listQuery.endDate = this.listQuery.end } - if (!this.start && !this.end) { + if (!this.listQuery.start && !this.listQuery.end) { this.listQuery.startDate = undefined this.listQuery.endDate = undefined } // console.log(e); }, - changeTime() { - if (this.listQuery.reportTime) { - console.log(this.listQuery.reportTime) - let start = new Date(this.listQuery.reportTime[0]) - let end = new Date(this.listQuery.reportTime[1]) - // const years = Number(this.listQuery.reportTime[1].slice(0, 4)) - Number(this.listQuery.reportTime[0].slice(0, 4)) - // const months = Number(this.listQuery.reportTime[1].slice(4)) - Number(this.listQuery.reportTime[0].slice(4)) - // console.log(years); - if ((end - start) > 31104000000) { - this.$message({ - message: '时间范围不能超过24个月', - type: 'warning' - }); - this.listQuery.reportTime = []; - } else { - this.listQuery.startDate = this.listQuery.reportTime[0] - this.listQuery.endDate = this.listQuery.reportTime[1] - } - } else { - this.listQuery.startDate = undefined - this.listQuery.endDate = undefined - } - }, onValueChange(picker, k) { // 选中近k周后触发的操作 - if (this.start && this.end) { - this.date1 = moment(this.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD') - this.date2 = moment(this.end.getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD') + // console.log(this.listQuery.reportTime[0], this.listQuery.reportTime[1]) + if (this.listQuery.start && this.listQuery.end) { + console.log(this.listQuery.reportTime) + this.date1 = moment(this.listQuery.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss') + this.date2 = moment(this.listQuery.end.getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss') const numDays = (new Date(this.date2).getTime() - new Date(this.date1).getTime()) / (24 * 3600 * 1000); if (numDays > 168) { console.log(numDays) @@ -270,20 +234,21 @@ export default { type: 'warning' }); } else { - this.listQuery.startDate = this.date1 - this.listQuery.endDate = this.date2 - // this.listQuery.startDate = Number(moment(this.start.getTime()).format('YYYYWW')) - // this.listQuery.endDate = Number(moment(this.end.getTime()).format('YYYYWW')) + this.listQuery.startDate = moment(this.listQuery.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD') + this.listQuery.endDate = moment(this.listQuery.end.getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD') } } - if (!this.start && !this.end) { + if (!this.listQuery.start && !this.listQuery.end) { this.listQuery.startDate = undefined this.listQuery.endDate = undefined } }, changeDayTime() { if (this.listQuery.reportTime) { - const numDays = Number(this.listQuery.reportTime[1]) - Number(this.listQuery.reportTime[0]) + // this.createStartDate = moment(new Date(this.listQuery.reportTime[0]), 'yyyy-MM-dd hh:mm:ss'); + // this.createEndDate = moment(new Date(this.listQuery.reportTime[1]), 'yyyy-MM-dd hh:mm:ss'); + console.log(this.listQuery.reportTime[1]) + const numDays = (this.listQuery.reportTime[1] - this.listQuery.reportTime[0]) / (24 * 3600 * 1000); if (numDays > 30) { this.$message({ message: '时间范围不能超过30天', @@ -299,26 +264,26 @@ export default { this.listQuery.endDate = undefined } }, - getOverView() { - // getOverView().then(res => { - // this.data = res.data - // console.log('aa', res.data) - // }) - }, - otherMethods(val) { - this.detailOrUpdateVisible = true; - // this.addOrEditTitle = "详情"; - this.$nextTick(() => { - // this.$refs.detailOrUpdate.init(val.data.id); - }); + changeTime(value) { + if (this.listQuery.reportTime) { + const numDays = this.listQuery.reportTime[1] - this.listQuery.reportTime[0]; + if (numDays > 2 * 365 * 24 * 60 * 60 * 1000) { + this.$message({ + message: '时间范围不能超过24个月', + type: 'warning' + }); + this.listQuery.reportTime = []; + } else { + this.listQuery.startDate = this.listQuery.reportTime[0] + this.listQuery.endDate = this.listQuery.reportTime[1] + } + } else { + this.listQuery.startDate = undefined + this.listQuery.endDate = undefined + } }, async getDataList() { this.otherProps = [] - console.log(this.listQuery); - if (this.listQuery.type == 3) { - this.listQuery.startDate = this.listQuery.reportTime[0] + '-01-01' - this.listQuery.endDate = this.listQuery.reportTime[1] + '-12-31' - } let arr = [] this.currentMenu === '邯郸' ? arr.push(1) : arr.push(2) this.listQuery.factory = arr diff --git a/src/views/report/productionSituationMW.vue b/src/views/report/productionSituationMW.vue index 0560914..0cf2ec0 100644 --- a/src/views/report/productionSituationMW.vue +++ b/src/views/report/productionSituationMW.vue @@ -138,6 +138,7 @@ export default { endDate: undefined, start: undefined, end: undefined, + reportTime:[], }, timeList: [ { @@ -372,9 +373,11 @@ export default { }, mounted() { // this.getOverView() - const currentMonth = new Date() - this.listQuery.reportTime = [moment(currentMonth).format('yyyy-MM-DD'), moment(currentMonth).format('yyyy-MM-DD')] - this.changeTime() + const today = new Date() + const sevenDaysAgo = new Date(today.getTime() - (7 * 24 * 60 * 60 * 1000)) + this.listQuery.startDate = moment(sevenDaysAgo).format('yyyy-MM-DD') + this.listQuery.endDate = moment(today).format('yyyy-MM-DD') + this.listQuery.reportTime = [this.listQuery.startDate, this.listQuery.endDate] this.getDataList() }, methods: { diff --git a/src/views/report/productionSituationTablets.vue b/src/views/report/productionSituationTablets.vue index 240b016..95e30cb 100644 --- a/src/views/report/productionSituationTablets.vue +++ b/src/views/report/productionSituationTablets.vue @@ -472,67 +472,40 @@ export default { }, mounted() { // this.getOverView() - const currentMonth = new Date() - this.listQuery.reportTime = [moment(currentMonth).format('yyyy-MM-DD'), moment(currentMonth).format('yyyy-MM-DD')] - this.changeTime() + const today = new Date() + const sevenDaysAgo = new Date(today.getTime() - (7 * 24 * 60 * 60 * 1000)) + this.listQuery.startDate = moment(sevenDaysAgo).format('yyyy-MM-DD') + this.listQuery.endDate = moment(today).format('yyyy-MM-DD') + this.listQuery.reportTime = [this.listQuery.startDate, this.listQuery.endDate] this.getDataList() }, methods: { getYear(e) { - if (this.end && Number(this.end) - Number(this.start) > 10) { + if (this.listQuery.end - this.listQuery.start > 10 * 365 * 24 * 60 * 60 * 1000) { this.$message({ message: '年份起止时间不能超过十年', type: 'warning' }); - this.start = undefined - this.end = undefined + this.listQuery.reportTime = [] + this.listQuery.start = undefined + this.listQuery.end = undefined // console.log(); } else { - if (Number(this.end) < Number(this.start)) { - this.$message({ - message: '结束年份不能小于开始年份', - type: 'warning' - }); - this.start = undefined - this.end = undefined - } else { - this.listQuery.startDate = Number(this.start) - this.listQuery.endDate = Number(this.end) - } + this.listQuery.startDate = this.listQuery.start + this.listQuery.endDate = this.listQuery.end } - if (!this.start && !this.end) { + if (!this.listQuery.start && !this.listQuery.end) { this.listQuery.startDate = undefined this.listQuery.endDate = undefined } // console.log(e); }, - changeTime() { - if (this.listQuery.reportTime) { - console.log(this.listQuery.reportTime) - let start = new Date(this.listQuery.reportTime[0]) - let end = new Date(this.listQuery.reportTime[1]) - // const years = Number(this.listQuery.reportTime[1].slice(0, 4)) - Number(this.listQuery.reportTime[0].slice(0, 4)) - // const months = Number(this.listQuery.reportTime[1].slice(4)) - Number(this.listQuery.reportTime[0].slice(4)) - // console.log(years); - if ((end - start) > 31104000000) { - this.$message({ - message: '时间范围不能超过24个月', - type: 'warning' - }); - this.listQuery.reportTime = []; - } else { - this.listQuery.startDate = this.listQuery.reportTime[0] - this.listQuery.endDate = this.listQuery.reportTime[1] - } - } else { - this.listQuery.startDate = undefined - this.listQuery.endDate = undefined - } - }, onValueChange(picker, k) { // 选中近k周后触发的操作 - if (this.start && this.end) { - this.date1 = moment(this.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD') - this.date2 = moment(this.end.getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD') + // console.log(this.listQuery.reportTime[0], this.listQuery.reportTime[1]) + if (this.listQuery.start && this.listQuery.end) { + console.log(this.listQuery.reportTime) + this.date1 = moment(this.listQuery.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss') + this.date2 = moment(this.listQuery.end.getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss') const numDays = (new Date(this.date2).getTime() - new Date(this.date1).getTime()) / (24 * 3600 * 1000); if (numDays > 168) { console.log(numDays) @@ -541,20 +514,21 @@ export default { type: 'warning' }); } else { - this.listQuery.startDate = this.date1 - this.listQuery.endDate = this.date2 - // this.listQuery.startDate = Number(moment(this.start.getTime()).format('YYYYWW')) - // this.listQuery.endDate = Number(moment(this.end.getTime()).format('YYYYWW')) + this.listQuery.startDate = moment(this.listQuery.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD') + this.listQuery.endDate = moment(this.listQuery.end.getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD') } } - if (!this.start && !this.end) { + if (!this.listQuery.start && !this.listQuery.end) { this.listQuery.startDate = undefined this.listQuery.endDate = undefined } }, changeDayTime() { if (this.listQuery.reportTime) { - const numDays = Number(this.listQuery.reportTime[1]) - Number(this.listQuery.reportTime[0]) + // this.createStartDate = moment(new Date(this.listQuery.reportTime[0]), 'yyyy-MM-dd hh:mm:ss'); + // this.createEndDate = moment(new Date(this.listQuery.reportTime[1]), 'yyyy-MM-dd hh:mm:ss'); + console.log(this.listQuery.reportTime[1]) + const numDays = (this.listQuery.reportTime[1] - this.listQuery.reportTime[0]) / (24 * 3600 * 1000); if (numDays > 30) { this.$message({ message: '时间范围不能超过30天', @@ -570,18 +544,23 @@ export default { this.listQuery.endDate = undefined } }, - getOverView() { - // getOverView().then(res => { - // this.data = res.data - // console.log('aa', res.data) - // }) - }, - otherMethods(val) { - this.detailOrUpdateVisible = true; - // this.addOrEditTitle = "详情"; - this.$nextTick(() => { - // this.$refs.detailOrUpdate.init(val.data.id); - }); + changeTime(value) { + if (this.listQuery.reportTime) { + const numDays = this.listQuery.reportTime[1] - this.listQuery.reportTime[0]; + if (numDays > 2 * 365 * 24 * 60 * 60 * 1000) { + this.$message({ + message: '时间范围不能超过24个月', + type: 'warning' + }); + this.listQuery.reportTime = []; + } else { + this.listQuery.startDate = this.listQuery.reportTime[0] + this.listQuery.endDate = this.listQuery.reportTime[1] + } + } else { + this.listQuery.startDate = undefined + this.listQuery.endDate = undefined + } }, async getDataList() { this.otherProps = [] @@ -589,10 +568,6 @@ export default { this.chartMsgTarget.xData = [] this.chartMsgYearTarget.xData = [] console.log(this.listQuery); - if (this.listQuery.type == 3) { - this.listQuery.startDate = this.listQuery.reportTime[0] + '-01-01' - this.listQuery.endDate = this.listQuery.reportTime[1] + '-12-31' - } let arr = [] this.currentMenu === '邯郸' ? arr.push(1) : arr.push(0) this.listQuery.factory = arr diff --git a/src/views/report/productionYield.vue b/src/views/report/productionYield.vue index bbe12f6..08a30aa 100644 --- a/src/views/report/productionYield.vue +++ b/src/views/report/productionYield.vue @@ -6,61 +6,48 @@ @@ -83,11 +70,11 @@ -
- 产量及良率对比 -
- +
+ 产量及良率对比 +
+