Commit 991f13cd authored by xiejb's avatar xiejb

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

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