Blame view

src/components/owner/ownerDetailAppUser.vue 4.85 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
  <template>
    <div class="margin-top">
      <el-table :data="ownerDetailAppUserInfo.appUsers" style="width: 100%">
        <el-table-column prop="communityName" :label="$t('ownerDetailAppUser.communityName')" align="center"></el-table-column>
        <el-table-column prop="appUserName" :label="$t('ownerDetailAppUser.relatedOwner')" align="center"></el-table-column>
        <el-table-column prop="idCard" :label="$t('ownerDetailAppUser.idCard')" align="center"></el-table-column>
        <el-table-column prop="link" :label="$t('ownerDetailAppUser.phone')" align="center"></el-table-column>
        <el-table-column prop="stateName" :label="$t('ownerDetailAppUser.status')" align="center"></el-table-column>
        <el-table-column prop="createTime" :label="$t('ownerDetailAppUser.applyTime')" align="center"></el-table-column>
        <el-table-column prop="appTypeName" :label="$t('ownerDetailAppUser.appType')" align="center"></el-table-column>
        <el-table-column :label="$t('common.operation')" align="center" width="300">
          <template slot-scope="scope">
            <el-button-group>
              <el-button size="mini" v-if="scope.row.state == '10000'" 
                @click="_openAuditAppUserBindingOwnerModel(scope.row)">
                {{ $t('common.audit') }}
              </el-button>
              <el-button size="mini" @click="_deleteAppUserBindingOwnerModel(scope.row)">
                {{ $t('ownerDetailAppUser.unbind') }}
              </el-button>
              <el-button size="mini" @click="_resetUserPwdModel(scope.row)">
                {{ $t('ownerDetailAppUser.resetPwd') }}
              </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>
  
      <audit ref="audit" @auditMessage="auditMessage"></audit>
      <delete-app-user-binding-owner ref="deleteAppUserBindingOwner" @refresh="_loadOwnerDetailAppUserData"></delete-app-user-binding-owner>
      <reset-staff-pwd ref="resetStaffPwd"></reset-staff-pwd>
    </div>
  </template>
  
  <script>
  import Audit from '@/components/staff/Audit'
  import DeleteAppUserBindingOwner from './DeleteAppUserBindingOwner'
  import ResetStaffPwd from '@/components/staff/resetStaffPwd'
  import { listAuditAppUserBindingOwners, updateAppUserBindingOwner } from '@/api/owner/ownerDetailAppUserApi'
  import { getCommunityId } from '@/api/community/communityApi'
  
  export default {
    name: 'OwnerDetailAppUser',
    components: {
      Audit,
      DeleteAppUserBindingOwner,
      ResetStaffPwd
    },
    data() {
      return {
        ownerDetailAppUserInfo: {
          appUsers: [],
          ownerId: '',
          name: '',
          currentAppUserId: ''
        },
        pagination: {
          currentPage: 1,
          pageSize: 10,
          total: 0
        }
      }
    },
    methods: {
      open(ownerId, ownerName, link) {
        this.ownerDetailAppUserInfo.ownerId = ownerId
        this.ownerDetailAppUserInfo.ownerName = ownerName
        this.ownerDetailAppUserInfo.link = link
        this._loadOwnerDetailAppUserData(1, this.pagination.pageSize)
      },
      _loadOwnerDetailAppUserData(page, row) {
        const params = {
          communityId: getCommunityId(),
          memberId: this.ownerDetailAppUserInfo.ownerId,
          name: this.ownerDetailAppUserInfo.name,
          page: page,
          row: row
        }
  
        listAuditAppUserBindingOwners(params).then(response => {
          this.ownerDetailAppUserInfo.appUsers = response.data
          this.pagination.total = response.records
        }).catch(error => {
          console.error('请求失败处理', error)
        })
      },
      _openAuditAppUserBindingOwnerModel(auditAppUserBindingOwner) {
        this.ownerDetailAppUserInfo.currentAppUserId = auditAppUserBindingOwner.appUserId
        this.$refs.audit.open({})
      },
      _auditAppUserBindingOwner(auditInfo) {
        auditInfo.communityId = getCommunityId()
        auditInfo.appUserId = this.ownerDetailAppUserInfo.currentAppUserId
        
        updateAppUserBindingOwner(auditInfo).then(() => {
          this.$message.success(this.$t('common.processSuccess'))
          this._loadOwnerDetailAppUserData(1, this.pagination.pageSize)
        }).catch(error => {
          this.$message.error(this.$t('common.processFailed') + error)
        })
      },
      _deleteAppUserBindingOwnerModel(auditAppUserBindingOwner) {
        this.$refs.deleteAppUserBindingOwner.open(auditAppUserBindingOwner)
      },
      _resetUserPwdModel(staff) {
        this.$refs.resetStaffPwd.open(staff)
      },
      handleCurrentChange(val) {
        this._loadOwnerDetailAppUserData(val, this.pagination.pageSize)
      },
    },
    created() {
      this.$on('switch', (data) => {
        this.ownerDetailAppUserInfo.ownerId = data.ownerId
        this._loadOwnerDetailAppUserData(1, this.pagination.pageSize)
      })
    }
  }
  </script>