|
|
@@ -1,133 +1,156 @@
|
|
|
<template>
|
|
|
- <div class="list-view">
|
|
|
- <page-title>
|
|
|
- <el-button
|
|
|
- @click="download"
|
|
|
- icon="el-icon-upload2"
|
|
|
- :loading="downloading"
|
|
|
- :disabled="fetchingData"
|
|
|
- class="filter-item"
|
|
|
- >
|
|
|
- 导出
|
|
|
- </el-button>
|
|
|
- </page-title>
|
|
|
- <div class="filters-container">
|
|
|
- <el-input
|
|
|
- placeholder="搜索..."
|
|
|
- v-model="search"
|
|
|
- clearable
|
|
|
- class="filter-item search"
|
|
|
- @keyup.enter.native="getData"
|
|
|
- >
|
|
|
- <el-button @click="getData" slot="append" icon="el-icon-search"> </el-button>
|
|
|
- </el-input>
|
|
|
- </div>
|
|
|
- <el-table
|
|
|
- :data="tableData"
|
|
|
- row-key="id"
|
|
|
- ref="table"
|
|
|
- header-row-class-name="table-header-row"
|
|
|
- header-cell-class-name="table-header-cell"
|
|
|
- row-class-name="table-row"
|
|
|
- cell-class-name="table-cell"
|
|
|
- :height="tableHeight"
|
|
|
- v-loading="fetchingData"
|
|
|
- >
|
|
|
- <el-table-column v-if="multipleMode" align="center" type="selection" width="50"> </el-table-column>
|
|
|
- <el-table-column prop="nickname" align="center" label="用户昵称"> </el-table-column>
|
|
|
- <el-table-column prop="userId" align="center" label="用户id"> </el-table-column>
|
|
|
- <el-table-column prop="avatar" align="center" label="头像">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <el-image
|
|
|
- style="width: 30px; height: 30px"
|
|
|
- :src="row.avatar"
|
|
|
- fit="cover"
|
|
|
- :preview-src-list="[row.avatar]"
|
|
|
- >
|
|
|
- </el-image>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="level" align="center" label="等级"> </el-table-column>
|
|
|
- <el-table-column prop="realm" align="center" label="境界"> </el-table-column>
|
|
|
- <el-table-column prop="title" align="center" label="头衔"> </el-table-column>
|
|
|
- <el-table-column prop="messageInfo" align="center" width="800" label="消息内容"> </el-table-column>
|
|
|
- <el-table-column prop="illegal" align="center" label="是否合法">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <el-tag :type="row.illegal ? '' : 'info'"> {{ row.illegal }} </el-tag>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="time" align="center" width="200" label="消息发送时间"> </el-table-column>
|
|
|
- </el-table>
|
|
|
- <div class="pagination-wrapper">
|
|
|
- <el-pagination
|
|
|
- background
|
|
|
- @size-change="onSizeChange"
|
|
|
- @current-change="onCurrentChange"
|
|
|
- :current-page="page"
|
|
|
- :page-sizes="[10, 20, 30, 40, 50]"
|
|
|
- :page-size="pageSize"
|
|
|
- layout="total, sizes, prev, pager, next, jumper"
|
|
|
- :total="totalElements"
|
|
|
- >
|
|
|
- </el-pagination>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <div class="list-view">
|
|
|
+ <page-title>
|
|
|
+ <el-button
|
|
|
+ @click="download"
|
|
|
+ icon="el-icon-upload2"
|
|
|
+ :loading="downloading"
|
|
|
+ :disabled="fetchingData"
|
|
|
+ class="filter-item"
|
|
|
+ >
|
|
|
+ 导出
|
|
|
+ </el-button>
|
|
|
+ </page-title>
|
|
|
+ <div class="filters-container">
|
|
|
+ <el-input
|
|
|
+ placeholder="搜索..."
|
|
|
+ v-model="search"
|
|
|
+ clearable
|
|
|
+ class="filter-item search"
|
|
|
+ @keyup.enter.native="getData"
|
|
|
+ >
|
|
|
+ <el-button @click="getData" slot="append" icon="el-icon-search"> </el-button>
|
|
|
+ </el-input>
|
|
|
+ </div>
|
|
|
+ <el-table
|
|
|
+ :data="tableData"
|
|
|
+ row-key="id"
|
|
|
+ ref="table"
|
|
|
+ header-row-class-name="table-header-row"
|
|
|
+ header-cell-class-name="table-header-cell"
|
|
|
+ row-class-name="table-row"
|
|
|
+ cell-class-name="table-cell"
|
|
|
+ :height="tableHeight"
|
|
|
+ v-loading="fetchingData"
|
|
|
+ >
|
|
|
+ <el-table-column v-if="multipleMode" align="center" type="selection" width="50"> </el-table-column>
|
|
|
+ <el-table-column prop="userId" align="center" label="发送方用户id"> </el-table-column>
|
|
|
+ <el-table-column prop="nickname" align="center" label="发送方昵称"> </el-table-column>
|
|
|
+ <el-table-column prop="avatar" align="center" label="发送方头像">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-image
|
|
|
+ style="width: 30px; height: 30px"
|
|
|
+ :src="row.avatar"
|
|
|
+ fit="cover"
|
|
|
+ :preview-src-list="[row.avatar]"
|
|
|
+ >
|
|
|
+ </el-image>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="time" align="center" width="200" label="消息发送时间"> </el-table-column>
|
|
|
+ <el-table-column prop="chatType" align="center" label="类型" :formatter="typeFormatter"> </el-table-column>
|
|
|
+ <el-table-column prop="messageInfo" align="center" width="800" label="消息内容"> </el-table-column>
|
|
|
+ <el-table-column prop="toUserId" align="center" label="接收方用户id"> </el-table-column>
|
|
|
+ <el-table-column prop="toUserNickname" align="center" label="接收方昵称"> </el-table-column>
|
|
|
+ <el-table-column prop="toUserAvatar" align="center" label="接收方头像">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-image
|
|
|
+ style="width: 30px; height: 30px"
|
|
|
+ :src="row.avatar"
|
|
|
+ fit="cover"
|
|
|
+ :preview-src-list="[row.avatar]"
|
|
|
+ >
|
|
|
+ </el-image>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="illegal" align="center" label="是否合法">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-tag :type="row.illegal ? '' : 'info'"> {{ row.illegal }} </el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div class="pagination-wrapper">
|
|
|
+ <el-pagination
|
|
|
+ background
|
|
|
+ @size-change="onSizeChange"
|
|
|
+ @current-change="onCurrentChange"
|
|
|
+ :current-page="page"
|
|
|
+ :page-sizes="[10, 20, 30, 40, 50]"
|
|
|
+ :page-size="pageSize"
|
|
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
+ :total="totalElements"
|
|
|
+ >
|
|
|
+ </el-pagination>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import { mapState } from 'vuex';
|
|
|
import pageableTable from '@/mixins/pageableTable';
|
|
|
|
|
|
export default {
|
|
|
- name: 'PublicScreenChatList',
|
|
|
- mixins: [pageableTable],
|
|
|
- data() {
|
|
|
- return {
|
|
|
- multipleMode: false,
|
|
|
- search: '',
|
|
|
- url: '/publicScreenChat/all',
|
|
|
- downloading: false
|
|
|
- };
|
|
|
- },
|
|
|
- computed: {
|
|
|
- selection() {
|
|
|
- return this.$refs.table.selection.map(i => i.id);
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- beforeGetData() {
|
|
|
- return { search: this.search, query: { del: false, type: 1 } };
|
|
|
- },
|
|
|
- toggleMultipleMode(multipleMode) {
|
|
|
- this.multipleMode = multipleMode;
|
|
|
- if (!multipleMode) {
|
|
|
- this.$refs.table.clearSelection();
|
|
|
- }
|
|
|
- },
|
|
|
- download() {
|
|
|
- this.downloading = true;
|
|
|
- this.$axios
|
|
|
- .get('/publicScreenChat/excel', {
|
|
|
- responseType: 'blob',
|
|
|
- params: { size: 10000 ,query: { del: false }},
|
|
|
- })
|
|
|
- .then(res => {
|
|
|
- console.log(res);
|
|
|
- this.downloading = false;
|
|
|
- const downloadUrl = window.URL.createObjectURL(new Blob([res.data]));
|
|
|
- const link = document.createElement('a');
|
|
|
- link.href = downloadUrl;
|
|
|
- link.setAttribute('download', res.headers['content-disposition'].split('filename=')[1]);
|
|
|
- document.body.appendChild(link);
|
|
|
- link.click();
|
|
|
- link.remove();
|
|
|
- })
|
|
|
- .catch(e => {
|
|
|
- console.log(e);
|
|
|
- this.downloading = false;
|
|
|
- this.$message.error(e.error);
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
+ name: 'PublicScreenChatList',
|
|
|
+ mixins: [pageableTable],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ typeOptions: [
|
|
|
+ { label: '默认', value: 'DEFAULT' },
|
|
|
+ { label: '公频聊天', value: 'PUBLIC' },
|
|
|
+ { label: '私聊', value: 'PRIVATE' }
|
|
|
+ ],
|
|
|
+ multipleMode: false,
|
|
|
+ search: '',
|
|
|
+ url: '/publicScreenChat/all',
|
|
|
+ downloading: false
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ selection() {
|
|
|
+ return this.$refs.table.selection.map(i => i.id);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ typeFormatter(row, column, cellValue, index) {
|
|
|
+ let selectedOption = this.typeOptions.find(i => i.value === cellValue);
|
|
|
+ if (selectedOption) {
|
|
|
+ return selectedOption.label;
|
|
|
+ }
|
|
|
+ return '';
|
|
|
+ },
|
|
|
+ beforeGetData() {
|
|
|
+ return { search: this.search, query: { del: false, type: 1 } };
|
|
|
+ },
|
|
|
+ toggleMultipleMode(multipleMode) {
|
|
|
+ this.multipleMode = multipleMode;
|
|
|
+ if (!multipleMode) {
|
|
|
+ this.$refs.table.clearSelection();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ download() {
|
|
|
+ this.downloading = true;
|
|
|
+ this.$axios
|
|
|
+ .get('/publicScreenChat/excel', {
|
|
|
+ responseType: 'blob',
|
|
|
+ params: { size: 10000, query: { del: false } }
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ console.log(res);
|
|
|
+ this.downloading = false;
|
|
|
+ const downloadUrl = window.URL.createObjectURL(new Blob([res.data]));
|
|
|
+ const link = document.createElement('a');
|
|
|
+ link.href = downloadUrl;
|
|
|
+ link.setAttribute('download', res.headers['content-disposition'].split('filename=')[1]);
|
|
|
+ document.body.appendChild(link);
|
|
|
+ link.click();
|
|
|
+ link.remove();
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ console.log(e);
|
|
|
+ this.downloading = false;
|
|
|
+ this.$message.error(e.error);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
};
|
|
|
</script>
|
|
|
<style lang="less" scoped>
|