Blame view

src/components/org/dataPrivilegeUnit.vue 2.95 KB
8592fee7   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
  <template>
    <div class="data-privilege-unit">
      <div class="action-bar text-right">
        <el-button type="primary" size="small" @click="handleAdd">
          <i class="el-icon-plus"></i>{{ $t('dataPrivilege.associateUnit') }}
        </el-button>
      </div>
  
      <el-table :data="tableData" border style="width: 100%" v-loading="loading">
        <el-table-column prop="floorNum" :label="$t('dataPrivilege.building')" align="center">
        </el-table-column>
        <el-table-column prop="unitNum" :label="$t('dataPrivilege.unit')" align="center">
        </el-table-column>
        <el-table-column :label="$t('common.operation')" align="center" width="150">
          <template slot-scope="scope">
            <el-button size="mini" type="danger" @click="handleDelete(scope.row)">
              {{ $t('common.delete') }}
            </el-button>
          </template>
        </el-table-column>
      </el-table>
  
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
        :current-page="pagination.current" :page-sizes="[10, 20, 30, 50]" :page-size="pagination.size"
        layout="total, sizes, prev, pager, next, jumper" :total="pagination.total">
      </el-pagination>
  
      <add-data-privilege-unit ref="addDataPrivilegeUnit" @success="loadData" />
      <delete-data-privilege-unit ref="deleteDataPrivilegeUnit" @success="loadData" />
    </div>
  </template>
  
  <script>
  import { listDataPrivilegeUnit } from '@/api/org/dataPrivilegeManageApi'
  import AddDataPrivilegeUnit from '@/components/org/addDataPrivilegeUnit'
  import DeleteDataPrivilegeUnit from '@/components/org/deleteDataPrivilegeUnit'
  
  export default {
    name: 'DataPrivilegeUnit',
    components: {
      AddDataPrivilegeUnit,
      DeleteDataPrivilegeUnit
    },
    data() {
      return {
        dpId: '',
        loading: false,
        tableData: [],
        pagination: {
          current: 1,
          size: 10,
          total: 0
        }
      }
    },
    created() {
  
    },
    methods: {
      open(dpId) {
        this.dpId = dpId
        this.loadData()
      },
      async loadData() {
        this.loading = true
        try {
          const params = {
            page: this.pagination.current,
            row: this.pagination.size,
            dpId: this.dpId
          }
          const { data, total } = await listDataPrivilegeUnit(params)
          this.tableData = data
          this.pagination.total = total
        } catch (error) {
          console.error('Failed to load data privilege units:', error)
        } finally {
          this.loading = false
        }
      },
      handleAdd() {
        this.$refs.addDataPrivilegeUnit.open({ dpId: this.dpId })
      },
      handleDelete(row) {
        this.$refs.deleteDataPrivilegeUnit.open(row)
      },
      handleSizeChange(val) {
        this.pagination.size = val
        this.loadData(this.dpId)
      },
      handleCurrentChange(val) {
        this.pagination.current = val
        this.loadData(this.dpId)
      }
    },
  }
  </script>
  
  <style scoped>
  .data-privilege-unit {
    padding: 20px;
ee7ccad3   wuxw   v1.9 优化数据权限界面间距比较大问题
102
    padding-top: 0;
8592fee7   wuxw   开发排版功能
103
104
105
106
107
108
  }
  
  .action-bar {
    margin-bottom: 15px;
  }
  </style>