This commit is contained in:
parent
1a1a838042
commit
1b191df783
|
@ -2,30 +2,23 @@
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-header>
|
<el-header>
|
||||||
<div class="right-panel">
|
<div class="right-panel">
|
||||||
<el-select v-model="queryType" clearable @change="queryTypeChange">
|
<el-select
|
||||||
<el-option v-for="item in typeOptions"
|
v-model="queryBelongDept"
|
||||||
:key="item"
|
clearable
|
||||||
:label="item"
|
style="width:200px"
|
||||||
:value="item"
|
placeholder="请选择部门">
|
||||||
>
|
<el-option v-for="item in deptData"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.name">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-if="queryType=='月'"
|
|
||||||
v-model="queryDate"
|
v-model="queryDate"
|
||||||
type="month"
|
type="month"
|
||||||
placeholder="查询月期"
|
placeholder="查询月期"
|
||||||
value-format="YYYY-MM"
|
value-format="YYYY-MM"
|
||||||
style="width:100%"
|
style="width:200px"
|
||||||
>
|
|
||||||
</el-date-picker>
|
|
||||||
<el-date-picker
|
|
||||||
v-if="queryType=='年'"
|
|
||||||
v-model="queryDate"
|
|
||||||
type="year"
|
|
||||||
placeholder="查询年份"
|
|
||||||
value-format="YYYY"
|
|
||||||
style="width:100%"
|
|
||||||
>
|
>
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
|
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
|
||||||
|
@ -40,16 +33,20 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :lg="12">
|
<el-col :lg="12">
|
||||||
<el-card shadow="never">
|
<el-card shadow="never">
|
||||||
<el-table :data="tableData">
|
<el-table :data="tableData" style="width: 100%">
|
||||||
<el-table-column label="日期" prop="date">
|
<el-table-column label="日期" prop="date">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ scope.row.年 }}-{{ scope.row.月 }}
|
||||||
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="人员名称" prop="name">
|
<el-table-column label="操作人" prop="操作人">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="工序" prop="name">
|
<el-table-column label="工段" prop="工段">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="车间" prop="count_ok">
|
<el-table-column label="车间">
|
||||||
|
{{ queryBelongDept }}
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="合格数" prop="count_ok">
|
<el-table-column label="合格数" prop="合格数">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
@ -68,13 +65,14 @@
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
queryType:'月',
|
queryBelongDept:'',
|
||||||
queryDate:'',
|
queryDate:'',
|
||||||
start_date:'',
|
start_date:'',
|
||||||
end_date:'',
|
end_date:'',
|
||||||
currentYear:'',
|
currentYear:'',
|
||||||
currentMonth:'',
|
currentMonth:'',
|
||||||
typeOptions:['月','年'],
|
deptData:[],
|
||||||
|
tableData:[],
|
||||||
option: {
|
option: {
|
||||||
title: {
|
title: {
|
||||||
text: '人员统计',
|
text: '人员统计',
|
||||||
|
@ -95,10 +93,10 @@
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'category',
|
type: 'category',
|
||||||
data: ['张良', '钱勇', '赵丽丽', '王军', '孙聪', '李超', '周年宋']
|
data: []
|
||||||
},
|
},
|
||||||
series: {
|
series: {
|
||||||
data: [300, 290, 320, 350, 310, 350, 290],
|
data: [],
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
barWidth: '15px',
|
barWidth: '15px',
|
||||||
}
|
}
|
||||||
|
@ -115,82 +113,57 @@
|
||||||
this.start_date =year+'-'+month+'-01';
|
this.start_date =year+'-'+month+'-01';
|
||||||
this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
|
this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
|
||||||
this.queryDate = year+'-'+month;
|
this.queryDate = year+'-'+month;
|
||||||
this.getData6();
|
this.getData();
|
||||||
this.getData7();
|
this.getDept();
|
||||||
this.getData10();
|
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
queryTypeChange(value){
|
getDept() {
|
||||||
console.log(value)
|
this.$API.system.dept.list.req({ page: 0,type:'dept'}).then(res=>{
|
||||||
this.queryDate = '';
|
let data = [];
|
||||||
if(value=='月'){
|
res.forEach(item => {
|
||||||
this.xAxisData = ['第一周','第二周','第三周','第四周'];
|
if(item.parent=='3423856735881117696'){
|
||||||
}else{
|
data.push(item)
|
||||||
this.xAxisData = ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月']
|
|
||||||
}
|
}
|
||||||
this.option.xAxis.data = this.xAxisData;
|
});
|
||||||
this.option2.xAxis.data = this.xAxisData;
|
this.deptData = data;
|
||||||
this.option3.xAxis.data = this.xAxisData;
|
this.queryBelongDept = data[0].name;
|
||||||
this.option4.xAxis.data = this.xAxisData;
|
|
||||||
},
|
|
||||||
getData6(){
|
|
||||||
let that = this;
|
|
||||||
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
|
|
||||||
let obj = {
|
|
||||||
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "6车间" },
|
|
||||||
};
|
|
||||||
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
|
|
||||||
console.log('6生产车间统计:',doInRes);
|
|
||||||
debugger;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getData7(){
|
queryTypeChange(value){
|
||||||
let that = this;
|
this.queryDate = '';
|
||||||
let obj = {
|
|
||||||
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "7车间" },
|
|
||||||
};
|
|
||||||
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
|
|
||||||
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
|
|
||||||
console.log('7生产车间统计:',doInRes);
|
|
||||||
debugger;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
getData10(){
|
getData(){
|
||||||
let that = this;
|
let that = this;
|
||||||
let obj = {
|
let obj = {
|
||||||
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "10·车间" },
|
query: { start_date: this.start_date, end_date: this.end_date, dept_name:this.queryBelongDept },
|
||||||
};
|
};
|
||||||
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
|
that.$API.bi.dataset.exec.req('performance', obj).then((res) => {
|
||||||
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
|
console.log('绩效统计:',res);
|
||||||
console.log('10生产车间统计:',doInRes);
|
let data = res.data2.ds0;
|
||||||
debugger;
|
let seriesData = [],yAxisData=[];
|
||||||
|
data.forEach(item=>{
|
||||||
|
seriesData.push(item.合格数);
|
||||||
|
yAxisData.push(item.操作人);
|
||||||
|
})
|
||||||
|
console.log(yAxisData)
|
||||||
|
console.log(seriesData)
|
||||||
|
console.log(data)
|
||||||
|
that.tableData = data;
|
||||||
|
that.option.yAxis.data = yAxisData;
|
||||||
|
that.option.series.data = seriesData;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleQuery(){
|
handleQuery(){
|
||||||
if(this.queryDate!==''){
|
if(this.queryDate!==''){
|
||||||
if(this.queryType=='月'){
|
|
||||||
|
|
||||||
this.start_date =this.queryDate+'-01';
|
this.start_date =this.queryDate+'-01';
|
||||||
let arr = this.queryDate.split('-');
|
let arr = this.queryDate.split('-');
|
||||||
this.end_date = this.queryDate+'-'+new Date(arr[0], arr[1], 0).getDate();
|
this.end_date = this.queryDate+'-'+new Date(arr[0], arr[1], 0).getDate();
|
||||||
}else{
|
}else{
|
||||||
this.start_date = this.queryDate+'-01-01';
|
|
||||||
this.end_date = this.queryDate+'-12-31';
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
if(this.queryType=='月'){
|
|
||||||
this.start_date =this.currentYear+'-'+this.currentMonth+'-01';
|
this.start_date =this.currentYear+'-'+this.currentMonth+'-01';
|
||||||
this.end_date = this.currentYear+'-'+this.currentMonth+'-'+new Date(this.currentYear, this.currentMonth, 0).getDate();
|
this.end_date = this.currentYear+'-'+this.currentMonth+'-'+new Date(this.currentYear, this.currentMonth, 0).getDate();
|
||||||
}else{
|
|
||||||
this.start_date = this.currentYear+'-01-01';
|
|
||||||
this.end_date = this.currentYear+'-12-31';
|
|
||||||
}
|
}
|
||||||
}
|
console.log('查询query',this.start_date,this.end_date)
|
||||||
debugger;
|
this.getData();
|
||||||
console.log(this.query)
|
|
||||||
this.getData6();
|
|
||||||
this.getData7();
|
|
||||||
this.getData10();
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue