v3.18.0 【新增】新增消息管理;【新增】完善企业demo;【新增】完善相关数据权限;【新增】菜单管理下级功能

This commit is contained in:
zhuoda 2025-04-10 21:21:37 +08:00
parent 7ea97f8433
commit caf8e3aa25
52 changed files with 1441 additions and 97 deletions

View File

@ -2,7 +2,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.1024lab</groupId>
<groupId>net.lab1024</groupId>
<artifactId>sa-parent</artifactId>
<version>3.0.0</version>
<packaging>pom</packaging>

View File

@ -2,7 +2,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.1024lab</groupId>
<groupId>net.lab1024</groupId>
<artifactId>sa-parent</artifactId>
<version>3.0.0</version>
<relativePath>../pom.xml</relativePath>
@ -18,7 +18,7 @@
<dependencies>
<dependency>
<groupId>net.1024lab</groupId>
<groupId>net.lab1024</groupId>
<artifactId>sa-base</artifactId>
<version>3.0.0</version>
</dependency>

View File

@ -51,6 +51,8 @@ public class AdminSwaggerTagConst extends SwaggerTagConst {
public static final String SYSTEM_POSITION = "系统-职务管理";
public static final String SYSTEM_MESSAGE = "系统-消息";
}

View File

@ -0,0 +1,54 @@
package net.lab1024.sa.admin.module.system.message;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import net.lab1024.sa.admin.constant.AdminSwaggerTagConst;
import net.lab1024.sa.base.common.domain.PageResult;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.ValidateList;
import net.lab1024.sa.base.module.support.message.domain.MessageQueryForm;
import net.lab1024.sa.base.module.support.message.domain.MessageSendForm;
import net.lab1024.sa.base.module.support.message.domain.MessageVO;
import net.lab1024.sa.base.module.support.message.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 后管 消息路由
*
* @author: 卓大
* @date: 2025/04/09 20:55
*/
@Tag(name = AdminSwaggerTagConst.System.SYSTEM_MESSAGE)
@RestController
public class AdminMessageController {
@Autowired
private MessageService messageService;
@Operation(summary = "通知消息-新建 @author 卓大")
@PostMapping("/message/sendMessages")
@SaCheckPermission("system:message:send")
public ResponseDTO<String> sendMessages(@RequestBody @Valid ValidateList<MessageSendForm> messageList) {
messageService.sendMessage(messageList);
return ResponseDTO.ok();
}
@Operation(summary = "通知消息-分页查询 @author 卓大")
@PostMapping("/message/query")
@SaCheckPermission("system:message:query")
public ResponseDTO<PageResult<MessageVO>> query(@RequestBody @Valid MessageQueryForm queryForm) {
return ResponseDTO.ok(messageService.query(queryForm));
}
@Operation(summary = "通知消息-删除 @author 卓大")
@GetMapping("/message/delete/{messageId}")
@SaCheckPermission("system:message:delete")
public ResponseDTO<String> delete(@PathVariable Long messageId) {
return messageService.delete(messageId);
}
}

View File

@ -2,7 +2,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.1024lab</groupId>
<groupId>net.lab1024</groupId>
<artifactId>sa-parent</artifactId>
<version>3.0.0</version>
<relativePath>../pom.xml</relativePath>

View File

@ -36,9 +36,9 @@ public class MessageQueryForm extends PageParam {
@Schema(description = "查询结束时间")
private LocalDate endDate;
@Schema(hidden = true)
@Schema(description = "接收人")
private Long receiverUserId;
@Schema(hidden = true)
@Schema(description = "接收人类型")
private Integer receiverUserType;
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import jakarta.annotation.Resource;
import net.lab1024.sa.base.common.domain.PageResult;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.enumeration.UserTypeEnum;
import net.lab1024.sa.base.common.util.SmartBeanUtil;
import net.lab1024.sa.base.common.util.SmartPageUtil;
@ -105,4 +106,13 @@ public class MessageService {
}).collect(Collectors.toList());
messageManager.saveBatch(messageEntityList);
}
// 删除消息
public ResponseDTO<String> delete(Long messageId) {
if(messageId == null){
return ResponseDTO.userErrorParam();
}
messageDao.deleteById(messageId);
return ResponseDTO.ok();
}
}

View File

@ -39,7 +39,7 @@ spring:
host: smtp.163.com
port: 465
username: lab1024@163.com
password: 1024lab
password: LAB1024LAB
properties:
mail:
smtp:

View File

@ -2,7 +2,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.1024lab</groupId>
<groupId>net.lab1024</groupId>
<artifactId>sa-parent</artifactId>
<version>3.0.0</version>
<packaging>pom</packaging>

View File

@ -2,7 +2,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.1024lab</groupId>
<groupId>net.lab1024</groupId>
<artifactId>sa-parent</artifactId>
<version>3.0.0</version>
<relativePath>../pom.xml</relativePath>
@ -18,7 +18,7 @@
<dependencies>
<dependency>
<groupId>net.1024lab</groupId>
<groupId>net.lab1024</groupId>
<artifactId>sa-base</artifactId>
<version>3.0.0</version>
</dependency>

View File

@ -51,6 +51,8 @@ public class AdminSwaggerTagConst extends SwaggerTagConst {
public static final String SYSTEM_POSITION = "系统-职务管理";
public static final String SYSTEM_MESSAGE = "系统-消息";
}

View File

@ -0,0 +1,54 @@
package net.lab1024.sa.admin.module.system.message;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import net.lab1024.sa.admin.constant.AdminSwaggerTagConst;
import net.lab1024.sa.base.common.domain.PageResult;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.ValidateList;
import net.lab1024.sa.base.module.support.message.domain.MessageQueryForm;
import net.lab1024.sa.base.module.support.message.domain.MessageSendForm;
import net.lab1024.sa.base.module.support.message.domain.MessageVO;
import net.lab1024.sa.base.module.support.message.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
/**
* 后管 消息路由
*
* @author: 卓大
* @date: 2025/04/09 20:55
*/
@Tag(name = AdminSwaggerTagConst.System.SYSTEM_MESSAGE)
@RestController
public class AdminMessageController {
@Autowired
private MessageService messageService;
@Operation(summary = "通知消息-新建 @author 卓大")
@PostMapping("/message/sendMessages")
@SaCheckPermission("system:message:send")
public ResponseDTO<String> sendMessages(@RequestBody @Valid ValidateList<MessageSendForm> messageList) {
messageService.sendMessage(messageList);
return ResponseDTO.ok();
}
@Operation(summary = "通知消息-分页查询 @author 卓大")
@PostMapping("/message/query")
@SaCheckPermission("system:message:query")
public ResponseDTO<PageResult<MessageVO>> query(@RequestBody @Valid MessageQueryForm queryForm) {
return ResponseDTO.ok(messageService.query(queryForm));
}
@Operation(summary = "通知消息-删除 @author 卓大")
@GetMapping("/message/delete/{messageId}")
@SaCheckPermission("system:message:delete")
public ResponseDTO<String> delete(@PathVariable Long messageId) {
return messageService.delete(messageId);
}
}

View File

@ -2,7 +2,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.1024lab</groupId>
<groupId>net.lab1024</groupId>
<artifactId>sa-parent</artifactId>
<version>3.0.0</version>
<relativePath>../pom.xml</relativePath>

View File

@ -36,9 +36,9 @@ public class MessageQueryForm extends PageParam {
@Schema(description = "查询结束时间")
private LocalDate endDate;
@Schema(hidden = true)
@Schema(description = "接收人")
private Long receiverUserId;
@Schema(hidden = true)
@Schema(description = "接收人类型")
private Integer receiverUserType;
}

