123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <template>
- <div class="hui-flex hui-content">
- <div class="hui-flex-box hui-flex hui-table">
- <div class="hui-flex-box">
- <el-table :data="tableData" row-key="id" border height="100%">
- <el-table-column label="序号" width="50">
- <template slot-scope="scope">
- {{scope.$index + 1}}
- </template>
- </el-table-column>
- <el-table-column label="消息内容">
- <template slot-scope="scope">
- <div class="hui-ellipsis" :style="(scope.row.viewed?'color:#999;':'')+'text-align:left;'">
- {{scope.row.message}}
- </div>
- </template>
- </el-table-column>
- <el-table-column label="时间" prop="sentTime" width="180"></el-table-column>
- <el-table-column label="消息类型" prop="messageType" width="150">
- <template slot-scope="scope">
- <span>{{messageType(scope.row.messageType).name}}</span>
- </template>
- </el-table-column>
- <el-table-column width="150" label="操作">
- <template slot-scope="scope">
- <div class="hui-table-operation">
- <el-link type="primary" @click="detail(scope.row)">详情</el-link>
- </div>
- </template>
- </el-table-column>
- <template slot="empty">
- <empty description="暂无数据"></empty>
- </template>
- </el-table>
- </div>
- <div class="hui-content-pagination">
- <el-pagination :page-size="pageSize" :pager-count="9" layout="prev, pager, next" :total="totalCount"
- @current-change="currentChange">
- </el-pagination>
- </div>
- </div>
- <el-drawer title="消息详情" :visible.sync="drawer" :size="400" :append-to-body="true">
- <detail v-if="drawer" :type="item.messageType" :detail="item" @close="drawer = false">
- </detail>
- </el-drawer>
- </div>
- </template>
- <script>
- import {
- getMessagePageListByQuery
- } from '@/httpApi/message'
- import detail from '@/components/message/detail'
- export default {
- props: ['option'],
- data() {
- return {
- tableData: [],
- pageIndex: 1,
- pageSize: 10,
- totalCount: 0,
- item: {},
- drawer: false
- }
- },
- created() {
- this.init();
- },
- methods: {
- init() {
- let data = {
- projectId: this.$store.getters.project.id,
- organizationId: this.$store.getters.organization.id,
- userId: this.$store.getters.user.userId
- }
- if (this.option) data = Object.assign(data, this.option);
- getMessagePageListByQuery(this.pageIndex, this.pageSize, data).then(res => {
- if (res.state) {
- this.tableData = res.data.dataList.map(node => {
- return Object.assign(node, JSON.parse(node.json));
- });
- this.totalCount = res.data.totalCount;
- }
- })
- },
- detail(item) {
- if (!item.viewed) this.$msg.viewed(item.id, this.init);
- this.item = item;
- this.drawer = true;
- },
- messageType(type) {
- return this.$msg.messageType.filter(item => item.id === type)[0];
- },
- currentChange(pageIndex) {
- this.pageIndex = pageIndex;
- this.init();
- }
- },
- components: {
- detail
- },
- }
- </script>
- <style lang="scss">
- </style>
|