From 600d607d4b02acfbbeec3723ab73a28d91f605b8 Mon Sep 17 00:00:00 2001 From: jxj_gmj <1351094127@qq.com> Date: Fri, 9 Dec 2022 19:06:41 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E6=BA=90=E8=BF=87=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/jChart/bar/JBarChart.vue | 7 ++- .../fourEngin/sourse/rightTop.vue | 61 ++++++++++++++----- 2 files changed, 50 insertions(+), 18 deletions(-) diff --git a/src/views/projectAdmin/common/jChart/bar/JBarChart.vue b/src/views/projectAdmin/common/jChart/bar/JBarChart.vue index 71c60199..9617a351 100644 --- a/src/views/projectAdmin/common/jChart/bar/JBarChart.vue +++ b/src/views/projectAdmin/common/jChart/bar/JBarChart.vue @@ -40,7 +40,8 @@ export default { }, mounted() { this.jBarChart = echarts.init(this.$refs.jBarChart) - this.createChart() + this.createChart(); + console.log(this.series,'series') }, data() { return { jBarChart: null } @@ -67,6 +68,8 @@ export default { createChart() { const { title, tooltip, grid, color, xData, yData, series } = this const configSeries = (series => { + console.log(series[0].data,'=========================yyyyyyyyyy') + console.log(series[1].data,'=========================yyyyyyyyyy') if (series.length) { return series.map(item => ({ name: item.name, type: 'bar', data: item.data, barWidth: 20, itemStyle: item.itemStyle })) } else { @@ -90,7 +93,7 @@ export default { left: 20, itemWidth: 8, textStyle: { color: '#fff' }, - data: [{ name: '计划用料' }, { name: '实际用料' }] + data: [{ name: '过磅次数' }, { name: '过磅重量' }] }, tooltip, grid: { diff --git a/src/views/projectAdmin/fourEngin/sourse/rightTop.vue b/src/views/projectAdmin/fourEngin/sourse/rightTop.vue index 1ab26adc..db4961a7 100644 --- a/src/views/projectAdmin/fourEngin/sourse/rightTop.vue +++ b/src/views/projectAdmin/fourEngin/sourse/rightTop.vue @@ -18,7 +18,7 @@
- +
@@ -69,8 +69,8 @@ export default { xData: new Array(12).fill('破产倒闭').map((v, i) => i + 1 + '月'), series: [ { - name: '计划用料', - data: [400, 420, 510, 600, 720, 820, 910, 820, 720, 510, 420, 400], + name: '过磅次数', + data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], itemStyle: { color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ { offset: 0, color: '#6de1ee' }, @@ -79,8 +79,8 @@ export default { } }, { - name: '实际用料', - data: [200, 300, 380, 420, 520, 620, 710, 620, 520, 420, 300, 200], + name: '过磅重量', + data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], itemStyle: { color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ { offset: 0, color: '#DE5F2A' }, @@ -93,8 +93,9 @@ export default { plan: [], actual: [], monly: [], - yearsList:[], - yearValue:'' + yearsList: [], + yearValue: '', + isblock: false } }, mounted() { @@ -106,16 +107,33 @@ export default { }, getList() { this.sn = this.$store.state.projectSn - getMaterialRequisitionTrendChart({ projectSn: this.sn, year: this.yearValue }).then(res => { - let dataAll = res - dataAll.forEach((item, index, array) => { - this.plan.push(item.ton) - this.monly.push(item.date) - this.actual.push(item.count) - }) - }) + trendChartTime({ projectSn: this.sn }).then(res => { - this.yearsList = res.result + this.yearsList = res.result; + if (this.yearsList.length > 0) { + + this.yearValue = this.yearsList[0] + getMaterialRequisitionTrendChart({ projectSn: this.sn, year: this.yearValue }).then(res => { + let dataAll = res.result + console.log(dataAll, 'dataAlldataAlldataAlldataAlldataAll ') + + let frequency = this.series[0].data; + let weight = this.series[1].data; + + for (let i = 0; i < 12; i++) { + let rest = dataAll.find(item => item.date == (i + 1)); + if (rest) { + frequency[i] = rest.count; + weight[i] = rest.ton + } + } + this.series[0].data = frequency; + this.series[1].data = weight; + this.isblock = true; + + }) + } + }) } } @@ -126,27 +144,32 @@ export default { .typedata { width: 100%; height: 100%; + .containbox { margin-top: 2%; margin-left: 80%; height: 20px; line-height: 25px; + span { margin-left: 15px; margin-right: 5px; font-size: 14px; } } + .myChart { width: 100%; height: 90%; } } + ::v-deep .el-input--mini .el-input__inner { height: 33px; width: 80px; color: #fff; } + ::v-deep .el-select, ::v-deep .el-input, ::v-deep .frist .el-input__inner { @@ -157,28 +180,34 @@ export default { border-radius: 0px; text-align: center; } + ::v-deep .el-select .el-input .el-select__caret { color: #fff; } + ::v-deep .el-date-editor--daterange.el-input__inner { width: 230px; height: 30px; background-color: #182337; border: 1px solid #264b5e; } + ::v-deep .el-range-input { background-color: #182337; color: #fff; } + ::v-deep .el-date-editor { .el-range__icon { line-height: 23px; color: #6ee4f0; } + .el-range-separator { line-height: 23px; color: #757d88; } + .el-range__close-icon { color: #757d88; line-height: 23px;