feat:人员工时统计-冷加工统计,数据处理,工段与物料呈二级表头

This commit is contained in:
shijing 2025-11-12 13:50:30 +08:00
parent 88c0be7b60
commit 77806aa776
1 changed files with 24 additions and 33 deletions

View File

@ -13,11 +13,6 @@
>
<el-table-column label="姓名" prop="name"></el-table-column>
</xtSelect>
<!-- <el-input v-model="query.user_name"
placeholder="姓名"
clearable
style="width: 200px;"
></el-input> -->
<el-date-picker
v-model="query.start_date"
type="date"
@ -51,23 +46,19 @@
</el-table-column>
<el-table-column label="操作人" prop="操作人" width="120">
</el-table-column>
<el-table-column v-for="item in lists" :key="item" :label="item" :prop="item">
<template #default="scope">
{{ scope.row[item] }}
</template>
<el-table-column v-for="item in lists" :key="item" :label="item.text">
<el-table-column v-for="item1 in item.value" :key="item1" :label="item1">
<template #default="scope">
<span v-if="scope.row[item1]">{{ scope.row[item.text+'_'+item1] }}</span>
</template>
</el-table-column>
</el-table-column>
<!-- <el-table-column label="生产数" prop="生产数">
<template #default="scope">
<span v-for="item in scope.row.list" :key="item">{{ item.text }}:{{ item.value }}</span>
</template>
</el-table-column> -->
</scTable>
</el-main>
</el-container>
</template>
<script>
import { genTree } from "@/utils/verificate";
export default {
name: "workerTimes",
data() {
@ -77,34 +68,23 @@ export default {
user_name:'',
start_date:'',
},
mgroups: [],
lists:[],
mgruops:[],
tableData:[],
groupsProps: {
value: "name",
multiple: false,
emitPath: false,
checkStrictly: true,
project_code : this.$TOOL.data.get("BASE_INFO").base.base_code
},
apiObj: this.$API.system.user.list,
};
},
mounted() {
let that = this;
let date = new Date();
that.query.start_date = that.query.end_date = that.$TOOL.dateFormat2(date);
that.query.end_date = that.$TOOL.dateFormat2(date);
that.query.start_date = that.query.end_date.split('-')[0] + '-' + that.query.end_date.split('-')[1] + '-01';
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;
that.mgruops = [];
let params = {};
params.query = that.query;
that.$API.bi.dataset.exec.req('lineDay_p', params).then((res) => {
@ -113,8 +93,20 @@ export default {
data.forEach(item=>{
let obj = JSON.parse(item.工段物料生产数);
for(let key in obj){
let mgroup = key.split('_')[0];
let pname = key.split('_')[1];
if(that.mgruops.indexOf(mgroup)<0){
that.mgruops.push(mgroup);
that.lists.push({text:mgroup,value:[pname]});
}else{
var index = that.mgruops.indexOf(mgroup);
if(that.lists[index].value.indexOf(pname)<0){
that.lists[index].value.push(pname);
}
}
item[key]= obj[key];
if(that.lists.indexOf(key)>-1){}else{that.lists.push(key)}
item[pname]= obj[key];
}
})
that.tableData = data;
@ -125,7 +117,6 @@ export default {
},
handleQuery(){
let that = this;
console.log('that.query',that.query)
that.getData();
},
},