feat:玻纤板未完成段列表搜索前置并选中,添加批量喷码

This commit is contained in:
shijing 2026-05-14 14:38:57 +08:00
parent fcb7474f17
commit ac45b9726a
1 changed files with 30 additions and 11 deletions

View File

@ -9,11 +9,17 @@
<h4>关联产品</h4>
<el-button v-if="mode=='out'" type="primary" @click="wprNumberChange">发货编号</el-button>
<el-button v-if="mode=='out'" type="warning" @click="wprNumberClear">清空编号</el-button>
<el-button
type="warning"
:disabled="selectedRows.length === 0"
@click="batchSendToCoder"
>批量喷码</el-button>
<el-input
style="margin-right: 5px;width: 200px;"
v-model="search"
placeholder="编号"
clearable
@keyup.enter="handleWprQuery"
></el-input>
<el-button
type="primary"
@ -22,7 +28,9 @@
></el-button>
</template>
<template #default>
<el-table ref="wprTable" id="wprTable" :data="wprList" :height="wprTableHeight" border highlight-current-row>
<el-table ref="wprTable" id="wprTable" :data="wprList" :height="wprTableHeight" border highlight-current-row @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50"></el-table-column>
<el-table-column label="序号" type="index" width="50"></el-table-column>
<el-table-column label="产品编号" prop="number" min-width="100px" ></el-table-column>
<el-table-column label="对外编号" prop="number_out" min-width="100px"
v-if="mgroupName=='成品内外初检'||mgroupName=='成品内质复检'||mgroupName=='成品性能检测'||mgroupName=='成品尺寸检测'||mgroupName=='成品外观复检一'||mgroupName=='成品外观复检二'"
@ -120,6 +128,7 @@ export default {
wmtype:'',
scQr_code:'',
wprList:[],
selectedRows:[],
digitNum:3,
wprTableHeight:500,
printer_name:localStorage.getItem("printer_name"),
@ -242,15 +251,16 @@ export default {
},
handleWprQuery(){
let that = this;
that.wprList.forEach((item,index)=>{
if(item.number.indexOf(that.search) > -1){
that.$refs.wprTable.setCurrentRow(item);
let rows = document.querySelectorAll("#wprTable .el-table__row");
let row = rows[index];
let rowTop = row.offsetTop;
that.$refs.wprTable.scrollTo({ top: rowTop });
}
})
let foundIndex = that.wprList.findIndex(item => item.number.indexOf(that.search) > -1);
if(foundIndex > -1){
let found = that.wprList.splice(foundIndex, 1)[0];
that.wprList.unshift(found);
that.$nextTick(() => {
that.$refs.wprTable.setCurrentRow(that.wprList[0]);
that.$refs.wprTable.toggleRowSelection(that.wprList[0], true);
that.$refs.wprTable.scrollTo({ top: 0 });
});
}
},
//
printMaterial(row){
@ -350,7 +360,7 @@ that.$API.wpm.prints.req(printer_ip, obj).then((response) => {
delete map[row.id];
that.coderLoadingIds = map;
};
that.$API.cm.labeltemplate.list.req({search: templateName, page: 0}).then((res) => {
that.$API.cm.labeltemplate.list.req({name: templateName, page: 0}).then((res) => {
let list = Array.isArray(res) ? res : (res && res.results) || [];
let template = list.find(t => t.name === templateName);
if (!template) {
@ -368,6 +378,15 @@ that.$API.wpm.prints.req(printer_ip, obj).then((response) => {
}).finally(release);
}).catch(release);
},
handleSelectionChange(rows){
this.selectedRows = rows;
},
batchSendToCoder(){
let that = this;
that.selectedRows.forEach(row => {
that.sendToCoder(row);
});
},
//
handleSaveSuccess() {
this.$refs.tables.refresh();