feat: 绩效统计增加字段
This commit is contained in:
parent
07adf80056
commit
7d69285bf0
|
|
@ -2,24 +2,12 @@
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-header>
|
<el-header>
|
||||||
<div class="right-panel">
|
<div class="right-panel">
|
||||||
<el-select
|
<el-select v-model="queryBelongDept" clearable style="width:200px" placeholder="请选择部门">
|
||||||
v-model="queryBelongDept"
|
<el-option v-for="item in deptData" :key="item.id" :label="item.name" :value="item.name">
|
||||||
clearable
|
|
||||||
style="width:200px"
|
|
||||||
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-model="queryDate" type="month" placeholder="查询月期" value-format="YYYY-MM"
|
||||||
v-model="queryDate"
|
style="width:200px">
|
||||||
type="month"
|
|
||||||
placeholder="查询月期"
|
|
||||||
value-format="YYYY-MM"
|
|
||||||
style="width:200px"
|
|
||||||
>
|
|
||||||
</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>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -46,8 +34,14 @@
|
||||||
<el-table-column label="车间">
|
<el-table-column label="车间">
|
||||||
{{ queryBelongDept }}
|
{{ queryBelongDept }}
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="生产数" prop="生产数">
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="合格数" prop="合格数">
|
<el-table-column label="合格数" prop="合格数">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="不合格数" prop="不合格数">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="合格率" prop="合格率">
|
||||||
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
@ -57,111 +51,110 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import scEcharts from '@/components/scEcharts';
|
import scEcharts from '@/components/scEcharts';
|
||||||
export default {
|
export default {
|
||||||
name: 'chart',
|
name: 'chart',
|
||||||
components: {
|
components: {
|
||||||
scEcharts
|
scEcharts
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
queryBelongDept:'',
|
queryBelongDept: '',
|
||||||
queryDate:'',
|
queryDate: '',
|
||||||
start_date:'',
|
start_date: '',
|
||||||
end_date:'',
|
end_date: '',
|
||||||
currentYear:'',
|
currentYear: '',
|
||||||
currentMonth:'',
|
currentMonth: '',
|
||||||
deptData:[],
|
deptData: [],
|
||||||
tableData:[],
|
tableData: [],
|
||||||
option: {
|
option: {
|
||||||
title: {
|
title: {
|
||||||
text: '人员统计',
|
text: '人员统计',
|
||||||
// subtext: '',
|
// subtext: '',
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
top: '80px'
|
top: '80px'
|
||||||
},
|
},
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'axis'
|
trigger: 'axis'
|
||||||
},
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'value',
|
type: 'value',
|
||||||
position:'top',
|
position: 'top',
|
||||||
axisLine:{
|
axisLine: {
|
||||||
show:true
|
show: true
|
||||||
}
|
|
||||||
},
|
|
||||||
yAxis: {
|
|
||||||
type: 'category',
|
|
||||||
data: []
|
|
||||||
},
|
|
||||||
series: {
|
|
||||||
data: [],
|
|
||||||
type: 'bar',
|
|
||||||
barWidth: '15px',
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
yAxis: {
|
||||||
},
|
type: 'category',
|
||||||
mounted(){
|
data: []
|
||||||
let date = new Date();
|
},
|
||||||
let year = date.getFullYear();
|
series: {
|
||||||
let month = date.getMonth()+1;
|
data: [],
|
||||||
let days = new Date(year, month, 0).getDate();
|
type: 'bar',
|
||||||
this.currentYear = year;
|
barWidth: '15px',
|
||||||
this.currentMonth = month;
|
|
||||||
this.start_date =year+'-'+month+'-01';
|
|
||||||
this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
|
|
||||||
this.queryDate = year+'-'+month;
|
|
||||||
this.getData();
|
|
||||||
this.getDept();
|
|
||||||
},
|
|
||||||
methods:{
|
|
||||||
getDept() {
|
|
||||||
this.$API.system.dept.list.req({ page: 0,type:'dept'}).then(res=>{
|
|
||||||
this.deptData = res;
|
|
||||||
this.queryBelongDept = res[0].name;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
queryTypeChange(value){
|
|
||||||
this.queryDate = '';
|
|
||||||
},
|
|
||||||
getData(){
|
|
||||||
let that = this;
|
|
||||||
let obj = {
|
|
||||||
query: { start_date: this.start_date, end_date: this.end_date, dept_name:this.queryBelongDept },
|
|
||||||
};
|
|
||||||
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!==''){
|
|
||||||
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.currentYear+'-'+this.currentMonth+'-01';
|
|
||||||
this.end_date = this.currentYear+'-'+this.currentMonth+'-'+new Date(this.currentYear, this.currentMonth, 0).getDate();
|
|
||||||
}
|
}
|
||||||
console.log('查询query',this.start_date,this.end_date)
|
|
||||||
this.getData();
|
|
||||||
},
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
let date = new Date();
|
||||||
|
let year = date.getFullYear();
|
||||||
|
let month = date.getMonth() + 1;
|
||||||
|
let days = new Date(year, month, 0).getDate();
|
||||||
|
this.currentYear = year;
|
||||||
|
this.currentMonth = month;
|
||||||
|
this.start_date = year + '-' + month + '-01';
|
||||||
|
this.end_date = year + '-' + month + '-' + new Date(year, month, 0).getDate();
|
||||||
|
this.queryDate = year + '-' + month;
|
||||||
|
this.getData();
|
||||||
|
this.getDept();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getDept() {
|
||||||
|
this.$API.system.dept.list.req({ page: 0, type: 'dept' }).then(res => {
|
||||||
|
this.deptData = res;
|
||||||
|
this.queryBelongDept = res[0].name;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
}
|
queryTypeChange(value) {
|
||||||
|
this.queryDate = '';
|
||||||
|
},
|
||||||
|
getData() {
|
||||||
|
let that = this;
|
||||||
|
let obj = {
|
||||||
|
query: { start_date: this.start_date, end_date: this.end_date, dept_name: this.queryBelongDept },
|
||||||
|
};
|
||||||
|
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 !== '') {
|
||||||
|
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.currentYear + '-' + this.currentMonth + '-01';
|
||||||
|
this.end_date = this.currentYear + '-' + this.currentMonth + '-' + new Date(this.currentYear, this.currentMonth, 0).getDate();
|
||||||
|
}
|
||||||
|
console.log('查询query', this.start_date, this.end_date)
|
||||||
|
this.getData();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style></style>
|
||||||
</style>
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue