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: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;}
.card-header {
display: flex;

View File

@ -217,6 +217,7 @@
stripe
:params="paramsIn"
hidePagination
hideDo
>
<el-table-column type="index" width="50" />
<el-table-column

View File

@ -17,148 +17,65 @@
</div>
</el-header>
<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-input v-if="multipleSet" v-model="wprInputText" @change="wprinputChange" style="width:200px;position: relative;left: 308px;"></el-input>
<sc-form-table
hideDelete
ref="mlogbwTable"
id="mlogbwlist"
v-model="mlogbwlist"
placeholder="暂无数据"
:hideAdd="hideAdd"
:addTemplate="addTemplate"
:tableHeight="tableHeight"
:canMultiple = "canMultiple"
:pushType="pushType"
row-key="id"
@selectChange="selectChange"
@selectAllChange="selectAllChange"
@add="rowAdd"
>
<el-table-column prop="mlogb__batch" label="物料批次" fixed min-width="160px">
<template #default="scope">
<el-input v-if="scope.row.isEdit" v-model="scope.row.mlogb__batch" placeholder="物料编号"></el-input>
<span v-else>{{ scope.row.mlogb__batch }}</span>
</template>
</el-table-column>
<el-table-column prop="number" label="物料编号" fixed min-width="160px">
<template #default="scope">
<el-input v-if="scope.row.isEdit" v-model="scope.row.number" placeholder="物料编号"></el-input>
<span v-else>{{ scope.row.number }}</span>
<span v-if="scope.row.wpr_number_out!==null&&scope.row.wpr_number_out!==undefined">{{ scope.row.wpr_number_out }}</span>
</template>
</el-table-column>
<el-table-column prop="note" :label="item.testitem_name" v-for="item in qct_testitems" :key="item.id" width="150px">
<template #default="scope">
<span v-if="!scope.row.isEdit||!item.canEdit">{{ scope.row[item.testitem_name] }}</span>
<el-input-number
v-if="item.testitem_field_type=='input-number'&&scope.row.isEdit&&item.canEdit"
v-model="scope.row[item.testitem_name]"
class="width-100"
controls-position="right"
@change="defectCountSun(scope.row)"
></el-input-number>
<el-input-number
v-if="item.testitem_field_type=='input-int'&&scope.row.isEdit&&item.canEdit"
v-model="scope.row[item.testitem_name]"
:min="0"
class="width-100"
controls-position="right"
@change="defectCountSun(scope.row)"
></el-input-number>
<el-input
v-if="item.testitem_field_type=='input-text'&&scope.row.isEdit&&item.canEdit"
v-model="scope.row[item.testitem_name]"
class="width-100"
@change="defectCountSun(scope.row)"
></el-input>
<el-select
v-if="item.testitem_field_type=='select-text'&&scope.row.isEdit&&item.canEdit"
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>
<table id="mlogbwlist" class="tables">
<thead>
<tr>
<th class="w_30 inlineBlock"></th>
<th class="w_140 inlineBlock">物料批次</th>
<th class="w_140 inlineBlock">物料编号</th>
<th class="w_80 inlineBlock" v-for="item in qct_testitems" :key="item.id">{{ item.testitem_name }}</th>
<th class="w_80 inlineBlock" v-for="item in qct_defects" :key="item.id">{{ item.defect_name }}</th>
<th class="w_80 inlineBlock">备注</th>
<th class="w_180 inlineBlock" v-if="!isSubmit">操作</th>
</tr>
</thead>
<tbody>
<tr v-for="(row, index) in mlogbwlist" :key="row.id">
<td class="w_30 inlineBlock padding_4">
<input type="checkbox" v-model="selectedindexes" :value="row.id" @change="selectChange">
</td>
<td class="w_140 inlineBlock">
<input v-if="row.isEdit" v-model="row.mlogb__batch" placeholder="物料批次">
<span v-else>{{ row.mlogb__batch }}</span>
</td>
<td class="w_140 inlineBlock">
<input v-if="row.isEdit" v-model="row.number" placeholder="物料编号">
<span v-else>{{ row.number }}</span>
<span v-if="row.wpr_number_out !== null && row.wpr_number_out !== undefined">{{ row.wpr_number_out }}</span>
</td>
<td class="w_80 inlineBlock" v-for="item in qct_testitems" :key="item.id">
<span v-if="!row.isEdit || !item.canEdit">{{ row[item.testitem_name] }}</span>
<input v-if="item.testitem_field_type == 'input-number' && row.isEdit && item.canEdit"
type="number" v-model="row[item.testitem_name]" @change="defectCountSun(row)">
<input v-if="item.testitem_field_type == 'input-text' && row.isEdit && item.canEdit"
type="text" v-model="row[item.testitem_name]" @change="defectCountSun(row)">
<select v-if="item.testitem_field_type == 'select-text' && row.isEdit && item.canEdit"
v-model="row[item.testitem_name]" @change="defectCountSun(row)">
<option v-for="item0 in item.testitem_choices" :key="item0" :value="item0">{{ item0 }}</option>
</select>
</td>
<td class="w_80 inlineBlock padding_4 defectBlock" v-for="item in qct_defects" :key="item.id">
<input type="checkbox" :disabled="!row.isEdit || !item.canEdit" v-model="row[item.defect_name]" @change="switchChange(row, item,index)">
</td>
<td class="w_80 inlineBlock">
<input v-if="row.isEdit" v-model="row.note" placeholder="备注">
<span v-else style="width: 100%;height: 100%;display: inline-block;">{{ row.note }}</span>
</td>
<td class="w_180 inlineBlock" v-if="!isSubmit">
<button v-if="row.isEdit" type="button" class="btn btn_blue" @click="formTableSave(row,index)">保存</button>
<button v-if="row.isEdit && row.id" type="button" class="btn btn_red" @click="formTableCancel(row,index)">取消</button>
<button v-if="row.isEdit && setForm.cd_req_addr !== null" type="button" class="btn btn_yellow" @click="getEqData(index)">重取数据</button>
<button v-if="!row.isEdit" type="button" class="btn btn_blue" @click="formTableEdit(index)">编辑</button>
<button v-if="row.isEdit && !row.id" type="button" class="btn btn_red" @click="formTableDelet(row, index)">删除</button>
<button v-if="!row.isEdit" type="button" class="btn btn_red" @click="formTableDel(row.id,index)">删除</button>
</td>
</tr>
</tbody>
</table>
</el-main>
</el-container>
<el-dialog
@ -404,6 +321,7 @@ export default {
checkAll: false,
hideAdd: false,
visible: false,
isSaveing:false,
setVisible:false,
multipleSet:false,
checkVisible:false,
@ -439,6 +357,7 @@ export default {
defectlists:[],
testitemlists:[],
selectWprList:[],
selectedindexes:[],
qct_defects_origin:[],
selectWpr:[],
tableHeight:500,
@ -467,37 +386,29 @@ export default {
that.tableHeight = document.getElementById('mlogbwMain').clientHeight-20;
},500)
that.route_code = that.$route.path.split("/")[2];
// that.hideAdd = that.isSubmit;
that.currentDate = that.$TOOL.dateFormat2(new Date());
},
methods: {
refreshfun(){
this.getList();
},
rowAdd(data){
check_add(){
let that = this;
let years = that.year+'';
years = years.slice(2,4);
let months = that.month<10?'0'+that.month:that.month;
let num = data.number.slice(-4);
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;
}
that.addTemplate.mlogb__batch = that.mlogb__batch;
that.addTemplate.isEdit = true;
that.addTemplate.canEdit = true;
that.mlogbwlist.unshift(Object.assign({},that.addTemplate));
},
selectChange(rows){
selectChange(){
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){
let that = this;
@ -616,6 +527,7 @@ export default {
}
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){
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);
}
},
@ -731,9 +651,8 @@ export default {
});
}).catch(() => {});
},
switchChange(row,item){
switchChange(row,item,index){
let that = this;
let index = that.mlogbwlist.indexOf(row);
that.mlogbwlist[index][item.defect_name] = row[item.defect_name];
},
//
@ -868,7 +787,7 @@ export default {
that.$refs.dialogForm.validate((valid) => {
if (valid) {
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_user = that.form.test_user;
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.testitemlists;
that.tableHeight = document.getElementById('mlogbwMain').clientHeight-80;
that.getList();
// that.getList();
}).catch(() => {
that.isSaveing = false;
})
@ -913,6 +832,7 @@ export default {
if(this.selectWprList.length>0){
this.selectWpr = this.selectWprList;
}
console.log('this.selectWpr',this.selectWpr);
this.setVisible=true;
},
//
@ -929,8 +849,15 @@ export default {
that.$nextTick(() => {
that.$refs.mlogbwTable.setCurrentRows(obj); //
})
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){
//cd_req_addr,
that.getEqData(0);
}
@ -1034,4 +961,79 @@ export default {
.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>