若依微服务1.3.7

1、管理员租户ID改为1,根据此修改逻辑
2、租户信息增删改查完善
dev 1.3.7
xins 1 year ago
parent cf6abbff50
commit ee4e74f3e9

@ -1,11 +1,7 @@
package com.ruoyi.system.api; package com.ruoyi.system.api;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import com.ruoyi.common.core.constant.SecurityConstants; import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants; import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.domain.R;
@ -40,4 +36,17 @@ public interface RemoteUserService
*/ */
@PostMapping("/user/register") @PostMapping("/user/register")
public R<Boolean> registerUserInfo(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); public R<Boolean> registerUserInfo(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* @param: tenantId
* @description
* @author xins
* @date 2023-09-27 9:58
* @return R<Boolean>
*/
@PostMapping("/user/deleteUsersByTenantId/{tenantId}")
public R<Boolean> deleteUsersByTenantId(@PathVariable("tenantId") Long tenantId);
} }

@ -36,6 +36,11 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
{ {
return R.fail("注册用户失败:" + throwable.getMessage()); return R.fail("注册用户失败:" + throwable.getMessage());
} }
@Override
public R<Boolean> deleteUsersByTenantId(Long tenantId) {
return R.fail("删除用户失败:" + throwable.getMessage());
}
}; };
} }
} }

@ -54,7 +54,7 @@ public class HwDictConstants {
public static final String DEVICE_DEFAULT_FLAG_YES = "1";//默认是 public static final String DEVICE_DEFAULT_FLAG_YES = "1";//默认是
public static final String DEVICE_DEFAULT_FLAG_NO = "0";//默认否 public static final String DEVICE_DEFAULT_FLAG_NO = "0";//默认否
public static final Long ADMINISTRATOR_TENANT_ID = 0L;//金瑞铭租户ID public static final Long ADMINISTRATOR_TENANT_ID = 1L;//金瑞铭租户ID
public static final String DEVICE_TYPE_GATEWAY_DEVICE = "1";//网关设备 public static final String DEVICE_TYPE_GATEWAY_DEVICE = "1";//网关设备
public static final String DEVICE_TYPE_GATEWAY_SUB_EQUIPMENT = "2";//网关子设备 public static final String DEVICE_TYPE_GATEWAY_SUB_EQUIPMENT = "2";//网关子设备
@ -100,5 +100,11 @@ public class HwDictConstants {
public static final String CONTROL_COMMAND_PAYLOAD_TYPE_KEY = "type"; public static final String CONTROL_COMMAND_PAYLOAD_TYPE_KEY = "type";
public static final String CONTROL_COMMAND_PAYLOAD_PARAM_KEY = "param"; public static final String CONTROL_COMMAND_PAYLOAD_PARAM_KEY = "param";
public static final String DEVICEMODE_GPS_FLAG_NO="0"; public static final String DEVICEMODE_GPS_FLAG_NO="0";//设备模型,非定位模型
public static final String TENANT_STATUS_NORMAL = "1";//租户状态:正常
public static final String TENANT_STATUS_DELETED = "9";//租户状态:正常
public static final String TENANT_IS_REGISTER_EXTERNAL = "0";//租户是否外部注册:否
} }

@ -4,6 +4,7 @@ package com.ruoyi.basic.service.impl;
import com.ruoyi.basic.api.domain.HwTenant; import com.ruoyi.basic.api.domain.HwTenant;
import com.ruoyi.basic.mapper.HwTenantMapper; import com.ruoyi.basic.mapper.HwTenantMapper;
import com.ruoyi.basic.service.IHwTenantService; import com.ruoyi.basic.service.IHwTenantService;
import com.ruoyi.common.core.constant.HwDictConstants;
import com.ruoyi.common.core.utils.DateUtils; import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -43,6 +44,7 @@ public class HwTenantServiceImpl implements IHwTenantService
@Override @Override
public List<HwTenant> selectHwTenantList(HwTenant hwTenant) public List<HwTenant> selectHwTenantList(HwTenant hwTenant)
{ {
hwTenant.setTenantStatus(HwDictConstants.TENANT_STATUS_NORMAL);
return hwTenantMapper.selectHwTenantList(hwTenant); return hwTenantMapper.selectHwTenantList(hwTenant);
} }

