| | |
| | | param: {}, |
| | | selList: [], |
| | | |
| | | isShowSelMem: false |
| | | isShowSelMem: false, |
| | | pagination: { |
| | | capacity: 20, |
| | | page: 1 |
| | | }, |
| | | } |
| | | }, |
| | | onLoad() { |
| | | this.initData() |
| | | }, |
| | | onReachBottom() { |
| | | // if(){} |
| | | }, |
| | | mounted() { |
| | | this.$eventBus.$on('applePeoDetail', (res)=>{ |
| | | res.forEach(item => { |
| | | this.changeMem(item) |
| | | this.memberList.forEach(mem => { |
| | | if (item.id === mem.id) { |
| | | mem.checked = !mem.checked |
| | | } |
| | | }) |
| | | this.$nextnick(() => { |
| | | }) |
| | | this.selList = this.memberList.filter(i => i.checked) |
| | | this.$nextTick(() => { |
| | | this.$forceUpdate() |
| | | }) |
| | | }) |
| | | }, |
| | | methods: { |
| | | initData() { |
| | | const { param, pagination } = this |
| | | findTypeMemberInfo({ |
| | | // model: { |
| | | name: param.name, |
| | | // }, |
| | | type: '2', |
| | | ...pagination |
| | | }).then(res => { |
| | | this.memberList = res.data || [] |
| | | this.memberList.forEach(i => { |
| | | i.checked = false |
| | | }) |
| | | }) |
| | | }, |
| | | onSubmit() { |
| | | if (this.selList.length === 0) return uni.showToast({ |
| | | title: '请先选择人员', |
| | | icon: 'none' |
| | | }) |
| | | this.$eventBus.$emit('applePeo', this.selList) |
| | | uni.navigateBack() |
| | | }, |
| | | changeMem(item, index) { |
| | | item.checked = !item.checked |
| | | this.selList = this.memberList.filter(i => i.checked) |
| | | // const arr = e.detail.value |
| | | // let arrTemp = arr.map(item => { |
| | | // let obj = {} |
| | | // this.memberList.forEach(ite => { |
| | | // if (item == ite.id) { |
| | | // obj.name = ite.name.split('-')[0] |
| | | // obj.componey = ite.name.split('-')[1] || '' |
| | | // obj.id = ite.id |
| | | // this.memberList.forEach(mem => { |
| | | // if(item.id === mem.id){ |
| | | // item.checked = !item.checked |
| | | // } |
| | | // }) |
| | | // return obj |
| | | // }) |
| | | // this.selList = arrTemp |
| | | item.checked = !item.checked |
| | | this.selList = this.memberList.filter(i => i.checked) |
| | | this.$forceUpdate() |
| | | }, |
| | | handleRemove(item) { |
| | |
| | | // console.log(this.memberList); |
| | | this.$forceUpdate() |
| | | }, |
| | | initData() { |
| | | const { param } = this |
| | | findTypeMemberInfo({ |
| | | name: param.name, |
| | | type: '2' |
| | | }).then(res => { |
| | | this.memberList = res.data || [] |
| | | this.memberList.forEach(i => { |
| | | i.checked = false |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | }; |
| | | </script> |