xiangpei
2025-01-07 8779375b26e23113ebfa5940e4e5dbe696980f53
src/components/flow/User/SingleUser.vue
@@ -96,7 +96,6 @@
    },
    // 回显数据传值
    selectUser: {
      type: Number,
      default: null,
      required: false
    },
@@ -148,7 +147,6 @@
        { key: 5, label: `状态`, visible: true },
        { key: 6, label: `创建时间`, visible: true }
      ],
      radioSelected: 0, // 单选框传值
      selectUserList: [] // 回显数据传值
    };
  },
@@ -160,18 +158,41 @@
    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(() => {
            if (this.$refs.dataTable) {
              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() {