diff --git a/src/views/report/produceConversion.vue b/src/views/report/produceConversion.vue index 1f45f91..bcb508e 100644 --- a/src/views/report/produceConversion.vue +++ b/src/views/report/produceConversion.vue @@ -106,7 +106,8 @@ export default { data() { return { otherProps: [], - title:'', + title: '', + currentMenu:'邯郸', listQuery: { start: undefined, end: undefined, @@ -547,29 +548,30 @@ export default { }) }) }) - this.chartMsg.xData.push(res.data[0].list[0].reportTimep + '目标') - if (this.listQuery.date === 0 || this.listQuery.date === 1 || this.listQuery.date === 2) { - this.otherProps.push({ - label: res.data[0].list[0].reportTimep + '目标', - prop: 'dayData' - }) - dataArr[0]['dayData'] = res.data[0].chipTarget - dataArr[1]['dayData'] = res.data[0].standTarget - dataArr[2]['dayData'] = res.data[0].conversionEfficiencyTarget - } - if (this.listQuery.date === 2 || this.listQuery.date === 3) { - this.otherProps.push({ - label: res.data[0].yearTarget.targetTime, - prop: 'yearData' - }) - dataArr[0]['yearData'] = res.data[0].yearTarget.chipTotalPower - dataArr[1]['yearData'] = res.data[0].yearTarget.componentTotalPower - dataArr[2]['yearData'] = res.data[0].yearTarget.componentConversionEfficiency - } - res.data.forEach((ele, index) => { - // let i = index + 1 - // let m = 'value' + i - ele.list.forEach((item, index) => { + if (res.data[0].list.length != 0) { + this.chartMsg.xData.push(res.data[0].list[0].reportTimep + '目标') + if (this.listQuery.date === 0 || this.listQuery.date === 1 || this.listQuery.date === 2) { + this.otherProps.push({ + label: res.data[0].list[0].reportTimep + '目标', + prop: 'dayData' + }) + dataArr[0]['dayData'] = res.data[0].list[0].chipTarget + dataArr[1]['dayData'] = res.data[0].list[0].standTarget + dataArr[2]['dayData'] = res.data[0].list[0].conversionEfficiencyTarget + } + if (this.listQuery.date === 2 || this.listQuery.date === 3) { + this.otherProps.push({ + label: res.data[0].yearTarget.targetTime, + prop: 'yearData' + }) + dataArr[0]['yearData'] = res.data[0].yearTarget.chipTotalPower + dataArr[1]['yearData'] = res.data[0].yearTarget.componentTotalPower + dataArr[2]['yearData'] = res.data[0].yearTarget.componentConversionEfficiency + } + res.data.forEach((ele, index) => { + // let i = index + 1 + // let m = 'value' + i + ele.list.forEach((item, index) => { let i = index + 1 let m = 'value' + i // ele.productionSituationDataVOList.forEach((item) => { @@ -588,73 +590,77 @@ export default { // props: 'value' + index + 1, // }) }) - }) - this.title = res.data[0].yearTarget.targetTime + '目标值' - this.chartMsgYearTarget.series[0].data = [ - { - value: res.data[0].yearTarget.chipTotalPower, - itemStyle: { - color: '#8EF0AB' + }) + this.title = res.data[0].yearTarget.targetTime + '目标值' + this.chartMsgYearTarget.series[0].data = [ + { + value: res.data[0].yearTarget.chipTotalPower, + itemStyle: { + color: '#8EF0AB' + } + }, + { + value: res.data[0].yearTarget.componentTotalPower, + itemStyle: { + color: '#288AFF' + } + }, + { + value: null, + itemStyle: { + color: '#64BDFF' + } + }] + this.chartMsgYearTarget.series[1].data = [ + { + value: null, + itemStyle: { + color: '#8EF0AB' + } + }, + { + value: null, + itemStyle: { + color: '#288AFF' + } + }, + { + value: res.data[0].yearTarget.componentConversionEfficiency, + itemStyle: { + color: '#64BDFF' + } + }] + console.log(dataArr); + for (let i in dataArr[0]) { + this.chartMsg.series[0].name = dataArr[0]['item'] + if (i.search('value') === 0) { + this.chartMsg.series[0].data.push({ + name: dataArr[0]['item'], + value: dataArr[0][i] + }) } - }, - { - value: res.data[0].yearTarget.componentTotalPower, - itemStyle: { - color: '#288AFF' - } - }, - { - value: null, - itemStyle: { - color: '#64BDFF' - } - }] - this.chartMsgYearTarget.series[1].data = [ - { - value: null, - itemStyle: { - color: '#8EF0AB' - } - }, - { - value: null, - itemStyle: { - color: '#288AFF' - } - }, - { - value: res.data[0].yearTarget.componentConversionEfficiency, - itemStyle: { - color: '#64BDFF' - } - }] - console.log(dataArr); - for (let i in dataArr[0]) { - this.chartMsg.series[0].name = dataArr[0]['item'] - if (i.search('value') === 0) { - this.chartMsg.series[0].data.push({ - name: dataArr[0]['item'], - value: dataArr[0][i] - }) } - } - for (let i in dataArr[1]) { - this.chartMsg.series[1].name = dataArr[1]['item'] - if (i.search('value') === 0) { - this.chartMsg.series[1].data.push({ - name: dataArr[1]['item'], - value: dataArr[1][i] - }) + for (let i in dataArr[1]) { + this.chartMsg.series[1].name = dataArr[1]['item'] + if (i.search('value') === 0) { + this.chartMsg.series[1].data.push({ + name: dataArr[1]['item'], + value: dataArr[1][i] + }) + } } - } - for (let i in dataArr[2]) { - this.chartMsg.series[2].name = dataArr[2]['item'] - if (i.search('value') === 0) { - this.chartMsg.series[2].data.push({ - name: dataArr[2]['item'], - value: dataArr[2][i] - }) + for (let i in dataArr[2]) { + this.chartMsg.series[2].name = dataArr[2]['item'] + if (i.search('value') === 0) { + this.chartMsg.series[2].data.push({ + name: dataArr[2]['item'], + value: dataArr[2][i] + }) + } } + } else { + this.chartMsgYearTarget.series[0].data = [] + this.chartMsgYearTarget.series[1].data = [] } // for (let i in dataArr[3]) { // this.chartMsg.series[3].name = dataArr[3]['item'] @@ -665,7 +671,7 @@ export default { // }) // } // } - this.tableData = dataArr + this.tableData =res.data[0].list.length !== 0? dataArr : [] }, _setTableHeight() { this.tableH = this.tableHeight(137) / 2 - 70;