pull/122/head
877617829 2023-06-15 23:42:02 +08:00
commit 6d85c7dae7
6 changed files with 78 additions and 36 deletions

View File

@ -5,9 +5,9 @@
@visibleChange="batchVisibleChange"
@confirm="deleteBatch"
>
<a-button :type="props.buttonType" :danger="props.buttonDanger">
<a-button :type="props.buttonType" :danger="props.buttonDanger" :size="props.size" :loading="buttonLoading">
<template #icon v-if="props.icon">
<component :is="props.icon" />
<component :is="props.icon" :style="{ color: props.color }" />
</template>
{{ props.buttonName }}
</a-button>
@ -18,6 +18,7 @@
import { message } from 'ant-design-vue'
const batchVisible = ref(false)
const emit = defineEmits({ batchCallBack: null })
const buttonLoading = ref(false)
const props = defineProps({
buttonName: {
type: String,
@ -35,9 +36,17 @@
type: String,
default: () => ''
},
size: {
type: String,
default: () => 'middle'
},
selectedRowKeys: {
type: Array,
default: () => []
},
color: {
type: String,
default: () => ''
}
})
//
@ -64,4 +73,12 @@
//
emit('batchCallBack', params)
}
// loading
const loading = () => {
buttonLoading.value = true
}
// loading
const closeLoading = () => {
buttonLoading.value = true
}
</script>

View File

@ -5,11 +5,11 @@
name="file"
:action="action"
:headers="headers"
:maxCount="props.uploadMumber"
:maxCount="props.uploadNumber"
@change="handleChange"
>
<a-button>
<upload-outlined></upload-outlined>
<upload-outlined />
上传
</a-button>
</a-upload>
@ -21,11 +21,11 @@
:multiple="true"
:action="action"
:headers="headers"
:maxCount="props.uploadMumber"
:maxCount="props.uploadNumber"
@change="handleChange"
>
<p class="ant-upload-drag-icon">
<inbox-outlined></inbox-outlined>
<inbox-outlined />
</p>
<p class="ant-upload-text">单击或拖动文件到此区域上传</p>
<p class="ant-upload-hint"></p>
@ -53,7 +53,7 @@
required: false
},
//
uploadMumber: {
uploadNumber: {
type: Number,
default: 1,
required: false
@ -61,11 +61,13 @@
})
const action = sysConfig.API_URL + props.action
// 使
const handleChange = () => {
// 使
let result = []
for (let a = 0; a < props.uploadMumber; a++) {
for (let a = 0; a < props.uploadNumber; a++) {
const file = fileList.value[a]
if (file.status === 'done' && file.response && file.response.code === 200) {
if (file && file.status === 'done' && file.response && file.response.code === 200) {
const resultObj = {
name: file.name,
url: file.response.data
@ -77,4 +79,27 @@
emit('uploadDone', result)
}
}
// DOM
const uploadFileList = () => {
if (fileList.value) {
const result = []
//
fileList.value.forEach((item) => {
const obj = {
name: item.name,
type: item.type,
size: item.size,
url: item.response.data
}
result.push(obj)
})
return result
} else {
return []
}
}
//
defineExpose({
uploadFileList
})
</script>

View File

@ -116,7 +116,6 @@ service.interceptors.response.use(
'update',
'grant',
'reset',
'start',
'stop',
'pass',
'disable',
@ -126,7 +125,8 @@ service.interceptors.response.use(
'active',
'turn',
'adjust',
'reject'
'reject',
'saveDraft'
]
apiNameArray.forEach((apiName) => {
if (responseUrl.includes(apiName)) {

View File

@ -186,7 +186,7 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
throw new CommonException("手机号码:{}格式错误", bizUserAddParam.getPhone());
}
if (this.count(new LambdaQueryWrapper<BizUser>()
.eq(BizUser::getPhone, bizUserAddParam.getPhone())) > 0) {
.eq(BizUser::getPhone, CommonCryptogramUtil.doSm4CbcEncrypt(bizUserAddParam.getPhone()))) > 0) {
throw new CommonException("存在重复的手机号,手机号为:{}", bizUserAddParam.getPhone());
}
}
@ -240,7 +240,7 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
throw new CommonException("手机号码:{}格式错误", bizUserEditParam.getPhone());
}
if (this.count(new LambdaQueryWrapper<BizUser>()
.eq(BizUser::getPhone, bizUserEditParam.getPhone())
.eq(BizUser::getPhone, CommonCryptogramUtil.doSm4CbcEncrypt(bizUserEditParam.getPhone()))
.ne(BizUser::getId, bizUserEditParam.getId())) > 0) {
throw new CommonException("存在重复的手机号,手机号为:{}", bizUserEditParam.getPhone());
}

View File

@ -147,7 +147,7 @@ public class ClientUserServiceImpl extends ServiceImpl<ClientUserMapper, ClientU
throw new CommonException("手机号码:{}格式错误", clientUserAddParam.getPhone());
}
if (this.count(new LambdaQueryWrapper<ClientUser>()
.eq(ClientUser::getPhone, clientUserAddParam.getPhone())) > 0) {
.eq(ClientUser::getPhone, CommonCryptogramUtil.doSm4CbcEncrypt(clientUserAddParam.getPhone()))) > 0) {
throw new CommonException("存在重复的手机号,手机号为:{}", clientUserAddParam.getPhone());
}
}
@ -181,7 +181,7 @@ public class ClientUserServiceImpl extends ServiceImpl<ClientUserMapper, ClientU
throw new CommonException("手机号码:{}格式错误", clientUserEditParam.getPhone());
}
if (this.count(new LambdaQueryWrapper<ClientUser>()
.eq(ClientUser::getPhone, clientUserEditParam.getPhone())
.eq(ClientUser::getPhone, CommonCryptogramUtil.doSm4CbcEncrypt(clientUserEditParam.getPhone()))
.ne(ClientUser::getId, clientUserEditParam.getId())) > 0) {
throw new CommonException("存在重复的手机号,手机号为:{}", clientUserEditParam.getPhone());
}