@ -5,6 +5,7 @@ import java.util.List;
import java.io.IOException; import java.io.IOException;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.constant.HwDictConstants;
import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.domain.SysUser; import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.model.LoginUser; import com.ruoyi.system.api.model.LoginUser;
@ -47,12 +48,7 @@ public class HwTenantController extends BaseController
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(HwTenant hwTenant) public TableDataInfo list(HwTenant hwTenant)
{ {
List<HwTenant> list = new ArrayList<HwTenant>(); return getDataTable(hwTenantService.selectHwTenantList(hwTenant));
startPage();
//todo 放到add中
list = hwTenantService.selectHwTenantList(hwTenant);
return getDataTable(list);
} }
/** /**
@ -86,10 +82,8 @@ public class HwTenantController extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@RequestBody HwTenant hwTenant) public AjaxResult add(@RequestBody HwTenant hwTenant)
{ {
LoginUser loginUser = SecurityUtils.getLoginUser(); hwTenant.setIsRegister(HwDictConstants.TENANT_IS_REGISTER_EXTERNAL);
SysUser sysUser = loginUser.getSysUser(); hwTenant.setCreateBy(SecurityUtils.getUsername());
hwTenant.setIsRegister("0");
hwTenant.setCreateBy(sysUser.getNickName());
return toAjax(hwTenantService.insertHwTenant(hwTenant)); return toAjax(hwTenantService.insertHwTenant(hwTenant));
} }
@ -100,10 +94,8 @@ public class HwTenantController extends BaseController
@Log(title = "租户信息", businessType = BusinessType.UPDATE) @Log(title = "租户信息", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody HwTenant hwTenant) public AjaxResult edit(@RequestBody HwTenant hwTenant)
{LoginUser loginUser = SecurityUtils.getLoginUser(); {
SysUser sysUser = loginUser.getSysUser(); hwTenant.setUpdateBy(SecurityUtils.getUsername());
hwTenant.setUpdateBy(sysUser.getNickName());
return toAjax(hwTenantService.updateHwTenant(hwTenant)); return toAjax(hwTenantService.updateHwTenant(hwTenant));
} }

@ -1,12 +1,20 @@
package com.ruoyi.business.service.impl; package com.ruoyi.business.service.impl;
import java.util.List; import com.ruoyi.business.domain.HwTenant;
import com.ruoyi.business.mapper.HwTenantMapper;
import com.ruoyi.business.service.IHwTenantService;
import com.ruoyi.common.core.constant.HwDictConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.common.core.utils.DateUtils; import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.datascope.annotation.DataScope;
import com.ruoyi.system.api.RemoteUserService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.HwTenantMapper; import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.business.domain.HwTenant;
import com.ruoyi.business.service.IHwTenantService; import javax.annotation.Resource;
import java.util.List;
/** /**
* Service * Service
@ -15,11 +23,13 @@ import com.ruoyi.business.service.IHwTenantService;
* @date 2023-09-04 * @date 2023-09-04
*/ */
@Service @Service
public class HwTenantServiceImpl implements IHwTenantService public class HwTenantServiceImpl implements IHwTenantService {
{
@Autowired @Autowired
private HwTenantMapper hwTenantMapper; private HwTenantMapper hwTenantMapper;
@Resource
private RemoteUserService remoteUserService;
/** /**
* *
* *
@ -27,8 +37,7 @@ public class HwTenantServiceImpl implements IHwTenantService
* @return * @return
*/ */
@Override @Override
public HwTenant selectHwTenantByTenantId(Long tenantId) public HwTenant selectHwTenantByTenantId(Long tenantId) {
{
return hwTenantMapper.selectHwTenantByTenantId(tenantId); return hwTenantMapper.selectHwTenantByTenantId(tenantId);
} }
@ -39,8 +48,9 @@ public class HwTenantServiceImpl implements IHwTenantService
* @return * @return
*/ */
@Override @Override
public List<HwTenant> selectHwTenantList(HwTenant hwTenant) @DataScope(tenantAlias = "ht")
{ public List<HwTenant> selectHwTenantList(HwTenant hwTenant) {
hwTenant.setTenantStatus(HwDictConstants.TENANT_STATUS_NORMAL);
return hwTenantMapper.selectHwTenantList(hwTenant); return hwTenantMapper.selectHwTenantList(hwTenant);
} }
@ -51,8 +61,7 @@ public class HwTenantServiceImpl implements IHwTenantService
* @return * @return
*/ */
@Override @Override
public int insertHwTenant(HwTenant hwTenant) public int insertHwTenant(HwTenant hwTenant) {
{
hwTenant.setCreateTime(DateUtils.getNowDate()); hwTenant.setCreateTime(DateUtils.getNowDate());
return hwTenantMapper.insertHwTenant(hwTenant); return hwTenantMapper.insertHwTenant(hwTenant);
} }
@ -64,8 +73,7 @@ public class HwTenantServiceImpl implements IHwTenantService
* @return * @return
*/ */
@Override @Override
public int updateHwTenant(HwTenant hwTenant) public int updateHwTenant(HwTenant hwTenant) {
{
hwTenant.setUpdateTime(DateUtils.getNowDate()); hwTenant.setUpdateTime(DateUtils.getNowDate());
return hwTenantMapper.updateHwTenant(hwTenant); return hwTenantMapper.updateHwTenant(hwTenant);
} }
@ -77,9 +85,24 @@ public class HwTenantServiceImpl implements IHwTenantService
* @return * @return
*/ */
@Override @Override
public int deleteHwTenantByTenantIds(Long[] tenantIds) @Transactional
{ public int deleteHwTenantByTenantIds(Long[] tenantIds) {
return hwTenantMapper.deleteHwTenantByTenantIds(tenantIds); for (Long tenantId : tenantIds) {
if(tenantId.equals(HwDictConstants.ADMINISTRATOR_TENANT_ID)){
throw new ServiceException("管理租户不能删除");
}
R<?> deleteResult = this.remoteUserService.deleteUsersByTenantId(tenantId);
if (R.FAIL == deleteResult.getCode()) {
throw new ServiceException(deleteResult.getMsg());
}
HwTenant tenant = hwTenantMapper.selectHwTenantByTenantId(tenantId);
tenant.setTenantStatus(HwDictConstants.TENANT_STATUS_DELETED);
hwTenantMapper.updateHwTenant(tenant);
}
return 1;
} }
/** /**
@ -89,8 +112,7 @@ public class HwTenantServiceImpl implements IHwTenantService
* @return * @return
*/ */
@Override @Override
public int deleteHwTenantByTenantId(Long tenantId) public int deleteHwTenantByTenantId(Long tenantId) {
{
return hwTenantMapper.deleteHwTenantByTenantId(tenantId); return hwTenantMapper.deleteHwTenantByTenantId(tenantId);
} }
} }

