mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-09-17 19:06:39 +08:00
优化一些问题和代码
This commit is contained in:
parent
f2d098d5d1
commit
e2c6a83125
@ -203,11 +203,11 @@
|
||||
</dependency>
|
||||
|
||||
<!-- sax 读取时候用到的 -->
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<version>${xerces.version}</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>xerces</groupId>-->
|
||||
<!-- <artifactId>xercesImpl</artifactId>-->
|
||||
<!-- <version>${xerces.version}</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-scratchpad</artifactId>
|
||||
|
@ -112,7 +112,6 @@ public class NoticeController {
|
||||
// --------------------- 【员工】查看 通知公告 -------------------------
|
||||
@ApiOperation("【员工】通知公告-查看详情 @author 卓大")
|
||||
@GetMapping("/oa/notice/employee/view/{noticeId}")
|
||||
@RepeatSubmit
|
||||
public ResponseDTO<NoticeDetailVO> view(@PathVariable Long noticeId, HttpServletRequest request) {
|
||||
return noticeEmployeeService.view(
|
||||
SmartRequestUtil.getRequestUserId(),
|
||||
@ -124,14 +123,12 @@ public class NoticeController {
|
||||
|
||||
@ApiOperation("【员工】通知公告-查询全部 @author 卓大")
|
||||
@PostMapping("/oa/notice/employee/query")
|
||||
@RepeatSubmit
|
||||
public ResponseDTO<PageResult<NoticeEmployeeVO>> queryEmployeeNotice(@RequestBody @Valid NoticeEmployeeQueryForm noticeEmployeeQueryForm) {
|
||||
return noticeEmployeeService.queryList(SmartRequestUtil.getRequestUserId(), noticeEmployeeQueryForm);
|
||||
}
|
||||
|
||||
@ApiOperation("【员工】通知公告-查询 查看记录 @author 卓大")
|
||||
@PostMapping("/oa/notice/employee/queryViewRecord")
|
||||
@RepeatSubmit
|
||||
public ResponseDTO<PageResult<NoticeViewRecordVO>> queryViewRecord(@RequestBody @Valid NoticeViewRecordQueryForm noticeViewRecordQueryForm) {
|
||||
return ResponseDTO.ok(noticeEmployeeService.queryViewRecord(noticeViewRecordQueryForm));
|
||||
}
|
||||
|
@ -111,17 +111,17 @@ public class EmployeeService {
|
||||
*/
|
||||
public synchronized ResponseDTO<String> addEmployee(EmployeeAddForm employeeAddForm) {
|
||||
// 校验名称是否重复
|
||||
EmployeeEntity employeeEntity = employeeDao.getByLoginName(employeeAddForm.getLoginName(), false);
|
||||
EmployeeEntity employeeEntity = employeeDao.getByLoginName(employeeAddForm.getLoginName(), null);
|
||||
if (null != employeeEntity) {
|
||||
return ResponseDTO.userErrorParam("登录名重复");
|
||||
}
|
||||
// 校验姓名是否重复
|
||||
employeeEntity = employeeDao.getByActualName(employeeAddForm.getActualName(), false);
|
||||
employeeEntity = employeeDao.getByActualName(employeeAddForm.getActualName(), null);
|
||||
if (null != employeeEntity) {
|
||||
return ResponseDTO.userErrorParam("姓名重复");
|
||||
}
|
||||
// 校验电话是否存在
|
||||
employeeEntity = employeeDao.getByPhone(employeeAddForm.getPhone(), false);
|
||||
employeeEntity = employeeDao.getByPhone(employeeAddForm.getPhone(), null);
|
||||
if (null != employeeEntity) {
|
||||
return ResponseDTO.userErrorParam("手机号已存在");
|
||||
}
|
||||
@ -166,17 +166,17 @@ public class EmployeeService {
|
||||
}
|
||||
|
||||
|
||||
EmployeeEntity existEntity = employeeDao.getByLoginName(employeeUpdateForm.getLoginName(), false);
|
||||
EmployeeEntity existEntity = employeeDao.getByLoginName(employeeUpdateForm.getLoginName(), null);
|
||||
if (null != existEntity && !Objects.equals(existEntity.getEmployeeId(), employeeId)) {
|
||||
return ResponseDTO.userErrorParam("登录名重复");
|
||||
}
|
||||
|
||||
existEntity = employeeDao.getByPhone(employeeUpdateForm.getPhone(), false);
|
||||
existEntity = employeeDao.getByPhone(employeeUpdateForm.getPhone(), null);
|
||||
if (null != existEntity && !Objects.equals(existEntity.getEmployeeId(), employeeId)) {
|
||||
return ResponseDTO.userErrorParam("手机号已存在");
|
||||
}
|
||||
|
||||
existEntity = employeeDao.getByActualName(employeeUpdateForm.getActualName(), false);
|
||||
existEntity = employeeDao.getByActualName(employeeUpdateForm.getActualName(), null);
|
||||
if (null != existEntity && !Objects.equals(existEntity.getEmployeeId(), employeeId)) {
|
||||
return ResponseDTO.userErrorParam("姓名重复");
|
||||
}
|
||||
|
@ -261,6 +261,7 @@ public class LoginService {
|
||||
private void saveLogoutLog(RequestUser requestUser, String ip, String userAgent) {
|
||||
LoginLogEntity loginEntity = LoginLogEntity.builder()
|
||||
.userId(requestUser.getUserId())
|
||||
.userType(requestUser.getUserType().getValue())
|
||||
.userName(requestUser.getUserName())
|
||||
.userAgent(userAgent)
|
||||
.loginIp(ip)
|
||||
|
@ -184,10 +184,10 @@
|
||||
</dependency>
|
||||
|
||||
<!-- sax 读取时候用到的 -->
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>xerces</groupId>-->
|
||||
<!-- <artifactId>xercesImpl</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-scratchpad</artifactId>
|
||||
|
@ -149,7 +149,7 @@ public abstract class CodeGenerateBaseVariableService {
|
||||
*/
|
||||
protected String getJavaPackageName(String javaType) {
|
||||
if ("BigDecimal".equals(javaType)) {
|
||||
return "import java.math.BigDecimal";
|
||||
return "import java.math.BigDecimal;";
|
||||
} else if ("LocalDate".equals(javaType)) {
|
||||
return "import java.time.LocalDate;";
|
||||
} else if ("LocalDateTime".equals(javaType)) {
|
||||
|
@ -139,9 +139,9 @@ public class FileService {
|
||||
fileEntity.setFileSize(file.getSize());
|
||||
fileEntity.setFileKey(uploadVO.getFileKey());
|
||||
fileEntity.setFileType(uploadVO.getFileType());
|
||||
fileEntity.setCreatorId(requestUser == null ? null:requestUser.getUserId());
|
||||
fileEntity.setCreatorName(requestUser == null ? null:requestUser.getUserName());
|
||||
fileEntity.setCreatorUserType(requestUser == null ? null:requestUser.getUserType().getValue());
|
||||
fileEntity.setCreatorId(requestUser == null ? null : requestUser.getUserId());
|
||||
fileEntity.setCreatorName(requestUser == null ? null : requestUser.getUserName());
|
||||
fileEntity.setCreatorUserType(requestUser == null ? null : requestUser.getUserType().getValue());
|
||||
fileDao.insert(fileEntity);
|
||||
uploadVO.setFileId(fileEntity.getFileId());
|
||||
// 添加缓存
|
||||
@ -230,6 +230,13 @@ public class FileService {
|
||||
* @throws IOException
|
||||
*/
|
||||
public ResponseEntity<Object> downloadByFileKey(String fileKey, String userAgent) {
|
||||
FileVO fileVO = fileDao.getByFileKey(fileKey);
|
||||
if (fileVO == null) {
|
||||
HttpHeaders heads = new HttpHeaders();
|
||||
heads.add(HttpHeaders.CONTENT_TYPE, "text/html;charset=UTF-8");
|
||||
return new ResponseEntity<>("文件不存在:" + fileKey, heads, HttpStatus.OK);
|
||||
}
|
||||
|
||||
// 根据文件服务类 获取对应文件服务 查询 url
|
||||
ResponseDTO<FileDownloadVO> responseDTO = fileStorageService.fileDownload(fileKey);
|
||||
if (!responseDTO.getOk()) {
|
||||
@ -237,15 +244,17 @@ public class FileService {
|
||||
heads.add(HttpHeaders.CONTENT_TYPE, "text/html;charset=UTF-8");
|
||||
return new ResponseEntity<>(responseDTO.getMsg() + ":" + fileKey, heads, HttpStatus.OK);
|
||||
}
|
||||
// 设置下载头
|
||||
HttpHeaders heads = new HttpHeaders();
|
||||
heads.add(HttpHeaders.CONTENT_TYPE, "application/octet-stream; charset=utf-8");
|
||||
// 设置对应浏览器的文件名称编码
|
||||
|
||||
FileDownloadVO fileDownloadVO = responseDTO.getData();
|
||||
FileMetadataVO metadata = fileDownloadVO.getMetadata();
|
||||
String fileName = null != metadata ? metadata.getFileName() : fileKey.substring(fileKey.lastIndexOf("/"));
|
||||
fileName = fileStorageService.getDownloadFileNameByUA(fileName, userAgent);
|
||||
heads.add(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + fileName);
|
||||
|
||||
// 设置下载头
|
||||
HttpHeaders heads = new HttpHeaders();
|
||||
heads.add(HttpHeaders.CONTENT_LENGTH, String.valueOf(metadata.getFileSize()));
|
||||
heads.add(HttpHeaders.CONTENT_TYPE, "application/octet-stream; charset=utf-8");
|
||||
heads.add(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + fileStorageService.getDownloadFileNameByUA(fileVO.getFileName(), userAgent));
|
||||
|
||||
// 返回给前端
|
||||
ResponseEntity<Object> responseEntity = new ResponseEntity<>(fileDownloadVO.getData(), heads, HttpStatus.OK);
|
||||
return responseEntity;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import net.lab1024.sa.common.common.code.SystemErrorCode;
|
||||
import net.lab1024.sa.common.common.code.UserErrorCode;
|
||||
import net.lab1024.sa.common.common.domain.ResponseDTO;
|
||||
import net.lab1024.sa.common.module.support.file.domain.vo.FileDownloadVO;
|
||||
import net.lab1024.sa.common.module.support.file.domain.vo.FileMetadataVO;
|
||||
import net.lab1024.sa.common.module.support.file.domain.vo.FileUploadVO;
|
||||
import net.lab1024.sa.common.module.support.config.ConfigKeyEnum;
|
||||
import net.lab1024.sa.common.module.support.config.ConfigService;
|
||||
@ -119,6 +120,13 @@ public class FileStorageLocalServiceImpl implements IFileStorageService {
|
||||
byte[] buffer = FileCopyUtils.copyToByteArray(in);
|
||||
FileDownloadVO fileDownloadVO = new FileDownloadVO();
|
||||
fileDownloadVO.setData(buffer);
|
||||
|
||||
FileMetadataVO fileMetadataDTO = new FileMetadataVO();
|
||||
fileMetadataDTO.setFileName(localFile.getName());
|
||||
fileMetadataDTO.setFileSize(localFile.length());
|
||||
fileMetadataDTO.setFileFormat(FilenameUtils.getExtension(localFile.getName()));
|
||||
fileDownloadVO.setMetadata(fileMetadataDTO);
|
||||
|
||||
return ResponseDTO.ok(fileDownloadVO);
|
||||
} catch (IOException e) {
|
||||
log.error("文件下载-发生异常:", e);
|
||||
|
@ -60,16 +60,24 @@ public class RepeatSubmitAspect {
|
||||
if (timeStamp != null) {
|
||||
Method method = ((MethodSignature) point.getSignature()).getMethod();
|
||||
RepeatSubmit annotation = method.getAnnotation(RepeatSubmit.class);
|
||||
|
||||
// 说明注解去掉了
|
||||
if (annotation != null) {
|
||||
return point.proceed();
|
||||
}
|
||||
|
||||
int interval = Math.min(annotation.value(), RepeatSubmit.MAX_INTERVAL);
|
||||
if (System.currentTimeMillis() < timeStamp + interval) {
|
||||
// 提交频繁
|
||||
return ResponseDTO.error(UserErrorCode.REPEAT_SUBMIT);
|
||||
}
|
||||
|
||||
}
|
||||
Object obj = null;
|
||||
try {
|
||||
obj = point.proceed();
|
||||
// 先给 ticket 设置在执行中
|
||||
this.repeatSubmitTicket.putTicket(ticket);
|
||||
obj = point.proceed();
|
||||
} catch (Throwable throwable) {
|
||||
log.error("", throwable);
|
||||
throw throwable;
|
||||
|
@ -10,19 +10,14 @@
|
||||
:title="form.$!{primaryKeyFieldName} ? '编辑' : '添加'"
|
||||
width="$!{insertAndUpdate.width}"
|
||||
:visible="visibleFlag"
|
||||
@close="onClose"
|
||||
@cancel="onClose"
|
||||
:maskClosable="false"
|
||||
:destroyOnClose="true"
|
||||
>
|
||||
<a-form ref="formRef" :model="form" :rules="rules" :label-col="{ span: 5 }" >
|
||||
#if($insertAndUpdate.countPerLine > 1)
|
||||
#if($insertAndUpdate.countPerLine == 1)
|
||||
<a-row>
|
||||
#end
|
||||
#foreach ($field in $formFields)
|
||||
#if($insertAndUpdate.countPerLine > 1)
|
||||
#set($span=24 / $!insertAndUpdate.countPerLine )
|
||||
<a-col :span="$!{span}">
|
||||
#end
|
||||
#foreach ($field in $formFields)
|
||||
#if($field.frontComponent == "Input")
|
||||
<a-form-item label="$!{field.label}" name="${field.fieldName}">
|
||||
<a-input style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" />
|
||||
@ -74,11 +69,70 @@
|
||||
/>
|
||||
</a-form-item>
|
||||
#end
|
||||
#end
|
||||
#if($insertAndUpdate.countPerLine > 1)
|
||||
</a-col>
|
||||
#end
|
||||
</a-row>
|
||||
#end
|
||||
|
||||
#if($insertAndUpdate.countPerLine > 1)
|
||||
<a-row>
|
||||
#end
|
||||
#set($span=24 / $!insertAndUpdate.countPerLine )
|
||||
#foreach ($field in $formFields)
|
||||
<a-col :span="$!{span}">
|
||||
#if($field.frontComponent == "Input")
|
||||
<a-form-item label="$!{field.label}" name="${field.fieldName}">
|
||||
<a-input style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" />
|
||||
</a-form-item>
|
||||
#end
|
||||
#if($field.frontComponent == "InputNumber")
|
||||
<a-form-item label="$!{field.label}" name="${field.fieldName}">
|
||||
<a-input-number style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" />
|
||||
</a-form-item>
|
||||
#end
|
||||
#if($field.frontComponent == "Textarea")
|
||||
<a-form-item label="$!{field.label}" name="${field.fieldName}">
|
||||
<a-textarea style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" />
|
||||
</a-form-item>
|
||||
#end
|
||||
#if($field.frontComponent == "BooleanSelect")
|
||||
<a-form-item label="$!{field.label}" name="${field.fieldName}">
|
||||
<BooleanSelect v-model:value="form.${field.fieldName}" style="width: 100%" />
|
||||
</a-form-item>
|
||||
#end
|
||||
#if($field.frontComponent == "SmartEnumSelect")
|
||||
<a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}">
|
||||
<SmartEnumSelect width="100%" v-model:value="form.${field.fieldName}" enumName="$!{field.upperUnderscoreEnum}" placeholder="$codeGeneratorTool.removeEnumDesc($!{field.label})"/>
|
||||
</a-form-item>
|
||||
#end
|
||||
#if($field.frontComponent == "DictSelect")
|
||||
<a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}">
|
||||
<DictSelect width="100%" v-model:value="form.${field.fieldName}" keyCode="$!{field.dict}" placeholder="$!{field.label}"/>
|
||||
</a-form-item>
|
||||
#end
|
||||
#if($field.frontComponent == "Date")
|
||||
<a-form-item label="$!{field.label}" name="${field.fieldName}">
|
||||
<a-date-picker valueFormat="YYYY-MM-DD" v-model:value="form.$!{field.fieldName}" style="width: 100%" placeholder="$!{field.label}"/>
|
||||
</a-form-item>
|
||||
#end
|
||||
#if($field.frontComponent == "DateTime")
|
||||
<a-form-item label="$!{field.label}" name="${field.fieldName}">
|
||||
<a-date-picker show-time valueFormat="YYYY-MM-DD HH:mm:ss" v-model:value="form.$!{field.fieldName}" style="width: 100%" placeholder="$!{field.label}" />
|
||||
</a-form-item>
|
||||
#end
|
||||
#if($field.frontComponent == "Upload")
|
||||
<a-form-item label="$!{field.label}" name="${field.fieldName}">
|
||||
<FileUpload
|
||||
:defaultFileList="form.$!{field.fieldName}"
|
||||
:folder="FILE_FOLDER_TYPE_ENUM.COMMON.value"
|
||||
buttonText="上传 $!{field.label}"
|
||||
listType="text"
|
||||
@change="e => form.$!{field.fieldName} = e"
|
||||
/>
|
||||
</a-form-item>
|
||||
#end
|
||||
</a-col>
|
||||
#end
|
||||
</a-row>
|
||||
#end
|
||||
</a-form>
|
||||
|
||||
<template #footer>
|
||||
|
@ -3,7 +3,7 @@ spring:
|
||||
datasource:
|
||||
url: jdbc:p6spy:mysql://127.0.0.1:3306/smart_admin_v2?autoReconnect=true&useServerPreparedStmts=false&rewriteBatchedStatements=true&characterEncoding=UTF-8&useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: Zhuoda123456
|
||||
password: Xxxx1024
|
||||
initial-size: 2
|
||||
min-idle: 2
|
||||
max-active: 10
|
||||
@ -16,7 +16,7 @@ spring:
|
||||
username: druid
|
||||
password: 1024
|
||||
login:
|
||||
enabled: true
|
||||
enabled: false
|
||||
method:
|
||||
pointcut: net.lab1024.sa..*Service.*
|
||||
|
||||
@ -89,9 +89,9 @@ file:
|
||||
local:
|
||||
path: ${localPath:/home}/smart_admin_v2/upload/
|
||||
cloud:
|
||||
region: oss-cn-qingdao
|
||||
endpoint: oss-cn-qingdao.aliyuncs.com
|
||||
bucket-name: common-sit
|
||||
region: oss-cn-hangzhou
|
||||
endpoint: oss-cn-hangzhou.aliyuncs.com
|
||||
bucket-name: 1024lab-smart-admin
|
||||
access-key:
|
||||
secret-key:
|
||||
url:
|
||||
@ -127,8 +127,8 @@ access-control-allow-origin: '*'
|
||||
|
||||
# 心跳配置
|
||||
heart-beat:
|
||||
interval-seconds: 60
|
||||
interval-seconds: 300
|
||||
|
||||
# 热加载配置
|
||||
reload:
|
||||
interval-seconds: 60
|
||||
interval-seconds: 300
|
Binary file not shown.
@ -46,14 +46,15 @@
|
||||
|
||||
//监听退出登录方法
|
||||
async function onLogout() {
|
||||
localClear();
|
||||
clearAllCoolies();
|
||||
useUserStore().logout();
|
||||
try {
|
||||
await loginApi.logout();
|
||||
} catch (e) {
|
||||
smartSentry.captureError(e);
|
||||
} finally {
|
||||
|
||||
localClear();
|
||||
clearAllCoolies();
|
||||
useUserStore().logout();
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
<template #icon>
|
||||
<component :is="$antIcons[item.icon]" />
|
||||
</template>
|
||||
{{ item.menuName }}
|
||||
{{ menuNameAdapter(item.menuName) }}
|
||||
</a-menu-item>
|
||||
</template>
|
||||
</template>
|
||||
@ -64,6 +64,11 @@
|
||||
return parentMenuList.value.map((e) => e.name);
|
||||
});
|
||||
|
||||
// 展开菜单的顶级目录名字适配,只展示两个字为好
|
||||
function menuNameAdapter(name){
|
||||
return name.substr(0,2);
|
||||
}
|
||||
|
||||
//监听路由的变化,进行更新菜单展开项目
|
||||
watch(
|
||||
currentRoute,
|
||||
|
@ -77,34 +77,34 @@
|
||||
// ------------------ 意见反馈 --------------------------
|
||||
let feedbackMessageList = ref([]);
|
||||
onMounted(() => {
|
||||
// 默认先查询一次
|
||||
// 首先查询多一些意见反馈
|
||||
queryFeedbackList();
|
||||
scroll();
|
||||
// 更换显示
|
||||
scheduleShowFeedback();
|
||||
});
|
||||
|
||||
let scrollInterval = null;
|
||||
let swiper = 1;
|
||||
let scheduleShowInterval = null;
|
||||
let scheduleShowIndex = 0;
|
||||
|
||||
function scroll() {
|
||||
if (scrollInterval != null) {
|
||||
function scheduleShowFeedback() {
|
||||
if (scheduleShowInterval != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
scrollInterval = setInterval(() => {
|
||||
if (currentPage >= pages) {
|
||||
currentPage = 1;
|
||||
}
|
||||
if (pages == 0 || feedbackList.length == 0) {
|
||||
scheduleShowInterval = setInterval(() => {
|
||||
if (feedbackList.length == 0) {
|
||||
return;
|
||||
}
|
||||
let initValue = (currentPage - 1) * 2;
|
||||
feedbackMessageList.value[0] = feedbackList[initValue];
|
||||
if (feedbackList[initValue + 1]) {
|
||||
feedbackMessageList.value[1] = feedbackList[initValue + 1];
|
||||
|
||||
// 显示两条意见反馈
|
||||
for (let i = 0; i < 2; i++) {
|
||||
if (scheduleShowIndex >= feedbackList.length) {
|
||||
scheduleShowIndex = 0;
|
||||
}
|
||||
swiper = currentPage - 1;
|
||||
currentPage++;
|
||||
}, 2000);
|
||||
feedbackMessageList.value[i] = feedbackList[scheduleShowIndex];
|
||||
scheduleShowIndex++;
|
||||
}
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
// 总页数
|
||||
@ -121,7 +121,7 @@
|
||||
};
|
||||
let result = await feedbackApi.queryFeedback(param);
|
||||
feedbackList = result.data.list;
|
||||
pages = Math.ceil(result.data.total / 2);
|
||||
pages = Math.ceil(feedbackList.length / 2);
|
||||
} catch (e) {
|
||||
smartSentry.captureError(e);
|
||||
}
|
||||
@ -143,9 +143,9 @@
|
||||
//SmartAdmin中 router的name 就是 后端存储menu的id
|
||||
let menuId = -1;
|
||||
try {
|
||||
if(currentRoute.name === HOME_PAGE_NAME){
|
||||
if (currentRoute.name === HOME_PAGE_NAME) {
|
||||
menuId = 0;
|
||||
}else{
|
||||
} else {
|
||||
menuId = _.toNumber(currentRoute.name);
|
||||
}
|
||||
} catch (e) {
|
||||
@ -163,7 +163,7 @@
|
||||
|
||||
<style scoped lang="less">
|
||||
.help-doc-wrapper {
|
||||
border-left:1px solid #ededed;
|
||||
border-left: 1px solid #ededed;
|
||||
height: 100vh;
|
||||
padding: 0 10px;
|
||||
|
||||
|
@ -103,6 +103,17 @@
|
||||
const helpDocFlag = computed(() => useAppConfigStore().$state.helpDocFlag);
|
||||
// 是否显示页脚
|
||||
const footerFlag = computed(() => useAppConfigStore().$state.footerFlag);
|
||||
// 多余高度
|
||||
const dueHeight = computed(() => {
|
||||
let due = 40;
|
||||
if (useAppConfigStore().$state.pageTagFlag) {
|
||||
due = due + 40;
|
||||
}
|
||||
if (useAppConfigStore().$state.footerFlag) {
|
||||
due = due + 40;
|
||||
}
|
||||
return due;
|
||||
});
|
||||
//是否隐藏菜单
|
||||
const collapsed = ref(false);
|
||||
|
||||
@ -222,10 +233,11 @@
|
||||
}
|
||||
|
||||
.admin-layout-content {
|
||||
background-color: inherit;
|
||||
min-height: auto;
|
||||
position: relative;
|
||||
padding: 10px 10px 0px 10px;
|
||||
height: v-bind('pageTagFlag ? "calc(100% - 80px)": "calc(100% - 40px)"');
|
||||
height: calc(100% - v-bind(dueHeight)px);
|
||||
overflow-x: hidden;
|
||||
}
|
||||
}
|
||||
|
@ -97,6 +97,17 @@
|
||||
const helpDocFlag = computed(() => useAppConfigStore().$state.helpDocFlag);
|
||||
// 是否显示页脚
|
||||
const footerFlag = computed(() => useAppConfigStore().$state.footerFlag);
|
||||
// 多余高度
|
||||
const dueHeight = computed(() => {
|
||||
let due = 40;
|
||||
if (useAppConfigStore().$state.pageTagFlag) {
|
||||
due = due + 40;
|
||||
}
|
||||
if (useAppConfigStore().$state.footerFlag) {
|
||||
due = due + 40;
|
||||
}
|
||||
return due;
|
||||
});
|
||||
//是否隐藏菜单
|
||||
const collapsed = ref(false);
|
||||
|
||||
@ -223,11 +234,12 @@
|
||||
}
|
||||
|
||||
.admin-layout-content {
|
||||
background-color: inherit;
|
||||
min-height: auto;
|
||||
position: relative;
|
||||
overflow-x: hidden;
|
||||
padding: 10px 10px 0px 10px;
|
||||
height: v-bind('pageTagFlag ? "calc(100% - 80px)": "calc(100% - 40px)"');
|
||||
height: calc(100% - v-bind(dueHeight)px);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,30 @@
|
||||
/**
|
||||
* 计算表格自适应高度
|
||||
*
|
||||
* @param {*} heightRef
|
||||
* @param {*} removeRefArray
|
||||
* @param {*} extraRemoveHeight
|
||||
* @returns
|
||||
*/
|
||||
|
||||
import { useAppConfigStore } from '../store/modules/system/app-config';
|
||||
|
||||
export function calcTableHeight(heightRef, removeRefArray, extraRemoveHeight) {
|
||||
let removeHeight = 0;
|
||||
if (removeRefArray && removeRefArray.length > 0) {
|
||||
for (const item of removeRefArray) {
|
||||
removeHeight = removeHeight + item.value.$el.offsetHeight;
|
||||
}
|
||||
}
|
||||
|
||||
let due = 40;
|
||||
if (useAppConfigStore().$state.pageTagFlag) {
|
||||
due = due + 40;
|
||||
}
|
||||
if (useAppConfigStore().$state.footerFlag) {
|
||||
due = due + 40;
|
||||
}
|
||||
|
||||
removeHeight = removeHeight + extraRemoveHeight + due;
|
||||
heightRef.value = document.querySelector('#smartAdminLayoutContent').offsetHeight - removeHeight;
|
||||
}
|
@ -8,7 +8,7 @@
|
||||
* @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012
|
||||
-->
|
||||
<template>
|
||||
<a-form class="smart-query-form" v-privilege="'loginLog:query'">
|
||||
<a-form class="smart-query-form" v-privilege="'loginLog:query'" ref="queryFormRef">
|
||||
<a-row class="smart-query-form-row">
|
||||
<a-form-item label="用户名称" class="smart-query-form-item">
|
||||
<a-input style="width: 300px" v-model:value="queryForm.userName" placeholder="用户名称" />
|
||||
@ -40,10 +40,19 @@
|
||||
</a-form>
|
||||
|
||||
<a-card size="small" :bordered="false" :hoverable="true">
|
||||
<a-row justify="end">
|
||||
<a-row justify="end" ref="tableOperatorRef">
|
||||
<TableOperator class="smart-margin-bottom5" v-model="columns" :tableId="TABLE_ID_CONST.SUPPORT.LOGIN_LOG" :refresh="ajaxQuery" />
|
||||
</a-row>
|
||||
<a-table size="small" :dataSource="tableData" :columns="columns" bordered rowKey="loginLogId" :pagination="false" :loading="tableLoading">
|
||||
<a-table
|
||||
size="small"
|
||||
:dataSource="tableData"
|
||||
:columns="columns"
|
||||
bordered
|
||||
rowKey="loginLogId"
|
||||
:pagination="false"
|
||||
:loading="tableLoading"
|
||||
:scroll="{ y: scrollY }"
|
||||
>
|
||||
<template #bodyCell="{ text, record, column }">
|
||||
<template v-if="column.dataIndex === 'loginResult'">
|
||||
<template v-if="text === LOGIN_RESULT_ENUM.LOGIN_SUCCESS.value">
|
||||
@ -85,7 +94,7 @@
|
||||
</a-card>
|
||||
</template>
|
||||
<script setup>
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { onMounted, onUnmounted, reactive, ref } from 'vue';
|
||||
import { PAGE_SIZE_OPTIONS } from '/@/constants/common-const';
|
||||
import { defaultTimeRanges } from '/@/lib/default-time-ranges';
|
||||
import uaparser from 'ua-parser-js';
|
||||
@ -94,6 +103,7 @@
|
||||
import { smartSentry } from '/@/lib/smart-sentry';
|
||||
import TableOperator from '/@/components/support/table-operator/index.vue';
|
||||
import { TABLE_ID_CONST } from '/@/constants/support/table-id-const';
|
||||
import { calcTableHeight } from '/@/lib/table-auto-height';
|
||||
|
||||
const columns = ref([
|
||||
{
|
||||
@ -190,5 +200,23 @@
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(ajaxQuery);
|
||||
// ----------------- 表格自适应高度 --------------------
|
||||
const scrollY = ref(100);
|
||||
const tableOperatorRef = ref();
|
||||
const queryFormRef = ref();
|
||||
|
||||
function autoCalcTableHeight() {
|
||||
calcTableHeight(scrollY, [tableOperatorRef, queryFormRef], 10);
|
||||
}
|
||||
|
||||
window.addEventListener('resize', autoCalcTableHeight);
|
||||
|
||||
onMounted(() => {
|
||||
ajaxQuery();
|
||||
autoCalcTableHeight();
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('resize', autoCalcTableHeight);
|
||||
});
|
||||
</script>
|
||||
|
@ -201,6 +201,9 @@
|
||||
try {
|
||||
params.departmentId = props.departmentId;
|
||||
let res = await employeeApi.queryEmployee(params);
|
||||
for (const item of res.data.list) {
|
||||
item.roleNameList = _.join(item.roleNameList,',');
|
||||
}
|
||||
tableData.value = res.data.list;
|
||||
total.value = res.data.total;
|
||||
// 清除选中
|
||||
|
Loading…
Reference in New Issue
Block a user