refactor:完成工作台的message

This commit is contained in:
PZ688 2025-02-28 17:51:29 +08:00
parent d66205f8a2
commit 8fe5c89fdd

View File

@ -4,17 +4,21 @@
<el-form :model="state.queryParams" ref="queryForm" :show-message="false" :inlineMessage="true" label-width="auto" style="flex: 1 1 0%">
<el-row :gutter="10">
<el-col class="mb5" :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
<el-form-item label="标题" prop="title">
<el-input v-model="state.queryParams.title" placeholder="标题" clearable @keyup.enter.native="handleQuery(true)" />
<el-form-item :label="$t('message.list.title')" prop="title">
<el-input v-model="state.queryParams.title" :placeholder="$t('message.list.title')" clearable @keyup.enter="handleQuery(true)" />
</el-form-item>
</el-col>
<el-col class="mb5" :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
<el-form-item label="类型" prop="type">
<el-select v-model="state.queryParams.type" placeholder="类型" clearable @clear="state.queryParams.type = undefined">
<el-option label="通知" :value="1" />
<el-option label="公告" :value="2" />
<el-form-item :label="$t('message.list.type')" prop="type">
<el-select v-model="state.queryParams.type" :placeholder="$t('message.list.type')" clearable @clear="state.queryParams.type = undefined">
<el-option :label="$t('message.list.notice')" :value="1" />
<el-option :label="$t('message.list.announcement')" :value="2" />
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
@ -24,11 +28,12 @@
<el-row>
<el-col>
<el-button-group>
<el-button type="primary" icon="ele-Search" @click="handleQuery(true)" :loading="options.loading"> 查询 </el-button>
<el-button icon="ele-Refresh" @click="resetQuery" :loading="options.loading"> 重置 </el-button>
<el-button type="primary" icon="ele-Search" @click="handleQuery(true)" :loading="options.loading"> {{$t('message.list.query')}} </el-button>
<el-button icon="ele-Refresh" @click="resetQuery" :loading="options.loading"> {{$t('message.list.reset')}} </el-button>
</el-button-group>
</el-col>
</el-row>
</el-card>
<el-card class="full-table" shadow="hover" style="margin-top: 5px">
@ -39,18 +44,19 @@
<el-empty :image-size="200" />
</template>
<template #row_type="{ row }">
<el-tag v-if="row.sysNotice.type === 1" type="success">通知</el-tag>
<el-tag v-else type="warning">公告</el-tag>
<el-tag v-if="row.sysNotice.type === 1" type="success">{{ $t('message.list.notice') }}</el-tag>
<el-tag v-else type="warning">{{ $t('message.list.announcement') }}</el-tag>
</template>
<template #row_readStatus="{ row }">
<el-tag v-if="row.readStatus === 1" type="info">已读</el-tag>
<el-tag v-else type="danger">未读</el-tag>
<el-tag v-if="row.readStatus === 1" type="info">{{ $t('message.list.read') }}</el-tag>
<el-tag v-else type="danger">{{ $t('message.list.unread') }}</el-tag>
</template>
<template #row_buttons="{ row }">
<el-tooltip content="详情" placement="top">
<el-tooltip :content="$t('message.list.detail')" placement="top">
<el-button icon="ele-InfoFilled" text type="primary" @click="handleView(row)"> </el-button>
</el-tooltip>
</template>
</vxe-grid>
</el-card>
@ -58,7 +64,7 @@
<template #header>
<div style="color: #fff">
<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Bell /> </el-icon>
<span> 消息详情 </span>
<span> {{ $t('message.list.messageDetail') }} </span>
</div>
</template>
<div class="w-e-text-container">
@ -66,7 +72,7 @@
</div>
<template #footer>
<span class="dialog-footer">
<el-button type="primary" @click="state.isShowDialog = false">确认</el-button>
<el-button type="primary" @click="state.isShowDialog = false">{{ $t('message.list.confirm') }}</el-button>
</span>
</template>
</el-dialog>
@ -84,6 +90,9 @@ import { Local } from '/@/utils/storage';
import { getAPI } from '/@/utils/axios-utils';
import { SysNoticeApi } from '/@/api-services/api';
import { SysNoticeUser, PageNoticeInput } from '/@/api-services/models';
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
const xGrid = ref<VxeGridInstance>();
const { removeHtml } = commonFunction();
@ -107,18 +116,24 @@ const localPageParamKey = 'localPageParam:sysNoticeUser';
const options = useVxeTable<SysNoticeUser>(
{
id: 'sysNoticeUser',
name: '消息/站内信',
name: t('message.list.messageInbox'),
columns: [
// { type: 'checkbox', width: 40, fixed: 'left' },
{ field: 'seq', type: 'seq', title: '序号', width: 60, fixed: 'left' },
{ field: 'sysNotice.title', title: '标题', minWidth: 200, showOverflow: 'tooltip' },
{ field: 'sysNotice.content', title: '内容', minWidth: 180, showOverflow: 'tooltip', slots: { default: (scope: any) => removeHtml(scope.row.sysNotice.content) } },
{ field: 'sysNotice.type', title: '类型', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_type' } },
{ field: 'sysNotice.createTime', title: '创建时间', minWidth: 150, showOverflow: 'tooltip' },
{ field: 'readStatus', title: '阅读状态', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_readStatus' } },
{ field: 'sysNotice.publicUserName', title: '发布者', minWidth: 120, showOverflow: 'tooltip' },
{ field: 'sysNotice.publicTime', title: '发布时间', minWidth: 150, showOverflow: 'tooltip' },
{ field: 'buttons', title: '操作', fixed: 'right', width: 100, showOverflow: true, slots: { default: 'row_buttons' } },
{ field: 'seq', type: 'seq', title: t('message.list.seq'), width: 60, fixed: 'left' },
{ field: 'sysNotice.title', title: t('message.list.title'), minWidth: 200, showOverflow: 'tooltip' },
{ field: 'sysNotice.content', title: t('message.list.content'), minWidth: 180, showOverflow: 'tooltip', slots: { default: (scope: any) => removeHtml(scope.row.sysNotice.content) } },
{ field: 'sysNotice.type', title: t('message.list.type'), minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_type' } },
{ field: 'sysNotice.createTime', title: t('message.list.createTime'), minWidth: 150, showOverflow: 'tooltip' },
{ field: 'readStatus', title: t('message.list.readStatus'), minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_readStatus' } },
{ field: 'sysNotice.publicUserName', title: t('message.list.publisher'), minWidth: 120, showOverflow: 'tooltip' },
{ field: 'sysNotice.publicTime', title: t('message.list.publishTime'), minWidth: 150, showOverflow: 'tooltip' },
{ field: 'buttons', title: t('message.list.operation'), fixed: 'right', width: 100, showOverflow: true, slots: { default: 'row_buttons' } },
],
},
// vxeGrid()vxe-table