clll
2023-09-13 716ad435a943659416f7678897eceaa637150056
CanadaMes-ui/src/views/user/index.vue
@@ -40,7 +40,7 @@
            </el-switch>
          </template>
        </el-table-column>
        <el-table-column label="操作">
        <el-table-column :label="$t('langOperation')">
          <template slot-scope="scope">
            <el-button type="primary" icon="el-icon-refresh" @click="resetPassword(scope.row)">
@@ -241,84 +241,84 @@
      });
    },
    resetPassword (info) {
      this.$confirm('确认重置密码为默认值吗?', '重置密码', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
        .then(() => {
          resetPass(info).then(() => {
            this.$message.success('密码已重置为默认值');
          });
        })
        .catch(() => {
          // 用户取消重置密码操作
        });
    },
    showEditDialog (id) {
      getById({ id: id }).then(res => {
        this.editUserForm = res.data;
        this.editDialogVisible = true;
  this.$confirm(this.$t('confirmResetPassword'), this.$t('resetPassword'), {
    confirmButtonText: this.$t('confirm'),
    cancelButtonText: this.$t('cancel'),
    type: 'warning',
  })
    .then(() => {
      resetPass(info).then(() => {
        this.$message.success(this.$t('passwordResetSuccess'));
      });
    })
    .catch(() => {
      // 用户取消重置密码操作
    });
},
showEditDialog (id) {
  getById({ id: id }).then(res => {
    this.editUserForm = res.data;
    this.editDialogVisible = true;
  });
  select().then(res => {
    this.roleList = res.data;
  });
},
removeUserById (user) {
  // 弹框询问用户是否删除分类
  this.$confirm(this.$t('confirmDeleteCategory'), this.$t('prompt'), {
    confirmButtonText: this.$t('confirm'),
    cancelButtonText: this.$t('cancel'),
    type: 'warning'
  }).then(() => {
    removeById({ id: user.id }).then(() => {
      // 重新获取分类列表
      this.getUserList();
      this.$message.success(this.$t('userDeleteSuccess'));
    });
  }).catch(() => {
    this.$message.info(this.$t('deleteCanceled'));
  });
},
handleSizeChange (newSize) {
  this.queryInfo.pageSize = newSize;
  this.getUserList()
},
handleCurrentChange (newPage) {
  this.queryInfo.pageNum = newPage;
  this.getUserList()
},
addDialogClosed () {
  this.$refs['addUserRef'].resetFields();
},
addUser () {
  this.$refs.addUserRef.validate(async valid => {
    if (!valid) return;
    saveOrUpdate(this.addUserForm).then(() => {
      const successMessage = this.$t('addUserSuccess');
      this.$message.success(successMessage);
      // 隐藏添加分类对话框
      this.addDialogVisible = false;
      // 重新获取分类列表
      this.getUserList();
    });
  })
},
editUserInfo () {
  this.$refs.addCategoryRef.validate(async valid => {
    if (!valid) return;
      select().then(res => {
        this.roleList = res.data;
      });
    },
    removeUserById (user) {
      // 弹框询问用户是否删除分类
      this.$confirm('此操作将永久删除该分类, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        removeById({ id: user.id }).then(() => {
          // 重新获取分类列表
          this.getUserList();
          this.$message.success("删除用户成功");
        });
      }).catch(() => {
        this.$message.info('已取消删除');
      });
    },
    handleSizeChange (newSize) {
      this.queryInfo.pageSize = newSize;
      this.getUserList()
    },
    handleCurrentChange (newPage) {
      this.queryInfo.pageNum = newPage;
      this.getUserList()
    },
    addDialogClosed () {
      this.$refs['addUserRef'].resetFields();
    },
    addUser () {
      this.$refs.addUserRef.validate(async valid => {
        if (!valid) return;
        saveOrUpdate(this.addUserForm).then(() => {
          this.$message.success("添加用户成功");
          // 隐藏添加分类对话框
          this.addDialogVisible = false;
          // 重新获取分类列表
          this.getUserList();
        });
      })
    },
    editUserInfo () {
      this.$refs.addCategoryRef.validate(async valid => {
        if (!valid) return;
        saveOrUpdate(this.editUserForm).then(() => {
          const 修改用户成功 = this.$t('修改用户成功');
          this.$message.success(修改用户成功);
          // 隐藏添加分类对话框
          this.editDialogVisible = false;
          // 重新获取分类列表
          this.getUserList();
        });
      })
    }
    saveOrUpdate(this.editUserForm).then(() => {
      const successMessage = this.$t('editUserSuccess');
      this.$message.success(successMessage);
      // 隐藏添加分类对话框
      this.editDialogVisible = false;
      // 重新获取分类列表
      this.getUserList();
    });
  })
}
  }
}
</script>