update
1.系统管理-短信管理-短信发送
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" title="查看详情" :showCancelBtn="false" :showOkBtn="false" :maxHeight="500">
|
||||
<iframe :src="frameSrc" class="detail-iframe"></iframe>
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { propTypes } from '/@/utils/propTypes';
|
||||
// 获取props
|
||||
defineProps({
|
||||
frameSrc: propTypes.string.def(''),
|
||||
});
|
||||
//表单赋值
|
||||
const [registerModal] = useModalInner();
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.detail-iframe {
|
||||
border: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-height: 500px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,74 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" @ok="handleSubmit" width="900px" destroyOnClose>
|
||||
<BasicForm @register="registerForm" />
|
||||
</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 { saveOrUpdate } from './notice.api';
|
||||
// 声明Emits
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const isUpdate = ref(true);
|
||||
//表单配置
|
||||
const [registerForm, { setProps, resetFields, setFieldsValue, validate }] = useForm({
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
});
|
||||
//表单赋值
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
//重置表单
|
||||
await resetFields();
|
||||
setModalProps({
|
||||
confirmLoading: false,
|
||||
showCancelBtn: !!data?.showFooter,
|
||||
showOkBtn: !!data?.showFooter,
|
||||
});
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
if (unref(isUpdate)) {
|
||||
// if (data.record.userIds) {
|
||||
// data.record.userIds = data.record.userIds.substring(0, data.record.userIds.length - 1);
|
||||
// }
|
||||
//表单赋值
|
||||
if (data.record.msgType === 'DOC') {
|
||||
//如果是指定专家,这里处理一下初始值
|
||||
data.record.docIds = data.record.userIds;
|
||||
data.record.userIds = '';
|
||||
}
|
||||
await setFieldsValue({
|
||||
...data.record,
|
||||
});
|
||||
}
|
||||
// 隐藏底部时禁用整个表单
|
||||
setProps({ disabled: !data?.showFooter });
|
||||
});
|
||||
//设置标题
|
||||
const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑'));
|
||||
//表单提交事件
|
||||
async function handleSubmit(v) {
|
||||
try {
|
||||
let values = await validate();
|
||||
setModalProps({ confirmLoading: true });
|
||||
//提交表单
|
||||
//update-begin-author:liusq---date:20230404--for: [issue#429]新增通知公告提交指定用户参数有undefined ---
|
||||
if (values.msgType === 'ALL' || values.msgType === 'ALL_DOC') {//全选置空
|
||||
values.userIds = '';
|
||||
} else {
|
||||
if (values.msgType === 'DOC'){
|
||||
values.userIds = values.docIds;
|
||||
}
|
||||
// values.userIds += ',';
|
||||
}
|
||||
//update-end-author:liusq---date:20230404--for: [issue#429]新增通知公告提交指定用户参数有undefined ---
|
||||
await saveOrUpdate(values, isUpdate.value);
|
||||
//关闭弹窗
|
||||
closeModal();
|
||||
//刷新列表
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,143 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #tableTitle>
|
||||
<a-button preIcon="ant-design:plus-outlined" type="primary" @click="handleAdd">新增</a-button>
|
||||
</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} from 'vue';
|
||||
import {BasicTable, TableAction} from '/@/components/Table';
|
||||
import {useModal} from '/@/components/Modal';
|
||||
import NoticeModal from './NoticeModal.vue';
|
||||
import DetailModal from './DetailModal.vue';
|
||||
import {useGlobSetting} from '/@/hooks/setting';
|
||||
import {columns, searchFormSchema} from './notice.data';
|
||||
import {deleteNotice, getExportUrl, getImportUrl, getList, publishData, resEditData} from './notice.api';
|
||||
import {useListPage} from '/@/hooks/system/useListPage';
|
||||
|
||||
const glob = useGlobSetting();
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [register, { openModal: openDetail }] = useModal();
|
||||
const iframeUrl = ref('');
|
||||
|
||||
// 列表页面公共参数、方法
|
||||
const { prefixCls, tableContext, doRequest } = useListPage({
|
||||
designScope: 'notice-template',
|
||||
tableProps: {
|
||||
title: '消息通知',
|
||||
api: getList,
|
||||
columns: columns,
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: '消息通知列表',
|
||||
url: getExportUrl,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
function handleAdd() {
|
||||
openModal(true, {
|
||||
isUpdate: false,
|
||||
showFooter: true,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑事件
|
||||
*/
|
||||
function handleEdit(record) {
|
||||
resEditData({ id: record.id }).then((res) => {
|
||||
openModal(true, {
|
||||
record: res,
|
||||
isUpdate: true,
|
||||
showFooter: true,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function handleDetail(record) {
|
||||
resEditData({ id: record.id }).then((res) => {
|
||||
openModal(true, {
|
||||
record: res,
|
||||
isUpdate: true,
|
||||
showFooter: false,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除事件
|
||||
*/
|
||||
async function handleDelete(record) {
|
||||
await deleteNotice({ id: record.id }, reload);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除事件
|
||||
*/
|
||||
// async function batchHandleDelete() {
|
||||
// doRequest(() => batchDeleteNotice({ ids: selectedRowKeys.value }));
|
||||
// }
|
||||
/**
|
||||
* 发布
|
||||
*/
|
||||
async function handleRelease(id) {
|
||||
await publishData({ id: id }, reload);
|
||||
}
|
||||
/**
|
||||
* 操作列定义
|
||||
* @param record
|
||||
*/
|
||||
function getActions(record) {
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
ifShow: record.sendStatus == '0',
|
||||
},
|
||||
|
||||
{
|
||||
label: '发布',
|
||||
disabled: record.sendStatus !== '0',
|
||||
onClick: handleRelease.bind(null, record.id),
|
||||
},
|
||||
];
|
||||
}
|
||||
/**
|
||||
* 下拉操作栏
|
||||
*/
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '查看',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
disabled: record.sendStatus === '3',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,89 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
const { createConfirm } = useMessage();
|
||||
enum Api {
|
||||
list = '/sys/annountCement/list',
|
||||
save = '/sys/annountCement/add',
|
||||
edit = '/sys/annountCement/edit',
|
||||
delete = '/sys/annountCement/delete',
|
||||
deleteBatch = '/sys/annountCement/deleteBatch',
|
||||
exportXls = '/sys/annountCement/exportXls',
|
||||
importExcel = '/sys/annountCement/importExcel',
|
||||
releaseData = '/sys/annountCement/doReleaseData',
|
||||
reovkeData = '/sys/annountCement/doReovkeData',
|
||||
publishData = '/sys/annountCement/publishData',
|
||||
queryById = '/sys/annountCement/queryById',
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出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 });
|
||||
};
|
||||
|
||||
/**
|
||||
* 请求编辑数据
|
||||
*/
|
||||
export const resEditData = async (params, handleSuccess) => {
|
||||
return await defHttp.get({ url: Api.queryById, params });
|
||||
};
|
||||
|
||||
/**
|
||||
* 保存或者更新通告
|
||||
* @param params
|
||||
*/
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
let 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 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 });
|
||||
export const publishData = (params, handleSuccess) => {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '确认发布',
|
||||
content: '是否发布该消息?发布之后会逐步发短信给用户',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
return defHttp.post({ url: Api.publishData, data: params }, { joinParamsToUrl: true }).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,199 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
import { rules } from '/@/utils/helper/validator';
|
||||
import { render } from '/@/utils/common/renderUtils';
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '标题',
|
||||
width: 150,
|
||||
dataIndex: 'titile',
|
||||
},
|
||||
{
|
||||
title: '消息类型',
|
||||
dataIndex: 'msgCategory_dictText',
|
||||
width: 100,
|
||||
},
|
||||
|
||||
/*{
|
||||
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_dictText',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '创建人',
|
||||
width: 100,
|
||||
dataIndex: 'createBy',
|
||||
},
|
||||
{
|
||||
title: '发布状态',
|
||||
dataIndex: 'sendStatus',
|
||||
width: 70,
|
||||
customRender: ({ text }) => {
|
||||
const color = text == '0' ? 'red' : text == '1' ? 'green' : 'orange';
|
||||
return render.renderTag(render.renderDict(text, 'send_status'), color);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '发布人',
|
||||
width: 100,
|
||||
dataIndex: 'sender',
|
||||
},
|
||||
{
|
||||
title: '发布时间',
|
||||
width: 100,
|
||||
dataIndex: 'sendTime',
|
||||
},
|
||||
{
|
||||
title: '发布进度',
|
||||
width: 100,
|
||||
dataIndex: 'msgAbstract',
|
||||
},
|
||||
/*{
|
||||
title: '撤销时间',
|
||||
width: 100,
|
||||
dataIndex: 'cancelTime',
|
||||
},*/
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
field: 'titile',
|
||||
label: '标题',
|
||||
component: 'JInput',
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
{
|
||||
field: 'sendStatus',
|
||||
label: '发布状态',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
dictCode: 'send_status',
|
||||
},
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{
|
||||
field: 'id',
|
||||
label: 'id',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
},
|
||||
{
|
||||
field: 'msgCategory',
|
||||
label: '消息类型',
|
||||
required: true,
|
||||
component: 'JDictSelectTag',
|
||||
defaultValue: '3',
|
||||
componentProps: {
|
||||
type: 'radio',
|
||||
dictCode: 'msg_category',
|
||||
placeholder: '请选择类型',
|
||||
},
|
||||
},
|
||||
|
||||
/*{
|
||||
field: 'msgAbstract',
|
||||
label: '摘要',
|
||||
component: 'InputTextArea',
|
||||
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: 'radioButton',
|
||||
dictCode: 'msg_type',
|
||||
placeholder: '请选择发布范围',
|
||||
onChange: function (arg1) {
|
||||
console.log(arg1);
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'userIds',
|
||||
label: '指定用户',
|
||||
component: 'JSelectUserByDept',
|
||||
required: true,
|
||||
componentProps: ({ formModel }) => {
|
||||
return {
|
||||
rowKey: 'id',
|
||||
labelKey: 'realname',
|
||||
// onChange: function (arg1) {
|
||||
// formModel.userIds = arg1.join(',');
|
||||
// }
|
||||
};
|
||||
},
|
||||
ifShow: ({ values }) => values.msgType == 'USER',
|
||||
},
|
||||
{
|
||||
field: 'docIds',
|
||||
label: '指定专家',
|
||||
component: 'JSelectDocByType',
|
||||
required: true,
|
||||
componentProps: ({ formModel }) => {
|
||||
return {
|
||||
rowKey: 'id',
|
||||
labelKey: 'doctorName',
|
||||
// onChange: function (arg1) {
|
||||
// formModel.userIds = arg1.join(',');
|
||||
// }
|
||||
};
|
||||
},
|
||||
ifShow: ({ values }) => values.msgType == 'DOC',
|
||||
},
|
||||
|
||||
/*{
|
||||
field: 'priority',
|
||||
label: '优先级',
|
||||
defaultValue: 'H',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
dictCode: 'priority',
|
||||
type: 'radio',
|
||||
placeholder: '请选择优先级',
|
||||
},
|
||||
},*/
|
||||
{
|
||||
field: 'titile',
|
||||
label: '标题',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
componentProps: {
|
||||
placeholder: '请输入标题',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'msgContent',
|
||||
label: '短信内容',
|
||||
component: 'InputTextArea',
|
||||
required: true,
|
||||
componentProps: {
|
||||
placeholder: '请输入短信内容',
|
||||
},
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user