@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectHwTenantVo"> <sql id="selectHwTenantVo">
select tenant_id, tenant_type, tenant_name, tenant_industry, contact_name, contact_phone, email, area_id, contact_address, remark, tenant_status, is_register, create_by, create_time, update_by, update_time, tenant_grade, tenant_field from hw_tenant select tenant_id, tenant_type, tenant_name, tenant_industry, contact_name, contact_phone, email, area_id, contact_address, remark, tenant_status, is_register, create_by, create_time, update_by, update_time, tenant_grade, tenant_field from hw_tenant ht
</sql> </sql>
<select id="selectHwTenantList" parameterType="HwTenant" resultMap="HwTenantResult"> <select id="selectHwTenantList" parameterType="HwTenant" resultMap="HwTenantResult">
@ -44,7 +44,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isRegister != null and isRegister != ''"> and is_register = #{isRegister}</if> <if test="isRegister != null and isRegister != ''"> and is_register = #{isRegister}</if>
<if test="tenantGrade != null "> and tenant_grade = #{tenantGrade}</if> <if test="tenantGrade != null "> and tenant_grade = #{tenantGrade}</if>
<if test="tenantField != null and tenantField != ''"> and tenant_field = #{tenantField}</if> <if test="tenantField != null and tenantField != ''"> and tenant_field = #{tenantField}</if>
<!-- 租户数据范围过滤 -->
${params.tenantDataScope}
</where> </where>
order by ht.tenant_id desc
</select> </select>
<select id="selectHwTenantByTenantId" parameterType="Long" resultMap="HwTenantResult"> <select id="selectHwTenantByTenantId" parameterType="Long" resultMap="HwTenantResult">

@ -1,26 +1,7 @@
package com.ruoyi.system.controller; package com.ruoyi.system.controller;
import java.io.IOException;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.basic.api.RemoteBasicService; import com.ruoyi.basic.api.RemoteBasicService;
import com.ruoyi.system.domain.SysPost; import com.ruoyi.common.core.constant.HwDictConstants;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.utils.poi.ExcelUtil; import com.ruoyi.common.core.utils.poi.ExcelUtil;
@ -36,12 +17,20 @@ import com.ruoyi.system.api.domain.SysDept;
import com.ruoyi.system.api.domain.SysRole; import com.ruoyi.system.api.domain.SysRole;
import com.ruoyi.system.api.domain.SysUser; import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.model.LoginUser; import com.ruoyi.system.api.model.LoginUser;
import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.service.ISysDeptService; import com.ruoyi.system.service.*;
import com.ruoyi.system.service.ISysPermissionService; import org.apache.commons.lang3.ArrayUtils;
import com.ruoyi.system.service.ISysPostService; import org.springframework.beans.factory.annotation.Autowired;
import com.ruoyi.system.service.ISysRoleService; import org.springframework.validation.annotation.Validated;
import com.ruoyi.system.service.ISysUserService; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/** /**
* *
@ -223,7 +212,8 @@ public class SysUserController extends BaseController {
user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser loginSysUser = loginUser.getSysUser(); SysUser loginSysUser = loginUser.getSysUser();
if(!loginSysUser.getTenantId().equals(0L)){ //如果不是admin的租户则就保存为登录用户的租户id如果是adimin则需要保存admin在创建时选择的租户ID
if(!loginSysUser.getTenantId().equals(HwDictConstants.ADMINISTRATOR_TENANT_ID)){
user.setTenantId(loginSysUser.getTenantId()); user.setTenantId(loginSysUser.getTenantId());
} }
@ -336,10 +326,32 @@ public class SysUserController extends BaseController {
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser user = loginUser.getSysUser(); SysUser user = loginUser.getSysUser();
Long tenantId = user.getTenantId(); Long tenantId = user.getTenantId();
if (tenantId.equals(0L)) { if (tenantId.equals(HwDictConstants.ADMINISTRATOR_TENANT_ID)) {
return success(remoteBasicService.getTenants().getData()); return success(remoteBasicService.getTenants().getData());
} else { } else {
return success(); return success();
} }
} }
/**
* ID
*/
@PostMapping("/deleteUsersByTenantId/{tenantId}")
public R<Boolean> deleteUsersByTenantId(@PathVariable Long tenantId) {
Long[] userIds = userService.getUserIdsByTenantId(tenantId);
if(userIds.length == 0) {
return R.ok();
}
if (ArrayUtils.contains(userIds, SecurityUtils.getUserId())) {
return R.fail("当前用户不能删除");
}
try{
userService.deleteUserByIds(userIds);
return R.ok();
}catch(Exception e){
return R.fail(e.getMessage());
}
}
} }

