Commit 6b8d5b1a by wangzhihui

```

feat(cannibalize): 新增调出门店仓库组件参数并优化搜索逻辑

新增yqMerchantName参数传递给调出组件,修复搜索时应该基于原始数据列表进行过滤的问题,
同时在采购和拆机单模块中统一搜索逻辑实现。

BREAKING CHANGE: 调出组件需要传入yqMerchantName参数
```
1 parent 3bc7322f
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<div class="explain">说明:订单审核后自动流转至下一节点进行复审</div> <div class="explain">说明:订单审核后自动流转至下一节点进行复审</div>
</div> </div>
<!-- 先选仓库再选门店 --> <!-- 先选仓库再选门店 -->
<send-out-comp :isVisible="sendOutVisible" :isYq="isYq" v-if="sendOutVisible" @cancel="handleSendCancel" @submit="handleSendSumit" :sendOutMerchantId="isYq == 1?approveForm.callOutMerchantId:approveForm.callOutYqMerchantId" :yqMerchantId="approveForm.callOutYqMerchantId"></send-out-comp> <send-out-comp :isVisible="sendOutVisible" :isYq="isYq" v-if="sendOutVisible" @cancel="handleSendCancel" @submit="handleSendSumit" :sendOutMerchantId="isYq == 1?approveForm.callOutMerchantId:approveForm.callOutYqMerchantId" :yqMerchantId="approveForm.callOutYqMerchantId" :yqMerchantName="approveForm.callOutYqMerchantName"></send-out-comp>
</h-dialog> </h-dialog>
</template> </template>
......
...@@ -30,7 +30,7 @@ export default { ...@@ -30,7 +30,7 @@ export default {
components: { hDialog }, components: { hDialog },
data() { data() {
return { return {
isFlag:false, isFlag: false,
title: '调出门店仓库', title: '调出门店仓库',
keyword: '', keyword: '',
originalShippingEntityList: [], originalShippingEntityList: [],
...@@ -47,11 +47,15 @@ export default { ...@@ -47,11 +47,15 @@ export default {
type: String, type: String,
default: '' default: ''
}, },
isYq:{ isYq: {
type: Number, type: Number,
default: 1 default: 1
}, },
yqMerchantId:{ yqMerchantId: {
type: String,
default: ''
},
yqMerchantName: {
type: String, type: String,
default: '' default: ''
} }
...@@ -76,15 +80,14 @@ export default { ...@@ -76,15 +80,14 @@ export default {
debouncedSearch(val) debouncedSearch(val)
}, },
handleSearch(val) { handleSearch(val) {
// 如果搜索值为空,显示全部数据 // 如果搜索值为空,显示全部数据
if (!val || val.trim() === '') { if (!val || val.trim() === '') {
this.shippingEntityList = this.originalShippingEntityList || this.shippingEntityList this.shippingEntityList = this.originalShippingEntityList || this.shippingEntityList
return return
} }
// console.log()
// 进行模糊搜索,匹配 shippingEntity 字段 // 进行模糊搜索,匹配 shippingEntity 字段
const filteredList = this.shippingEntityList.filter(item => { const filteredList = this.originalShippingEntityList.filter(item => {
return item.merchantName.toLowerCase().includes(val.toLowerCase()) return item.merchantName.toLowerCase().includes(val.toLowerCase())
}) })
...@@ -95,24 +98,28 @@ export default { ...@@ -95,24 +98,28 @@ export default {
this.handleFindIdAttribute() this.handleFindIdAttribute()
} }
}, },
getMethodsByYq(){ getMethodsByYq() {
const methodMap = { const methodMap = {
1: 'selectServicemerchantList', 1: 'selectServicemerchantList',
2: 'selectYqMerchantList' 2: 'selectYqMerchantList'
} }
return methodMap[this.isYq] return methodMap[this.isYq]
}, },
async selectShippingEntityInfoAll() { async selectShippingEntityInfoAll() {
let methodName = this.getMethodsByYq() let methodName = this.getMethodsByYq()
let params = {} let params = {}
if(this.isYq ==1) params.yqMerchantId = this.yqMerchantId if (this.isYq == 1) params.yqMerchantId = this.yqMerchantId
let result = await allocateApi[methodName](params) let result = await allocateApi[methodName](params)
this.isFlag = true this.isFlag = true
if (result.code == 0) { if (result.code == 0) {
result.data.forEach(item => { result.data.forEach(item => {
item.checked = false item.checked = false
}) })
this.shippingEntityList = result.data this.shippingEntityList = result.data
let _headOffice = { merchantId: this.yqMerchantId, merchantName: this.yqMerchantName, checked: false }
if (this.isYq == 1) {
this.shippingEntityList.unshift(_headOffice)
}
this.originalShippingEntityList = [...this.shippingEntityList] this.originalShippingEntityList = [...this.shippingEntityList]
this.handleFindIdAttribute() this.handleFindIdAttribute()
} }
...@@ -123,7 +130,6 @@ export default { ...@@ -123,7 +130,6 @@ export default {
item.checked = false item.checked = false
}) })
this.shippingEntityList.forEach(item => { this.shippingEntityList.forEach(item => {
if (item[key] == this.selectSendOutMerchantId) { if (item[key] == this.selectSendOutMerchantId) {
item.checked = true item.checked = true
} }
...@@ -135,14 +141,14 @@ export default { ...@@ -135,14 +141,14 @@ export default {
item.checked = false item.checked = false
}) })
this.shippingEntityList[index].checked = true this.shippingEntityList[index].checked = true
this.selectSendOutMerchantId = this.shippingEntityList[index][key] this.selectSendOutMerchantId = this.shippingEntityList[index][key]
console.log(this.selectSendOutMerchantId) console.log(this.selectSendOutMerchantId)
}, },
handleSubmit() { handleSubmit() {
let key = this.isYq == 1 ? 'merchantId' : 'merchantNo' let key = this.isYq == 1 ? 'merchantId' : 'merchantNo'
let data = this.originalShippingEntityList.find(item => item[key] == this.selectSendOutMerchantId) || {} let data = this.originalShippingEntityList.find(item => item[key] == this.selectSendOutMerchantId) || {}
this.$emit('submit', {...data,isYq:this.isYq}) this.$emit('submit', { ...data, isYq: this.isYq })
// this.$refs.myDialog.stopLoading(); // this.$refs.myDialog.stopLoading();
}, },
handleCancel() { handleCancel() {
......
...@@ -74,7 +74,7 @@ export default { ...@@ -74,7 +74,7 @@ export default {
} }
// 进行模糊搜索,匹配 shippingEntity 字段 // 进行模糊搜索,匹配 shippingEntity 字段
const filteredList = this.shippingEntityList.filter(item => { const filteredList = this.originalShippingEntityList.filter(item => {
return item.shippingEntity.toLowerCase().includes(val.toLowerCase()) return item.shippingEntity.toLowerCase().includes(val.toLowerCase())
}) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!