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