fix:员工工时统计

This commit is contained in:
shijing 2025-10-29 16:28:00 +08:00
parent da13175ebb
commit 33040f0ccc
1 changed files with 46 additions and 31 deletions

View File

@ -3,11 +3,19 @@
<el-header>
<div class="left-panel"></div>
<div class="right-panel">
<el-input v-model="query.user_name"
<el-cascader
v-model="query.dept_name"
:options="group"
:props="groupsProps"
clearable
:show-all-levels="false"
@change="deptChange">
</el-cascader>
<!-- <el-input v-model="query.user_name"
placeholder="姓名"
clearable
style="width: 200px;"
></el-input>
></el-input> -->
<el-date-picker
v-model="query.start_date"
type="date"
@ -27,11 +35,6 @@
icon="el-icon-search"
@click="handleQuery"
></el-button>
<!-- <el-button
@click="handleExport"
class="tables"
type="primary"
>导出</el-button> -->
</div>
</el-header>
<el-main class="nopadding">
@ -42,31 +45,48 @@
stripe
>
<el-table-column type="index" width="50" fixed="left"/>
<el-table-column label="操作人" prop="操作人">
<el-table-column label="工段" prop="工段">
</el-table-column>
<el-table-column label="日期" prop="日期">
</el-table-column>
<el-table-column label="物料领用数" align="center">
<template #default="scope">
<div v-for="value in scope.row.data" :key="value.name">{{ value.name }}:{{ value.count }}</div>
{{ scope.row.}}-{{ scope.row.}}-{{ scope.row.}}
</template>
</el-table-column>
<el-table-column label="操作人" prop="操作人">
</el-table-column>
<el-table-column label="生产数" prop="生产数">
</el-table-column>
<el-table-column label="合格数" prop="合格数">
</el-table-column>
<el-table-column label="不合格数" prop="不合格数">
</el-table-column>
<el-table-column label="合格率" prop="合格率">
</el-table-column>
</scTable>
</el-main>
</el-container>
</template>
<script>
import { genTree } from "@/utils/verificate";
export default {
name: "workerTimes",
data() {
return {
query:{
end_date:'',
user_name:'',
dept_name:'',
start_date:'',
},
group: [],
tableData:[],
groupsProps: {
value: "name",
multiple: false,
emitPath: false,
checkStrictly: true,
project_code : this.$TOOL.data.get("BASE_INFO").base.base_code
},
};
},
mounted() {
@ -74,35 +94,30 @@ export default {
let date = new Date();
that.query.start_date = that.query.end_date = that.$TOOL.dateFormat2(date);
that.getData();
this.getGroup();
},
methods: {
getGroup() {
let that = this;
that.$API.system.dept.list.req({ page: 0, type: 'dept' }).then(res => {
that.group = genTree(res);
});
},
getData(){
let that = this;
let params = {};
params.query = that.query;
that.$API.bi.dataset.exec.req('lineDay_p', params).then((res) => {
let data = res.data2.ds0;
data.forEach((item) => {
item.data = [];
item.工段物料领用数 = JSON.parse(item.工段物料领用数);
for(let key in item.工段物料领用数){
item.data.push({
"name":key,
"count":item.工段物料领用数[key]
})
}
})
that.tableData = data;
that.$API.bi.dataset.exec.req('performance', params).then((res) => {
that.tableData = res.data2.ds0;
});
},
deptChange(){
this.getData();
},
handleQuery(){
let that = this;
if(that.query.user_name==null||that.query.user_name==''){
that.$message.error('请输入员工姓名');
}else{
that.getData();
}
console.log('that.query',that.query)
that.getData();
},
},
};