第一次提交
This commit is contained in:
174
jeecgboot-vue3/src/views/system/notice/DetailModal.vue
Normal file
174
jeecgboot-vue3/src/views/system/notice/DetailModal.vue
Normal file
@@ -0,0 +1,174 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :width="800" title="查看详情" :showCancelBtn="false" :showOkBtn="false" :maxHeight="500">
|
||||
<template #title>
|
||||
<span class="basic-title">查看详情</span>
|
||||
<div class="print-btn" @click="onPrinter">
|
||||
<Icon icon="ant-design:printer-filled" />
|
||||
<span class="print-text">打印</span>
|
||||
</div>
|
||||
</template>
|
||||
<iframe ref="iframeRef" :src="frameSrc" class="detail-iframe" @load="onIframeLoad"></iframe>
|
||||
<template v-if="noticeFiles && noticeFiles.length > 0">
|
||||
<div class="files-title">相关附件:</div>
|
||||
<template v-for="(file, index) in noticeFiles" :key="index">
|
||||
<div class="files-area">
|
||||
<div class="files-area-text">
|
||||
<span>
|
||||
<paper-clip-outlined />
|
||||
<a
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
:title="file.fileName"
|
||||
:href="getFileAccessHttpUrl(file.filePath)"
|
||||
class="ant-upload-list-item-name"
|
||||
>{{ file.fileName }}</a
|
||||
>
|
||||
</span>
|
||||
</div>
|
||||
<div class="files-area-operate">
|
||||
<download-outlined class="item-icon" @click="handleDownloadFile(file.filePath)" />
|
||||
<eye-outlined class="item-icon" @click="handleViewFile(file.filePath)" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<a v-if="noticeFiles.length > 1" :href="downLoadFiles + '?id=' + noticeId + '&token=' + getToken()" target="_blank" style="margin: 15px 6px;color: #5ac0fa;">
|
||||
<download-outlined class="item-icon" style="margin-right: 5px" /><span>批量下载所有附件</span>
|
||||
</a>
|
||||
</template>
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { propTypes } from '/@/utils/propTypes';
|
||||
import { ref } from 'vue';
|
||||
import { buildUUID } from '@/utils/uuid';
|
||||
import {getElectronFileUrl, getFileAccessHttpUrl} from '@/utils/common/compUtils';
|
||||
import { DownloadOutlined, EyeOutlined, PaperClipOutlined } from '@ant-design/icons-vue';
|
||||
import { encryptByBase64 } from '@/utils/cipher';
|
||||
import { useGlobSetting } from '@/hooks/setting';
|
||||
import { getToken } from "@/utils/auth";
|
||||
import {$electron} from "@/electron";
|
||||
const glob = useGlobSetting();
|
||||
// 获取props
|
||||
defineProps({
|
||||
frameSrc: propTypes.string.def(''),
|
||||
});
|
||||
/**
|
||||
* 下载文件路径
|
||||
*/
|
||||
const downLoadFiles = `${glob.domainUrl}/sys/annountCement/downLoadFiles`;
|
||||
|
||||
//附件内容
|
||||
const noticeFiles = ref([]);
|
||||
//数据ID
|
||||
const noticeId = ref('');
|
||||
//表单赋值
|
||||
const [registerModal] = useModalInner((data) => {
|
||||
noticeFiles.value = [];
|
||||
noticeId.value = data.record.id;
|
||||
if (data.record?.files && data.record?.files.length > 0) {
|
||||
noticeFiles.value = data.record.files.split(',').map((item) => {
|
||||
return {
|
||||
fileName: item.split('/').pop(),
|
||||
filePath: item,
|
||||
};
|
||||
});
|
||||
}
|
||||
});
|
||||
// iframe引用
|
||||
const iframeRef = ref<HTMLIFrameElement>();
|
||||
// 存储当前打印会话ID
|
||||
const printSessionId = ref<string>('');
|
||||
// iframe加载完成后初始化通信
|
||||
const onIframeLoad = () => {
|
||||
printSessionId.value = buildUUID(); // 每次加载生成新的会话ID
|
||||
};
|
||||
//打印
|
||||
function onPrinter() {
|
||||
if (!iframeRef.value) return;
|
||||
console.log('onPrinter', iframeRef.value);
|
||||
iframeRef.value?.contentWindow?.postMessage({ printSessionId: printSessionId.value, type: 'action:print' }, '*');
|
||||
}
|
||||
/**
|
||||
* 下载文件
|
||||
* @param filePath
|
||||
*/
|
||||
function handleDownloadFile(filePath) {
|
||||
window.open(getFileAccessHttpUrl(filePath), '_blank');
|
||||
}
|
||||
/**
|
||||
* 预览文件
|
||||
* @param filePath
|
||||
*/
|
||||
function handleViewFile(filePath) {
|
||||
if (filePath) {
|
||||
let url = encodeURIComponent(encryptByBase64(filePath));
|
||||
let previewUrl = `${glob.viewUrl}?url=` + url;
|
||||
//update-begin-author:liusq---date:2025-12-16--for: JHHB-1139桌面端 文件预览统一修改
|
||||
if($electron.isElectron()){
|
||||
previewUrl = getElectronFileUrl(filePath);
|
||||
}
|
||||
//update-end-author:liusq---date:2025-12-16--for: JHHB-1139桌面端 文件预览统一修改
|
||||
window.open(previewUrl, '_blank');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.print-btn {
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
right: 100px;
|
||||
cursor: pointer;
|
||||
color: #a3a3a5;
|
||||
z-index: 999;
|
||||
.print-text {
|
||||
margin-left: 5px;
|
||||
}
|
||||
&:hover {
|
||||
color: #40a9ff;
|
||||
}
|
||||
}
|
||||
.detail-iframe {
|
||||
border: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-height: 500px;
|
||||
// -update-begin--author:liaozhiyang---date:20240702---for:【TV360X-1685】通知公告查看出现两个滚动条
|
||||
display: block;
|
||||
// -update-end--author:liaozhiyang---date:20240702---for:【TV360X-1685】通知公告查看出现两个滚动条
|
||||
}
|
||||
.files-title {
|
||||
font-size: 16px;
|
||||
margin: 10px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
.files-area {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
margin: 6px;
|
||||
&:hover {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
.files-area-text {
|
||||
display: flex;
|
||||
.ant-upload-list-item-name {
|
||||
margin: 0 6px;
|
||||
color: #56befa;
|
||||
}
|
||||
}
|
||||
.files-area-operate {
|
||||
display: flex;
|
||||
margin-left: 10px;
|
||||
.item-icon {
|
||||
cursor: pointer;
|
||||
margin: 0 6px;
|
||||
&:hover {
|
||||
color: #56befa;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
116
jeecgboot-vue3/src/views/system/notice/NoticeForm.vue
Normal file
116
jeecgboot-vue3/src/views/system/notice/NoticeForm.vue
Normal file
@@ -0,0 +1,116 @@
|
||||
<template>
|
||||
<div style="min-height: 400px">
|
||||
<BasicForm @register="registerForm">
|
||||
<template #msgTemplate="{ model, field }">
|
||||
<a-select v-model:value="model[field]" placeholder="请选择消息模版" :options="templateOption" @change="handleChange" />
|
||||
</template>
|
||||
<template #msgContent="{ model, field }">
|
||||
<div v-html="model[field]" class="article-content"></div>
|
||||
</template>
|
||||
</BasicForm>
|
||||
<div class="footer-btn" v-if="!formDisabled">
|
||||
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary">提 交</a-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { getBpmFormSchema } from './notice.data';
|
||||
import { getTempList, queryById, saveOrUpdate } from './notice.api';
|
||||
import { computed, ref } from 'vue';
|
||||
// 定义属性
|
||||
const props = defineProps({
|
||||
formData: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
//表单禁用
|
||||
const formDisabled = computed(() => {
|
||||
if (props.formData.disabled === false) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
const templateOption = ref([]);
|
||||
//表单配置
|
||||
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
|
||||
schemas: getBpmFormSchema(props.formData),
|
||||
showActionButtonGroup: false,
|
||||
disabled: formDisabled.value,
|
||||
labelWidth: 100,
|
||||
baseRowStyle: { marginTop: '10px' },
|
||||
baseColProps: { xs: 24, sm: 12, md: 12, lg: 12, xl: 12, xxl: 12 },
|
||||
});
|
||||
|
||||
//表单提交
|
||||
async function submitForm() {
|
||||
let values = await validate();
|
||||
if (values.msgType === 'ALL') {
|
||||
values.userIds = '';
|
||||
} else {
|
||||
values.userIds += ',';
|
||||
}
|
||||
console.log('表单数据', values);
|
||||
await saveOrUpdate(values, true);
|
||||
}
|
||||
//初始化模板
|
||||
async function initTemplate() {
|
||||
const res = await getTempList({ templateCategory: 'notice', pageSize: 100 });
|
||||
console.log('res', res);
|
||||
if (res.records && res.records.length > 0) {
|
||||
templateOption.value = res.records.map((item) => {
|
||||
return {
|
||||
label: item.templateName,
|
||||
value: item.templateCode,
|
||||
content: item.templateContent,
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 模版修改
|
||||
* @param val
|
||||
*/
|
||||
function handleChange(val) {
|
||||
const content = templateOption.value.find((item: any) => item.value === val)?.content;
|
||||
if (content) {
|
||||
setFieldsValue({
|
||||
msgContent: content,
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 加载数据
|
||||
*/
|
||||
async function initFormData() {
|
||||
let res = await queryById({ id: props.formData.dataId });
|
||||
if (res.success) {
|
||||
//重置表单
|
||||
await resetFields();
|
||||
const record = res.result;
|
||||
if (record.userIds) {
|
||||
record.userIds = record.userIds.substring(0, record.userIds.length - 1);
|
||||
}
|
||||
//表单赋值
|
||||
await setFieldsValue({
|
||||
...record,
|
||||
});
|
||||
}
|
||||
}
|
||||
//加载模版
|
||||
initTemplate();
|
||||
//加载数据
|
||||
initFormData();
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.footer-btn {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
.article-content {
|
||||
max-width: 100%;
|
||||
max-height: 500px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
</style>
|
||||
120
jeecgboot-vue3/src/views/system/notice/NoticeModal.vue
Normal file
120
jeecgboot-vue3/src/views/system/notice/NoticeModal.vue
Normal file
@@ -0,0 +1,120 @@
|
||||
<template>
|
||||
<BasicModal
|
||||
v-bind="$attrs"
|
||||
@register="registerModal"
|
||||
@ok="handleSubmit"
|
||||
:title="title"
|
||||
width="900px"
|
||||
wrapClassName="notice-cls-modal"
|
||||
:maxHeight="800"
|
||||
destroyOnClose
|
||||
>
|
||||
<BasicForm @register="registerForm">
|
||||
<template #msgTemplate="{ model, field }">
|
||||
<a-select v-model:value="model[field]" placeholder="请选择消息模版" :options="templateOption" @change="handleChange" />
|
||||
</template>
|
||||
</BasicForm>
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, unref } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { formSchema } from './notice.data';
|
||||
import { getTempList, saveOrUpdate } from './notice.api';
|
||||
// 声明Emits
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const isUpdate = ref(true);
|
||||
const record = ref<any>({});
|
||||
const templateOption = ref([]);
|
||||
//表单配置
|
||||
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
labelWidth: 100,
|
||||
baseRowStyle: { marginTop: '10px' },
|
||||
baseColProps: { xs: 24, sm: 12, md: 12, lg: 12, xl: 12, xxl: 12 },
|
||||
});
|
||||
//表单赋值
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
//加载模版
|
||||
await initTemplate();
|
||||
//重置表单
|
||||
await resetFields();
|
||||
setModalProps({ confirmLoading: false });
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
if (unref(isUpdate)) {
|
||||
if (data.record.userIds) {
|
||||
data.record.userIds = data.record.userIds.substring(0, data.record.userIds.length - 1);
|
||||
}
|
||||
//表单赋值
|
||||
await setFieldsValue({
|
||||
...data.record,
|
||||
});
|
||||
record.value = data.record;
|
||||
} else {
|
||||
//表单赋值
|
||||
await setFieldsValue({
|
||||
...data.record,
|
||||
});
|
||||
}
|
||||
});
|
||||
//设置标题
|
||||
const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑'));
|
||||
//表单提交事件
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
let values = await validate();
|
||||
setModalProps({ confirmLoading: true });
|
||||
//提交表单
|
||||
// 代码逻辑说明: [issue#429]新增通知公告提交指定用户参数有undefined ---
|
||||
if(values.msgType==='ALL'){
|
||||
values.userIds = '';
|
||||
}else{
|
||||
values.userIds += ',';
|
||||
}
|
||||
if (isUpdate.value && record.value.sendStatus != '2') {
|
||||
values.sendStatus = '0';
|
||||
}
|
||||
await saveOrUpdate(values, isUpdate.value);
|
||||
//关闭弹窗
|
||||
closeModal();
|
||||
//刷新列表
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
//初始化模板
|
||||
async function initTemplate() {
|
||||
const res = await getTempList({ templateCategory: 'notice', pageSize: 100 });
|
||||
console.log('res', res);
|
||||
if (res.records && res.records.length > 0) {
|
||||
templateOption.value = res.records.map((item) => {
|
||||
return {
|
||||
label: item.templateName,
|
||||
value: item.templateCode,
|
||||
content: item.templateContent,
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 模版修改
|
||||
* @param val
|
||||
*/
|
||||
function handleChange(val) {
|
||||
const content = templateOption.value.find((item: any) => item.value === val)?.content;
|
||||
if (content) {
|
||||
setFieldsValue({
|
||||
msgContent: content,
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.notice-cls-modal {
|
||||
top: 20px !important;
|
||||
}
|
||||
</style>
|
||||
210
jeecgboot-vue3/src/views/system/notice/index.vue
Normal file
210
jeecgboot-vue3/src/views/system/notice/index.vue
Normal file
@@ -0,0 +1,210 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #tableTitle>
|
||||
<a-button preIcon="ant-design:plus-outlined" type="primary" @click="handleAdd">新建</a-button>
|
||||
<!-- <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>-->
|
||||
<!-- <j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>-->
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item key="1" @click="batchHandleDelete">
|
||||
<Icon icon="ant-design:delete-outlined"></Icon>
|
||||
删除
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<a-button
|
||||
>批量操作
|
||||
<Icon style="fontsize: 12px" icon="ant-design:down-outlined"></Icon>
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getActions(record)" :dropDownActions="getDropDownAction(record)" />
|
||||
</template>
|
||||
</BasicTable>
|
||||
<NoticeModal @register="registerModal" @success="reload" />
|
||||
<DetailModal @register="register" :frameSrc="iframeUrl" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" name="system-notice" setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import NoticeModal from './NoticeModal.vue';
|
||||
import DetailModal from './DetailModal.vue';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { useGlobSetting } from '/@/hooks/setting';
|
||||
import { getToken } from '/@/utils/auth';
|
||||
import { columns, searchFormSchema } from './notice.data';
|
||||
import { getList, deleteNotice, batchDeleteNotice,editIzTop, getExportUrl, getImportUrl, doReleaseData, doReovkeData } from './notice.api';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { useAppStore } from '/@/store/modules/app';
|
||||
|
||||
const appStore = useAppStore();
|
||||
const glob = useGlobSetting();
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [register, { openModal: openDetail }] = useModal();
|
||||
const iframeUrl = ref('');
|
||||
const { createMessage, createConfirm } = useMessage();
|
||||
// 列表页面公共参数、方法
|
||||
const { prefixCls, onExportXls, onImportXls, tableContext, doRequest } = useListPage({
|
||||
designScope: 'notice-template',
|
||||
tableProps: {
|
||||
title: '消息通知',
|
||||
api: getList,
|
||||
columns: columns,
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
fieldMapToTime: [['sendTime', ['sendTime_begin', 'sendTime_end'], 'YYYY-MM-DD']]
|
||||
}
|
||||
},
|
||||
exportConfig: {
|
||||
name: '消息通知列表',
|
||||
url: getExportUrl,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
//流程编码
|
||||
const flowCode = 'dev_sys_announcement_001';
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
function handleAdd(record = {}) {
|
||||
openModal(true, {
|
||||
isUpdate: false,
|
||||
record,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑事件
|
||||
*/
|
||||
function handleEdit(record) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除事件
|
||||
*/
|
||||
async function handleDelete(record) {
|
||||
await deleteNotice({ id: record.id }, reload);
|
||||
}
|
||||
/**
|
||||
* 置顶操作
|
||||
*/
|
||||
async function handleTop(record, izTop) {
|
||||
await editIzTop({ id: record.id, izTop }, reload);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除事件
|
||||
*/
|
||||
async function batchHandleDelete() {
|
||||
doRequest(() => batchDeleteNotice({ ids: selectedRowKeys.value }));
|
||||
}
|
||||
/**
|
||||
* 发布
|
||||
*/
|
||||
async function handleRelease(id) {
|
||||
await doReleaseData({ id });
|
||||
reload();
|
||||
}
|
||||
/**
|
||||
* 撤销
|
||||
*/
|
||||
async function handleReovke(id) {
|
||||
await doReovkeData({ id });
|
||||
reload();
|
||||
}
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
function handleDetail(record) {
|
||||
iframeUrl.value = `${glob.uploadUrl}/sys/annountCement/show/${record.id}?token=${getToken()}`;
|
||||
openDetail(true, { record });
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作列定义
|
||||
* @param record
|
||||
*/
|
||||
function getActions(record) {
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
ifShow: record.sendStatus == 0 || record.sendStatus == '2',
|
||||
},
|
||||
{
|
||||
label: '查看',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
ifShow: record.sendStatus == 1,
|
||||
},
|
||||
];
|
||||
}
|
||||
/**
|
||||
* 下拉操作栏
|
||||
*/
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '删除',
|
||||
ifShow: record.sendStatus != 1,
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '发布',
|
||||
ifShow: (!record?.izApproval || record.izApproval == '0') && record.sendStatus == 0,
|
||||
onClick: handleRelease.bind(null, record.id),
|
||||
},
|
||||
{
|
||||
label: '撤销',
|
||||
ifShow: record.sendStatus == 1,
|
||||
popConfirm: {
|
||||
title: '确定要撤销吗?',
|
||||
confirm: handleReovke.bind(null, record.id),
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '发布',
|
||||
ifShow: record.sendStatus == '2',
|
||||
popConfirm: {
|
||||
title: '确定要再次发布吗?',
|
||||
confirm: handleRelease.bind(null, record.id),
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '置顶',
|
||||
onClick: handleTop.bind(null, record, 1),
|
||||
ifShow: record.sendStatus == 1 && record.izTop == 0,
|
||||
},
|
||||
{
|
||||
label: '取消置顶',
|
||||
onClick: handleTop.bind(null, record, 0),
|
||||
ifShow: record.sendStatus == 1 && record.izTop == 1,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// 代码逻辑说明: 【JHHB-128】转公告
|
||||
const params = appStore.getMessageHrefParams;
|
||||
if (params?.add) {
|
||||
delete params.add;
|
||||
handleAdd(params);
|
||||
appStore.setMessageHrefParams('');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
95
jeecgboot-vue3/src/views/system/notice/notice.api.ts
Normal file
95
jeecgboot-vue3/src/views/system/notice/notice.api.ts
Normal file
@@ -0,0 +1,95 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
list = '/sys/annountCement/list',
|
||||
save = '/sys/annountCement/add',
|
||||
edit = '/sys/annountCement/edit',
|
||||
delete = '/sys/annountCement/delete',
|
||||
queryById = '/sys/annountCement/queryById',
|
||||
deleteBatch = '/sys/annountCement/deleteBatch',
|
||||
exportXls = '/sys/annountCement/exportXls',
|
||||
importExcel = '/sys/annountCement/importExcel',
|
||||
releaseData = '/sys/annountCement/doReleaseData',
|
||||
reovkeData = '/sys/annountCement/doReovkeData',
|
||||
editIzTop = '/sys/annountCement/editIzTop',
|
||||
addVisitsNum = '/sys/annountCement/addVisitsNumber',
|
||||
tempList = '/sys/message/sysMessageTemplate/list',
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出url
|
||||
*/
|
||||
export const getExportUrl = Api.exportXls;
|
||||
/**
|
||||
* 导入url
|
||||
*/
|
||||
export const getImportUrl = Api.importExcel;
|
||||
/**
|
||||
* 查询消息列表
|
||||
* @param params
|
||||
*/
|
||||
export const getList = (params) => {
|
||||
return defHttp.get({ url: Api.list, params });
|
||||
};
|
||||
|
||||
/**
|
||||
* 保存或者更新通告
|
||||
* @param params
|
||||
*/
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
const url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({ url: url, params });
|
||||
};
|
||||
|
||||
/**
|
||||
* 删除通告
|
||||
* @param params
|
||||
*/
|
||||
export const deleteNotice = (params, handleSuccess) => {
|
||||
return defHttp.delete({ url: Api.delete, data: params }, { joinParamsToUrl: true }).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 置顶编辑
|
||||
* @param params
|
||||
*/
|
||||
export const editIzTop = (params, handleSuccess) => {
|
||||
return defHttp.post({ url: Api.editIzTop, data: params }).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 批量消息公告
|
||||
* @param params
|
||||
*/
|
||||
export const batchDeleteNotice = (params) => defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true });
|
||||
|
||||
/**
|
||||
* 发布
|
||||
* @param id
|
||||
*/
|
||||
export const doReleaseData = (params) => defHttp.get({ url: Api.releaseData, params });
|
||||
/**
|
||||
* 撤销
|
||||
* @param id
|
||||
*/
|
||||
export const doReovkeData = (params) => defHttp.get({ url: Api.reovkeData, params });
|
||||
/**
|
||||
* 新增访问量
|
||||
* @param id
|
||||
*/
|
||||
export const addVisitsNum = (params) => defHttp.get({ url: Api.addVisitsNum, params }, { successMessageMode: 'none' });
|
||||
/**
|
||||
* 根据ID查询数据
|
||||
* @param id
|
||||
*/
|
||||
export const queryById = (params) => defHttp.get({ url: Api.queryById, params }, { isTransformResponse: false });
|
||||
/**
|
||||
* 查询模板列表
|
||||
* @param params
|
||||
*/
|
||||
export const getTempList = (params) => {
|
||||
return defHttp.get({ url: Api.tempList, params });
|
||||
};
|
||||
434
jeecgboot-vue3/src/views/system/notice/notice.data.ts
Normal file
434
jeecgboot-vue3/src/views/system/notice/notice.data.ts
Normal file
@@ -0,0 +1,434 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
import { render } from '/@/utils/common/renderUtils';
|
||||
import { h } from 'vue';
|
||||
import { Tinymce } from '@/components/Tinymce';
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '标题',
|
||||
width: 150,
|
||||
dataIndex: 'titile',
|
||||
},
|
||||
{
|
||||
title: '消息类型',
|
||||
dataIndex: 'msgCategory',
|
||||
width: 100,
|
||||
customRender: ({ text }) => {
|
||||
return render.renderDict(text, 'msg_category');
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '发布人',
|
||||
width: 100,
|
||||
dataIndex: 'sender_dictText',
|
||||
},
|
||||
{
|
||||
title: '优先级',
|
||||
dataIndex: 'priority',
|
||||
width: 70,
|
||||
customRender: ({ text }) => {
|
||||
const color = text == 'L' ? 'blue' : text == 'M' ? 'yellow' : 'red';
|
||||
return render.renderTag(render.renderDict(text, 'priority'), color);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '通告对象',
|
||||
dataIndex: 'msgType',
|
||||
width: 100,
|
||||
customRender: ({ text }) => {
|
||||
return render.renderDict(text, 'msg_type');
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '发布状态',
|
||||
dataIndex: 'sendStatus',
|
||||
width: 70,
|
||||
customRender: ({ text }) => {
|
||||
const color = text == '0' ? 'red' : text == '1' ? 'green' : 'gray';
|
||||
return render.renderTag(render.renderDict(text, 'send_status'), color);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '发布时间',
|
||||
width: 100,
|
||||
dataIndex: 'sendTime',
|
||||
},
|
||||
{
|
||||
title: '撤销时间',
|
||||
width: 100,
|
||||
dataIndex: 'cancelTime',
|
||||
},
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
field: 'titile',
|
||||
label: '标题',
|
||||
component: 'JInput',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
field: 'msgCategory',
|
||||
label: '消息类型',
|
||||
component: 'JDictSelectTag',
|
||||
defaultValue: '1',
|
||||
componentProps: {
|
||||
dictCode: 'msg_category',
|
||||
placeholder: '请选择类型',
|
||||
},
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
field: 'msgClassify',
|
||||
label: '公告分类',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
dictCode: 'notice_type',
|
||||
placeholder: '请选择公告分类',
|
||||
},
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
field: 'sendTime',
|
||||
label: '发布时间',
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
valueType: 'Date',
|
||||
},
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{
|
||||
field: 'id',
|
||||
label: 'id',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
},
|
||||
{
|
||||
field: 'msgCategory',
|
||||
label: '消息类型',
|
||||
required: true,
|
||||
component: 'JDictSelectTag',
|
||||
defaultValue: '1',
|
||||
componentProps: {
|
||||
type: 'radio',
|
||||
dictCode: 'msg_category',
|
||||
placeholder: '请选择类型',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'izTop',
|
||||
label: '是否置顶',
|
||||
defaultValue: '0',
|
||||
component: 'JSwitch',
|
||||
componentProps: {
|
||||
//取值 options
|
||||
options: ['1', '0'],
|
||||
//文本option
|
||||
labelOptions: ['是', '否'],
|
||||
placeholder: '是否置顶',
|
||||
checkedChildren: '是',
|
||||
unCheckedChildren: '否',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'titile',
|
||||
label: '通告标题',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
componentProps: {
|
||||
placeholder: '请输入标题',
|
||||
},
|
||||
// 代码逻辑说明: 【TV360X-1632】标题过长保存报错,长度校验
|
||||
dynamicRules() {
|
||||
return [
|
||||
{
|
||||
validator: (_, value) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
if (value.length > 100) {
|
||||
reject('最长100个字符');
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
},
|
||||
},
|
||||
];
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'msgAbstract',
|
||||
label: '通告摘要',
|
||||
component: 'InputTextArea',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
autoSize: {
|
||||
minRows: 2,
|
||||
maxRows: 5,
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
// {
|
||||
// field: 'endTime',
|
||||
// label: '截至日期',
|
||||
// component: 'DatePicker',
|
||||
// componentProps: {
|
||||
// showTime: true,
|
||||
// valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
// placeholder: '请选择截至日期',
|
||||
// },
|
||||
// dynamicRules: ({ model }) => rules.endTime(model.startTime, true),
|
||||
// },
|
||||
{
|
||||
field: 'msgType',
|
||||
label: '接收用户',
|
||||
defaultValue: 'ALL',
|
||||
component: 'JDictSelectTag',
|
||||
required: true,
|
||||
componentProps: {
|
||||
type: 'radio',
|
||||
dictCode: 'msg_type',
|
||||
placeholder: '请选择发布范围',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'userIds',
|
||||
label: '指定用户',
|
||||
component: 'JSelectUserByDepartment',
|
||||
required: true,
|
||||
componentProps: {
|
||||
rowKey: 'id',
|
||||
// 代码逻辑说明: 【TV360X-1627】通知公告用户选择组件没翻译
|
||||
labelKey: 'realname',
|
||||
},
|
||||
ifShow: ({ values }) => values.msgType == 'USER',
|
||||
},
|
||||
{
|
||||
field: 'msgClassify',
|
||||
label: '公告分类',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
dictCode: 'notice_type',
|
||||
placeholder: '请选择公告分类',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'priority',
|
||||
label: '优先级别',
|
||||
defaultValue: 'H',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
dictCode: 'priority',
|
||||
type: 'radio',
|
||||
placeholder: '请选择优先级',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'izApproval',
|
||||
label: '是否审批',
|
||||
component: 'RadioGroup',
|
||||
defaultValue: '0',
|
||||
componentProps: {
|
||||
options: [
|
||||
{
|
||||
label: '是',
|
||||
value: '1',
|
||||
},
|
||||
{
|
||||
label: '否',
|
||||
value: '0',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'msgTemplate',
|
||||
label: '公告模版',
|
||||
component: 'Input',
|
||||
slot: 'msgTemplate',
|
||||
},
|
||||
{
|
||||
field: 'files',
|
||||
label: '通告附件',
|
||||
component: 'JUpload',
|
||||
componentProps: {
|
||||
//是否显示选择按钮
|
||||
text: '文件上传',
|
||||
//最大上传数
|
||||
maxCount: 20,
|
||||
//是否显示下载按钮
|
||||
download: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'msgContent',
|
||||
label: '通告内容',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
render: render.renderTinymce,
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* 流程表单调用这个方法获取formSchema
|
||||
* @param param
|
||||
*/
|
||||
export function getBpmFormSchema(_formData): FormSchema[] {
|
||||
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
|
||||
return [
|
||||
{
|
||||
field: 'id',
|
||||
label: 'id',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
},
|
||||
{
|
||||
field: 'msgCategory',
|
||||
label: '消息类型',
|
||||
required: true,
|
||||
component: 'JDictSelectTag',
|
||||
defaultValue: '1',
|
||||
componentProps: {
|
||||
type: 'radio',
|
||||
dictCode: 'msg_category',
|
||||
placeholder: '请选择类型',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'izTop',
|
||||
label: '是否置顶',
|
||||
defaultValue: '0',
|
||||
component: 'JSwitch',
|
||||
componentProps: {
|
||||
//取值 options
|
||||
options: ['1', '0'],
|
||||
//文本option
|
||||
labelOptions: ['是', '否'],
|
||||
placeholder: '是否置顶',
|
||||
checkedChildren: '是',
|
||||
unCheckedChildren: '否',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'titile',
|
||||
label: '通告标题',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
componentProps: {
|
||||
placeholder: '请输入标题',
|
||||
},
|
||||
// 代码逻辑说明: 【TV360X-1632】标题过长保存报错,长度校验
|
||||
dynamicRules() {
|
||||
return [
|
||||
{
|
||||
validator: (_, value) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
if (value.length > 100) {
|
||||
reject('最长100个字符');
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
},
|
||||
},
|
||||
];
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'msgAbstract',
|
||||
label: '通告摘要',
|
||||
component: 'InputTextArea',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
field: 'msgType',
|
||||
label: '接收用户',
|
||||
defaultValue: 'ALL',
|
||||
component: 'JDictSelectTag',
|
||||
required: true,
|
||||
componentProps: {
|
||||
type: 'radio',
|
||||
dictCode: 'msg_type',
|
||||
placeholder: '请选择发布范围',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'userIds',
|
||||
label: '指定用户',
|
||||
component: 'JSelectUserByDepartment',
|
||||
required: true,
|
||||
componentProps: {
|
||||
rowKey: 'id',
|
||||
// 代码逻辑说明: 【TV360X-1627】通知公告用户选择组件没翻译
|
||||
labelKey: 'realname',
|
||||
},
|
||||
ifShow: ({ values }) => values.msgType == 'USER',
|
||||
},
|
||||
{
|
||||
field: 'msgClassify',
|
||||
label: '公告分类',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
dictCode: 'notice_type',
|
||||
placeholder: '请选择公告分类',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'priority',
|
||||
label: '优先级别',
|
||||
defaultValue: 'H',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
dictCode: 'priority',
|
||||
type: 'radio',
|
||||
placeholder: '请选择优先级',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'msgTemplate',
|
||||
label: '公告模版',
|
||||
component: 'Input',
|
||||
slot: 'msgTemplate',
|
||||
},
|
||||
{
|
||||
field: 'files',
|
||||
label: '通告附件',
|
||||
component: 'JUpload',
|
||||
componentProps: {
|
||||
//是否显示选择按钮
|
||||
text: '文件上传',
|
||||
//最大上传数
|
||||
maxCount: 2,
|
||||
//是否显示下载按钮
|
||||
download: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'msgContent',
|
||||
label: '通告内容',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
ifShow: ({}) => _formData.disabled == false,
|
||||
render: ({ model, field }) => {
|
||||
return h(Tinymce, {
|
||||
showImageUpload: false,
|
||||
disabled: _formData.disabled !== false,
|
||||
height: 300,
|
||||
value: model[field],
|
||||
onChange: (value: string) => {
|
||||
model[field] = value;
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'msgContent',
|
||||
label: '通告内容',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
ifShow: ({}) => _formData.disabled !== false,
|
||||
slot: 'msgContent',
|
||||
},
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user