Commit 29f61456 authored by xiejb's avatar xiejb

货主多选功能

parent 393da7d7
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
:error.sync="error" :error.sync="error"
:offset="10" :offset="10"
@load="onLoad"> @load="onLoad">
<van-radio-group v-model="checked"> <!-- <van-radio-group v-model="checked">
<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">
...@@ -37,7 +37,17 @@ ...@@ -37,7 +37,17 @@
</template> </template>
</van-cell> </van-cell>
</van-cell-group> </van-cell-group>
</van-radio-group> </van-radio-group> -->
<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-checkbox :name="item.comPartyId" />
</template>
</van-cell>
</van-cell-group>
</van-checkbox-group>
</van-list> </van-list>
</van-pull-refresh> </van-pull-refresh>
</div> </div>
...@@ -71,7 +81,8 @@ export default { ...@@ -71,7 +81,8 @@ export default {
pageSize: 10, pageSize: 10,
postDataList: [], postDataList: [],
checked: '', checked: '',
choosedPost: {} checkedList: [],
choosedPost: []
} }
}, },
computed: { computed: {
...@@ -85,8 +96,8 @@ export default { ...@@ -85,8 +96,8 @@ export default {
default: false default: false
}, },
customer: { customer: {
type: Object, type: Array,
default: () => {} default: () => []
}, },
chinfo: { chinfo: {
type: Object, type: Object,
...@@ -103,11 +114,15 @@ export default { ...@@ -103,11 +114,15 @@ 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.comPartyId ? '' : this.customer.comPartyId // this.checked = !this.customer.comPartyId ? '' : this.customer.comPartyId
console.log(this.checked) // console.log(this.checked)
this.customer.forEach((res)=>{
this.checkedList.push(res.comPartyId)
})
this.currentPage = 1 this.currentPage = 1
this.onLoad() this.onRefresh()
} }
}, },
postShow (val) { postShow (val) {
...@@ -140,10 +155,11 @@ export default { ...@@ -140,10 +155,11 @@ export default {
}, },
onCancelClick() { onCancelClick() {
this.postShow = false this.postShow = false
this.checkedList = []
this.$emit('cancleclick') this.$emit('cancleclick')
}, },
onConfirmClick() { onConfirmClick() {
if (!this.choosedPost.comPartyId) { if (this.choosedPost.length === 0) {
Dialog.alert({ Dialog.alert({
title: '温馨提示', title: '温馨提示',
message: '请选择选项!' message: '请选择选项!'
...@@ -158,8 +174,15 @@ export default { ...@@ -158,8 +174,15 @@ export default {
}) })
}, },
itemClick(item, index) { itemClick(item, index) {
this.checked = item.comPartyId // this.checked = item.comPartyId
this.choosedPost = item // this.choosedPost = item
if(this.checkedList.indexOf(item.comPartyId) > -1) {
this.choosedPost.splice(this.checkedList.indexOf(item.comPartyId),1)
this.checkedList.splice(this.checkedList.indexOf(item.comPartyId),1)
} else {
this.checkedList.push(item.comPartyId)
this.choosedPost.push(item)
}
}, },
onRefresh() { onRefresh() {
// 刷新接口 // 刷新接口
......
...@@ -133,7 +133,7 @@ export default { ...@@ -133,7 +133,7 @@ export default {
}, },
moreSearchInfo: { moreSearchInfo: {
supplier: '', // 供应商 supplier: '', // 供应商
consignor: '', // 货主 consignor: [], // 货主
goods: '', // 商品 goods: '', // 商品
client: '', // 客户 client: '', // 客户
orderNo: '', // 订单号 orderNo: '', // 订单号
...@@ -159,8 +159,13 @@ export default { ...@@ -159,8 +159,13 @@ export default {
}, },
// 货主 // 货主
consignor () { consignor () {
if (this.moreSearchInfo.consignor.comPartyId) { // if (this.moreSearchInfo.consignor.comPartyId) {
return !this.moreSearchInfo.consignor ? '' : (this.moreSearchInfo.consignor.comPartyId + '/(' + this.moreSearchInfo.consignor.partyOpcode + ')' + this.moreSearchInfo.consignor.partyName) // return !this.moreSearchInfo.consignor ? '' : (this.moreSearchInfo.consignor.comPartyId + '/(' + this.moreSearchInfo.consignor.partyOpcode + ')' + this.moreSearchInfo.consignor.partyName)
// } else {
// return ''
// }
if (this.moreSearchInfo.consignor) {
return this.fieldStitching()
} else { } else {
return '' return ''
} }
...@@ -271,6 +276,20 @@ export default { ...@@ -271,6 +276,20 @@ export default {
} }
this.showPost(data.page); this.showPost(data.page);
}, },
// 字段拼接
fieldStitching() {
let str = ''
if (this.moreSearchInfo.consignor.length === 1) {
str = this.goodsInfoStitching(this.moreSearchInfo.consignor[0])
} else if (this.moreSearchInfo.consignor.length > 1) {
str = this.goodsInfoStitching(this.moreSearchInfo.consignor[0]) + '......'
}
return str
},
// 商品信息拼接
goodsInfoStitching(model) {
return model.comPartyId + '/(' + model.partyOpcode + ')/' + model.partyName
}
} }
} }
</script> </script>
......
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