添加系统绑的功能

This commit is contained in:
guanj
2026-01-05 16:34:42 +08:00
parent 75987c0c6f
commit d25f16bcc7
13 changed files with 502 additions and 401 deletions

View File

@@ -7,16 +7,34 @@
</div>
<Table ref="tableRef" :row-config="{ isCurrent: true, isHover: true }" @currentChange="currentChange" />
</div>
<Tree
v-if="menuListId"
ref="treeRef"
show-checkbox
width="350px"
:data="menuTree"
:checkStrictly="false"
@checkChange="checkChange"
></Tree>
<el-empty style="width: 350px; padding-top: 300px; box-sizing: border-box" description="请选择角色" v-else />
<div>
<el-tabs type="border-card">
<el-tab-pane label="菜单">
<Tree
v-if="menuListId"
ref="treeRef"
show-checkbox
width="350px"
:data="menuTree"
:checkStrictly="false"
@checkChange="checkChange"
></Tree>
<el-empty
style="width: 350px; padding-top: 300px; box-sizing: border-box"
description="请选择角色"
v-else
/>
</el-tab-pane>
<el-tab-pane label="系统">
<div class="mt10 mr10" style="display: flex; justify-content: end">
<el-button type="primary" icon="el-icon-Select" @click="saveSystem">保存</el-button>
</div>
<el-checkbox-group v-model="systemIds" class="md10 system" >
<el-checkbox v-for="item in systemList" :label="item.name" :value="item.id" :key="item.id" />
</el-checkbox-group>
</el-tab-pane>
</el-tabs>
</div>
<PopupForm ref="popupRef"></PopupForm>
</div>
</template>
@@ -34,11 +52,14 @@ import { del } from '@/api/user-boot/role'
import { ElMessage } from 'element-plus'
import PopupForm from './popupForm.vue'
import { useAdminInfo } from '@/stores/adminInfo'
import { useDictData } from '@/stores/dictData'
const dictData = useDictData()
const systemList = dictData.getBasicData('System_Type')
const adminInfo = useAdminInfo()
defineOptions({
name: 'auth/role'
})
const systemIds = ref([])
const height = mainHeight(20).height
const treeRef = ref()
const menuTree = ref<treeData[]>([])
@@ -163,6 +184,19 @@ const checkChange = (data: any) => {
treeRef.value.loading = false
})
}
const saveSystem = () => {
// updateRoleMenu({
// id: menuListId.value,
// idList: systemIds.value
// })
// .then(() => {
// ElMessage.success('操作成功!')
// treeRef.value.loading = false
// })
// .catch(() => {
// treeRef.value.loading = false
// })
}
onMounted(() => {
tableStore.index()
})
@@ -170,3 +204,17 @@ const addRole = () => {
popupRef.value.open('新增角色')
}
</script>
<style lang="scss" scoped>
:deep(.el-tabs--border-card > .el-tabs__content) {
padding: 0px !important;
}
.system{
width: 330px;
height: calc(100vh - 225px);
border: 1px solid var(--el-border-color);
padding: 5px 10px;
display: flex;
flex-direction: column;
}
</style>