Blame view

src/components/staff/AStaffDetailAppAuth.vue 2.67 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
76
77
78
79
80
81
82
83
84
85
86
      <div class="staff-app-auth-container">
        <el-table :data="aStaffDetailAppAuthInfo.auths" border style="width: 100%" class="margin-top">
          <el-table-column prop="authId" :label="$t('staffDetailAppAuth.authId')" align="center" />
          <el-table-column prop="appName" :label="$t('staffDetailAppAuth.appName')" align="center" />
          <el-table-column prop="authTime" :label="$t('staffDetailAppAuth.authTime')" align="center" />
          <el-table-column prop="stateName" :label="$t('staffDetailAppAuth.stateName')" align="center" />
          <el-table-column :label="$t('common.operation')" align="center">
            <template slot-scope="scope">
              <el-button size="mini" type="primary" @click="openAuthDetail(scope.row)">
                {{ $t('common.detail') }}
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          :current-page.sync="page.current"
          :page-sizes="[10, 15, 20, 30]"
          :page-size="page.size"
          :total="page.total"
          layout="total, sizes, prev, pager, next, jumper"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
        />
      </div>
    </template>
    
    <script>
    import { listAdminAppAuths } from '@/api/staff/adminStaffDetailApi'
    
    export default {
      name: 'AStaffDetailAppAuth',
      data() {
        return {
          aStaffDetailAppAuthInfo: {
            auths: [],
            staffId: ''
          },
          page: {
            current: 1,
            size: 10,
            total: 0
          }
        }
      },
      methods: {
        switchTab(data) {
          this.aStaffDetailAppAuthInfo.staffId = data.staffId
          this.loadAppAuthData(1, this.page.size)
        },
        async loadAppAuthData(page, row) {
          try {
            const { data, total } = await listAdminAppAuths({
              staffId: this.aStaffDetailAppAuthInfo.staffId,
              page,
              row
            })
            this.aStaffDetailAppAuthInfo.auths = data.auths
            this.page.total = total
          } catch (error) {
            this.$message.error(this.$t('staffDetailAppAuth.fetchError'))
          }
        },
        openAuthDetail(auth) {
          this.$router.push(`/views/auth/adminAppAuthDetail?authId=${auth.authId}`)
        },
        handleSizeChange(val) {
          this.page.size = val
          this.loadAppAuthData(this.page.current, this.page.size)
        },
        handleCurrentChange(val) {
          this.page.current = val
          this.loadAppAuthData(this.page.current, this.page.size)
        }
      }
    }
    </script>
    
    <style lang="scss" scoped>
    .staff-app-auth-container {
      padding: 20px;
      .margin-top {
        margin-top: 20px;
      }
    }
    </style>