Просмотр исходного кода

feat:【system 系统功能】邮箱增加抄送、密送,支持多个

YunaiV 6 месяцев назад
Родитель
Сommit
ff7beb6db2

+ 3 - 1
src/api/system/mail/log/index.ts

@@ -4,7 +4,9 @@ export interface MailLogVO {
   id: number
   userId: number
   userType: number
-  toMail: string
+  toMails: string[]
+  ccMails?: string[]
+  bccMails?: string[]
   accountId: number
   fromMail: string
   templateId: number

+ 7 - 2
src/api/system/mail/template/index.ts

@@ -14,7 +14,9 @@ export interface MailTemplateVO {
 }
 
 export interface MailSendReqVO {
-  mail: string
+  toMails: string[]
+  ccMails?: string[]
+  bccMails?: string[]
   templateCode: string
   templateParams: Map<String, Object>
 }
@@ -46,7 +48,10 @@ export const deleteMailTemplate = async (id: number) => {
 
 // 批量删除邮件模版
 export const deleteMailTemplateList = async (ids: number[]) => {
-  return await request.delete({ url: '/system/mail-template/delete-list', params: { ids: ids.join(',') } })
+  return await request.delete({
+    url: '/system/mail-template/delete-list',
+    params: { ids: ids.join(',') }
+  })
 }
 
 // 发送邮件

+ 25 - 3
src/views/system/mail/log/MailLogDetail.vue

@@ -13,12 +13,34 @@
       <el-descriptions-item label="模版发送人名称">
         {{ detailData.templateNickname }}
       </el-descriptions-item>
-      <el-descriptions-item label="用户信息">
-        {{ detailData.toMail }}
+      <el-descriptions-item label="接收用户">
         <span v-if="detailData.userType && detailData.userId">
           <dict-tag :type="DICT_TYPE.USER_TYPE" :value="detailData.userType" />
           ({{ detailData.userId }})
         </span>
+        <span v-else>无</span>
+      </el-descriptions-item>
+      <el-descriptions-item label="接收信息">
+        <div>
+          <div v-if="detailData.toMails && detailData.toMails.length > 0">
+            收件:
+            <span v-for="(mail, index) in detailData.toMails" :key="mail">
+              {{ mail }}<span v-if="index < detailData.toMails.length - 1">、</span>
+            </span>
+          </div>
+          <div v-if="detailData.ccMails && detailData.ccMails.length > 0">
+            抄送:
+            <span v-for="(mail, index) in detailData.ccMails" :key="mail">
+              {{ mail }}<span v-if="index < detailData.ccMails.length - 1">、</span>
+            </span>
+          </div>
+          <div v-if="detailData.bccMails && detailData.bccMails.length > 0">
+            密送:
+            <span v-for="(mail, index) in detailData.bccMails" :key="mail">
+              {{ mail }}<span v-if="index < detailData.bccMails.length - 1">、</span>
+            </span>
+          </div>
+        </div>
       </el-descriptions-item>
       <el-descriptions-item label="邮件标题">
         {{ detailData.templateTitle }}
@@ -58,7 +80,7 @@ defineOptions({ name: 'SystemMailLogDetail' })
 const dialogVisible = ref(false) // 弹窗的是否展示
 const detailLoading = ref(false) // 表单的加载中
 const detailData = ref() // 详情数据
-const accountList = ref([]) // 邮箱账号列表
+const accountList = ref<MailAccountApi.MailAccountVO[]>([]) // 邮箱账号列表
 
 /** 打开弹窗 */
 const open = async (data: MailLogApi.MailLogVO) => {

+ 33 - 9
src/views/system/mail/log/index.vue

@@ -119,12 +119,36 @@
         width="180"
         :formatter="dateFormatter"
       />
-      <el-table-column label="接收邮箱" align="center" prop="toMail" width="200">
+      <el-table-column label="接收用户" align="center" width="150">
         <template #default="scope">
-          <div>{{ scope.row.toMail }}</div>
           <div v-if="scope.row.userType && scope.row.userId">
             <dict-tag :type="DICT_TYPE.USER_TYPE" :value="scope.row.userType" />
-            {{ '(' + scope.row.userId + ')' }}
+            <div>{{ '(' + scope.row.userId + ')' }}</div>
+          </div>
+          <div v-else>-</div>
+        </template>
+      </el-table-column>
+      <el-table-column label="接收信息" align="center" width="300">
+        <template #default="scope">
+          <div class="text-left">
+            <div v-if="scope.row.toMails && scope.row.toMails.length > 0">
+              收件:
+              <span v-for="(mail, index) in scope.row.toMails" :key="mail">
+                {{ mail }}<span v-if="index < scope.row.toMails.length - 1">、</span>
+              </span>
+            </div>
+            <div v-if="scope.row.ccMails && scope.row.ccMails.length > 0">
+              抄送:
+              <span v-for="(mail, index) in scope.row.ccMails" :key="mail">
+                {{ mail }}<span v-if="index < scope.row.ccMails.length - 1">、</span>
+              </span>
+            </div>
+            <div v-if="scope.row.bccMails && scope.row.bccMails.length > 0">
+              密送:
+              <span v-for="(mail, index) in scope.row.bccMails" :key="mail">
+                {{ mail }}<span v-if="index < scope.row.bccMails.length - 1">、</span>
+              </span>
+            </div>
           </div>
         </template>
       </el-table-column>
@@ -185,15 +209,15 @@ const queryParams = reactive({
   pageNo: 1,
   pageSize: 10,
   toMail: '',
-  accountId: null,
-  templateId: null,
-  sendStatus: null,
-  userId: null,
-  userType: null,
+  accountId: undefined,
+  templateId: undefined,
+  sendStatus: undefined,
+  userId: undefined,
+  userType: undefined,
   sendTime: []
 })
 const exportLoading = ref(false) // 导出的加载中
-const accountList = ref([]) // 邮箱账号列表
+const accountList = ref<MailAccountApi.MailAccountVO[]>([]) // 邮箱账号列表
 
 /** 查询列表 */
 const getList = async () => {

+ 26 - 5
src/views/system/mail/template/MailTemplateSendForm.vue

@@ -10,8 +10,26 @@
       <el-form-item label="模板内容" prop="content">
         <Editor :model-value="formData.content" height="150px" readonly />
       </el-form-item>
-      <el-form-item label="收件邮箱" prop="mail">
-        <el-input v-model="formData.mail" placeholder="请输入收件邮箱" />
+      <el-form-item label="收件邮箱" prop="toMails">
+        <el-input-tag
+          v-model="formData.toMails"
+          placeholder="请输入收件邮箱,多个邮箱用回车分隔"
+          class="!w-full"
+        />
+      </el-form-item>
+      <el-form-item label="抄送邮箱" prop="ccMails">
+        <el-input-tag
+          v-model="formData.ccMails"
+          placeholder="请输入抄送邮箱,多个邮箱用回车分隔"
+          class="!w-full"
+        />
+      </el-form-item>
+      <el-form-item label="密送邮箱" prop="bccMails">
+        <el-input-tag
+          v-model="formData.bccMails"
+          placeholder="请输入密送邮箱,多个邮箱用回车分隔"
+          class="!w-full"
+        />
       </el-form-item>
       <el-form-item
         v-for="param in formData.params"
@@ -43,12 +61,13 @@ const formLoading = ref(false) // 表单的加载中:1)修改时的数据加
 const formData = ref({
   content: '',
   params: {},
-  mail: '',
+  toMails: [],
+  ccMails: [],
+  bccMails: [],
   templateCode: '',
   templateParams: new Map()
 })
 const formRules = reactive({
-  mail: [{ required: true, message: '邮箱不能为空', trigger: 'blur' }],
   templateCode: [{ required: true, message: '模版编号不能为空', trigger: 'blur' }],
   templateParams: {}
 })
@@ -105,7 +124,9 @@ const resetForm = () => {
   formData.value = {
     content: '',
     params: {},
-    mail: '',
+    toMails: [],
+    ccMails: [],
+    bccMails: [],
     templateCode: '',
     templateParams: new Map()
   }