修复部门和角色树列表部分情况无法自动展开问题

This commit is contained in:
孟帅 2023-08-08 10:14:16 +08:00
parent 90d09deeff
commit 5538d9b720
4 changed files with 45 additions and 28 deletions

View File

@ -2,7 +2,7 @@
<div>
<div class="n-layout-page-header">
<n-card :bordered="false" title="通知公告">
在这里你可以发送通知公告私信到平台中的用户
在这里您可以向平台中的用户发送通知公告和私信消息
</n-card>
</div>
<n-card :bordered="false" class="proCard">

View File

@ -2,7 +2,7 @@
<div>
<div class="n-layout-page-header">
<n-card :bordered="false" title="我的消息">
在这里你可以查看平台中通知公告和与你相关的私信
在这里您可以方便地查看平台中的通知公告和与您相关的私信消息
</n-card>
</div>
<n-card :bordered="false" class="proCard">
@ -13,9 +13,9 @@
animated
@before-leave="handleBeforeLeave"
>
<n-tab-pane name="1" tab="系统通知"> <List :type="defaultTab" /></n-tab-pane>
<n-tab-pane name="2" tab="系统公告"> <List :type="defaultTab" /> </n-tab-pane>
<n-tab-pane name="3" tab="私信消息"> <List :type="defaultTab" /> </n-tab-pane>
<n-tab-pane name="1" tab="通知"> <List :type="defaultTab" /></n-tab-pane>
<n-tab-pane name="2" tab="公告"> <List :type="defaultTab" /> </n-tab-pane>
<n-tab-pane name="3" tab="私信"> <List :type="defaultTab" /> </n-tab-pane>
</n-tabs>
</n-card>
</div>

View File

@ -25,6 +25,7 @@
</n-space>
<n-data-table
v-if="data.length > 0 || !loading"
:columns="columns"
:data="data"
:row-key="rowKey"
@ -317,6 +318,10 @@
return h(TableAction as any, {
style: 'button',
actions: [
{
label: '添加',
onClick: handleAddSub.bind(null, record),
},
{
label: '编辑',
onClick: handleEdit.bind(null, record),
@ -341,6 +346,12 @@
optionsDefaultValue.value = 0;
}
function handleAddSub(record: Recordable) {
showModal.value = true;
formParams.value = cloneDeep(defaultState);
optionsDefaultValue.value = record.id;
}
function handleEdit(record: Recordable) {
showModal.value = true;
formParams.value = cloneDeep(record);

View File

@ -1,20 +1,8 @@
<template>
<div>
<div class="n-layout-page-header">
<n-card :bordered="false" title="角色管理"> 在这里可以管理你权限下的角色权限</n-card>
</div>
<n-card :bordered="false" class="mt-4 proCard">
<BasicTable
:columns="columns"
:request="loadDataTable"
:row-key="(row) => row.id"
ref="actionRef"
:actionColumn="actionColumn"
@update:checked-row-keys="onCheckedRow"
:pagination="false"
:resizeHeightOffset="-20000"
>
<template #tableTitle>
<n-card :bordered="false" title="角色管理">
<n-space vertical :size="12">
<n-space>
<n-button type="primary" @click="addTable">
<template #icon>
<n-icon>
@ -23,8 +11,18 @@
</template>
添加角色
</n-button>
</template>
</BasicTable>
</n-space>
<n-data-table
v-if="data.length > 0 || !loading"
:columns="columns.concat(actionColumn)"
:data="data"
:row-key="(row) => row.id"
:loading="loading"
:resizeHeightOffset="-20000"
default-expand-all
/>
</n-space>
</n-card>
<n-modal v-model:show="showModal" :show-icon="false" preset="dialog" :title="editRoleTitle">
@ -155,8 +153,8 @@
<script lang="ts" setup>
import { h, onMounted, reactive, ref } from 'vue';
import { useDialog, useMessage } from 'naive-ui';
import { BasicColumn, BasicTable, TableAction } from '@/components/Table';
import { NButton, useDialog, useMessage } from 'naive-ui';
import { BasicColumn, TableAction } from '@/components/Table';
import {
Delete,
Edit,
@ -195,6 +193,8 @@
const dataFormBtnLoading = ref(false);
const showDataModal = ref(false);
const dataForm = ref<any>();
const loading = ref(false);
const data = ref<any>([]);
const rules = {
name: {
@ -270,12 +270,18 @@
});
const loadDataTable = async (res: any) => {
return await getRoleList({ ...res, ...{ pageSize: 100, page: 1 } });
loading.value = true;
const tmp = await getRoleList({ ...res, ...{ pageSize: 100, page: 1 } });
data.value = tmp?.list;
if (data.value === undefined || data.value === null) {
data.value = [];
}
loading.value = false;
};
function onCheckedRow(rowKeys: any[]) {
console.log(rowKeys);
}
onMounted(async () => {
await loadDataTable({});
});
function reloadTable() {
actionRef.value.reload();