优化商品选择的仓库传值逻辑

This commit is contained in:
季圣华
2021-12-24 00:12:23 +08:00
parent 56d8218ac4
commit d537d25907

View File

@@ -30,7 +30,7 @@
</a-col> </a-col>
<a-col :md="6" :sm="8"> <a-col :md="6" :sm="8">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="仓库"> <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="仓库">
<a-select placeholder="选择仓库" v-model="queryParam.depotId" <a-select placeholder="选择仓库" v-model="queryParam.depotId" @change="onDepotChange"
:dropdownMatchSelectWidth="false" showSearch optionFilterProp="children" allow-clear> :dropdownMatchSelectWidth="false" showSearch optionFilterProp="children" allow-clear>
<a-select-option v-for="(item,index) in depotList" :key="index" :value="item.id"> <a-select-option v-for="(item,index) in depotList" :key="index" :value="item.id">
{{ item.depotName }} {{ item.depotName }}
@@ -166,7 +166,6 @@
this.resetScreenSize() this.resetScreenSize()
this.loadTreeData() this.loadTreeData()
this.getDepotList() this.getDepotList()
this.loadData()
}, },
methods: { methods: {
initBarCode() { initBarCode() {
@@ -226,6 +225,7 @@
this.title = '选择商品' this.title = '选择商品'
this.queryParam.q = barCode this.queryParam.q = barCode
this.$nextTick(() => this.$refs.material.focus()); this.$nextTick(() => this.$refs.material.focus());
this.initDepotSelect()
this.loadData(); this.loadData();
this.form.resetFields(); this.form.resetFields();
}, },
@@ -289,7 +289,6 @@
getAction('/depot/findDepotByCurrentUser').then((res) => { getAction('/depot/findDepotByCurrentUser').then((res) => {
if(res.code === 200){ if(res.code === 200){
that.depotList = res.data that.depotList = res.data
this.initDepotSelect()
} }
}) })
}, },
@@ -300,6 +299,9 @@
} }
} }
}, },
onDepotChange(value) {
this.queryParam.depotId = value
},
onSelectChange(selectedRowKeys, selectionRows) { onSelectChange(selectedRowKeys, selectionRows) {
this.selectedRowKeys = selectedRowKeys; this.selectedRowKeys = selectedRowKeys;
this.selectionRows = selectionRows; this.selectionRows = selectionRows;