Blame view

src/components/owner/ownerComplaints.vue 3.33 KB
af1bcbd6   wuxw   房屋页面开发中
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
  <template>
    <el-dialog
      :visible.sync="dialogVisible"
      :title="$t('ownerComplaints.title')"
      width="80%"
      top="5vh"
      @close="handleClose"
    >
      <el-row>
        <el-col :span="24">
          <div class="table-container">
            <el-table :data="ownerComplaintsInfo.complaints" border stripe>
              <el-table-column prop="typeCdName" :label="$t('ownerComplaints.type')" align="center" />
              <el-table-column :label="$t('ownerComplaints.room')" align="center">
                <template #default="{ row }">
                  {{ row.floorNum }}-{{ row.unitNum }}-{{ row.roomNum }}
                </template>
              </el-table-column>
              <el-table-column prop="complaintName" :label="$t('ownerComplaints.contact')" align="center" />
              <el-table-column prop="tel" :label="$t('ownerComplaints.phone')" align="center" />
              <el-table-column prop="stateName" :label="$t('ownerComplaints.status')" align="center" />
              <el-table-column :label="$t('ownerComplaints.handler')" align="center">
                <template #default="{ row }">
                  {{ row.currentUserName || $t('ownerComplaints.none') }}
                </template>
              </el-table-column>
              <el-table-column :label="$t('ownerComplaints.handlerPhone')" align="center">
                <template #default="{ row }">
                  {{ row.currentUserTel || $t('ownerComplaints.none') }}
                </template>
              </el-table-column>
              <el-table-column prop="createTime" :label="$t('ownerComplaints.createTime')" align="center" />
            </el-table>
          </div>
          <el-pagination
            background
            layout="prev, pager, next, sizes, total"
            :total="totalCount"
            :page-size="pageSize"
            :current-page="currentPage"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
          />
        </el-col>
      </el-row>
    </el-dialog>
  </template>
  
  <script>
  import { listComplaints } from '@/api/room/ownerComplaintsApi'
  
  export default {
    name: 'OwnerComplaints',
    data() {
      return {
        dialogVisible: false,
        ownerComplaintsInfo: {
          complaints: [],
          ownerId: ''
        },
        totalCount: 0,
        pageSize: 10,
        currentPage: 1
      }
    },
    methods: {
      open(ownerId) {
        this.ownerComplaintsInfo.ownerId = ownerId
        this.dialogVisible = true
        this._loadOwnerComplaintInfo(1, this.pageSize)
      },
      handleClose() {
        this.dialogVisible = false
      },
      handleSizeChange(size) {
        this.pageSize = size
        this._loadOwnerComplaintInfo(this.currentPage, size)
      },
      handleCurrentChange(page) {
        this.currentPage = page
        this._loadOwnerComplaintInfo(page, this.pageSize)
      },
      async _loadOwnerComplaintInfo(page, size) {
        try {
          const params = {
            page: page,
            row: size,
            communityId: this.$store.getters.communityId,
            ownerId: this.ownerComplaintsInfo.ownerId
          }
          
          const response = await listComplaints(params)
          this.ownerComplaintsInfo.complaints = response.data
          this.totalCount = response.total
          this.currentPage = page
        } catch (error) {
          console.error('加载业主投诉信息失败:', error)
        }
      }
    }
  }
  </script>
  
  <style scoped>
  .table-container {
    margin-top: 15px;
  }
  </style>