k94314517
2024-06-28 ecbdab9da9488cc58a1ac7064f9cffde4792fba4
h5/pages/staff/vehicle/applePeo.vue
@@ -35,7 +35,7 @@
        <image
          @click="changeMem(item, index)"
          v-if="item.checked"
          src="@/static/meeting/icon/ic_choose_sel@2x.png"
          src="@/static/checkbox_sel@2x.png"
          mode="widthFix"
          class="checked"
        ></image>
@@ -113,43 +113,66 @@
      param: {},
      selList: [],
      isShowSelMem: false
      isShowSelMem: false,
      pagination: {
        capacity: 20,
        page: 1
      },
    }
  },
  onLoad() {
    this.initData()
  },
  onReachBottom() {
    // if(){}
  },
  mounted() {
    this.$eventBus.$on('applePeoDetail', (res)=>{
    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) {
      // this.memberList.forEach(mem => {
      //   if(item.id === mem.id){
      //     item.checked = !item.checked
      //   }
      // })
      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
      //     }
      //   })
      //   return obj
      // })
      // this.selList = arrTemp
      this.$forceUpdate()
    },
    handleRemove(item) {
@@ -161,18 +184,6 @@
      // 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>
@@ -188,7 +199,7 @@
      font-weight: 600;
    }
    .btn {
      color: #279baa;
      color: $uni-color-primary;
    }
  }
  .modal_mem_list {
@@ -245,7 +256,7 @@
    align-items: center;
    .members {
      width: 500rpx;
      color: #4d98a7;
      color: $uni-color-primary;
      white-space: nowrap;
      overflow: hidden; //文本超出隐藏
      text-overflow: ellipsis;
@@ -260,7 +271,7 @@
    width: 690rpx;
    height: 88rpx;
    line-height: 88rpx;
    background: #279baa;
    background: $uni-color-primary;
    border-radius: 44rpx;
    color: #fff;
    text-align: center;
@@ -302,7 +313,7 @@
        }
      }
    }
    .checked{
    .checked {
      width: 48rpx;
    }
  }