feat:禅道425

This commit is contained in:
shijing 2026-06-10 13:39:45 +08:00
parent c6bf06bd3b
commit c3f38b084d
1 changed files with 20 additions and 15 deletions

View File

@ -105,6 +105,9 @@ export default {
tooltip: { tooltip: {
trigger: 'axis' trigger: 'axis'
}, },
legend: {
top: 30
},
xAxis: { xAxis: {
type: 'category', type: 'category',
data: [] data: []
@ -112,7 +115,6 @@ export default {
yAxis: { yAxis: {
type: 'value' type: 'value'
}, },
lenged: [],
series: [{ series: [{
data: [0, 0, 0, 0, 0, 0, 0], data: [0, 0, 0, 0, 0, 0, 0],
stack: 'Ad', stack: 'Ad',
@ -146,13 +148,11 @@ export default {
that.start_date = year + '-' + month + '-01'; that.start_date = year + '-' + month + '-01';
that.end_date = year + '-' + month + '-' + days; that.end_date = year + '-' + month + '-' + days;
that.queryDate = year + '-' + month; that.queryDate = year + '-' + month;
let duration = that.endWeekNum - that.firstWeekNum + 1; for (let i = that.firstWeekNum; i <= that.endWeekNum; i++) {
for (let i = 1; i <= duration; i++) {
that.xAxisOrigin.push('第' + i + '周'); that.xAxisOrigin.push('第' + i + '周');
} }
that.xAxisData = that.xAxisOrigin; that.xAxisData = that.xAxisOrigin;
let height = document.getElementById('mainDom').clientHeight; let height = document.getElementById('mainDom').clientHeight;
console.log('height',height);
height= height-60; height= height-60;
that.tableHeight = height; that.tableHeight = height;
document.getElementById('bachart1').style.height = height + 'px'; document.getElementById('bachart1').style.height = height + 'px';
@ -175,7 +175,6 @@ export default {
}, 500) }, 500)
}, },
queryTypeChange(value) { queryTypeChange(value) {
console.log(value)
this.queryDate = ''; this.queryDate = '';
}, },
getWeekOfYear(a,b,c) { getWeekOfYear(a,b,c) {
@ -197,19 +196,18 @@ export default {
query: { start_date: that.start_date, end_date: that.end_date, mgroup_name: "混料", is_count_utask: -1 }, query: { start_date: that.start_date, end_date: that.end_date, mgroup_name: "混料", is_count_utask: -1 },
}; };
let option = deepCopy(that.basicOption); let option = deepCopy(that.basicOption);
option.xAxis.data = that.xAxisData;
option.title.text = '混料统计'; option.title.text = '混料统计';
let dateLabels = that.xAxisData;
let exec = that.queryType == '月' ? 'lineWeek' : 'lineMonth'; let exec = that.queryType == '月' ? 'lineWeek' : 'lineMonth';
that.$API.bi.dataset.exec.req(exec, obj).then((res) => { that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
let dataList = res.data2.ds0 ? res.data2.ds0 : []; let dataList = res.data2.ds0 ? res.data2.ds0 : [];
that.dataList = dataList; that.dataList = dataList;
if (dataList.length > 0) { if (dataList.length > 0) {
option.series = []; option.series = [];
let seriesData = [], nameList = []; let nameList = [];
dataList.forEach(ite => { dataList.forEach(ite => {
if (nameList.indexOf(ite.物料名) > -1) { } else { if (nameList.indexOf(ite.物料名) > -1) { } else {
nameList.push(ite.物料名); nameList.push(ite.物料名);
seriesData.push([0,0,0,0,0,0,0,0,0,0,0,0])
let obj = {}; let obj = {};
obj.text = ite.物料名; obj.text = ite.物料名;
obj.value = ite.物料名; obj.value = ite.物料名;
@ -230,11 +228,15 @@ export default {
that.specsFilters.push(obj3); that.specsFilters.push(obj3);
} }
}) })
let seriesData = [];
for (let i = 0; i < dateLabels.length; i++) {
seriesData.push(new Array(nameList.length).fill(0));
}
dataList.forEach(item => { dataList.forEach(item => {
let indexX = 0, indexY = 0; let indexX = 0, indexY = 0;
if (that.queryType == '月') { if (that.queryType == '月') {
indexX = nameList.indexOf(item.物料名); indexX = item. - that.firstWeekNum;
indexY = item. - that.firstWeekNum; indexY = nameList.indexOf(item.物料名);
if(dateList.indexOf(item.)>-1){}else{ if(dateList.indexOf(item.)>-1){}else{
dateList.push(item.); dateList.push(item.);
let obj = {}; let obj = {};
@ -244,15 +246,17 @@ export default {
} }
} else { } else {
that.dateFilters = [1,2,3,4,5,6,7,8,9,10,11,12]; that.dateFilters = [1,2,3,4,5,6,7,8,9,10,11,12];
indexX = nameList.indexOf(item.物料名); indexX = item. - 1;
indexY = item. - 1; indexY = nameList.indexOf(item.物料名);
}
if (indexX >= 0 && indexX < seriesData.length && indexY >= 0) {
seriesData[indexX][indexY] += item.合格数;
} }
seriesData[indexX][indexY] += item.合格数;
}); });
option.xAxis.data = nameList;
for (let n = 0; n < seriesData.length; n++) { for (let n = 0; n < seriesData.length; n++) {
let obj = {}; let obj = {};
obj.name = nameList[n]; obj.name = dateLabels[n];
obj.stack = 'Ad';
obj.type = 'bar'; obj.type = 'bar';
obj.barWidth = '15px'; obj.barWidth = '15px';
obj.data = seriesData[n]; obj.data = seriesData[n];
@ -260,6 +264,7 @@ export default {
} }
that.setChart("bachart1", option); that.setChart("bachart1", option);
} else { } else {
option.xAxis.data = [];
that.setChart("bachart1", option); that.setChart("bachart1", option);
} }
}); });