2024-05-20 15:36:39 +08:00
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<el-table v-loading="loading" :data="tableList" border>
|
|
|
|
|
<el-table-column type="index" width="50" />
|
|
|
|
|
<el-table-column
|
|
|
|
|
v-for="col in columns"
|
|
|
|
|
:prop="col.prop"
|
|
|
|
|
:key="col.prop"
|
|
|
|
|
:label="col.label"
|
|
|
|
|
:width="col.width"
|
|
|
|
|
/>
|
|
|
|
|
</el-table>
|
|
|
|
|
<Pagination
|
|
|
|
|
v-model:limit="pageSize"
|
|
|
|
|
v-model:page="currentPage"
|
|
|
|
|
:total="total"
|
|
|
|
|
@pagination="getList"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup name="RoleEmployee">
|
2024-05-23 18:07:49 +08:00
|
|
|
import { getRoleUsers } from '@/api/system/role'
|
2024-05-23 14:08:08 +08:00
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
roleId: {
|
|
|
|
|
type: Number
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => props.roleId,
|
|
|
|
|
(newValue) => {
|
|
|
|
|
getList(newValue)
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
2024-05-20 15:36:39 +08:00
|
|
|
const loading = ref(false)
|
|
|
|
|
const tableList = ref([])
|
|
|
|
|
const total = ref(0)
|
|
|
|
|
const pageSize = ref(20)
|
|
|
|
|
const currentPage = ref(1)
|
|
|
|
|
|
|
|
|
|
const columns = ref([
|
2024-05-23 14:08:08 +08:00
|
|
|
{ prop: 'nickname', label: '姓名' },
|
|
|
|
|
{ prop: 'mobile', label: '手机号' },
|
|
|
|
|
{ prop: 'deptName', label: '部门' },
|
|
|
|
|
{ prop: '', label: '角色', width: '300px' }
|
2024-05-20 15:36:39 +08:00
|
|
|
])
|
|
|
|
|
|
2024-05-23 14:08:08 +08:00
|
|
|
async function getList() {
|
|
|
|
|
loading.value = true
|
|
|
|
|
try {
|
2024-05-23 18:07:49 +08:00
|
|
|
const data = await getRoleUsers({
|
2024-05-23 14:08:08 +08:00
|
|
|
pageNo: currentPage.value,
|
|
|
|
|
pageSize: pageSize.value,
|
2024-05-23 18:07:49 +08:00
|
|
|
id: props.roleId
|
2024-05-23 14:08:08 +08:00
|
|
|
})
|
|
|
|
|
tableList.value = data.list
|
|
|
|
|
total.value = data.total
|
|
|
|
|
} finally {
|
|
|
|
|
loading.value = false
|
|
|
|
|
}
|
2024-05-20 15:36:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
getList()
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped></style>
|