From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目

---
 src/views/system/mail/account/index.vue |  213 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 213 insertions(+), 0 deletions(-)

diff --git a/src/views/system/mail/account/index.vue b/src/views/system/mail/account/index.vue
new file mode 100644
index 0000000..51c07ed
--- /dev/null
+++ b/src/views/system/mail/account/index.vue
@@ -0,0 +1,213 @@
+<template>
+  <doc-alert title="閭欢閰嶇疆" url="https://doc.iocoder.cn/mail" />
+
+  <ContentWrap>
+    <el-form
+      class="-mb-15px"
+      :model="queryParams"
+      ref="queryFormRef"
+      :inline="true"
+      label-width="68px"
+    >
+      <el-form-item label="閭" prop="mail">
+        <el-input
+          v-model="queryParams.mail"
+          placeholder="璇疯緭鍏ラ偖绠�"
+          clearable
+          class="!w-240px"
+          @keyup.enter="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="鐢ㄦ埛鍚�" prop="username">
+        <el-input
+          v-model="queryParams.username"
+          placeholder="璇疯緭鍏ョ敤鎴峰悕"
+          clearable
+          class="!w-240px"
+          @keyup.enter="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="鍒涘缓鏃堕棿" prop="createTime">
+        <el-date-picker
+          v-model="queryParams.createTime"
+          value-format="YYYY-MM-DD HH:mm:ss"
+          type="daterange"
+          start-placeholder="寮�濮嬫棩鏈�"
+          end-placeholder="缁撴潫鏃ユ湡"
+          :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
+          class="!w-240px"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 鎼滅储</el-button>
+        <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 閲嶇疆</el-button>
+        <el-button
+          type="primary"
+          plain
+          @click="openForm('create')"
+          v-hasPermi="['system:mail-account:create']"
+        >
+          <Icon icon="ep:plus" class="mr-5px" /> 鏂板</el-button
+        >
+        <el-button
+          type="danger"
+          plain
+          :disabled="checkedIds.length === 0"
+          @click="handleDeleteBatch"
+          v-hasPermi="['system:mail-account:delete']"
+        >
+          <Icon icon="ep:delete" class="mr-5px" /> 鎵归噺鍒犻櫎
+        </el-button>
+      </el-form-item>
+    </el-form>
+  </ContentWrap>
+
+  <!-- 鍒楄〃 -->
+  <ContentWrap>
+    <el-table v-loading="loading" :data="list" @selection-change="handleRowCheckboxChange">
+      <el-table-column type="selection" width="55" />
+      <el-table-column label="缂栧彿" align="center" prop="id" />
+      <el-table-column label="閭" align="center" prop="mail" />
+      <el-table-column label="鐢ㄦ埛鍚�" align="center" prop="username" />
+      <el-table-column label="SMTP 鏈嶅姟鍣ㄥ煙鍚�" align="center" prop="host" />
+      <el-table-column label="SMTP 鏈嶅姟鍣ㄧ鍙�" align="center" prop="port" />
+      <el-table-column label="鏄惁寮�鍚� SSL" align="center" prop="sslEnable">
+        <template #default="scope">
+          <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.sslEnable" />
+        </template>
+      </el-table-column>
+      <el-table-column label="鏄惁寮�鍚� STARTTLS" align="center" prop="starttlsEnable">
+        <template #default="scope">
+          <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.starttlsEnable" />
+        </template>
+      </el-table-column>
+      <el-table-column
+        label="鍒涘缓鏃堕棿"
+        align="center"
+        prop="createTime"
+        width="180"
+        :formatter="dateFormatter"
+      />
+      <el-table-column label="鎿嶄綔" align="center">
+        <template #default="scope">
+          <el-button
+            link
+            type="primary"
+            @click="openForm('update', scope.row.id)"
+            v-hasPermi="['system:mail-account:update']"
+          >
+            缂栬緫
+          </el-button>
+          <el-button
+            link
+            type="danger"
+            @click="handleDelete(scope.row.id)"
+            v-hasPermi="['system:mail-account:delete']"
+          >
+            鍒犻櫎
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <!-- 鍒嗛〉 -->
+    <Pagination
+      :total="total"
+      v-model:page="queryParams.pageNo"
+      v-model:limit="queryParams.pageSize"
+      @pagination="getList"
+    />
+  </ContentWrap>
+
+  <!-- 琛ㄥ崟寮圭獥锛氭坊鍔�/淇敼 -->
+  <MailAccountForm ref="formRef" @success="getList" />
+</template>
+<script lang="ts" setup>
+import { DICT_TYPE } from '@/utils/dict'
+import { dateFormatter } from '@/utils/formatTime'
+import * as MailAccountApi from '@/api/system/mail/account'
+import MailAccountForm from './MailAccountForm.vue'
+
+defineOptions({ name: 'SystemMailAccount' })
+
+const { t } = useI18n() // 鍥介檯鍖�
+const message = useMessage() // 娑堟伅寮圭獥
+
+const loading = ref(false) // 鍒楄〃鐨勫姞杞戒腑
+const total = ref(0) // 鍒楄〃鐨勬�婚〉鏁�
+const list = ref([]) // 鍒楄〃鐨勬暟鎹�
+const queryFormRef = ref() // 鎼滅储鐨勮〃鍗�
+const queryParams = reactive({
+  pageNo: 1,
+  pageSize: 10,
+  mail: '',
+  username: '',
+  createTime: []
+})
+
+/** 鏌ヨ鍒楄〃 */
+const getList = async () => {
+  loading.value = true
+  try {
+    const data = await MailAccountApi.getMailAccountPage(queryParams)
+    list.value = data.list
+    total.value = data.total
+  } finally {
+    loading.value = false
+  }
+}
+
+/** 鎼滅储鎸夐挳鎿嶄綔 */
+const handleQuery = () => {
+  queryParams.pageNo = 1
+  getList()
+}
+
+/** 閲嶇疆鎸夐挳鎿嶄綔 */
+const resetQuery = () => {
+  queryFormRef.value.resetFields()
+  handleQuery()
+}
+
+/** 娣诲姞/淇敼鎿嶄綔 */
+const formRef = ref()
+const openForm = (type: string, id?: number) => {
+  formRef.value.open(type, id)
+}
+
+/** 鍒犻櫎鎸夐挳鎿嶄綔 */
+const handleDelete = async (id: number) => {
+  try {
+    // 鍒犻櫎鐨勪簩娆$‘璁�
+    await message.delConfirm()
+    // 鍙戣捣鍒犻櫎
+    await MailAccountApi.deleteMailAccount(id)
+    message.success(t('common.delSuccess'))
+    // 鍒锋柊鍒楄〃
+    await getList()
+  } catch {}
+}
+
+/** 鎵归噺鍒犻櫎鎸夐挳鎿嶄綔 */
+const checkedIds = ref<number[]>([])
+const handleRowCheckboxChange = (rows: MailAccountApi.MailAccountVO[]) => {
+  checkedIds.value = rows.map((row) => row.id)
+}
+
+const handleDeleteBatch = async () => {
+  try {
+    // 鍒犻櫎鐨勪簩娆$‘璁�
+    await message.delConfirm()
+    // 鍙戣捣鎵归噺鍒犻櫎
+    await MailAccountApi.deleteMailAccountList(checkedIds.value)
+    checkedIds.value = []
+    message.success(t('common.delSuccess'))
+    // 鍒锋柊鍒楄〃
+    await getList()
+  } catch {}
+}
+
+/** 鍒濆鍖� **/
+onMounted(() => {
+  getList()
+})
+</script>

--
Gitblit v1.8.0