View File

@ -1,10 +1,13 @@
package net.lab1024.sa.base.module.support.message.domain;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import net.lab1024.sa.base.common.enumeration.UserTypeEnum;
import net.lab1024.sa.base.module.support.message.constant.MessageTemplateEnum;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;
/**
@ -25,6 +28,10 @@ public class MessageTemplateSendForm {
@NotNull(message = "接收者id不能为空")
private Long receiverUserId;
@Schema(description = "接收者id")
@NotEmpty(message = "接收者id不能为空")
private List<Long> receiverUserIdList;
/**
* 相关业务id | 可选
* 用于跳转具体业务

View File

@ -3,6 +3,7 @@ package net.lab1024.sa.base.module.support.message.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import net.lab1024.sa.base.common.domain.PageResult;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.enumeration.UserTypeEnum;
import net.lab1024.sa.base.common.util.SmartBeanUtil;
import net.lab1024.sa.base.common.util.SmartPageUtil;
@ -105,4 +106,13 @@ public class MessageService {
}).collect(Collectors.toList());
messageManager.saveBatch(messageEntityList);
}
// 删除消息
public ResponseDTO<String> delete(Long messageId) {
if(messageId == null){
return ResponseDTO.userErrorParam();
}
messageDao.deleteById(messageId);
return ResponseDTO.ok();
}
}

View File

@ -87,8 +87,8 @@ file:
region: oss-cn-hangzhou
endpoint: oss-cn-hangzhou.aliyuncs.com
bucket-name: 1024lab-smart-admin
access-key:
secret-key:
access-key:
secret-key:
url-prefix: https://${file.storage.cloud.bucket-name}.${file.storage.cloud.endpoint}/
private-url-expire-seconds: 3600

View File

@ -87,8 +87,8 @@ file:
region: oss-cn-hangzhou
endpoint: oss-cn-hangzhou.aliyuncs.com
bucket-name: 1024lab-smart-admin
access-key:
secret-key:
access-key:
secret-key:
url-prefix: https://${file.storage.cloud.bucket-name}.${file.storage.cloud.endpoint}/
private-url-expire-seconds: 3600

View File

@ -90,9 +90,7 @@
return text;
}
}
window.addEventListener('resize',_.throttle(()=>{
window.location.reload()
},1000));
</script>
<style scoped lang="less">
:deep(.ant-table-column-sorters) {

View File

@ -13,4 +13,19 @@ export const messageApi = {
updateReadFlag: (messageId) => {
return getRequest(`/support/message/read/${messageId}`);
},
//通知消息-分页查询 @author 卓大
queryAdminMessage: (param) => {
return postRequest('/message/query', param);
},
//通知消息-新建 @author 卓大
sendMessages: (param) => {
return postRequest('/message/sendMessages', param);
},
//通知消息-删除 @author 卓大
deleteMessage: (messageId) => {
return getRequest(`/message/delete/${messageId}`);
},
};

View File

@ -61,11 +61,6 @@
type: Number,
require: true,
},
//scroll scroll,main.jsscrolltrue
scroll: {
type: Boolean,
default: true,
},
});
const emit = defineEmits(['update:modelValue']);
@ -79,7 +74,13 @@
watch(
() => props.modelValue,
(value) => {
newColumn = value;
newColumn.forEach(item=>{
value.forEach(itemNewColumns=>{
if(item.dataIndex==itemNewColumns.dataIndex){
Object.assign(item,itemNewColumns)
}
})
})
},
{
deep: true,
@ -179,7 +180,7 @@
const smartTableColumnModal = ref();
function showModal() {
smartTableColumnModal.value.show(newColumn, props.tableId,props.scroll);
smartTableColumnModal.value.show(newColumn, props.tableId);
}
//
@ -193,6 +194,13 @@
obj = mergeColumn(_.cloneDeep(newColumn), changeColumnArray);
}
const newColumns = obj.newColumns;
newColumn.forEach(item=>{
obj.newColumns.forEach(itemNewColumns=>{
if(item.dataIndex==itemNewColumns.dataIndex){
Object.assign(item,itemNewColumns)
}
})
})
emit(
'update:modelValue',
newColumns.filter((e) => e.showFlag)

View File

@ -93,11 +93,9 @@
// ---------------- / --------------------
let tableId = null;
const visible = ref(false);
const scroll = ref(true);
//
function show(columns, showTableId,scrollFlag) {
function show(columns, showTableId) {
tableId = showTableId;
scroll.value = scrollFlag;
visible.value = true;
getUserTableColumns(tableId, _.cloneDeep(columns));
}
@ -183,12 +181,7 @@
if (newIndex === oldIndex) {
return;
}
// scroll1
if(scroll.value){
moveTableData(oldIndex-1, newIndex-1);
}else{
moveTableData(oldIndex, newIndex);
}
moveTableData(oldIndex, newIndex);
},
});
}

View File

@ -24,7 +24,7 @@ export const appDefaultConfig = {
pageWidth: '99%',
// 圆角
borderRadius: 6,
// 展开模式
// 菜单展开模式
flatPattern: true,
// 标签页
pageTagFlag: true,

View File

@ -40,7 +40,7 @@ export const TABLE_ID_CONST = {
SYSTEM: {
EMPLOYEE: systemInitTableId + 1, //员工
MENU: systemInitTableId + 2, //菜单
POSITION:systemInitTableId + 3, //职位
POSITION: systemInitTableId + 3, //职位
},
/**
* 支撑
@ -56,5 +56,6 @@ export const TABLE_ID_CONST = {
HELP_DOC: supportInitTableId + 8, //帮助文档
JOB: supportInitTableId + 9, //Job
JOB_LOG: supportInitTableId + 10, //JobLog
MAIL: supportInitTableId + 11,
},
};

View File

@ -24,7 +24,7 @@ export default {
'setting.border.radius': '页面圆角',
'setting.page.width': '页面宽度',
'setting.bread': '面包屑',
'setting.flatPattern': '展开模式',
'setting.flatPattern': '菜单展开模式',
'setting.pagetag': '标签页',
'setting.pagetag.style': '标签页样式',
'setting.footer': '页脚',

View File

@ -83,8 +83,8 @@
<a-radio-button value="chrome">Chrome</a-radio-button>
</a-radio-group>
</a-form-item>
<a-form-item :label="$t('setting.flatPattern')">
<a-switch @change="changeFlatPattern" v-model:checked="formState.flatPattern" checked-children="单个" un-checked-children="" />
<a-form-item :label="$t('setting.flatPattern')" v-if="formState.layout === LAYOUT_ENUM.SIDE.value">
<a-switch @change="changeFlatPattern" v-model:checked="formState.flatPattern" checked-children="多个" un-checked-children="" />
</a-form-item>
<a-form-item :label="$t('setting.pagetag')">
<a-switch @change="changePageTagFlag" v-model:checked="formState.pageTagFlag" checked-children="显示" un-checked-children="隐藏" />

View File

@ -62,7 +62,7 @@
:url="item.meta.frameUrl"
/>
<!--非iframe使用router-view-->
<div v-show="!iframeNotKeepAlivePageFlag && keepAliveIframePages.every((e) => route.name !== e.name)">
<div v-show="!iframeNotKeepAlivePageFlag && keepAliveIframePages.every((e) => route.name !== e.name)" style="height: 100%;" class="admin-content">
<router-view v-slot="{ Component }">
<keep-alive :include="keepAliveIncludes">
<component :is="Component" :key="route.name" />

View File

@ -62,7 +62,7 @@
:url="item.meta.frameUrl"
/>
<!--非iframe使用router-view-->
<div v-show="!iframeNotKeepAlivePageFlag && keepAliveIframePages.every((e) => route.name != e.name)" style="height: 100%;">
<div v-show="!iframeNotKeepAlivePageFlag && keepAliveIframePages.every((e) => route.name != e.name)" style="height: 100%;" class="admin-content">
<router-view v-slot="{ Component }">
<keep-alive :include="keepAliveIncludes">
<component :is="Component" :key="route.name" />

View File

@ -62,7 +62,7 @@
:url="item.meta.frameUrl"
/>
<!--非iframe使用router-view-->
<div v-show="!iframeNotKeepAlivePageFlag && keepAliveIframePages.every((e) => route.name != e.name)">
<div v-show="!iframeNotKeepAlivePageFlag && keepAliveIframePages.every((e) => route.name != e.name)" style="height: 100%;" class="admin-content">
<router-view v-slot="{ Component }">
<keep-alive :include="keepAliveIncludes">
<component :is="Component" :key="route.name" />

View File

@ -26,7 +26,7 @@
/>
<!--非iframe使用router-view-->
<div v-show="!iframeNotKeepAlivePageFlag && keepAliveIframePages.every((e) => route.name !== e.name)">
<div v-show="!iframeNotKeepAlivePageFlag && keepAliveIframePages.every((e) => route.name !== e.name)" :style="{height: contentBoxHeight+'px'}" class="admin-content">
<router-view v-slot="{ Component }">
<keep-alive :include="keepAliveIncludes">
<component :is="Component" :key="route.name" />
@ -84,6 +84,8 @@
const breadCrumbFlag = computed(() => useAppConfigStore().$state.breadCrumbFlag);
//
const pageWidth = computed(() => useAppConfigStore().$state.pageWidth);
let contentBoxHeight=ref()
//
const dueHeight = computed(() => {
if (fullScreenFlag.value) {
@ -104,6 +106,14 @@
return due;
});
watch(() => dueHeight.value, () => {
let dom=document.querySelector('.admin-layout-content')
contentBoxHeight.value=dom.offsetHeight - 20 - dueHeight.value.split('px')[0]
});
onMounted(() => {
let dom=document.querySelector('.admin-layout-content')
contentBoxHeight.value=dom.offsetHeight - 20 - dueHeight.value.split('px')[0]
});
//
onMounted(() => {
if (watermarkFlag.value) {

View File

@ -102,7 +102,7 @@
:dataSource="tableData"
:columns="columns"
rowKey="goodsId"
:scroll="{ x: 1000,y: yHeight }"
:scroll="{ x: 1000, y: yHeight }"
bordered
:pagination="false"
:showSorterTooltip="false"
@ -110,8 +110,6 @@
@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>
@ -205,7 +203,6 @@
import SmartHeaderCell from '/@/components/support/table-header-cell/index.vue';
import { DICT_CODE_ENUM } from '/@/constants/support/dict-const.js';
import DictLabel from '/@/components/support/dict-label/index.vue';
import { onBeforeMount } from 'vue';
// ---------------------------- ----------------------------
@ -499,15 +496,31 @@ import { onBeforeMount } from 'vue';
return str.replace(/([A-Z])/g, '_$1').toLowerCase();
}
const dueHeight=ref(0)
const yHeight=ref(0)
//
const yHeight = ref(0);
onMounted(() => {
let doc = document.querySelector('.ant-form');
let btn = document.querySelector('.smart-table-btn-block');
let tableCell = document.querySelector('.ant-table-cell');
let page = document.querySelector('.smart-query-table-page');
let box = document.querySelector('.ant-layout-content>div');
dueHeight.value = doc.offsetHeight+10+24+btn.offsetHeight+15+tableCell.offsetHeight+page.offsetHeight+20
yHeight.value=box.offsetHeight-dueHeight.value
resetGetHeight();
});
function resetGetHeight() {
//
let doc = document.querySelector('.ant-form');
//
let btn = document.querySelector('.smart-table-btn-block');
//
let tableCell = document.querySelector('.ant-table-cell');
//
let page = document.querySelector('.smart-query-table-page');
//
let box = document.querySelector('.admin-content');
setTimeout(() => {
let dueHeight = doc.offsetHeight + 10 + 24 + btn.offsetHeight + 15 + tableCell.offsetHeight + page.offsetHeight + 20;
yHeight.value = box.offsetHeight - dueHeight;
}, 100);
}
window.addEventListener(
'resize',
_.throttle(() => {
resetGetHeight();
}, 1000)
);
</script>

View File

@ -0,0 +1,158 @@
<template>
<a-modal v-model:open="visible" title="推送人" width="1100px" ok-text="确定" cancel-text="取消" @ok="onSubmit" @cancel="onClose" :zIndex="9999">
<a-form class="smart-query-form">
<a-row class="smart-query-form-row">
<a-form-item label="关键词搜索" class="smart-query-form-item">
<a-input v-model:value="queryParam.searchWord" :style="{ width: '250px' }" placeholder="请输入姓名" @change="selectSearchWord" />
</a-form-item>
<a-form-item class="smart-query-form-item">
<a-button type="primary" @click="searchQuery">
<template #icon>
<SearchOutlined />
</template>
查询
</a-button>
</a-form-item>
<a-form-item class="smart-query-form-item">
<a-button @click="searchReset">
<template #icon>
<ReloadOutlined />
</template>
重置
</a-button>
</a-form-item>
</a-row>
</a-form>
<a-table
rowKey="employeeId"
:loading="tableLoading"
:columns="columns"
:data-source="tableData"
bordered
:pagination="false"
:row-selection="{
selectedRowKeys: selectedRowKeyList,
onChange: onSelectChange,
}"
>
</a-table>
<div class="smart-query-table-page">
<a-pagination
showSizeChanger
showQuickJumper
show-less-items
:pageSizeOptions="PAGE_SIZE_OPTIONS"
:defaultPageSize="queryParam.pageSize"
v-model:current="queryParam.pageNum"
v-model:pageSize="queryParam.pageSize"
:total="total"
@change="queryList"
@showSizeChange="queryList"
:show-total="(total) => `共${total}条`"
/>
</div>
</a-modal>
</template>
<script setup>
import { reactive, ref } from 'vue';
import { message, Modal } from 'ant-design-vue';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS } from '/@/constants/common-const';
import { smartSentry } from '/src/lib/smart-sentry';
import { SmartLoading } from '/src/components/framework/smart-loading';
import SmartEnumSelect from '/src/components/framework/smart-enum-select/index.vue';
import { employeeApi } from '/@/api/system/employee-api';
// -------------------------------
const queryParamState = {
searchWord: null,
keyword: null,
pageNum: 1,
pageSize: PAGE_SIZE,
};
const classId = ref();
const queryParam = reactive({ ...queryParamState });
const tableData = ref([]);
let tableLoading = ref(false);
const total = ref(0);
//
function searchQuery() {
queryList();
}
//
const visible = ref(false);
//
function searchReset() {
Object.assign(queryParam, queryParamState);
queryList();
}
function showModal(receiverIdList) {
selectedRowKeyList.value = receiverIdList;
queryList();
visible.value = true;
}
function selectSearchWord(e) {
queryParam.keyword = queryParam.searchWord;
}
const columns = [
{
title: '姓名',
dataIndex: 'actualName',
align: 'center',
},
{
title: '手机号',
dataIndex: 'phone',
align: 'center',
},
];
// ----------------------
async function queryList() {
try {
tableLoading.value = true;
let res = await employeeApi.queryEmployee(queryParam);
const list = res.data.list;
total.value = res.data.total;
tableData.value = list;
} catch (e) {
smartSentry.captureError(e);
} finally {
tableLoading.value = false;
}
}
//
const selectedRowKeyList = ref([]);
const selectedRowsList = ref([]);
function onSelectChange(keyArray, selectedRows) {
selectedRowKeyList.value = keyArray;
selectedRowsList.value = selectedRows;
}
//
function onClose() {
visible.value = false;
let nameList = selectedRowsList.value.map((item) => item.actualName);
emit('reloadList', selectedRowKeyList.value, nameList);
}
const emit = defineEmits(['reloadList']);
//
function onSubmit() {
try {
onClose();
} catch (error) {
smartSentry.captureError(error);
} finally {
SmartLoading.hide();
}
}
defineExpose({
showModal,
});
</script>
<style scoped lang="less"></style>

View File

@ -0,0 +1,128 @@
<template>
<a-modal title="添加" :width="700" :open="visibleFlag" @cancel="onClose" :maskClosable="false" :destroyOnClose="true">
<a-form ref="formRef" :model="form" :rules="rules" :label-col="{ span: 5 }" :wrapper-col="{ span: 16 }">
<a-form-item label="标题" name="title">
<a-input style="width: 100%" v-model:value="form.title" placeholder="标题" />
</a-form-item>
<a-form-item label="接收人" name="receiverUserIdList">
<a-button @click="selectReceiver" type="primary"> 选择接收人 </a-button>
<div>{{ nameListString }}</div>
</a-form-item>
<a-form-item label="消息类型" name="messageType">
<SmartEnumSelect width="100%" v-model:value="form.messageType" placeholder="请选择类型" enum-name="MESSAGE_TYPE_ENUM" />
</a-form-item>
<a-form-item label="推送内容" name="content">
<a-textarea style="width: 100%" v-model:value="form.content" placeholder="推送内容" />
</a-form-item>
</a-form>
<template #footer>
<a-space>
<a-button @click="onClose">取消</a-button>
<a-button type="primary" @click="onSubmit">保存</a-button>
</a-space>
</template>
</a-modal>
<MessageReceiverModal ref="receiverModalRef" @reloadList="addReceiverIdList" />
</template>
<script setup>
import { nextTick, reactive, ref } from 'vue';
import { message } from 'ant-design-vue';
import { SmartLoading } from '/src/components/framework/smart-loading';
import { smartSentry } from '/src/lib/smart-sentry';
import SmartEnumSelect from '/src/components/framework/smart-enum-select/index.vue';
import MessageReceiverModal from './message-receiver-modal.vue';
import { USER_TYPE_ENUM } from '/src/constants/common-const.js';
import { messageApi } from '/@/api/support/message-api.js';
// ------------------------ ------------------------
const emits = defineEmits(['reloadList']);
// ------------------------ ------------------------
//
const visibleFlag = ref(false);
function show(rowData) {
Object.assign(form, formDefault);
nameListString.value = null;
visibleFlag.value = true;
nextTick(() => {
formRef.value.clearValidate();
});
}
function onClose() {
Object.assign(form, formDefault);
visibleFlag.value = false;
}
// ------------------------ ------------------------
// ref
const formRef = ref();
const formDefault = {
title: undefined,
receiverUserIdList: null,
content: null,
messageType: null,
receiverUserType: USER_TYPE_ENUM.ADMIN_EMPLOYEE.value,
};
let form = reactive({ ...formDefault });
const rules = {
title: [{ required: true, message: '标题 必填' }],
content: [{ required: true, message: '推送内容 必填' }],
receiverUserIdList: [{ required: true, message: '推送人 必填' }],
messageType: [{ required: true, message: '消息类型 必填' }],
};
const nameListString = ref();
function addReceiverIdList(idList, nameList) {
form.receiverUserIdList = idList;
nameListString.value = nameList.join(',');
}
const receiverModalRef = ref();
function selectReceiver() {
receiverModalRef.value.showModal(form.receiverUserIdList);
}
//
async function onSubmit() {
try {
await formRef.value.validateFields();
save();
} catch (err) {
message.error('参数验证错误,请仔细填写表单数据!');
}
}
// API
async function save() {
SmartLoading.show();
try {
let messageList = [];
for (const userId of form.receiverUserIdList) {
messageList.push({
title: form.title,
receiverUserId: userId,
content: form.content,
messageType: form.messageType,
receiverUserType: USER_TYPE_ENUM.ADMIN_EMPLOYEE.value,
});
}
await messageApi.sendMessages(messageList);
message.success('操作成功');
emits('reloadList');
onClose();
} catch (err) {
smartSentry.captureError(err);
} finally {
SmartLoading.hide();
}
}
defineExpose({
show,
});
</script>

View File

@ -0,0 +1,236 @@
<template>
<!---------- 查询表单form begin ----------->
<a-form class="smart-query-form">
<a-row class="smart-query-form-row">
<a-form-item label="关键词" class="smart-query-form-item">
<a-input style="width: 150px" v-model:value="queryForm.searchWord" placeholder="关键词" />
</a-form-item>
<a-form-item label="类型" class="smart-query-form-item">
<smart-enum-select style="width: 150px" v-model:value="queryForm.messageType" placeholder="消息类型" enum-name="MESSAGE_TYPE_ENUM" />
</a-form-item>
<a-form-item label="是否已读" class="smart-query-form-item">
<SmartEnumSelect width="120px" enum-name="FLAG_NUMBER_ENUM" v-model:value="queryForm.readFlag" />
</a-form-item>
<a-form-item label="创建时间" class="smart-query-form-item">
<a-range-picker v-model:value="queryForm.createTime" style="width: 200px" @change="onChangeCreateTime" />
</a-form-item>
<a-form-item class="smart-query-form-item">
<a-button type="primary" @click="searchQuery">
<template #icon>
<SearchOutlined />
</template>
查询
</a-button>
<a-button @click="resetQuery" class="smart-margin-left10">
<template #icon>
<ReloadOutlined />
</template>
重置
</a-button>
</a-form-item>
</a-row>
</a-form>
<!---------- 查询表单form end ----------->
<a-card size="small" :bordered="false" :hoverable="true">
<!---------- 表格操作行 begin ----------->
<a-row class="smart-table-btn-block">
<div class="smart-table-operate-block">
<a-button @click="showForm" type="primary">
<template #icon>
<PlusOutlined />
</template>
发送消息
</a-button>
</div>
<div class="smart-table-setting-block">
<TableOperator v-model="columns" :tableId="TABLE_ID_CONST.SUPPORT.MAIL" :refresh="queryData" />
</div>
</a-row>
<!---------- 表格操作行 end ----------->
<!---------- 表格 begin ----------->
<a-table size="small" :dataSource="tableData" :columns="columns" rowKey="telephoneId" bordered :loading="tableLoading" :pagination="false">
<template #bodyCell="{ record, column, text }">
<template v-if="column.dataIndex === 'readFlag'">
{{ text ? '已读' : '未读' }}
</template>
<template v-if="column.dataIndex === 'messageType'">
{{ $smartEnumPlugin.getDescByValue('MESSAGE_TYPE_ENUM', text) }}
</template>
<template v-if="column.dataIndex === 'action'">
<div class="smart-table-operate">
<a-button @click="onDelete(record)" danger type="link">删除</a-button>
</div>
</template>
</template>
</a-table>
<!---------- 表格 end ----------->
<div class="smart-query-table-page">
<a-pagination
showSizeChanger
showQuickJumper
show-less-items
:pageSizeOptions="PAGE_SIZE_OPTIONS"
:defaultPageSize="queryForm.pageSize"
v-model:current="queryForm.pageNum"
v-model:pageSize="queryForm.pageSize"
:total="total"
@change="queryData"
@showSizeChange="queryData"
:show-total="(total) => `共${total}条`"
/>
</div>
<MessageSendForm ref="formRef" @reloadList="queryData" />
</a-card>
</template>
<script setup>
import { onMounted, reactive, ref } from 'vue';
import { message, Modal } from 'ant-design-vue';
import { SmartLoading } from '/@/components/framework/smart-loading';
import { messageApi } from '/@/api/support/message-api';
import { PAGE_SIZE_OPTIONS } from '/@/constants/common-const';
import { smartSentry } from '/@/lib/smart-sentry';
import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue';
import TableOperator from '/@/components/support/table-operator/index.vue';
import MessageSendForm from './components/message-send-form.vue';
import { TABLE_ID_CONST } from '/@/constants/support/table-id-const';
// ---------------------------- ----------------------------
const columns = ref([
{
title: '消息类型',
dataIndex: 'messageType',
ellipsis: true,
width: 100,
},
{
title: '消息标题',
dataIndex: 'title',
ellipsis: true,
},
{
title: '消息内容',
dataIndex: 'content',
ellipsis: true,
},
{
title: '接收人ID',
dataIndex: 'receiverUserId',
ellipsis: true,
width: 100,
},
{
title: '已读',
dataIndex: 'readFlag',
width: 50,
},
{
title: '已读时间',
dataIndex: 'readTime',
width: 150,
},
{
title: '创建时间',
dataIndex: 'createTime',
width: 150,
},
{
title: '操作',
dataIndex: 'action',
fixed: 'right',
width: 60,
},
]);
// ---------------------------- ----------------------------
const queryFormState = {
searchWord: undefined, //
pageNum: 1,
pageSize: 10,
createTime: [],
readFlag: null,
startDate: null,
endDate: null,
messageType: null,
};
function onChangeCreateTime(dates, dateStrings) {
queryForm.startDate = dateStrings[0];
queryForm.endDate = dateStrings[1];
}
// form
const queryForm = reactive({ ...queryFormState });
// loading
const tableLoading = ref(false);
//
const tableData = ref([]);
//
const total = ref(0);
//
function resetQuery() {
let pageSize = queryForm.pageSize;
Object.assign(queryForm, queryFormState);
queryForm.pageSize = pageSize;
queryData();
}
function searchQuery() {
queryForm.pageNum = 1;
queryData();
}
//
async function queryData() {
tableLoading.value = true;
try {
let queryResult = await messageApi.queryAdminMessage(queryForm);
tableData.value = queryResult.data.list;
total.value = queryResult.data.total;
} catch (e) {
smartSentry.captureError(e);
} finally {
tableLoading.value = false;
}
}
onMounted(queryData);
// ---------------------------- / ----------------------------
const formRef = ref();
function showForm(data) {
formRef.value.show(data);
}
//
function onDelete(data) {
Modal.confirm({
title: '提示',
content: '确定要删除选吗?',
okText: '删除',
okType: 'danger',
onOk() {
requestDelete(data);
},
cancelText: '取消',
onCancel() {},
});
}
async function requestDelete(data) {
try {
SmartLoading.show();
await messageApi.deleteMessage(data.messageId);
message.success('删除成功');
queryData();
} catch (e) {
smartSentry.captureError(e);
} finally {
SmartLoading.hide();
}
}
</script>

View File

@ -91,9 +91,6 @@
return text;
}
}
window.addEventListener('resize',_.throttle(()=>{
window.location.reload()
},1000));
</script>
<style scoped lang="less">
:deep(.ant-table-column-sorters) {

View File

@ -13,4 +13,19 @@ export const messageApi = {
updateReadFlag: (messageId) => {
return getRequest(`/support/message/read/${messageId}`);
},
//通知消息-分页查询 @author 卓大
queryAdminMessage: (param) => {
return postRequest('/message/query', param);
},
//通知消息-新建 @author 卓大
sendMessages: (param) => {
return postRequest('/message/sendMessages', param);
},
//通知消息-删除 @author 卓大
deleteMessage: (messageId) => {
return getRequest(`/message/delete/${messageId}`);
},
};

View File

@ -61,11 +61,6 @@
type: Number,
require: true,
},
//scroll scroll,main.jsscrolltrue
scroll: {
type: Boolean,
default: true,
},
});
const emit = defineEmits(['update:modelValue']);
@ -79,7 +74,13 @@
watch(
() => props.modelValue,
(value) => {
newColumn = value;
newColumn.forEach(item=>{
value.forEach(itemNewColumns=>{
if(item.dataIndex==itemNewColumns.dataIndex){
Object.assign(item,itemNewColumns)
}
})
})
},
{
deep: true,
@ -179,7 +180,7 @@
const smartTableColumnModal = ref();
function showModal() {
smartTableColumnModal.value.show(newColumn, props.tableId,props.scroll);
smartTableColumnModal.value.show(newColumn, props.tableId);
}
//
@ -193,6 +194,13 @@
obj = mergeColumn(_.cloneDeep(newColumn), changeColumnArray);
}
const newColumns = obj.newColumns;
newColumn.forEach(item=>{
obj.newColumns.forEach(itemNewColumns=>{
if(item.dataIndex==itemNewColumns.dataIndex){
Object.assign(item,itemNewColumns)
}
})
})
emit(
'update:modelValue',
newColumns.filter((e) => e.showFlag)

View File

@ -93,11 +93,9 @@
// ---------------- / --------------------
let tableId = null;
const visible = ref(false);
const scroll = ref(true);
//
function show(columns, showTableId,scrollFlag) {
function show(columns, showTableId) {
tableId = showTableId;
scroll.value = scrollFlag;
visible.value = true;
getUserTableColumns(tableId, _.cloneDeep(columns));
}
@ -183,12 +181,7 @@
if (newIndex === oldIndex) {
return;
}
// scroll1
if(scroll.value){
moveTableData(oldIndex-1, newIndex-1);
}else{
moveTableData(oldIndex, newIndex);
}
moveTableData(oldIndex, newIndex);
},
});
}

View File

@ -30,7 +30,7 @@ export const appDefaultConfig: AppConfig = {
pageWidth: '99%',
// 圆角
borderRadius: 6,
// 展开模式
// 菜单展开模式
flatPattern: true,
// 标签页
pageTagFlag: true,

View File

@ -40,7 +40,7 @@ export const TABLE_ID_CONST = {
SYSTEM: {
EMPLOYEE: systemInitTableId + 1, //员工
MENU: systemInitTableId + 2, //菜单
POSITION:systemInitTableId + 3, //职位
POSITION: systemInitTableId + 3, //职位
},
/**
*
@ -56,5 +56,6 @@ export const TABLE_ID_CONST = {
HELP_DOC: supportInitTableId + 8, //帮助文档
JOB: supportInitTableId + 9, //Job
JOB_LOG: supportInitTableId + 10, //JobLog
MAIL: supportInitTableId + 11,
},
};

View File

@ -24,7 +24,7 @@ export default {
'setting.border.radius': '页面圆角',
'setting.page.width': '页面宽度',
'setting.bread': '面包屑',
'setting.flatPattern': '展开模式',
'setting.flatPattern': '菜单展开模式',
'setting.pagetag': '标签页',
'setting.pagetag.style': '标签页样式',
'setting.footer': '页脚',

View File

@ -83,8 +83,8 @@
<a-radio-button value="chrome">Chrome</a-radio-button>
</a-radio-group>
</a-form-item>
<a-form-item :label="$t('setting.flatPattern')">
<a-switch @change="changeFlatPattern" v-model:checked="formState.flatPattern" checked-children="单个" un-checked-children="" />
<a-form-item :label="$t('setting.flatPattern')" v-if="formState.layout === LAYOUT_ENUM.SIDE.value">
<a-switch @change="changeFlatPattern" v-model:checked="formState.flatPattern" checked-children="多个" un-checked-children="" />
</a-form-item>
<a-form-item :label="$t('setting.pagetag')">
<a-switch @change="changePageTagFlag" v-model:checked="formState.pageTagFlag" checked-children="显示" un-checked-children="隐藏" />

View File

@ -62,7 +62,7 @@
:url="item.meta.frameUrl"
/>
<!--非iframe使用router-view-->
<div v-show="!iframeNotKeepAlivePageFlag && keepAliveIframePages.every((e) => route.name !== e.name)">
<div v-show="!iframeNotKeepAlivePageFlag && keepAliveIframePages.every((e) => route.name !== e.name)" style="height: 100%;" class="admin-content">
<router-view v-slot="{ Component }">
<keep-alive :include="keepAliveIncludes">
<component :is="Component" :key="route.name" />

View File

@ -62,7 +62,7 @@
:url="item.meta.frameUrl"
/>
<!--非iframe使用router-view-->
<div v-show="!iframeNotKeepAlivePageFlag && keepAliveIframePages.every((e) => route.name != e.name)" style="height: 100%;">
<div v-show="!iframeNotKeepAlivePageFlag && keepAliveIframePages.every((e) => route.name != e.name)" style="height: 100%;" class="admin-content">
<router-view v-slot="{ Component }">
<keep-alive :include="keepAliveIncludes">
<component :is="Component" :key="route.name" />

View File

@ -62,7 +62,7 @@
:url="item.meta.frameUrl"
/>
<!--非iframe使用router-view-->
<div v-show="!iframeNotKeepAlivePageFlag && keepAliveIframePages.every((e) => route.name != e.name)">
<div v-show="!iframeNotKeepAlivePageFlag && keepAliveIframePages.every((e) => route.name != e.name)" style="height: 100%;" class="admin-content">
<router-view v-slot="{ Component }">
<keep-alive :include="keepAliveIncludes">
<component :is="Component" :key="route.name" />

View File

@ -26,7 +26,7 @@
/>
<!--非iframe使用router-view-->
<div v-show="!iframeNotKeepAlivePageFlag && keepAliveIframePages.every((e) => route.name !== e.name)">
<div v-show="!iframeNotKeepAlivePageFlag && keepAliveIframePages.every((e) => route.name !== e.name)" :style="{height: contentBoxHeight+'px'}" class="admin-content">
<router-view v-slot="{ Component }">
<keep-alive :include="keepAliveIncludes">
<component :is="Component" :key="route.name" />
@ -84,6 +84,8 @@
const breadCrumbFlag = computed(() => useAppConfigStore().$state.breadCrumbFlag);
//
const pageWidth = computed(() => useAppConfigStore().$state.pageWidth);
let contentBoxHeight=ref()
//
const dueHeight = computed(() => {
if (fullScreenFlag.value) {
@ -104,6 +106,14 @@
return due;
});
watch(() => dueHeight.value, () => {
let dom=document.querySelector('.admin-layout-content')
contentBoxHeight.value=dom.offsetHeight - 20 - dueHeight.value.split('px')[0]
});
onMounted(() => {
let dom=document.querySelector('.admin-layout-content')
contentBoxHeight.value=dom.offsetHeight - 20 - dueHeight.value.split('px')[0]
});
//
onMounted(() => {
if (watermarkFlag.value) {

View File

@ -102,7 +102,7 @@
:dataSource="tableData"
:columns="columns"
rowKey="goodsId"
:scroll="{ x: 1000,y: yHeight }"
:scroll="{ x: 1000, y: yHeight }"
bordered
:pagination="false"
:showSorterTooltip="false"
@ -495,15 +495,32 @@
function camelToUnderscore(str) {
return str.replace(/([A-Z])/g, '_$1').toLowerCase();
}
const dueHeight=ref(0)
const yHeight=ref(0)
//
const yHeight = ref(0);
onMounted(() => {
let doc = document.querySelector('.ant-form');
let btn = document.querySelector('.smart-table-btn-block');
let tableCell = document.querySelector('.ant-table-cell');
let page = document.querySelector('.smart-query-table-page');
let box = document.querySelector('.ant-layout-content>div');
dueHeight.value = doc.offsetHeight+10+24+btn.offsetHeight+15+tableCell.offsetHeight+page.offsetHeight+20
yHeight.value=box.offsetHeight-dueHeight.value
resetGetHeight();
});
function resetGetHeight() {
//
let doc = document.querySelector('.ant-form');
//
let btn = document.querySelector('.smart-table-btn-block');
//
let tableCell = document.querySelector('.ant-table-cell');
//
let page = document.querySelector('.smart-query-table-page');
//
let box = document.querySelector('.admin-content');
setTimeout(() => {
let dueHeight = doc.offsetHeight + 10 + 24 + btn.offsetHeight + 15 + tableCell.offsetHeight + page.offsetHeight + 20;
yHeight.value = box.offsetHeight - dueHeight;
}, 100);
}
window.addEventListener(
'resize',
_.throttle(() => {
resetGetHeight();
}, 1000)
);
</script>

View File

@ -0,0 +1,158 @@
<template>
<a-modal v-model:open="visible" title="推送人" width="1100px" ok-text="确定" cancel-text="取消" @ok="onSubmit" @cancel="onClose" :zIndex="9999">
<a-form class="smart-query-form">
<a-row class="smart-query-form-row">
<a-form-item label="关键词搜索" class="smart-query-form-item">
<a-input v-model:value="queryParam.searchWord" :style="{ width: '250px' }" placeholder="请输入姓名" @change="selectSearchWord" />
</a-form-item>
<a-form-item class="smart-query-form-item">
<a-button type="primary" @click="searchQuery">
<template #icon>
<SearchOutlined />
</template>
查询
</a-button>
</a-form-item>
<a-form-item class="smart-query-form-item">
<a-button @click="searchReset">
<template #icon>
<ReloadOutlined />
</template>
重置
</a-button>
</a-form-item>
</a-row>
</a-form>
<a-table
rowKey="employeeId"
:loading="tableLoading"
:columns="columns"
:data-source="tableData"
bordered
:pagination="false"
:row-selection="{
selectedRowKeys: selectedRowKeyList,
onChange: onSelectChange,
}"
>
</a-table>
<div class="smart-query-table-page">
<a-pagination
showSizeChanger
showQuickJumper
show-less-items
:pageSizeOptions="PAGE_SIZE_OPTIONS"
:defaultPageSize="queryParam.pageSize"
v-model:current="queryParam.pageNum"
v-model:pageSize="queryParam.pageSize"
:total="total"
@change="queryList"
@showSizeChange="queryList"
:show-total="(total) => `共${total}条`"
/>
</div>
</a-modal>
</template>
<script setup>
import { reactive, ref } from 'vue';
import { message, Modal } from 'ant-design-vue';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS } from '/@/constants/common-const';
import { smartSentry } from '/src/lib/smart-sentry';
import { SmartLoading } from '/src/components/framework/smart-loading';
import SmartEnumSelect from '/src/components/framework/smart-enum-select/index.vue';
import { employeeApi } from '/@/api/system/employee-api';
// -------------------------------
const queryParamState = {
searchWord: null,
keyword: null,
pageNum: 1,
pageSize: PAGE_SIZE,
};
const classId = ref();
const queryParam = reactive({ ...queryParamState });
const tableData = ref([]);
let tableLoading = ref(false);
const total = ref(0);
//
function searchQuery() {
queryList();
}
//
const visible = ref(false);
//
function searchReset() {
Object.assign(queryParam, queryParamState);
queryList();
}
function showModal(receiverIdList) {
selectedRowKeyList.value = receiverIdList;
queryList();
visible.value = true;
}
function selectSearchWord(e) {
queryParam.keyword = queryParam.searchWord;
}
const columns = [
{
title: '姓名',
dataIndex: 'actualName',
align: 'center',
},
{
title: '手机号',
dataIndex: 'phone',
align: 'center',
},
];
// ----------------------
async function queryList() {
try {
tableLoading.value = true;
let res = await employeeApi.queryEmployee(queryParam);
const list = res.data.list;
total.value = res.data.total;
tableData.value = list;
} catch (e) {
smartSentry.captureError(e);
} finally {
tableLoading.value = false;
}
}
//
const selectedRowKeyList = ref([]);
const selectedRowsList = ref([]);
function onSelectChange(keyArray, selectedRows) {
selectedRowKeyList.value = keyArray;
selectedRowsList.value = selectedRows;
}
//
function onClose() {
visible.value = false;
let nameList = selectedRowsList.value.map((item) => item.actualName);
emit('reloadList', selectedRowKeyList.value, nameList);
}
const emit = defineEmits(['reloadList']);
//
function onSubmit() {
try {
onClose();
} catch (error) {
smartSentry.captureError(error);
} finally {
SmartLoading.hide();
}
}
defineExpose({
showModal,
});
</script>
<style scoped lang="less"></style>

View File

@ -0,0 +1,128 @@
<template>
<a-modal title="添加" :width="700" :open="visibleFlag" @cancel="onClose" :maskClosable="false" :destroyOnClose="true">
<a-form ref="formRef" :model="form" :rules="rules" :label-col="{ span: 5 }" :wrapper-col="{ span: 16 }">
<a-form-item label="标题" name="title">
<a-input style="width: 100%" v-model:value="form.title" placeholder="标题" />
</a-form-item>
<a-form-item label="接收人" name="receiverUserIdList">
<a-button @click="selectReceiver" type="primary"> 选择接收人 </a-button>
<div>{{ nameListString }}</div>
</a-form-item>
<a-form-item label="消息类型" name="messageType">
<SmartEnumSelect width="100%" v-model:value="form.messageType" placeholder="请选择类型" enum-name="MESSAGE_TYPE_ENUM" />
</a-form-item>
<a-form-item label="推送内容" name="content">
<a-textarea style="width: 100%" v-model:value="form.content" placeholder="推送内容" />
</a-form-item>
</a-form>
<template #footer>
<a-space>
<a-button @click="onClose">取消</a-button>
<a-button type="primary" @click="onSubmit">保存</a-button>
</a-space>
</template>
</a-modal>
<MessageReceiverModal ref="receiverModalRef" @reloadList="addReceiverIdList" />
</template>
<script setup>
import { nextTick, reactive, ref } from 'vue';
import { message } from 'ant-design-vue';
import { SmartLoading } from '/src/components/framework/smart-loading';
import { smartSentry } from '/src/lib/smart-sentry';
import SmartEnumSelect from '/src/components/framework/smart-enum-select/index.vue';
import MessageReceiverModal from './message-receiver-modal.vue';
import { USER_TYPE_ENUM } from '/src/constants/common-const.js';
import { messageApi } from '/@/api/support/message-api.js';
// ------------------------ ------------------------
const emits = defineEmits(['reloadList']);
// ------------------------ ------------------------
//
const visibleFlag = ref(false);
function show(rowData) {
Object.assign(form, formDefault);
nameListString.value = null;
visibleFlag.value = true;
nextTick(() => {
formRef.value.clearValidate();
});
}
function onClose() {
Object.assign(form, formDefault);
visibleFlag.value = false;
}
// ------------------------ ------------------------
// ref
const formRef = ref();
const formDefault = {
title: undefined,
receiverUserIdList: null,
content: null,
messageType: null,
receiverUserType: USER_TYPE_ENUM.ADMIN_EMPLOYEE.value,
};
let form = reactive({ ...formDefault });
const rules = {
title: [{ required: true, message: '标题 必填' }],
content: [{ required: true, message: '推送内容 必填' }],
receiverUserIdList: [{ required: true, message: '推送人 必填' }],
messageType: [{ required: true, message: '消息类型 必填' }],
};
const nameListString = ref();
function addReceiverIdList(idList, nameList) {
form.receiverUserIdList = idList;
nameListString.value = nameList.join(',');
}
const receiverModalRef = ref();
function selectReceiver() {
receiverModalRef.value.showModal(form.receiverUserIdList);
}
//
async function onSubmit() {
try {
await formRef.value.validateFields();
save();
} catch (err) {
message.error('参数验证错误,请仔细填写表单数据!');
}
}
// API
async function save() {
SmartLoading.show();
try {
let messageList = [];
for (const userId of form.receiverUserIdList) {
messageList.push({
title: form.title,
receiverUserId: userId,
content: form.content,
messageType: form.messageType,
receiverUserType: USER_TYPE_ENUM.ADMIN_EMPLOYEE.value,
});
}
await messageApi.sendMessages(messageList);
message.success('操作成功');
emits('reloadList');
onClose();
} catch (err) {
smartSentry.captureError(err);
} finally {
SmartLoading.hide();
}
}
defineExpose({
show,
});
</script>

View File

@ -0,0 +1,236 @@
<template>
<!---------- 查询表单form begin ----------->
<a-form class="smart-query-form">
<a-row class="smart-query-form-row">
<a-form-item label="关键词" class="smart-query-form-item">
<a-input style="width: 150px" v-model:value="queryForm.searchWord" placeholder="关键词" />
</a-form-item>
<a-form-item label="类型" class="smart-query-form-item">
<smart-enum-select style="width: 150px" v-model:value="queryForm.messageType" placeholder="消息类型" enum-name="MESSAGE_TYPE_ENUM" />
</a-form-item>
<a-form-item label="是否已读" class="smart-query-form-item">
<SmartEnumSelect width="120px" enum-name="FLAG_NUMBER_ENUM" v-model:value="queryForm.readFlag" />
</a-form-item>
<a-form-item label="创建时间" class="smart-query-form-item">
<a-range-picker v-model:value="queryForm.createTime" style="width: 200px" @change="onChangeCreateTime" />
</a-form-item>
<a-form-item class="smart-query-form-item">
<a-button type="primary" @click="searchQuery">
<template #icon>
<SearchOutlined />
</template>
查询
</a-button>
<a-button @click="resetQuery" class="smart-margin-left10">
<template #icon>
<ReloadOutlined />
</template>
重置
</a-button>
</a-form-item>
</a-row>
</a-form>
<!---------- 查询表单form end ----------->
<a-card size="small" :bordered="false" :hoverable="true">
<!---------- 表格操作行 begin ----------->
<a-row class="smart-table-btn-block">
<div class="smart-table-operate-block">
<a-button @click="showForm" type="primary">
<template #icon>
<PlusOutlined />
</template>
发送消息
</a-button>
</div>
<div class="smart-table-setting-block">
<TableOperator v-model="columns" :tableId="TABLE_ID_CONST.SUPPORT.MAIL" :refresh="queryData" />
</div>
</a-row>
<!---------- 表格操作行 end ----------->
<!---------- 表格 begin ----------->
<a-table size="small" :dataSource="tableData" :columns="columns" rowKey="telephoneId" bordered :loading="tableLoading" :pagination="false">
<template #bodyCell="{ record, column, text }">
<template v-if="column.dataIndex === 'readFlag'">
{{ text ? '已读' : '未读' }}
</template>
<template v-if="column.dataIndex === 'messageType'">
{{ $smartEnumPlugin.getDescByValue('MESSAGE_TYPE_ENUM', text) }}
</template>
<template v-if="column.dataIndex === 'action'">
<div class="smart-table-operate">
<a-button @click="onDelete(record)" danger type="link">删除</a-button>
</div>
</template>
</template>
</a-table>
<!---------- 表格 end ----------->
<div class="smart-query-table-page">
<a-pagination
showSizeChanger
showQuickJumper
show-less-items
:pageSizeOptions="PAGE_SIZE_OPTIONS"
:defaultPageSize="queryForm.pageSize"
v-model:current="queryForm.pageNum"
v-model:pageSize="queryForm.pageSize"
:total="total"
@change="queryData"
@showSizeChange="queryData"
:show-total="(total) => `共${total}条`"
/>
</div>
<MessageSendForm ref="formRef" @reloadList="queryData" />
</a-card>
</template>
<script setup>
import { onMounted, reactive, ref } from 'vue';
import { message, Modal } from 'ant-design-vue';
import { SmartLoading } from '/@/components/framework/smart-loading';
import { messageApi } from '/@/api/support/message-api';
import { PAGE_SIZE_OPTIONS } from '/@/constants/common-const';
import { smartSentry } from '/@/lib/smart-sentry';
import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue';
import TableOperator from '/@/components/support/table-operator/index.vue';
import MessageSendForm from './components/message-send-form.vue';
import { TABLE_ID_CONST } from '/@/constants/support/table-id-const';
// ---------------------------- ----------------------------
const columns = ref([
{
title: '消息类型',
dataIndex: 'messageType',
ellipsis: true,
width: 100,
},
{
title: '消息标题',
dataIndex: 'title',
ellipsis: true,
},
{
title: '消息内容',
dataIndex: 'content',
ellipsis: true,
},
{
title: '接收人ID',
dataIndex: 'receiverUserId',
ellipsis: true,
width: 100,
},
{
title: '已读',
dataIndex: 'readFlag',
width: 50,
},
{
title: '已读时间',
dataIndex: 'readTime',
width: 150,
},
{
title: '创建时间',
dataIndex: 'createTime',
width: 150,
},
{
title: '操作',
dataIndex: 'action',
fixed: 'right',
width: 60,
},
]);
// ---------------------------- ----------------------------
const queryFormState = {
searchWord: undefined, //
pageNum: 1,
pageSize: 10,
createTime: [],
readFlag: null,
startDate: null,
endDate: null,
messageType: null,
};
function onChangeCreateTime(dates, dateStrings) {
queryForm.startDate = dateStrings[0];
queryForm.endDate = dateStrings[1];
}
// form
const queryForm = reactive({ ...queryFormState });
// loading
const tableLoading = ref(false);
//
const tableData = ref([]);
//
const total = ref(0);
//
function resetQuery() {
let pageSize = queryForm.pageSize;
Object.assign(queryForm, queryFormState);
queryForm.pageSize = pageSize;
queryData();
}
function searchQuery() {
queryForm.pageNum = 1;
queryData();
}
//
async function queryData() {
tableLoading.value = true;
try {
let queryResult = await messageApi.queryAdminMessage(queryForm);
tableData.value = queryResult.data.list;
total.value = queryResult.data.total;
} catch (e) {
smartSentry.captureError(e);
} finally {
tableLoading.value = false;
}
}
onMounted(queryData);
// ---------------------------- / ----------------------------
const formRef = ref();
function showForm(data) {
formRef.value.show(data);
}
//
function onDelete(data) {
Modal.confirm({
title: '提示',
content: '确定要删除选吗?',
okText: '删除',
okType: 'danger',
onOk() {
requestDelete(data);
},
cancelText: '取消',
onCancel() {},
});
}
async function requestDelete(data) {
try {
SmartLoading.show();
await messageApi.deleteMessage(data.messageId);
message.success('删除成功');
queryData();
} catch (e) {
smartSentry.captureError(e);
} finally {
SmartLoading.hide();
}
}
</script>

View File

@ -37,4 +37,17 @@ export const loginApi = {
getLoginInfo: () => {
return getRequest('/login/getLoginInfo');
},
/**
* 获取双因子登录标识 @author 卓大
*/
getTwoFactorLoginFlag: () => {
return getRequest('/login/getTwoFactorLoginFlag');
},
/**
* 获取邮箱登录验证码 @author 卓大
*/
sendLoginEmailCode: (loginName) => {
return getRequest(`/login/sendEmailCode/${loginName}`);
},
};

