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/notify/my/index.vue | 218 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 218 insertions(+), 0 deletions(-)
diff --git a/src/views/system/notify/my/index.vue b/src/views/system/notify/my/index.vue
new file mode 100644
index 0000000..ae4b9c5
--- /dev/null
+++ b/src/views/system/notify/my/index.vue
@@ -0,0 +1,218 @@
+<template>
+ <doc-alert title="绔欏唴淇¢厤缃�" url="https://doc.iocoder.cn/notify/" />
+
+ <ContentWrap>
+ <!-- 鎼滅储宸ヤ綔鏍� -->
+ <el-form
+ class="-mb-15px"
+ :model="queryParams"
+ ref="queryFormRef"
+ :inline="true"
+ label-width="68px"
+ >
+ <el-form-item label="鏄惁宸茶" prop="readStatus">
+ <el-select
+ v-model="queryParams.readStatus"
+ placeholder="璇烽�夋嫨鐘舵��"
+ clearable
+ class="!w-240px"
+ >
+ <el-option
+ v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
+ :key="dict.value"
+ :label="dict.label"
+ :value="dict.value"
+ />
+ </el-select>
+ </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 @click="handleUpdateList">
+ <Icon icon="ep:reading" class="mr-5px" /> 鏍囪宸茶
+ </el-button>
+ <el-button @click="handleUpdateAll">
+ <Icon icon="ep:reading" class="mr-5px" /> 鍏ㄩ儴宸茶
+ </el-button>
+ </el-form-item>
+ </el-form>
+ </ContentWrap>
+
+ <!-- 鍒楄〃 -->
+ <ContentWrap>
+ <el-table
+ v-loading="loading"
+ :data="list"
+ ref="tableRef"
+ row-key="id"
+ @selection-change="handleSelectionChange"
+ >
+ <el-table-column type="selection" :selectable="selectable" :reserve-selection="true" />
+ <el-table-column label="鍙戦�佷汉" align="center" prop="templateNickname" width="180" />
+ <el-table-column
+ label="鍙戦�佹椂闂�"
+ align="center"
+ prop="createTime"
+ width="200"
+ :formatter="dateFormatter"
+ />
+ <el-table-column label="绫诲瀷" align="center" prop="templateType" width="180">
+ <template #default="scope">
+ <dict-tag :type="DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE" :value="scope.row.templateType" />
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="娑堟伅鍐呭"
+ align="center"
+ prop="templateContent"
+ show-overflow-tooltip
+ />
+ <el-table-column label="鏄惁宸茶" align="center" prop="readStatus" width="160">
+ <template #default="scope">
+ <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.readStatus" />
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="闃呰鏃堕棿"
+ align="center"
+ prop="readTime"
+ width="200"
+ :formatter="dateFormatter"
+ />
+ <el-table-column label="鎿嶄綔" align="center" width="160">
+ <template #default="scope">
+ <el-button
+ link
+ :type="scope.row.readStatus ? 'primary' : 'warning'"
+ @click="openDetail(scope.row)"
+ >
+ {{ scope.row.readStatus ? '璇︽儏' : '宸茶' }}
+ </el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ <!-- 鍒嗛〉 -->
+ <Pagination
+ :total="total"
+ v-model:page="queryParams.pageNo"
+ v-model:limit="queryParams.pageSize"
+ @pagination="getList"
+ />
+ </ContentWrap>
+
+ <!-- 琛ㄥ崟寮圭獥锛氳鎯� -->
+ <MyNotifyMessageDetail ref="detailRef" />
+</template>
+
+<script lang="ts" setup>
+import { DICT_TYPE, getBoolDictOptions } from '@/utils/dict'
+import { dateFormatter } from '@/utils/formatTime'
+import * as NotifyMessageApi from '@/api/system/notify/message'
+import MyNotifyMessageDetail from './MyNotifyMessageDetail.vue'
+
+defineOptions({ name: 'SystemMyNotify' })
+
+const message = useMessage() // 娑堟伅
+
+const loading = ref(true) // 鍒楄〃鐨勫姞杞戒腑
+const total = ref(0) // 鍒楄〃鐨勬�婚〉鏁�
+const list = ref([]) // 鍒楄〃鐨勬暟鎹�
+const queryParams = reactive({
+ pageNo: 1,
+ pageSize: 10,
+ readStatus: undefined,
+ createTime: []
+})
+const queryFormRef = ref() // 鎼滅储鐨勮〃鍗�
+const tableRef = ref() // 琛ㄦ牸鐨� Ref
+const selectedIds = ref<number[]>([]) // 琛ㄦ牸鐨勯�変腑 ID 鏁扮粍
+
+/** 鏌ヨ鍒楄〃 */
+const getList = async () => {
+ loading.value = true
+ try {
+ const data = await NotifyMessageApi.getMyNotifyMessagePage(queryParams)
+ list.value = data.list
+ total.value = data.total
+ } finally {
+ loading.value = false
+ }
+}
+
+/** 鎼滅储鎸夐挳鎿嶄綔 */
+const handleQuery = () => {
+ queryParams.pageNo = 1
+ getList()
+}
+
+/** 閲嶇疆鎸夐挳鎿嶄綔 */
+const resetQuery = () => {
+ queryFormRef.value.resetFields()
+ tableRef.value.clearSelection()
+ handleQuery()
+}
+
+/** 璇︽儏鎿嶄綔 */
+const detailRef = ref()
+const openDetail = (data: NotifyMessageApi.NotifyMessageVO) => {
+ if (!data.readStatus) {
+ handleReadOne(data.id)
+ }
+ detailRef.value.open(data)
+}
+
+/** 鏍囪涓�鏉$珯鍐呬俊宸茶 */
+const handleReadOne = async (id) => {
+ await NotifyMessageApi.updateNotifyMessageRead(id)
+ await getList()
+}
+
+/** 鏍囪鍏ㄩ儴绔欏唴淇″凡璇� **/
+const handleUpdateAll = async () => {
+ await NotifyMessageApi.updateAllNotifyMessageRead()
+ message.success('鍏ㄩ儴宸茶鎴愬姛锛�')
+ tableRef.value.clearSelection()
+ await getList()
+}
+
+/** 鏍囪涓�浜涚珯鍐呬俊宸茶 **/
+const handleUpdateList = async () => {
+ if (selectedIds.value.length === 0) {
+ return
+ }
+ await NotifyMessageApi.updateNotifyMessageRead(selectedIds.value)
+ message.success('鎵归噺宸茶鎴愬姛锛�')
+ tableRef.value.clearSelection()
+ await getList()
+}
+
+/** 鏌愪竴琛岋紝鏄惁鍏佽閫変腑 */
+const selectable = (row) => {
+ return !row.readStatus
+}
+
+/** 褰撹〃鏍奸�夋嫨椤瑰彂鐢熷彉鍖栨椂浼氳Е鍙戣浜嬩欢 */
+const handleSelectionChange = (array: NotifyMessageApi.NotifyMessageVO[]) => {
+ selectedIds.value = []
+ if (!array) {
+ return
+ }
+ array.forEach((row) => selectedIds.value.push(row.id))
+}
+
+/** 鍒濆鍖� **/
+onMounted(() => {
+ getList()
+})
+</script>
--
Gitblit v1.8.0