|
@@ -4,6 +4,9 @@
|
|
<div class="my-flex-column w100 h100">
|
|
<div class="my-flex-column w100 h100">
|
|
<el-card class="mt8" shadow="never" :body-style="{ paddingBottom: '0' }">
|
|
<el-card class="mt8" shadow="never" :body-style="{ paddingBottom: '0' }">
|
|
<el-form :inline="true" @submit.stop.prevent>
|
|
<el-form :inline="true" @submit.stop.prevent>
|
|
|
|
+ <el-form-item label="应用">
|
|
|
|
+ <el-input v-model="state.filter.app" disabled placeholder="请选择应用" @keyup.enter="onQuery" />
|
|
|
|
+ </el-form-item>
|
|
<el-form-item label="角色名称">
|
|
<el-form-item label="角色名称">
|
|
<el-input v-model="state.filter.roleName" placeholder="角色名称" @keyup.enter="onQuery" />
|
|
<el-input v-model="state.filter.roleName" placeholder="角色名称" @keyup.enter="onQuery" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -113,11 +116,13 @@
|
|
@sure="onSureUser"
|
|
@sure="onSureUser"
|
|
></user-select>
|
|
></user-select>
|
|
<set-app-menu ref="setAppMenuRef"></set-app-menu>
|
|
<set-app-menu ref="setAppMenuRef"></set-app-menu>
|
|
|
|
+ <set-role-menu ref="setRoleMenuRef"></set-role-menu>
|
|
<set-role-data-scope ref="setRoleDataScopeRef"></set-role-data-scope>
|
|
<set-role-data-scope ref="setRoleDataScopeRef"></set-role-data-scope>
|
|
</my-layout>
|
|
</my-layout>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup name="admin/role">
|
|
<script lang="ts" setup name="admin/role">
|
|
|
|
+import router from "/@/router";
|
|
import { ref, reactive, onMounted, getCurrentInstance, onBeforeMount, nextTick, defineAsyncComponent } from 'vue'
|
|
import { ref, reactive, onMounted, getCurrentInstance, onBeforeMount, nextTick, defineAsyncComponent } from 'vue'
|
|
import { OauthRole,RoleGetListOutput, RoleType,UserDto } from '/@/api/admin/data-contracts'
|
|
import { OauthRole,RoleGetListOutput, RoleType,UserDto } from '/@/api/admin/data-contracts'
|
|
import { RoleApi } from '/@/api/admin/Role'
|
|
import { RoleApi } from '/@/api/admin/Role'
|
|
@@ -135,7 +140,7 @@ const SetAppMenu = defineAsyncComponent(() => import('./components/set-app-menu.
|
|
const UserSelect = defineAsyncComponent(() => import('./components/user-select.vue'))
|
|
const UserSelect = defineAsyncComponent(() => import('./components/user-select.vue'))
|
|
const MyDropdownMore = defineAsyncComponent(() => import('/@/components/my-dropdown-more/index.vue'))
|
|
const MyDropdownMore = defineAsyncComponent(() => import('/@/components/my-dropdown-more/index.vue'))
|
|
const MyLayout = defineAsyncComponent(() => import('/@/components/my-layout/index.vue'))
|
|
const MyLayout = defineAsyncComponent(() => import('/@/components/my-layout/index.vue'))
|
|
-
|
|
|
|
|
|
+const SetRoleMenu = defineAsyncComponent(() => import('./components/set-role-menu.vue'))
|
|
const { proxy } = getCurrentInstance() as any
|
|
const { proxy } = getCurrentInstance() as any
|
|
|
|
|
|
const roleTableRef = ref()
|
|
const roleTableRef = ref()
|
|
@@ -143,6 +148,7 @@ const roleFormRef = ref()
|
|
const userTableRef = ref<InstanceType<typeof ElTable>>()
|
|
const userTableRef = ref<InstanceType<typeof ElTable>>()
|
|
const userSelectRef = ref()
|
|
const userSelectRef = ref()
|
|
const setAppMenuRef = ref()
|
|
const setAppMenuRef = ref()
|
|
|
|
+const setRoleMenuRef = ref()
|
|
const setRoleDataScopeRef = ref()
|
|
const setRoleDataScopeRef = ref()
|
|
|
|
|
|
const state = reactive({
|
|
const state = reactive({
|
|
@@ -153,6 +159,7 @@ const state = reactive({
|
|
filter: {
|
|
filter: {
|
|
name: '',
|
|
name: '',
|
|
roleName: '',
|
|
roleName: '',
|
|
|
|
+ app:''
|
|
},
|
|
},
|
|
roleTreeData: [] as any,
|
|
roleTreeData: [] as any,
|
|
roleFormTreeData: [] as any,
|
|
roleFormTreeData: [] as any,
|
|
@@ -175,6 +182,9 @@ onBeforeMount(() => {
|
|
|
|
|
|
const onQuery = async () => {
|
|
const onQuery = async () => {
|
|
state.loading = true
|
|
state.loading = true
|
|
|
|
+ const name = router.currentRoute.value.params.id
|
|
|
|
+ const appData=await new PermissionApi().getApplyInfo({Name:name})
|
|
|
|
+ state.filter.app=appData.data[0].name
|
|
const res = await new PermissionApi().getRoleInfo({name:state.filter.roleName}).catch(() => {
|
|
const res = await new PermissionApi().getRoleInfo({name:state.filter.roleName}).catch(() => {
|
|
state.loading = false
|
|
state.loading = false
|
|
})
|
|
})
|
|
@@ -199,7 +209,7 @@ const onQuery = async () => {
|
|
state.roleFormTreeData = listToTree(cloneDeep(res.data).filter((a) => a.parentId === 0))
|
|
state.roleFormTreeData = listToTree(cloneDeep(res.data).filter((a) => a.parentId === 0))
|
|
if (state.roleTreeData.length > 0 && state.roleTreeData[0].children?.length > 0) {
|
|
if (state.roleTreeData.length > 0 && state.roleTreeData[0].children?.length > 0) {
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
- roleTableRef.value!.setCurrentRow(state.roleTreeData[0].children[0])
|
|
|
|
|
|
+ roleTableRef.value!?.setCurrentRow(state.roleTreeData[0].children[0])
|
|
})
|
|
})
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -336,12 +346,16 @@ const onSureUser = async (users: UserDto[]) => {
|
|
onGetRoleUserList()
|
|
onGetRoleUserList()
|
|
}
|
|
}
|
|
|
|
|
|
-const onSetAppMenu = (role: RoleGetListOutput) => {
|
|
|
|
|
|
+const onSetAppMenu = async (role: RoleGetListOutput) => {
|
|
if (!((role?.id as number) > 0)) {
|
|
if (!((role?.id as number) > 0)) {
|
|
proxy.$modal.msgWarning('请选择角色')
|
|
proxy.$modal.msgWarning('请选择角色')
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- setAppMenuRef.value.open(role)
|
|
|
|
|
|
+ const input = { id: role.id, name:role.name }
|
|
|
|
+ const name = router.currentRoute.value.params.id
|
|
|
|
+ const appData=await new PermissionApi().getApplyInfo({Name:name})
|
|
|
|
+ console.log(appData.data)
|
|
|
|
+ setRoleMenuRef.value.open(input,appData.data[0].id)
|
|
}
|
|
}
|
|
|
|
|
|
const onSetRoleDataScope = (role: RoleGetListOutput) => {
|
|
const onSetRoleDataScope = (role: RoleGetListOutput) => {
|