From 5aeff8f6ba54fb07ca127505d1314fe57b32853a Mon Sep 17 00:00:00 2001
From: admin <344137771@qq.com>
Date: Mon, 05 Jan 2026 10:44:48 +0800
Subject: [PATCH] 1

---
 src/views/logmanage/stationmessage.vue |   91 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 90 insertions(+), 1 deletions(-)

diff --git a/src/views/logmanage/stationmessage.vue b/src/views/logmanage/stationmessage.vue
index ac549f6..c4c96f2 100644
--- a/src/views/logmanage/stationmessage.vue
+++ b/src/views/logmanage/stationmessage.vue
@@ -1,6 +1,9 @@
 <template>
     <page-header-wrapper>
         <a-card :bordered="false">
+            <div style="margin-bottom: 16px;">
+                <a-button type="primary" @click="showSendDialog">发送站内消息</a-button>
+            </div>
             <a-table bordered :loading="loading" :pagination="pagination" :columns="columns" :data-source="datalist"
                 rowKey="id">
                 <span slot="status" slot-scope="text,record">
@@ -11,15 +14,63 @@
                 </span>
             </a-table>
         </a-card>
+        
+        <!-- 发送消息对话框 -->
+        <a-modal
+            title="发送站内消息"
+            :visible="sendDialogVisible"
+            @ok="handleSendMessage"
+            @cancel="handleCancelSend"
+            :confirmLoading="sending"
+        >
+            <a-form :form="sendForm">
+                <a-form-item label="接收用户" :label-col="{ span: 6 }" :wrapper-col="{ span: 16 }">
+                    <a-radio-group v-decorator="['sendType', { initialValue: 'all' }]" @change="handleSendTypeChange">
+                        <a-radio value="all">所有用户</a-radio>
+                        <a-radio value="single">指定用户</a-radio>
+                    </a-radio-group>
+                </a-form-item>
+                <a-form-item 
+                    v-if="sendType === 'single'"
+                    label="用户ID" 
+                    :label-col="{ span: 6 }" 
+                    :wrapper-col="{ span: 16 }"
+                >
+                    <a-input-number 
+                        v-decorator="['userId', { rules: [{ required: sendType === 'single', message: '请输入用户ID' }] }]"
+                        :min="1"
+                        placeholder="请输入用户ID"
+                        style="width: 100%"
+                    />
+                </a-form-item>
+                <a-form-item label="消息类型" :label-col="{ span: 6 }" :wrapper-col="{ span: 16 }">
+                    <a-input 
+                        v-decorator="['typeName', { initialValue: '站内消息' }]"
+                        placeholder="消息类型,如:站内消息、系统通知等"
+                    />
+                </a-form-item>
+                <a-form-item label="消息内容" :label-col="{ span: 6 }" :wrapper-col="{ span: 16 }">
+                    <a-textarea 
+                        v-decorator="['content', { rules: [{ required: true, message: '请输入消息内容' }] }]"
+                        :rows="4"
+                        placeholder="请输入消息内容"
+                    />
+                </a-form-item>
+            </a-form>
+        </a-modal>
     </page-header-wrapper>
 </template>
 <script>
-import { logmessageList } from '@/api/logmanage'
+import { logmessageList, logsendMessage } from '@/api/logmanage'
 import moment from 'moment'
 export default {
     name: 'smslog',
     data() {
         return {
+            sendDialogVisible: false,
+            sending: false,
+            sendType: 'all',
+            sendForm: this.$form.createForm(this),
             columns: [
                 {
                     title: '用户名称',
@@ -95,6 +146,44 @@
             this.queryParam.pageSize = pageSize
             this.getlist()
         },
+        showSendDialog() {
+            this.sendDialogVisible = true
+            this.sendForm.resetFields()
+            this.sendType = 'all'
+        },
+        handleSendTypeChange(e) {
+            this.sendType = e.target.value
+        },
+        handleCancelSend() {
+            this.sendDialogVisible = false
+            this.sendForm.resetFields()
+        },
+        handleSendMessage() {
+            this.sendForm.validateFields((err, values) => {
+                if (!err) {
+                    this.sending = true
+                    const params = {
+                        userId: this.sendType === 'all' ? 0 : values.userId,
+                        content: values.content,
+                        typeName: values.typeName || '站内消息'
+                    }
+                    logsendMessage(params).then(res => {
+                        this.sending = false
+                        if (res.status === 0) {
+                            this.$message.success('发送成功')
+                            this.sendDialogVisible = false
+                            this.sendForm.resetFields()
+                            this.getlist()
+                        } else {
+                            this.$message.error(res.msg || '发送失败')
+                        }
+                    }).catch(err => {
+                        this.sending = false
+                        this.$message.error('发送失败:' + (err.message || '未知错误'))
+                    })
+                }
+            })
+        },
     }
 }
 </script>

--
Gitblit v1.9.3