factory_web/src/views/statistics/bxerp/mioitemw.vue

132 lines
3.5 KiB
Vue

<template>
<el-container>
<el-header>
<div class="left-panel"></div>
<div class="right-panel">
<el-input v-model="params.number"
placeholder="批次号"
clearable
style="width: 200px;"
></el-input>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
></el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable v-if="data_show" :data="tableData" row-key="id" border hidePagination hideDo>
<el-table-column label="物料编号" prop="number" min-width="170px" fixed="left">
</el-table-column>
<el-table-column prop="note" :label="item.testitem_name" v-for="item in qct_testitems" :key="item.id">
<template #default="scope">
{{ scope.row[item.testitem_name] }}
</template>
</el-table-column>
<el-table-column prop="note" :label="item.defect_name" v-for="item in qct_defects" :key="item.id">
<template #default="scope">
<el-switch
:disabled="true"
v-model="scope.row[item.defect_name]"
style="--el-switch-on-color: red"
></el-switch>
</template>
</el-table-column>
<el-table-column label="备注" prop="note">
</el-table-column>
</scTable>
</el-main>
<el-footer>
<el-pagination
background
:small="true"
:total="dataTotal"
layout="total, sizes, prev, pager, next, jumper"
:page-size="params.page_size"
:page-sizes="[20, 50, 100, 200]"
:current-page="params.page"
@current-change="getData"
@update:page-size="getData"
></el-pagination>
</el-footer>
</el-container>
</template>
<script>
export default {
name: "inmTotal",
data() {
return {
data_show:false,
tableData:[],
qct_defects:[],
qct_testitems:[],
params:{
page:1,
page_size:20,
number:"",
mioitem__material__type:30,
ftest__isnull:0,
mioitem__mio__state:20,
}
};
},
created() {
let that = this;
that.$API.qm.qct.list.req({search:'光纤预制棒管',page:0}).then((res) => {
that.$API.qm.qct.item.req(res[0].id).then((res) => {
that.qct_defects = res.qct_defects;
that.qct_testitems = res.qct_testitems;
that.data_show = true;
that.getData(1);
})
})
},
methods: {
getData(page){
let that = this;
that.params.page = page;
that.tableData = [];
that.$API.inm.mioitemw.list.req(that.params).then(res=>{
that.dataTotal = res.count;
if(res.results.length>0){
res.results.forEach((item) => {
let obj = {};
obj = Object.assign({},item);
obj.isEdit = false;
if(item.ftest!=null){
if(item.ftest.ftestdefects!==undefined&&item.ftest.ftestdefects!==''&&item.ftest.ftestdefects!==null&&item.ftest.ftestdefects.length>0){
item.ftest.ftestdefects.forEach((item1) => {
obj[item1.defect_name] = item1.has?item1.has:false;
})
}
if(item.ftest.ftestitems!==undefined&&item.ftest.ftestitems!==''&&item.ftest.ftestitems!==null&&item.ftest.ftestitems.length>0){
item.ftest.ftestitems.forEach((item2) => {
obj[item2.testitem_name] = item2.test_val_json?item2.test_val_json:"";
})
}
}else{
that.qct_defects.forEach((item1) => {
obj[item1.defect_name] = false;
})
that.qct_testitems.forEach((item2) => {
obj[item2.testitem_name] = "";
})
}
that.tableData.push(obj);
})
}
})
},
handleQuery(){
this.getData(1)
},
},
};
</script>
<style scoped>
</style>