Commit 991f13cd authored by xiejb's avatar xiejb

高级搜索 供应商实现多选功能

parent cca1925c
......@@ -90,8 +90,8 @@ export default {
},
// 供应商
supplier: {
type: Object,
default: () => {}
type: Array,
default: () => []
},
// 货主
consignor: {
......
......@@ -86,8 +86,8 @@ export default {
},
// 供应商
supplier: {
type: Object,
default: () => {}
type: Array,
default: () => []
},
customer: {
type: Object,
......
......@@ -218,7 +218,7 @@ export default {
getConsignorSetList(data).then(rt => {
if (rt.code === 200) {
if (_this.currentPage === 1) {
_this.searchNum = rt.data.total
_this.searchNum = rt.data.total + ''
this.postDataList = []
}
if (this.isRefreshing) {
......
......@@ -28,16 +28,16 @@
:error.sync="error"
:offset="10"
@load="onLoad">
<van-radio-group v-model="checked">
<van-checkbox-group v-model="checkedList">
<van-cell-group>
<van-cell :title="titleInitial(item)" clickable @click="itemClick(item,index)" v-for="(item,index) in postDataList"
:key="index">
<template #right-icon>
<van-radio :name="item.org" />
<van-checkbox :name="item.org" />
</template>
</van-cell>
</van-cell-group>
</van-radio-group>
</van-checkbox-group>
</van-list>
</van-pull-refresh>
</div>
......@@ -71,7 +71,8 @@ export default {
pageSize: 10,
postDataList: [],
checked: '',
choosedPost: {}
checkedList: [],
choosedPost: []
}
},
computed: {
......@@ -85,8 +86,8 @@ export default {
default: false
},
customer: {
type: Object,
default: () => {}
type: Array,
default: () => []
},
// 货主
consignor: {
......@@ -99,8 +100,13 @@ export default {
this.postShow = val
if (val) {
this.postDataList = []
this.checkedList = []
this.choosedPost = JSON.parse(JSON.stringify(this.customer))
this.checked = !this.customer.org ? '' : this.customer.org
// this.checked = !this.customer.comPartyId ? '' : this.customer.comPartyId
// console.log(this.checked)
this.customer.forEach((res)=>{
this.checkedList.push(res.org)
})
this.currentPage = 1
this.onLoad()
}
......@@ -135,10 +141,11 @@ export default {
},
onCancelClick() {
this.postShow = false
this.checkedList = []
this.$emit('cancleclick')
},
onConfirmClick() {
if (!this.choosedPost.org) {
if (!this.choosedPost.length === 0) {
Dialog.alert({
title: '温馨提示',
message: '请选择选项!'
......@@ -153,8 +160,15 @@ export default {
})
},
itemClick(item, index) {
this.checked = item.org
this.choosedPost = item
// this.checked = item.org
// this.choosedPost = item
if(this.checkedList.indexOf(item.org) > -1) {
this.choosedPost.splice(this.checkedList.indexOf(item.org),1)
this.checkedList.splice(this.checkedList.indexOf(item.org),1)
} else {
this.checkedList.push(item.org)
this.choosedPost.push(item)
}
},
onRefresh() {
// 刷新接口
......@@ -206,7 +220,7 @@ export default {
getEmployeeOrgQueryList(data).then(rt => {
if (rt.code === 200) {
if (_this.currentPage === 1) {
_this.searchNum = rt.data.length
_this.searchNum = rt.data.length + ''
this.postDataList = []
}
if (this.isRefreshing) {
......
......@@ -175,8 +175,13 @@ export default {
computed: {
// 供应商
supplier () {
// if (this.moreSearchInfo.supplier) {
// return !this.moreSearchInfo.supplier ? '' : this.moreSearchInfo.supplier.partyName
// } else {
// return ''
// }
if (this.moreSearchInfo.supplier) {
return !this.moreSearchInfo.supplier ? '' : this.moreSearchInfo.supplier.partyName
return this.supplierStitching()
} else {
return ''
}
......@@ -220,7 +225,7 @@ export default {
},
// 货主与供应商是否选择
isSelectConsignorSupplier () {
if (this.moreSearchInfo.consignor.length === 0 || this.moreSearchInfo.supplier.org === {} || this.moreSearchInfo.supplier.org === null || this.moreSearchInfo.supplier.org === undefined) {
if (this.moreSearchInfo.consignor.length === 0 || this.moreSearchInfo.supplier.length === 0) {
return false
}
return true
......@@ -239,7 +244,7 @@ export default {
type: Object,
default: () => {
return {
supplier: {}, // 供应商
supplier: [], // 供应商
consignor: [], // 货主
goods: '', // 商品
client: '', // 客户
......@@ -270,17 +275,21 @@ export default {
this.$toast('请先选择货主!')
return
}
if (this.moreSearchInfo.supplier.org === '' || this.moreSearchInfo.supplier.org === null || this.moreSearchInfo.supplier.org === undefined) {
if (this.moreSearchInfo.supplier.length === 0) {
this.$toast('请先供应商!')
return
}
// if (this.moreSearchInfo.supplier.org === '' || this.moreSearchInfo.supplier.org === null || this.moreSearchInfo.supplier.org === undefined) {
// this.$toast('请先供应商!')
// return
// }
// console.log(this.moreSearchInfo)
this.moreSearchShow = false
this.$emit('onsearch', this.moreSearchInfo)
},
onCleanClick() {
this.moreSearchInfo = {
supplier: {}, // 供应商
supplier: [], // 供应商
consignor: [], // 货主
goods: '', // 商品
client: '', // 客户
......@@ -303,7 +312,11 @@ export default {
return
}
if (type !== 'supplier') {
if (this.moreSearchInfo.supplier.org === '' || this.moreSearchInfo.supplier.org === null || this.moreSearchInfo.supplier.org === undefined) {
// if (this.moreSearchInfo.supplier.org === '' || this.moreSearchInfo.supplier.org === null || this.moreSearchInfo.supplier.org === undefined) {
// this.$toast('请先供应商!')
// return
// }
if (this.moreSearchInfo.supplier.length === 0 ) {
this.$toast('请先供应商!')
return
}
......@@ -338,7 +351,7 @@ export default {
this.moreSearchInfo.goods = data.value
break;
case data.page === 'consignor':
this.moreSearchInfo.supplier = {}
this.moreSearchInfo.supplier = []
this.moreSearchInfo.goods = ''
this.moreSearchInfo.client = ''
this.moreSearchInfo.consignor = data.value
......@@ -349,7 +362,7 @@ export default {
}
this.showPost(data.page);
},
// 字段拼接
// 货主字段拼接
fieldStitching() {
let str = ''
if (this.moreSearchInfo.consignor.length === 1) {
......@@ -359,10 +372,24 @@ export default {
}
return str
},
// 商品信息拼接
// 货主信息拼接
consignorInfoStitching(model) {
return model.companyname + '/(' + model.erp_userid[0] + ')'
// return model.comGoodsId + '/(' + model.goodsOpcode + ')' + model.goodsName + '/' + model.goodsDesc + '/' + model.partyName + '/' + model.packageNum + '/' + model.unitName
},
// 供应商字段拼接
supplierStitching() {
let str = ''
console.log(this.moreSearchInfo)
if (this.moreSearchInfo.supplier.length === 1) {
str = this.supplierInfoStitching(this.moreSearchInfo.supplier[0])
} else if (this.moreSearchInfo.supplier.length > 1) {
str = this.supplierInfoStitching(this.moreSearchInfo.supplier[0]) + '......'
}
return str
},
// 货主信息拼接
supplierInfoStitching(model) {
return model.partyName
},
onQuickDateChoose(index, tag) {
console.log(index,tag)
......
......@@ -53,7 +53,7 @@ export default {
moreSearchShow: false,
activeTab: 'all',
moreSearchInfo: {
supplier: {}, // 供应商
supplier: [], // 供应商
consignor: [], // 货主
goods: '', // 商品
client: '', // 客户
......
......@@ -276,19 +276,28 @@ export default {
'sourceDb': !item.ownerid ? '':item.ownerid, // 数据来源
'sourceOrderNo': '', // 来源订单号(网上订单号)
'sourceSystem': '', // 订单来源 来源订单号和订单来源必须同时不为空
'supplierId': this.getArray(_this.moreSearchInfo.supplier.org) // 供应商(部门)编码
'supplierId': this.getValueArray(_this.moreSearchInfo.supplier) // 供应商(部门)编码
}
dataList.push(model)
})
console.log(dataList)
return dataList
},
// 是否返回空数组
getArray (value) {
if (this.isJudgeStrNull(value)) {
return [value]
}
return []
},
// 返回数据数组
getValueArray (array) {
const vaueArray = []
array.forEach(item => {
vaueArray.push(item.org)
})
return vaueArray
},
/// 判断数值是否为空
isJudgeStrNull(val) {
if (val !== null && val !== undefined && val !== '') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment