fix(线边物料库存差异调整):打印机可维护多个

This commit is contained in:
liaohechuan 2025-01-20 20:07:51 +08:00
parent 49e5e10559
commit 0e008b2934

View File

@ -14,7 +14,7 @@
<el-row>
<el-col :span="24">
<el-form-item label="库存条码" prop="inventoryId">
<el-input style="width: 200px" v-model.trim="searchForm.inventoryId" clearable @change="inventoryIdBlur" placeholder="请扫描或输入条码">
<el-input v-model.trim="searchForm.inventoryId" clearable @change="inventoryIdBlur" placeholder="请扫描或输入条码">
</el-input>
</el-form-item>
</el-col>
@ -26,6 +26,16 @@
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="打印机" prop="printer">
<el-select v-model="searchForm.printer" filterable :filter-method="filterMethod" @input="printerInput" :loading="printerLoading" clearable>
<el-option v-for="item in filteredOptions" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-table ref="inventoryDifferenceAdjustData" :data="searchForm.inventoryDifferenceAdjustData" tooltip-effect="dark" border height="500px" style="width: 100%;"
@selection-change="handleSelectionChange"
:row-key="'handle'"
@ -195,8 +205,12 @@ export default {
minValue: 0, // 最小值,这里是 0,只能输入正整数
selectedRows: [], // 选中行数据列表
storageLocationList: [], // 作业规则维护存储区域
printer: null, // 作业规则维护打印机
printerList: null, // 作业规则维护打印机
currentRow: null, // 记录列表当前行数据
selectPrinterName: [], // 打印机下拉原始列表
filteredOptions: [], // 打印机下拉筛选后的选项
searchQuery: '', // 打印机下拉用户输入的搜索内容
printerLoading: false, // 打印机下拉加载状态
}
},
created() {
@ -223,6 +237,27 @@ export default {
},
},
methods: {
// 防止清除掉时下拉内容没变
printerInput(query) {
this.filterMethod(query); // 手动触发 filterMethod
},
// 打印机下拉搜索变化触发
filterMethod(query) {
// 如果搜索内容为空,显示所有选项
if (!query) {
this.filteredOptions = this.selectPrinterName;
} else {
this.searchQuery = query;
this.printerLoading = true;
// 模拟网络请求,筛选出匹配的选项
setTimeout(() => {
this.filteredOptions = this.selectPrinterName.filter(item =>
item.label.toLowerCase().includes(query.toLowerCase())
);
this.printerLoading = false;
}, 300); // 假设 300ms 后数据返回
}
},
// 下料跳转初始化方法
init(inventoryIdList) {
let me = this
@ -283,13 +318,24 @@ export default {
if(optionList[i].optionName === 'STORAGE_LOCATION'){
that.searchForm.storageLocation = optionList[i].optionValue
that.storageLocationList = optionList[i].optionValue.split(";")
that.searchForm = Object.assign({}, that.searchForm)
}
// 打印机
if(optionList[i].optionName === 'PRINTER'){
that.printer = optionList[i].optionValue
that.printerList = optionList[i].optionValue.split(";")
that.printerList.forEach(item => {
const obj = {
label: item,
value: item
};
that.selectPrinterName.push(obj);
that.filteredOptions.push(obj);
})
if (that.printerList.length === 1) {
that.searchForm.printer = that.printerList[0];
}
}
}
that.searchForm = Object.assign({}, that.searchForm)
}).catch(e => {
hideLoading()
})
@ -390,8 +436,8 @@ export default {
},
// 标签打印
labelPrint() {
if (!this.printer) {
return this.$message.warning("请先在作业规则维护打印机[PRINTER]!");
if (!this.searchForm.printer) {
return this.$message.warning("请先选择打印机!");
} else if (this.selectedRows.length === 0) {
return this.$message.warning("请先勾选列表中需要打印的数据!");
} else {
@ -402,7 +448,7 @@ export default {
}).then(() => {
showLoading();
labelPrint({
printer: this.printer,
printer: this.searchForm.printer,
inventoryDifferenceAdjustDTOList: this.selectedRows
}).then((response) => {
hideLoading();