mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-23 23:59:19 +08:00
wip(account): 开发账户管理相关
This commit is contained in:
+8
-28
@@ -19,7 +19,7 @@ import top.xyquan.ecomdmbbackend.modules.org.service.AccountService;
|
||||
*/
|
||||
@Tag(name = "组织-账户管理", description = "账户管理相关接口")
|
||||
@RestController
|
||||
@RequestMapping("/account")
|
||||
@RequestMapping("/company/account")
|
||||
public class AccountController {
|
||||
|
||||
private final AccountService accountService;
|
||||
@@ -28,51 +28,31 @@ public class AccountController {
|
||||
this.accountService = accountService;
|
||||
}
|
||||
|
||||
// ==================== 超管接口 ====================
|
||||
|
||||
@Operation(summary = "创建账户(超管)", description = "超级管理员创建账户,可指定公司")
|
||||
@PostMapping("/create")
|
||||
public ApiResponse<AccountVO> createAccount(@Valid @RequestBody CreateAccountDTO createAccountDTO) {
|
||||
AccountVO accountVO = accountService.createAccount(createAccountDTO);
|
||||
return ApiResponse.success(accountVO);
|
||||
}
|
||||
|
||||
@Operation(summary = "分页查询账户(超管)", description = "超级管理员分页查询所有账户")
|
||||
@PostMapping("/page")
|
||||
public ApiResponse<PageResultVO<AccountVO>> getAccountPage(@Valid @RequestBody PageQueryDTO<AccountFilterDTO> pageQuery) {
|
||||
PageResultVO<AccountVO> pageResult = accountService.getAccountPage(pageQuery);
|
||||
return ApiResponse.success(pageResult);
|
||||
}
|
||||
|
||||
// ==================== 管理员接口 ====================
|
||||
|
||||
@Operation(summary = "创建账户(管理员)", description = "公司管理员创建本公司账户")
|
||||
@PostMapping("/company/create")
|
||||
@PostMapping("/create")
|
||||
public ApiResponse<AccountVO> createAccountForCompany(@Valid @RequestBody CreateAccountDTO createAccountDTO) {
|
||||
AccountVO accountVO = accountService.createAccountForCompany(createAccountDTO);
|
||||
return ApiResponse.success(accountVO);
|
||||
}
|
||||
|
||||
@Operation(summary = "分页查询账户(管理员)", description = "公司管理员分页查询本公司账户")
|
||||
@PostMapping("/company/page")
|
||||
@PostMapping("/page")
|
||||
public ApiResponse<PageResultVO<AccountVO>> getAccountPageForCompany(@Valid @RequestBody PageQueryDTO<AccountFilterDTO> pageQuery) {
|
||||
PageResultVO<AccountVO> pageResult = accountService.getAccountPageForCompany(pageQuery);
|
||||
return ApiResponse.success(pageResult);
|
||||
}
|
||||
|
||||
// ==================== 通用接口 ====================
|
||||
|
||||
@Operation(summary = "更新账户信息", description = "更新账户信息")
|
||||
@PutMapping("/{accountId}")
|
||||
@Operation(summary = "更新账户信息", description = "公司管理员更新本公司账户信息")
|
||||
@PutMapping("/update/{accountId}")
|
||||
public ApiResponse<AccountVO> updateAccount(
|
||||
@Parameter(description = "账户ID", example = "1") @PathVariable Long accountId,
|
||||
@Valid @RequestBody UpdateAccountDTO updateAccountDTO) {
|
||||
AccountVO accountVO = accountService.updateAccount(updateAccountDTO, accountId);
|
||||
AccountVO accountVO = accountService.updateAccountForCompany(updateAccountDTO, accountId);
|
||||
return ApiResponse.success(accountVO);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除账户", description = "逻辑删除账户")
|
||||
@DeleteMapping("/{accountId}")
|
||||
@DeleteMapping("/delete/{accountId}")
|
||||
public ApiResponse<Void> deleteAccount(
|
||||
@Parameter(description = "账户ID", example = "1") @PathVariable Long accountId) {
|
||||
accountService.deleteAccount(accountId);
|
||||
@@ -80,7 +60,7 @@ public class AccountController {
|
||||
}
|
||||
|
||||
@Operation(summary = "获取账户详情", description = "获取账户详细信息")
|
||||
@GetMapping("/{accountId}")
|
||||
@GetMapping("/detail/{accountId}")
|
||||
public ApiResponse<AccountVO> getAccountDetail(
|
||||
@Parameter(description = "账户ID", example = "1") @PathVariable Long accountId) {
|
||||
AccountVO accountVO = accountService.getAccountDetail(accountId);
|
||||
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.org.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import top.xyquan.ecomdmbbackend.common.model.dto.PageQueryDTO;
|
||||
import top.xyquan.ecomdmbbackend.common.model.vo.PageResultVO;
|
||||
import top.xyquan.ecomdmbbackend.common.response.ApiResponse;
|
||||
import top.xyquan.ecomdmbbackend.modules.org.model.dto.account.AccountFilterDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.org.model.dto.account.SuperCreateAccountDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.org.model.dto.account.SuperUpdateAccountDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.org.model.vo.AccountVO;
|
||||
import top.xyquan.ecomdmbbackend.modules.org.service.SuperAccountService;
|
||||
import top.xyquan.ecomdmbbackend.common.annotation.RequireRole;
|
||||
|
||||
/**
|
||||
* 超级管理员账户管理控制器
|
||||
*/
|
||||
@Tag(name = "超级管理员-账户管理", description = "超级管理员账户管理相关接口")
|
||||
@RestController
|
||||
@RequestMapping("/super/account")
|
||||
public class SuperAccountController {
|
||||
|
||||
private final SuperAccountService superAccountService;
|
||||
|
||||
public SuperAccountController(SuperAccountService superAccountService) {
|
||||
this.superAccountService = superAccountService;
|
||||
}
|
||||
|
||||
@Operation(summary = "创建账户", description = "超级管理员创建账户,可指定公司")
|
||||
@PostMapping("/create")
|
||||
@RequireRole(description = "创建账户", allowCompany = false)
|
||||
public ApiResponse<AccountVO> createAccount(@Valid @RequestBody SuperCreateAccountDTO superCreateAccountDTO) {
|
||||
AccountVO accountVO = superAccountService.createAccount(superCreateAccountDTO);
|
||||
return ApiResponse.success(accountVO);
|
||||
}
|
||||
|
||||
@Operation(summary = "分页查询账户", description = "超级管理员分页查询所有账户")
|
||||
@PostMapping("/page")
|
||||
@RequireRole(description = "查询账户列表", allowCompany = false)
|
||||
public ApiResponse<PageResultVO<AccountVO>> getAccountPage(@Valid @RequestBody PageQueryDTO<AccountFilterDTO> pageQuery) {
|
||||
PageResultVO<AccountVO> pageResult = superAccountService.getAccountPage(pageQuery);
|
||||
return ApiResponse.success(pageResult);
|
||||
}
|
||||
|
||||
@Operation(summary = "更新账户信息", description = "超级管理员更新账户信息")
|
||||
@PutMapping("/update/{accountId}")
|
||||
@RequireRole(description = "更新账户", allowCompany = false)
|
||||
public ApiResponse<AccountVO> updateAccount(
|
||||
@Parameter(description = "账户ID", example = "1") @PathVariable Long accountId,
|
||||
@Valid @RequestBody SuperUpdateAccountDTO superUpdateAccountDTO) {
|
||||
AccountVO accountVO = superAccountService.updateAccount(superUpdateAccountDTO, accountId);
|
||||
return ApiResponse.success(accountVO);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除账户", description = "超级管理员逻辑删除账户")
|
||||
@DeleteMapping("/delete/{accountId}")
|
||||
@RequireRole(description = "删除账户", allowCompany = false)
|
||||
public ApiResponse<Void> deleteAccount(
|
||||
@Parameter(description = "账户ID", example = "1") @PathVariable Long accountId) {
|
||||
superAccountService.deleteAccount(accountId);
|
||||
return ApiResponse.success();
|
||||
}
|
||||
|
||||
@Operation(summary = "获取账户详情", description = "超级管理员获取账户详细信息")
|
||||
@GetMapping("/detail/{accountId}")
|
||||
@RequireRole(description = "查询账户详情", allowCompany = false)
|
||||
public ApiResponse<AccountVO> getAccountDetail(
|
||||
@Parameter(description = "账户ID", example = "1") @PathVariable Long accountId) {
|
||||
AccountVO accountVO = superAccountService.getAccountDetail(accountId);
|
||||
return ApiResponse.success(accountVO);
|
||||
}
|
||||
}
|
||||
-3
@@ -46,7 +46,4 @@ public class CreateAccountDTO {
|
||||
@Schema(description = "备注信息", example = "新员工账户")
|
||||
private String remark;
|
||||
|
||||
// 超管创建账户时需要指定公司ID,管理员创建时不需要
|
||||
@Schema(description = "公司ID(仅超管创建时需要)", example = "1")
|
||||
private Long companyId;
|
||||
}
|
||||
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.org.model.dto.account;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 超级管理员创建账户DTO
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "超级管理员创建账户请求")
|
||||
public class SuperCreateAccountDTO {
|
||||
|
||||
@NotBlank(message = "登录账号不能为空")
|
||||
@Size(min = 3, max = 20, message = "登录账号长度必须在3-20个字符之间")
|
||||
@Pattern(regexp = "^[a-zA-Z0-9_]+$", message = "登录账号只能包含字母、数字和下划线")
|
||||
@Schema(description = "登录账号", example = "admin")
|
||||
private String loginCode;
|
||||
|
||||
@NotBlank(message = "密码不能为空")
|
||||
@Size(min = 8, max = 20, message = "密码长度必须在8-20个字符之间")
|
||||
@Schema(description = "密码", example = "12345678")
|
||||
private String password;
|
||||
|
||||
@NotBlank(message = "用户姓名不能为空")
|
||||
@Size(max = 50, message = "用户姓名长度不能超过50个字符")
|
||||
@Schema(description = "用户姓名", example = "张三")
|
||||
private String realName;
|
||||
|
||||
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号码格式不正确")
|
||||
@Schema(description = "手机号码", example = "13800138000")
|
||||
private String phone;
|
||||
|
||||
@NotNull(message = "公司ID不能为空")
|
||||
@Schema(description = "公司ID", example = "1")
|
||||
private Long companyId;
|
||||
|
||||
@Schema(description = "部门ID", example = "1")
|
||||
private Long departmentId;
|
||||
|
||||
@Schema(description = "岗位ID", example = "1")
|
||||
private Long positionId;
|
||||
|
||||
@NotBlank(message = "角色不能为空")
|
||||
@Schema(description = "角色", example = "user", allowableValues = {"super", "admin", "user"})
|
||||
private String role;
|
||||
|
||||
@Schema(description = "头像图片ID", example = "1")
|
||||
private Long avatarImageId;
|
||||
|
||||
@Schema(description = "备注", example = "备注信息")
|
||||
private String remark;
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.org.model.dto.account;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 超级管理员更新账户DTO
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "超级管理员更新账户请求")
|
||||
public class SuperUpdateAccountDTO {
|
||||
|
||||
@Size(min = 3, max = 20, message = "登录账号长度必须在3-20个字符之间")
|
||||
@Pattern(regexp = "^[a-zA-Z0-9_]+$", message = "登录账号只能包含字母、数字和下划线")
|
||||
@Schema(description = "登录账号", example = "admin")
|
||||
private String loginCode;
|
||||
|
||||
@Size(max = 50, message = "用户姓名长度不能超过50个字符")
|
||||
@Schema(description = "用户姓名", example = "张三")
|
||||
private String realName;
|
||||
|
||||
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号码格式不正确")
|
||||
@Schema(description = "手机号码", example = "13800138000")
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "公司ID", example = "1")
|
||||
private Long companyId;
|
||||
|
||||
@Schema(description = "部门ID", example = "1")
|
||||
private Long departmentId;
|
||||
|
||||
@Schema(description = "岗位ID", example = "1")
|
||||
private Long positionId;
|
||||
|
||||
@Schema(description = "角色", example = "user", allowableValues = {"super", "admin", "user"})
|
||||
private String role;
|
||||
|
||||
@Schema(description = "头像图片ID", example = "1")
|
||||
private Long avatarImageId;
|
||||
|
||||
@Schema(description = "状态(0-正常 1-删除 2-停用 3-冻结)", example = "0")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", example = "备注信息")
|
||||
private String remark;
|
||||
}
|
||||
+2
-10
@@ -14,14 +14,6 @@ import top.xyquan.ecomdmbbackend.modules.org.model.vo.AccountVO;
|
||||
*/
|
||||
public interface AccountService extends IService<UserPO> {
|
||||
|
||||
/**
|
||||
* 创建账户(超管接口)
|
||||
*
|
||||
* @param createAccountDTO 创建账户信息
|
||||
* @return 账户信息
|
||||
*/
|
||||
AccountVO createAccount(CreateAccountDTO createAccountDTO);
|
||||
|
||||
/**
|
||||
* 创建账户(管理员接口,自动设置公司ID)
|
||||
*
|
||||
@@ -31,13 +23,13 @@ public interface AccountService extends IService<UserPO> {
|
||||
AccountVO createAccountForCompany(CreateAccountDTO createAccountDTO);
|
||||
|
||||
/**
|
||||
* 更新账户信息
|
||||
* 更新账户信息(管理员接口)
|
||||
*
|
||||
* @param updateAccountDTO 更新账户信息
|
||||
* @param accountId 账户ID
|
||||
* @return 更新后的账户信息
|
||||
*/
|
||||
AccountVO updateAccount(UpdateAccountDTO updateAccountDTO, Long accountId);
|
||||
AccountVO updateAccountForCompany(UpdateAccountDTO updateAccountDTO, Long accountId);
|
||||
|
||||
/**
|
||||
* 删除账户(逻辑删除)
|
||||
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.org.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import top.xyquan.ecomdmbbackend.common.model.dto.PageQueryDTO;
|
||||
import top.xyquan.ecomdmbbackend.common.model.vo.PageResultVO;
|
||||
import top.xyquan.ecomdmbbackend.modules.org.model.dto.account.AccountFilterDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.org.model.dto.account.SuperCreateAccountDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.org.model.dto.account.SuperUpdateAccountDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.sys.model.po.UserPO;
|
||||
import top.xyquan.ecomdmbbackend.modules.org.model.vo.AccountVO;
|
||||
|
||||
/**
|
||||
* 超级管理员账户管理服务接口
|
||||
*/
|
||||
public interface SuperAccountService extends IService<UserPO> {
|
||||
|
||||
/**
|
||||
* 创建账户(超管接口)
|
||||
*
|
||||
* @param superCreateAccountDTO 创建账户信息
|
||||
* @return 账户信息
|
||||
*/
|
||||
AccountVO createAccount(SuperCreateAccountDTO superCreateAccountDTO);
|
||||
|
||||
/**
|
||||
* 更新账户信息(超管接口)
|
||||
*
|
||||
* @param superUpdateAccountDTO 更新账户信息
|
||||
* @param accountId 账户ID
|
||||
* @return 更新后的账户信息
|
||||
*/
|
||||
AccountVO updateAccount(SuperUpdateAccountDTO superUpdateAccountDTO, Long accountId);
|
||||
|
||||
/**
|
||||
* 删除账户(逻辑删除)
|
||||
*
|
||||
* @param accountId 账户ID
|
||||
*/
|
||||
void deleteAccount(Long accountId);
|
||||
|
||||
/**
|
||||
* 获取账户详情
|
||||
*
|
||||
* @param accountId 账户ID
|
||||
* @return 账户详情
|
||||
*/
|
||||
AccountVO getAccountDetail(Long accountId);
|
||||
|
||||
/**
|
||||
* 分页查询账户(超管接口)
|
||||
*
|
||||
* @param pageQuery 分页查询参数
|
||||
* @return 分页结果
|
||||
*/
|
||||
PageResultVO<AccountVO> getAccountPage(PageQueryDTO<AccountFilterDTO> pageQuery);
|
||||
}
|
||||
+10
-16
@@ -45,8 +45,15 @@ public class AccountServiceImpl extends ServiceImpl<UserMapper, UserPO> implemen
|
||||
this.currentUserContext = currentUserContext;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AccountVO createAccount(CreateAccountDTO createAccountDTO) {
|
||||
public AccountVO createAccountForCompany(CreateAccountDTO createAccountDTO) {
|
||||
// 从用户上下文获取公司ID
|
||||
Long companyId = currentUserContext.getCurrentCompanyId();
|
||||
if (companyId == null) {
|
||||
throw new BusinessException("无法获取公司信息");
|
||||
}
|
||||
|
||||
// 验证登录账号是否已存在
|
||||
if (StringUtils.hasText(createAccountDTO.getLoginCode())) {
|
||||
LambdaQueryWrapper<UserPO> wrapper = new LambdaQueryWrapper<>();
|
||||
@@ -68,6 +75,7 @@ public class AccountServiceImpl extends ServiceImpl<UserMapper, UserPO> implemen
|
||||
// 创建账户
|
||||
UserPO user = new UserPO();
|
||||
BeanUtils.copyProperties(createAccountDTO, user);
|
||||
user.setCompanyId(companyId); // 设置公司ID
|
||||
user.setPassword(passwordEncoder.encode(createAccountDTO.getPassword()));
|
||||
user.setRole("user"); // 默认角色
|
||||
user.setStatus(0); // 正常状态
|
||||
@@ -82,23 +90,9 @@ public class AccountServiceImpl extends ServiceImpl<UserMapper, UserPO> implemen
|
||||
return convertToVO(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountVO createAccountForCompany(CreateAccountDTO createAccountDTO) {
|
||||
// 从用户上下文获取公司ID
|
||||
Long companyId = currentUserContext.getCurrentCompanyId();
|
||||
if (companyId == null) {
|
||||
throw new BusinessException("无法获取公司信息");
|
||||
}
|
||||
|
||||
// 设置公司ID
|
||||
createAccountDTO.setCompanyId(companyId);
|
||||
|
||||
// 调用通用创建方法
|
||||
return createAccount(createAccountDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountVO updateAccount(UpdateAccountDTO updateAccountDTO, Long accountId) {
|
||||
public AccountVO updateAccountForCompany(UpdateAccountDTO updateAccountDTO, Long accountId) {
|
||||
// 查询账户
|
||||
UserPO user = super.getById(accountId);
|
||||
if (user == null) {
|
||||
|
||||
+330
@@ -0,0 +1,330 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.org.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
import top.xyquan.ecomdmbbackend.common.exception.BusinessException;
|
||||
import top.xyquan.ecomdmbbackend.common.model.dto.PageQueryDTO;
|
||||
import top.xyquan.ecomdmbbackend.common.model.vo.PageResultVO;
|
||||
import top.xyquan.ecomdmbbackend.modules.sys.mapper.UserMapper;
|
||||
import top.xyquan.ecomdmbbackend.modules.org.model.dto.account.AccountFilterDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.org.model.dto.account.SuperCreateAccountDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.org.model.dto.account.SuperUpdateAccountDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.sys.model.po.UserPO;
|
||||
import top.xyquan.ecomdmbbackend.modules.org.model.vo.AccountVO;
|
||||
import top.xyquan.ecomdmbbackend.modules.org.service.SuperAccountService;
|
||||
import top.xyquan.ecomdmbbackend.utils.CurrentUserContext;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 超级管理员账户管理服务实现类
|
||||
*/
|
||||
@Service
|
||||
public class SuperAccountServiceImpl extends ServiceImpl<UserMapper, UserPO> implements SuperAccountService {
|
||||
|
||||
private final PasswordEncoder passwordEncoder;
|
||||
private final CurrentUserContext currentUserContext;
|
||||
|
||||
public SuperAccountServiceImpl(PasswordEncoder passwordEncoder,
|
||||
CurrentUserContext currentUserContext) {
|
||||
this.passwordEncoder = passwordEncoder;
|
||||
this.currentUserContext = currentUserContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountVO createAccount(SuperCreateAccountDTO superCreateAccountDTO) {
|
||||
// 验证登录账号是否已存在
|
||||
if (StringUtils.hasText(superCreateAccountDTO.getLoginCode())) {
|
||||
LambdaQueryWrapper<UserPO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(UserPO::getLoginCode, superCreateAccountDTO.getLoginCode());
|
||||
if (this.count(wrapper) > 0) {
|
||||
throw new BusinessException("登录账号已存在");
|
||||
}
|
||||
}
|
||||
|
||||
// 验证手机号码是否已存在
|
||||
if (StringUtils.hasText(superCreateAccountDTO.getPhone())) {
|
||||
LambdaQueryWrapper<UserPO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(UserPO::getPhone, superCreateAccountDTO.getPhone());
|
||||
if (this.count(wrapper) > 0) {
|
||||
throw new BusinessException("手机号码已存在");
|
||||
}
|
||||
}
|
||||
|
||||
// 创建账户
|
||||
UserPO user = new UserPO();
|
||||
BeanUtils.copyProperties(superCreateAccountDTO, user);
|
||||
user.setPassword(passwordEncoder.encode(superCreateAccountDTO.getPassword()));
|
||||
user.setStatus(0); // 正常状态
|
||||
user.setPwdSecurityLevel(calculatePasswordSecurityLevel(superCreateAccountDTO.getPassword()));
|
||||
user.setPwdUpdateTime(LocalDateTime.now());
|
||||
user.setCreateBy(currentUserContext.getCurrentUserId());
|
||||
|
||||
// 保存账户
|
||||
this.save(user);
|
||||
|
||||
// 转换为VO并返回
|
||||
return convertToVO(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountVO updateAccount(SuperUpdateAccountDTO superUpdateAccountDTO, Long accountId) {
|
||||
// 查询账户
|
||||
UserPO user = super.getById(accountId);
|
||||
if (user == null) {
|
||||
throw new BusinessException("账户不存在");
|
||||
}
|
||||
|
||||
// 检查登录账号是否被其他用户使用
|
||||
if (StringUtils.hasText(superUpdateAccountDTO.getLoginCode()) &&
|
||||
!superUpdateAccountDTO.getLoginCode().equals(user.getLoginCode())) {
|
||||
LambdaQueryWrapper<UserPO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(UserPO::getLoginCode, superUpdateAccountDTO.getLoginCode());
|
||||
wrapper.ne(UserPO::getId, accountId);
|
||||
if (this.count(wrapper) > 0) {
|
||||
throw new BusinessException("登录账号已被其他用户使用");
|
||||
}
|
||||
}
|
||||
|
||||
// 检查手机号码是否被其他用户使用
|
||||
if (StringUtils.hasText(superUpdateAccountDTO.getPhone()) &&
|
||||
!superUpdateAccountDTO.getPhone().equals(user.getPhone())) {
|
||||
LambdaQueryWrapper<UserPO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(UserPO::getPhone, superUpdateAccountDTO.getPhone());
|
||||
wrapper.ne(UserPO::getId, accountId);
|
||||
if (this.count(wrapper) > 0) {
|
||||
throw new BusinessException("手机号码已被其他用户使用");
|
||||
}
|
||||
}
|
||||
|
||||
// 更新账户信息
|
||||
if (StringUtils.hasText(superUpdateAccountDTO.getLoginCode())) {
|
||||
user.setLoginCode(superUpdateAccountDTO.getLoginCode());
|
||||
}
|
||||
if (StringUtils.hasText(superUpdateAccountDTO.getPhone())) {
|
||||
user.setPhone(superUpdateAccountDTO.getPhone());
|
||||
}
|
||||
if (StringUtils.hasText(superUpdateAccountDTO.getRealName())) {
|
||||
user.setRealName(superUpdateAccountDTO.getRealName());
|
||||
}
|
||||
if (superUpdateAccountDTO.getAvatarImageId() != null) {
|
||||
user.setAvatarImageId(superUpdateAccountDTO.getAvatarImageId());
|
||||
}
|
||||
if (superUpdateAccountDTO.getCompanyId() != null) {
|
||||
user.setCompanyId(superUpdateAccountDTO.getCompanyId());
|
||||
}
|
||||
if (superUpdateAccountDTO.getDepartmentId() != null) {
|
||||
user.setDepartmentId(superUpdateAccountDTO.getDepartmentId());
|
||||
}
|
||||
if (superUpdateAccountDTO.getPositionId() != null) {
|
||||
user.setPositionId(superUpdateAccountDTO.getPositionId());
|
||||
}
|
||||
if (StringUtils.hasText(superUpdateAccountDTO.getRole())) {
|
||||
user.setRole(superUpdateAccountDTO.getRole());
|
||||
}
|
||||
if (superUpdateAccountDTO.getStatus() != null) {
|
||||
user.setStatus(superUpdateAccountDTO.getStatus());
|
||||
}
|
||||
if (StringUtils.hasText(superUpdateAccountDTO.getRemark())) {
|
||||
user.setRemark(superUpdateAccountDTO.getRemark());
|
||||
}
|
||||
|
||||
user.setUpdateBy(currentUserContext.getCurrentUserId());
|
||||
|
||||
// 保存更新
|
||||
this.updateById(user);
|
||||
|
||||
// 转换为VO并返回
|
||||
return convertToVO(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAccount(Long accountId) {
|
||||
// 查询账户
|
||||
UserPO user = super.getById(accountId);
|
||||
if (user == null) {
|
||||
throw new BusinessException("账户不存在");
|
||||
}
|
||||
|
||||
// 逻辑删除
|
||||
user.setStatus(1); // 删除状态
|
||||
user.setUpdateBy(currentUserContext.getCurrentUserId());
|
||||
this.updateById(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountVO getAccountDetail(Long accountId) {
|
||||
// 查询账户
|
||||
UserPO user = super.getById(accountId);
|
||||
if (user == null) {
|
||||
throw new BusinessException("账户不存在");
|
||||
}
|
||||
|
||||
// 转换为VO并返回
|
||||
return convertToVO(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResultVO<AccountVO> getAccountPage(PageQueryDTO<AccountFilterDTO> pageQuery) {
|
||||
// 构建查询条件
|
||||
LambdaQueryWrapper<UserPO> wrapper = buildQueryWrapper(pageQuery.getFilters());
|
||||
|
||||
// 分页查询
|
||||
Page<UserPO> page = new Page<>(pageQuery.getPage(), pageQuery.getPageSize());
|
||||
IPage<UserPO> pageResult = this.page(page, wrapper);
|
||||
|
||||
// 转换为VO
|
||||
List<AccountVO> records = pageResult.getRecords().stream()
|
||||
.map(this::convertToVO)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 构建分页响应
|
||||
return PageResultVO.create(records, pageResult.getTotal(), pageQuery.getPage(), pageQuery.getPageSize());
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建查询条件
|
||||
*/
|
||||
private LambdaQueryWrapper<UserPO> buildQueryWrapper(AccountFilterDTO filterDTO) {
|
||||
LambdaQueryWrapper<UserPO> wrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
// 如果过滤条件为空,直接返回基础查询条件
|
||||
if (filterDTO == null) {
|
||||
wrapper.ne(UserPO::getStatus, 1);
|
||||
wrapper.orderByDesc(UserPO::getCreateTime);
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
// 登录账号
|
||||
if (StringUtils.hasText(filterDTO.getLoginCode())) {
|
||||
wrapper.like(UserPO::getLoginCode, filterDTO.getLoginCode());
|
||||
}
|
||||
|
||||
// 用户姓名
|
||||
if (StringUtils.hasText(filterDTO.getRealName())) {
|
||||
wrapper.like(UserPO::getRealName, filterDTO.getRealName());
|
||||
}
|
||||
|
||||
// 手机号码
|
||||
if (StringUtils.hasText(filterDTO.getPhone())) {
|
||||
wrapper.like(UserPO::getPhone, filterDTO.getPhone());
|
||||
}
|
||||
|
||||
// 公司ID
|
||||
if (filterDTO.getCompanyId() != null) {
|
||||
wrapper.eq(UserPO::getCompanyId, filterDTO.getCompanyId());
|
||||
}
|
||||
|
||||
// 部门ID
|
||||
if (filterDTO.getDepartmentId() != null) {
|
||||
wrapper.eq(UserPO::getDepartmentId, filterDTO.getDepartmentId());
|
||||
}
|
||||
|
||||
// 岗位ID
|
||||
if (filterDTO.getPositionId() != null) {
|
||||
wrapper.eq(UserPO::getPositionId, filterDTO.getPositionId());
|
||||
}
|
||||
|
||||
// 角色
|
||||
if (StringUtils.hasText(filterDTO.getRole())) {
|
||||
wrapper.eq(UserPO::getRole, filterDTO.getRole());
|
||||
}
|
||||
|
||||
// 状态
|
||||
if (filterDTO.getStatus() != null) {
|
||||
wrapper.eq(UserPO::getStatus, filterDTO.getStatus());
|
||||
}
|
||||
|
||||
// 排除删除状态
|
||||
wrapper.ne(UserPO::getStatus, 1);
|
||||
|
||||
// 按创建时间倒序
|
||||
wrapper.orderByDesc(UserPO::getCreateTime);
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换为VO
|
||||
*/
|
||||
private AccountVO convertToVO(UserPO user) {
|
||||
AccountVO accountVO = new AccountVO();
|
||||
BeanUtils.copyProperties(user, accountVO);
|
||||
|
||||
// 设置状态名称
|
||||
accountVO.setStatusName(getStatusName(user.getStatus()));
|
||||
|
||||
// 设置角色名称
|
||||
accountVO.setRoleName(getRoleName(user.getRole()));
|
||||
|
||||
// TODO: 设置公司名称、部门名称、岗位名称等关联信息
|
||||
// 这里可以根据需要查询关联表获取详细信息
|
||||
|
||||
return accountVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取状态名称
|
||||
*/
|
||||
private String getStatusName(Integer status) {
|
||||
if (status == null) return "未知";
|
||||
return switch (status) {
|
||||
case 0 -> "正常";
|
||||
case 1 -> "删除";
|
||||
case 2 -> "停用";
|
||||
case 3 -> "冻结";
|
||||
default -> "未知";
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取角色名称
|
||||
*/
|
||||
private String getRoleName(String role) {
|
||||
if (role == null) return "未知";
|
||||
return switch (role) {
|
||||
case "super" -> "超级管理员";
|
||||
case "admin" -> "公司管理员";
|
||||
case "user" -> "普通用户";
|
||||
default -> "未知";
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算密码安全级别
|
||||
*/
|
||||
private Integer calculatePasswordSecurityLevel(String password) {
|
||||
if (password == null || password.length() < 8) {
|
||||
return 1; // 很弱
|
||||
}
|
||||
|
||||
boolean hasLower = password.matches(".*[a-z].*");
|
||||
boolean hasUpper = password.matches(".*[A-Z].*");
|
||||
boolean hasDigit = password.matches(".*\\d.*");
|
||||
boolean hasSpecial = password.matches(".*[@$!%*?&].*");
|
||||
|
||||
int score = 0;
|
||||
if (hasLower) score++;
|
||||
if (hasUpper) score++;
|
||||
if (hasDigit) score++;
|
||||
if (hasSpecial) score++;
|
||||
|
||||
if (password.length() >= 12) score++;
|
||||
|
||||
return switch (score) {
|
||||
case 0, 1 -> 1; // 很弱
|
||||
case 2 -> 2; // 弱
|
||||
case 3 -> 3; // 安全
|
||||
case 4, 5 -> 4; // 很安全
|
||||
default -> 2; // 弱
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -7,57 +7,37 @@ import type { AccountDTO, AccountVO } from './types';
|
||||
* 账户管理API
|
||||
*/
|
||||
|
||||
// ==================== 超管接口 ====================
|
||||
|
||||
/**
|
||||
* 创建账户(超管)
|
||||
*/
|
||||
export async function createAccountApi(data: AccountDTO.CreateAccountDTO) {
|
||||
return requestClient.post<AccountVO.AccountInfoVO>('/account/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询账户(超管)
|
||||
*/
|
||||
export async function getAccountPageApi(params: PageQueryDTO<AccountDTO.AccountFilterDTO>) {
|
||||
return requestClient.post<PageResultVO<AccountVO.AccountInfoVO>>('/account/page', params);
|
||||
}
|
||||
|
||||
// ==================== 管理员接口 ====================
|
||||
|
||||
/**
|
||||
* 创建账户(管理员)
|
||||
*/
|
||||
export async function createAccountForCompanyApi(data: AccountDTO.CreateAccountDTO) {
|
||||
return requestClient.post<AccountVO.AccountInfoVO>('/account/company/create', data);
|
||||
export async function admin_createAccountApi(data: AccountDTO.CreateAccountDTO) {
|
||||
return requestClient.post<AccountVO.AccountInfoVO>('/company/account/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询账户(管理员)
|
||||
*/
|
||||
export async function getAccountPageForCompanyApi(params: PageQueryDTO<AccountDTO.AccountFilterDTO>) {
|
||||
return requestClient.post<PageResultVO<AccountVO.AccountInfoVO>>('/account/company/page', params);
|
||||
export async function admin_getAccountPageApi(params: PageQueryDTO<AccountDTO.AccountFilterDTO>) {
|
||||
return requestClient.post<PageResultVO<AccountVO.AccountInfoVO>>('/company/account/page', params);
|
||||
}
|
||||
|
||||
// ==================== 通用接口 ====================
|
||||
|
||||
/**
|
||||
* 更新账户信息
|
||||
*/
|
||||
export async function updateAccountApi(accountId: number, data: AccountDTO.UpdateAccountDTO) {
|
||||
return requestClient.put<AccountVO.AccountInfoVO>(`/account/${accountId}`, data);
|
||||
export async function admin_updateAccountApi(data: AccountDTO.UpdateAccountDTO) {
|
||||
return requestClient.put<AccountVO.AccountInfoVO>(`/company/account/update/${data.id}`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除账户
|
||||
*/
|
||||
export async function deleteAccountApi(accountId: number) {
|
||||
return requestClient.delete<void>(`/account/${accountId}`);
|
||||
export async function admin_deleteAccountApi(accountId: number) {
|
||||
return requestClient.delete<void>(`/company/account/delete/${accountId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取账户详情
|
||||
*/
|
||||
export async function getAccountDetailApi(accountId: number) {
|
||||
return requestClient.get<AccountVO.AccountInfoVO>(`/account/${accountId}`);
|
||||
export async function admin_getAccountDetailApi(accountId: number) {
|
||||
return requestClient.get<AccountVO.AccountInfoVO>(`/company/account/detail/${accountId}`);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ export namespace AccountDTO {
|
||||
|
||||
/** 更新账户参数 */
|
||||
export interface UpdateAccountDTO {
|
||||
/** 账户ID */
|
||||
id: number;
|
||||
/** 真实姓名 */
|
||||
realName?: string;
|
||||
/** 邮箱 */
|
||||
@@ -50,24 +52,24 @@ export namespace AccountDTO {
|
||||
/** 账户过滤条件 */
|
||||
export interface AccountFilterDTO {
|
||||
/** 登录账号(模糊查询) */
|
||||
loginCode?: string;
|
||||
loginCode?: undefined | string;
|
||||
/** 用户姓名(模糊查询) */
|
||||
realName?: string;
|
||||
realName?: undefined | string;
|
||||
/** 手机号码(精确查询) */
|
||||
phone?: string;
|
||||
phone?: undefined | string;
|
||||
/** 公司ID */
|
||||
companyId?: number;
|
||||
companyId?: undefined | number;
|
||||
/** 部门ID */
|
||||
departmentId?: number;
|
||||
departmentId?: undefined | number;
|
||||
/** 岗位ID */
|
||||
positionId?: number;
|
||||
positionId?: undefined | number;
|
||||
/** 角色 */
|
||||
role?: string;
|
||||
role?: undefined | string;
|
||||
/** 状态(0-正常 1-删除 2-停用 3-冻结) */
|
||||
status?: number;
|
||||
status?: undefined | number;
|
||||
/** 页码 */
|
||||
pageNum?: number;
|
||||
pageNum?: undefined | number;
|
||||
/** 每页大小 */
|
||||
pageSize?: number;
|
||||
pageSize?: undefined | number;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
import type { PageQueryDTO, PageResultVO } from '#/types/common';
|
||||
import type { SuperAccountDTO, SuperAccountVO } from './types';
|
||||
|
||||
/**
|
||||
* 超管账户管理API
|
||||
*/
|
||||
|
||||
/**
|
||||
* 创建账户(超管)
|
||||
*/
|
||||
export async function super_createAccountApi(data: SuperAccountDTO.SuperCreateAccountDTO) {
|
||||
return requestClient.post<SuperAccountVO.AccountInfoVO>('/super/account/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询账户(超管)
|
||||
*/
|
||||
export async function super_getAccountPageApi(params: PageQueryDTO<SuperAccountDTO.AccountFilterDTO>) {
|
||||
return requestClient.post<PageResultVO<SuperAccountVO.AccountInfoVO>>('/super/account/page', params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新账户信息(超管)
|
||||
*/
|
||||
export async function super_updateAccountApi(accountId: number, data: SuperAccountDTO.SuperUpdateAccountDTO) {
|
||||
return requestClient.put<SuperAccountVO.AccountInfoVO>(`/super/account/update/${accountId}`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除账户(超管)
|
||||
*/
|
||||
export async function super_deleteAccountApi(accountId: number) {
|
||||
return requestClient.delete<void>(`/super/account/delete/${accountId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取账户详情(超管)
|
||||
*/
|
||||
export async function super_getAccountDetailApi(accountId: number) {
|
||||
return requestClient.get<SuperAccountVO.AccountInfoVO>(`/super/account/detail/${accountId}`);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 超管账户管理模块API导出
|
||||
*/
|
||||
|
||||
export * from './apis';
|
||||
export * from './types';
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 超管账户管理模块类型定义导出
|
||||
*/
|
||||
|
||||
export * from './types.dto';
|
||||
export * from './types.vo';
|
||||
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* 超管账户管理模块DTO类型定义
|
||||
*/
|
||||
|
||||
export namespace SuperAccountDTO {
|
||||
/** 超管创建账户参数 */
|
||||
export interface SuperCreateAccountDTO {
|
||||
/** 登录账号 */
|
||||
loginCode: string;
|
||||
/** 密码 */
|
||||
password: string;
|
||||
/** 用户姓名 */
|
||||
realName: string;
|
||||
/** 手机号码 */
|
||||
phone?: string;
|
||||
/** 公司ID */
|
||||
companyId: number;
|
||||
/** 部门ID */
|
||||
departmentId?: number;
|
||||
/** 岗位ID */
|
||||
positionId?: number;
|
||||
/** 角色 */
|
||||
role: string;
|
||||
/** 头像图片ID */
|
||||
avatarImageId?: number;
|
||||
/** 备注 */
|
||||
remark?: string;
|
||||
}
|
||||
|
||||
/** 超管更新账户参数 */
|
||||
export interface SuperUpdateAccountDTO {
|
||||
/** 登录账号 */
|
||||
loginCode?: string;
|
||||
/** 用户姓名 */
|
||||
realName?: string;
|
||||
/** 手机号码 */
|
||||
phone?: string;
|
||||
/** 公司ID */
|
||||
companyId?: number;
|
||||
/** 部门ID */
|
||||
departmentId?: number;
|
||||
/** 岗位ID */
|
||||
positionId?: number;
|
||||
/** 角色 */
|
||||
role?: string;
|
||||
/** 头像图片ID */
|
||||
avatarImageId?: number;
|
||||
/** 状态(0-正常 1-删除 2-停用 3-冻结) */
|
||||
status?: number;
|
||||
/** 备注 */
|
||||
remark?: string;
|
||||
}
|
||||
|
||||
/** 账户过滤条件 */
|
||||
export interface AccountFilterDTO {
|
||||
/** 登录账号(模糊查询) */
|
||||
loginCode?: string;
|
||||
/** 用户姓名(模糊查询) */
|
||||
realName?: string;
|
||||
/** 手机号码(精确查询) */
|
||||
phone?: string;
|
||||
/** 公司ID */
|
||||
companyId?: number;
|
||||
/** 部门ID */
|
||||
departmentId?: number;
|
||||
/** 岗位ID */
|
||||
positionId?: number;
|
||||
/** 角色 */
|
||||
role?: string;
|
||||
/** 状态(0-正常 1-删除 2-停用 3-冻结) */
|
||||
status?: number;
|
||||
/** 页码 */
|
||||
pageNum?: number;
|
||||
/** 每页大小 */
|
||||
pageSize?: number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* 超管账户管理模块VO类型定义
|
||||
*/
|
||||
|
||||
export namespace SuperAccountVO {
|
||||
/** 账户信息 */
|
||||
export interface AccountInfoVO {
|
||||
/** 账户ID */
|
||||
id: number;
|
||||
/** 登录账号 */
|
||||
loginCode: string;
|
||||
/** 用户姓名 */
|
||||
realName: string;
|
||||
/** 手机号码 */
|
||||
phone?: string;
|
||||
/** 公司ID */
|
||||
companyId?: number;
|
||||
/** 公司名称 */
|
||||
companyName?: string;
|
||||
/** 部门ID */
|
||||
departmentId?: number;
|
||||
/** 部门名称 */
|
||||
departmentName?: string;
|
||||
/** 岗位ID */
|
||||
positionId?: number;
|
||||
/** 岗位名称 */
|
||||
positionName?: string;
|
||||
/** 角色 */
|
||||
role?: string;
|
||||
/** 头像 */
|
||||
avatar?: string;
|
||||
/** 状态(0-正常 1-删除 2-停用 3-冻结) */
|
||||
status: number;
|
||||
/** 备注 */
|
||||
remark?: string;
|
||||
/** 创建时间 */
|
||||
createTime: string;
|
||||
/** 更新时间 */
|
||||
updateTime: string;
|
||||
}
|
||||
}
|
||||
+195
@@ -0,0 +1,195 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { Form, Input, Modal, Select, message } from 'ant-design-vue';
|
||||
|
||||
import {
|
||||
admin_createAccountApi,
|
||||
admin_updateAccountApi,
|
||||
type AccountVO,
|
||||
type AccountDTO
|
||||
} from '#/api/org/account';
|
||||
|
||||
interface Emits {
|
||||
(e: 'success'): void;
|
||||
}
|
||||
|
||||
const emit = defineEmits<Emits>();
|
||||
|
||||
defineOptions({ name: 'AccountFormModal' });
|
||||
|
||||
// 响应式数据
|
||||
const formRef = ref();
|
||||
const loading = ref(false);
|
||||
const visible = ref(false);
|
||||
const isEdit = ref(false);
|
||||
const currentAccountData = ref<AccountVO.AccountInfoVO | null>(null);
|
||||
|
||||
// 表单数据
|
||||
const formData = ref<AccountDTO.CreateAccountDTO>({
|
||||
username: '',
|
||||
password: '',
|
||||
realName: '',
|
||||
email: '',
|
||||
phone: '',
|
||||
companyId: undefined,
|
||||
departmentId: undefined,
|
||||
positionId: undefined,
|
||||
roleId: undefined,
|
||||
status: 1,
|
||||
});
|
||||
|
||||
// 模态框标题
|
||||
const modalTitle = computed(() => isEdit.value ? '编辑账户' : '添加账户');
|
||||
|
||||
// 状态选项
|
||||
const statusOptions = [
|
||||
{ label: '禁用', value: 0 },
|
||||
{ label: '正常', value: 1 },
|
||||
];
|
||||
|
||||
// 重置表单
|
||||
function resetForm() {
|
||||
formData.value = {
|
||||
username: '',
|
||||
password: '',
|
||||
realName: '',
|
||||
email: '',
|
||||
phone: '',
|
||||
companyId: undefined,
|
||||
departmentId: undefined,
|
||||
positionId: undefined,
|
||||
roleId: undefined,
|
||||
status: 1,
|
||||
};
|
||||
formRef.value?.resetFields();
|
||||
}
|
||||
|
||||
// 处理模态框关闭
|
||||
function handleCancel() {
|
||||
visible.value = false;
|
||||
}
|
||||
|
||||
// 暴露给父组件的方法
|
||||
function open(editMode: boolean = false, accountData?: AccountVO.AccountInfoVO | null) {
|
||||
isEdit.value = editMode;
|
||||
currentAccountData.value = accountData || null;
|
||||
|
||||
resetForm();
|
||||
|
||||
if (editMode && accountData) {
|
||||
formData.value = {
|
||||
username: accountData.username,
|
||||
password: '', // 编辑时密码为空
|
||||
realName: accountData.realName,
|
||||
email: accountData.email || '',
|
||||
phone: accountData.phone || '',
|
||||
companyId: accountData.companyId,
|
||||
departmentId: accountData.departmentId,
|
||||
positionId: accountData.positionId,
|
||||
roleId: accountData.roleId,
|
||||
status: accountData.status,
|
||||
};
|
||||
}
|
||||
|
||||
visible.value = true;
|
||||
}
|
||||
|
||||
// 处理表单提交
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
await formRef.value?.validate();
|
||||
loading.value = true;
|
||||
|
||||
if (isEdit.value && currentAccountData.value) {
|
||||
const { password, ...updateData } = formData.value;
|
||||
await admin_updateAccountApi({ ...updateData, id: currentAccountData.value.id });
|
||||
message.success('更新成功');
|
||||
} else {
|
||||
await admin_createAccountApi(formData.value);
|
||||
message.success('创建成功');
|
||||
}
|
||||
|
||||
visible.value = false;
|
||||
emit('success');
|
||||
} catch (error) {
|
||||
console.error('保存账户失败:', error);
|
||||
message.error('保存账户失败');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
// 监听弹窗关闭
|
||||
watch(visible, (val) => {
|
||||
if (!val) {
|
||||
resetForm();
|
||||
}
|
||||
});
|
||||
|
||||
// 暴露方法给父组件
|
||||
defineExpose({
|
||||
open,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal
|
||||
:open="visible"
|
||||
:title="modalTitle"
|
||||
width="500px"
|
||||
:confirm-loading="loading"
|
||||
@ok="handleSubmit"
|
||||
@cancel="handleCancel"
|
||||
>
|
||||
<Form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:label-col="{ span: 6 }"
|
||||
:wrapper-col="{ span: 18 }"
|
||||
>
|
||||
<Form.Item label="用户名" name="username" :rules="[{ required: true, message: '请输入用户名' }]">
|
||||
<Input v-model:value="formData.username" placeholder="请输入用户名" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item v-if="!isEdit" label="密码" name="password" :rules="[{ required: true, message: '请输入密码' }]">
|
||||
<Input v-model:value="formData.password" type="password" placeholder="请输入密码" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="真实姓名" name="realName" :rules="[{ required: true, message: '请输入真实姓名' }]">
|
||||
<Input v-model:value="formData.realName" placeholder="请输入真实姓名" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="邮箱" name="email">
|
||||
<Input v-model:value="formData.email" placeholder="请输入邮箱" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="手机号" name="phone">
|
||||
<Input v-model:value="formData.phone" placeholder="请输入手机号" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="公司ID" name="companyId">
|
||||
<Input v-model:value="formData.companyId" type="number" placeholder="请输入公司ID" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="部门ID" name="departmentId">
|
||||
<Input v-model:value="formData.departmentId" type="number" placeholder="请输入部门ID" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="职位ID" name="positionId">
|
||||
<Input v-model:value="formData.positionId" type="number" placeholder="请输入职位ID" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="角色ID" name="roleId">
|
||||
<Input v-model:value="formData.roleId" type="number" placeholder="请输入角色ID" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="状态" name="status">
|
||||
<Select
|
||||
v-model:value="formData.status"
|
||||
placeholder="请选择状态"
|
||||
:options="statusOptions"
|
||||
/>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
</template>
|
||||
@@ -0,0 +1,328 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { Button, message, Space, Tag } from 'ant-design-vue';
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import {
|
||||
admin_deleteAccountApi,
|
||||
admin_getAccountPageApi,
|
||||
type AccountVO,
|
||||
type AccountDTO
|
||||
} from '#/api/org/account';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
import AccountFormModal from './components/AccountFormModal.vue';
|
||||
|
||||
// 创建图标组件
|
||||
const PlusIcon = createIconifyIcon('lucide:plus');
|
||||
|
||||
defineOptions({ name: 'CompanyAccountManagement' });
|
||||
|
||||
// 响应式数据
|
||||
const loading = ref(false);
|
||||
const accountFormModalRef = ref();
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = ref({
|
||||
loginCode: undefined as undefined | string,
|
||||
realName: undefined as undefined | string,
|
||||
phone: undefined as undefined | string,
|
||||
companyId: undefined as undefined | number,
|
||||
departmentId: undefined as undefined | number,
|
||||
positionId: undefined as undefined | number,
|
||||
role: undefined as undefined | string,
|
||||
status: undefined as undefined | number,
|
||||
});
|
||||
|
||||
// 状态选项
|
||||
const statusOptions = [
|
||||
{ label: '正常', value: 0 },
|
||||
{ label: '删除', value: 1 },
|
||||
{ label: '停用', value: 2 },
|
||||
{ label: '冻结', value: 3 },
|
||||
];
|
||||
|
||||
// 搜索表单配置
|
||||
const formOptions = computed(() => ({
|
||||
schemas: [
|
||||
{
|
||||
fieldName: 'loginCode',
|
||||
label: '登录账号',
|
||||
},
|
||||
{
|
||||
fieldName: 'realName',
|
||||
label: '真实姓名',
|
||||
},
|
||||
{
|
||||
fieldName: 'phone',
|
||||
label: '手机号',
|
||||
},
|
||||
{
|
||||
fieldName: 'status',
|
||||
label: '状态',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: statusOptions,
|
||||
placeholder: '请选择状态',
|
||||
},
|
||||
},
|
||||
],
|
||||
showDefaultActions: true,
|
||||
collapsed: true,
|
||||
collapsedRows: 1,
|
||||
}));
|
||||
|
||||
// VbenVxeGrid 表格配置
|
||||
const gridOptions: VxeGridProps<any> = {
|
||||
columns: [
|
||||
{
|
||||
type: 'seq' as const,
|
||||
minWidth: 'auto',
|
||||
title: '序号',
|
||||
},
|
||||
{
|
||||
field: 'loginCode',
|
||||
title: '登录账号',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'realName',
|
||||
title: '真实姓名',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'phone',
|
||||
title: '手机号',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'companyName',
|
||||
title: '公司',
|
||||
minWidth: 150,
|
||||
},
|
||||
{
|
||||
field: 'departmentName',
|
||||
title: '部门',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'positionName',
|
||||
title: '职位',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'role',
|
||||
title: '角色',
|
||||
minWidth: 100,
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
minWidth: 80,
|
||||
slots: { default: 'status' },
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
minWidth: 160,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 120,
|
||||
fixed: 'right' as const,
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
],
|
||||
height: 'auto',
|
||||
border: true,
|
||||
stripe: true,
|
||||
showOverflow: true,
|
||||
size: 'small',
|
||||
toolbarConfig: {
|
||||
custom: true,
|
||||
refresh: true,
|
||||
zoom: true,
|
||||
},
|
||||
data: [],
|
||||
pagerConfig: {
|
||||
enabled: true,
|
||||
pageSizes: [10, 20, 50, 100],
|
||||
layouts: ['PrevJump', 'PrevPage', 'Number', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total'] as ('PrevJump' | 'PrevPage' | 'Number' | 'NextPage' | 'NextJump' | 'Sizes' | 'FullJump' | 'Total')[],
|
||||
},
|
||||
// 配置远程加载
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }) => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const params: PageQueryDTO<AccountDTO.AccountFilterDTO> = {
|
||||
page: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...searchForm.value,
|
||||
};
|
||||
const response = await admin_getAccountPageApi(params);
|
||||
return {
|
||||
items: response.records,
|
||||
total: response.total,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('查询数据失败:', error);
|
||||
message.error('查询数据失败');
|
||||
return {
|
||||
items: [],
|
||||
total: 0,
|
||||
};
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// 表格实例
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
gridOptions,
|
||||
formOptions: formOptions.value,
|
||||
showSearchForm: true,
|
||||
tableTitle: '账户管理',
|
||||
});
|
||||
|
||||
// 计算属性
|
||||
const hasSelected = computed(() => {
|
||||
const vxeTable = (gridApi as any).grid;
|
||||
return vxeTable?.getCheckboxRecords?.()?.length > 0;
|
||||
});
|
||||
|
||||
// 刷新表格数据
|
||||
function refreshTable() {
|
||||
if (gridApi) {
|
||||
gridApi.reload();
|
||||
}
|
||||
}
|
||||
|
||||
const handleAdd = () => {
|
||||
accountFormModalRef.value?.open();
|
||||
};
|
||||
|
||||
const handleEdit = (row: AccountVO.AccountInfoVO) => {
|
||||
accountFormModalRef.value?.open(row);
|
||||
};
|
||||
|
||||
const handleDelete = async (row: AccountVO.AccountInfoVO) => {
|
||||
try {
|
||||
await admin_deleteAccountApi(row.id);
|
||||
message.success('删除成功');
|
||||
refreshTable();
|
||||
} catch (error) {
|
||||
console.error('删除失败:', error);
|
||||
message.error('删除失败');
|
||||
}
|
||||
};
|
||||
|
||||
const handleBatchDelete = async () => {
|
||||
const vxeTable = (gridApi as any).grid;
|
||||
const selectedRows = vxeTable?.getCheckboxRecords?.();
|
||||
if (!selectedRows?.length) {
|
||||
message.warning('请选择要删除的数据');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const deletePromises = selectedRows.map((row: AccountVO.AccountInfoVO) =>
|
||||
admin_deleteAccountApi(row.id)
|
||||
);
|
||||
await Promise.all(deletePromises);
|
||||
message.success('批量删除成功');
|
||||
refreshTable();
|
||||
} catch (error) {
|
||||
console.error('批量删除失败:', error);
|
||||
message.error('批量删除失败');
|
||||
}
|
||||
};
|
||||
|
||||
// 获取状态文本
|
||||
const getStatusText = (status: number) => {
|
||||
const statusMap = {
|
||||
0: '正常',
|
||||
1: '删除',
|
||||
2: '停用',
|
||||
3: '冻结',
|
||||
};
|
||||
return statusMap[status as keyof typeof statusMap] || '未知';
|
||||
};
|
||||
|
||||
// 获取状态颜色
|
||||
const getStatusColor = (status: number) => {
|
||||
const colorMap = {
|
||||
0: 'green',
|
||||
1: 'red',
|
||||
2: 'orange',
|
||||
3: 'purple',
|
||||
};
|
||||
return colorMap[status as keyof typeof colorMap] || 'default';
|
||||
};
|
||||
|
||||
// 处理模态框成功回调
|
||||
function handleModalSuccess() {
|
||||
refreshTable();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page title="账户管理" auto-content-height>
|
||||
<template #description>
|
||||
<div class="text-foreground/80 mt-2">
|
||||
管理公司账户信息,支持账户的增删改查操作
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- VbenVxeGrid 表格 -->
|
||||
<Grid
|
||||
:loading="loading"
|
||||
>
|
||||
<!-- 工具栏工具 -->
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon />
|
||||
添加账户
|
||||
</Button>
|
||||
<Button
|
||||
v-if="hasSelected"
|
||||
danger
|
||||
@click="handleBatchDelete"
|
||||
>
|
||||
批量删除
|
||||
</Button>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
<!-- 状态列 -->
|
||||
<template #status="{ row }">
|
||||
<Tag :color="getStatusColor(row.status)">
|
||||
{{ getStatusText(row.status) }}
|
||||
</Tag>
|
||||
</template>
|
||||
|
||||
<!-- 操作列 -->
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<Button size="small" @click="handleEdit(row)">
|
||||
编辑
|
||||
</Button>
|
||||
<Button size="small" danger @click="handleDelete(row)">
|
||||
删除
|
||||
</Button>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
<!-- 账户表单弹窗 -->
|
||||
<AccountFormModal ref="accountFormModalRef" @success="handleModalSuccess" />
|
||||
</Page>
|
||||
</template>
|
||||
-264
@@ -1,264 +0,0 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Modal, Form, FormItem, Input, Select, SelectOption, Button, message } from 'ant-design-vue';
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
|
||||
import {
|
||||
createAccountApi,
|
||||
updateAccountApi,
|
||||
type AccountVO,
|
||||
type AccountDTO
|
||||
} from '#/api/org/account';
|
||||
|
||||
// 创建图标组件
|
||||
const SaveIcon = createIconifyIcon('lucide:save');
|
||||
const CloseIcon = createIconifyIcon('lucide:x');
|
||||
|
||||
defineOptions({ name: 'AccountFormModal' });
|
||||
|
||||
// 响应式数据
|
||||
const visible = ref(false);
|
||||
const loading = ref(false);
|
||||
const isEdit = ref(false);
|
||||
const formRef = ref();
|
||||
|
||||
// 表单数据
|
||||
const formData = reactive<AccountDTO.CreateAccountDTO>({
|
||||
username: '',
|
||||
password: '',
|
||||
realName: '',
|
||||
email: '',
|
||||
phone: '',
|
||||
companyId: undefined,
|
||||
departmentId: undefined,
|
||||
positionId: undefined,
|
||||
roleId: undefined,
|
||||
status: 1,
|
||||
});
|
||||
|
||||
// 表单规则
|
||||
const formRules = {
|
||||
username: [
|
||||
{ required: true, message: '请输入用户名', trigger: 'blur' },
|
||||
{ min: 3, max: 20, message: '用户名长度为3-20个字符', trigger: 'blur' },
|
||||
],
|
||||
password: [
|
||||
{ required: true, message: '请输入密码', trigger: 'blur' },
|
||||
{ min: 6, max: 20, message: '密码长度为6-20个字符', trigger: 'blur' },
|
||||
],
|
||||
realName: [
|
||||
{ required: true, message: '请输入真实姓名', trigger: 'blur' },
|
||||
],
|
||||
email: [
|
||||
{ type: 'email', message: '请输入正确的邮箱格式', trigger: 'blur' },
|
||||
],
|
||||
phone: [
|
||||
{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号', trigger: 'blur' },
|
||||
],
|
||||
};
|
||||
|
||||
// 状态选项
|
||||
const statusOptions = [
|
||||
{ label: '禁用', value: 0 },
|
||||
{ label: '正常', value: 1 },
|
||||
];
|
||||
|
||||
// 方法
|
||||
const open = (record?: AccountVO.AccountInfoVO) => {
|
||||
visible.value = true;
|
||||
isEdit.value = !!record;
|
||||
|
||||
if (record) {
|
||||
Object.assign(formData, {
|
||||
username: record.username,
|
||||
realName: record.realName,
|
||||
email: record.email,
|
||||
phone: record.phone,
|
||||
companyId: record.companyId,
|
||||
departmentId: record.departmentId,
|
||||
positionId: record.positionId,
|
||||
roleId: record.roleId,
|
||||
status: record.status,
|
||||
});
|
||||
} else {
|
||||
resetForm();
|
||||
}
|
||||
};
|
||||
|
||||
const close = () => {
|
||||
visible.value = false;
|
||||
resetForm();
|
||||
};
|
||||
|
||||
const resetForm = () => {
|
||||
Object.assign(formData, {
|
||||
username: '',
|
||||
password: '',
|
||||
realName: '',
|
||||
email: '',
|
||||
phone: '',
|
||||
companyId: undefined,
|
||||
departmentId: undefined,
|
||||
positionId: undefined,
|
||||
roleId: undefined,
|
||||
status: 1,
|
||||
});
|
||||
formRef.value?.resetFields();
|
||||
};
|
||||
|
||||
const handleSubmit = async () => {
|
||||
try {
|
||||
await formRef.value?.validate();
|
||||
loading.value = true;
|
||||
|
||||
if (isEdit.value) {
|
||||
const { password, ...updateData } = formData;
|
||||
await updateAccountApi(formData.id!, updateData);
|
||||
message.success('更新成功');
|
||||
} else {
|
||||
await createAccountApi(formData);
|
||||
message.success('创建成功');
|
||||
}
|
||||
|
||||
close();
|
||||
emit('success');
|
||||
} catch (error) {
|
||||
console.error('提交失败:', error);
|
||||
message.error(isEdit.value ? '更新失败' : '创建失败');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 事件
|
||||
const emit = defineEmits<{
|
||||
success: [];
|
||||
}>();
|
||||
|
||||
// 监听弹窗关闭
|
||||
watch(visible, (val) => {
|
||||
if (!val) {
|
||||
resetForm();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal
|
||||
v-model:open="visible"
|
||||
:title="isEdit ? '编辑账户' : '新增账户'"
|
||||
width="600px"
|
||||
:confirm-loading="loading"
|
||||
@cancel="close"
|
||||
>
|
||||
<Form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
layout="vertical"
|
||||
class="mt-4"
|
||||
>
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<FormItem label="用户名" name="username">
|
||||
<Input
|
||||
v-model:value="formData.username"
|
||||
placeholder="请输入用户名"
|
||||
:disabled="isEdit"
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem label="密码" name="password" v-if="!isEdit">
|
||||
<Input
|
||||
v-model:value="formData.password"
|
||||
type="password"
|
||||
placeholder="请输入密码"
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem label="真实姓名" name="realName">
|
||||
<Input
|
||||
v-model:value="formData.realName"
|
||||
placeholder="请输入真实姓名"
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem label="邮箱" name="email">
|
||||
<Input
|
||||
v-model:value="formData.email"
|
||||
placeholder="请输入邮箱"
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem label="手机号" name="phone">
|
||||
<Input
|
||||
v-model:value="formData.phone"
|
||||
placeholder="请输入手机号"
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem label="公司ID" name="companyId">
|
||||
<Input
|
||||
v-model:value="formData.companyId"
|
||||
type="number"
|
||||
placeholder="请输入公司ID"
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem label="部门ID" name="departmentId">
|
||||
<Input
|
||||
v-model:value="formData.departmentId"
|
||||
type="number"
|
||||
placeholder="请输入部门ID"
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem label="职位ID" name="positionId">
|
||||
<Input
|
||||
v-model:value="formData.positionId"
|
||||
type="number"
|
||||
placeholder="请输入职位ID"
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem label="角色ID" name="roleId">
|
||||
<Input
|
||||
v-model:value="formData.roleId"
|
||||
type="number"
|
||||
placeholder="请输入角色ID"
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem label="状态" name="status">
|
||||
<Select
|
||||
v-model:value="formData.status"
|
||||
placeholder="请选择状态"
|
||||
>
|
||||
<SelectOption
|
||||
v-for="option in statusOptions"
|
||||
:key="option.value"
|
||||
:value="option.value"
|
||||
>
|
||||
{{ option.label }}
|
||||
</SelectOption>
|
||||
</Select>
|
||||
</FormItem>
|
||||
</div>
|
||||
</Form>
|
||||
|
||||
<template #footer>
|
||||
<div class="flex justify-end space-x-2">
|
||||
<Button @click="close" :icon="CloseIcon">
|
||||
取消
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
:loading="loading"
|
||||
:icon="SaveIcon"
|
||||
@click="handleSubmit"
|
||||
>
|
||||
{{ isEdit ? '更新' : '创建' }}
|
||||
</Button>
|
||||
</div>
|
||||
</template>
|
||||
</Modal>
|
||||
</template>
|
||||
-346
@@ -1,346 +0,0 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, h, onMounted } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { Button, message, Space, Tag } from 'ant-design-vue';
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import {
|
||||
deleteAccountApi,
|
||||
getAccountPageApi,
|
||||
type AccountVO,
|
||||
type AccountDTO
|
||||
} from '#/api/org/account';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
import AccountFormModal from './components/AccountFormModal.vue';
|
||||
|
||||
// 创建图标组件
|
||||
const PlusIcon = createIconifyIcon('lucide:plus');
|
||||
const EditIcon = createIconifyIcon('lucide:edit');
|
||||
const TrashIcon = createIconifyIcon('lucide:trash-2');
|
||||
|
||||
defineOptions({ name: 'AdminAccountManagement' });
|
||||
|
||||
// 响应式数据
|
||||
const loading = ref(false);
|
||||
const accountFormModalRef = ref();
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = ref({
|
||||
loginCode: '',
|
||||
realName: '',
|
||||
phone: '',
|
||||
companyId: undefined as number | undefined,
|
||||
departmentId: undefined as number | undefined,
|
||||
positionId: undefined as number | undefined,
|
||||
role: '',
|
||||
status: undefined as number | undefined,
|
||||
});
|
||||
|
||||
// 状态选项
|
||||
const statusOptions = [
|
||||
{ label: '正常', value: 0 },
|
||||
{ label: '删除', value: 1 },
|
||||
{ label: '停用', value: 2 },
|
||||
{ label: '冻结', value: 3 },
|
||||
];
|
||||
|
||||
// VbenVxeGrid 表格配置
|
||||
const gridOptions: VxeGridProps<any> = {
|
||||
columns: [
|
||||
{
|
||||
type: 'seq' as const,
|
||||
minWidth: 'auto',
|
||||
title: '序号',
|
||||
},
|
||||
{
|
||||
field: 'username',
|
||||
title: '用户名',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'realName',
|
||||
title: '真实姓名',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'email',
|
||||
title: '邮箱',
|
||||
minWidth: 150,
|
||||
},
|
||||
{
|
||||
field: 'phone',
|
||||
title: '手机号',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'companyName',
|
||||
title: '公司',
|
||||
minWidth: 150,
|
||||
},
|
||||
{
|
||||
field: 'departmentName',
|
||||
title: '部门',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'positionName',
|
||||
title: '职位',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'roleName',
|
||||
title: '角色',
|
||||
minWidth: 100,
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
minWidth: 80,
|
||||
cellRender: ({ row }) => {
|
||||
const statusMap = {
|
||||
0: { text: '正常', color: 'green' },
|
||||
1: { text: '删除', color: 'red' },
|
||||
2: { text: '停用', color: 'orange' },
|
||||
3: { text: '冻结', color: 'purple' },
|
||||
};
|
||||
const status = statusMap[row.status as keyof typeof statusMap];
|
||||
return h(Tag, { color: status.color }, () => status.text);
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
minWidth: 160,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 120,
|
||||
fixed: 'right' as const,
|
||||
cellRender: ({ row }) => {
|
||||
return h(Space, {}, () => [
|
||||
h(Button, {
|
||||
type: 'link',
|
||||
size: 'small',
|
||||
icon: h(EditIcon),
|
||||
onClick: () => handleEdit(row),
|
||||
}, () => '编辑'),
|
||||
h(Button, {
|
||||
type: 'link',
|
||||
size: 'small',
|
||||
danger: true,
|
||||
icon: h(TrashIcon),
|
||||
onClick: () => handleDelete(row),
|
||||
}, () => '删除'),
|
||||
]);
|
||||
},
|
||||
},
|
||||
],
|
||||
data: [],
|
||||
loading: false,
|
||||
height: 'auto',
|
||||
border: true,
|
||||
stripe: true,
|
||||
showOverflow: 'tooltip',
|
||||
showHeaderOverflow: 'tooltip',
|
||||
resizable: true,
|
||||
keepSource: true,
|
||||
id: 'admin-account-grid',
|
||||
};
|
||||
|
||||
// 表格实例
|
||||
const { gridRef, getVxeGridInstance } = useVbenVxeGrid({
|
||||
gridOptions,
|
||||
});
|
||||
|
||||
// 计算属性
|
||||
const hasSelected = computed(() => {
|
||||
const instance = getVxeGridInstance();
|
||||
return instance?.getCheckboxRecords().length > 0;
|
||||
});
|
||||
|
||||
// 方法
|
||||
const handleSearch = async () => {
|
||||
await loadData();
|
||||
};
|
||||
|
||||
const handleReset = () => {
|
||||
searchForm.value = {
|
||||
loginCode: '',
|
||||
realName: '',
|
||||
phone: '',
|
||||
companyId: undefined,
|
||||
departmentId: undefined,
|
||||
positionId: undefined,
|
||||
role: '',
|
||||
status: undefined,
|
||||
};
|
||||
loadData();
|
||||
};
|
||||
|
||||
const loadData = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const instance = getVxeGridInstance();
|
||||
instance?.commitProxy('query');
|
||||
} catch (error) {
|
||||
console.error('加载数据失败:', error);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const handleAdd = () => {
|
||||
accountFormModalRef.value?.open();
|
||||
};
|
||||
|
||||
const handleEdit = (row: AccountVO.AccountInfoVO) => {
|
||||
accountFormModalRef.value?.open(row);
|
||||
};
|
||||
|
||||
const handleDelete = async (row: AccountVO.AccountInfoVO) => {
|
||||
try {
|
||||
await deleteAccountApi(row.id);
|
||||
message.success('删除成功');
|
||||
await loadData();
|
||||
} catch (error) {
|
||||
console.error('删除失败:', error);
|
||||
message.error('删除失败');
|
||||
}
|
||||
};
|
||||
|
||||
const handleBatchDelete = async () => {
|
||||
const instance = getVxeGridInstance();
|
||||
const selectedRows = instance?.getCheckboxRecords();
|
||||
if (!selectedRows?.length) {
|
||||
message.warning('请选择要删除的数据');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const deletePromises = selectedRows.map((row: AccountVO.AccountInfoVO) =>
|
||||
deleteAccountApi(row.id)
|
||||
);
|
||||
await Promise.all(deletePromises);
|
||||
message.success('批量删除成功');
|
||||
await loadData();
|
||||
} catch (error) {
|
||||
console.error('批量删除失败:', error);
|
||||
message.error('批量删除失败');
|
||||
}
|
||||
};
|
||||
|
||||
// 表格代理配置
|
||||
const gridProxyConfig = {
|
||||
ajax: {
|
||||
query: async ({ page, sorts, filters }: any) => {
|
||||
const params: PageQueryDTO<AccountDTO.AccountFilterDTO> = {
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...searchForm.value,
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await getAccountPageApi(params);
|
||||
return {
|
||||
result: response.data.records,
|
||||
page: {
|
||||
total: response.data.total,
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('查询数据失败:', error);
|
||||
return {
|
||||
result: [],
|
||||
page: {
|
||||
total: 0,
|
||||
},
|
||||
};
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
const instance = getVxeGridInstance();
|
||||
instance?.setProxyConfig(gridProxyConfig);
|
||||
loadData();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page>
|
||||
<template #title>
|
||||
<div class="flex items-center justify-between">
|
||||
<h1 class="text-xl font-semibold">超管账户管理</h1>
|
||||
<Space>
|
||||
<Button @click="handleAdd" type="primary" :icon="PlusIcon">
|
||||
新增账户
|
||||
</Button>
|
||||
<Button
|
||||
v-if="hasSelected"
|
||||
danger
|
||||
@click="handleBatchDelete"
|
||||
>
|
||||
批量删除
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 搜索表单 -->
|
||||
<div class="mb-4 p-4 bg-gray-50 rounded-lg">
|
||||
<div class="grid grid-cols-4 gap-4">
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-1">用户名</label>
|
||||
<input
|
||||
v-model="searchForm.loginCode"
|
||||
placeholder="请输入用户名"
|
||||
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-1">真实姓名</label>
|
||||
<input
|
||||
v-model="searchForm.realName"
|
||||
placeholder="请输入真实姓名"
|
||||
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-1">手机号</label>
|
||||
<input
|
||||
v-model="searchForm.phone"
|
||||
placeholder="请输入手机号"
|
||||
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-1">状态</label>
|
||||
<select
|
||||
v-model="searchForm.status"
|
||||
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
>
|
||||
<option value="">全部</option>
|
||||
<option v-for="option in statusOptions" :key="option.value" :value="option.value">
|
||||
{{ option.label }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-4 flex justify-end space-x-2">
|
||||
<Button @click="handleReset">重置</Button>
|
||||
<Button type="primary" @click="handleSearch">搜索</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 表格 -->
|
||||
<VbenVxeGrid ref="gridRef" v-bind="gridOptions" />
|
||||
|
||||
<!-- 账户表单弹窗 -->
|
||||
<AccountFormModal ref="accountFormModalRef" @success="loadData" />
|
||||
</Page>
|
||||
</template>
|
||||
+271
@@ -0,0 +1,271 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { Modal, Form, FormItem, Input, Select, Button, message } from 'ant-design-vue';
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
|
||||
import {
|
||||
admin_createAccountApi,
|
||||
admin_updateAccountApi,
|
||||
type AccountVO,
|
||||
type AccountDTO
|
||||
} from '#/api/org/account';
|
||||
|
||||
// 创建图标组件
|
||||
const SaveIcon = createIconifyIcon('lucide:save');
|
||||
const CancelIcon = createIconifyIcon('lucide:x');
|
||||
|
||||
// Props
|
||||
interface Props {
|
||||
visible?: boolean;
|
||||
accountData?: AccountVO.AccountInfoVO;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
visible: false,
|
||||
accountData: undefined,
|
||||
});
|
||||
|
||||
// Emits
|
||||
const emit = defineEmits<{
|
||||
success: [];
|
||||
cancel: [];
|
||||
}>();
|
||||
|
||||
// 响应式数据
|
||||
const formRef = ref();
|
||||
const loading = ref(false);
|
||||
const formData = ref<any>({
|
||||
username: '',
|
||||
password: '',
|
||||
realName: '',
|
||||
phone: '',
|
||||
companyId: undefined,
|
||||
departmentId: undefined,
|
||||
positionId: undefined,
|
||||
roleId: undefined,
|
||||
status: 1,
|
||||
});
|
||||
|
||||
// 计算属性
|
||||
const isEdit = computed(() => !!props.accountData);
|
||||
const modalTitle = computed(() => isEdit.value ? '编辑账户' : '新增账户');
|
||||
|
||||
// 角色选项
|
||||
const roleOptions = [
|
||||
{ label: '超级管理员', value: 'super' },
|
||||
{ label: '管理员', value: 'admin' },
|
||||
{ label: '普通用户', value: 'user' },
|
||||
];
|
||||
|
||||
// 监听props变化
|
||||
watch(() => props.accountData, (newData) => {
|
||||
if (newData) {
|
||||
formData.value = {
|
||||
id: newData.id,
|
||||
username: newData.username,
|
||||
realName: newData.realName,
|
||||
phone: newData.phone,
|
||||
companyId: newData.companyId,
|
||||
departmentId: newData.departmentId,
|
||||
positionId: newData.positionId,
|
||||
roleId: newData.roleId,
|
||||
status: newData.status,
|
||||
};
|
||||
} else {
|
||||
resetForm();
|
||||
}
|
||||
}, { immediate: true });
|
||||
|
||||
// 方法
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
username: '',
|
||||
password: '',
|
||||
realName: '',
|
||||
phone: '',
|
||||
companyId: undefined,
|
||||
departmentId: undefined,
|
||||
positionId: undefined,
|
||||
roleId: undefined,
|
||||
status: 1,
|
||||
};
|
||||
};
|
||||
|
||||
const handleSave = async () => {
|
||||
try {
|
||||
await formRef.value?.validate();
|
||||
loading.value = true;
|
||||
|
||||
if (isEdit.value) {
|
||||
await admin_updateAccountApi(formData.value as AccountDTO.UpdateAccountDTO);
|
||||
message.success('更新成功');
|
||||
} else {
|
||||
await admin_createAccountApi(formData.value as AccountDTO.CreateAccountDTO);
|
||||
message.success('创建成功');
|
||||
}
|
||||
|
||||
emit('success');
|
||||
handleCancel();
|
||||
} catch (error) {
|
||||
console.error('保存失败:', error);
|
||||
message.error('保存失败');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
resetForm();
|
||||
emit('cancel');
|
||||
};
|
||||
|
||||
// 暴露方法给父组件
|
||||
defineExpose({
|
||||
open: (data?: AccountVO.AccountInfoVO) => {
|
||||
if (data) {
|
||||
formData.value = {
|
||||
id: data.id,
|
||||
username: data.username,
|
||||
realName: data.realName,
|
||||
phone: data.phone,
|
||||
companyId: data.companyId,
|
||||
departmentId: data.departmentId,
|
||||
positionId: data.positionId,
|
||||
roleId: data.roleId,
|
||||
status: data.status,
|
||||
};
|
||||
} else {
|
||||
resetForm();
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal
|
||||
v-model:open="props.visible"
|
||||
:title="modalTitle"
|
||||
width="600px"
|
||||
:confirm-loading="loading"
|
||||
@ok="handleSave"
|
||||
@cancel="handleCancel"
|
||||
>
|
||||
<Form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:label-col="{ span: 6 }"
|
||||
:wrapper-col="{ span: 18 }"
|
||||
>
|
||||
<FormItem
|
||||
label="登录账号"
|
||||
name="username"
|
||||
:rules="[
|
||||
{ required: true, message: '请输入登录账号' },
|
||||
{ min: 3, max: 20, message: '登录账号长度必须在3-20个字符之间' },
|
||||
{ pattern: /^[a-zA-Z0-9_]+$/, message: '登录账号只能包含字母、数字和下划线' }
|
||||
]"
|
||||
>
|
||||
<Input v-model:value="formData.username" placeholder="请输入登录账号" />
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
v-if="!isEdit"
|
||||
label="密码"
|
||||
name="password"
|
||||
:rules="[
|
||||
{ required: true, message: '请输入密码' },
|
||||
{ min: 8, max: 20, message: '密码长度必须在8-20个字符之间' }
|
||||
]"
|
||||
>
|
||||
<Input v-model:value="formData.password" type="password" placeholder="请输入密码" />
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="真实姓名"
|
||||
name="realName"
|
||||
:rules="[
|
||||
{ required: true, message: '请输入真实姓名' },
|
||||
{ max: 50, message: '真实姓名长度不能超过50个字符' }
|
||||
]"
|
||||
>
|
||||
<Input v-model:value="formData.realName" placeholder="请输入真实姓名" />
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="手机号码"
|
||||
name="phone"
|
||||
:rules="[
|
||||
{ pattern: /^1[3-9]\d{9}$/, message: '手机号码格式不正确' }
|
||||
]"
|
||||
>
|
||||
<Input v-model:value="formData.phone" placeholder="请输入手机号码" />
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="公司ID"
|
||||
name="companyId"
|
||||
:rules="[
|
||||
{ required: true, message: '请选择公司' }
|
||||
]"
|
||||
>
|
||||
<Input v-model:value="formData.companyId" type="number" placeholder="请输入公司ID" />
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="部门ID"
|
||||
name="departmentId"
|
||||
>
|
||||
<Input v-model:value="formData.departmentId" type="number" placeholder="请输入部门ID" />
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="岗位ID"
|
||||
name="positionId"
|
||||
>
|
||||
<Input v-model:value="formData.positionId" type="number" placeholder="请输入岗位ID" />
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="角色"
|
||||
name="roleId"
|
||||
:rules="[
|
||||
{ required: true, message: '请选择角色' }
|
||||
]"
|
||||
>
|
||||
<Select v-model:value="formData.roleId" placeholder="请选择角色">
|
||||
<Select.Option
|
||||
v-for="option in roleOptions"
|
||||
:key="option.value"
|
||||
:value="option.value"
|
||||
>
|
||||
{{ option.label }}
|
||||
</Select.Option>
|
||||
</Select>
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="状态"
|
||||
name="status"
|
||||
:rules="[
|
||||
{ required: true, message: '请选择状态' }
|
||||
]"
|
||||
>
|
||||
<Select v-model:value="formData.status" placeholder="请选择状态">
|
||||
<Select.Option :value="0">禁用</Select.Option>
|
||||
<Select.Option :value="1">正常</Select.Option>
|
||||
</Select>
|
||||
</FormItem>
|
||||
</Form>
|
||||
|
||||
<template #footer>
|
||||
<div class="flex justify-end space-x-2">
|
||||
<Button @click="handleCancel" :icon="CancelIcon">
|
||||
取消
|
||||
</Button>
|
||||
<Button type="primary" @click="handleSave" :loading="loading" :icon="SaveIcon">
|
||||
保存
|
||||
</Button>
|
||||
</div>
|
||||
</template>
|
||||
</Modal>
|
||||
</template>
|
||||
+327
@@ -0,0 +1,327 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { Button, message, Space, Tag } from 'ant-design-vue';
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import {
|
||||
admin_deleteAccountApi,
|
||||
admin_getAccountPageApi,
|
||||
type AccountVO,
|
||||
type AccountDTO
|
||||
} from '#/api/org/account';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
import SuperAccountFormModal from './components/SuperAccountFormModal.vue';
|
||||
|
||||
// 创建图标组件
|
||||
const PlusIcon = createIconifyIcon('lucide:plus');
|
||||
|
||||
defineOptions({ name: 'SuperAccountManagement' });
|
||||
|
||||
// 响应式数据
|
||||
const loading = ref(false);
|
||||
const accountFormModalRef = ref();
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = ref({
|
||||
username: '',
|
||||
realName: '',
|
||||
phone: '',
|
||||
companyId: undefined as number | undefined,
|
||||
departmentId: undefined as number | undefined,
|
||||
positionId: undefined as number | undefined,
|
||||
roleId: undefined as number | undefined,
|
||||
status: undefined as number | undefined,
|
||||
});
|
||||
|
||||
// 状态选项
|
||||
const statusOptions = [
|
||||
{ label: '正常', value: 0 },
|
||||
{ label: '删除', value: 1 },
|
||||
{ label: '停用', value: 2 },
|
||||
{ label: '冻结', value: 3 },
|
||||
];
|
||||
|
||||
// 搜索表单配置
|
||||
const formOptions = computed(() => ({
|
||||
schemas: [
|
||||
{
|
||||
fieldName: 'username',
|
||||
label: '登录账号',
|
||||
},
|
||||
{
|
||||
fieldName: 'realName',
|
||||
label: '真实姓名',
|
||||
},
|
||||
{
|
||||
fieldName: 'phone',
|
||||
label: '手机号',
|
||||
},
|
||||
{
|
||||
fieldName: 'status',
|
||||
label: '状态',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: statusOptions,
|
||||
placeholder: '请选择状态',
|
||||
},
|
||||
},
|
||||
],
|
||||
showDefaultActions: true,
|
||||
collapsed: true,
|
||||
collapsedRows: 1,
|
||||
}));
|
||||
|
||||
// VbenVxeGrid 表格配置
|
||||
const gridOptions: VxeGridProps<any> = {
|
||||
columns: [
|
||||
{
|
||||
type: 'seq' as const,
|
||||
minWidth: 'auto',
|
||||
title: '序号',
|
||||
},
|
||||
{
|
||||
field: 'username',
|
||||
title: '登录账号',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'realName',
|
||||
title: '真实姓名',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'phone',
|
||||
title: '手机号',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'companyName',
|
||||
title: '公司',
|
||||
minWidth: 150,
|
||||
},
|
||||
{
|
||||
field: 'departmentName',
|
||||
title: '部门',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'positionName',
|
||||
title: '职位',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'role',
|
||||
title: '角色',
|
||||
minWidth: 100,
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
minWidth: 80,
|
||||
slots: { default: 'status' },
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
minWidth: 160,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 120,
|
||||
fixed: 'right' as const,
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
],
|
||||
height: 'auto',
|
||||
border: true,
|
||||
stripe: true,
|
||||
showOverflow: true,
|
||||
size: 'small',
|
||||
toolbarConfig: {
|
||||
custom: true,
|
||||
refresh: true,
|
||||
zoom: true,
|
||||
},
|
||||
data: [],
|
||||
pagerConfig: {
|
||||
enabled: true,
|
||||
pageSizes: [10, 20, 50, 100],
|
||||
layouts: ['PrevJump', 'PrevPage', 'Number', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total'] as ('PrevJump' | 'PrevPage' | 'Number' | 'NextPage' | 'NextJump' | 'Sizes' | 'FullJump' | 'Total')[],
|
||||
},
|
||||
// 配置远程加载
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }) => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const params: PageQueryDTO<AccountDTO.AccountFilterDTO> = {
|
||||
page: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...searchForm.value,
|
||||
};
|
||||
const response = await admin_getAccountPageApi(params);
|
||||
return {
|
||||
items: response.records,
|
||||
total: response.total,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('查询数据失败:', error);
|
||||
message.error('查询数据失败');
|
||||
return {
|
||||
items: [],
|
||||
total: 0,
|
||||
};
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// 表格实例
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
gridOptions,
|
||||
formOptions: formOptions.value,
|
||||
showSearchForm: true,
|
||||
tableTitle: '超级账户管理',
|
||||
});
|
||||
|
||||
// 计算属性
|
||||
const hasSelected = computed(() => {
|
||||
const vxeTable = (gridApi as any).grid;
|
||||
return vxeTable?.getCheckboxRecords?.()?.length > 0;
|
||||
});
|
||||
|
||||
// 刷新表格数据
|
||||
function refreshTable() {
|
||||
if (gridApi) {
|
||||
gridApi.reload();
|
||||
}
|
||||
}
|
||||
|
||||
const handleAdd = () => {
|
||||
accountFormModalRef.value?.open();
|
||||
};
|
||||
|
||||
const handleEdit = (row: AccountVO.AccountInfoVO) => {
|
||||
accountFormModalRef.value?.open(true, row);
|
||||
};
|
||||
|
||||
const handleDelete = async (row: AccountVO.AccountInfoVO) => {
|
||||
try {
|
||||
await admin_deleteAccountApi(row.id);
|
||||
message.success('删除成功');
|
||||
refreshTable();
|
||||
} catch (error) {
|
||||
console.error('删除失败:', error);
|
||||
message.error('删除失败');
|
||||
}
|
||||
};
|
||||
|
||||
const handleBatchDelete = async () => {
|
||||
const vxeTable = (gridApi as any).grid;
|
||||
const selectedRows = vxeTable?.getCheckboxRecords?.();
|
||||
if (!selectedRows?.length) {
|
||||
message.warning('请选择要删除的数据');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const deletePromises = selectedRows.map((row: AccountVO.AccountInfoVO) =>
|
||||
admin_deleteAccountApi(row.id)
|
||||
);
|
||||
await Promise.all(deletePromises);
|
||||
message.success('批量删除成功');
|
||||
refreshTable();
|
||||
} catch (error) {
|
||||
console.error('批量删除失败:', error);
|
||||
message.error('批量删除失败');
|
||||
}
|
||||
};
|
||||
|
||||
// 处理模态框成功回调
|
||||
function handleModalSuccess() {
|
||||
refreshTable();
|
||||
}
|
||||
|
||||
// 获取状态文本
|
||||
const getStatusText = (status: number) => {
|
||||
const statusMap = {
|
||||
0: '正常',
|
||||
1: '删除',
|
||||
2: '停用',
|
||||
3: '冻结',
|
||||
};
|
||||
return statusMap[status as keyof typeof statusMap] || '未知';
|
||||
};
|
||||
|
||||
// 获取状态颜色
|
||||
const getStatusColor = (status: number) => {
|
||||
const colorMap = {
|
||||
0: 'green',
|
||||
1: 'red',
|
||||
2: 'orange',
|
||||
3: 'purple',
|
||||
};
|
||||
return colorMap[status as keyof typeof colorMap] || 'default';
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page title="超级账户管理" auto-content-height>
|
||||
<template #description>
|
||||
<div class="text-foreground/80 mt-2">
|
||||
管理超级管理员账户信息,支持账户的增删改查操作
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- VbenVxeGrid 表格 -->
|
||||
<Grid
|
||||
:loading="loading"
|
||||
>
|
||||
<!-- 工具栏工具 -->
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon />
|
||||
添加账户
|
||||
</Button>
|
||||
<Button
|
||||
v-if="hasSelected"
|
||||
danger
|
||||
@click="handleBatchDelete"
|
||||
>
|
||||
批量删除
|
||||
</Button>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
<!-- 状态列 -->
|
||||
<template #status="{ row }">
|
||||
<Tag :color="getStatusColor(row.status)">
|
||||
{{ getStatusText(row.status) }}
|
||||
</Tag>
|
||||
</template>
|
||||
|
||||
<!-- 操作列 -->
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<Button size="small" @click="handleEdit(row)">
|
||||
编辑
|
||||
</Button>
|
||||
<Button size="small" danger @click="handleDelete(row)">
|
||||
删除
|
||||
</Button>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
<!-- 账户表单弹窗 -->
|
||||
<SuperAccountFormModal ref="accountFormModalRef" @success="handleModalSuccess" />
|
||||
</Page>
|
||||
</template>
|
||||
@@ -1,334 +0,0 @@
|
||||
<div data-radix-popper-content-wrapper=""
|
||||
style="position: fixed; left: 0px; top: 0px; transform: translate(2066px, 310px); min-width: max-content; --radix-popper-transform-origin: 100% 0px; z-index: 2000; --radix-popper-available-width: 2737px; --radix-popper-available-height: 974px; --radix-popper-anchor-width: 253.5px; --radix-popper-anchor-height: 32px;">
|
||||
<div trapfocus="false" disableoutsidepointerevents="false" id="radix-vue-popover-content-v-132" data-state="open"
|
||||
role="dialog" data-dismissable-layer="" tabindex="-1"
|
||||
class="bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 border-border rounded-md border shadow-md outline-none p-0 pt-3 w-full side-content z-popup"
|
||||
data-side="bottom" data-align="end"
|
||||
style="--radix-popover-content-transform-origin: var(--radix-popper-transform-origin); --radix-popover-content-available-width: var(--radix-popper-available-width); --radix-popover-content-available-height: var(--radix-popper-available-height); --radix-popover-trigger-width: var(--radix-popper-anchor-width); --radix-popover-trigger-height: var(--radix-popper-anchor-height);">
|
||||
<div class="mb-2 flex w-full"><input type="text" class="ant-input css-oddqdp mx-2" placeholder="搜索图标..." value="">
|
||||
</div>
|
||||
<div class="grid max-h-[360px] w-full grid-cols-6 justify-items-center"><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor" d="M17 15V8h-2v7H8v2h7v7h2v-7h7v-2z"></path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor"
|
||||
d="M16 4c6.6 0 12 5.4 12 12s-5.4 12-12 12S4 22.6 4 16S9.4 4 16 4m0-2C8.3 2 2 8.3 2 16s6.3 14 14 14s14-6.3 14-14S23.7 2 16 2">
|
||||
</path>
|
||||
<path fill="currentColor" d="M24 15h-7V8h-2v7H8v2h7v7h2v-7h7z"></path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor"
|
||||
d="M17.74 30L16 29l4-7h6a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h9v2H6a4 4 0 0 1-4-4V8a4 4 0 0 1 4-4h20a4 4 0 0 1 4 4v12a4 4 0 0 1-4 4h-4.84Z">
|
||||
</path>
|
||||
<path fill="currentColor" d="M17 9h-2v4h-4v2h4v4h2v-4h4v-2h-4z"></path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor"
|
||||
d="M16 2A14.173 14.173 0 0 0 2 16a14.173 14.173 0 0 0 14 14a14.173 14.173 0 0 0 14-14A14.173 14.173 0 0 0 16 2m8 15h-7v7h-2v-7H8v-2h7V8h2v7h7Z">
|
||||
</path>
|
||||
<path fill="none" d="M24 17h-7v7h-2v-7H8v-2h7V8h2v7h7z"></path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor" d="M17 15V5h-2v10H5v2h10v10h2V17h10v-2z"></path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor"
|
||||
d="M26 30H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h20a2 2 0 0 1 2 2v24a2 2 0 0 1-2 2M6 4v24h20V4Z"></path>
|
||||
<path fill="currentColor" d="M22 20H10v-2h12zm-2 5h-8v-2h8z"></path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor"
|
||||
d="M26 30H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h20a2 2 0 0 1 2 2v24a2 2 0 0 1-2 2M6 4v24h20V4Z"></path>
|
||||
<path fill="currentColor" d="M9 18h11v2H9zm0 5h7v2H9z"></path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor"
|
||||
d="M26 30H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h20a2 2 0 0 1 2 2v24a2 2 0 0 1-2 2M6 4v24h20V4Z"></path>
|
||||
<path fill="currentColor" d="M23 20H12v-2h11zm0 5h-7v-2h7z"></path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor"
|
||||
d="M26 30H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h20a2 2 0 0 1 2 2v24a2 2 0 0 1-2 2M6 4v24h20V4Z"></path>
|
||||
<path fill="currentColor" d="M22 15H10v-2h12zm-2 5h-8v-2h8z"></path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor"
|
||||
d="M26 30H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h20a2 2 0 0 1 2 2v24a2 2 0 0 1-2 2M6 4v24h20V4Z"></path>
|
||||
<path fill="currentColor" d="M9 13h11v2H9zm0 5h7v2H9z"></path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor"
|
||||
d="M26 30H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h20a2 2 0 0 1 2 2v24a2 2 0 0 1-2 2M6 4v24h20V4Z"></path>
|
||||
<path fill="currentColor" d="M23 15H12v-2h11zm0 5h-7v-2h7z"></path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor"
|
||||
d="M26 30H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h20a2 2 0 0 1 2 2v24a2 2 0 0 1-2 2M6 4v24h20V4Z"></path>
|
||||
<path fill="currentColor" d="M22 9H10V7h12zm-2 5h-8v-2h8z"></path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor"
|
||||
d="M26 30H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h20a2 2 0 0 1 2 2v24a2 2 0 0 1-2 2M6 4v24h20V4Z"></path>
|
||||
<path fill="currentColor" d="M9 7h11v2H9zm0 5h7v2H9z"></path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor"
|
||||
d="M26 30H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h20a2 2 0 0 1 2 2v24a2 2 0 0 1-2 2M6 4v24h20V4Z"></path>
|
||||
<path fill="currentColor" d="M23 9H12V7h11zm0 5h-7v-2h7z"></path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor"
|
||||
d="M24 18h-7v-4h3a2.003 2.003 0 0 0 2-2V8a2.003 2.003 0 0 0-2-2h-3V2h-2v4h-3a2.003 2.003 0 0 0-2 2v4a2.003 2.003 0 0 0 2 2h3v4H8a2.003 2.003 0 0 0-2 2v4a2.003 2.003 0 0 0 2 2h7v4h2v-4h7a2.003 2.003 0 0 0 2-2v-4a2.003 2.003 0 0 0-2-2M12 8h8v4h-8Zm12 16H8v-4h16Z">
|
||||
</path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor"
|
||||
d="M26 26H11a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h15a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2m0-6.001L11 20v4h15zM18 14h-7a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2m0-6.001L11 8v4h7zM4 2h2v28H4z">
|
||||
</path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor"
|
||||
d="M4 24v-4a2 2 0 0 1 2-2h15a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2m2 0h15v-4l-15-.001zm6-12V8a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7a2 2 0 0 1-2-2m2 0h7V8l-7-.001zm14 18h-2V2h2z">
|
||||
</path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor"
|
||||
d="M2 26h28v2H2zm22-3h-4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2m-4-9v7h4.001L24 14zm-8 9H8a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v15a2 2 0 0 1-2 2M8 6v15h4.001L12 6z">
|
||||
</path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor"
|
||||
d="M30 15h-4v-3a2.003 2.003 0 0 0-2-2h-4a2.003 2.003 0 0 0-2 2v3h-4V8a2.003 2.003 0 0 0-2-2H8a2.003 2.003 0 0 0-2 2v7H2v2h4v7a2.003 2.003 0 0 0 2 2h4a2.003 2.003 0 0 0 2-2v-7h4v3a2.003 2.003 0 0 0 2 2h4a2.003 2.003 0 0 0 2-2v-3h4ZM8 24V8h4l.001 16Zm12-4v-8h4l.001 8Z">
|
||||
</path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor"
|
||||
d="M24 20h-4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2m-4-9v7h4.001L24 11zm-8 17H8a2 2 0 0 1-2-2V11a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v15a2 2 0 0 1-2 2M8 11v15h4.001L12 11zM2 4h28v2H2z">
|
||||
</path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor"
|
||||
d="M8 4v4H4V4Zm2-2H2v8h8Zm8 2v4h-4V4Zm2-2h-8v8h8Zm8 2v4h-4V4Zm2-2h-8v8h8ZM8 14v4H4v-4Zm2-2H2v8h8Zm8 2v4h-4v-4Zm2-2h-8v8h8Zm8 2v4h-4v-4Zm2-2h-8v8h8ZM8 24v4H4v-4Zm2-2H2v8h8Zm8 2v4h-4v-4Zm2-2h-8v8h8Zm8 2v4h-4v-4Zm2-2h-8v8h8Z">
|
||||
</path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor"
|
||||
d="M27 22.142V9.858A3.992 3.992 0 1 0 22.142 5H9.858A3.992 3.992 0 1 0 5 9.858v12.284A3.992 3.992 0 1 0 9.858 27h12.284A3.992 3.992 0 1 0 27 22.142M26 4a2 2 0 1 1-2 2a2 2 0 0 1 2-2M4 6a2 2 0 1 1 2 2a2 2 0 0 1-2-2m2 22a2 2 0 1 1 2-2a2 2 0 0 1-2 2m16.142-3H9.858A4 4 0 0 0 7 22.142V9.858A4 4 0 0 0 9.858 7h12.284A4 4 0 0 0 25 9.858v12.284A3.99 3.99 0 0 0 22.142 25M26 28a2 2 0 1 1 2-2a2.003 2.003 0 0 1-2 2">
|
||||
</path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor"
|
||||
d="M30 6a3.992 3.992 0 0 0-7.977-.224L9.586 8.263A3.99 3.99 0 1 0 5 13.858v8.284A3.992 3.992 0 1 0 9.858 27h8.284a3.991 3.991 0 1 0 5.595-4.586l2.487-12.437A3.995 3.995 0 0 0 30 6m-4-2a2 2 0 1 1-2 2a2 2 0 0 1 2-2M4 10a2 2 0 1 1 2 2a2 2 0 0 1-2-2m2 18a2 2 0 1 1 2-2a2 2 0 0 1-2 2m12.142-3H9.858A4 4 0 0 0 7 22.142v-8.284a3.99 3.99 0 0 0 2.977-3.634l12.437-2.487a4 4 0 0 0 1.849 1.85l-2.487 12.436A3.99 3.99 0 0 0 18.142 25M22 28a2 2 0 1 1 2-2a2 2 0 0 1-2 2">
|
||||
</path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor" d="M24 9h-2l-6 8.571L10 9H8l7 10l-7 10h2l6-8.571L22 29h2l-7-10zM8 3h16v2H8z"></path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor"
|
||||
d="M24 9h-2l-6 8.571L10 9H8l7 10l-7 10h2l6-8.571L22 29h2l-7-10zm-4-2c-1.777 0-3.231-.873-4.514-1.642C14.322 4.659 13.223 4 12 4c-1.398 0-2.449.863-3.293 1.707L7.293 4.293C8.36 3.225 9.86 2 12 2c1.777 0 3.231.872 4.514 1.642C17.678 4.34 18.777 5 20 5c1.398 0 2.449-.863 3.293-1.707l1.414 1.414C23.64 5.774 22.14 7 20 7">
|
||||
</path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor" d="M30 29H2v-2h28zm-3-10H5v2h22zm-3-8H8v2h16zm-3-8H11v2h10z"></path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor"
|
||||
d="M2 3h28v2H2zm11 18H5c-1.103 0-2-.897-2-2v-6c0-1.103.897-2 2-2h8c1.103 0 2 .897 2 2v6c0 1.103-.897 2-2 2m-8-8v6h8v-6zm22 8h-8c-1.103 0-2-.897-2-2v-6c0-1.103.897-2 2-2h8c1.103 0 2 .897 2 2v6c0 1.103-.897 2-2 2m-8-8v6h8v-6zM2 27h28v2H2z">
|
||||
</path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor"
|
||||
d="M27 2h2v28h-2zm-7 13h-8c-1.103 0-2-.897-2-2V7c0-1.103.897-2 2-2h8c1.103 0 2 .897 2 2v6c0 1.103-.897 2-2 2m-8-8v6h8V7zm0 10h8c1.103 0 2 .897 2 2v6c0 1.103-.897 2-2 2h-8c-1.103 0-2-.897-2-2v-6c0-1.103.897-2 2-2m8 8v-6h-8v6zM3 2h2v28H3z">
|
||||
</path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor" d="M24.59 16.59L17 24.17V4h-2v20.17l-7.59-7.58L6 18l10 10l10-10z"></path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor" d="M22 26v-2H9.41L26 7.41L24.59 6L8 22.59V10H6v16z"></path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor" d="M10 26v-2h12.59L6 7.41L7.41 6L24 22.59V10h2v16z"></path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor" d="m14 26l1.41-1.41L7.83 17H28v-2H7.83l7.58-7.59L14 6L4 16z"></path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor" d="m18 6l-1.43 1.393L24.15 15H4v2h20.15l-7.58 7.573L18 26l10-10z"></path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor"
|
||||
d="M23 6v10h5a1 1 0 0 1 .707 1.707l-12 12a1 1 0 0 1-1.414 0l-12-12A1 1 0 0 1 4 16h5V6a2 2 0 0 1 2-2h10a2.003 2.003 0 0 1 2 2m-7 21.586L25.586 18H21V6H11v12H6.414Z">
|
||||
</path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor" d="M16 4L6 14l1.41 1.41L15 7.83V28h2V7.83l7.59 7.58L26 14z"></path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 h-8 w-8 px-1 text-lg hover:bg-accent hover:text-accent-foreground text-foreground/80 rounded-full"
|
||||
data-state="closed" data-grace-area-trigger="" tabindex="-1"><!----><svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em"
|
||||
viewBox="0 0 32 32" class="iconify iconify--carbon">
|
||||
<path fill="currentColor" d="M22 6v2H9.41L26 24.59L24.59 26L8 9.41V22H6V6z"></path>
|
||||
</svg></button></div>
|
||||
<div class="flex-center flex justify-end overflow-hidden border-t py-2 pr-3">
|
||||
<nav size="small">
|
||||
<div class="flex w-full items-center gap-1"><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground p-0 size-5"
|
||||
aria-label="First Page" type="button" disabled=""><svg xmlns="http://www.w3.org/2000/svg" width="24"
|
||||
height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
|
||||
stroke-linejoin="round" class="lucide lucide-chevrons-left-icon lucide-chevrons-left size-4">
|
||||
<path d="m11 17-5-5 5-5"></path>
|
||||
<path d="m18 17-5-5 5-5"></path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground p-0 size-5"
|
||||
aria-label="Previous Page" type="button" disabled=""><svg xmlns="http://www.w3.org/2000/svg" width="24"
|
||||
height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
|
||||
stroke-linejoin="round" class="lucide lucide-chevron-left-icon lucide-chevron-left size-4">
|
||||
<path d="m15 18-6-6 6-6"></path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 bg-primary text-primary-foreground shadow hover:bg-primary/90 size-5 p-0 text-sm"
|
||||
data-type="page" aria-label="Page 1" aria-current="page" data-selected="true" type="button"
|
||||
value="1">1</button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground size-5 p-0 text-sm"
|
||||
data-type="page" aria-label="Page 2" type="button" value="2">2</button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground size-5 p-0 text-sm"
|
||||
data-type="page" aria-label="Page 3" type="button" value="3">3</button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground size-5 p-0 text-sm"
|
||||
data-type="page" aria-label="Page 4" type="button" value="4">4</button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground size-5 p-0 text-sm"
|
||||
data-type="page" aria-label="Page 5" type="button" value="5">5</button>
|
||||
<div data-type="ellipsis" class="flex items-center justify-center size-5" index="5"><svg
|
||||
xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
|
||||
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
||||
class="lucide lucide-ellipsis-icon lucide-ellipsis size-4">
|
||||
<circle cx="12" cy="12" r="1"></circle>
|
||||
<circle cx="19" cy="12" r="1"></circle>
|
||||
<circle cx="5" cy="12" r="1"></circle>
|
||||
</svg></div><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground size-5 p-0 text-sm"
|
||||
data-type="page" aria-label="Page 66" type="button" value="66">66</button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground p-0 size-5"
|
||||
aria-label="Next Page" type="button"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
|
||||
viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
|
||||
stroke-linejoin="round" class="lucide lucide-chevron-right-icon lucide-chevron-right size-4">
|
||||
<path d="m9 18 6-6-6-6"></path>
|
||||
</svg></button><button
|
||||
class="inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground p-0 size-5"
|
||||
aria-label="Last Page" type="button"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
|
||||
viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
|
||||
stroke-linejoin="round" class="lucide lucide-chevrons-right-icon lucide-chevrons-right size-4">
|
||||
<path d="m6 17 5-5-5-5"></path>
|
||||
<path d="m13 17 5-5-5-5"></path>
|
||||
</svg></button>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -22,6 +22,8 @@ const TrashIcon = createIconifyIcon('lucide:trash-2');
|
||||
const FolderIcon = createIconifyIcon('lucide:folder');
|
||||
const FileIcon = createIconifyIcon('lucide:file');
|
||||
const PlusCircleIcon = createIconifyIcon('lucide:plus-circle');
|
||||
const ExpandIcon = createIconifyIcon('lucide:chevrons-down');
|
||||
const CollapseIcon = createIconifyIcon('lucide:chevrons-up');
|
||||
|
||||
defineOptions({ name: 'MenuManagement' });
|
||||
|
||||
@@ -96,6 +98,9 @@ const gridOptions: VxeGridProps<any> = {
|
||||
showOverflow: true,
|
||||
size: 'small',
|
||||
resizable: true, // 启用列宽调整
|
||||
rowConfig: {
|
||||
isHover: true, // 启用行悬停高亮
|
||||
},
|
||||
toolbarConfig: {
|
||||
custom: true,
|
||||
refresh: true,
|
||||
@@ -106,7 +111,7 @@ const gridOptions: VxeGridProps<any> = {
|
||||
treeConfig: {
|
||||
children: 'children',
|
||||
hasChild: 'hasChildren',
|
||||
expandAll: false, // 默认不展开所有节点
|
||||
expandAll: true, // 自动展开所有节点
|
||||
indent: 20, // 树节点缩进距离
|
||||
showIcon: true, // 显示展开/收起图标
|
||||
iconOpen: 'vxe-icon-arrow-down', // 展开图标
|
||||
@@ -180,6 +185,26 @@ function handleModalSuccess() {
|
||||
refreshTable();
|
||||
}
|
||||
|
||||
// 全部展开树形表格
|
||||
function expandAllTree() {
|
||||
if (gridApi) {
|
||||
const vxeTable = (gridApi as any).grid;
|
||||
if (vxeTable && typeof vxeTable.setAllTreeExpand === 'function') {
|
||||
vxeTable.setAllTreeExpand(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 全部收起树形表格
|
||||
function collapseAllTree() {
|
||||
if (gridApi) {
|
||||
const vxeTable = (gridApi as any).grid;
|
||||
if (vxeTable && typeof vxeTable.setAllTreeExpand === 'function') {
|
||||
vxeTable.setAllTreeExpand(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 获取菜单类型标签
|
||||
function getMenuTypeLabel(type: string) {
|
||||
const typeMap: Record<string, string> = {
|
||||
@@ -269,6 +294,14 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
<PlusIcon />
|
||||
添加菜单
|
||||
</Button>
|
||||
<Button @click="expandAllTree">
|
||||
<ExpandIcon />
|
||||
全部展开
|
||||
</Button>
|
||||
<Button @click="collapseAllTree">
|
||||
<CollapseIcon />
|
||||
全部收起
|
||||
</Button>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user