修改物料搜索页面

This commit is contained in:
andy 2026-11-06 13:49:04 +08:00
parent 88b445daf3
commit 141f70dec1

View File

@ -63,6 +63,15 @@
<el-card class="select-card" shadow="never"> <el-card class="select-card" shadow="never">
<div class="select-row"> <div class="select-row">
<div style="margin-right: 1%; font-size: 15px; font-weight: bold;">
<el-checkbox v-model="useAutonomous" style="font-size: 15px; font-weight: bold;">自主查询</el-checkbox>
<el-tooltip class="item" effect="dark" placement="top-start">
<div slot="content">
<span style="color:#f56c6c;">勾选自主查询后,可自行输入查询格式统一的物料编码或物料名称</span>
</div>
<i class="el-icon-warning-outline"/>
</el-tooltip>
</div>
<label class="select-label">指定物料</label> <label class="select-label">指定物料</label>
<el-radio-group v-model="searchMode" size="mini" class="search-mode"> <el-radio-group v-model="searchMode" size="mini" class="search-mode">
<el-radio-button label="code">按编码</el-radio-button> <el-radio-button label="code">按编码</el-radio-button>
@ -74,6 +83,7 @@
filterable filterable
remote remote
reserve-keyword reserve-keyword
:allow-create="useAutonomous"
collapse-tags collapse-tags
:placeholder="searchMode === 'code' ? '可选:搜索并多选物料后查询库存' : '可选:按名称搜索并多选'" :placeholder="searchMode === 'code' ? '可选:搜索并多选物料后查询库存' : '可选:按名称搜索并多选'"
:remote-method="remoteSearchMaterial" :remote-method="remoteSearchMaterial"
@ -93,7 +103,7 @@
</el-button> </el-button>
<el-button icon="el-icon-refresh" size="mini" @click="clearSelection">清除指定</el-button> <el-button icon="el-icon-refresh" size="mini" @click="clearSelection">清除指定</el-button>
</div> </div>
<div v-if="selectedMaterials.length" class="selected-tags"> <div v-if="selectedMaterials.length && !useAutonomous" class="selected-tags">
<el-tag <el-tag
v-for="m in selectedMaterials" v-for="m in selectedMaterials"
:key="m.materialCode" :key="m.materialCode"
@ -206,6 +216,7 @@ export default {
}, },
materialLoading: false, materialLoading: false,
searchMode: 'code', searchMode: 'code',
useAutonomous:false,
selectedMaterials: [], selectedMaterials: [],
materialOptions: [], materialOptions: [],
/** 是否处于「指定物料查询」模式(无分页) */ /** 是否处于「指定物料查询」模式(无分页) */
@ -283,6 +294,7 @@ export default {
this.selectedMode = false; this.selectedMode = false;
this.loading = true; this.loading = true;
const reqSeq = ++this.inventoryReqSeq; const reqSeq = ++this.inventoryReqSeq;
this.queryParams.useAutonomous = this.useAutonomous
listMaterial_index(this.queryParams) listMaterial_index(this.queryParams)
.then(async (response) => { .then(async (response) => {
const rows = response.rows || []; const rows = response.rows || [];
@ -331,12 +343,18 @@ export default {
clearSelection() { clearSelection() {
this.selectedMaterials = []; this.selectedMaterials = [];
this.materialOptions = []; this.materialOptions = [];
this.queryParams.materialCode = ""
this.queryParams.materialName = ""
this.queryParams.pageNum = 0
this.getList(); this.getList();
}, },
/** 指定物料:一次批量查库存 */ /** 指定物料:一次批量查库存 */
async handleQueryInventory() { async handleQueryInventory() {
if (!this.selectedMaterials.length) { if (!this.selectedMaterials.length) {
this.$message.info("未指定物料,已按默认列表查询"); this.$message.info("未指定物料,已按默认列表查询");
this.queryParams.materialCode = ""
this.queryParams.materialName = ""
this.queryParams.pageNum = 0
this.getList(); this.getList();
return; return;
} }
@ -344,6 +362,17 @@ export default {
this.$message.warning("单次最多查询 50 个物料"); this.$message.warning("单次最多查询 50 个物料");
return; return;
} }
//使用自主查询
if(this.useAutonomous){
if(this.searchMode === 'code'){
this.queryParams.materialCode = this.selectedMaterials.join(',')
}else{
this.queryParams.materialName = this.selectedMaterials.join(',')
}
this.queryParams.pageNum = 0
this.getList();
return;
}
this.selectedMode = true; this.selectedMode = true;
const reqSeq = ++this.inventoryReqSeq; const reqSeq = ++this.inventoryReqSeq;
const codes = this.selectedMaterials.map(m => m.materialCode).filter(Boolean); const codes = this.selectedMaterials.map(m => m.materialCode).filter(Boolean);