Blame view

src/components/owner/ownerDetailComplaint.vue 4.58 KB
c85e0853   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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
  <template>
    <div class="margin-top">
      <el-table :data="ownerDetailComplaintInfo.complaints" style="width: 100%">
        <el-table-column prop="typeCdName" :label="$t('complaint.table.type')" align="center"></el-table-column>
        <el-table-column :label="$t('complaint.table.room')" align="center">
          <template slot-scope="scope">
            {{scope.row.floorNum}}-{{scope.row.unitNum}}-{{scope.row.roomNum}}
          </template>
        </el-table-column>
        <el-table-column prop="complaintName" :label="$t('complaint.table.contact')" align="center"></el-table-column>
        <el-table-column prop="tel" :label="$t('complaint.table.phone')" align="center"></el-table-column>
        <el-table-column prop="stateName" :label="$t('complaint.table.status')" align="center"></el-table-column>
        <el-table-column prop="currentUserName" :label="$t('complaint.table.handler')" align="center">
          <template slot-scope="scope">
            {{scope.row.currentUserName == '' ? $t('common.none'):scope.row.currentUserName}}
          </template>
        </el-table-column>
        <el-table-column prop="currentUserTel" :label="$t('complaint.table.handlerPhone')" align="center">
          <template slot-scope="scope">
            {{scope.row.currentUserTel == '' ? $t('common.none'):scope.row.currentUserTel}}
          </template>
        </el-table-column>
        <el-table-column prop="createTime" :label="$t('complaint.table.createTime')" align="center"></el-table-column>
        <el-table-column :label="$t('common.operation')" align="center" width="200">
          <template slot-scope="scope">
            <el-button-group>
              <el-button size="mini" @click="_openComplaintDetailModel(scope.row)">
                {{ $t('common.detail') }}
              </el-button>
              <el-button size="mini" @click="_openRunWorkflowImage(scope.row)">
                {{ $t('ownerDetailComplaint.flowChart') }}
              </el-button>
            </el-button-group>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        @current-change="handleCurrentChange"
        :current-page="pagination.currentPage"
        :page-size="pagination.pageSize"
        :total="pagination.total"
        layout="total, prev, pager, next, jumper">
      </el-pagination>
  
      <complaint-detail ref="complaintDetail"></complaint-detail>
      <view-image ref="viewImage"></view-image>
    </div>
  </template>
  
  <script>
  import ComplaintDetail from '@/components/oa/complaintDetail'
  import ViewImage from '@/components/system/viewImage'
  import { listComplaints, listRunWorkflowImage } from '@/api/owner/ownerDetailComplaintApi'
  import { getCommunityId } from '@/api/community/communityApi'
  
  export default {
    name: 'OwnerDetailComplaint',
    components: {
      ComplaintDetail,
      ViewImage
    },
    data() {
      return {
        ownerDetailComplaintInfo: {
          complaints: [],
          ownerId: '',
          ownerName: '',
          link: ''
        },
        pagination: {
          currentPage: 1,
          pageSize: 10,
          total: 0
        }
      }
    },
    methods: {
      open(ownerId, ownerName, link) {
        this.ownerDetailComplaintInfo.ownerId = ownerId
        this.ownerDetailComplaintInfo.ownerName = ownerName
        this.ownerDetailComplaintInfo.link = link
        this._loadOwnerDetailComplaintData(1, this.pagination.pageSize)
      },
      _loadOwnerDetailComplaintData(page, row) {
        const params = {
          communityId: getCommunityId(),
          memberId: this.ownerDetailComplaintInfo.ownerId,
          page: page,
          row: row
        }
  
        listComplaints(params).then(response => {
          this.ownerDetailComplaintInfo.complaints = response.complaints
          this.pagination.total = response.records
        }).catch(error => {
          console.error('请求失败处理', error)
        })
      },
      _openComplaintDetailModel(complaint) {
        this.$refs.complaintDetail.open(complaint)
      },
      _openRunWorkflowImage(complaint) {
        const params = {
          communityId: getCommunityId(),
          businessKey: complaint.complaintId
        }
  
        listRunWorkflowImage(params).then(response => {
          if (response.code != '0') {
            this.$message.error(response.msg)
            return
          }
          this.$refs.viewImage.open('data:image/png;base64,' + response.data)
        }).catch(error => {
          console.error('请求失败处理', error)
        })
      },
      handleCurrentChange(val) {
        this._loadOwnerDetailComplaintData(val, this.pagination.pageSize)
      }
    },
    created() {
      this.$on('switch', (data) => {
        this.ownerDetailComplaintInfo.ownerId = data.ownerId
        this._loadOwnerDetailComplaintData(1, this.pagination.pageSize)
      })
    }
  }
  </script>