xiangpei
2025-01-02 23fdfa68682eef52fee5a8d257c002cdd375a563
src/components/flow/User/SingleUser.vue
@@ -96,7 +96,6 @@
    },
    // 回显数据传值
    selectUser: {
      type: Number,
      default: null,
      required: false
    },
@@ -160,18 +159,40 @@
    selectUser: {
      deep: true,
      handler(newVal) {
        console.log(this.selectValues, "传入的值是")
        this.$nextTick(() => {
          this.$refs.dataTable.clearSelection();
        if (newVal) {
          this.$nextTick(() => {
            this.$refs.dataTable.clearSelection();
            this.userList.forEach(item => {
              if (newVal === item.userId) {
                this.innerSelected = item
                this.$refs.dataTable.toggleRowSelection(item)
              }
            })
        });
          });
        } else {
          this.innerSelected = null;
        }
      },
      // immediate: true
    },
    userLst: {
      deep: true,
      handler(newVal) {
        if (newVal) {
          this.$nextTick(() => {
            this.$refs.dataTable.clearSelection();
            if (! this.innerSelected) {
              newVal.forEach(item => {
                if (this.innerSelected.userId === item.userId) {
                  this.innerSelected = item
                  this.$refs.dataTable.toggleRowSelection(item)
                }
              })
            }
          });
        } else {
          this.innerSelected = null;
        }
      },
    },
  },
  mounted() {
@@ -180,15 +201,19 @@
  },
  methods: {
    setChecked(val) {
      if (val) {
        this.$nextTick(() => {
          this.$refs.dataTable.clearSelection();
            this.userList.forEach(item => {
              if (val === item.userId) {
                this.innerSelected = item
                this.$refs.dataTable.toggleRowSelection(item)
              }
            })
          this.userList.forEach(item => {
            if (val.userId === item.userId) {
              this.innerSelected = item
              this.$refs.dataTable.toggleRowSelection(item)
            }
          })
        });
      } else {
        this.innerSelected = null
      }
    },
    /** 查询用户列表 */
    getList() {