123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <template>
- <div id="list">
- <el-row>
- <el-col :span="24" class="main">
- <data-table :data="messageList" :fields="fields" :opera="opera" :usePage="false" @views="toView">
- <template #custom="{item,row}">
- <template v-if="item.prop == 'name'">
- {{ toFormat(row) }}
- </template>
- </template>
- </data-table>
- </el-col>
- </el-row>
- </div>
- </template>
- <script>
- import dataTable from '@common/src/components/frame/filter-page-table.vue';
- import { mapState, createNamespacedHelpers } from 'vuex';
- export default {
- name: 'list',
- props: {
- messageList: { type: Array },
- },
- components: {
- dataTable,
- },
- data: function() {
- return {
- opera: [
- {
- label: '查看',
- method: 'views',
- },
- ],
- fields: [
- {
- label: '发言人',
- prop: 'name',
- custom: true,
- },
- {
- label: '产品/专家',
- prop: 'product.name',
- },
- {
- label: '是否有未读消息',
- prop: 'is_read',
- format: item => {
- return item === false ? '有' : '未有';
- },
- },
- ],
- };
- },
- created() {},
- methods: {
- // 查看消息
- toView({ data }) {
- this.$emit('toView', data);
- },
- toFormat(data) {
- if (this.user.id) {
- if (data.p1_id == this.user.id) {
- return data.p2;
- } else {
- return data.p1;
- }
- }
- },
- },
- computed: {
- ...mapState(['user']),
- },
- watch: {},
- };
- </script>
- <style lang="less" scoped>
- .main {
- height: 465px;
- overflow-y: auto;
- }
- </style>
|