This commit is contained in:
caoqianming 2025-11-28 15:37:15 +08:00
commit 1d27409939
3 changed files with 174 additions and 171 deletions

View File

@ -4,7 +4,7 @@ a {color: #333;text-decoration: none;}
a:hover, a:focus {color: #000;text-decoration: none;} a:hover, a:focus {color: #000;text-decoration: none;}
a:link {text-decoration: none;} a:link {text-decoration: none;}
a:-webkit-any-link {text-decoration: none;} a:-webkit-any-link {text-decoration: none;}
a,button,input,textarea{-webkit-tap-highlight-color:rgba(0,0,0,0);box-sizing: border-box;outline:none !important; -webkit-appearance: none;} a,button,textarea{-webkit-tap-highlight-color:rgba(0,0,0,0);box-sizing: border-box;outline:none !important; -webkit-appearance: none;}
* {margin: 0;padding: 0;box-sizing: border-box;outline: none;} * {margin: 0;padding: 0;box-sizing: border-box;outline: none;}
.card-header { .card-header {
display: flex; display: flex;

View File

@ -216,7 +216,8 @@
row-key="id" row-key="id"
stripe stripe
:params="paramsIn" :params="paramsIn"
hidePagination hidePagination
hideDo
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column <el-table-column

View File

@ -17,148 +17,65 @@
</div> </div>
</el-header> </el-header>
<el-main id="mlogbwMain"> <el-main id="mlogbwMain">
<el-button type="primary" v-if="!isSubmit&&processType=='20'" @click="check_start" style="position: relative;">检验</el-button> <el-button type="primary" v-if="!isSubmit" @click="check_add">新增</el-button>
<el-button type="primary" v-if="!isSubmit&&processType=='20'" @click="check_start">检验</el-button>
<el-button type="primary" v-if="multipleSet" @click="check_set" style="position: relative;left: 210px;">批量操作</el-button> <el-button type="primary" v-if="multipleSet" @click="check_set" style="position: relative;left: 210px;">批量操作</el-button>
<el-input v-if="multipleSet" v-model="wprInputText" @change="wprinputChange" style="width:200px;position: relative;left: 308px;"></el-input> <el-input v-if="multipleSet" v-model="wprInputText" @change="wprinputChange" style="width:200px;position: relative;left: 308px;"></el-input>
<sc-form-table <table id="mlogbwlist" class="tables">
hideDelete <thead>
ref="mlogbwTable" <tr>
id="mlogbwlist" <th class="w_30 inlineBlock"></th>
v-model="mlogbwlist" <th class="w_140 inlineBlock">物料批次</th>
placeholder="暂无数据" <th class="w_140 inlineBlock">物料编号</th>
:hideAdd="hideAdd" <th class="w_80 inlineBlock" v-for="item in qct_testitems" :key="item.id">{{ item.testitem_name }}</th>
:addTemplate="addTemplate" <th class="w_80 inlineBlock" v-for="item in qct_defects" :key="item.id">{{ item.defect_name }}</th>
:tableHeight="tableHeight" <th class="w_80 inlineBlock">备注</th>
:canMultiple = "canMultiple" <th class="w_180 inlineBlock" v-if="!isSubmit">操作</th>
:pushType="pushType" </tr>
row-key="id" </thead>
@selectChange="selectChange" <tbody>
@selectAllChange="selectAllChange" <tr v-for="(row, index) in mlogbwlist" :key="row.id">
@add="rowAdd" <td class="w_30 inlineBlock padding_4">
> <input type="checkbox" v-model="selectedindexes" :value="row.id" @change="selectChange">
<el-table-column prop="mlogb__batch" label="物料批次" fixed min-width="160px"> </td>
<template #default="scope"> <td class="w_140 inlineBlock">
<el-input v-if="scope.row.isEdit" v-model="scope.row.mlogb__batch" placeholder="物料编号"></el-input> <input v-if="row.isEdit" v-model="row.mlogb__batch" placeholder="物料批次">
<span v-else>{{ scope.row.mlogb__batch }}</span> <span v-else>{{ row.mlogb__batch }}</span>
</template> </td>
</el-table-column> <td class="w_140 inlineBlock">
<el-table-column prop="number" label="物料编号" fixed min-width="160px"> <input v-if="row.isEdit" v-model="row.number" placeholder="物料编号">
<template #default="scope"> <span v-else>{{ row.number }}</span>
<el-input v-if="scope.row.isEdit" v-model="scope.row.number" placeholder="物料编号"></el-input> <span v-if="row.wpr_number_out !== null && row.wpr_number_out !== undefined">{{ row.wpr_number_out }}</span>
<span v-else>{{ scope.row.number }}</span> </td>
<span v-if="scope.row.wpr_number_out!==null&&scope.row.wpr_number_out!==undefined">{{ scope.row.wpr_number_out }}</span> <td class="w_80 inlineBlock" v-for="item in qct_testitems" :key="item.id">
</template> <span v-if="!row.isEdit || !item.canEdit">{{ row[item.testitem_name] }}</span>
</el-table-column> <input v-if="item.testitem_field_type == 'input-number' && row.isEdit && item.canEdit"
<el-table-column prop="note" :label="item.testitem_name" v-for="item in qct_testitems" :key="item.id" width="150px"> type="number" v-model="row[item.testitem_name]" @change="defectCountSun(row)">
<template #default="scope"> <input v-if="item.testitem_field_type == 'input-text' && row.isEdit && item.canEdit"
<span v-if="!scope.row.isEdit||!item.canEdit">{{ scope.row[item.testitem_name] }}</span> type="text" v-model="row[item.testitem_name]" @change="defectCountSun(row)">
<el-input-number <select v-if="item.testitem_field_type == 'select-text' && row.isEdit && item.canEdit"
v-if="item.testitem_field_type=='input-number'&&scope.row.isEdit&&item.canEdit" v-model="row[item.testitem_name]" @change="defectCountSun(row)">
v-model="scope.row[item.testitem_name]" <option v-for="item0 in item.testitem_choices" :key="item0" :value="item0">{{ item0 }}</option>
class="width-100" </select>
controls-position="right" </td>
@change="defectCountSun(scope.row)" <td class="w_80 inlineBlock padding_4 defectBlock" v-for="item in qct_defects" :key="item.id">
></el-input-number> <input type="checkbox" :disabled="!row.isEdit || !item.canEdit" v-model="row[item.defect_name]" @change="switchChange(row, item,index)">
<el-input-number </td>
v-if="item.testitem_field_type=='input-int'&&scope.row.isEdit&&item.canEdit" <td class="w_80 inlineBlock">
v-model="scope.row[item.testitem_name]" <input v-if="row.isEdit" v-model="row.note" placeholder="备注">
:min="0" <span v-else style="width: 100%;height: 100%;display: inline-block;">{{ row.note }}</span>
class="width-100" </td>
controls-position="right" <td class="w_180 inlineBlock" v-if="!isSubmit">
@change="defectCountSun(scope.row)" <button v-if="row.isEdit" type="button" class="btn btn_blue" @click="formTableSave(row,index)">保存</button>
></el-input-number> <button v-if="row.isEdit && row.id" type="button" class="btn btn_red" @click="formTableCancel(row,index)">取消</button>
<el-input <button v-if="row.isEdit && setForm.cd_req_addr !== null" type="button" class="btn btn_yellow" @click="getEqData(index)">重取数据</button>
v-if="item.testitem_field_type=='input-text'&&scope.row.isEdit&&item.canEdit" <button v-if="!row.isEdit" type="button" class="btn btn_blue" @click="formTableEdit(index)">编辑</button>
v-model="scope.row[item.testitem_name]" <button v-if="row.isEdit && !row.id" type="button" class="btn btn_red" @click="formTableDelet(row, index)">删除</button>
class="width-100" <button v-if="!row.isEdit" type="button" class="btn btn_red" @click="formTableDel(row.id,index)">删除</button>
@change="defectCountSun(scope.row)" </td>
></el-input> </tr>
<el-select </tbody>
v-if="item.testitem_field_type=='select-text'&&scope.row.isEdit&&item.canEdit" </table>
v-model="scope.row[item.testitem_name]"
clearable
class="width-100"
@change="defectCountSun(scope.row)"
>
<el-option
v-for="item0 in item.testitem_choices"
:key="item0"
:label="item0"
:value="item0"
></el-option>
</el-select>
<el-select
v-if="item.testitem_field_type=='selects-text'&&scope.row.isEdit&&item.canEdit"
v-model="scope.row[item.testitem_name]"
clearable
multiple
class="width-100"
@change="defectCountSun(scope.row)"
>
<el-option
v-for="item1 in item.testitem_choices"
:key="item1"
:label="item1"
:value="item1"
></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="note" :label="item.defect_name" v-for="item in qct_defects" :key="item.id" :width="widthFun(item)">
<template #default="scope">
<el-switch
:disabled="!scope.row.isEdit||!item.canEdit"
v-model="scope.row[item.defect_name]"
style="--el-switch-on-color: red"
@change="switchChange(scope.row, item)"
></el-switch>
</template>
</el-table-column>
<el-table-column prop="note" label="备注" width="80px">
<template #default="scope">
<span v-if="!scope.row.isEdit">{{ scope.row.note }}</span>
<el-input v-else v-model="scope.row.note" placeholder="备注"></el-input>
</template>
</el-table-column>
<el-table-column label="操作" width="160" align="center" fixed="right" v-if="!isSubmit">
<template #default="scope">
<el-button
v-if="scope.row.isEdit"
type="success"
@click="formTableSave(scope.row)"
>保存</el-button>
<el-button
v-if="scope.row.isEdit&&scope.row.id"
type="danger"
style="margin-left: 5px;"
@click="formTableCancel(scope.row)"
>取消</el-button>
<el-button
v-if="scope.row.isEdit&&setForm.cd_req_addr!=null"
type="warning"
style="margin-left: 5px;"
@click="getEqData(scope.$index)"
>重取数据</el-button>
<el-button
v-if="!scope.row.isEdit"
type="primary"
@click="formTableEdit(scope.$index)"
>编辑</el-button>
<el-button
v-if="scope.row.isEdit&&!scope.row.id"
type="danger"
style="margin-left: 5px;"
@click="formTableDelet(scope.row,scope.$index)"
>删除</el-button>
<el-button
v-if="!scope.row.isEdit"
type="danger"
style="margin-left: 5px;"
@click="formTableDel(scope.row.id)"
>删除</el-button>
</template>
</el-table-column>
</sc-form-table>
</el-main> </el-main>
</el-container> </el-container>
<el-dialog <el-dialog
@ -404,6 +321,7 @@ export default {
checkAll: false, checkAll: false,
hideAdd: false, hideAdd: false,
visible: false, visible: false,
isSaveing:false,
setVisible:false, setVisible:false,
multipleSet:false, multipleSet:false,
checkVisible:false, checkVisible:false,
@ -439,6 +357,7 @@ export default {
defectlists:[], defectlists:[],
testitemlists:[], testitemlists:[],
selectWprList:[], selectWprList:[],
selectedindexes:[],
qct_defects_origin:[], qct_defects_origin:[],
selectWpr:[], selectWpr:[],
tableHeight:500, tableHeight:500,
@ -467,37 +386,29 @@ export default {
that.tableHeight = document.getElementById('mlogbwMain').clientHeight-20; that.tableHeight = document.getElementById('mlogbwMain').clientHeight-20;
},500) },500)
that.route_code = that.$route.path.split("/")[2]; that.route_code = that.$route.path.split("/")[2];
// that.hideAdd = that.isSubmit;
that.currentDate = that.$TOOL.dateFormat2(new Date()); that.currentDate = that.$TOOL.dateFormat2(new Date());
}, },
methods: { methods: {
refreshfun(){ refreshfun(){
this.getList(); this.getList();
}, },
rowAdd(data){ check_add(){
let that = this; let that = this;
let years = that.year+''; that.addTemplate.mlogb__batch = that.mlogb__batch;
years = years.slice(2,4); that.addTemplate.isEdit = true;
let months = that.month<10?'0'+that.month:that.month; that.addTemplate.canEdit = true;
let num = data.number.slice(-4); that.mlogbwlist.unshift(Object.assign({},that.addTemplate));
num = Number(num)+1;
if(num<10){
num = "000"+num;
}else if(num<100){
num = "00"+num;
}else if(num<1000){
num = "0"+num;
}
if(that.mgroupName=='排一次棒'){
that.addTemplate.number = years+months+num;
}
if(that.mgroupName=='排板'){
that.addTemplate.number = years+ months + that.material_model+num;
}
}, },
selectChange(rows){ selectChange(){
let that = this; let that = this;
that.selectWprList = rows; that.selectWprList = [];
console.log('selectedindexes',that.selectedindexes);
that.mlogbwlist.forEach((item) => {
if(that.selectedindexes.indexOf(item.id)>-1){
that.selectWprList.push(item);
}
})
console.log('selectWprList',that.selectWprList);
}, },
selectAllChange(datas){ selectAllChange(datas){
let that = this; let that = this;
@ -616,6 +527,7 @@ export default {
} }
that.mlogbwlist.push(obj); that.mlogbwlist.push(obj);
}) })
// console.log('that.mlogbwlist',that.mlogbwlist);
} }
}) })
}, },
@ -709,7 +621,15 @@ export default {
if(that.mlogbwlist[index].work_start_time==''||that.mlogbwlist[index].work_start_time==null){ if(that.mlogbwlist[index].work_start_time==''||that.mlogbwlist[index].work_start_time==null){
that.mlogbwlist[index].work_start_time = that.$TOOL.dateFormat(date, 'yyyy-MM-dd hh:mm:ss'); that.mlogbwlist[index].work_start_time = that.$TOOL.dateFormat(date, 'yyyy-MM-dd hh:mm:ss');
} }
if(that.setForm.cd_req_addr!==null&&that.setForm.cd_req_addr!==""&&that.setForm.cd_req_addr!==undefined){ let getEd = false;
if(that.qct_testitems.length>0){
for(let i=0;i<that.qct_testitems.length;i++){
if(that.qct_testitems[i].cd_expr!=null){
getEd = true;
}
}
}
if(getEd&&that.setForm.cd_req_addr!==null&&that.setForm.cd_req_addr!==""&&that.setForm.cd_req_addr!==undefined){
that.getEqData(index); that.getEqData(index);
} }
}, },
@ -731,9 +651,8 @@ export default {
}); });
}).catch(() => {}); }).catch(() => {});
}, },
switchChange(row,item){ switchChange(row,item,index){
let that = this; let that = this;
let index = that.mlogbwlist.indexOf(row);
that.mlogbwlist[index][item.defect_name] = row[item.defect_name]; that.mlogbwlist[index][item.defect_name] = row[item.defect_name];
}, },
// //
@ -868,7 +787,7 @@ export default {
that.$refs.dialogForm.validate((valid) => { that.$refs.dialogForm.validate((valid) => {
if (valid) { if (valid) {
let obj = {}; let obj = {};
obj.mlogbw_ids = that.mlogbwlist.map(item => item.id); obj.mlogbw_ids = that.mlogbwlist.map(item => item.id).filter(id => id !== undefined && id !== null && id !== '');
obj.test_equip = that.form.equipment; obj.test_equip = that.form.equipment;
obj.test_user = that.form.test_user; obj.test_user = that.form.test_user;
obj.test_date = that.handle_date!=null?that.handle_date:that.currentDate; obj.test_date = that.handle_date!=null?that.handle_date:that.currentDate;
@ -892,7 +811,7 @@ export default {
that.qct_testitems = []; that.qct_testitems = [];
that.qct_testitems = that.testitemlists; that.qct_testitems = that.testitemlists;
that.tableHeight = document.getElementById('mlogbwMain').clientHeight-80; that.tableHeight = document.getElementById('mlogbwMain').clientHeight-80;
that.getList(); // that.getList();
}).catch(() => { }).catch(() => {
that.isSaveing = false; that.isSaveing = false;
}) })
@ -913,6 +832,7 @@ export default {
if(this.selectWprList.length>0){ if(this.selectWprList.length>0){
this.selectWpr = this.selectWprList; this.selectWpr = this.selectWprList;
} }
console.log('this.selectWpr',this.selectWpr);
this.setVisible=true; this.setVisible=true;
}, },
// //
@ -929,8 +849,15 @@ export default {
that.$nextTick(() => { that.$nextTick(() => {
that.$refs.mlogbwTable.setCurrentRows(obj); // that.$refs.mlogbwTable.setCurrentRows(obj); //
}) })
let getEd = false;
if(that.setForm.cd_req_addr!==null&&that.setForm.cd_req_addr!==""&&that.setForm.cd_req_addr!==undefined){ if(that.qct_testitems.length>0){
for(let i=0;i<that.qct_testitems.length;i++){
if(that.qct_testitems[i].cd_expr!=null){
getEd = true;
}
}
}
if(getEd&&that.setForm.cd_req_addr!==null&&that.setForm.cd_req_addr!==""&&that.setForm.cd_req_addr!==undefined){
//cd_req_addr, //cd_req_addr,
that.getEqData(0); that.getEqData(0);
} }
@ -1034,4 +961,79 @@ export default {
.width-100{ .width-100{
width: 100%; width: 100%;
} }
table {
border-collapse: collapse;
}
.tables,thead,tbody,tr {
width: max-content;
}
table {
border-top: 1px solid #ebeef5;
border-left: 1px solid #ebeef5;
}
td {
height: 25px;
text-align: left;
border-right: 1px solid #ebeef5;
border-bottom: 1px solid #ebeef5;
}
th{
height: 34px;
word-break: break-all;
border-right: 1px solid #ebeef5;
border-bottom: 1px solid #ebeef5;
/* background-color: #5ca969; */
}
input{
width: 100%;
height: 100%;
border: none;
padding: 0 2px;
}
.w_30{
width: 30px;
}
.w_80{
width: 80px;
}
.w_120{
width: 120px;
}
.w_140{
width: 140px;
}
.w_150{
width: 150px;
}
.w_180{
width: 180px;
}
.inlineBlock{
display: inline-block;
}
.padding_4{
padding: 4px; /* 添加内边距 */
}
.btn{
margin: 2px 2px;
border: none;
color: #ffffff;
font-size: 12px;
border-radius: 4px;
width: 55px;
height: 20px;
line-height: 20px;
}
.btn_red{
background: #ff0000;
}
.btn_blue{
background: #2965f2;
}
.btn_green{
background: #28b208;
}
.btn_yellow{
background: #f9db45;
}
</style> </style>