Blame view

src/components/staff/AUserDetailAttr.vue 1.78 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
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
    <div class="user-detail-attr-container">
      <el-table :data="attrs" border style="width: 100%">
        <el-table-column prop="specCd" :label="$t('userDetailAttr.specCd')" align="center"></el-table-column>
        <el-table-column prop="specCdName" :label="$t('userDetailAttr.specName')" align="center"></el-table-column>
        <el-table-column prop="value" :label="$t('userDetailAttr.value')" align="center"></el-table-column>
      </el-table>
  
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="page.current"
        :page-sizes="[10, 20, 30, 50]"
        :page-size="page.size"
        layout="total, sizes, prev, pager, next, jumper"
        :total="page.total">
      </el-pagination>
    </div>
  </template>
  
  <script>
  import { listSystemUserAttr } from '@/api/staff/systemUserDetailApi'
  
  export default {
    name: 'AUserDetailAttr',
    props: {
      userId: {
        type: String,
        required: true
      }
    },
    data() {
      return {
        attrs: [],
        page: {
          current: 1,
          size: 10,
          total: 0
        }
      }
    },
    methods: {
      async loadData() {
        try {
          const params = {
            page: this.page.current,
            row: this.page.size,
            systemUserId: this.userId
          }
          const res = await listSystemUserAttr(params)
          if (res.code === 0) {
            this.attrs = res.data
            this.page.total = res.total
          }
        } catch (error) {
          this.$message.error(this.$t('common.loadFailed'))
        }
      },
      handleSizeChange(val) {
        this.page.size = val
        this.loadData()
      },
      handleCurrentChange(val) {
        this.page.current = val
        this.loadData()
      }
    }
  }
  </script>
  
  <style scoped>
  .user-detail-attr-container {
    margin-top: 20px;
  }
  </style>