houzhongjian
2024-08-08 820397e43a0b64d35c6d31d2a55475061438593b
提交 | 用户 | 时间
820397 1 <template>
H 2   <ContentWrap>
3     <!-- 搜索工作栏 -->
4     <el-form
5       class="-mb-15px"
6       :model="queryParams"
7       ref="queryFormRef"
8       :inline="true"
9       label-width="68px"
10     >
11       <el-form-item label="用户编号" prop="userId">
12         <el-input
13           v-model="queryParams.userId"
14           placeholder="请输入用户编号"
15           clearable
16           @keyup.enter="handleQuery"
17           class="!w-240px"
18         />
19       </el-form-item>
20       <el-form-item label="用户类型" prop="userType">
21         <el-select
22           v-model="queryParams.userType"
23           placeholder="请选择用户类型"
24           clearable
25           class="!w-240px"
26         >
27           <el-option
28             v-for="dict in getIntDictOptions(DICT_TYPE.USER_TYPE)"
29             :key="dict.value"
30             :label="dict.label"
31             :value="dict.value"
32           />
33         </el-select>
34       </el-form-item>
35       <el-form-item label="模板编码" prop="templateCode">
36         <el-input
37           v-model="queryParams.templateCode"
38           placeholder="请输入模板编码"
39           clearable
40           @keyup.enter="handleQuery"
41           class="!w-240px"
42         />
43       </el-form-item>
44       <el-form-item label="模版类型" prop="templateType">
45         <el-select
46           v-model="queryParams.templateType"
47           placeholder="请选择模版类型"
48           clearable
49           class="!w-240px"
50         >
51           <el-option
52             v-for="dict in getIntDictOptions(DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE)"
53             :key="dict.value"
54             :label="dict.label"
55             :value="dict.value"
56           />
57         </el-select>
58       </el-form-item>
59       <el-form-item label="创建时间" prop="createTime">
60         <el-date-picker
61           v-model="queryParams.createTime"
62           value-format="YYYY-MM-DD HH:mm:ss"
63           type="daterange"
64           start-placeholder="开始日期"
65           end-placeholder="结束日期"
66           :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
67           class="!w-240px"
68         />
69       </el-form-item>
70       <el-form-item>
71         <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
72         <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
73       </el-form-item>
74     </el-form>
75   </ContentWrap>
76
77   <!-- 列表 -->
78   <ContentWrap>
79     <el-table v-loading="loading" :data="list">
80       <el-table-column label="编号" align="center" prop="id" />
81       <el-table-column label="用户类型" align="center" prop="userType">
82         <template #default="scope">
83           <dict-tag :type="DICT_TYPE.USER_TYPE" :value="scope.row.userType" />
84         </template>
85       </el-table-column>
86       <el-table-column label="用户编号" align="center" prop="userId" width="80" />
87       <el-table-column label="模板编码" align="center" prop="templateCode" width="80" />
88       <el-table-column label="发送人名称" align="center" prop="templateNickname" width="180" />
89       <el-table-column
90         label="模版内容"
91         align="center"
92         prop="templateContent"
93         width="200"
94         show-overflow-tooltip
95       />
96       <el-table-column
97         label="模版参数"
98         align="center"
99         prop="templateParams"
100         width="180"
101         show-overflow-tooltip
102       >
103         <template #default="scope"> {{ scope.row.templateParams }}</template>
104       </el-table-column>
105       <el-table-column label="模版类型" align="center" prop="templateType" width="120">
106         <template #default="scope">
107           <dict-tag :type="DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE" :value="scope.row.templateType" />
108         </template>
109       </el-table-column>
110       <el-table-column label="是否已读" align="center" prop="readStatus" width="100">
111         <template #default="scope">
112           <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.readStatus" />
113         </template>
114       </el-table-column>
115       <el-table-column
116         label="阅读时间"
117         align="center"
118         prop="readTime"
119         width="180"
120         :formatter="dateFormatter"
121       />
122       <el-table-column
123         label="创建时间"
124         align="center"
125         prop="createTime"
126         width="180"
127         :formatter="dateFormatter"
128       />
129       <el-table-column label="操作" align="center" fixed="right">
130         <template #default="scope">
131           <el-button
132             link
133             type="primary"
134             @click="openDetail(scope.row)"
135             v-hasPermi="['system:notify-message:query']"
136           >
137             详情
138           </el-button>
139         </template>
140       </el-table-column>
141     </el-table>
142     <!-- 分页 -->
143     <Pagination
144       :total="total"
145       v-model:page="queryParams.pageNo"
146       v-model:limit="queryParams.pageSize"
147       @pagination="getList"
148     />
149   </ContentWrap>
150
151   <!-- 表单弹窗:详情 -->
152   <NotifyMessageDetail ref="detailRef" />
153 </template>
154 <script lang="ts" setup>
155 import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
156 import { dateFormatter } from '@/utils/formatTime'
157 import * as NotifyMessageApi from '@/api/system/notify/message'
158 import NotifyMessageDetail from './NotifyMessageDetail.vue'
159
160 defineOptions({ name: 'SystemNotifyMessage' })
161
162 const loading = ref(true) // 列表的加载中
163 const total = ref(0) // 列表的总页数
164 const list = ref([]) // 列表的数据
165 const queryParams = reactive({
166   pageNo: 1,
167   pageSize: 10,
168   userType: undefined,
169   userId: undefined,
170   templateCode: undefined,
171   templateType: undefined,
172   createTime: []
173 })
174 const queryFormRef = ref() // 搜索的表单
175
176 /** 查询列表 */
177 const getList = async () => {
178   loading.value = true
179   try {
180     const data = await NotifyMessageApi.getNotifyMessagePage(queryParams)
181     list.value = data.list
182     total.value = data.total
183   } finally {
184     loading.value = false
185   }
186 }
187
188 /** 搜索按钮操作 */
189 const handleQuery = () => {
190   queryParams.pageNo = 1
191   getList()
192 }
193
194 /** 重置按钮操作 */
195 const resetQuery = () => {
196   queryFormRef.value.resetFields()
197   handleQuery()
198 }
199
200 /** 详情操作 */
201 const detailRef = ref()
202 const openDetail = (data: NotifyMessageApi.NotifyMessageVO) => {
203   detailRef.value.open(data)
204 }
205
206 /** 初始化 **/
207 onMounted(() => {
208   getList()
209 })
210 </script>