Browse Source

完善图表数据

master
guoxing 2 years ago
parent
commit
90e042d587
  1. 45
      supervise-report-ui/src/views/reportCenter/goodsOnWay.vue
  2. 44
      supervise-report-ui/src/views/reportCenter/salesReport.vue
  3. 122
      supervise-report-ui/src/views/reportCenter/thresholdAnalysis.vue

45
supervise-report-ui/src/views/reportCenter/goodsOnWay.vue

@ -256,8 +256,7 @@
const data = resp.data
_this.listGoodsOnWays = data.listGoodsOnWays
_this.listArrivedEarlyWarning = data.listArrivedEarlyWarning
_this.analysisChartData = data.analysisChartData
this.drawLine()
this.drawLine(data.analysisChartData)
this.tableLoading = false
} else {
@ -271,12 +270,48 @@
})
},
//
drawLine() {
drawLine(obj) {
// domecharts
var myChart = echarts.init(document.getElementById('main'));
//
console.log('option', this.analysisChartData)
myChart.setOption(this.analysisChartData);
console.log('option', obj)
myChart.setOption({
legend: {
top: 'bottom'
},
toolbox: {
show: true,
feature: {
mark: {
show: true
},
//
dataView: {
show: false,
readOnly: false
},
//
restore: {
show: false
},
//
saveAsImage: {
show: false
}
}
},
series: [{
name: 'Nightingale Chart',
type: 'pie',
radius: [30, 150],
center: ['50%', '50%'],
roseType: 'area',
itemStyle: {
borderRadius: 8
},
data: obj
}]
})
},
dosearch() {

44
supervise-report-ui/src/views/reportCenter/salesReport.vue

@ -178,11 +178,12 @@
}
],
queryParams: {
customerSid: '',
customerSid: '11',
date: "",
type: '' // key
type: "" // key
},
nowDate: new Date().getFullYear() + "-" + (new Date().getMonth() + 1) + "-" + new Date().getDate(),
nowDate: this.getDate(),
//
option: {
legend: {},
@ -224,6 +225,13 @@
this.loadList()
},
methods: {
getDate(){
var tempDate = new Date() //
tempDate.setDate(tempDate.getDate() - 1) // NN
var endDate = tempDate.getFullYear() + '-' + (tempDate.getMonth() + 1) + '-' + tempDate.getDate()
console.log(endDate)
return endDate
},
//
clicksearchShow() {
this.isSearchShow = !this.isSearchShow
@ -247,8 +255,8 @@
}
},
loadList() {
console.log('2222222')
this.tableLoading = true
let _this = this
req.initData(_this.queryParams).then((resp) => {
if (resp.success) {
@ -256,8 +264,7 @@
const data = resp.data
_this.dataList = data.financialData
_this.listSalesChannelData = data.listSalesChannelData
_this.financialAnalysisChartData = data.financialAnalysisChartData
_this.drawLine()
_this.drawLine(data.financialAnalysisChartData)
this.tableLoading = false
} else {
// resp.code
@ -270,12 +277,31 @@
})
},
//
drawLine() {
drawLine(obj) {
// domecharts
var myChart = echarts.init(document.getElementById('main'));
//
console.log('option', this.financialAnalysisChartData)
myChart.setOption(this.financialAnalysisChartData);
console.log('option', obj)
myChart.setOption({
legend: {},
tooltip: {},
dataset: {
//
source: obj
},
// X category dataset
xAxis: {
type: 'category'
},
// Y
yAxis: {},
// bar dataset
series: [{
type: 'bar'
}, {
type: 'bar'
}]
})
},
dosearch() {

122
supervise-report-ui/src/views/reportCenter/thresholdAnalysis.vue

@ -247,6 +247,123 @@
this.loadList()
},
methods: {
initChart(obj) {
var _legend = []
var _xdata = obj.date
var _series = obj.series
var _ss = []
for (var i in _series) {
let objNum = _series[i];
let _key;
let _value;
Object.keys(objNum).forEach(key => {
_key = key;
_value = objNum[key];
})
_legend.push(
_key
)
if (i == 6)
//
_ss.push({
name: _key,
type: 'line',
yAxisIndex: 1,
tooltip: {
valueFormatter: function(value) {
return value + ' %';
}
},
data: _value
})
else
//
_ss.push({
name: _key,
type: 'bar',
tooltip: {
valueFormatter: function(value) {
return value + ' 万元';
}
},
data: _value
})
}
var myChart = echarts.init(document.getElementById('main'));
//
myChart.setOption({
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
toolbox: {
feature: {
dataView: {
//
show: false,
readOnly: false
},
magicType: {
//
show: false,
type: ['line', 'bar']
},
//
restore: {
show: false
},
//
saveAsImage: {
show: false
}
}
},
legend: {
data: _legend
},
xAxis: [{
type: 'category',
data: _xdata,
axisPointer: {
type: 'shadow'
}
}],
yAxis: [{
type: 'value',
name: '人民币',
min: 0,
max: 10000,
interval: 1000,
axisLabel: {
formatter: '{value} 万元'
}
},
{
type: 'value',
name: '百分比',
min: 0,
max: 100,
interval: 10,
axisLabel: {
formatter: '{value} %'
}
}
],
series: _ss
});
},
//
clicksearchShow() {
this.isSearchShow = !this.isSearchShow
@ -279,11 +396,8 @@
if (resp.success) {
console.log('11111',resp.data)
const data = resp.data
_this.queryParams.total = data.total
_this.thresholdAnalysisTable = data.thresholdAnalysisTable
_this.analysisChartData = data.analysisChartData
_this. drawLine()
_this.tableLoading = false
this.initChart(resp.data)
} else {
// resp.code
_this.thresholdAnalysisTable = []

Loading…
Cancel
Save