feat:统计分析:生产缺陷统计和各工序物料统计初版

This commit is contained in:
shijing 2025-11-11 15:46:29 +08:00
parent cf0088c515
commit 26cb93052d
2 changed files with 202 additions and 0 deletions

View File

@ -0,0 +1,76 @@
<template>
<el-container>
<el-main class="nopadding">
<scTable
ref="table"
:data="tableData"
id="exportDiv"
stripe
>
<el-table-column type="index" width="50" fixed="left"/>
<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">
<span v-if="scope.row[item]">{{ scope.row[item] }}</span>
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
</template>
<script>
import { genTree } from "@/utils/verificate";
export default {
name: "workerTimes",
data() {
return {
lists:[],
tableData:[],
};
},
mounted() {
let that = this;
that.getData();
this.getMgroup();
},
methods: {
getMgroup() {
let that = this;
that.$API.mtm.mgroup.list.req({ page: 0,query:'{name}' }).then(res => {
let end = res.length-1;
let arr = res.slice(13,end);
that.mgroups = arr.forEach(item=>{
that.lists.push(item.name);
});
});
},
getData(){
let that = this;
let params = {};
that.$API.bi.dataset.exec.req('mat_p_count', params).then((res) => {
let data = res.data2.ds0;
let data2 = [];
data.forEach(item=>{
if(item.物料名.indexOf('玻璃棒管')<0){
data2.push(item);
}
})
data2.forEach(item=>{
if(item.工序数量分布){
let obj = JSON.parse(item.工序数量分布);
for(let key in obj){
item[key]= obj[key];
}
}
})
that.tableData = data2;
});
},
},
};
</script>
<style scoped>
</style>

View File

@ -0,0 +1,126 @@
<template>
<el-container>
<el-header>
<div class="left-panel"></div>
<div class="right-panel">
<el-select
v-model="query.mgroup_name"
placeholder="所属工段"
clearable style="width: 150px">
<el-option
v-for="item in mgroups"
:key="item.id"
:label="item.name"
:value="item.name"
></el-option>
</el-select>
<el-date-picker
v-model="query.start_date"
type="date"
value-format="YYYY-MM-DD"
placeholder="开始时间"
style="width: 150px"
/>
<el-date-picker
v-model="query.end_date"
type="date"
value-format="YYYY-MM-DD"
placeholder="结束时间"
style="margin-left: 2px; width: 150px"
/>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
></el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable
ref="table"
:data="tableData"
id="exportDiv"
stripe
>
<el-table-column type="index" width="50" fixed="left"/>
<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>
<!-- <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() {
return {
query:{
end_date:'',
mgroup_name:'排板',
start_date:'2025-11-01',
},
lists:[],
mgroups: [],
tableData:[],
apiObj: this.$API.system.user.list,
};
},
mounted() {
let that = this;
let date = new 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.getMgroup();
},
methods: {
getMgroup() {
let that = this;
that.$API.mtm.mgroup.list.req({ page: 0 }).then(res => {
that.mgroups = res;
});
},
getData(){
let that = this;
let params = {};
params.query = that.query;
that.$API.bi.dataset.exec.req('prodect_defect', params).then((res) => {
let data = res.data2.ds0;
that.lists = [];
data.forEach(item=>{
let obj = JSON.parse(item.缺陷分布);
for(let key in obj){
if(that.lists.indexOf(key)>-1){}else{that.lists.push(key)}
item[key]= obj[key].;
}
})
that.tableData = data;
});
},
deptChange(){
this.getData();
},
handleQuery(){
let that = this;
console.log('that.query',that.query)
that.getData();
},
},
};
</script>
<style scoped>
</style>