View File

@ -19,6 +19,21 @@
/>
</view>
<view class="input-view smart-margin-top10" v-if="emailCodeShowFlag">
<image src="@/static/images/login/login-password.png"></image>
<uni-easyinput
class="input"
placeholder="请输入邮箱验证码"
:clearable="true"
placeholderStyle="color:#CCCCCC"
border="none"
v-model="loginForm.emailCode"
/>
<button @click="sendSmsCode" class="code-btn" :disabled="emailCodeButtonDisabled">
{{ emailCodeTips }}
</button>
</view>
<view class="input-view smart-margin-top10">
<image src="@/static/images/login/login-password.png"></image>
<uni-easyinput
@ -155,7 +170,54 @@
}
}
onShow(getCaptcha);
const emailCodeShowFlag = ref(false);
let emailCodeTips = ref('获取邮箱验证码');
let emailCodeButtonDisabled = ref(false);
//
let countDownTimer = null;
//
function runCountDown() {
emailCodeButtonDisabled.value = true;
let countDown = 60;
emailCodeTips.value = `${countDown}秒后重新获取`;
countDownTimer = setInterval(() => {
if (countDown > 1) {
countDown--;
emailCodeTips.value = `${countDown}秒后重新获取`;
} else {
clearInterval(countDownTimer);
emailCodeButtonDisabled.value = false;
emailCodeTips.value = '获取验证码';
}
}, 1000);
}
//
async function getTwoFactorLoginFlag() {
try {
let result = await loginApi.getTwoFactorLoginFlag();
emailCodeShowFlag.value = result.data;
} catch (e) {
smartSentry.captureError(e);
}
}
//
async function sendSmsCode() {
try {
uni.showLoading();
let result = await loginApi.sendLoginEmailCode(loginForm.loginName);
message.success('验证码发送成功!请登录邮箱查看验证码~');
runCountDown();
} catch (e) {
smartSentry.captureError(e);
} finally {
uni.hideLoading();
}
}
onShow(()=>{
getCaptcha()
getTwoFactorLoginFlag();
});
</script>
<style lang="scss" scoped>
.bottom-view {
@ -294,4 +356,11 @@
margin-bottom: 120rpx;
align-self: flex-start;
}
.code-btn{
width: 240rpx;
font-size: 24rpx;
margin-right: 20rpx;
background-color: $main-color;
color: #fff;
}
</style>