@ -203,4 +203,13 @@ public interface ISysUserService
* @return * @return
*/ */
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName); public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName);
/**
* @param: tenantId
* @description IDID
* @author xins
* @date 2023-09-27 10:08
* @return Long[]
*/
public Long[] getUserIdsByTenantId(Long tenantId);
} }

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.validation.Validator; import javax.validation.Validator;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -36,8 +37,7 @@ import com.ruoyi.system.service.ISysUserService;
* @author ruoyi * @author ruoyi
*/ */
@Service @Service
public class SysUserServiceImpl implements ISysUserService public class SysUserServiceImpl implements ISysUserService {
{
private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class); private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class);
@Autowired @Autowired
@ -69,8 +69,7 @@ public class SysUserServiceImpl implements ISysUserService
*/ */
@Override @Override
@DataScope(deptAlias = "d", userAlias = "u", tenantAlias = "u") @DataScope(deptAlias = "d", userAlias = "u", tenantAlias = "u")
public List<SysUser> selectUserList(SysUser user) public List<SysUser> selectUserList(SysUser user) {
{
return userMapper.selectUserList(user); return userMapper.selectUserList(user);
} }
@ -82,8 +81,7 @@ public class SysUserServiceImpl implements ISysUserService
*/ */
@Override @Override
@DataScope(deptAlias = "d", userAlias = "u") @DataScope(deptAlias = "d", userAlias = "u")
public List<SysUser> selectAllocatedList(SysUser user) public List<SysUser> selectAllocatedList(SysUser user) {
{
return userMapper.selectAllocatedList(user); return userMapper.selectAllocatedList(user);
} }
@ -95,8 +93,7 @@ public class SysUserServiceImpl implements ISysUserService
*/ */
@Override @Override
@DataScope(deptAlias = "d", userAlias = "u") @DataScope(deptAlias = "d", userAlias = "u")
public List<SysUser> selectUnallocatedList(SysUser user) public List<SysUser> selectUnallocatedList(SysUser user) {
{
return userMapper.selectUnallocatedList(user); return userMapper.selectUnallocatedList(user);
} }
@ -107,8 +104,7 @@ public class SysUserServiceImpl implements ISysUserService
* @return * @return
*/ */
@Override @Override
public SysUser selectUserByUserName(String userName) public SysUser selectUserByUserName(String userName) {
{
return userMapper.selectUserByUserName(userName); return userMapper.selectUserByUserName(userName);
} }
@ -119,8 +115,7 @@ public class SysUserServiceImpl implements ISysUserService
* @return * @return
*/ */
@Override @Override
public SysUser selectUserById(Long userId) public SysUser selectUserById(Long userId) {
{
return userMapper.selectUserById(userId); return userMapper.selectUserById(userId);
} }
@ -131,11 +126,9 @@ public class SysUserServiceImpl implements ISysUserService
* @return * @return
*/ */
@Override @Override
public String selectUserRoleGroup(String userName) public String selectUserRoleGroup(String userName) {
{
List<SysRole> list = roleMapper.selectRolesByUserName(userName); List<SysRole> list = roleMapper.selectRolesByUserName(userName);
if (CollectionUtils.isEmpty(list)) if (CollectionUtils.isEmpty(list)) {
{
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }
return list.stream().map(SysRole::getRoleName).collect(Collectors.joining(",")); return list.stream().map(SysRole::getRoleName).collect(Collectors.joining(","));
@ -148,11 +141,9 @@ public class SysUserServiceImpl implements ISysUserService
* @return * @return
*/ */
@Override @Override
public String selectUserPostGroup(String userName) public String selectUserPostGroup(String userName) {
{
List<SysPost> list = postMapper.selectPostsByUserName(userName); List<SysPost> list = postMapper.selectPostsByUserName(userName);
if (CollectionUtils.isEmpty(list)) if (CollectionUtils.isEmpty(list)) {
{
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }
return list.stream().map(SysPost::getPostName).collect(Collectors.joining(",")); return list.stream().map(SysPost::getPostName).collect(Collectors.joining(","));
@ -165,12 +156,10 @@ public class SysUserServiceImpl implements ISysUserService
* @return * @return
*/ */
@Override @Override
public boolean checkUserNameUnique(SysUser user) public boolean checkUserNameUnique(SysUser user) {
{
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId(); Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
SysUser info = userMapper.checkUserNameUnique(user.getUserName()); SysUser info = userMapper.checkUserNameUnique(user.getUserName());
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
{
return UserConstants.NOT_UNIQUE; return UserConstants.NOT_UNIQUE;
} }
return UserConstants.UNIQUE; return UserConstants.UNIQUE;
@ -183,12 +172,10 @@ public class SysUserServiceImpl implements ISysUserService
* @return * @return
*/ */
@Override @Override
public boolean checkPhoneUnique(SysUser user) public boolean checkPhoneUnique(SysUser user) {
{
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId(); Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber()); SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber());
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
{
return UserConstants.NOT_UNIQUE; return UserConstants.NOT_UNIQUE;
} }
return UserConstants.UNIQUE; return UserConstants.UNIQUE;
@ -201,12 +188,10 @@ public class SysUserServiceImpl implements ISysUserService
* @return * @return
*/ */
@Override @Override
public boolean checkEmailUnique(SysUser user) public boolean checkEmailUnique(SysUser user) {
{
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId(); Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
SysUser info = userMapper.checkEmailUnique(user.getEmail()); SysUser info = userMapper.checkEmailUnique(user.getEmail());
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
{
return UserConstants.NOT_UNIQUE; return UserConstants.NOT_UNIQUE;
} }
return UserConstants.UNIQUE; return UserConstants.UNIQUE;
@ -218,10 +203,8 @@ public class SysUserServiceImpl implements ISysUserService
* @param user * @param user
*/ */
@Override @Override
public void checkUserAllowed(SysUser user) public void checkUserAllowed(SysUser user) {
{ if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin()) {
if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin())
{
throw new ServiceException("不允许操作超级管理员用户"); throw new ServiceException("不允许操作超级管理员用户");
} }
} }
@ -232,15 +215,12 @@ public class SysUserServiceImpl implements ISysUserService
* @param userId id * @param userId id
*/ */
@Override @Override
public void checkUserDataScope(Long userId) public void checkUserDataScope(Long userId) {
{ if (!SysUser.isAdmin(SecurityUtils.getUserId())) {
if (!SysUser.isAdmin(SecurityUtils.getUserId()))
{
SysUser user = new SysUser(); SysUser user = new SysUser();
user.setUserId(userId); user.setUserId(userId);
List<SysUser> users = SpringUtils.getAopProxy(this).selectUserList(user); List<SysUser> users = SpringUtils.getAopProxy(this).selectUserList(user);
if (StringUtils.isEmpty(users)) if (StringUtils.isEmpty(users)) {
{
throw new ServiceException("没有权限访问用户数据!"); throw new ServiceException("没有权限访问用户数据!");
} }
} }
@ -254,8 +234,7 @@ public class SysUserServiceImpl implements ISysUserService
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int insertUser(SysUser user) public int insertUser(SysUser user) {
{
// 新增用户信息 // 新增用户信息
int rows = userMapper.insertUser(user); int rows = userMapper.insertUser(user);
// 新增用户岗位关联 // 新增用户岗位关联
@ -272,8 +251,7 @@ public class SysUserServiceImpl implements ISysUserService
* @return * @return
*/ */
@Override @Override
public boolean registerUser(SysUser user) public boolean registerUser(SysUser user) {
{
return userMapper.insertUser(user) > 0; return userMapper.insertUser(user) > 0;
} }
@ -285,8 +263,7 @@ public class SysUserServiceImpl implements ISysUserService
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int updateUser(SysUser user) public int updateUser(SysUser user) {
{
Long userId = user.getUserId(); Long userId = user.getUserId();
// 删除用户与角色关联 // 删除用户与角色关联
userRoleMapper.deleteUserRoleByUserId(userId); userRoleMapper.deleteUserRoleByUserId(userId);
@ -307,8 +284,7 @@ public class SysUserServiceImpl implements ISysUserService
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void insertUserAuth(Long userId, Long[] roleIds) public void insertUserAuth(Long userId, Long[] roleIds) {
{
userRoleMapper.deleteUserRoleByUserId(userId); userRoleMapper.deleteUserRoleByUserId(userId);
insertUserRole(userId, roleIds); insertUserRole(userId, roleIds);
} }
@ -320,8 +296,7 @@ public class SysUserServiceImpl implements ISysUserService
* @return * @return
*/ */
@Override @Override
public int updateUserStatus(SysUser user) public int updateUserStatus(SysUser user) {
{
return userMapper.updateUser(user); return userMapper.updateUser(user);
} }
@ -332,8 +307,7 @@ public class SysUserServiceImpl implements ISysUserService
* @return * @return
*/ */
@Override @Override
public int updateUserProfile(SysUser user) public int updateUserProfile(SysUser user) {
{
return userMapper.updateUser(user); return userMapper.updateUser(user);
} }
@ -345,8 +319,7 @@ public class SysUserServiceImpl implements ISysUserService
* @return * @return
*/ */
@Override @Override
public boolean updateUserAvatar(String userName, String avatar) public boolean updateUserAvatar(String userName, String avatar) {
{
return userMapper.updateUserAvatar(userName, avatar) > 0; return userMapper.updateUserAvatar(userName, avatar) > 0;
} }
@ -357,8 +330,7 @@ public class SysUserServiceImpl implements ISysUserService
* @return * @return
*/ */
@Override @Override
public int resetPwd(SysUser user) public int resetPwd(SysUser user) {
{
return userMapper.updateUser(user); return userMapper.updateUser(user);
} }
@ -370,8 +342,7 @@ public class SysUserServiceImpl implements ISysUserService
* @return * @return
*/ */
@Override @Override
public int resetUserPwd(String userName, String password) public int resetUserPwd(String userName, String password) {
{
return userMapper.resetUserPwd(userName, password); return userMapper.resetUserPwd(userName, password);
} }
@ -380,8 +351,7 @@ public class SysUserServiceImpl implements ISysUserService
* *
* @param user * @param user
*/ */
public void insertUserRole(SysUser user) public void insertUserRole(SysUser user) {
{
this.insertUserRole(user.getUserId(), user.getRoleIds()); this.insertUserRole(user.getUserId(), user.getRoleIds());
} }
@ -390,15 +360,12 @@ public class SysUserServiceImpl implements ISysUserService
* *
* @param user * @param user
*/ */
public void insertUserPost(SysUser user) public void insertUserPost(SysUser user) {
{
Long[] posts = user.getPostIds(); Long[] posts = user.getPostIds();
if (StringUtils.isNotEmpty(posts)) if (StringUtils.isNotEmpty(posts)) {
{
// 新增用户与岗位管理 // 新增用户与岗位管理
List<SysUserPost> list = new ArrayList<SysUserPost>(); List<SysUserPost> list = new ArrayList<SysUserPost>();
for (Long postId : posts) for (Long postId : posts) {
{
SysUserPost up = new SysUserPost(); SysUserPost up = new SysUserPost();
up.setUserId(user.getUserId()); up.setUserId(user.getUserId());
up.setPostId(postId); up.setPostId(postId);
@ -414,14 +381,11 @@ public class SysUserServiceImpl implements ISysUserService
* @param userId ID * @param userId ID
* @param roleIds * @param roleIds
*/ */
public void insertUserRole(Long userId, Long[] roleIds) public void insertUserRole(Long userId, Long[] roleIds) {
{ if (StringUtils.isNotEmpty(roleIds)) {
if (StringUtils.isNotEmpty(roleIds))
{
// 新增用户与角色管理 // 新增用户与角色管理
List<SysUserRole> list = new ArrayList<SysUserRole>(); List<SysUserRole> list = new ArrayList<SysUserRole>();
for (Long roleId : roleIds) for (Long roleId : roleIds) {
{
SysUserRole ur = new SysUserRole(); SysUserRole ur = new SysUserRole();
ur.setUserId(userId); ur.setUserId(userId);
ur.setRoleId(roleId); ur.setRoleId(roleId);
@ -439,8 +403,7 @@ public class SysUserServiceImpl implements ISysUserService
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int deleteUserById(Long userId) public int deleteUserById(Long userId) {
{
// 删除用户与角色关联 // 删除用户与角色关联
userRoleMapper.deleteUserRoleByUserId(userId); userRoleMapper.deleteUserRoleByUserId(userId);
// 删除用户与岗位表 // 删除用户与岗位表
@ -456,10 +419,8 @@ public class SysUserServiceImpl implements ISysUserService
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int deleteUserByIds(Long[] userIds) public int deleteUserByIds(Long[] userIds) {
{ for (Long userId : userIds) {
for (Long userId : userIds)
{
checkUserAllowed(new SysUser(userId)); checkUserAllowed(new SysUser(userId));
checkUserDataScope(userId); checkUserDataScope(userId);
} }
@ -479,10 +440,8 @@ public class SysUserServiceImpl implements ISysUserService
* @return * @return
*/ */
@Override @Override
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName) public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName) {
{ if (StringUtils.isNull(userList) || userList.size() == 0) {
if (StringUtils.isNull(userList) || userList.size() == 0)
{
throw new ServiceException("导入用户数据不能为空!"); throw new ServiceException("导入用户数据不能为空!");
} }
int successNum = 0; int successNum = 0;
@ -490,23 +449,18 @@ public class SysUserServiceImpl implements ISysUserService
StringBuilder successMsg = new StringBuilder(); StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder(); StringBuilder failureMsg = new StringBuilder();
String password = configService.selectConfigByKey("sys.user.initPassword"); String password = configService.selectConfigByKey("sys.user.initPassword");
for (SysUser user : userList) for (SysUser user : userList) {
{ try {
try
{
// 验证是否存在这个用户 // 验证是否存在这个用户
SysUser u = userMapper.selectUserByUserName(user.getUserName()); SysUser u = userMapper.selectUserByUserName(user.getUserName());
if (StringUtils.isNull(u)) if (StringUtils.isNull(u)) {
{
BeanValidators.validateWithException(validator, user); BeanValidators.validateWithException(validator, user);
user.setPassword(SecurityUtils.encryptPassword(password)); user.setPassword(SecurityUtils.encryptPassword(password));
user.setCreateBy(operName); user.setCreateBy(operName);
userMapper.insertUser(user); userMapper.insertUser(user);
successNum++; successNum++;
successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功"); successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功");
} } else if (isUpdateSupport) {
else if (isUpdateSupport)
{
BeanValidators.validateWithException(validator, user); BeanValidators.validateWithException(validator, user);
checkUserAllowed(u); checkUserAllowed(u);
checkUserDataScope(u.getUserId()); checkUserDataScope(u.getUserId());
@ -515,31 +469,43 @@ public class SysUserServiceImpl implements ISysUserService
userMapper.updateUser(user); userMapper.updateUser(user);
successNum++; successNum++;
successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 更新成功"); successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 更新成功");
} } else {
else
{
failureNum++; failureNum++;
failureMsg.append("<br/>" + failureNum + "、账号 " + user.getUserName() + " 已存在"); failureMsg.append("<br/>" + failureNum + "、账号 " + user.getUserName() + " 已存在");
} }
} } catch (Exception e) {
catch (Exception e)
{
failureNum++; failureNum++;
String msg = "<br/>" + failureNum + "、账号 " + user.getUserName() + " 导入失败:"; String msg = "<br/>" + failureNum + "、账号 " + user.getUserName() + " 导入失败:";
failureMsg.append(msg + e.getMessage()); failureMsg.append(msg + e.getMessage());
log.error(msg, e); log.error(msg, e);
} }
} }
if (failureNum > 0) if (failureNum > 0) {
{
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new ServiceException(failureMsg.toString()); throw new ServiceException(failureMsg.toString());
} } else {
else
{
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
} }
return successMsg.toString(); return successMsg.toString();
} }
/**
* @param: tenantId
* @description IDID
* @author xins
* @date 2023-09-27 10:08
* @return Long[]
*/
@Override
public Long[] getUserIdsByTenantId(Long tenantId) {
SysUser queryUser = new SysUser();
queryUser.setTenantId(tenantId);
List<SysUser> users = userMapper.selectUserList(queryUser);
if (users != null && !users.isEmpty()) {
return users.stream().
map(SysUser::getUserId).toArray(Long[]::new);
}
return new Long[0];
}
} }

@ -66,6 +66,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null and userId != 0"> <if test="userId != null and userId != 0">
AND u.user_id = #{userId} AND u.user_id = #{userId}
</if> </if>
<if test="tenantId != null and tenantId != 0">
AND u.tenant_id = #{tenantId}
</if>
<if test="userName != null and userName != ''"> <if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%') AND u.user_name like concat('%', #{userName}, '%')
</if> </if>

@ -1,17 +1,17 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="88px">
<!-- <el-form-item label="行业类型关联sys_dict_data的dict_type是hw_tenant_industry的dict_value" prop="tenantIndustry">--> <el-form-item label="租户名称" prop="tenantName">
<!-- <el-input--> <el-input
<!-- v-model="queryParams.tenantIndustry"--> v-model="queryParams.tenantName"
<!-- placeholder="请输入行业类型关联sys_dict_data的dict_type是hw_tenant_industry的dict_value"--> placeholder="请输入租户名称"
<!-- clearable--> clearable
<!-- @keyup.enter.native="handleQuery"--> @keyup.enter.native="handleQuery"
<!-- />--> />
<!-- </el-form-item>--> </el-form-item>
<el-form-item label="租户类型" prop="tenantType"> <el-form-item label="租户类型" prop="tenantType">
<el-select v-model="queryParams.tenantType" placeholder="租户类型"> <el-select v-model="queryParams.tenantType" placeholder="租户类型" clearable>
<el-option <el-option
v-for="dict in dict.type.hw_tenant_type" v-for="dict in dict.type.hw_tenant_type"
:key ="dict.value" :key ="dict.value"
@ -20,14 +20,7 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="租户名称" prop="tenantName">
<el-input
v-model="queryParams.tenantName"
placeholder="请输入租户名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="联系人姓名" prop="contactName"> <el-form-item label="联系人姓名" prop="contactName">
<el-input <el-input
v-model="queryParams.contactName" v-model="queryParams.contactName"
@ -44,54 +37,7 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<!-- <el-form-item label="邮箱地址" prop="email">-->
<!-- <el-input-->
<!-- v-model="queryParams.email"-->
<!-- placeholder="请输入邮箱地址"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="区域ID管理区域hw_area" prop="areaId">-->
<!-- <el-input-->
<!-- v-model="queryParams.areaId"-->
<!-- placeholder="请输入区域ID管理区域hw_area"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="联系人地址" prop="contactAddress">-->
<!-- <el-input-->
<!-- v-model="queryParams.contactAddress"-->
<!-- placeholder="请输入联系人地址"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="是否外部注册" prop="isRegister">-->
<!-- <el-input-->
<!-- v-model="queryParams.isRegister"-->
<!-- placeholder="请输入是否外部注册"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="租户等级,预留字段" prop="tenantGrade">-->
<!-- <el-input-->
<!-- v-model="queryParams.tenantGrade"-->
<!-- placeholder="请输入租户等级,预留字段"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="预留字段" prop="tenantField">-->
<!-- <el-input-->
<!-- v-model="queryParams.tenantField"-->
<!-- placeholder="请输入预留字段"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
@ -146,7 +92,7 @@
<el-table v-loading="loading" :data="tenantList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="tenantList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="租户ID" align="center" prop="tenantId" />--> <el-table-column label="租户ID" align="center" prop="tenantId" />
<el-table-column label="租户名称" align="center" prop="tenantName" /> <el-table-column label="租户名称" align="center" prop="tenantName" />
<el-table-column label="租户类型" align="center" prop="tenantType"> <el-table-column label="租户类型" align="center" prop="tenantType">
<template slot-scope="scope"> <template slot-scope="scope">
@ -172,13 +118,7 @@
<el-table-column label="联系人姓名" align="center" prop="contactName" /> <el-table-column label="联系人姓名" align="center" prop="contactName" />
<el-table-column label="联系人电话" align="center" prop="contactPhone" /> <el-table-column label="联系人电话" align="center" prop="contactPhone" />
<el-table-column label="邮箱地址" align="center" prop="email" /> <el-table-column label="邮箱地址" align="center" prop="email" />
<!-- <el-table-column label="区域ID管理区域hw_area" align="center" prop="areaId" />-->
<el-table-column label="联系人地址" align="center" prop="contactAddress" /> <el-table-column label="联系人地址" align="center" prop="contactAddress" />
<!-- <el-table-column label="描述" align="center" prop="remark" />-->
<!-- <el-table-column label="状态" align="center" prop="tenantStatus" />-->
<!-- <el-table-column label="是否外部注册" align="center" prop="isRegister" />-->
<!-- <el-table-column label="租户等级,预留字段" align="center" prop="tenantGrade" />-->
<!-- <el-table-column label="预留字段" align="center" prop="tenantField" />-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
@ -261,29 +201,10 @@
</el-col> </el-col>
</el-row> </el-row>
<!-- <el-form-item label="行业类型关联sys_dict_data的dict_type是hw_tenant_industry的dict_value" prop="tenantIndustry">-->
<!-- <el-input v-model="form.tenantIndustry" placeholder="请输入行业类型关联sys_dict_data的dict_type是hw_tenant_industry的dict_value" />-->
<!-- </el-form-item>-->
<!-- 区域ID管理区域hw_area-->
<el-form-item label="描述" prop="remark"> <el-form-item label="描述" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" /> <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item> </el-form-item>
<!-- <el-form-item label="是否外部注册" prop="isRegister">-->
<!-- <el-input v-model="form.isRegister" placeholder="请输入是否外部注册" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="租户等级,预留字段" prop="tenantGrade">-->
<!-- <el-input v-model="form.tenantGrade" placeholder="请输入租户等级,预留字段" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="预留字段" prop="tenantField">-->
<!-- <el-input v-model="form.tenantField" placeholder="请输入预留字段" />-->
<!-- </el-form-item>-->
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
@ -351,14 +272,20 @@ export default {
{ required: true, message: "联系人姓名不能为空", trigger: "blur" } { required: true, message: "联系人姓名不能为空", trigger: "blur" }
], ],
contactPhone: [ contactPhone: [
{ required: true, message: "联系人电话不能为空", trigger: "blur" } { required: true, message: "手机号码不能为空", trigger: "blur" },
{
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: "请输入正确的手机号码",
trigger: "blur"
}
],
email: [
{
type: "email",
message: "请输入正确的邮箱地址",
trigger: ["blur", "change"]
}
], ],
// tenantStatus: [
// { required: true, message: "", trigger: "change" }
// ],
// isRegister: [
// { required: true, message: "", trigger: "blur" }
// ],
} }
}; };
}, },
@ -366,8 +293,6 @@ export default {
this.getList(); this.getList();
}, },
methods: { methods: {
/** 查询租户信息列表 */ /** 查询租户信息列表 */
getList() { getList() {
this.loading = true; this.loading = true;
@ -462,7 +387,7 @@ export default {
// /** */ // /** */
handleDelete(row) { handleDelete(row) {
const tenantIds = row.tenantId || this.ids; const tenantIds = row.tenantId || this.ids;
this.$modal.confirm('是否确认删除租户名称为"' + row.tenantName + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除租户ID为"' + tenantIds + '"的数据项?').then(function() {
return delTenant(tenantIds); return delTenant(tenantIds);
}).then(() => { }).then(() => {
this.getList(); this.getList();
@ -480,25 +405,3 @@ export default {
</script> </script>
<a-form-item label="测站类型">
<a-select
allowClear
v-decorator="[
'typeId',
{ rules: [{ required: true, message: '请选择测站类型' }] },
]"
placeholder="请选择测站类型"
>
<a-select-option
v-for="(item, index) in $attrs.testList"
:value="String(item.id)"
:key="index"
>
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>

Loading…
Cancel
Save