mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-09-17 10:56:39 +08:00
v3.14.0 更新;【新增】EasyExcel重磅升级为FastExcel;【新增】使用最强Argon2算法作为密码存储;【新增】大家吐槽的数据字典改为可重复;【新增】前端布局再增加多种样式;【优化】升级SaToken到最新版本;【优化】token使用Sa-Token的Bearer类型;【优化】优化其他
This commit is contained in:
parent
5553aac514
commit
eeb9c569de
@ -34,10 +34,11 @@
|
||||
<commons-io.version>2.15.0</commons-io.version>
|
||||
<commons-lang3.version>3.12.0</commons-lang3.version>
|
||||
<commons-collections4.version>4.4</commons-collections4.version>
|
||||
<commons-compress.version>1.26.0</commons-compress.version>
|
||||
<commons-codec.version>1.13</commons-codec.version>
|
||||
<commons-text.version>1.9</commons-text.version>
|
||||
<xerces.version>2.12.0</xerces.version>
|
||||
<easy-excel.version>3.3.2</easy-excel.version>
|
||||
<fast-excel.version>1.0.0</fast-excel.version>
|
||||
<poi.version>5.2.4</poi.version>
|
||||
<ooxml-schemas.version>1.4</ooxml-schemas.version>
|
||||
<aws-java-sdk.version>1.11.842</aws-java-sdk.version>
|
||||
@ -164,6 +165,12 @@
|
||||
<version>${commons-collections4.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>${commons-compress.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<groupId>commons-codec</groupId>
|
||||
@ -248,13 +255,13 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>${easy-excel.version}</version>
|
||||
<groupId>cn.idev.excel</groupId>
|
||||
<artifactId>fastexcel</artifactId>
|
||||
<version>${fast-excel.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
@ -2,8 +2,8 @@ package net.lab1024.sa.admin.interceptor;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.dev33.satoken.exception.SaTokenException;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.dev33.satoken.strategy.SaStrategy;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
@ -14,14 +14,9 @@ import net.lab1024.sa.admin.module.system.login.service.LoginService;
|
||||
import net.lab1024.sa.base.common.annoation.NoNeedLogin;
|
||||
import net.lab1024.sa.base.common.code.SystemErrorCode;
|
||||
import net.lab1024.sa.base.common.code.UserErrorCode;
|
||||
import net.lab1024.sa.base.common.constant.StringConst;
|
||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||
import net.lab1024.sa.base.common.domain.SystemEnvironment;
|
||||
import net.lab1024.sa.base.common.enumeration.SystemEnvironmentEnum;
|
||||
import net.lab1024.sa.base.common.enumeration.UserTypeEnum;
|
||||
import net.lab1024.sa.base.common.util.SmartRequestUtil;
|
||||
import net.lab1024.sa.base.common.util.SmartResponseUtil;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -47,9 +42,6 @@ public class AdminInterceptor implements HandlerInterceptor {
|
||||
@Resource
|
||||
private LoginService loginService;
|
||||
|
||||
@Resource
|
||||
private SystemEnvironment systemEnvironment;
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
|
||||
@ -68,17 +60,7 @@ public class AdminInterceptor implements HandlerInterceptor {
|
||||
// --------------- 第一步: 根据token 获取用户 ---------------
|
||||
|
||||
String tokenValue = StpUtil.getTokenValue();
|
||||
boolean debugNumberTokenFlag = isDevDebugNumberToken(tokenValue);
|
||||
|
||||
String loginId = null;
|
||||
if (debugNumberTokenFlag) {
|
||||
//开发、测试环境,且为数字的话,则表明为 调试临时用户,即需要调用 sa-token switch
|
||||
loginId = UserTypeEnum.ADMIN_EMPLOYEE.getValue() + StringConst.COLON + tokenValue;
|
||||
StpUtil.switchTo(loginId);
|
||||
} else {
|
||||
loginId = (String) StpUtil.getLoginIdByToken(tokenValue);
|
||||
}
|
||||
|
||||
String loginId = (String) StpUtil.getLoginIdByToken(tokenValue);
|
||||
RequestEmployee requestEmployee = loginService.getLoginEmployee(loginId, request);
|
||||
|
||||
// --------------- 第二步: 校验 登录 ---------------
|
||||
@ -86,7 +68,7 @@ public class AdminInterceptor implements HandlerInterceptor {
|
||||
Method method = ((HandlerMethod) handler).getMethod();
|
||||
NoNeedLogin noNeedLogin = ((HandlerMethod) handler).getMethodAnnotation(NoNeedLogin.class);
|
||||
if (noNeedLogin != null) {
|
||||
checkActiveTimeout(requestEmployee, debugNumberTokenFlag);
|
||||
checkActiveTimeout(requestEmployee);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -96,7 +78,7 @@ public class AdminInterceptor implements HandlerInterceptor {
|
||||
}
|
||||
|
||||
// 检测token 活跃频率
|
||||
checkActiveTimeout(requestEmployee, debugNumberTokenFlag);
|
||||
checkActiveTimeout(requestEmployee);
|
||||
|
||||
|
||||
// --------------- 第三步: 校验 权限 ---------------
|
||||
@ -143,12 +125,7 @@ public class AdminInterceptor implements HandlerInterceptor {
|
||||
/**
|
||||
* 检测:token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结
|
||||
*/
|
||||
private void checkActiveTimeout(RequestEmployee requestEmployee, boolean debugNumberTokenFlag) {
|
||||
|
||||
// 对于开发环境的 数字 debug token ,不需要检测活跃有效期
|
||||
if (debugNumberTokenFlag) {
|
||||
return;
|
||||
}
|
||||
private void checkActiveTimeout(RequestEmployee requestEmployee) {
|
||||
|
||||
// 用户不在线,也不用检测
|
||||
if (requestEmployee == null) {
|
||||
@ -160,28 +137,11 @@ public class AdminInterceptor implements HandlerInterceptor {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 是否为开发使用的 debug token
|
||||
*
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
private boolean isDevDebugNumberToken(String token) {
|
||||
if (!StrUtil.isNumeric(token)) {
|
||||
return false;
|
||||
}
|
||||
return systemEnvironment.getCurrentEnvironment() == SystemEnvironmentEnum.DEV
|
||||
|| systemEnvironment.getCurrentEnvironment() == SystemEnvironmentEnum.TEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
||||
// 清除上下文
|
||||
SmartRequestUtil.remove();
|
||||
// 开发环境,关闭 sa token 的临时切换用户
|
||||
if (systemEnvironment.getCurrentEnvironment() == SystemEnvironmentEnum.DEV) {
|
||||
StpUtil.endSwitch();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.lab1024.sa.admin.module.business.goods.domain.form;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.lab1024.sa.admin.module.business.goods.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
@ -4,7 +4,6 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import net.lab1024.sa.admin.module.business.goods.constant.GoodsStatusEnum;
|
||||
import net.lab1024.sa.base.common.json.serializer.DictValueVoSerializer;
|
||||
import net.lab1024.sa.base.common.swagger.SchemaEnum;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@ -32,7 +31,6 @@ public class GoodsVO {
|
||||
private Integer goodsStatus;
|
||||
|
||||
@Schema(description = "产地")
|
||||
@JsonSerialize(using = DictValueVoSerializer.class)
|
||||
private String place;
|
||||
|
||||
@Schema(description = "商品价格")
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.lab1024.sa.admin.module.business.goods.service;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import cn.idev.excel.FastExcel;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import jakarta.annotation.Resource;
|
||||
@ -174,7 +174,7 @@ public class GoodsService {
|
||||
public ResponseDTO<String> importGoods(MultipartFile file) {
|
||||
List<GoodsImportForm> dataList;
|
||||
try {
|
||||
dataList = EasyExcel.read(file.getInputStream()).head(GoodsImportForm.class)
|
||||
dataList = FastExcel.read(file.getInputStream()).head(GoodsImportForm.class)
|
||||
.sheet()
|
||||
.doReadSync();
|
||||
} catch (IOException e) {
|
||||
@ -194,12 +194,13 @@ public class GoodsService {
|
||||
*/
|
||||
public List<GoodsExcelVO> getAllGoods() {
|
||||
List<GoodsEntity> goodsEntityList = goodsDao.selectList(null);
|
||||
String keyCode="GODOS_PLACE";
|
||||
return goodsEntityList.stream()
|
||||
.map(e ->
|
||||
GoodsExcelVO.builder()
|
||||
.goodsStatus(SmartEnumUtil.getEnumDescByValue(e.getGoodsStatus(), GoodsStatusEnum.class))
|
||||
.categoryName(categoryQueryService.queryCategoryName(e.getCategoryId()))
|
||||
.place(Arrays.stream(e.getPlace().split(",")).map(code -> dictCacheService.selectValueNameByValueCode(code)).collect(Collectors.joining(",")))
|
||||
.place(Arrays.stream(e.getPlace().split(",")).map(code -> dictCacheService.selectValueNameByValueCode(keyCode,code)).collect(Collectors.joining(",")))
|
||||
.price(e.getPrice())
|
||||
.goodsName(e.getGoodsName())
|
||||
.remark(e.getRemark())
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
|
@ -56,7 +56,6 @@ public class DataScopeViewService {
|
||||
if (DataScopeViewTypeEnum.DEPARTMENT_AND_SUB == viewType) {
|
||||
return this.getDepartmentAndSubEmployeeIdList(employeeId);
|
||||
}
|
||||
// 可以查看所有员工数据
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
|
||||
|
@ -59,8 +59,8 @@ public class LoginController {
|
||||
|
||||
@Operation(summary = "退出登陆 @author 卓大")
|
||||
@GetMapping("/login/logout")
|
||||
public ResponseDTO<String> logout(@RequestHeader(value = RequestHeaderConst.TOKEN, required = false) String token) {
|
||||
return loginService.logout(token, SmartRequestUtil.getRequestUser());
|
||||
public ResponseDTO<String> logout() {
|
||||
return loginService.logout(SmartRequestUtil.getRequestUser());
|
||||
}
|
||||
|
||||
@Operation(summary = "获取验证码 @author 卓大")
|
||||
|
@ -376,10 +376,10 @@ public class LoginService implements StpInterface {
|
||||
/**
|
||||
* 退出登录
|
||||
*/
|
||||
public ResponseDTO<String> logout(String token, RequestUser requestUser) {
|
||||
public ResponseDTO<String> logout(RequestUser requestUser) {
|
||||
|
||||
// sa token 登出
|
||||
StpUtil.logoutByTokenValue(token);
|
||||
StpUtil.logout();
|
||||
|
||||
// 清空登录信息缓存
|
||||
loginEmployeeCache.remove(requestUser.getUserId());
|
||||
|
@ -19,9 +19,8 @@
|
||||
|
||||
<select id="selectMenuListByRoleIdList"
|
||||
resultType="net.lab1024.sa.admin.module.system.menu.domain.entity.MenuEntity">
|
||||
|
||||
SELECT
|
||||
t_menu.*
|
||||
distinct t_menu.*
|
||||
from t_menu
|
||||
left join t_role_menu on t_role_menu.menu_id = t_menu.menu_id
|
||||
<where>
|
||||
@ -35,8 +34,6 @@
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
group by t_menu.menu_id
|
||||
ORDER BY t_menu.sort ASC
|
||||
|
||||
</select>
|
||||
</mapper>
|
@ -177,6 +177,11 @@
|
||||
<artifactId>commons-io</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
@ -213,8 +218,14 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<groupId>cn.idev.excel</groupId>
|
||||
<artifactId>fastexcel</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -11,7 +11,7 @@ package net.lab1024.sa.base.common.constant;
|
||||
*/
|
||||
public class RequestHeaderConst {
|
||||
|
||||
public static final String TOKEN = "x-access-token";
|
||||
public static final String TOKEN = "Authorization";
|
||||
|
||||
public static final String USER_AGENT = "user-agent";
|
||||
|
||||
|
@ -1,52 +0,0 @@
|
||||
package net.lab1024.sa.base.common.json.serializer;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import com.google.common.collect.Lists;
|
||||
import jakarta.annotation.Resource;
|
||||
import net.lab1024.sa.base.module.support.dict.domain.vo.DictValueVO;
|
||||
import net.lab1024.sa.base.module.support.dict.service.DictCacheService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典序列化
|
||||
*
|
||||
* @Author 1024创新实验室: 罗伊
|
||||
* @Date 2022-08-12 22:17:53
|
||||
* @Wechat zhuoda1024
|
||||
* @Email lab1024@163.com
|
||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||
*/
|
||||
public class DictValueVoSerializer extends JsonSerializer<String> {
|
||||
|
||||
@Resource
|
||||
private DictCacheService dictCacheService;
|
||||
|
||||
|
||||
@Override
|
||||
public void serialize(String value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
|
||||
if (StringUtils.isEmpty(value)) {
|
||||
jsonGenerator.writeObject(Lists.newArrayList());
|
||||
return;
|
||||
}
|
||||
|
||||
String[] valueCodeArray = value.split(",");
|
||||
List<String> valueCodeList = Arrays.asList(valueCodeArray);
|
||||
List<DictValueVO> dictValueVOList = Lists.newArrayList();
|
||||
valueCodeList.forEach(e->{
|
||||
if(StringUtils.isNotBlank(e)){
|
||||
DictValueVO dictValueVO = dictCacheService.selectValueByValueCode(e);
|
||||
if(dictValueVO != null){
|
||||
dictValueVOList.add(dictValueVO);
|
||||
}
|
||||
}
|
||||
});
|
||||
jsonGenerator.writeObject(dictValueVOList);
|
||||
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
package net.lab1024.sa.base.common.util;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.write.handler.SheetWriteHandler;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder;
|
||||
import cn.idev.excel.FastExcel;
|
||||
import cn.idev.excel.write.handler.SheetWriteHandler;
|
||||
import cn.idev.excel.write.metadata.holder.WriteSheetHolder;
|
||||
import cn.idev.excel.write.metadata.holder.WriteWorkbookHolder;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -43,7 +43,7 @@ public final class SmartExcelUtil {
|
||||
// 设置下载消息头
|
||||
SmartResponseUtil.setDownloadFileHeader(response, fileName, null);
|
||||
// 下载
|
||||
EasyExcel.write(response.getOutputStream(), head)
|
||||
FastExcel.write(response.getOutputStream(), head)
|
||||
.autoCloseStream(Boolean.FALSE)
|
||||
.sheet(sheetName)
|
||||
.doWrite(data);
|
||||
@ -58,7 +58,7 @@ public final class SmartExcelUtil {
|
||||
// 水印
|
||||
Watermark watermark = new Watermark(watermarkString);
|
||||
// 一定要inMemory
|
||||
EasyExcel.write(response.getOutputStream(), head)
|
||||
FastExcel.write(response.getOutputStream(), head)
|
||||
.inMemory(true)
|
||||
.sheet(sheetName)
|
||||
.registerWriteHandler(new CustomWaterMarkHandler(watermark))
|
||||
|
@ -77,7 +77,7 @@ public class SwaggerConfig {
|
||||
|
||||
private Components components() {
|
||||
return new Components()
|
||||
.addSecuritySchemes(RequestHeaderConst.TOKEN, new SecurityScheme().type(SecurityScheme.Type.APIKEY).in(SecurityScheme.In.HEADER).name(RequestHeaderConst.TOKEN));
|
||||
.addSecuritySchemes(RequestHeaderConst.TOKEN, new SecurityScheme().scheme("Bearer").description("请输入token,格式为[Bearer xxxxxxxx]").type(SecurityScheme.Type.APIKEY).in(SecurityScheme.In.HEADER).name(RequestHeaderConst.TOKEN));
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
@ -18,5 +18,5 @@ import java.lang.annotation.Target;
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface DataTracerFieldDict {
|
||||
|
||||
|
||||
String keyCode() default "";
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ public class DataTracerChangeContentService {
|
||||
fieldContent = SmartEnumUtil.getEnumDescByValue(fieldValue, dataTracerFieldEnum.enumClass());
|
||||
}
|
||||
} else if (dataTracerFieldDict != null) {
|
||||
fieldContent = dictCacheService.selectValueNameByValueCodeSplit(fieldValue.toString());
|
||||
fieldContent = dictCacheService.selectValueNameByValueCodeSplit(dataTracerFieldDict.keyCode(), fieldValue.toString());
|
||||
} else if (dataTracerFieldSql != null) {
|
||||
fieldContent = this.getRelateDisplayValue(fieldValue, dataTracerFieldSql);
|
||||
} else if (fieldValue instanceof Date) {
|
||||
|
@ -52,5 +52,5 @@ public interface DictValueDao extends BaseMapper<DictValueEntity> {
|
||||
* 跟进code查询
|
||||
*
|
||||
*/
|
||||
DictValueEntity selectByCode(@Param("valueCode") String valueCode, @Param("deletedFlag") Boolean deletedFlag);
|
||||
DictValueEntity selectByCode(@Param("dictKeyId") Long dictKeyId,@Param("valueCode") String valueCode, @Param("deletedFlag") Boolean deletedFlag);
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -41,8 +42,6 @@ public class DictCacheService {
|
||||
|
||||
private ConcurrentHashMap<String, List<DictValueVO>> DICT_CACHE = new ConcurrentHashMap<>();
|
||||
|
||||
private ConcurrentHashMap<String, DictValueVO> VALUE_CACHE = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
@PostConstruct
|
||||
public void dictCache() {
|
||||
@ -63,10 +62,6 @@ public class DictCacheService {
|
||||
Long dictKeyId = dictKeyEntity.getDictKeyId();
|
||||
DICT_CACHE.put(keyCode, valueListMap.getOrDefault(dictKeyId, Lists.newArrayList()));
|
||||
}
|
||||
//字典值缓存
|
||||
dictValueVOList.forEach(e -> {
|
||||
VALUE_CACHE.put(e.getValueCode(), e);
|
||||
});
|
||||
log.info("################# 数据字典缓存初始化完毕 ###################");
|
||||
}
|
||||
|
||||
@ -75,7 +70,6 @@ public class DictCacheService {
|
||||
*/
|
||||
public ResponseDTO<String> cacheRefresh() {
|
||||
DICT_CACHE.clear();
|
||||
VALUE_CACHE.clear();
|
||||
this.cacheInit();
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
@ -92,37 +86,45 @@ public class DictCacheService {
|
||||
|
||||
/**
|
||||
* 查询值code名称
|
||||
*
|
||||
* @param keyCode
|
||||
* @param valueCode
|
||||
* @return
|
||||
*/
|
||||
public String selectValueNameByValueCode(String valueCode) {
|
||||
if (StrUtil.isEmpty(valueCode)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
DictValueVO dictValueVO = VALUE_CACHE.get(valueCode);
|
||||
if (dictValueVO == null) {
|
||||
public String selectValueNameByValueCode(String keyCode, String valueCode) {
|
||||
DictValueVO dictValueVO = this.selectValueByValueCode(keyCode, valueCode);
|
||||
if (dictValueVO == null){
|
||||
return "";
|
||||
}
|
||||
return dictValueVO.getValueName();
|
||||
return dictValueVO.getValueName()
|
||||
;
|
||||
}
|
||||
|
||||
public DictValueVO selectValueByValueCode(String valueCode) {
|
||||
public DictValueVO selectValueByValueCode(String keyCode, String valueCode) {
|
||||
if (StrUtil.isEmpty(valueCode)) {
|
||||
return null;
|
||||
}
|
||||
return VALUE_CACHE.get(valueCode);
|
||||
}
|
||||
if (StrUtil.isEmpty(keyCode)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String selectValueNameByValueCodeSplit(String valueCodes) {
|
||||
List<DictValueVO> dictValueVOList = DICT_CACHE.get(valueCode);
|
||||
if (CollectionUtils.isEmpty(dictValueVOList)) {
|
||||
return null;
|
||||
}
|
||||
Optional<DictValueVO> option = dictValueVOList.stream().filter(e->e.getValueCode().equals(valueCode)).findFirst();
|
||||
if(option.isPresent()){
|
||||
return option.get();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public String selectValueNameByValueCodeSplit(String keyCode, String valueCodes) {
|
||||
if (StrUtil.isEmpty(valueCodes)) {
|
||||
return "";
|
||||
}
|
||||
List<String> valueNameList = Lists.newArrayList();
|
||||
String[] valueCodeArray = valueCodes.split(",");
|
||||
for (String valueCode : valueCodeArray) {
|
||||
DictValueVO dictValueVO = VALUE_CACHE.get(valueCode);
|
||||
DictValueVO dictValueVO = this.selectValueByValueCode(keyCode, valueCode);
|
||||
if (dictValueVO != null) {
|
||||
valueNameList.add(dictValueVO.getValueName());
|
||||
}
|
||||
@ -130,4 +132,4 @@ public class DictCacheService {
|
||||
return StringUtils.join(valueNameList, ",");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public class DictService {
|
||||
* @return
|
||||
*/
|
||||
public synchronized ResponseDTO<String> valueAdd(DictValueAddForm valueAddForm) {
|
||||
DictValueEntity dictValueEntity = dictValueDao.selectByCode(valueAddForm.getValueCode(), false);
|
||||
DictValueEntity dictValueEntity = dictValueDao.selectByCode(valueAddForm.getDictKeyId(),valueAddForm.getValueCode(), false);
|
||||
if (dictValueEntity != null) {
|
||||
return ResponseDTO.error(UserErrorCode.ALREADY_EXIST);
|
||||
}
|
||||
@ -106,7 +106,7 @@ public class DictService {
|
||||
if (dictKeyEntity == null || dictKeyEntity.getDeletedFlag()) {
|
||||
return ResponseDTO.userErrorParam("key不能存在");
|
||||
}
|
||||
DictValueEntity dictValueEntity = dictValueDao.selectByCode(valueUpdateForm.getValueCode(), false);
|
||||
DictValueEntity dictValueEntity = dictValueDao.selectByCode(valueUpdateForm.getDictKeyId(),valueUpdateForm.getValueCode(), false);
|
||||
if (dictValueEntity != null && !dictValueEntity.getDictValueId().equals(valueUpdateForm.getDictValueId())) {
|
||||
return ResponseDTO.error(UserErrorCode.ALREADY_EXIST);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.lab1024.sa.base.module.support.securityprotect.service;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import jakarta.annotation.Resource;
|
||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||
import org.apache.tika.config.TikaConfig;
|
||||
@ -17,7 +18,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 三级等保 文件上传 相关
|
||||
* 三级等保 文件 相关
|
||||
*
|
||||
* @Author 1024创新实验室-主任:卓大
|
||||
* @Date 2024/08/22 19:25:59
|
||||
@ -27,6 +28,7 @@ import java.util.List;
|
||||
*/
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class SecurityFileService {
|
||||
|
||||
@Resource
|
||||
@ -96,6 +98,7 @@ public class SecurityFileService {
|
||||
MediaType mimetype = tika.getDetector().detect(stream, metadata);
|
||||
return mimetype.toString();
|
||||
} catch (IOException | TikaException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return MimeTypes.OCTET_STREAM;
|
||||
}
|
||||
}
|
||||
|
@ -35,10 +35,8 @@ public class SecurityPasswordService {
|
||||
|
||||
public static final String PASSWORD_FORMAT_MSG = "密码必须为长度8-20位且必须包含大小写字母、数字、特殊符号(如:@#$%^&*()_+-=)等三种字符";
|
||||
|
||||
|
||||
private static final int PASSWORD_LENGTH = 8;
|
||||
|
||||
private static final String PASSWORD_SALT_FORMAT = "smart_%s_admin_$^&*";
|
||||
|
||||
|
||||
@Resource
|
||||
@ -47,7 +45,7 @@ public class SecurityPasswordService {
|
||||
@Resource
|
||||
private Level3ProtectConfigService level3ProtectConfigService;
|
||||
|
||||
static Argon2PasswordEncoder encoder = Argon2PasswordEncoder.defaultsForSpringSecurity_v5_8();
|
||||
static Argon2PasswordEncoder ARGON2_PASSWORD_ENCODER = Argon2PasswordEncoder.defaultsForSpringSecurity_v5_8();
|
||||
|
||||
/**
|
||||
* 校验密码复杂度
|
||||
@ -87,7 +85,7 @@ public class SecurityPasswordService {
|
||||
|
||||
// 检查最近几次是否有重复密码
|
||||
List<String> oldPasswords = passwordLogDao.selectOldPassword(requestUser.getUserType().getValue(), requestUser.getUserId(), level3ProtectConfigService.getRegularChangePasswordNotAllowRepeatTimes());
|
||||
boolean isDuplicate = oldPasswords.stream().anyMatch(oldPassword -> encoder.matches(newPassword, oldPassword));
|
||||
boolean isDuplicate = oldPasswords.stream().anyMatch(oldPassword -> ARGON2_PASSWORD_ENCODER.matches(newPassword, oldPassword));
|
||||
if (isDuplicate) {
|
||||
return ResponseDTO.userErrorParam(String.format("与前%d个历史密码重复,请换个密码!", level3ProtectConfigService.getRegularChangePasswordNotAllowRepeatTimes()));
|
||||
}
|
||||
@ -147,14 +145,14 @@ public class SecurityPasswordService {
|
||||
* 获取 加密后 的密码
|
||||
*/
|
||||
public static String getEncryptPwd(String password) {
|
||||
return encoder.encode(password);
|
||||
return ARGON2_PASSWORD_ENCODER.encode(password);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验密码是否匹配
|
||||
*/
|
||||
public static Boolean matchesPwd( String password, String encodedPassword){
|
||||
return encoder.matches( password, encodedPassword);
|
||||
return ARGON2_PASSWORD_ENCODER.matches( password, encodedPassword);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -132,7 +132,9 @@ reload:
|
||||
# sa-token 配置
|
||||
sa-token:
|
||||
# token 名称(同时也是 cookie 名称)
|
||||
token-name: x-access-token
|
||||
token-name: Authorization
|
||||
# token 前缀 例如:Bearer
|
||||
token-prefix: Bearer
|
||||
# token 有效期(单位:秒) 默认30天(2592000秒),-1 代表永久有效
|
||||
timeout: 2592000
|
||||
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
<select id="selectByCode"
|
||||
resultType="net.lab1024.sa.base.module.support.dict.domain.entity.DictValueEntity">
|
||||
select * from t_dict_value where value_code = #{valueCode} and deleted_flag = #{deletedFlag}
|
||||
select * from t_dict_value where dict_Key_id = #{dictKeyId} and value_code = #{valueCode} and deleted_flag = #{deletedFlag}
|
||||
</select>
|
||||
|
||||
<select id="selectByDeletedFlag"
|
||||
|
@ -132,7 +132,9 @@ reload:
|
||||
# sa-token 配置
|
||||
sa-token:
|
||||
# token 名称(同时也是 cookie 名称)
|
||||
token-name: x-access-token
|
||||
token-name: Authorization
|
||||
# token 前缀 例如:Bear
|
||||
token-prefix: Bearer
|
||||
# token 有效期(单位:秒) 默认30天(2592000秒),-1 代表永久有效
|
||||
timeout: 2592000
|
||||
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结
|
||||
|
@ -129,7 +129,9 @@ reload:
|
||||
# sa-token 配置
|
||||
sa-token:
|
||||
# token 名称(同时也是 cookie 名称)
|
||||
token-name: x-access-token
|
||||
token-name: Authorization
|
||||
# token 前缀 例如:Bear
|
||||
token-prefix: Bearer
|
||||
# token 有效期(单位:秒) 默认30天(2592000秒),-1 代表永久有效
|
||||
timeout: 2592000
|
||||
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结
|
||||
|
@ -132,7 +132,9 @@ reload:
|
||||
# sa-token 配置
|
||||
sa-token:
|
||||
# token 名称(同时也是 cookie 名称)
|
||||
token-name: x-access-token
|
||||
token-name: Authorization
|
||||
# token 前缀 例如:Bear
|
||||
token-prefix: Bearer
|
||||
# token 有效期(单位:秒) 默认30天(2592000秒),-1 代表永久有效
|
||||
timeout: 2592000
|
||||
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结
|
||||
|
@ -1 +0,0 @@
|
||||
# Smart Admin API
|
@ -36,10 +36,11 @@
|
||||
<commons-io.version>2.15.0</commons-io.version>
|
||||
<commons-lang3.version>3.12.0</commons-lang3.version>
|
||||
<commons-collections4.version>4.4</commons-collections4.version>
|
||||
<commons-compress.version>1.26.0</commons-compress.version>
|
||||
<commons-codec.version>1.13</commons-codec.version>
|
||||
<commons-text.version>1.9</commons-text.version>
|
||||
<xerces.version>2.12.0</xerces.version>
|
||||
<easy-excel.version>3.3.2</easy-excel.version>
|
||||
<fast-excel.version>1.0.0</fast-excel.version>
|
||||
<poi.version>5.2.4</poi.version>
|
||||
<ooxml-schemas.version>1.4</ooxml-schemas.version>
|
||||
<aws-java-sdk.version>1.11.842</aws-java-sdk.version>
|
||||
@ -189,6 +190,12 @@
|
||||
<version>${commons-collections4.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>${commons-compress.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<groupId>commons-codec</groupId>
|
||||
@ -274,13 +281,13 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>${easy-excel.version}</version>
|
||||
<groupId>cn.idev.excel</groupId>
|
||||
<artifactId>fastexcel</artifactId>
|
||||
<version>${fast-excel.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
@ -4,21 +4,15 @@ import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.dev33.satoken.exception.SaTokenException;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.dev33.satoken.strategy.SaStrategy;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.lab1024.sa.admin.module.system.login.domain.RequestEmployee;
|
||||
import net.lab1024.sa.admin.module.system.login.service.LoginService;
|
||||
import net.lab1024.sa.base.common.annoation.NoNeedLogin;
|
||||
import net.lab1024.sa.base.common.code.SystemErrorCode;
|
||||
import net.lab1024.sa.base.common.code.UserErrorCode;
|
||||
import net.lab1024.sa.base.common.constant.StringConst;
|
||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||
import net.lab1024.sa.base.common.domain.SystemEnvironment;
|
||||
import net.lab1024.sa.base.common.enumeration.SystemEnvironmentEnum;
|
||||
import net.lab1024.sa.base.common.enumeration.UserTypeEnum;
|
||||
import net.lab1024.sa.base.common.util.SmartRequestUtil;
|
||||
import net.lab1024.sa.base.common.util.SmartResponseUtil;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -47,9 +41,6 @@ public class AdminInterceptor implements HandlerInterceptor {
|
||||
@Resource
|
||||
private LoginService loginService;
|
||||
|
||||
@Resource
|
||||
private SystemEnvironment systemEnvironment;
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
|
||||
@ -68,17 +59,7 @@ public class AdminInterceptor implements HandlerInterceptor {
|
||||
// --------------- 第一步: 根据token 获取用户 ---------------
|
||||
|
||||
String tokenValue = StpUtil.getTokenValue();
|
||||
boolean debugNumberTokenFlag = isDevDebugNumberToken(tokenValue);
|
||||
|
||||
String loginId = null;
|
||||
if (debugNumberTokenFlag) {
|
||||
//开发、测试环境,且为数字的话,则表明为 调试临时用户,即需要调用 sa-token switch
|
||||
loginId = UserTypeEnum.ADMIN_EMPLOYEE.getValue() + StringConst.COLON + tokenValue;
|
||||
StpUtil.switchTo(loginId);
|
||||
} else {
|
||||
loginId = (String) StpUtil.getLoginIdByToken(tokenValue);
|
||||
}
|
||||
|
||||
String loginId = (String) StpUtil.getLoginIdByToken(tokenValue);
|
||||
RequestEmployee requestEmployee = loginService.getLoginEmployee(loginId, request);
|
||||
|
||||
// --------------- 第二步: 校验 登录 ---------------
|
||||
@ -86,7 +67,7 @@ public class AdminInterceptor implements HandlerInterceptor {
|
||||
Method method = ((HandlerMethod) handler).getMethod();
|
||||
NoNeedLogin noNeedLogin = ((HandlerMethod) handler).getMethodAnnotation(NoNeedLogin.class);
|
||||
if (noNeedLogin != null) {
|
||||
checkActiveTimeout(requestEmployee, debugNumberTokenFlag);
|
||||
checkActiveTimeout(requestEmployee);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -96,7 +77,7 @@ public class AdminInterceptor implements HandlerInterceptor {
|
||||
}
|
||||
|
||||
// 检测token 活跃频率
|
||||
checkActiveTimeout(requestEmployee, debugNumberTokenFlag);
|
||||
checkActiveTimeout(requestEmployee);
|
||||
|
||||
|
||||
// --------------- 第三步: 校验 权限 ---------------
|
||||
@ -143,13 +124,7 @@ public class AdminInterceptor implements HandlerInterceptor {
|
||||
/**
|
||||
* 检测:token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结
|
||||
*/
|
||||
private void checkActiveTimeout(RequestEmployee requestEmployee, boolean debugNumberTokenFlag) {
|
||||
|
||||
// 对于开发环境的 数字 debug token ,不需要检测活跃有效期
|
||||
if (debugNumberTokenFlag) {
|
||||
return;
|
||||
}
|
||||
|
||||
private void checkActiveTimeout(RequestEmployee requestEmployee) {
|
||||
// 用户不在线,也不用检测
|
||||
if (requestEmployee == null) {
|
||||
return;
|
||||
@ -160,29 +135,9 @@ public class AdminInterceptor implements HandlerInterceptor {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 是否为开发使用的 debug token
|
||||
*
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
private boolean isDevDebugNumberToken(String token) {
|
||||
if (!StrUtil.isNumeric(token)) {
|
||||
return false;
|
||||
}
|
||||
return systemEnvironment.getCurrentEnvironment() == SystemEnvironmentEnum.DEV
|
||||
|| systemEnvironment.getCurrentEnvironment() == SystemEnvironmentEnum.TEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
||||
// 清除上下文
|
||||
SmartRequestUtil.remove();
|
||||
// 开发环境,关闭 sa token 的临时切换用户
|
||||
if (systemEnvironment.getCurrentEnvironment() == SystemEnvironmentEnum.DEV) {
|
||||
StpUtil.endSwitch();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package net.lab1024.sa.admin.module.business.goods.domain.form;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.lab1024.sa.admin.module.business.goods.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
@ -4,7 +4,6 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import net.lab1024.sa.admin.module.business.goods.constant.GoodsStatusEnum;
|
||||
import net.lab1024.sa.base.common.json.serializer.DictValueVoSerializer;
|
||||
import net.lab1024.sa.base.common.swagger.SchemaEnum;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@ -32,7 +31,6 @@ public class GoodsVO {
|
||||
private Integer goodsStatus;
|
||||
|
||||
@Schema(description = "产地")
|
||||
@JsonSerialize(using = DictValueVoSerializer.class)
|
||||
private String place;
|
||||
|
||||
@Schema(description = "商品价格")
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.lab1024.sa.admin.module.business.goods.service;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import cn.idev.excel.FastExcel;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -174,7 +174,7 @@ public class GoodsService {
|
||||
public ResponseDTO<String> importGoods(MultipartFile file) {
|
||||
List<GoodsImportForm> dataList;
|
||||
try {
|
||||
dataList = EasyExcel.read(file.getInputStream()).head(GoodsImportForm.class)
|
||||
dataList = FastExcel.read(file.getInputStream()).head(GoodsImportForm.class)
|
||||
.sheet()
|
||||
.doReadSync();
|
||||
} catch (IOException e) {
|
||||
@ -194,12 +194,13 @@ public class GoodsService {
|
||||
*/
|
||||
public List<GoodsExcelVO> getAllGoods() {
|
||||
List<GoodsEntity> goodsEntityList = goodsDao.selectList(null);
|
||||
String keyCode="GODOS_PLACE";
|
||||
return goodsEntityList.stream()
|
||||
.map(e ->
|
||||
GoodsExcelVO.builder()
|
||||
.goodsStatus(SmartEnumUtil.getEnumDescByValue(e.getGoodsStatus(), GoodsStatusEnum.class))
|
||||
.categoryName(categoryQueryService.queryCategoryName(e.getCategoryId()))
|
||||
.place(Arrays.stream(e.getPlace().split(",")).map(code -> dictCacheService.selectValueNameByValueCode(code)).collect(Collectors.joining(",")))
|
||||
.place(Arrays.stream(e.getPlace().split(",")).map(code -> dictCacheService.selectValueNameByValueCode(keyCode,code)).collect(Collectors.joining(",")))
|
||||
.price(e.getPrice())
|
||||
.goodsName(e.getGoodsName())
|
||||
.remark(e.getRemark())
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
|
@ -1,8 +1,8 @@
|
||||
package net.lab1024.sa.admin.module.system.employee.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import net.lab1024.sa.admin.constant.AdminSwaggerTagConst;
|
||||
import net.lab1024.sa.admin.module.system.employee.domain.form.*;
|
||||
import net.lab1024.sa.admin.module.system.employee.domain.vo.EmployeeVO;
|
||||
|
@ -4,9 +4,9 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import net.lab1024.sa.base.common.enumeration.GenderEnum;
|
||||
import net.lab1024.sa.base.common.swagger.SchemaEnum;
|
||||
import net.lab1024.sa.base.common.util.SmartVerificationUtil;
|
||||
import net.lab1024.sa.base.common.validator.enumeration.CheckEnum;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import net.lab1024.sa.base.common.util.SmartVerificationUtil;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
@ -55,4 +55,4 @@ public class EmployeeUpdateCenterForm {
|
||||
@Schema(description = "备注")
|
||||
@Length(max = 200, message = "备注最多200字符")
|
||||
private String remark;
|
||||
}
|
||||
}
|
@ -60,8 +60,8 @@ public class LoginController {
|
||||
|
||||
@Operation(summary = "退出登陆 @author 卓大")
|
||||
@GetMapping("/login/logout")
|
||||
public ResponseDTO<String> logout(@RequestHeader(value = RequestHeaderConst.TOKEN, required = false) String token) {
|
||||
return loginService.logout(token, SmartRequestUtil.getRequestUser());
|
||||
public ResponseDTO<String> logout() {
|
||||
return loginService.logout(SmartRequestUtil.getRequestUser());
|
||||
}
|
||||
|
||||
@Operation(summary = "获取验证码 @author 卓大")
|
||||
|
@ -378,10 +378,10 @@ public class LoginService implements StpInterface {
|
||||
/**
|
||||
* 退出登录
|
||||
*/
|
||||
public ResponseDTO<String> logout(String token, RequestUser requestUser) {
|
||||
public ResponseDTO<String> logout(RequestUser requestUser) {
|
||||
|
||||
// sa token 登出
|
||||
StpUtil.logoutByTokenValue(token);
|
||||
StpUtil.logout();
|
||||
|
||||
// 清空登录信息缓存
|
||||
loginEmployeeCache.remove(requestUser.getUserId());
|
||||
|
@ -19,9 +19,8 @@
|
||||
|
||||
<select id="selectMenuListByRoleIdList"
|
||||
resultType="net.lab1024.sa.admin.module.system.menu.domain.entity.MenuEntity">
|
||||
|
||||
SELECT
|
||||
t_menu.*
|
||||
distinct t_menu.*
|
||||
from t_menu
|
||||
left join t_role_menu on t_role_menu.menu_id = t_menu.menu_id
|
||||
<where>
|
||||
@ -35,8 +34,6 @@
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
group by t_menu.menu_id
|
||||
ORDER BY t_menu.sort ASC
|
||||
|
||||
</select>
|
||||
</mapper>
|
@ -198,6 +198,11 @@
|
||||
<artifactId>commons-io</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
@ -234,8 +239,14 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<groupId>cn.idev.excel</groupId>
|
||||
<artifactId>fastexcel</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -11,7 +11,7 @@ package net.lab1024.sa.base.common.constant;
|
||||
*/
|
||||
public class RequestHeaderConst {
|
||||
|
||||
public static final String TOKEN = "x-access-token";
|
||||
public static final String TOKEN = "Authorization";
|
||||
|
||||
public static final String USER_AGENT = "user-agent";
|
||||
|
||||
|
@ -1,52 +0,0 @@
|
||||
package net.lab1024.sa.base.common.json.serializer;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import com.google.common.collect.Lists;
|
||||
import net.lab1024.sa.base.module.support.dict.domain.vo.DictValueVO;
|
||||
import net.lab1024.sa.base.module.support.dict.service.DictCacheService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典序列化
|
||||
*
|
||||
* @Author 1024创新实验室: 罗伊
|
||||
* @Date 2022-08-12 22:17:53
|
||||
* @Wechat zhuoda1024
|
||||
* @Email lab1024@163.com
|
||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||
*/
|
||||
public class DictValueVoSerializer extends JsonSerializer<String> {
|
||||
|
||||
@Resource
|
||||
private DictCacheService dictCacheService;
|
||||
|
||||
|
||||
@Override
|
||||
public void serialize(String value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
|
||||
if (StringUtils.isEmpty(value)) {
|
||||
jsonGenerator.writeObject(Lists.newArrayList());
|
||||
return;
|
||||
}
|
||||
|
||||
String[] valueCodeArray = value.split(",");
|
||||
List<String> valueCodeList = Arrays.asList(valueCodeArray);
|
||||
List<DictValueVO> dictValueVOList = Lists.newArrayList();
|
||||
valueCodeList.forEach(e->{
|
||||
if(StringUtils.isNotBlank(e)){
|
||||
DictValueVO dictValueVO = dictCacheService.selectValueByValueCode(e);
|
||||
if(dictValueVO != null){
|
||||
dictValueVOList.add(dictValueVO);
|
||||
}
|
||||
}
|
||||
});
|
||||
jsonGenerator.writeObject(dictValueVOList);
|
||||
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
package net.lab1024.sa.base.common.util;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.write.handler.SheetWriteHandler;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder;
|
||||
import cn.idev.excel.FastExcel;
|
||||
import cn.idev.excel.write.handler.SheetWriteHandler;
|
||||
import cn.idev.excel.write.metadata.holder.WriteSheetHolder;
|
||||
import cn.idev.excel.write.metadata.holder.WriteWorkbookHolder;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.openxml4j.opc.PackagePartName;
|
||||
@ -43,7 +43,7 @@ public final class SmartExcelUtil {
|
||||
// 设置下载消息头
|
||||
SmartResponseUtil.setDownloadFileHeader(response, fileName, null);
|
||||
// 下载
|
||||
EasyExcel.write(response.getOutputStream(), head)
|
||||
FastExcel.write(response.getOutputStream(), head)
|
||||
.autoCloseStream(Boolean.FALSE)
|
||||
.sheet(sheetName)
|
||||
.doWrite(data);
|
||||
@ -58,7 +58,7 @@ public final class SmartExcelUtil {
|
||||
// 水印
|
||||
Watermark watermark = new Watermark(watermarkString);
|
||||
// 一定要inMemory
|
||||
EasyExcel.write(response.getOutputStream(), head)
|
||||
FastExcel.write(response.getOutputStream(), head)
|
||||
.inMemory(true)
|
||||
.sheet(sheetName)
|
||||
.registerWriteHandler(new CustomWaterMarkHandler(watermark))
|
||||
|
@ -73,7 +73,7 @@ public class SwaggerConfig {
|
||||
|
||||
private Components components() {
|
||||
return new Components()
|
||||
.addSecuritySchemes(RequestHeaderConst.TOKEN, new SecurityScheme().type(SecurityScheme.Type.APIKEY).in(SecurityScheme.In.HEADER).name(RequestHeaderConst.TOKEN));
|
||||
.addSecuritySchemes(RequestHeaderConst.TOKEN, new SecurityScheme().scheme("Bearer").description("请输入token,格式为[Bearer xxxxxxxx]").type(SecurityScheme.Type.APIKEY).in(SecurityScheme.In.HEADER).name(RequestHeaderConst.TOKEN));
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
@ -18,5 +18,5 @@ import java.lang.annotation.Target;
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface DataTracerFieldDict {
|
||||
|
||||
|
||||
String keyCode() default "";
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ public class DataTracerChangeContentService {
|
||||
fieldContent = SmartEnumUtil.getEnumDescByValue(fieldValue, dataTracerFieldEnum.enumClass());
|
||||
}
|
||||
} else if (dataTracerFieldDict != null) {
|
||||
fieldContent = dictCacheService.selectValueNameByValueCodeSplit(fieldValue.toString());
|
||||
fieldContent = dictCacheService.selectValueNameByValueCodeSplit(dataTracerFieldDict.keyCode(), fieldValue.toString());
|
||||
} else if (dataTracerFieldSql != null) {
|
||||
fieldContent = this.getRelateDisplayValue(fieldValue, dataTracerFieldSql);
|
||||
} else if (fieldValue instanceof Date) {
|
||||
|
@ -52,5 +52,5 @@ public interface DictValueDao extends BaseMapper<DictValueEntity> {
|
||||
* 跟进code查询
|
||||
*
|
||||
*/
|
||||
DictValueEntity selectByCode(@Param("valueCode") String valueCode, @Param("deletedFlag") Boolean deletedFlag);
|
||||
DictValueEntity selectByCode(@Param("dictKeyId") Long dictKeyId,@Param("valueCode") String valueCode, @Param("deletedFlag") Boolean deletedFlag);
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -41,8 +42,6 @@ public class DictCacheService {
|
||||
|
||||
private ConcurrentHashMap<String, List<DictValueVO>> DICT_CACHE = new ConcurrentHashMap<>();
|
||||
|
||||
private ConcurrentHashMap<String, DictValueVO> VALUE_CACHE = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
@PostConstruct
|
||||
public void dictCache() {
|
||||
@ -63,10 +62,6 @@ public class DictCacheService {
|
||||
Long dictKeyId = dictKeyEntity.getDictKeyId();
|
||||
DICT_CACHE.put(keyCode, valueListMap.getOrDefault(dictKeyId, Lists.newArrayList()));
|
||||
}
|
||||
//字典值缓存
|
||||
dictValueVOList.forEach(e -> {
|
||||
VALUE_CACHE.put(e.getValueCode(), e);
|
||||
});
|
||||
log.info("################# 数据字典缓存初始化完毕 ###################");
|
||||
}
|
||||
|
||||
@ -75,7 +70,6 @@ public class DictCacheService {
|
||||
*/
|
||||
public ResponseDTO<String> cacheRefresh() {
|
||||
DICT_CACHE.clear();
|
||||
VALUE_CACHE.clear();
|
||||
this.cacheInit();
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
@ -92,37 +86,45 @@ public class DictCacheService {
|
||||
|
||||
/**
|
||||
* 查询值code名称
|
||||
*
|
||||
* @param keyCode
|
||||
* @param valueCode
|
||||
* @return
|
||||
*/
|
||||
public String selectValueNameByValueCode(String valueCode) {
|
||||
if (StrUtil.isEmpty(valueCode)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
DictValueVO dictValueVO = VALUE_CACHE.get(valueCode);
|
||||
if (dictValueVO == null) {
|
||||
public String selectValueNameByValueCode(String keyCode, String valueCode) {
|
||||
DictValueVO dictValueVO = this.selectValueByValueCode(keyCode, valueCode);
|
||||
if (dictValueVO == null){
|
||||
return "";
|
||||
}
|
||||
return dictValueVO.getValueName();
|
||||
return dictValueVO.getValueName()
|
||||
;
|
||||
}
|
||||
|
||||
public DictValueVO selectValueByValueCode(String valueCode) {
|
||||
public DictValueVO selectValueByValueCode(String keyCode, String valueCode) {
|
||||
if (StrUtil.isEmpty(valueCode)) {
|
||||
return null;
|
||||
}
|
||||
return VALUE_CACHE.get(valueCode);
|
||||
}
|
||||
if (StrUtil.isEmpty(keyCode)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String selectValueNameByValueCodeSplit(String valueCodes) {
|
||||
List<DictValueVO> dictValueVOList = DICT_CACHE.get(valueCode);
|
||||
if (CollectionUtils.isEmpty(dictValueVOList)) {
|
||||
return null;
|
||||
}
|
||||
Optional<DictValueVO> option = dictValueVOList.stream().filter(e->e.getValueCode().equals(valueCode)).findFirst();
|
||||
if(option.isPresent()){
|
||||
return option.get();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public String selectValueNameByValueCodeSplit(String keyCode, String valueCodes) {
|
||||
if (StrUtil.isEmpty(valueCodes)) {
|
||||
return "";
|
||||
}
|
||||
List<String> valueNameList = Lists.newArrayList();
|
||||
String[] valueCodeArray = valueCodes.split(",");
|
||||
for (String valueCode : valueCodeArray) {
|
||||
DictValueVO dictValueVO = VALUE_CACHE.get(valueCode);
|
||||
DictValueVO dictValueVO = this.selectValueByValueCode(keyCode, valueCode);
|
||||
if (dictValueVO != null) {
|
||||
valueNameList.add(dictValueVO.getValueName());
|
||||
}
|
||||
@ -130,4 +132,4 @@ public class DictCacheService {
|
||||
return StringUtils.join(valueNameList, ",");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package net.lab1024.sa.base.module.support.dict.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.collect.Interner;
|
||||
import com.google.common.collect.Interners;
|
||||
import net.lab1024.sa.base.common.code.UserErrorCode;
|
||||
import net.lab1024.sa.base.common.domain.PageResult;
|
||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||
@ -26,7 +28,7 @@ import java.util.List;
|
||||
* @Date 2022/5/26 19:40:55
|
||||
* @Wechat zhuoda1024
|
||||
* @Email lab1024@163.com
|
||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||
*/
|
||||
@Service
|
||||
public class DictService {
|
||||
@ -37,6 +39,10 @@ public class DictService {
|
||||
private DictValueDao dictValueDao;
|
||||
@Resource
|
||||
private DictCacheService dictCacheService;
|
||||
/**
|
||||
* CODE锁
|
||||
*/
|
||||
private static final Interner<String> CODE_POOL = Interners.newWeakInterner();
|
||||
|
||||
|
||||
/**
|
||||
@ -45,15 +51,15 @@ public class DictService {
|
||||
* @param keyAddForm
|
||||
* @return
|
||||
*/
|
||||
public synchronized ResponseDTO<String> keyAdd(DictKeyAddForm keyAddForm) {
|
||||
DictKeyEntity dictKeyEntity = dictKeyDao.selectByCode(keyAddForm.getKeyCode(), false);
|
||||
if (dictKeyEntity != null) {
|
||||
return ResponseDTO.error(UserErrorCode.ALREADY_EXIST);
|
||||
public ResponseDTO<String> keyAdd(DictKeyAddForm keyAddForm) {
|
||||
synchronized (CODE_POOL.intern(keyAddForm.getKeyCode())) {
|
||||
DictKeyEntity dictKeyEntity = dictKeyDao.selectByCode(keyAddForm.getKeyCode(), false);
|
||||
if (dictKeyEntity != null) {
|
||||
return ResponseDTO.error(UserErrorCode.ALREADY_EXIST);
|
||||
}
|
||||
dictKeyEntity = SmartBeanUtil.copy(keyAddForm, DictKeyEntity.class);
|
||||
dictKeyDao.insert(dictKeyEntity);
|
||||
}
|
||||
dictKeyEntity = SmartBeanUtil.copy(keyAddForm, DictKeyEntity.class);
|
||||
dictKeyDao.insert(dictKeyEntity);
|
||||
//刷新缓存
|
||||
dictCacheService.cacheRefresh();
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
@ -63,15 +69,16 @@ public class DictService {
|
||||
* @param valueAddForm
|
||||
* @return
|
||||
*/
|
||||
public synchronized ResponseDTO<String> valueAdd(DictValueAddForm valueAddForm) {
|
||||
DictValueEntity dictValueEntity = dictValueDao.selectByCode(valueAddForm.getValueCode(), false);
|
||||
if (dictValueEntity != null) {
|
||||
return ResponseDTO.error(UserErrorCode.ALREADY_EXIST);
|
||||
public ResponseDTO<String> valueAdd(DictValueAddForm valueAddForm) {
|
||||
|
||||
synchronized (CODE_POOL.intern(valueAddForm.getValueCode())) {
|
||||
DictValueEntity dictValueEntity = dictValueDao.selectByCode(valueAddForm.getDictKeyId(),valueAddForm.getValueCode(), false);
|
||||
if (dictValueEntity != null) {
|
||||
return ResponseDTO.error(UserErrorCode.ALREADY_EXIST);
|
||||
}
|
||||
dictValueEntity = SmartBeanUtil.copy(valueAddForm, DictValueEntity.class);
|
||||
dictValueDao.insert(dictValueEntity);
|
||||
}
|
||||
dictValueEntity = SmartBeanUtil.copy(valueAddForm, DictValueEntity.class);
|
||||
dictValueDao.insert(dictValueEntity);
|
||||
//刷新缓存
|
||||
dictCacheService.cacheRefresh();
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
@ -81,15 +88,15 @@ public class DictService {
|
||||
* @param keyUpdateForm
|
||||
* @return
|
||||
*/
|
||||
public synchronized ResponseDTO<String> keyEdit(DictKeyUpdateForm keyUpdateForm) {
|
||||
DictKeyEntity dictKeyEntity = dictKeyDao.selectByCode(keyUpdateForm.getKeyCode(), false);
|
||||
if (dictKeyEntity != null && !dictKeyEntity.getDictKeyId().equals(keyUpdateForm.getDictKeyId())) {
|
||||
return ResponseDTO.error(UserErrorCode.ALREADY_EXIST);
|
||||
public ResponseDTO<String> keyEdit(DictKeyUpdateForm keyUpdateForm) {
|
||||
synchronized (CODE_POOL.intern(keyUpdateForm.getKeyCode())) {
|
||||
DictKeyEntity dictKeyEntity = dictKeyDao.selectByCode(keyUpdateForm.getKeyCode(), false);
|
||||
if (dictKeyEntity != null && !dictKeyEntity.getDictKeyId().equals(keyUpdateForm.getDictKeyId())) {
|
||||
return ResponseDTO.error(UserErrorCode.ALREADY_EXIST);
|
||||
}
|
||||
DictKeyEntity dictKeyUpdateEntity = SmartBeanUtil.copy(keyUpdateForm, DictKeyEntity.class);
|
||||
dictKeyDao.updateById(dictKeyUpdateEntity);
|
||||
}
|
||||
DictKeyEntity dictKeyUpdateEntity = SmartBeanUtil.copy(keyUpdateForm, DictKeyEntity.class);
|
||||
dictKeyDao.updateById(dictKeyUpdateEntity);
|
||||
//刷新缓存
|
||||
dictCacheService.cacheRefresh();
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
@ -99,19 +106,19 @@ public class DictService {
|
||||
* @param valueUpdateForm
|
||||
* @return
|
||||
*/
|
||||
public synchronized ResponseDTO<String> valueEdit(DictValueUpdateForm valueUpdateForm) {
|
||||
public ResponseDTO<String> valueEdit(DictValueUpdateForm valueUpdateForm) {
|
||||
DictKeyEntity dictKeyEntity = dictKeyDao.selectById(valueUpdateForm.getDictKeyId());
|
||||
if (dictKeyEntity == null || dictKeyEntity.getDeletedFlag()) {
|
||||
return ResponseDTO.userErrorParam("key不能存在");
|
||||
}
|
||||
DictValueEntity dictValueEntity = dictValueDao.selectByCode(valueUpdateForm.getValueCode(), false);
|
||||
if (dictValueEntity != null && !dictValueEntity.getDictValueId().equals(valueUpdateForm.getDictValueId())) {
|
||||
return ResponseDTO.error(UserErrorCode.ALREADY_EXIST);
|
||||
synchronized (CODE_POOL.intern(valueUpdateForm.getValueCode())) {
|
||||
DictValueEntity dictValueEntity = dictValueDao.selectByCode(valueUpdateForm.getDictKeyId() ,valueUpdateForm.getValueCode(), false);
|
||||
if (dictValueEntity != null && !dictValueEntity.getDictValueId().equals(valueUpdateForm.getDictValueId())) {
|
||||
return ResponseDTO.error(UserErrorCode.ALREADY_EXIST);
|
||||
}
|
||||
DictValueEntity dictValueUpdateEntity = SmartBeanUtil.copy(valueUpdateForm, DictValueEntity.class);
|
||||
dictValueDao.updateById(dictValueUpdateEntity);
|
||||
}
|
||||
DictValueEntity dictValueUpdateEntity = SmartBeanUtil.copy(valueUpdateForm, DictValueEntity.class);
|
||||
dictValueDao.updateById(dictValueUpdateEntity);
|
||||
//刷新缓存
|
||||
dictCacheService.cacheRefresh();
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
@ -121,13 +128,11 @@ public class DictService {
|
||||
* @param keyIdList
|
||||
* @return
|
||||
*/
|
||||
public synchronized ResponseDTO<String> keyDelete(List<Long> keyIdList) {
|
||||
public ResponseDTO<String> keyDelete(List<Long> keyIdList) {
|
||||
if (CollectionUtils.isEmpty(keyIdList)) {
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
dictKeyDao.updateDeletedFlagByIdList(keyIdList, true);
|
||||
//刷新缓存
|
||||
dictCacheService.cacheRefresh();
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
@ -137,13 +142,11 @@ public class DictService {
|
||||
* @param valueIdList
|
||||
* @return
|
||||
*/
|
||||
public synchronized ResponseDTO<String> valueDelete(List<Long> valueIdList) {
|
||||
public ResponseDTO<String> valueDelete(List<Long> valueIdList) {
|
||||
if (CollectionUtils.isEmpty(valueIdList)) {
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
dictValueDao.updateDeletedFlagByIdList(valueIdList, true);
|
||||
//刷新缓存
|
||||
dictCacheService.cacheRefresh();
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
|
@ -1,26 +1,24 @@
|
||||
package net.lab1024.sa.base.module.support.securityprotect.service;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||
import org.apache.tika.config.TikaConfig;
|
||||
import org.apache.tika.detect.Detector;
|
||||
import org.apache.tika.exception.TikaException;
|
||||
import org.apache.tika.io.TikaInputStream;
|
||||
import org.apache.tika.metadata.Metadata;
|
||||
import org.apache.tika.metadata.TikaCoreProperties;
|
||||
import org.apache.tika.mime.MediaType;
|
||||
import org.apache.tika.mime.MimeTypes;
|
||||
import org.apache.tika.parser.AutoDetectParser;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 三级等保 文件上传 相关
|
||||
* 三级等保 文件 相关
|
||||
*
|
||||
* @Author 1024创新实验室-主任:卓大
|
||||
* @Date 2024/08/22 19:25:59
|
||||
@ -30,6 +28,7 @@ import java.util.List;
|
||||
*/
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class SecurityFileService {
|
||||
|
||||
@Resource
|
||||
@ -74,8 +73,8 @@ public class SecurityFileService {
|
||||
// 文件类型安全检测
|
||||
if (level3ProtectConfigService.isFileDetectFlag()) {
|
||||
String fileType = getFileMimeType(file);
|
||||
if(ALLOWED_MIME_TYPES.stream()
|
||||
.noneMatch(allowedType -> matchesMimeType(fileType, allowedType))){
|
||||
if (ALLOWED_MIME_TYPES.stream()
|
||||
.noneMatch(allowedType -> matchesMimeType(fileType, allowedType))) {
|
||||
return ResponseDTO.userErrorParam("禁止上传此文件类型");
|
||||
}
|
||||
}
|
||||
@ -88,17 +87,17 @@ public class SecurityFileService {
|
||||
*
|
||||
* @param file 要检查的文件
|
||||
* @return 文件的 MIME 类型
|
||||
*
|
||||
*/
|
||||
public static String getFileMimeType(MultipartFile file) {
|
||||
try {
|
||||
TikaConfig tika = new TikaConfig();
|
||||
Metadata metadata = new Metadata();
|
||||
metadata.set(TikaCoreProperties.RESOURCE_NAME_KEY, file.getOriginalFilename());
|
||||
metadata.set(TikaCoreProperties.RESOURCE_NAME_KEY, file.getOriginalFilename());
|
||||
TikaInputStream stream = TikaInputStream.get(file.getInputStream());
|
||||
MediaType mimetype = tika.getDetector().detect(stream, metadata);
|
||||
return mimetype.toString();
|
||||
} catch (IOException | TikaException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return MimeTypes.OCTET_STREAM;
|
||||
}
|
||||
}
|
||||
@ -106,8 +105,8 @@ public class SecurityFileService {
|
||||
/**
|
||||
* 检查文件的 MIME 类型是否与指定的MIME 类型匹配(支持通配符)
|
||||
*
|
||||
* @param fileType 文件的 MIME 类型
|
||||
* @param mimetype MIME 类型(支持通配符)
|
||||
* @param fileType 文件的 MIME 类型
|
||||
* @param mimetype MIME 类型(支持通配符)
|
||||
* @return 是否匹配
|
||||
*/
|
||||
private static boolean matchesMimeType(String fileType, String mimetype) {
|
||||
|
@ -34,11 +34,8 @@ public class SecurityPasswordService {
|
||||
|
||||
public static final String PASSWORD_FORMAT_MSG = "密码必须为长度8-20位且必须包含大小写字母、数字、特殊符号(如:@#$%^&*()_+-=)等三种字符";
|
||||
|
||||
|
||||
private static final int PASSWORD_LENGTH = 8;
|
||||
|
||||
private static final String PASSWORD_SALT_FORMAT = "smart_%s_admin_$^&*";
|
||||
|
||||
|
||||
@Resource
|
||||
private PasswordLogDao passwordLogDao;
|
||||
@ -46,7 +43,7 @@ public class SecurityPasswordService {
|
||||
@Resource
|
||||
private Level3ProtectConfigService level3ProtectConfigService;
|
||||
|
||||
static Argon2PasswordEncoder encoder = Argon2PasswordEncoder.defaultsForSpringSecurity_v5_8();
|
||||
static Argon2PasswordEncoder ARGON2_PASSWORD_ENCODER = Argon2PasswordEncoder.defaultsForSpringSecurity_v5_8();
|
||||
|
||||
/**
|
||||
* 校验密码复杂度
|
||||
@ -86,7 +83,7 @@ public class SecurityPasswordService {
|
||||
|
||||
// 检查最近几次是否有重复密码
|
||||
List<String> oldPasswords = passwordLogDao.selectOldPassword(requestUser.getUserType().getValue(), requestUser.getUserId(), level3ProtectConfigService.getRegularChangePasswordNotAllowRepeatTimes());
|
||||
boolean isDuplicate = oldPasswords.stream().anyMatch(oldPassword -> encoder.matches(newPassword, oldPassword));
|
||||
boolean isDuplicate = oldPasswords.stream().anyMatch(oldPassword -> ARGON2_PASSWORD_ENCODER.matches(newPassword, oldPassword));
|
||||
if (isDuplicate) {
|
||||
return ResponseDTO.userErrorParam(String.format("与前%d个历史密码重复,请换个密码!", level3ProtectConfigService.getRegularChangePasswordNotAllowRepeatTimes()));
|
||||
}
|
||||
@ -146,14 +143,14 @@ public class SecurityPasswordService {
|
||||
* 获取 加密后 的密码
|
||||
*/
|
||||
public static String getEncryptPwd(String password) {
|
||||
return encoder.encode(password);
|
||||
return ARGON2_PASSWORD_ENCODER.encode(password);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验密码是否匹配
|
||||
*/
|
||||
public static Boolean matchesPwd( String password, String encodedPassword){
|
||||
return encoder.matches( password, encodedPassword);
|
||||
public static Boolean matchesPwd(String password, String encodedPassword) {
|
||||
return ARGON2_PASSWORD_ENCODER.matches(password, encodedPassword);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -131,7 +131,9 @@ reload:
|
||||
# sa-token 配置
|
||||
sa-token:
|
||||
# token 名称(同时也是 cookie 名称)
|
||||
token-name: x-access-token
|
||||
token-name: Authorization
|
||||
# token 前缀 例如:Bearer
|
||||
token-prefix: Bearer
|
||||
# token 有效期(单位:秒) 默认30天(2592000秒),-1 代表永久有效
|
||||
timeout: 2592000
|
||||
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
<select id="selectByCode"
|
||||
resultType="net.lab1024.sa.base.module.support.dict.domain.entity.DictValueEntity">
|
||||
select * from t_dict_value where value_code = #{valueCode} and deleted_flag = #{deletedFlag}
|
||||
select * from t_dict_value where dict_Key_id = #{dictKeyId} and value_code = #{valueCode} and deleted_flag = #{deletedFlag}
|
||||
</select>
|
||||
|
||||
<select id="selectByDeletedFlag"
|
||||
|
@ -131,7 +131,9 @@ reload:
|
||||
# sa-token 配置
|
||||
sa-token:
|
||||
# token 名称(同时也是 cookie 名称)
|
||||
token-name: x-access-token
|
||||
token-name: Authorization
|
||||
# token 前缀 例如:Bear
|
||||
token-prefix: Bearer
|
||||
# token 有效期(单位:秒) 默认30天(2592000秒),-1 代表永久有效
|
||||
timeout: 2592000
|
||||
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结
|
||||
|
@ -128,7 +128,9 @@ reload:
|
||||
# sa-token 配置
|
||||
sa-token:
|
||||
# token 名称(同时也是 cookie 名称)
|
||||
token-name: x-access-token
|
||||
token-name: Authorization
|
||||
# token 前缀 例如:Bear
|
||||
token-prefix: Bearer
|
||||
# token 有效期(单位:秒) 默认30天(2592000秒),-1 代表永久有效
|
||||
timeout: 2592000
|
||||
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结
|
||||
|
@ -131,7 +131,9 @@ reload:
|
||||
# sa-token 配置
|
||||
sa-token:
|
||||
# token 名称(同时也是 cookie 名称)
|
||||
token-name: x-access-token
|
||||
token-name: Authorization
|
||||
# token 前缀 例如:Bear
|
||||
token-prefix: Bearer
|
||||
# token 有效期(单位:秒) 默认30天(2592000秒),-1 代表永久有效
|
||||
timeout: 2592000
|
||||
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结
|
||||
|
@ -17,7 +17,7 @@
|
||||
},
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@ant-design/icons-vue": "^6.1.0",
|
||||
"@ant-design/icons-vue": "^7.0.1",
|
||||
"@wangeditor/editor": "5.1.14",
|
||||
"@wangeditor/editor-for-vue": "5.1.12",
|
||||
"ant-design-vue": "4.2.5",
|
||||
@ -38,6 +38,7 @@
|
||||
"sm-crypto": "0.3.13",
|
||||
"sortablejs": "1.15.0",
|
||||
"ua-parser-js": "1.0.35",
|
||||
"uuid": "^11.1.0",
|
||||
"v-viewer": "~1.6.4",
|
||||
"vue": "3.4.27",
|
||||
"vue-i18n": "9.13.1",
|
||||
|
@ -32,6 +32,7 @@
|
||||
},
|
||||
},
|
||||
}"
|
||||
:transformCellText="transformCellText"
|
||||
>
|
||||
<!---全局loading--->
|
||||
<a-spin :spinning="spinning" tip="稍等片刻,我在拼命加载中..." size="large">
|
||||
@ -43,13 +44,16 @@
|
||||
|
||||
<script setup>
|
||||
import dayjs from 'dayjs';
|
||||
import { computed } from 'vue';
|
||||
import { computed, h, useSlots } from 'vue';
|
||||
import { messages } from '/@/i18n';
|
||||
import { useAppConfigStore } from '/@/store/modules/system/app-config';
|
||||
import { useSpinStore } from '/@/store/modules/system/spin';
|
||||
import { theme } from 'ant-design-vue';
|
||||
import { themeColors } from '/@/theme/color.js';
|
||||
import { Popover } from 'ant-design-vue';
|
||||
import SmartCopyIcon from '/@/components/smart-copy-icon/index.vue';
|
||||
|
||||
const slots = useSlots();
|
||||
const antdLocale = computed(() => messages[useAppConfigStore().language].antdLocale);
|
||||
const dayjsLocale = computed(() => messages[useAppConfigStore().language].dayjsLocale);
|
||||
dayjs.locale(dayjsLocale);
|
||||
@ -67,4 +71,28 @@
|
||||
const borderRadius = computed(() => {
|
||||
return useAppConfigStore().borderRadius;
|
||||
});
|
||||
function transformCellText({ text, column, record, index }) {
|
||||
if (column && column.textEllipsisFlag === true) {
|
||||
return h(
|
||||
Popover,
|
||||
{ placement: 'bottom' },
|
||||
{
|
||||
default: () =>
|
||||
h('div', { style: { whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }, id: `${column.dataIndex}${index}` }, text),
|
||||
content: () =>
|
||||
h('div', { style: { display: 'flex' } }, [
|
||||
h('div', text),
|
||||
h(SmartCopyIcon, { value: document.getElementById(`${column.dataIndex}${index}`).innerText }),
|
||||
]),
|
||||
}
|
||||
);
|
||||
} else {
|
||||
return text;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="less">
|
||||
:deep(.ant-table-column-sorters) {
|
||||
align-items: flex-start !important;
|
||||
}
|
||||
</style>
|
||||
|
@ -0,0 +1,28 @@
|
||||
<template>
|
||||
<div>
|
||||
<template v-for="(item, index) in options">
|
||||
<template v-if="values.includes(item.valueCode)">
|
||||
{{ item.valueName }}
|
||||
<span> </span>
|
||||
</template>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
// 数据
|
||||
options: {
|
||||
type: Array,
|
||||
default: null,
|
||||
},
|
||||
// 当前的值
|
||||
value: [Number, String, Array],
|
||||
});
|
||||
const values = computed(() => {
|
||||
if (props.value === null || typeof props.value === 'undefined' || props.value === '') return [];
|
||||
return Array.isArray(props.value) ? props.value.map((item) => item.valueCode) : props.value.split(',');
|
||||
});
|
||||
</script>
|
@ -99,10 +99,20 @@
|
||||
getHtml,
|
||||
getText,
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.w-e-full-screen-container {
|
||||
z-index: 9999 !important;
|
||||
}
|
||||
</style>
|
||||
<!-- 解决弹窗高度警告信息显示 -->
|
||||
<style>
|
||||
::v-deep .w-e-text-container {
|
||||
height: 420px !important;
|
||||
}
|
||||
.w-e-text-container .w-e-scroll {
|
||||
height: 500px !important;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
</style>
|
||||
|
@ -0,0 +1,38 @@
|
||||
<template>
|
||||
<CopyOutlined
|
||||
@click="copy"
|
||||
:style="{
|
||||
color: `${color}`,
|
||||
}"
|
||||
class="icon"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { message } from 'ant-design-vue';
|
||||
const props = defineProps({
|
||||
value: {
|
||||
type: [String, Number],
|
||||
default: '',
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
default: '#1890ff',
|
||||
},
|
||||
});
|
||||
|
||||
function copy() {
|
||||
const textarea = document.createElement('textarea');
|
||||
textarea.value = props.value;
|
||||
document.body.appendChild(textarea);
|
||||
textarea.select();
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(textarea);
|
||||
message.success('复制成功');
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="less">
|
||||
.icon {
|
||||
margin: 0 10px;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,178 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<div class="table-title">
|
||||
<slot name="title">
|
||||
{{ column.title }}
|
||||
</slot>
|
||||
</div>
|
||||
<div class="filter" style="max-width: 300px; min-height: 40px">
|
||||
<slot>
|
||||
<template v-if="column.filterOptions">
|
||||
<template v-if="column.filterOptions.type === 'input'">
|
||||
<a-input-search
|
||||
@change="change('no-search')"
|
||||
v-model:value="modelValue"
|
||||
allowClear
|
||||
:placeholder="column.placeholder || column.title"
|
||||
@search="change"
|
||||
/>
|
||||
</template>
|
||||
<template v-else-if="column.filterOptions.type === 'date-range'">
|
||||
<a-range-picker
|
||||
v-model:value="createDateRange"
|
||||
:ranges="column.filterOptions.ranges ? defaultTimeRanges : []"
|
||||
style="width: 100%"
|
||||
@change="changeCreateDate"
|
||||
/>
|
||||
</template>
|
||||
<template v-else-if="column.filterOptions.type === 'datetime-range'">
|
||||
<a-range-picker
|
||||
show-time
|
||||
v-model:value="createDateRange"
|
||||
:ranges="column.filterOptions.ranges ? defaultTimeRanges : []"
|
||||
style="width: 100%"
|
||||
@change="changeCreateDate"
|
||||
/>
|
||||
</template>
|
||||
<template v-else-if="column.filterOptions.type === 'month'">
|
||||
<a-range-picker v-model:value="createDateRange" picker="month" @change="changeCreateDate" />
|
||||
</template>
|
||||
<template v-else-if="column.filterOptions.type === 'submit'">
|
||||
<div class="smart-table-operate"><a-button :type="column.filterOptions.btnType" @click="submit">查询</a-button></div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<component
|
||||
v-if="componentsKey.includes(column.filterOptions.type)"
|
||||
:is="getComponent(column.filterOptions.type)"
|
||||
width="100%"
|
||||
v-model:value="modelValue"
|
||||
:multiple="column.filterOptions.multiple"
|
||||
:keyCode="column.filterOptions.keyCode"
|
||||
:enumName="column.filterOptions.enumName"
|
||||
:systemConfigKey="column.filterOptions.systemConfigKey"
|
||||
:placeholder="column.placeholder"
|
||||
:leaveFlag="column.filterOptions.leaveFlag"
|
||||
:categoryType="column.filterOptions.categoryType"
|
||||
@change="change"
|
||||
/>
|
||||
<div v-else class="error-component">未定义的组件类型</div>
|
||||
</template>
|
||||
</template>
|
||||
</slot>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, useSlots, watch, onMounted, defineAsyncComponent } from 'vue';
|
||||
import dayjs from 'dayjs';
|
||||
import _ from 'lodash';
|
||||
import { defaultTimeRanges } from '/@/lib/default-time-ranges';
|
||||
const props = defineProps({
|
||||
value: {
|
||||
type: [Number, String, Array, Object],
|
||||
},
|
||||
column: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
});
|
||||
|
||||
const components = {
|
||||
'enum-select': defineAsyncComponent(() => import('/@/components/framework/smart-enum-select/index.vue')),
|
||||
'dict-select': defineAsyncComponent(() => import('/@/components/support/dict-select/index.vue')),
|
||||
'employee-select': defineAsyncComponent(() => import('/@/components/system/employee-select/index.vue')),
|
||||
'enterprise-select': defineAsyncComponent(() => import('/@/components/business/oa/enterprise-select/index.vue')),
|
||||
'boolean-select': defineAsyncComponent(() => import('/@/components/framework/boolean-select/index.vue')),
|
||||
'category-tree': defineAsyncComponent(() => import('/@/components/business/category-tree-select/index.vue')),
|
||||
};
|
||||
|
||||
const componentsKey = Object.keys(components);
|
||||
|
||||
function getComponent(key) {
|
||||
return components[key];
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.value,
|
||||
() => {
|
||||
if (props.column.filterOptions && (props.column.filterOptions.type === 'date-range' || props.column.filterOptions.type === 'datetime-range')) {
|
||||
if (!_.isEmpty(props.value) && props.value.length === 2 && !_.isEmpty(props.value[0]) && !_.isEmpty(props.value[1])) {
|
||||
createDateRange.value = [dayjs(props.value[0]), dayjs(props.value[1])];
|
||||
} else {
|
||||
createDateRange.value = [];
|
||||
}
|
||||
} else {
|
||||
modelValue.value = props.value;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
const slots = useSlots();
|
||||
|
||||
const emits = defineEmits(['change', 'update:value']);
|
||||
const createDateRange = ref([]);
|
||||
const modelValue = ref(undefined);
|
||||
|
||||
function changeCreateDate(dates, dateStrings) {
|
||||
// emits('update:value',dates)
|
||||
emits('change', {
|
||||
type: props.column.filterOptions.type,
|
||||
key: props.column.filterOptions.key || props.column.dataIndex,
|
||||
value: [dateStrings[0], dateStrings[1]],
|
||||
search: true,
|
||||
});
|
||||
}
|
||||
|
||||
//是否立即查询
|
||||
function change(search) {
|
||||
let isSearch = true;
|
||||
if (search === 'no-search') {
|
||||
isSearch = false;
|
||||
}
|
||||
emits('update:value', modelValue.value);
|
||||
emits('change', {
|
||||
type: props.column.filterOptions.type,
|
||||
key: props.column.filterOptions.key || props.column.dataIndex,
|
||||
value: modelValue.value,
|
||||
search: isSearch,
|
||||
});
|
||||
}
|
||||
|
||||
function submit() {
|
||||
emits('change', {
|
||||
search: true,
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (props.column.filterOptions && (props.column.filterOptions.type === 'date-range' || props.column.filterOptions.type === 'datetime-range')) {
|
||||
if (!_.isEmpty(props.value) && props.value.length === 2 && !_.isEmpty(props.value[0]) && !_.isEmpty(props.value[1])) {
|
||||
createDateRange.value = [dayjs(props.value[0]), dayjs(props.value[1])];
|
||||
} else {
|
||||
createDateRange.value = [];
|
||||
}
|
||||
} else {
|
||||
modelValue.value = props.value;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<style scoped lang="less">
|
||||
.container {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.table-title {
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
.filter {
|
||||
padding-top: 8px;
|
||||
}
|
||||
|
||||
.error-component {
|
||||
color: red;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
</style>
|
@ -16,7 +16,7 @@
|
||||
:before-upload="beforeUpload"
|
||||
:customRequest="customRequest"
|
||||
:file-list="fileList"
|
||||
:headers="{ 'x-access-token': useUserStore().getToken }"
|
||||
:headers="{ Authorization: 'Bearer ' + useUserStore().getToken }"
|
||||
:list-type="listType"
|
||||
@change="handleChange"
|
||||
@preview="handlePreview"
|
||||
|
@ -38,7 +38,7 @@
|
||||
<script setup>
|
||||
import _ from 'lodash';
|
||||
import { tableColumnApi } from '/@/api/support/table-column-api';
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
import { onMounted, ref, watch, reactive } from 'vue';
|
||||
import SmartTableColumnModal from './smart-table-column-modal.vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { mergeColumn } from './smart-table-column-merge';
|
||||
@ -66,17 +66,17 @@
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
|
||||
// 原始表格列数据(复制一份最原始的columns集合,以供后续各个地方使用)
|
||||
let originalColumn = _.cloneDeep(props.modelValue);
|
||||
|
||||
onMounted(() => {
|
||||
buildUserTableColumns();
|
||||
// 监听全屏事件 解决按下 ESC 退出全屏 fullScreenFlag 未改变导致下次第一下点击全屏无效的问题
|
||||
addEventListener('fullscreenchange', (event) => {
|
||||
if (document.fullscreenElement === null) {
|
||||
fullScreenFlag.value = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
let originalColumn = reactive(_.cloneDeep(props.modelValue));
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(value) => {
|
||||
originalColumn = value;
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
}
|
||||
);
|
||||
onMounted(buildUserTableColumns);
|
||||
|
||||
//构建用户的数据列
|
||||
async function buildUserTableColumns() {
|
||||
@ -176,7 +176,8 @@
|
||||
// 将弹窗修改的列数据,赋值给原表格 列数组
|
||||
function updateColumn(changeColumnArray) {
|
||||
//合并列
|
||||
const newColumns = mergeColumn(_.cloneDeep(originalColumn), changeColumnArray);
|
||||
let obj = mergeColumn(_.cloneDeep(originalColumn), changeColumnArray);
|
||||
const newColumns = obj.newColumns;
|
||||
emit(
|
||||
'update:modelValue',
|
||||
newColumns.filter((e) => e.showFlag)
|
||||
|
@ -1,12 +1,12 @@
|
||||
/*
|
||||
* 表格列设置
|
||||
*
|
||||
* @Author: 1024创新实验室-主任:卓大
|
||||
* @Date: 2022-08-26 23:45:51
|
||||
* @Wechat: zhuda1024
|
||||
* @Email: lab1024@163.com
|
||||
* @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012
|
||||
*/
|
||||
/*
|
||||
* 表格列设置
|
||||
*
|
||||
* @Author: 1024创新实验室-主任:卓大
|
||||
* @Date: 2022-08-26 23:45:51
|
||||
* @Wechat: zhuda1024
|
||||
* @Email: lab1024@163.com
|
||||
* @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012
|
||||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
|
||||
@ -16,6 +16,7 @@ import _ from 'lodash';
|
||||
* @param {*} userTableColumnArray
|
||||
*/
|
||||
export function mergeColumn(originalTableColumnArray, userTableColumnArray) {
|
||||
let saveFlag = false;
|
||||
if (!userTableColumnArray) {
|
||||
return originalTableColumnArray;
|
||||
}
|
||||
@ -40,8 +41,13 @@ export function mergeColumn(originalTableColumnArray, userTableColumnArray) {
|
||||
if (userColumn) {
|
||||
fontColumn.sort = userColumn.sort;
|
||||
fontColumn.showFlag = userColumn.showFlag;
|
||||
if (userColumn.width) {
|
||||
fontColumn.width = userColumn.width;
|
||||
if (fontColumn.dragAndDropFlag) {
|
||||
saveFlag = true;
|
||||
delete fontColumn.dragAndDropFlag;
|
||||
} else {
|
||||
if (userColumn.width) {
|
||||
fontColumn.width = userColumn.width;
|
||||
}
|
||||
}
|
||||
}
|
||||
newColumns.push(fontColumn);
|
||||
@ -50,5 +56,8 @@ export function mergeColumn(originalTableColumnArray, userTableColumnArray) {
|
||||
|
||||
//第三步:前端列进行排序
|
||||
newColumns = _.sortBy(newColumns, (e) => e.sort);
|
||||
return newColumns;
|
||||
return {
|
||||
newColumns,
|
||||
saveFlag,
|
||||
};
|
||||
}
|
||||
|
@ -104,7 +104,7 @@
|
||||
function hide() {
|
||||
visible.value = false;
|
||||
}
|
||||
|
||||
const saveFlag = ref(false);
|
||||
//获取用户的列数据
|
||||
async function getUserTableColumns(tableId, columns) {
|
||||
if (!tableId) {
|
||||
@ -128,14 +128,18 @@
|
||||
}
|
||||
|
||||
//根据前端列和后端列构建新的列数据
|
||||
tableData.value = mergeColumn(columns, userTableColumnArray);
|
||||
|
||||
let obj = mergeColumn(columns, userTableColumnArray);
|
||||
tableData.value = obj.newColumns;
|
||||
saveFlag.value = obj.saveFlag;
|
||||
//将已经显示的展示出来
|
||||
for (const item of tableData.value) {
|
||||
if (item.showFlag) {
|
||||
selectedRowKeyList.value.push(item.columnKey);
|
||||
}
|
||||
}
|
||||
if (saveFlag.value) {
|
||||
save(false);
|
||||
}
|
||||
|
||||
nextTick(() => {
|
||||
initDrag();
|
||||
@ -253,7 +257,7 @@
|
||||
}
|
||||
|
||||
//保存
|
||||
async function save() {
|
||||
async function save(closeFlag = true) {
|
||||
submitLoading.value = true;
|
||||
try {
|
||||
let columnList = [];
|
||||
@ -277,9 +281,11 @@
|
||||
columnList,
|
||||
});
|
||||
|
||||
message.success('保存成功');
|
||||
emit('change', columnList);
|
||||
hide();
|
||||
if (closeFlag) {
|
||||
message.success('保存成功');
|
||||
hide();
|
||||
}
|
||||
} catch (e) {
|
||||
smartSentry.captureError(e);
|
||||
} finally {
|
||||
|
@ -0,0 +1,77 @@
|
||||
<template>
|
||||
<div :class="className">
|
||||
<div v-if="overflow" class="ellipsis-box">
|
||||
<a-popover>
|
||||
<template #content>
|
||||
{{ text }}
|
||||
<SmartCopyIcon :value="text" />
|
||||
</template>
|
||||
<div>
|
||||
<slot>
|
||||
{{ text }}
|
||||
</slot>
|
||||
</div>
|
||||
</a-popover>
|
||||
</div>
|
||||
<div v-else>
|
||||
<slot>
|
||||
{{ text }}
|
||||
</slot>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { onMounted, ref, nextTick } from 'vue';
|
||||
import { Modal } from 'ant-design-vue';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import SmartCopyIcon from '/@/components/smart-copy-icon/index.vue';
|
||||
|
||||
const props = defineProps({
|
||||
text: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
classKey: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
});
|
||||
|
||||
const overflow = ref(false);
|
||||
const className = ref();
|
||||
onMounted(() => {
|
||||
className.value = props.classKey + uuid();
|
||||
nextTick(() => {
|
||||
let doc = document.querySelector(`.${className.value}`);
|
||||
let fontSize = window.getComputedStyle(doc).fontSize.replace('px', '');
|
||||
let clientWidth = doc.clientWidth;
|
||||
let span = document.createElement('span');
|
||||
document.body.appendChild(span);
|
||||
span.style.fontSize = `${fontSize}px`;
|
||||
span.innerText = props.text;
|
||||
let width = span.offsetWidth;
|
||||
document.body.removeChild(span);
|
||||
overflow.value = width > clientWidth;
|
||||
});
|
||||
});
|
||||
|
||||
function showModel() {
|
||||
Modal.info({
|
||||
content: props.text,
|
||||
icon: '',
|
||||
okText: '关闭',
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.ellipsis-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
div {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -14,6 +14,10 @@ export const appDefaultConfig = {
|
||||
layout: 'side',
|
||||
// 侧边菜单宽度 , 默认为200px
|
||||
sideMenuWidth: 200,
|
||||
// 表格高度
|
||||
tableYHeight: 300,
|
||||
//标签页位置
|
||||
pageTagLocation: 'top',
|
||||
// 菜单主题
|
||||
sideMenuTheme: 'dark',
|
||||
// 主题颜色索引
|
||||
|
@ -14,6 +14,8 @@ export default {
|
||||
antdLocale: antd,
|
||||
dayjsLocale: dayjs,
|
||||
'setting.title': 'Setting',
|
||||
'setting.table.yHeight': 'Table Height',
|
||||
'setting.pagetag.location': 'TagPage Position',
|
||||
'setting.color': 'Theme Color',
|
||||
'setting.menu.layout': 'Menu Layout',
|
||||
'setting.menu.width': 'Menu Width',
|
||||
|
@ -14,6 +14,8 @@ export default {
|
||||
antdLocale: antd,
|
||||
dayjsLocale: dayjs,
|
||||
'setting.title': '网站设置',
|
||||
'setting.table.yHeight': '表格高度',
|
||||
'setting.pagetag.location': '标签页位置',
|
||||
'setting.color': '主题颜色',
|
||||
'setting.menu.layout': '菜单布局',
|
||||
'setting.menu.width': '菜单宽度',
|
||||
|
@ -9,7 +9,7 @@
|
||||
-->
|
||||
|
||||
<template>
|
||||
<a-drawer :title="$t('setting.title')" placement="right" :width="410" :open="visible" @close="close">
|
||||
<a-drawer :title="$t('setting.title')" placement="right" :width="450" :open="visible" @close="close">
|
||||
<a-form layout="horizontal" :label-col="{ span: 8 }">
|
||||
<a-form-item label="语言/Language">
|
||||
<a-select v-model:value="formState.language" @change="changeLanguage" style="width: 120px">
|
||||
@ -47,6 +47,10 @@
|
||||
<a-input-number @change="changeSideMenuWidth" v-model:value="formState.sideMenuWidth" :min="1" />
|
||||
像素(px)
|
||||
</a-form-item>
|
||||
<a-form-item :label="$t('setting.table.yHeight')">
|
||||
<a-input-number @change="changeTableYHeight" v-model:value="formState.tableYHeight" :min="100" />
|
||||
像素(px)
|
||||
</a-form-item>
|
||||
<a-form-item :label="$t('setting.page.width')" v-if="formState.layout === LAYOUT_ENUM.TOP.value">
|
||||
<a-input @change="changePageWidth" v-model:value="formState.pageWidth" />
|
||||
像素(px)或者 百分比
|
||||
@ -70,6 +74,12 @@
|
||||
<a-radio-button value="light">Light</a-radio-button>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
<a-form-item :label="$t('setting.pagetag.location')">
|
||||
<a-radio-group v-model:value="formState.pageTagLocation" button-style="solid" @change="changePageTagLocation">
|
||||
<a-radio-button value="top">顶部</a-radio-button>
|
||||
<a-radio-button value="center">中部</a-radio-button>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
<a-form-item :label="$t('setting.pagetag.style')">
|
||||
<a-radio-group v-model:value="formState.pageTagStyle" button-style="solid" @change="changePageTagStyle">
|
||||
<a-radio-button value="default">默认</a-radio-button>
|
||||
@ -81,7 +91,13 @@
|
||||
<a-switch @change="changePageTagFlag" v-model:checked="formState.pageTagFlag" checked-children="显示" un-checked-children="隐藏" />
|
||||
</a-form-item>
|
||||
<a-form-item :label="$t('setting.bread')">
|
||||
<a-switch @change="changeBreadCrumbFlag" v-model:checked="formState.breadCrumbFlag" checked-children="显示" un-checked-children="隐藏" />
|
||||
<a-switch
|
||||
@change="changeBreadCrumbFlag"
|
||||
:disabled="formState.pageTagLocation === 'top'"
|
||||
v-model:checked="formState.breadCrumbFlag"
|
||||
checked-children="显示"
|
||||
un-checked-children="隐藏"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item :label="$t('setting.footer')">
|
||||
<a-switch @change="changeFooterFlag" v-model:checked="formState.footerFlag" checked-children="显示" un-checked-children="隐藏" />
|
||||
@ -111,7 +127,7 @@
|
||||
</a-drawer>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, reactive, h } from 'vue';
|
||||
import { ref, reactive, h, watch } from 'vue';
|
||||
import { i18nList } from '/@/i18n/index';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import localStorageKeyConst from '/@/constants/local-storage-key-const';
|
||||
@ -186,6 +202,8 @@
|
||||
colorIndex: appConfigStore.colorIndex,
|
||||
// 侧边菜单宽度
|
||||
sideMenuWidth: appConfigStore.sideMenuWidth,
|
||||
// 表格高度
|
||||
tableYHeight: appConfigStore.tableYHeight,
|
||||
// 菜单主题
|
||||
sideMenuTheme: appConfigStore.sideMenuTheme,
|
||||
// 页面紧凑
|
||||
@ -206,10 +224,26 @@
|
||||
helpDocExpandFlag: appConfigStore.helpDocExpandFlag,
|
||||
// 水印
|
||||
watermarkFlag: appConfigStore.watermarkFlag,
|
||||
//标签页位置
|
||||
pageTagLocation: appConfigStore.pageTagLocation,
|
||||
};
|
||||
|
||||
let formState = reactive({ ...formValue });
|
||||
|
||||
watch(
|
||||
() => formState.pageTagLocation,
|
||||
() => {
|
||||
if (formState.pageTagLocation === 'top') {
|
||||
formState.breadCrumbFlag = false;
|
||||
} else {
|
||||
formState.breadCrumbFlag = true;
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
}
|
||||
);
|
||||
|
||||
const { locale } = useI18n();
|
||||
function changeLanguage(languageValue) {
|
||||
locale.value = languageValue;
|
||||
@ -218,6 +252,12 @@
|
||||
});
|
||||
}
|
||||
|
||||
function changePageTagLocation(e) {
|
||||
appConfigStore.$patch({
|
||||
pageTagLocation: e.target.value,
|
||||
});
|
||||
}
|
||||
|
||||
function changeLayout(e) {
|
||||
appConfigStore.$patch({
|
||||
layout: e.target.value,
|
||||
@ -236,6 +276,12 @@
|
||||
sideMenuWidth: value,
|
||||
});
|
||||
}
|
||||
function changeTableYHeight(value) {
|
||||
appConfigStore.$patch({
|
||||
tableYHeight: value,
|
||||
});
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
function changePageWidth(e) {
|
||||
appConfigStore.$patch({
|
||||
|
@ -40,7 +40,7 @@
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="less">
|
||||
::v-deep(.ant-menu-item-selected) {
|
||||
:deep(.ant-menu-item-selected) {
|
||||
border-right: 3px !important;
|
||||
}
|
||||
</style>
|
||||
|
@ -8,14 +8,7 @@
|
||||
* @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012
|
||||
-->
|
||||
<template>
|
||||
<a-menu
|
||||
v-model:openKeys="openKeys"
|
||||
v-model:selectedKeys="selectedKeys"
|
||||
class="smart-menu"
|
||||
mode="inline"
|
||||
:theme="theme"
|
||||
:inlineCollapsed="collapsed"
|
||||
>
|
||||
<a-menu v-model:openKeys="openKeys" v-model:selectedKeys="selectedKeys" class="smart-menu" mode="inline" :theme="theme">
|
||||
<template v-for="item in menuTree" :key="item.menuId">
|
||||
<template v-if="item.visibleFlag && !item.disabledFlag">
|
||||
<template v-if="$lodash.isEmpty(item.children)">
|
||||
@ -80,7 +73,7 @@
|
||||
let parentList = menuParentIdListMap.get(currentRoute.name) || [];
|
||||
|
||||
// 如果是折叠菜单的话,则不需要设置openkey
|
||||
if(!props.collapsed){
|
||||
if (!props.collapsed) {
|
||||
// 使用lodash的union函数,进行 去重合并两个数组
|
||||
let needOpenKeys = _.map(parentList, 'name').map(Number);
|
||||
openKeys.value = _.union(openKeys.value, needOpenKeys);
|
||||
|
@ -46,7 +46,6 @@ let currentRoute = useRoute();
|
||||
function updateSelectKeyAndOpenKey() {
|
||||
// 第一步,根据路由 更新选中 顶级菜单
|
||||
let parentList = useUserStore().menuParentIdListMap.get(currentRoute.name) || [];
|
||||
console.log('parentList', parentList)
|
||||
if (parentList.length === 0) {
|
||||
topMenuRef.value.updateSelectKey(currentRoute.name);
|
||||
return;
|
||||
|
@ -1,11 +1,11 @@
|
||||
<!--
|
||||
* 递归菜单
|
||||
*
|
||||
* @Author: 1024创新实验室-主任:卓大
|
||||
* @Date: 2022-09-06 20:29:12
|
||||
* @Wechat: zhuda1024
|
||||
* @Email: lab1024@163.com
|
||||
* @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012
|
||||
*
|
||||
* @Author: 1024创新实验室-主任:卓大
|
||||
* @Date: 2022-09-06 20:29:12
|
||||
* @Wechat: zhuda1024
|
||||
* @Email: lab1024@163.com
|
||||
* @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012
|
||||
-->
|
||||
<template>
|
||||
<div class="recursion-container" v-show="topMenu.children && topMenu.children.length > 0">
|
||||
@ -39,10 +39,11 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { HOME_PAGE_NAME } from '/@/constants/system/home-const';
|
||||
import SubMenu from './sub-menu.vue';
|
||||
import { router } from '/@/router';
|
||||
import { useRoute } from 'vue-router';
|
||||
import _ from 'lodash';
|
||||
import menuEmitter from './top-expand-menu-mitt';
|
||||
import { useAppConfigStore } from '/@/store/modules/system/app-config';
|
||||
@ -59,10 +60,23 @@ const props = defineProps({
|
||||
},
|
||||
});
|
||||
|
||||
//菜单宽度
|
||||
const sideMenuWidth = computed(() => useAppConfigStore().$state.sideMenuWidth);
|
||||
|
||||
// 选中的顶级菜单
|
||||
let topMenu = ref({});
|
||||
menuEmitter.on('selectTopMenu', onSelectTopMenu);
|
||||
|
||||
//动态通知顶部菜单栏侧边栏状态
|
||||
watch(
|
||||
topMenu,
|
||||
(value) => {
|
||||
let hasSideMenu = value.children && value.children.length > 0;
|
||||
menuEmitter.emit('sideMenuChange', hasSideMenu);
|
||||
},
|
||||
{ immediate: true, deep: true }
|
||||
);
|
||||
|
||||
// 监听选中顶级菜单事件
|
||||
function onSelectTopMenu(selectedTopMenu) {
|
||||
topMenu.value = selectedTopMenu;
|
||||
@ -75,6 +89,7 @@ function onSelectTopMenu(selectedTopMenu) {
|
||||
}
|
||||
|
||||
//展开的菜单
|
||||
let currentRoute = useRoute();
|
||||
const selectedKeys = ref([]);
|
||||
const openKeys = ref([]);
|
||||
|
||||
@ -87,6 +102,15 @@ function updateSelectKeyAndOpenKey(parentList, currentSelectKey) {
|
||||
selectedKeys.value = [currentSelectKey];
|
||||
}
|
||||
|
||||
watch(
|
||||
currentRoute,
|
||||
(value) => {
|
||||
selectedKeys.value = [value.name];
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
}
|
||||
);
|
||||
// 页面跳转
|
||||
function turnToPage(route) {
|
||||
useUserStore().deleteKeepAliveIncludes(route.menuId.toString());
|
||||
@ -113,22 +137,22 @@ const color = computed(() => {
|
||||
background-color: v-bind('color.background');
|
||||
}
|
||||
|
||||
.min-logo {
|
||||
height: @header-user-height;
|
||||
line-height: @header-user-height;
|
||||
padding: 0px 15px 0px 15px;
|
||||
// background-color: v-bind('color.background');
|
||||
.min-logo {
|
||||
height: @header-user-height;
|
||||
line-height: @header-user-height;
|
||||
padding: 0px 15px 0px 15px;
|
||||
// background-color: v-bind('color.background');
|
||||
|
||||
width: 80px;
|
||||
z-index: 21;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.logo-img {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
}
|
||||
width: 80px;
|
||||
z-index: 21;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.logo-img {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
}
|
||||
}
|
||||
.top-menu {
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
|
@ -75,19 +75,22 @@ function updateSelectKey(key) {
|
||||
defineExpose({ updateSelectKey });
|
||||
|
||||
// 动态计算当前导航宽度
|
||||
let menuInfo = computed(() => {
|
||||
let hasSideMenu = ref(false);
|
||||
menuEmitter.on('sideMenuChange', (data) => {
|
||||
hasSideMenu.value = data;
|
||||
});
|
||||
|
||||
const menuInfo = computed(() => {
|
||||
let width = '100vw';
|
||||
let right = '-100vw';
|
||||
let selectedItem = _.find(menuTree.value, { menuId: Number(selectedKeys.value[0]) });
|
||||
const hasSecoundMenu = selectedItem && !_.isEmpty(selectedItem.children) && selectedItem.children.some((e) => e.visibleFlag);
|
||||
if (hasSecoundMenu) {
|
||||
if (props.collapsed) {
|
||||
width = 'calc(100vw - 80px)';
|
||||
right = 'calc(-100vw + 80px)';
|
||||
} else {
|
||||
width = 'calc(100vw - 180px)';
|
||||
right = 'calc(-100vw + 180px)';
|
||||
}
|
||||
if (hasSideMenu.value) {
|
||||
if (props.collapsed) {
|
||||
width = 'calc(100vw - 80px)';
|
||||
right = 'calc(-100vw + 80px)';
|
||||
} else {
|
||||
width = 'calc(100vw - 180px)';
|
||||
right = 'calc(-100vw + 180px)';
|
||||
}
|
||||
}
|
||||
return {
|
||||
width,
|
||||
|
@ -20,7 +20,12 @@
|
||||
<!-- 顶部头部信息 -->
|
||||
<a-layout-header class="smart-layout-header" :id="LAYOUT_ELEMENT_IDS.header" v-show="!fullScreenFlag">
|
||||
<a-row justify="space-between" class="smart-layout-header-user">
|
||||
<a-col class="smart-layout-header-left">
|
||||
<a-col
|
||||
class="smart-layout-header-left"
|
||||
:style="{
|
||||
'max-width': `calc(100% - ${rightWidth}px)`,
|
||||
}"
|
||||
>
|
||||
<span class="collapsed-button">
|
||||
<menu-unfold-outlined v-if="collapsed" class="trigger" @click="() => (collapsed = !collapsed)" />
|
||||
<menu-fold-outlined v-else class="trigger" @click="() => (collapsed = !collapsed)" />
|
||||
@ -32,7 +37,8 @@
|
||||
</span>
|
||||
</a-tooltip>
|
||||
<span class="location-breadcrumb">
|
||||
<MenuLocationBreadcrumb />
|
||||
<PageTag v-if="pageTagLocation === 'top'" />
|
||||
<MenuLocationBreadcrumb v-if="pageTagLocation !== 'top'" />
|
||||
</span>
|
||||
</a-col>
|
||||
<!---用戶操作区域-->
|
||||
@ -40,7 +46,7 @@
|
||||
<HeaderUserSpace />
|
||||
</a-col>
|
||||
</a-row>
|
||||
<PageTag />
|
||||
<PageTag v-if="pageTagLocation === 'center'" />
|
||||
</a-layout-header>
|
||||
|
||||
<!--中间内容-->
|
||||
@ -84,7 +90,7 @@
|
||||
</a-layout>
|
||||
</template>
|
||||
<script setup>
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import { computed, nextTick, onMounted, ref, watch } from 'vue';
|
||||
import HeaderUserSpace from './components/header-user-space/index.vue';
|
||||
import MenuLocationBreadcrumb from './components/menu-location-breadcrumb/index.vue';
|
||||
import PageTag from './components/page-tag/index.vue';
|
||||
@ -99,6 +105,7 @@
|
||||
import { useRouter } from 'vue-router';
|
||||
import { HOME_PAGE_NAME } from '/@/constants/system/home-const';
|
||||
import { LAYOUT_ELEMENT_IDS } from '/@/layout/layout-const.js';
|
||||
const appConfigStore = useAppConfigStore();
|
||||
|
||||
const windowHeight = ref(window.innerHeight);
|
||||
//是否全屏
|
||||
@ -115,6 +122,8 @@
|
||||
const footerFlag = computed(() => useAppConfigStore().$state.footerFlag);
|
||||
// 是否显示水印
|
||||
const watermarkFlag = computed(() => useAppConfigStore().$state.watermarkFlag);
|
||||
// 标签页位置
|
||||
const pageTagLocation = computed(() => useAppConfigStore().$state.pageTagLocation);
|
||||
// 多余高度
|
||||
const dueHeight = computed(() => {
|
||||
let due = 40;
|
||||
@ -126,6 +135,34 @@
|
||||
}
|
||||
return due;
|
||||
});
|
||||
|
||||
watch(
|
||||
pageTagLocation,
|
||||
(newVal) => {
|
||||
if (newVal == 'top') {
|
||||
nextTick(() => {
|
||||
sizeComputed();
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
}
|
||||
);
|
||||
const rightWidth = ref(0);
|
||||
function sizeComputed() {
|
||||
const tagParentElement = document.querySelector('.location-breadcrumb');
|
||||
const tagsElement = tagParentElement.querySelector('.ant-tabs-nav-list');
|
||||
const parentElement = document.querySelector('.smart-layout-header-user');
|
||||
const rightElement = document.querySelector('.smart-layout-header-right');
|
||||
rightWidth.value = rightElement.offsetWidth;
|
||||
let ro = new ResizeObserver((e) => {
|
||||
rightWidth.value = rightElement.offsetWidth + 10;
|
||||
});
|
||||
ro.observe(rightElement);
|
||||
ro.observe(tagsElement);
|
||||
ro.observe(parentElement);
|
||||
}
|
||||
//是否隐藏菜单
|
||||
const collapsed = ref(false);
|
||||
|
||||
@ -204,6 +241,7 @@
|
||||
}
|
||||
|
||||
.location-breadcrumb {
|
||||
width: calc(100% - 56px);
|
||||
margin-left: 15px;
|
||||
line-height: @header-user-height;
|
||||
}
|
||||
|
@ -1,7 +1,14 @@
|
||||
<template>
|
||||
<a-layout class="admin-layout" style="min-height: 100%">
|
||||
<!-- 侧边菜单 side-menu -->
|
||||
<a-layout-sider :id="LAYOUT_ELEMENT_IDS.menu" class="side-menu" :width="sideMenuWidth" :collapsed="collapsed" :theme="theme" v-show="!fullScreenFlag">
|
||||
<a-layout-sider
|
||||
:id="LAYOUT_ELEMENT_IDS.menu"
|
||||
class="side-menu"
|
||||
:width="sideMenuWidth"
|
||||
v-model:collapsed="collapsed"
|
||||
:theme="theme"
|
||||
v-show="!fullScreenFlag"
|
||||
>
|
||||
<!-- 左侧菜单 -->
|
||||
<SideMenu :collapsed="collapsed" />
|
||||
</a-layout-sider>
|
||||
@ -11,27 +18,35 @@
|
||||
<!-- 顶部头部信息 -->
|
||||
<a-layout-header class="layout-header" :id="LAYOUT_ELEMENT_IDS.header" v-show="!fullScreenFlag">
|
||||
<a-row class="layout-header-user" justify="space-between">
|
||||
<a-col class="layout-header-left">
|
||||
<span class="collapsed-button">
|
||||
<menu-unfold-outlined v-if="collapsed" class="trigger" @click="() => (collapsed = !collapsed)" />
|
||||
<menu-fold-outlined v-else class="trigger" @click="() => (collapsed = !collapsed)" />
|
||||
</span>
|
||||
<a-tooltip placement="bottom">
|
||||
<template #title>首页</template>
|
||||
<span class="home-button" @click="goHome">
|
||||
<home-outlined class="trigger" />
|
||||
<a-col
|
||||
class="layout-header-left"
|
||||
:style="{
|
||||
'max-width': `calc(100% - ${rightWidth}px)`,
|
||||
}"
|
||||
>
|
||||
<div class="layout-header-box">
|
||||
<span class="collapsed-button">
|
||||
<menu-unfold-outlined v-if="collapsed" class="trigger" @click="() => (collapsed = !collapsed)" />
|
||||
<menu-fold-outlined v-else class="trigger" @click="() => (collapsed = !collapsed)" />
|
||||
</span>
|
||||
</a-tooltip>
|
||||
<span class="location-breadcrumb">
|
||||
<MenuLocationBreadcrumb />
|
||||
</span>
|
||||
<a-tooltip placement="bottom">
|
||||
<template #title>首页</template>
|
||||
<span class="home-button" @click="goHome">
|
||||
<home-outlined class="trigger" />
|
||||
</span>
|
||||
</a-tooltip>
|
||||
<span class="location-breadcrumb">
|
||||
<PageTag v-if="pageTagLocation === 'top'" />
|
||||
<MenuLocationBreadcrumb />
|
||||
</span>
|
||||
</div>
|
||||
</a-col>
|
||||
<!---用戶操作区域-->
|
||||
<a-col class="layout-header-right">
|
||||
<HeaderUserSpace />
|
||||
</a-col>
|
||||
</a-row>
|
||||
<PageTag />
|
||||
<PageTag v-if="pageTagLocation === 'center'" />
|
||||
</a-layout-header>
|
||||
|
||||
<!--中间内容-->
|
||||
@ -94,6 +109,8 @@
|
||||
import { useRouter } from 'vue-router';
|
||||
import { HOME_PAGE_NAME } from '/@/constants/system/home-const';
|
||||
import { LAYOUT_ELEMENT_IDS } from '/@/layout/layout-const.js';
|
||||
import { nextTick } from 'vue';
|
||||
const appConfigStore = useAppConfigStore();
|
||||
|
||||
const windowHeight = ref(window.innerHeight);
|
||||
//是否全屏
|
||||
@ -112,6 +129,8 @@
|
||||
const footerFlag = computed(() => useAppConfigStore().$state.footerFlag);
|
||||
// 是否显示水印
|
||||
const watermarkFlag = computed(() => useAppConfigStore().$state.watermarkFlag);
|
||||
// 标签页位置
|
||||
const pageTagLocation = computed(() => useAppConfigStore().$state.pageTagLocation);
|
||||
// 多余高度
|
||||
const dueHeight = computed(() => {
|
||||
let due = 40;
|
||||
@ -123,6 +142,36 @@
|
||||
}
|
||||
return due;
|
||||
});
|
||||
|
||||
watch(
|
||||
pageTagLocation,
|
||||
(newVal) => {
|
||||
if (newVal == 'top') {
|
||||
nextTick(() => {
|
||||
sizeComputed();
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
}
|
||||
);
|
||||
|
||||
const rightWidth = ref(0);
|
||||
function sizeComputed() {
|
||||
const tagParentElement = document.querySelector('.location-breadcrumb');
|
||||
const tagsElement = tagParentElement.querySelector('.ant-tabs-nav-list');
|
||||
const parentElement = document.querySelector('.layout-header-user');
|
||||
const rightElement = document.querySelector('.layout-header-right');
|
||||
rightWidth.value = rightElement.offsetWidth;
|
||||
let ro = new ResizeObserver((e) => {
|
||||
rightWidth.value = rightElement.offsetWidth + 10;
|
||||
});
|
||||
ro.observe(rightElement);
|
||||
ro.observe(tagsElement);
|
||||
ro.observe(parentElement);
|
||||
}
|
||||
|
||||
//是否隐藏菜单
|
||||
const collapsed = ref(false);
|
||||
|
||||
@ -188,6 +237,11 @@
|
||||
display: flex;
|
||||
height: @header-user-height;
|
||||
|
||||
.layout-header-box {
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
}
|
||||
.collapsed-button {
|
||||
margin-left: 10px;
|
||||
line-height: @header-user-height;
|
||||
@ -205,6 +259,7 @@
|
||||
}
|
||||
|
||||
.location-breadcrumb {
|
||||
width: calc(100% - 56px);
|
||||
margin-left: 15px;
|
||||
line-height: @header-user-height;
|
||||
}
|
||||
|
@ -20,7 +20,12 @@
|
||||
<!-- 顶部头部信息 -->
|
||||
<a-layout-header class="smart-layout-header">
|
||||
<a-row justify="space-between" class="smart-layout-header-user">
|
||||
<a-col class="smart-layout-header-left">
|
||||
<a-col
|
||||
class="smart-layout-header-left"
|
||||
:style="{
|
||||
'max-width': `calc(100% - ${rightWidth}px)`,
|
||||
}"
|
||||
>
|
||||
<span class="collapsed-button">
|
||||
<menu-unfold-outlined v-if="collapsed" class="trigger" @click="() => (collapsed = !collapsed)" />
|
||||
<menu-fold-outlined v-else class="trigger" @click="() => (collapsed = !collapsed)" />
|
||||
@ -32,7 +37,8 @@
|
||||
</span>
|
||||
</a-tooltip>
|
||||
<span class="location-breadcrumb">
|
||||
<MenuLocationBreadcrumb />
|
||||
<PageTag v-if="pageTagLocation === 'top'" />
|
||||
<MenuLocationBreadcrumb v-if="pageTagLocation === 'center'" />
|
||||
</span>
|
||||
</a-col>
|
||||
<!---用戶操作区域-->
|
||||
@ -40,7 +46,7 @@
|
||||
<HeaderUserSpace />
|
||||
</a-col>
|
||||
</a-row>
|
||||
<PageTag />
|
||||
<PageTag v-if="pageTagLocation === 'center'" />
|
||||
</a-layout-header>
|
||||
|
||||
<!--中间内容-->
|
||||
@ -76,204 +82,234 @@
|
||||
</a-layout>
|
||||
</template>
|
||||
<script setup>
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import HeaderUserSpace from './components/header-user-space/index.vue';
|
||||
import MenuLocationBreadcrumb from './components/menu-location-breadcrumb/index.vue';
|
||||
import PageTag from './components/page-tag/index.vue';
|
||||
import TopExpandMenu from './components/top-expand-menu/index.vue';
|
||||
import SmartFooter from './components/smart-footer/index.vue';
|
||||
import { smartKeepAlive } from './components/smart-keep-alive';
|
||||
import IframeIndex from '/@/components/framework/iframe/iframe-index.vue';
|
||||
import watermark from '../lib/smart-watermark';
|
||||
import { useAppConfigStore } from '/@/store/modules/system/app-config';
|
||||
import { useUserStore } from '/@/store/modules/system/user';
|
||||
import SideHelpDoc from './components/side-help-doc/index.vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { HOME_PAGE_NAME } from '/@/constants/system/home-const';
|
||||
import { computed, nextTick, onMounted, ref, watch } from 'vue';
|
||||
import HeaderUserSpace from './components/header-user-space/index.vue';
|
||||
import MenuLocationBreadcrumb from './components/menu-location-breadcrumb/index.vue';
|
||||
import PageTag from './components/page-tag/index.vue';
|
||||
import TopExpandMenu from './components/top-expand-menu/index.vue';
|
||||
import SmartFooter from './components/smart-footer/index.vue';
|
||||
import { smartKeepAlive } from './components/smart-keep-alive';
|
||||
import IframeIndex from '/@/components/framework/iframe/iframe-index.vue';
|
||||
import watermark from '../lib/smart-watermark';
|
||||
import { useAppConfigStore } from '/@/store/modules/system/app-config';
|
||||
import { useUserStore } from '/@/store/modules/system/user';
|
||||
import SideHelpDoc from './components/side-help-doc/index.vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { HOME_PAGE_NAME } from '/@/constants/system/home-const';
|
||||
|
||||
const windowHeight = ref(window.innerHeight);
|
||||
const windowHeight = ref(window.innerHeight);
|
||||
|
||||
//主题颜色
|
||||
const theme = computed(() => useAppConfigStore().$state.sideMenuTheme);
|
||||
//是否显示标签页
|
||||
const pageTagFlag = computed(() => useAppConfigStore().$state.pageTagFlag);
|
||||
// 是否显示帮助文档
|
||||
const helpDocFlag = computed(() => useAppConfigStore().$state.helpDocExpandFlag);
|
||||
// 是否显示页脚
|
||||
const footerFlag = computed(() => useAppConfigStore().$state.footerFlag);
|
||||
// 是否显示水印
|
||||
const watermarkFlag = computed(() => useAppConfigStore().$state.watermarkFlag);
|
||||
// 多余高度
|
||||
const dueHeight = computed(() => {
|
||||
let due = 40;
|
||||
if (useAppConfigStore().$state.pageTagFlag) {
|
||||
due = due + 40;
|
||||
//主题颜色
|
||||
const theme = computed(() => useAppConfigStore().$state.sideMenuTheme);
|
||||
//是否显示标签页
|
||||
const pageTagFlag = computed(() => useAppConfigStore().$state.pageTagFlag);
|
||||
// 是否显示帮助文档
|
||||
const helpDocFlag = computed(() => useAppConfigStore().$state.helpDocExpandFlag);
|
||||
// 是否显示页脚
|
||||
const footerFlag = computed(() => useAppConfigStore().$state.footerFlag);
|
||||
// 是否显示水印
|
||||
const watermarkFlag = computed(() => useAppConfigStore().$state.watermarkFlag);
|
||||
// 标签页位置
|
||||
const pageTagLocation = computed(() => useAppConfigStore().$state.pageTagLocation);
|
||||
// 多余高度
|
||||
const dueHeight = computed(() => {
|
||||
let due = 40;
|
||||
if (useAppConfigStore().$state.pageTagFlag) {
|
||||
due = due + 40;
|
||||
}
|
||||
if (useAppConfigStore().$state.footerFlag) {
|
||||
due = due + 40;
|
||||
}
|
||||
return due;
|
||||
});
|
||||
watch(
|
||||
pageTagLocation,
|
||||
(newVal) => {
|
||||
if (newVal == 'top') {
|
||||
nextTick(() => {
|
||||
sizeComputed();
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
}
|
||||
);
|
||||
const rightWidth = ref(0);
|
||||
function sizeComputed() {
|
||||
const tagParentElement = document.querySelector('.location-breadcrumb');
|
||||
const tagsElement = tagParentElement.querySelector('.ant-tabs-nav-list');
|
||||
const parentElement = document.querySelector('.smart-layout-header-user');
|
||||
const rightElement = document.querySelector('.smart-layout-header-right');
|
||||
rightWidth.value = rightElement.offsetWidth;
|
||||
let ro = new ResizeObserver((e) => {
|
||||
rightWidth.value = rightElement.offsetWidth + 10;
|
||||
});
|
||||
ro.observe(rightElement);
|
||||
ro.observe(tagsElement);
|
||||
ro.observe(parentElement);
|
||||
}
|
||||
if (useAppConfigStore().$state.footerFlag) {
|
||||
due = due + 40;
|
||||
}
|
||||
return due;
|
||||
});
|
||||
//是否隐藏菜单
|
||||
const collapsed = ref(false);
|
||||
//是否隐藏菜单
|
||||
const collapsed = ref(false);
|
||||
|
||||
//页面初始化的时候加载水印
|
||||
onMounted(() => {
|
||||
if (watermarkFlag.value) {
|
||||
watermark.set('smartAdminLayoutContent', useUserStore().actualName);
|
||||
} else {
|
||||
watermark.clear();
|
||||
}
|
||||
});
|
||||
|
||||
watch(
|
||||
() => watermarkFlag.value,
|
||||
(newValue) => {
|
||||
if (newValue) {
|
||||
//页面初始化的时候加载水印
|
||||
onMounted(() => {
|
||||
if (watermarkFlag.value) {
|
||||
watermark.set('smartAdminLayoutContent', useUserStore().actualName);
|
||||
} else {
|
||||
watermark.clear();
|
||||
}
|
||||
});
|
||||
|
||||
watch(
|
||||
() => watermarkFlag.value,
|
||||
(newValue) => {
|
||||
if (newValue) {
|
||||
watermark.set('smartAdminLayoutContent', useUserStore().actualName);
|
||||
} else {
|
||||
watermark.clear();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
window.addEventListener('resize', function () {
|
||||
windowHeight.value = window.innerHeight;
|
||||
});
|
||||
|
||||
//回到顶部
|
||||
const backTopTarget = () => {
|
||||
return document.getElementById('smartAdminMain');
|
||||
};
|
||||
// ----------------------- keep-alive相关 -----------------------
|
||||
let { route, keepAliveIncludes, iframeNotKeepAlivePageFlag, keepAliveIframePages } = smartKeepAlive();
|
||||
const router = useRouter();
|
||||
function goHome() {
|
||||
router.push({ name: HOME_PAGE_NAME });
|
||||
}
|
||||
);
|
||||
|
||||
window.addEventListener('resize', function () {
|
||||
windowHeight.value = window.innerHeight;
|
||||
});
|
||||
|
||||
//回到顶部
|
||||
const backTopTarget = () => {
|
||||
return document.getElementById('smartAdminMain');
|
||||
};
|
||||
// ----------------------- keep-alive相关 -----------------------
|
||||
let { route, keepAliveIncludes, iframeNotKeepAlivePageFlag, keepAliveIframePages } = smartKeepAlive();
|
||||
const router = useRouter();
|
||||
function goHome() {
|
||||
router.push({ name: HOME_PAGE_NAME });
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="less">
|
||||
:deep(.ant-layout-header) {
|
||||
height: auto;
|
||||
}
|
||||
:deep(.layout-header) {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.smart-layout-header {
|
||||
background: #fff;
|
||||
padding: 0;
|
||||
z-index: 21;
|
||||
}
|
||||
|
||||
.smart-layout-header-user {
|
||||
height: @header-user-height;
|
||||
border-bottom: 1px solid #f6f6f6;
|
||||
}
|
||||
|
||||
.smart-layout-header-left {
|
||||
display: flex;
|
||||
height: @header-user-height;
|
||||
|
||||
.collapsed-button {
|
||||
margin-left: 10px;
|
||||
line-height: @header-user-height;
|
||||
:deep(.ant-layout-header) {
|
||||
height: auto;
|
||||
}
|
||||
:deep(.layout-header) {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.home-button {
|
||||
margin-left: 15px;
|
||||
cursor: pointer;
|
||||
padding: 0 5px;
|
||||
line-height: @header-user-height;
|
||||
.smart-layout-header {
|
||||
background: #fff;
|
||||
padding: 0;
|
||||
z-index: 21;
|
||||
}
|
||||
|
||||
.home-button:hover {
|
||||
background-color: #efefef;
|
||||
.smart-layout-header-user {
|
||||
height: @header-user-height;
|
||||
border-bottom: 1px solid #f6f6f6;
|
||||
}
|
||||
|
||||
.location-breadcrumb {
|
||||
margin-left: 15px;
|
||||
line-height: @header-user-height;
|
||||
.smart-layout-header-left {
|
||||
display: flex;
|
||||
height: @header-user-height;
|
||||
|
||||
.collapsed-button {
|
||||
margin-left: 10px;
|
||||
line-height: @header-user-height;
|
||||
}
|
||||
|
||||
.home-button {
|
||||
margin-left: 15px;
|
||||
cursor: pointer;
|
||||
padding: 0 5px;
|
||||
line-height: @header-user-height;
|
||||
}
|
||||
|
||||
.home-button:hover {
|
||||
background-color: #efefef;
|
||||
}
|
||||
|
||||
.location-breadcrumb {
|
||||
width: calc(100% - 56px);
|
||||
margin-left: 15px;
|
||||
line-height: @header-user-height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.smart-layout-header-right {
|
||||
display: flex;
|
||||
height: @header-user-height;
|
||||
}
|
||||
.smart-layout-header-right {
|
||||
display: flex;
|
||||
height: @header-user-height;
|
||||
}
|
||||
|
||||
.admin-layout {
|
||||
.side-menu {
|
||||
height: 100vh;
|
||||
flex: 0 !important;
|
||||
min-width: inherit !important;
|
||||
max-width: none !important;
|
||||
// width: auto !important;
|
||||
&.fixed-side {
|
||||
position: fixed;
|
||||
.admin-layout {
|
||||
.side-menu {
|
||||
height: 100vh;
|
||||
left: 0;
|
||||
top: 0;
|
||||
flex: 0 !important;
|
||||
min-width: inherit !important;
|
||||
max-width: none !important;
|
||||
// width: auto !important;
|
||||
&.fixed-side {
|
||||
position: fixed;
|
||||
height: 100vh;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
.side-menu::-webkit-scrollbar {
|
||||
width: 4px;
|
||||
}
|
||||
.side-menu::-webkit-scrollbar-thumb {
|
||||
border-radius: 10px;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
.side-menu::-webkit-scrollbar-track {
|
||||
border-radius: 0;
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
}
|
||||
.side-menu::-webkit-scrollbar {
|
||||
width: 4px;
|
||||
}
|
||||
.side-menu::-webkit-scrollbar-thumb {
|
||||
border-radius: 10px;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
.side-menu::-webkit-scrollbar-track {
|
||||
border-radius: 0;
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.help-doc-sider {
|
||||
flex: 0 !important;
|
||||
min-width: 100px;
|
||||
height: 100vh;
|
||||
max-width: 100px;
|
||||
width: auto !important;
|
||||
&.fixed-side {
|
||||
position: fixed;
|
||||
.help-doc-sider {
|
||||
flex: 0 !important;
|
||||
min-width: 100px;
|
||||
height: 100vh;
|
||||
right: 0;
|
||||
top: 0;
|
||||
max-width: 100px;
|
||||
width: auto !important;
|
||||
&.fixed-side {
|
||||
position: fixed;
|
||||
height: 100vh;
|
||||
right: 0;
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.virtual-side {
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.virtual-header {
|
||||
transition: all 0.2s;
|
||||
opacity: 0;
|
||||
|
||||
&.fixed-tabs.multi-page:not(.fixed-header) {
|
||||
height: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.admin-layout-main {
|
||||
padding-top: 46px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.admin-layout-content {
|
||||
background-color: inherit;
|
||||
min-height: auto;
|
||||
position: relative;
|
||||
padding: 10px 10px 0px 10px;
|
||||
height: calc(100% - v-bind(dueHeight) px);
|
||||
overflow-x: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.virtual-side {
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.virtual-header {
|
||||
transition: all 0.2s;
|
||||
opacity: 0;
|
||||
|
||||
&.fixed-tabs.multi-page:not(.fixed-header) {
|
||||
height: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.admin-layout-main {
|
||||
padding-top: 46px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.admin-layout-content {
|
||||
background-color: inherit;
|
||||
min-height: auto;
|
||||
.smart-layout-footer {
|
||||
position: relative;
|
||||
padding: 10px 10px 0px 10px;
|
||||
height: calc(100% - v-bind(dueHeight) px);
|
||||
overflow-x: hidden;
|
||||
padding: 10px 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
.smart-layout-footer {
|
||||
position: relative;
|
||||
padding: 10px 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
||||
|
@ -8,7 +8,8 @@
|
||||
<!--中间内容-->
|
||||
<a-layout-content :id="LAYOUT_ELEMENT_IDS.content" class="admin-layout-content">
|
||||
<!---标签页-->
|
||||
<div class="page-tag-div" v-show="pageTagFlag && !fullScreenFlag" :id="LAYOUT_ELEMENT_IDS.header">
|
||||
<div class="page-tag-div" v-show="(pageTagFlag && !fullScreenFlag) || breadCrumbFlag" :id="LAYOUT_ELEMENT_IDS.header">
|
||||
<MenuLocationBreadcrumb v-if="pageTagLocation !== 'top'" />
|
||||
<PageTag />
|
||||
</div>
|
||||
|
||||
@ -56,6 +57,7 @@
|
||||
import { useRouter } from 'vue-router';
|
||||
import { HOME_PAGE_NAME } from '/@/constants/system/home-const';
|
||||
import { LAYOUT_ELEMENT_IDS } from '/@/layout/layout-const.js';
|
||||
import MenuLocationBreadcrumb from './components/menu-location-breadcrumb/index.vue';
|
||||
|
||||
const windowHeight = ref(window.innerHeight);
|
||||
//主题颜色
|
||||
@ -76,6 +78,10 @@
|
||||
const footerFlag = computed(() => useAppConfigStore().$state.footerFlag);
|
||||
// 是否显示水印
|
||||
const watermarkFlag = computed(() => useAppConfigStore().$state.watermarkFlag);
|
||||
// 标签页位置
|
||||
const pageTagLocation = computed(() => useAppConfigStore().$state.pageTagLocation);
|
||||
// 面包屑
|
||||
const breadCrumbFlag = computed(() => useAppConfigStore().$state.breadCrumbFlag);
|
||||
// 页面宽度
|
||||
const pageWidth = computed(() => useAppConfigStore().$state.pageWidth);
|
||||
// 多余高度
|
||||
@ -85,9 +91,16 @@
|
||||
}
|
||||
|
||||
let due = '45px';
|
||||
if (useAppConfigStore().$state.pageTagFlag) {
|
||||
if (useAppConfigStore().$state.pageTagFlag || useAppConfigStore().$state.breadCrumbFlag) {
|
||||
due = '85px';
|
||||
}
|
||||
if (
|
||||
useAppConfigStore().$state.pageTagFlag &&
|
||||
useAppConfigStore().$state.pageTagLocation === 'center' &&
|
||||
useAppConfigStore().$state.breadCrumbFlag
|
||||
) {
|
||||
due = '125px';
|
||||
}
|
||||
return due;
|
||||
});
|
||||
|
||||
|
@ -17,7 +17,7 @@ import _ from 'lodash';
|
||||
import LocalStorageKeyConst from '/@/constants/local-storage-key-const.js';
|
||||
|
||||
// token的消息头
|
||||
const TOKEN_HEADER = 'x-access-token';
|
||||
const TOKEN_HEADER = 'Authorization';
|
||||
|
||||
// 创建axios对象
|
||||
const smartAxios = axios.create({
|
||||
@ -37,7 +37,7 @@ smartAxios.interceptors.request.use(
|
||||
// 在发送请求之前消息头加入token token
|
||||
const token = localRead(LocalStorageKeyConst.USER_TOKEN);
|
||||
if (token) {
|
||||
config.headers[TOKEN_HEADER] = token;
|
||||
config.headers[TOKEN_HEADER] = 'Bearer ' + token;
|
||||
} else {
|
||||
delete config.headers[TOKEN_HEADER];
|
||||
}
|
||||
|
@ -30,6 +30,9 @@ import 'vue3-tabs-chrome/dist/vue3-tabs-chrome.css';
|
||||
import '/@/theme/index.less';
|
||||
import { localRead } from '/@/utils/local-util.js';
|
||||
import LocalStorageKeyConst from '/@/constants/local-storage-key-const.js';
|
||||
import { Table } from 'ant-design-vue';
|
||||
import { useAppConfigStore } from '/@/store/modules/system/app-config';
|
||||
import '/@/utils/ployfill';
|
||||
|
||||
/*
|
||||
* -------------------- ※ 着重 解释说明下main.js的初始化逻辑 begin ※ --------------------
|
||||
@ -64,7 +67,7 @@ async function getLoginInfo() {
|
||||
}
|
||||
}
|
||||
|
||||
function initVue() {
|
||||
async function initVue() {
|
||||
let vueApp = createApp(App);
|
||||
let app = vueApp.use(router).use(store).use(i18n).use(Antd).use(smartEnumPlugin, constantsInfo).use(privilegePlugin).use(JsonViewer);
|
||||
//注入权限
|
||||
@ -83,11 +86,17 @@ function initVue() {
|
||||
//挂载
|
||||
app.mount('#app');
|
||||
}
|
||||
|
||||
function setTableYHeight() {
|
||||
Table.props.scroll.default = {
|
||||
y: useAppConfigStore().tableYHeight,
|
||||
};
|
||||
}
|
||||
//不需要获取用户信息、用户菜单、用户菜单动态路由,直接初始化vue即可
|
||||
let token = localRead(LocalStorageKeyConst.USER_TOKEN);
|
||||
if (!token) {
|
||||
initVue();
|
||||
await initVue();
|
||||
setTableYHeight();
|
||||
} else {
|
||||
getLoginInfo();
|
||||
await getLoginInfo();
|
||||
setTableYHeight();
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
* @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012
|
||||
*/
|
||||
import { useUserStore } from '/@/store/modules/system/user';
|
||||
import _ from 'lodash';
|
||||
|
||||
const privilege = (value) => {
|
||||
// 超级管理员
|
||||
|
53
smart-admin-web-javascript/src/store/modules/system/dict.js
Normal file
53
smart-admin-web-javascript/src/store/modules/system/dict.js
Normal file
@ -0,0 +1,53 @@
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
export const useDictStore = defineStore({
|
||||
id: 'dict',
|
||||
state: () => ({
|
||||
dict: new Array(),
|
||||
}),
|
||||
actions: {
|
||||
// 获取字典
|
||||
getDict(keyCode) {
|
||||
if (keyCode == null && keyCode == '') {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
for (let i = 0; i < this.dict.length; i++) {
|
||||
if (this.dict[i].keyCode == keyCode) {
|
||||
return this.dict[i].value;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
// 设置字典
|
||||
setDict(keyCode, value) {
|
||||
if (keyCode !== null && keyCode !== '') {
|
||||
this.dict.push({
|
||||
key: keyCode,
|
||||
value: value,
|
||||
});
|
||||
}
|
||||
},
|
||||
// 删除字典
|
||||
removeDict(keyCode) {
|
||||
let flag = false;
|
||||
try {
|
||||
for (let i = 0; i < this.dict.length; i++) {
|
||||
if (this.dict[i].keyCode == keyCode) {
|
||||
this.dict.splice(i, 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
flag = false;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
// 清空字典
|
||||
cleanDict() {
|
||||
this.dict = new Array();
|
||||
},
|
||||
},
|
||||
});
|
@ -73,7 +73,7 @@ export const useUserStore = defineStore({
|
||||
}
|
||||
return localRead(localKey.USER_TOKEN);
|
||||
},
|
||||
getNeedUpdatePwdFlag(state) {
|
||||
getNeedUpdatePwdFlag(state){
|
||||
return state.needUpdatePwdFlag;
|
||||
},
|
||||
//是否初始化了 路由
|
||||
@ -206,7 +206,7 @@ export const useUserStore = defineStore({
|
||||
// @ts-ignore
|
||||
menuTitle: route.meta.title,
|
||||
menuQuery: route.query,
|
||||
menuIcon: route.meta?.icon,
|
||||
menuIcon:route.meta?.icon,
|
||||
// @ts-ignore
|
||||
fromMenuName: from.name,
|
||||
fromMenuQuery: from.query,
|
||||
|
22
smart-admin-web-javascript/src/utils/dict.js
Normal file
22
smart-admin-web-javascript/src/utils/dict.js
Normal file
@ -0,0 +1,22 @@
|
||||
import { useDictStore } from '/@/store/modules/system/dict';
|
||||
import { dictApi } from '/@/api/support/dict-api';
|
||||
|
||||
/**
|
||||
* 获取字典数据
|
||||
*/
|
||||
|
||||
export function useDict(...args) {
|
||||
let res = {};
|
||||
args.forEach(async (keyCode, index) => {
|
||||
res[keyCode] = [];
|
||||
const dicts = useDictStore().getDict(keyCode);
|
||||
if (dicts) {
|
||||
res[keyCode] = dicts;
|
||||
} else {
|
||||
let result = await dictApi.valueList(keyCode);
|
||||
res[keyCode] = result.data;
|
||||
useDictStore().setDict(keyCode, res[keyCode]);
|
||||
}
|
||||
});
|
||||
return res;
|
||||
}
|
14
smart-admin-web-javascript/src/utils/ployfill.js
Normal file
14
smart-admin-web-javascript/src/utils/ployfill.js
Normal file
@ -0,0 +1,14 @@
|
||||
//去除谷歌浏览器的scroll、wheel等事件警告
|
||||
(function () {
|
||||
if (typeof EventTarget !== 'undefined') {
|
||||
let func = EventTarget.prototype.addEventListener;
|
||||
EventTarget.prototype.addEventListener = function (type, fn, capture) {
|
||||
this.func = func;
|
||||
if (typeof capture !== 'boolean') {
|
||||
capture = capture || {};
|
||||
capture.passive = false;
|
||||
}
|
||||
this.func(type, fn, capture);
|
||||
};
|
||||
}
|
||||
})();
|
@ -17,7 +17,7 @@
|
||||
</a-modal>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import { ref, reactive, nextTick } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { SmartLoading } from '/@/components/framework/smart-loading';
|
||||
import _ from 'lodash';
|
||||
@ -43,6 +43,21 @@
|
||||
Object.assign(form, rowData);
|
||||
}
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
// 解决弹窗错误信息显示,没有可忽略
|
||||
const domArr = document.getElementsByClassName('ant-modal');
|
||||
if (domArr && domArr.length > 0) {
|
||||
Array.from(domArr).forEach((item) => {
|
||||
if (item.childNodes && item.childNodes.length > 0) {
|
||||
Array.from(item.childNodes).forEach((child) => {
|
||||
if (child.setAttribute) {
|
||||
child.setAttribute('aria-hidden', 'false');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function onClose() {
|
||||
|
@ -20,7 +20,7 @@
|
||||
<SmartEnumSelect enum-name="GOODS_STATUS_ENUM" v-model:value="form.goodsStatus" />
|
||||
</a-form-item>
|
||||
<a-form-item label="产地" name="place">
|
||||
<DictSelect width="100%" key-code="GODOS_PLACE" v-model:value="form.place" mode="tags" />
|
||||
<DictSelect width="100%" key-code="GOODS_PLACE" v-model:value="form.place" mode="tags" />
|
||||
</a-form-item>
|
||||
<a-form-item label="上架状态" name="shelvesFlag">
|
||||
<a-radio-group v-model:value="form.shelvesFlag">
|
||||
@ -107,7 +107,7 @@
|
||||
Object.assign(form, rowData);
|
||||
}
|
||||
if (form.place && form.place.length > 0) {
|
||||
form.place = form.place.map((e) => e.valueCode);
|
||||
form.place = form.place.split(',');
|
||||
}
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
|
@ -25,7 +25,7 @@
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="产地" name="place" class="smart-query-form-item">
|
||||
<DictSelect key-code="GODOS_PLACE" v-model:value="queryForm.place" width="120px" />
|
||||
<DictSelect key-code="GOODS_PLACE" v-model:value="queryForm.place" width="120px" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="商品状态" name="goodsStatus" class="smart-query-form-item">
|
||||
@ -35,8 +35,8 @@
|
||||
<a-form-item label="快速筛选" class="smart-query-form-item">
|
||||
<a-radio-group v-model:value="queryForm.shelvesFlag" @change="onSearch">
|
||||
<a-radio-button :value="undefined">全部</a-radio-button>
|
||||
<a-radio-button :value="true">上架</a-radio-button>
|
||||
<a-radio-button :value="false">下架</a-radio-button>
|
||||
<a-radio-button :value="'true'">上架</a-radio-button>
|
||||
<a-radio-button :value="'false'">下架</a-radio-button>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
|
||||
@ -102,15 +102,28 @@
|
||||
:dataSource="tableData"
|
||||
:columns="columns"
|
||||
rowKey="goodsId"
|
||||
:scroll="{ x: 1000 }"
|
||||
bordered
|
||||
:pagination="false"
|
||||
:showSorterTooltip="false"
|
||||
:row-selection="{ selectedRowKeys: selectedRowKeyList, onChange: onSelectChange }"
|
||||
@change="onChange"
|
||||
@resizeColumn="handleResizeColumn"
|
||||
>
|
||||
<!-- main.js中有全局表格高度配置,也可单独配置 -->
|
||||
<!-- :scroll="{ y: 300 }" -->
|
||||
<template #headerCell="{ column }">
|
||||
<SmartHeaderCell v-model:value="queryForm[column.filterOptions?.key || column.dataIndex]" :column="column" @change="queryData" />
|
||||
</template>
|
||||
<template #bodyCell="{ text, record, column }">
|
||||
<template v-if="column.dataIndex === 'goodsName'">
|
||||
{{ text }}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'place'">
|
||||
<span>{{ text && text.length > 0 ? text.map((e) => e.valueName).join(',') : '' }}</span>
|
||||
<DictPreview :options="descList.GOODS_PLACE" :value="text" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'remark'">
|
||||
<span>{{ text ? text : '' }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'goodsStatus'">
|
||||
<span>{{ $smartEnumPlugin.getDescByValue('GOODS_STATUS_ENUM', text) }}</span>
|
||||
@ -176,7 +189,7 @@
|
||||
</template>
|
||||
<script setup>
|
||||
import GoodsFormModal from './components/goods-form-modal.vue';
|
||||
import { reactive, ref, onMounted } from 'vue';
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { SmartLoading } from '/@/components/framework/smart-loading';
|
||||
import { goodsApi } from '/@/api/business/goods/goods-api';
|
||||
@ -189,52 +202,88 @@
|
||||
import { GOODS_STATUS_ENUM } from '/@/constants/business/erp/goods-const';
|
||||
import DictSelect from '/@/components/support/dict-select/index.vue';
|
||||
import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue';
|
||||
import { FILE_FOLDER_TYPE_ENUM } from '/@/constants/support/file-const.js';
|
||||
import FileUpload from '/@/components/support/file-upload/index.vue';
|
||||
import _ from 'lodash';
|
||||
import SmartHeaderCell from '/@/components/smart-table-header-cell/index.vue';
|
||||
import DictPreview from '/@/components/dict-preview/index.vue';
|
||||
import { useDict } from '/@/utils/dict';
|
||||
|
||||
const descList = useDict('GOODS_PLACE');
|
||||
// ---------------------------- 表格列 ----------------------------
|
||||
|
||||
const columns = ref([
|
||||
{
|
||||
title: '商品分类',
|
||||
dataIndex: 'categoryName',
|
||||
resizable: true,
|
||||
filterOptions: {
|
||||
type: 'category-tree',
|
||||
key: 'categoryId',
|
||||
categoryType: CATEGORY_TYPE_ENUM.GOODS.value,
|
||||
},
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '商品名称',
|
||||
dataIndex: 'goodsName',
|
||||
resizable: true,
|
||||
filterOptions: {
|
||||
type: 'input',
|
||||
key: 'searchWord',
|
||||
},
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '商品状态',
|
||||
dataIndex: 'goodsStatus',
|
||||
sorter: true
|
||||
resizable: true,
|
||||
sorter: true,
|
||||
filterOptions: {
|
||||
type: 'enum-select',
|
||||
enumName: 'GOODS_STATUS_ENUM',
|
||||
},
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '产地',
|
||||
dataIndex: 'place',
|
||||
resizable: true,
|
||||
filterOptions: {
|
||||
type: 'dict-select',
|
||||
keyCode: 'GOODS_PLACE',
|
||||
},
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '商品价格',
|
||||
title: '价格',
|
||||
dataIndex: 'price',
|
||||
sorter: true
|
||||
resizable: true,
|
||||
sorter: true,
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '上架状态',
|
||||
title: '状态',
|
||||
dataIndex: 'shelvesFlag',
|
||||
sorter: true
|
||||
resizable: true,
|
||||
sorter: true,
|
||||
width: 80,
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
dataIndex: 'remark',
|
||||
ellipsis: true,
|
||||
resizable: true,
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
resizable: true,
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
resizable: true,
|
||||
fixed: 'right',
|
||||
width: 100,
|
||||
},
|
||||
@ -251,7 +300,7 @@
|
||||
goodsType: undefined,
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
sortItemList: []
|
||||
sortItemList: [],
|
||||
};
|
||||
// 查询表单form
|
||||
const queryForm = reactive(_.cloneDeep(queryFormState));
|
||||
@ -261,7 +310,15 @@
|
||||
const tableData = ref([]);
|
||||
// 总数
|
||||
const total = ref(0);
|
||||
|
||||
function handleResizeColumn(w, col) {
|
||||
columns.value.forEach((item) => {
|
||||
if (item.dataIndex === col.dataIndex) {
|
||||
item.width = Math.floor(w);
|
||||
// 拖动宽度标识
|
||||
item.dragAndDropFlag = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
// 重置查询条件
|
||||
function resetQuery() {
|
||||
let pageSize = queryForm.pageSize;
|
||||
@ -421,11 +478,11 @@
|
||||
await goodsApi.exportGoods();
|
||||
}
|
||||
|
||||
function onChange(pagination, filters, sorter, { action }){
|
||||
function onChange(pagination, filters, sorter, { action }) {
|
||||
if (action === 'sort') {
|
||||
const { order, field } = sorter;
|
||||
let column = camelToUnderscore(field);
|
||||
let findIndex = queryForm.sortItemList.findIndex(e => e.column === column);
|
||||
let findIndex = queryForm.sortItemList.findIndex((e) => e.column === column);
|
||||
if (findIndex !== -1) {
|
||||
queryForm.sortItemList.splice(findIndex, 1);
|
||||
}
|
||||
@ -433,7 +490,7 @@
|
||||
let isAsc = order !== 'ascend';
|
||||
queryForm.sortItemList.push({
|
||||
column,
|
||||
isAsc
|
||||
isAsc,
|
||||
});
|
||||
}
|
||||
queryData();
|
||||
@ -441,6 +498,6 @@
|
||||
}
|
||||
|
||||
function camelToUnderscore(str) {
|
||||
return str.replace(/([A-Z])/g, "_$1").toLowerCase();
|
||||
return str.replace(/([A-Z])/g, '_$1').toLowerCase();
|
||||
}
|
||||
</script>
|
||||
|
@ -85,6 +85,21 @@
|
||||
detail(enterpriseId);
|
||||
}
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
// 解决弹窗错误信息显示,没有可忽略
|
||||
const domArr = document.getElementsByClassName('ant-modal');
|
||||
if (domArr && domArr.length > 0) {
|
||||
Array.from(domArr).forEach((item) => {
|
||||
if (item.childNodes && item.childNodes.length > 0) {
|
||||
Array.from(item.childNodes).forEach((child) => {
|
||||
if (child.setAttribute) {
|
||||
child.setAttribute('aria-hidden', 'false');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function onClose() {
|
||||
|
@ -60,102 +60,102 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { reactive, ref } from 'vue';
|
||||
import { noticeApi } from '/@/api/business/oa/notice-api';
|
||||
import { PAGE_SIZE, PAGE_SIZE_OPTIONS } from '/@/constants/common-const';
|
||||
import DepartmentTreeSelect from '/@/components/system/department-tree-select/index.vue';
|
||||
import uaparser from 'ua-parser-js';
|
||||
import { reactive, ref } from 'vue';
|
||||
import { noticeApi } from '/@/api/business/oa/notice-api';
|
||||
import { PAGE_SIZE, PAGE_SIZE_OPTIONS } from '/@/constants/common-const';
|
||||
import DepartmentTreeSelect from '/@/components/system/department-tree-select/index.vue';
|
||||
import uaparser from 'ua-parser-js';
|
||||
|
||||
const props = defineProps({
|
||||
noticeId: {
|
||||
type: [Number, String],
|
||||
},
|
||||
});
|
||||
const props = defineProps({
|
||||
noticeId: {
|
||||
type: [Number, String],
|
||||
},
|
||||
});
|
||||
|
||||
defineExpose({
|
||||
onSearch,
|
||||
});
|
||||
defineExpose({
|
||||
onSearch,
|
||||
});
|
||||
|
||||
const tableColumns = [
|
||||
{
|
||||
title: '姓名',
|
||||
dataIndex: 'employeeName',
|
||||
},
|
||||
{
|
||||
title: '查看次数',
|
||||
dataIndex: 'pageViewCount',
|
||||
},
|
||||
{
|
||||
title: '首次查看设备',
|
||||
dataIndex: 'firstIp',
|
||||
},
|
||||
{
|
||||
title: '首次查看时间',
|
||||
dataIndex: 'createTime',
|
||||
},
|
||||
{
|
||||
title: '最后一次查看设备',
|
||||
dataIndex: 'lastIp',
|
||||
},
|
||||
{
|
||||
title: '最后一次查看时间',
|
||||
dataIndex: 'updateTime',
|
||||
with: 80,
|
||||
},
|
||||
];
|
||||
const tableColumns = [
|
||||
{
|
||||
title: '姓名',
|
||||
dataIndex: 'employeeName',
|
||||
},
|
||||
{
|
||||
title: '查看次数',
|
||||
dataIndex: 'pageViewCount',
|
||||
},
|
||||
{
|
||||
title: '首次查看设备',
|
||||
dataIndex: 'firstIp',
|
||||
},
|
||||
{
|
||||
title: '首次查看时间',
|
||||
dataIndex: 'createTime',
|
||||
},
|
||||
{
|
||||
title: '最后一次查看设备',
|
||||
dataIndex: 'lastIp',
|
||||
},
|
||||
{
|
||||
title: '最后一次查看时间',
|
||||
dataIndex: 'updateTime',
|
||||
with: 80,
|
||||
},
|
||||
];
|
||||
|
||||
const tableData = ref([]);
|
||||
const total = ref(0);
|
||||
const tableLoading = ref(false);
|
||||
const tableData = ref([]);
|
||||
const total = ref(0);
|
||||
const tableLoading = ref(false);
|
||||
|
||||
const defaultQueryForm = {
|
||||
noticeId: props.noticeId,
|
||||
departmentId: null,
|
||||
keywords: '',
|
||||
pageNum: 1,
|
||||
pageSize: PAGE_SIZE,
|
||||
};
|
||||
const defaultQueryForm = {
|
||||
noticeId: props.noticeId,
|
||||
departmentId: null,
|
||||
keywords: '',
|
||||
pageNum: 1,
|
||||
pageSize: PAGE_SIZE,
|
||||
};
|
||||
|
||||
const queryForm = reactive({ ...defaultQueryForm });
|
||||
const queryForm = reactive({ ...defaultQueryForm });
|
||||
|
||||
function buildDeviceInfo(userAgent) {
|
||||
if (!userAgent) {
|
||||
return '';
|
||||
}
|
||||
|
||||
let ua = uaparser(userAgent);
|
||||
let browser = ua.browser.name;
|
||||
let os = ua.os.name;
|
||||
return browser + '/' + os + '/' + (ua.device.vendor ? ua.device.vendor + ua.device.model : '');
|
||||
}
|
||||
|
||||
async function queryViewRecord() {
|
||||
try {
|
||||
tableLoading.value = true;
|
||||
const result = await noticeApi.queryViewRecord(queryForm);
|
||||
|
||||
for (const e of result.data.list) {
|
||||
e.firstDevice = buildDeviceInfo(e.firstUserAgent);
|
||||
e.lastDevice = buildDeviceInfo(e.lastUserAgent);
|
||||
function buildDeviceInfo(userAgent) {
|
||||
if (!userAgent) {
|
||||
return '';
|
||||
}
|
||||
|
||||
tableData.value = result.data.list;
|
||||
total.value = result.data.total;
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
} finally {
|
||||
tableLoading.value = false;
|
||||
let ua = uaparser(userAgent);
|
||||
let browser = ua.browser.name;
|
||||
let os = ua.os.name;
|
||||
return browser + '/' + os + '/' + (ua.device.vendor ? ua.device.vendor + ua.device.model : '');
|
||||
}
|
||||
}
|
||||
// 点击查询
|
||||
function onSearch() {
|
||||
queryForm.pageNum = 1;
|
||||
queryViewRecord();
|
||||
}
|
||||
|
||||
// 点击重置
|
||||
function resetQuery() {
|
||||
Object.assign(queryForm, defaultQueryForm);
|
||||
queryViewRecord();
|
||||
}
|
||||
async function queryViewRecord() {
|
||||
try {
|
||||
tableLoading.value = true;
|
||||
const result = await noticeApi.queryViewRecord(queryForm);
|
||||
|
||||
for (const e of result.data.list) {
|
||||
e.firstDevice = buildDeviceInfo(e.firstUserAgent);
|
||||
e.lastDevice = buildDeviceInfo(e.lastUserAgent);
|
||||
}
|
||||
|
||||
tableData.value = result.data.list;
|
||||
total.value = result.data.total;
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
} finally {
|
||||
tableLoading.value = false;
|
||||
}
|
||||
}
|
||||
// 点击查询
|
||||
function onSearch() {
|
||||
queryForm.pageNum = 1;
|
||||
queryViewRecord();
|
||||
}
|
||||
|
||||
// 点击重置
|
||||
function resetQuery() {
|
||||
Object.assign(queryForm, defaultQueryForm);
|
||||
queryViewRecord();
|
||||
}
|
||||
</script>
|
||||
|
@ -43,7 +43,7 @@
|
||||
新建
|
||||
</a-button>
|
||||
|
||||
<a-button @click="confirmBatchDelete" v-privilege="'support:dict:batchDelete'" type="text" danger :disabled="selectedRowKeyList.length === 0">
|
||||
<a-button @click="confirmBatchDelete" v-privilege="'support:dict:batchDelete'" type="primary" danger :disabled="selectedRowKeyList.length === 0">
|
||||
<template #icon>
|
||||
<DeleteOutlined />
|
||||
</template>
|
||||
|
@ -165,7 +165,7 @@
|
||||
import JobFormModal from './components/job-form-modal.vue';
|
||||
import JobLogListModal from './components/job-log-list-modal.vue';
|
||||
import { SmartLoading } from '/@/components/framework/smart-loading/index.js';
|
||||
|
||||
const activeKey = ref('1');
|
||||
const columns = ref([
|
||||
{
|
||||
title: 'id',
|
||||
@ -242,8 +242,6 @@
|
||||
},
|
||||
]);
|
||||
|
||||
const activeKey = ref('1');
|
||||
|
||||
// ---------------- 查询数据 -----------------------
|
||||
|
||||
const queryFormState = {
|
||||
|
@ -51,7 +51,7 @@
|
||||
list-type="picture-card"
|
||||
class="avatar-uploader"
|
||||
:show-upload-list="false"
|
||||
:headers="{ 'x-access-token': useUserStore().getToken }"
|
||||
:headers="{ Authorization: 'Bearer ' + useUserStore().getToken }"
|
||||
:customRequest="customRequest"
|
||||
:before-upload="beforeUpload"
|
||||
>
|
||||
|
@ -4,13 +4,13 @@
|
||||
<div class="password-form-area">
|
||||
<a-form ref="formRef" :model="form" :rules="rules" layout="vertical">
|
||||
<a-form-item label="原密码" name="oldPassword">
|
||||
<a-input-password class="form-item" v-model:value.trim="form.oldPassword" type="password" placeholder="请输入原密码" />
|
||||
<a-input-password class="form-item" v-model:value.trim="form.oldPassword" type="password" placeholder="请输入原密码" autocomplete="off" />
|
||||
</a-form-item>
|
||||
<a-form-item label="新密码" name="newPassword" :help="tips">
|
||||
<a-input-password class="form-item" v-model:value.trim="form.newPassword" type="password" placeholder="请输入新密码" />
|
||||
<a-input-password class="form-item" v-model:value.trim="form.newPassword" type="password" placeholder="请输入新密码" autocomplete="off" />
|
||||
</a-form-item>
|
||||
<a-form-item label="确认密码" name="confirmPwd" :help="tips">
|
||||
<a-input-password class="form-item" v-model:value.trim="form.confirmPwd" type="password" placeholder="请输入确认密码" />
|
||||
<a-input-password class="form-item" v-model:value.trim="form.confirmPwd" type="password" placeholder="请输入确认密码" autocomplete="off" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
<a-button type="primary" style="margin: 20px 0 0 250px" @click="onSubmit">修改密码</a-button>
|
||||
|
@ -31,9 +31,13 @@
|
||||
});
|
||||
// 选中的菜单
|
||||
let selectedMenu = ref({ menuId: 0 });
|
||||
let selectedKeys = computed(() => {
|
||||
return _.isEmpty(selectedMenu.value) ? [] : [selectedMenu.value.menuId];
|
||||
});
|
||||
let selectedKeys = ref([]);
|
||||
watch(
|
||||
() => selectedMenu.value,
|
||||
(newQuery, oldQuery) => {
|
||||
selectedKeys.value = _.isEmpty(selectedMenu.value) ? [] : [selectedMenu.value.menuId];
|
||||
}
|
||||
);
|
||||
|
||||
function selectMenu(menuId) {
|
||||
selectedMenu.value = menuList.value.find((e) => e.menuId === menuId);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user