资源过来

This commit is contained in:
jxj_gmj 2022-12-09 19:06:41 +08:00
parent c650b5fac2
commit 600d607d4b
2 changed files with 50 additions and 18 deletions

View File

@ -40,7 +40,8 @@ export default {
}, },
mounted() { mounted() {
this.jBarChart = echarts.init(this.$refs.jBarChart) this.jBarChart = echarts.init(this.$refs.jBarChart)
this.createChart() this.createChart();
console.log(this.series,'series')
}, },
data() { data() {
return { jBarChart: null } return { jBarChart: null }
@ -67,6 +68,8 @@ export default {
createChart() { createChart() {
const { title, tooltip, grid, color, xData, yData, series } = this const { title, tooltip, grid, color, xData, yData, series } = this
const configSeries = (series => { const configSeries = (series => {
console.log(series[0].data,'=========================yyyyyyyyyy')
console.log(series[1].data,'=========================yyyyyyyyyy')
if (series.length) { if (series.length) {
return series.map(item => ({ name: item.name, type: 'bar', data: item.data, barWidth: 20, itemStyle: item.itemStyle })) return series.map(item => ({ name: item.name, type: 'bar', data: item.data, barWidth: 20, itemStyle: item.itemStyle }))
} else { } else {
@ -90,7 +93,7 @@ export default {
left: 20, left: 20,
itemWidth: 8, itemWidth: 8,
textStyle: { color: '#fff' }, textStyle: { color: '#fff' },
data: [{ name: '计划用料' }, { name: '实际用料' }] data: [{ name: '过磅次数' }, { name: '过磅重量' }]
}, },
tooltip, tooltip,
grid: { grid: {

View File

@ -18,7 +18,7 @@
</div> </div>
</div> </div>
<div class="myChart"> <div class="myChart">
<JBarChart :tooltip="{}" :grid="grid" :xData="xData" :series="series" /> <JBarChart v-if="isblock" :tooltip="{}" :grid="grid" :xData="xData" :series="series" />
</div> </div>
</div> </div>
</Card> </Card>
@ -69,8 +69,8 @@ export default {
xData: new Array(12).fill('破产倒闭').map((v, i) => i + 1 + '月'), xData: new Array(12).fill('破产倒闭').map((v, i) => i + 1 + '月'),
series: [ series: [
{ {
name: '计划用料', name: '过磅次数',
data: [400, 420, 510, 600, 720, 820, 910, 820, 720, 510, 420, 400], data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
itemStyle: { itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: '#6de1ee' }, { offset: 0, color: '#6de1ee' },
@ -79,8 +79,8 @@ export default {
} }
}, },
{ {
name: '实际用料', name: '过磅重量',
data: [200, 300, 380, 420, 520, 620, 710, 620, 520, 420, 300, 200], data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
itemStyle: { itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: '#DE5F2A' }, { offset: 0, color: '#DE5F2A' },
@ -93,8 +93,9 @@ export default {
plan: [], plan: [],
actual: [], actual: [],
monly: [], monly: [],
yearsList:[], yearsList: [],
yearValue:'' yearValue: '',
isblock: false
} }
}, },
mounted() { mounted() {
@ -106,16 +107,33 @@ export default {
}, },
getList() { getList() {
this.sn = this.$store.state.projectSn 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 => { 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 { .typedata {
width: 100%; width: 100%;
height: 100%; height: 100%;
.containbox { .containbox {
margin-top: 2%; margin-top: 2%;
margin-left: 80%; margin-left: 80%;
height: 20px; height: 20px;
line-height: 25px; line-height: 25px;
span { span {
margin-left: 15px; margin-left: 15px;
margin-right: 5px; margin-right: 5px;
font-size: 14px; font-size: 14px;
} }
} }
.myChart { .myChart {
width: 100%; width: 100%;
height: 90%; height: 90%;
} }
} }
::v-deep .el-input--mini .el-input__inner { ::v-deep .el-input--mini .el-input__inner {
height: 33px; height: 33px;
width: 80px; width: 80px;
color: #fff; color: #fff;
} }
::v-deep .el-select, ::v-deep .el-select,
::v-deep .el-input, ::v-deep .el-input,
::v-deep .frist .el-input__inner { ::v-deep .frist .el-input__inner {
@ -157,28 +180,34 @@ export default {
border-radius: 0px; border-radius: 0px;
text-align: center; text-align: center;
} }
::v-deep .el-select .el-input .el-select__caret { ::v-deep .el-select .el-input .el-select__caret {
color: #fff; color: #fff;
} }
::v-deep .el-date-editor--daterange.el-input__inner { ::v-deep .el-date-editor--daterange.el-input__inner {
width: 230px; width: 230px;
height: 30px; height: 30px;
background-color: #182337; background-color: #182337;
border: 1px solid #264b5e; border: 1px solid #264b5e;
} }
::v-deep .el-range-input { ::v-deep .el-range-input {
background-color: #182337; background-color: #182337;
color: #fff; color: #fff;
} }
::v-deep .el-date-editor { ::v-deep .el-date-editor {
.el-range__icon { .el-range__icon {
line-height: 23px; line-height: 23px;
color: #6ee4f0; color: #6ee4f0;
} }
.el-range-separator { .el-range-separator {
line-height: 23px; line-height: 23px;
color: #757d88; color: #757d88;
} }
.el-range__close-icon { .el-range__close-icon {
color: #757d88; color: #757d88;
line-height: 23px; line-height: 23px;