资源过来

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() {
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: {

View File

@ -18,7 +18,7 @@
</div>
</div>
<div class="myChart">
<JBarChart :tooltip="{}" :grid="grid" :xData="xData" :series="series" />
<JBarChart v-if="isblock" :tooltip="{}" :grid="grid" :xData="xData" :series="series" />
</div>
</div>
</Card>
@ -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;