|
|
@@ -4,7 +4,7 @@
|
|
|
:options="options"
|
|
|
id="up11Chart"
|
|
|
height="180px"
|
|
|
- width="570px"
|
|
|
+ width="590px"
|
|
|
ref="column-board"
|
|
|
></Echart>
|
|
|
</div>
|
|
|
@@ -36,10 +36,10 @@ export default {
|
|
|
top:8,
|
|
|
},
|
|
|
grid: {
|
|
|
- left: '4%',
|
|
|
+ left: '3%',
|
|
|
right: '1%',
|
|
|
bottom: '3%',
|
|
|
- top: 65,
|
|
|
+ top: 50,
|
|
|
containLabel: true
|
|
|
},
|
|
|
xAxis: [
|
|
|
@@ -57,13 +57,21 @@ export default {
|
|
|
type: 'value',
|
|
|
axisLabel: {
|
|
|
fontSize: 16
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ show: true,
|
|
|
+ lineStyle: {
|
|
|
+ // 使用深浅的间隔色
|
|
|
+ type: "dashed",
|
|
|
+ color: ['#aaa', '#aaa']
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
],
|
|
|
series: [
|
|
|
{
|
|
|
name: '数量',
|
|
|
- type: 'bar',
|
|
|
+ type: 'line',
|
|
|
barWidth: 20,
|
|
|
emphasis: {
|
|
|
focus: 'series'
|
|
|
@@ -108,23 +116,63 @@ export default {
|
|
|
}, 30000);
|
|
|
},
|
|
|
async getdata() {
|
|
|
- var caller = 'KB!IQC!CHECK7DAYDATA';
|
|
|
+ var caller = 'KB!IQC!CHECK7DAYDATA1';
|
|
|
await this.$http.get("kanban/datalist.action?caller="+caller+"&_noc=1&page=1&pageSize=100",{
|
|
|
params: {
|
|
|
condition: "1=1"
|
|
|
}
|
|
|
- }).then((result)=>{
|
|
|
- let dataList = JSON.parse(result.data.data);
|
|
|
- let xAxis0 = new Array();
|
|
|
- let series0 = new Array();
|
|
|
- for (let index = 0; index < dataList.length; index++) {
|
|
|
- const element = dataList[index];
|
|
|
- xAxis0.push(element.v_checkman);
|
|
|
- //数量
|
|
|
- series0.push(element.v_count);
|
|
|
+ }).then((result)=> {
|
|
|
+ let dataList = JSON.parse(result.data.data);
|
|
|
+ let series = new Array();
|
|
|
+ // 构建最终数据结构
|
|
|
+ let seriesdata = new Array();
|
|
|
+ if (dataList.length > 0) {
|
|
|
+ // 生成最近7天日期数组(包含今天)
|
|
|
+ const today = new Date()
|
|
|
+ const dateRange = Array.from({length: 7}, (_, i) => {
|
|
|
+ const d = new Date(today)
|
|
|
+ d.setDate(d.getDate() - 6 + i) // 从6天前到今天
|
|
|
+ return `${String(d.getMonth() + 1).padStart(2, '0')}${String(d.getDate()).padStart(2, '0')}`
|
|
|
+ })
|
|
|
+
|
|
|
+ // 按检查员分组并建立日期映射
|
|
|
+ const grouped = dataList.reduce((acc, item) => {
|
|
|
+ if (!acc[item.v_checkman]) {
|
|
|
+ acc[item.v_checkman] = {}
|
|
|
+ }
|
|
|
+ acc[item.v_checkman][item.v_ymd] = item.v_count
|
|
|
+ return acc
|
|
|
+ }, {})
|
|
|
+
|
|
|
+ seriesdata = Object.keys(grouped).map(name => ({
|
|
|
+ name: name,
|
|
|
+ data: dateRange.map(ymd => grouped[name][ymd] || null)
|
|
|
+ }))
|
|
|
+
|
|
|
+ for (let value of seriesdata) {
|
|
|
+ series.push({
|
|
|
+ name: value.name,
|
|
|
+ type: 'line',
|
|
|
+ data: value.data,
|
|
|
+ symbolSize: 4,
|
|
|
+ lineStyle: {
|
|
|
+ width: 3
|
|
|
+ },
|
|
|
+ label: {
|
|
|
+ show: false,
|
|
|
+ position: 'top',
|
|
|
+ fontSize:15,
|
|
|
+ color:'inherit',
|
|
|
+ fontWeight: "bold"
|
|
|
+ },
|
|
|
+ emphasis: {
|
|
|
+ focus: 'series'
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.options.xAxis[0].data = dateRange;
|
|
|
+ this.options.series = series;
|
|
|
}
|
|
|
- this.options.xAxis[0].data = xAxis0;
|
|
|
- this.options.series[0].data = series0;
|
|
|
},(result)=>{
|
|
|
console.error(result)
|
|
|
}
|