fix: bug#10537
This commit is contained in:
parent
dd4f921df4
commit
d29346248e
|
@ -21,56 +21,59 @@
|
|||
</PermissionButton>
|
||||
</div>
|
||||
|
||||
<jTree
|
||||
:tree-data="treeData"
|
||||
v-model:selected-keys="selectedKeys"
|
||||
:fieldNames="{ key: 'id' }"
|
||||
v-loading="loading"
|
||||
>
|
||||
<template #title="{ name, data }">
|
||||
<span>{{ name }}</span>
|
||||
<span class="func-btns" @click="(e) => e.stopPropagation()">
|
||||
<PermissionButton
|
||||
:hasPermission="`${permission}:update`"
|
||||
type="link"
|
||||
:tooltip="{
|
||||
title: '编辑',
|
||||
}"
|
||||
@click="openDialog(data)"
|
||||
>
|
||||
<AIcon type="EditOutlined" />
|
||||
</PermissionButton>
|
||||
<PermissionButton
|
||||
:hasPermission="`${permission}:add`"
|
||||
type="link"
|
||||
:tooltip="{
|
||||
title: '新增子组织',
|
||||
}"
|
||||
@click="
|
||||
openDialog({
|
||||
...data,
|
||||
id: '',
|
||||
parentId: data.id,
|
||||
})
|
||||
"
|
||||
>
|
||||
<AIcon type="PlusCircleOutlined" />
|
||||
</PermissionButton>
|
||||
<PermissionButton
|
||||
type="link"
|
||||
:hasPermission="`${permission}:delete`"
|
||||
:tooltip="{ title: '删除' }"
|
||||
:popConfirm="{
|
||||
title: `确定要删除吗`,
|
||||
onConfirm: () => delDepartment(data.id),
|
||||
}"
|
||||
>
|
||||
<AIcon type="DeleteOutlined" />
|
||||
</PermissionButton>
|
||||
</span>
|
||||
</template>
|
||||
</jTree>
|
||||
|
||||
<div class="tree">
|
||||
<jTree
|
||||
v-if="treeData.length > 0"
|
||||
:tree-data="treeData"
|
||||
v-model:selected-keys="selectedKeys"
|
||||
:fieldNames="{ key: 'id' }"
|
||||
>
|
||||
<template #title="{ name, data }">
|
||||
<span>{{ name }}</span>
|
||||
<span class="func-btns" @click="(e) => e.stopPropagation()">
|
||||
<PermissionButton
|
||||
:hasPermission="`${permission}:update`"
|
||||
type="link"
|
||||
:tooltip="{
|
||||
title: '编辑',
|
||||
}"
|
||||
@click="openDialog(data)"
|
||||
>
|
||||
<AIcon type="EditOutlined" />
|
||||
</PermissionButton>
|
||||
<PermissionButton
|
||||
:hasPermission="`${permission}:add`"
|
||||
type="link"
|
||||
:tooltip="{
|
||||
title: '新增子组织',
|
||||
}"
|
||||
@click="
|
||||
openDialog({
|
||||
...data,
|
||||
id: '',
|
||||
parentId: data.id,
|
||||
})
|
||||
"
|
||||
>
|
||||
<AIcon type="PlusCircleOutlined" />
|
||||
</PermissionButton>
|
||||
<PermissionButton
|
||||
type="link"
|
||||
:hasPermission="`${permission}:delete`"
|
||||
:tooltip="{ title: '删除' }"
|
||||
:popConfirm="{
|
||||
title: `确定要删除吗`,
|
||||
onConfirm: () => delDepartment(data.id),
|
||||
}"
|
||||
>
|
||||
<AIcon type="DeleteOutlined" />
|
||||
</PermissionButton>
|
||||
</span>
|
||||
</template>
|
||||
</jTree>
|
||||
<div class="loading" v-else-if="loading"><j-spin /></div>
|
||||
<j-empty v-else description="暂无数据" />
|
||||
</div>
|
||||
<!-- 编辑弹窗 -->
|
||||
<EditDepartmentDialog
|
||||
v-if="dialog.visible"
|
||||
|
@ -193,9 +196,11 @@ const openDialog = (row: any = {}) => {
|
|||
if (row.parentId) {
|
||||
childrens = row.children;
|
||||
} else childrens = treeData.value;
|
||||
const indexs = childrens.length > 0 ? childrens?.map((item) => item.sortIndex) :[0]
|
||||
sortIndex =
|
||||
Math.max(...indexs) + 1;
|
||||
const indexs =
|
||||
childrens.length > 0
|
||||
? childrens?.map((item) => item.sortIndex)
|
||||
: [0];
|
||||
sortIndex = Math.max(...indexs) + 1;
|
||||
}
|
||||
|
||||
dialog.selectItem = { ...row, sortIndex };
|
||||
|
@ -248,5 +253,11 @@ function init() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.loading {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
}"
|
||||
:popConfirm="{
|
||||
title: `确认删除`,
|
||||
onConfirm: () => table.clickDel(slotProps),
|
||||
onConfirm: () => table.clickDel(slotProps.id),
|
||||
}"
|
||||
:disabled="slotProps.status"
|
||||
>
|
||||
|
@ -223,10 +223,10 @@ const table = {
|
|||
dialog.type = type;
|
||||
dialog.visible = true;
|
||||
},
|
||||
changeStatus: (row: any) => {
|
||||
changeStatus: ({ id, status }: any) => {
|
||||
const params = {
|
||||
id: row.id,
|
||||
status: row.status === 0 ? 1 : 0,
|
||||
status: status === 0 ? 1 : 0,
|
||||
id,
|
||||
};
|
||||
changeUserStatus_api(params).then(() => {
|
||||
message.success('操作成功');
|
||||
|
@ -234,8 +234,8 @@ const table = {
|
|||
});
|
||||
},
|
||||
// 删除
|
||||
clickDel: (row: any) => {
|
||||
deleteUser_api(row.id).then(() => {
|
||||
clickDel: (id: string) => {
|
||||
deleteUser_api(id).then(() => {
|
||||
message.success('操作成功');
|
||||
table.refresh();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue