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