| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- <template>
- <div class="ele-body">
- <el-card shadow="never">
- <div class="filter-container">
- <el-form
- label-width="100px"
- class="ele-form-search"
- @keyup.enter.native="reload"
- @submit.native.prevent
- >
- <el-row :gutter="15">
- <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
- <el-form-item label="状态:" prop="readStatus">
- <el-select
- style="width: 100%"
- v-model="params.readStatus"
- placeholder="请选择状态"
- clearable
- >
- <el-option :value="1" label="已读"></el-option>
- <el-option :value="0" label="未读"></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col
- v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
- <el-form-item label="发送时间:" prop="createTime">
- <el-date-picker
- v-model="params.createTime"
- style="width: 100%"
- value-format="yyyy-MM-dd HH:mm:ss"
- type="daterange"
- range-separator="-"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- :default-time="['00:00:00', '23:59:59']"
- />
- </el-form-item>
- </el-col>
- <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
- <div class="ele-form-actions">
- <el-button
- type="primary"
- icon="el-icon-search"
- class="ele-btn-icon"
- @click="reload('search')"
- >
- 查询
- </el-button>
- <el-button @click="reload('reset')">重置</el-button>
- </div>
- </el-col>
- </el-row>
- </el-form>
- </div>
- <ele-pro-table ref="table" :columns="columns" :datasource="datasource">
- <!-- 操作列 -->
- <template v-slot:action="{ row }">
- <el-link
- type="primary"
- :underline="false"
- icon="el-icon-view"
- v-if="!row.readStatus"
- @click="handleAddOrEdit(row)"
- >
- 已读
- </el-link>
- </template>
- <template v-slot:readStatus="{row}">
- <el-tag v-if="row.readStatus" type="success">{{ '已读' }}</el-tag>
- <el-tag v-else type="danger">{{ '未读' }}</el-tag>
- </template>
- </ele-pro-table>
- </el-card>
- </div>
- </template>
- <script>
- import {notifyMessagePageAPI, updateNotifyMessageReadByIdAPI} from "@/api/bpm/task";
- import {mapGetters} from "vuex";
- export default {
- data() {
- return {
- addOrEditDialogFlag: false,
- params: {
- createTime: null,
- readStatus: null,
- },
- columns: [
- {
- columnKey: 'index',
- label: '序号',
- type: 'index',
- width: 55,
- align: 'center',
- showOverflowTooltip: true,
- fixed: 'left'
- },
- {
- prop: 'templateContent',
- label: '消息',
- minWidth: '250',
- },
- {
- prop: 'readStatus',
- label: '状态',
- width: '80',
- align: "center",
- slot:'readStatus',
- },
- {
- prop: 'readTime',
- label: '阅读时间',
- width: '180',
- align: "center",
- showOverflowTooltip: true,
- },
- {
- prop: 'templateNickname',
- label: '发送人',
- width: '80',
- align: "center",
- },
- {
- prop: 'createTime',
- label: '发送时间',
- width: '180',
- align: "center",
- showOverflowTooltip: true,
- },
- {
- columnKey: 'action',
- label: '操作',
- width: 100,
- align: 'center',
- slot: 'action',
- fixed: 'right'
- }
- ],
- searchForm: {},
- tableData: [],
- size: 10,
- page: 1,
- total: 0
- };
- },
- computed: {
- ...mapGetters(['user']),
- // 是否开启响应式布局
- styleResponsive() {
- return this.$store.state.theme.styleResponsive;
- }
- },
- methods: {
- //新增或修改模板
- async handleAddOrEdit(row) {
- await updateNotifyMessageReadByIdAPI([row.id]);
- this.$refs.table.reload()
- },
- reload(type) {
- if (type == 'reset') {
- this.params = {
- createTime: null,
- readStatus: null,
- }
- }
- this.$refs.table.reload({pageNum: 1, where: this.params});
- },
- datasource({page, where, limit, ...row}) {
- return notifyMessagePageAPI({
- ...where,
- pageNum: page,
- size: limit,
- userId: this.user.info.userId
- });
- },
- }
- };
- </script>
- <style lang="scss" scoped>
- .app-container {
- background: #f0f3f3;
- min-height: calc(100vh - 84px);
- }
- .zw-page-table {
- background: #ffffff;
- padding-top: 20px;
- }
- .pagination-wrap {
- display: flex;
- justify-content: flex-end;
- padding: 10px 0;
- }
- .table {
- width: 100%;
- margin-top: 10px;
- }
- </style>
|