View File

@ -264,7 +264,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
throw new CommonException("手机号码:{}格式错误", sysUserAddParam.getPhone());
}
if (this.count(new LambdaQueryWrapper<SysUser>()
.eq(SysUser::getPhone, sysUserAddParam.getPhone())) > 0) {
.eq(SysUser::getPhone, CommonCryptogramUtil.doSm4CbcEncrypt(sysUserAddParam.getPhone()))) > 0) {
throw new CommonException("存在重复的手机号,手机号为:{}", sysUserAddParam.getPhone());
}
}
@ -307,7 +307,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
throw new CommonException("手机号码:{}格式错误", sysUserEditParam.getPhone());
}
if (this.count(new LambdaQueryWrapper<SysUser>()
.eq(SysUser::getPhone, sysUserEditParam.getPhone())
.eq(SysUser::getPhone, CommonCryptogramUtil.doSm4CbcEncrypt(sysUserEditParam.getPhone()))
.ne(SysUser::getId, sysUserEditParam.getId())) > 0) {
throw new CommonException("存在重复的手机号,手机号为:{}", sysUserEditParam.getPhone());
}
@ -784,30 +784,30 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
@Override
public void grantResource(SysUserGrantResourceParam sysUserGrantResourceParam) {
String id = sysUserGrantResourceParam.getId();
SysUserIdParam sysUserIdParam = new SysUserIdParam();
List<String> roleIdList = this.ownRole(sysUserIdParam);
if(ObjectUtil.isEmpty(roleIdList)) {
throw new CommonException("非超管角色用户不可被授权系统模块菜单资源");
}
boolean hasSuperAdminRole = sysRoleService.listByIds(roleIdList).stream().map(SysRole::getCode).collect(Collectors.toSet())
.contains(SysBuildInEnum.BUILD_IN_ROLE_CODE.getValue());
List<String> menuIdList = sysUserGrantResourceParam.getGrantInfoList().stream()
.map(SysUserGrantResourceParam.SysUserGrantResource::getMenuId).collect(Collectors.toList());
if(!hasSuperAdminRole) {
if(ObjectUtil.isNotEmpty(menuIdList)) {
Set<String> sysModuleIdList = sysMenuService.listByIds(menuIdList).stream().map(SysMenu::getModule).collect(Collectors.toSet());
boolean containsSystemModule = sysModuleService.listByIds(sysModuleIdList).stream().map(SysModule::getCode)
.collect(Collectors.toSet()).contains(SysBuildInEnum.BUILD_IN_MODULE_CODE.getValue());
if(containsSystemModule) {
if(ObjectUtil.isNotEmpty(menuIdList)) {
SysUserIdParam sysUserIdParam = new SysUserIdParam();
sysUserIdParam.setId(sysUserGrantResourceParam.getId());
List<String> roleIdList = this.ownRole(sysUserIdParam);
Set<String> sysModuleIdList = sysMenuService.listByIds(menuIdList).stream().map(SysMenu::getModule).collect(Collectors.toSet());
boolean containsSystemModule = sysModuleService.listByIds(sysModuleIdList).stream().map(SysModule::getCode)
.collect(Collectors.toSet()).contains(SysBuildInEnum.BUILD_IN_MODULE_CODE.getValue());
if(containsSystemModule) {
if(ObjectUtil.isEmpty(roleIdList)) {
throw new CommonException("非超管角色用户不可被授权系统模块菜单资源");
} else {
boolean hasSuperAdminRole = sysRoleService.listByIds(roleIdList).stream().map(SysRole::getCode).collect(Collectors.toSet())
.contains(SysBuildInEnum.BUILD_IN_ROLE_CODE.getValue());
if(!hasSuperAdminRole) {
throw new CommonException("非超管角色用户不可被授权系统模块菜单资源");
}
}
}
List<String> extJsonList = sysUserGrantResourceParam.getGrantInfoList().stream()
.map(JSONUtil::toJsonStr).collect(Collectors.toList());
sysRelationService.saveRelationBatchWithClear(sysUserGrantResourceParam.getId(), menuIdList, SysRelationCategoryEnum.SYS_USER_HAS_RESOURCE.getValue(), extJsonList);
}
List<String> extJsonList = sysUserGrantResourceParam.getGrantInfoList().stream()
.map(JSONUtil::toJsonStr).collect(Collectors.toList());
sysRelationService.saveRelationBatchWithClear(id, menuIdList, SysRelationCategoryEnum.SYS_USER_HAS_RESOURCE.getValue(),
extJsonList);
}
@Override
@ -858,7 +858,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
throw new CommonException("手机号码:{}格式错误", sysUserUpdateInfoParam.getPhone());
}
if (this.count(new LambdaQueryWrapper<SysUser>().ne(SysUser::getId, sysUser.getId())
.eq(SysUser::getPhone, sysUserUpdateInfoParam.getPhone())) > 0) {
.eq(SysUser::getPhone, CommonCryptogramUtil.doSm4CbcEncrypt(sysUserUpdateInfoParam.getPhone()))) > 0) {
throw new CommonException("存在重复的手机号,手机号为:{}", sysUserUpdateInfoParam.getPhone());
}
}