|
|
@ -1,76 +1,77 @@ |
|
|
|
<template> |
|
|
|
<div class="page"> |
|
|
|
<div class="ele-body"> |
|
|
|
<a-card :bordered="false" :body-style="{ padding: '16px' }"> |
|
|
|
<ele-split-layout |
|
|
|
width="266px" |
|
|
|
allow-collapse |
|
|
|
:right-style="{ overflow: 'hidden' }" |
|
|
|
:style="{ minHeight: 'calc(100vh - 152px)' }" |
|
|
|
> |
|
|
|
<div> |
|
|
|
<ele-toolbar theme="default"> |
|
|
|
<a-space :size="10"> |
|
|
|
<a-button type="primary" class="ele-btn-icon" @click="openEdit()"> |
|
|
|
<template #icon> |
|
|
|
<plus-outlined/> |
|
|
|
</template> |
|
|
|
<span>新建</span> |
|
|
|
</a-button> |
|
|
|
<a-button |
|
|
|
type="primary" |
|
|
|
:disabled="!current" |
|
|
|
class="ele-btn-icon" |
|
|
|
@click="openEdit(current)" |
|
|
|
> |
|
|
|
<template #icon> |
|
|
|
<edit-outlined/> |
|
|
|
</template> |
|
|
|
<span>修改</span> |
|
|
|
</a-button> |
|
|
|
<a-button |
|
|
|
danger |
|
|
|
type="primary" |
|
|
|
:disabled="!current" |
|
|
|
class="ele-btn-icon" |
|
|
|
@click="remove" |
|
|
|
> |
|
|
|
<template #icon> |
|
|
|
<delete-outlined/> |
|
|
|
</template> |
|
|
|
<span>删除</span> |
|
|
|
</a-button> |
|
|
|
</a-space> |
|
|
|
</ele-toolbar> |
|
|
|
<div class="ele-border-split sys-organization-list"> |
|
|
|
<a-tree |
|
|
|
:tree-data="(data as any)" |
|
|
|
:show-line="true" |
|
|
|
v-model:expanded-keys="expandedRowKeys" |
|
|
|
v-model:selected-keys="selectedRowKeys" |
|
|
|
@select="onTreeSelect" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<template #content> |
|
|
|
<org-user-list |
|
|
|
:organization-list="data" |
|
|
|
:organization-id="current?.organizationId" |
|
|
|
@done="query" |
|
|
|
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)"> |
|
|
|
<template #extra> |
|
|
|
<Extra/> |
|
|
|
</template> |
|
|
|
<a-card :bordered="false" :body-style="{ padding: '16px' }"> |
|
|
|
<ele-split-layout |
|
|
|
width="266px" |
|
|
|
allow-collapse |
|
|
|
:right-style="{ overflow: 'hidden' }" |
|
|
|
:style="{ minHeight: 'calc(100vh - 152px)' }" |
|
|
|
> |
|
|
|
<div> |
|
|
|
<ele-toolbar theme="default"> |
|
|
|
<a-space :size="10"> |
|
|
|
<a-button type="primary" class="ele-btn-icon" @click="openEdit()"> |
|
|
|
<template #icon> |
|
|
|
<plus-outlined/> |
|
|
|
</template> |
|
|
|
<span>新建</span> |
|
|
|
</a-button> |
|
|
|
<a-button |
|
|
|
type="primary" |
|
|
|
:disabled="!current" |
|
|
|
class="ele-btn-icon" |
|
|
|
@click="openEdit(current)" |
|
|
|
> |
|
|
|
<template #icon> |
|
|
|
<edit-outlined/> |
|
|
|
</template> |
|
|
|
<span>修改</span> |
|
|
|
</a-button> |
|
|
|
<a-button |
|
|
|
danger |
|
|
|
type="primary" |
|
|
|
:disabled="!current" |
|
|
|
class="ele-btn-icon" |
|
|
|
@click="remove" |
|
|
|
> |
|
|
|
<template #icon> |
|
|
|
<delete-outlined/> |
|
|
|
</template> |
|
|
|
<span>删除</span> |
|
|
|
</a-button> |
|
|
|
</a-space> |
|
|
|
</ele-toolbar> |
|
|
|
<div class="ele-border-split sys-organization-list"> |
|
|
|
<a-tree |
|
|
|
:tree-data="(data as any)" |
|
|
|
:show-line="true" |
|
|
|
v-model:expanded-keys="expandedRowKeys" |
|
|
|
v-model:selected-keys="selectedRowKeys" |
|
|
|
@select="onTreeSelect" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
</ele-split-layout> |
|
|
|
</a-card> |
|
|
|
<!-- 编辑弹窗 --> |
|
|
|
<org-edit |
|
|
|
v-model:visible="showEdit" |
|
|
|
:data="editData" |
|
|
|
:organization-list="data" |
|
|
|
:organization-id="current?.organizationId" |
|
|
|
@done="query" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<template #content> |
|
|
|
<org-user-list |
|
|
|
:organization-list="data" |
|
|
|
:organization-id="current?.organizationId" |
|
|
|
@done="query" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
</ele-split-layout> |
|
|
|
</a-card> |
|
|
|
<!-- 编辑弹窗 --> |
|
|
|
<org-edit |
|
|
|
v-model:visible="showEdit" |
|
|
|
:data="editData" |
|
|
|
:organization-list="data" |
|
|
|
:organization-id="current?.organizationId" |
|
|
|
@done="query" |
|
|
|
/> |
|
|
|
</a-page-header> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script lang="ts" setup> |
|
|
@ -90,6 +91,8 @@ import { |
|
|
|
removeOrganization |
|
|
|
} from '@/api/system/organization'; |
|
|
|
import type {Organization} from '@/api/system/organization/model'; |
|
|
|
import {getPageTitle} from "@/utils/common"; |
|
|
|
import Extra from "@/views/system/user/components/Extra.vue"; |
|
|
|
|
|
|
|
// 加载状态 |
|
|
|
const loading = ref(true); |
|
|
@ -116,39 +119,39 @@ const editData = ref<Organization | null>(null); |
|
|
|
const query = () => { |
|
|
|
loading.value = true; |
|
|
|
listOrganizations() |
|
|
|
.then((list) => { |
|
|
|
loading.value = false; |
|
|
|
const eks: number[] = []; |
|
|
|
list.forEach((d, i) => { |
|
|
|
d.title = d.organizationName + `[${d.organizationId}]`; |
|
|
|
d.key = d.organizationId; |
|
|
|
d.value = d.organizationId; |
|
|
|
|
|
|
|
if (typeof d.key === 'number') { |
|
|
|
eks.push(d.key); |
|
|
|
} |
|
|
|
}); |
|
|
|
expandedRowKeys.value = eks; |
|
|
|
data.value = toTreeData({ |
|
|
|
data: list, |
|
|
|
idField: 'organizationId', |
|
|
|
parentIdField: 'parentId' |
|
|
|
}); |
|
|
|
if (list.length) { |
|
|
|
// if (typeof list[0].key === 'number') { |
|
|
|
// selectedRowKeys.value = [list[0].key]; |
|
|
|
// } |
|
|
|
// current.value = list[0]; |
|
|
|
// current.value.organizationId = 0; |
|
|
|
} else { |
|
|
|
selectedRowKeys.value = []; |
|
|
|
current.value = null; |
|
|
|
.then((list) => { |
|
|
|
loading.value = false; |
|
|
|
const eks: number[] = []; |
|
|
|
list.forEach((d, i) => { |
|
|
|
d.title = d.organizationName + `[${d.organizationId}]`; |
|
|
|
d.key = d.organizationId; |
|
|
|
d.value = d.organizationId; |
|
|
|
|
|
|
|
if (typeof d.key === 'number') { |
|
|
|
eks.push(d.key); |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch((e) => { |
|
|
|
loading.value = false; |
|
|
|
message.error(e.message); |
|
|
|
}); |
|
|
|
expandedRowKeys.value = eks; |
|
|
|
data.value = toTreeData({ |
|
|
|
data: list, |
|
|
|
idField: 'organizationId', |
|
|
|
parentIdField: 'parentId' |
|
|
|
}); |
|
|
|
if (list.length) { |
|
|
|
// if (typeof list[0].key === 'number') { |
|
|
|
// selectedRowKeys.value = [list[0].key]; |
|
|
|
// } |
|
|
|
// current.value = list[0]; |
|
|
|
// current.value.organizationId = 0; |
|
|
|
} else { |
|
|
|
selectedRowKeys.value = []; |
|
|
|
current.value = null; |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch((e) => { |
|
|
|
loading.value = false; |
|
|
|
message.error(e.message); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
/* 选择数据 */ |
|
|
@ -177,15 +180,15 @@ const remove = () => { |
|
|
|
onOk: () => { |
|
|
|
const hide = messageLoading('请求中..', 0); |
|
|
|
removeOrganization(current.value?.organizationId) |
|
|
|
.then((msg) => { |
|
|
|
hide(); |
|
|
|
message.success(msg); |
|
|
|
query(); |
|
|
|
}) |
|
|
|
.catch((e) => { |
|
|
|
hide(); |
|
|
|
message.error(e.message); |
|
|
|
}); |
|
|
|
.then((msg) => { |
|
|
|
hide(); |
|
|
|
message.success(msg); |
|
|
|
query(); |
|
|
|
}) |
|
|
|
.catch((e) => { |
|
|
|
hide(); |
|
|
|
message.error(e.message); |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
}; |
|
|
|