diff --git a/src/api/system/user.ts b/src/api/system/user.ts index 4574219..b28417a 100644 --- a/src/api/system/user.ts +++ b/src/api/system/user.ts @@ -239,3 +239,13 @@ export function getCityByList(pid: any) { method: 'get', }); } +/** + * @description: 发送消息 + */ +export function sendMsg(data) { + return http.request({ + url: '/websocket/sendMsg', + method: 'post', + data, + }); +} diff --git a/src/views/system/user/edit.vue b/src/views/system/user/edit.vue index a2806fe..1f7aa3c 100644 --- a/src/views/system/user/edit.vue +++ b/src/views/system/user/edit.vue @@ -353,7 +353,6 @@ * 执行提交表单 */ const handleSubmit = () => { - console.log(formData); formRef.value .validate() .then(async () => { diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index a88c56a..bfeafd0 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -61,6 +61,14 @@ 导出 + + + 发送消息 + @@ -74,6 +82,13 @@ /> + + @@ -99,8 +114,10 @@ PrinterOutlined, ToTopOutlined, FormOutlined, + CommentOutlined, } from '@vicons/antd'; import editDialog from './edit.vue'; + import sendMsgDialog from './sendMsg.vue'; import userUpload from './userUpload.vue'; import { downloadByData } from '@/utils/file/download'; import { schemas } from './querySchemas'; @@ -114,7 +131,10 @@ const dialog = useDialog(); const basicTableRef = ref(); const createModalRef = ref(); + const sendModalRef = ref(); + const receiveId = ref(''); const editVisible = ref(false); + const sendMsgVisible = ref(false); const userId = ref(0); const rowKeys = ref([]); const importVisible = ref(false); @@ -245,7 +265,6 @@ * @param id 参数 */ const handleResetPassword = (record) => { - console.log(rowKeys.value); dialog.warning({ title: '提示', content: '确定重置密码?', @@ -319,6 +338,20 @@ showModal: true, }); }; + /** + * 发送消息 + * 此处写的是Socket消息发送案例,实际业务研发时根据实际需求自行接入模板消息 + */ + const sendMessage = async () => { + if (rowKeys.value.length == 0) { + message.error('请选择数据'); + return; + } + receiveId.value = rowKeys.value.join(); + sendMsgVisible.value = true; + await nextTick(); + sendModalRef.value.openModal(); + }; diff --git a/src/views/system/user/sendMsg.vue b/src/views/system/user/sendMsg.vue new file mode 100644 index 0000000..f2eec96 --- /dev/null +++ b/src/views/system/user/sendMsg.vue @@ -0,0 +1,98 @@ + +