feat(系统设置): 系统组织移除
This commit is contained in:
parent
1bfa2a611f
commit
2f472293df
|
@ -30,3 +30,9 @@ export function addUserToOrgOrProject(data: AddUserToOrgOrProjectParams) {
|
||||||
export function getUserByOrganizationOrProject(sourceId: string) {
|
export function getUserByOrganizationOrProject(sourceId: string) {
|
||||||
return MSR.get({ url: `${orgUrl.getUserByOrgOrProjectUrl}${sourceId}` });
|
return MSR.get({ url: `${orgUrl.getUserByOrgOrProjectUrl}${sourceId}` });
|
||||||
}
|
}
|
||||||
|
// 删除组织或项目成员
|
||||||
|
export function deleteUserFromOrgOrProject(sourceId: string, userId: string, isOrg = true) {
|
||||||
|
return MSR.get({
|
||||||
|
url: `${isOrg ? orgUrl.getDeleteOrgMemberUrl : orgUrl.getDeleteProjectMemberUrl}${sourceId}/${userId}`,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -197,7 +197,7 @@
|
||||||
};
|
};
|
||||||
watch(
|
watch(
|
||||||
() => props.treeData,
|
() => props.treeData,
|
||||||
(newVal, oldVal) => {
|
(newVal) => {
|
||||||
treeList.value = newVal;
|
treeList.value = newVal;
|
||||||
transferData = getTransferData(treeList.value, []);
|
transferData = getTransferData(treeList.value, []);
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
<template>
|
||||||
|
<MsPopconfirm
|
||||||
|
v-model:visible="currentVisible"
|
||||||
|
:ok-text="t('common.remove')"
|
||||||
|
:cancel-text="t('common.cancel')"
|
||||||
|
type="error"
|
||||||
|
:title="props.title"
|
||||||
|
:sub-title-tip="props.subTitleTip"
|
||||||
|
@confirm="handleOk"
|
||||||
|
@cancel="handleCancel"
|
||||||
|
>
|
||||||
|
<MsButton @click="showPopconfirm">{{ t('common.remove') }}</MsButton>
|
||||||
|
</MsPopconfirm>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { useI18n } from '@/hooks/useI18n';
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import MsButton from '@/components/pure/ms-button/index.vue';
|
||||||
|
import MsPopconfirm from '@/components/pure/ms-popconfirm/index.vue';
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
title: string;
|
||||||
|
subTitleTip: string;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'ok'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const currentVisible = ref(false);
|
||||||
|
|
||||||
|
const handleCancel = () => {
|
||||||
|
currentVisible.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const showPopconfirm = () => {
|
||||||
|
currentVisible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleOk = () => {
|
||||||
|
emit('ok');
|
||||||
|
currentVisible.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
</script>
|
|
@ -32,7 +32,7 @@
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
type?: 'organization' | 'usergroup';
|
type?: 'organization' | 'usergroup';
|
||||||
sourceId?: string;
|
sourceId?: string;
|
||||||
disabledKey?: 'disabled' | 'memberFlag' | 'adminFlag';
|
disabledKey?: 'disabled' | 'memberFlag';
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UserItem {
|
export interface UserItem {
|
||||||
|
@ -41,7 +41,6 @@
|
||||||
email: string;
|
email: string;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
memberFlag?: boolean;
|
memberFlag?: boolean;
|
||||||
adminFlag?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const fieldNames = { value: 'id', label: 'name' };
|
const fieldNames = { value: 'id', label: 'name' };
|
||||||
|
|
|
@ -190,8 +190,11 @@ export default function useTableProps(
|
||||||
setTableErrorStatus('error');
|
setTableErrorStatus('error');
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
// eslint-disable-next-line no-console
|
// debug 模式下打印属性
|
||||||
if (propsRes.value.debug) console.info(propsRes.value);
|
if (propsRes.value.debug && import.meta.env.DEV) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log('Table propsRes: ', propsRes.value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,30 @@
|
||||||
export default {
|
export default {
|
||||||
'common.pleaseSelectMember': 'Please select member',
|
'common.pleaseSelectMember': 'Please select member',
|
||||||
|
'common.add': 'Add',
|
||||||
|
'common.edit': 'Edit',
|
||||||
|
'common.delete': 'Delete',
|
||||||
|
'common.save': 'Save',
|
||||||
|
'common.cancel': 'Cancel',
|
||||||
|
'common.confirm': 'Confirm',
|
||||||
|
'common.confirmDelete': 'Confirm delete',
|
||||||
|
'common.search': 'Search',
|
||||||
|
'common.reset': 'Reset',
|
||||||
|
'common.retry': 'Retry',
|
||||||
|
'common.all': 'All',
|
||||||
|
'common.operation': 'Operation',
|
||||||
|
'common.remove': 'Remove',
|
||||||
|
'common.revoked': 'Revoked',
|
||||||
|
'common.deleteConfirm': 'Confirm delete?',
|
||||||
|
'common.deleteSuccess': 'Delete success',
|
||||||
|
'common.deleteFailed': 'Delete failed',
|
||||||
|
'common.addSuccess': 'Add success',
|
||||||
|
'common.addFailed': 'Add failed',
|
||||||
|
'common.editSuccess': 'Edit success',
|
||||||
|
'common.editFailed': 'Edit failed',
|
||||||
|
'common.saveSuccess': 'Save success',
|
||||||
|
'common.saveFailed': 'Save failed',
|
||||||
|
'common.operationSuccess': 'Operation success',
|
||||||
|
'common.operationFailed': 'Operation failed',
|
||||||
|
'common.removeSuccess': 'Remove success',
|
||||||
|
'common.removeFailed': 'Remove failed',
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,3 +1,30 @@
|
||||||
export default {
|
export default {
|
||||||
'common.pleaseSelectMember': '请选择成员',
|
'common.pleaseSelectMember': '请选择成员',
|
||||||
|
'common.add': '添加',
|
||||||
|
'common.edit': '编辑',
|
||||||
|
'common.delete': '删除',
|
||||||
|
'common.save': '保存',
|
||||||
|
'common.cancel': '取消',
|
||||||
|
'common.confirm': '确认',
|
||||||
|
'common.confirmDelete': '确认删除',
|
||||||
|
'common.search': '搜索',
|
||||||
|
'common.reset': '重置',
|
||||||
|
'common.retry': '重试',
|
||||||
|
'common.all': '全部',
|
||||||
|
'common.operation': '操作',
|
||||||
|
'common.remove': '移除',
|
||||||
|
'common.revoked': '已撤销',
|
||||||
|
'common.deleteConfirm': '确认删除?',
|
||||||
|
'common.deleteSuccess': '删除成功',
|
||||||
|
'common.deleteFailed': '删除失败',
|
||||||
|
'common.addSuccess': '添加成功',
|
||||||
|
'common.addFailed': '添加失败',
|
||||||
|
'common.editSuccess': '编辑成功',
|
||||||
|
'common.editFailed': '编辑失败',
|
||||||
|
'common.saveSuccess': '保存成功',
|
||||||
|
'common.saveFailed': '保存失败',
|
||||||
|
'common.operationSuccess': '操作成功',
|
||||||
|
'common.operationFailed': '操作失败',
|
||||||
|
'common.removeSuccess': '移除成功',
|
||||||
|
'common.removeFailed': '移除失败',
|
||||||
};
|
};
|
||||||
|
|
|
@ -189,7 +189,8 @@
|
||||||
() => props.keyword,
|
() => props.keyword,
|
||||||
() => {
|
() => {
|
||||||
fetchData();
|
fetchData();
|
||||||
}
|
},
|
||||||
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,11 @@
|
||||||
</div>
|
</div>
|
||||||
<ms-base-table class="mt-[16px]" v-bind="propsRes" v-on="propsEvent">
|
<ms-base-table class="mt-[16px]" v-bind="propsRes" v-on="propsEvent">
|
||||||
<template #operation="{ record }">
|
<template #operation="{ record }">
|
||||||
<ms-button @click="handleRemove(record)">{{ t('system.organization.remove') }}</ms-button>
|
<MsRemoveButton
|
||||||
|
:title="t('system.organization.removeName', { name: record.name })"
|
||||||
|
:sub-title-tip="t('system.organization.removeTip')"
|
||||||
|
@ok="handleRemove(record)"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</ms-base-table>
|
</ms-base-table>
|
||||||
</div>
|
</div>
|
||||||
|
@ -31,7 +35,10 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { postUserTableByOrgId } from '@/api/modules/setting/system/organizationAndProject';
|
import {
|
||||||
|
postUserTableByOrgId,
|
||||||
|
deleteUserFromOrgOrProject,
|
||||||
|
} from '@/api/modules/setting/system/organizationAndProject';
|
||||||
import { MsTableColumn } from '@/components/pure/ms-table/type';
|
import { MsTableColumn } from '@/components/pure/ms-table/type';
|
||||||
import useTable from '@/components/pure/ms-table/useTable';
|
import useTable from '@/components/pure/ms-table/useTable';
|
||||||
import { useI18n } from '@/hooks/useI18n';
|
import { useI18n } from '@/hooks/useI18n';
|
||||||
|
@ -39,8 +46,8 @@
|
||||||
import MsDrawer from '@/components/pure/ms-drawer/index.vue';
|
import MsDrawer from '@/components/pure/ms-drawer/index.vue';
|
||||||
import MsBaseTable from '@/components/pure/ms-table/base-table.vue';
|
import MsBaseTable from '@/components/pure/ms-table/base-table.vue';
|
||||||
import AddUserModal from './addUserModal.vue';
|
import AddUserModal from './addUserModal.vue';
|
||||||
import { TableData } from '@arco-design/web-vue';
|
import { TableData, Message } from '@arco-design/web-vue';
|
||||||
import MsButton from '@/components/pure/ms-button/index.vue';
|
import MsRemoveButton from '@/components/bussiness/ms-remove-button/MsRemoveButton.vue';
|
||||||
|
|
||||||
export interface projectDrawerProps {
|
export interface projectDrawerProps {
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
|
@ -71,7 +78,7 @@
|
||||||
title: 'system.organization.phone',
|
title: 'system.organization.phone',
|
||||||
dataIndex: 'phone',
|
dataIndex: 'phone',
|
||||||
},
|
},
|
||||||
{ title: 'system.organization.operation', dataIndex: 'operation' },
|
{ title: 'system.organization.operation', slotName: 'operation' },
|
||||||
];
|
];
|
||||||
|
|
||||||
const { propsRes, propsEvent, loadList, setLoadListParams, setKeyword } = useTable(postUserTableByOrgId, {
|
const { propsRes, propsEvent, loadList, setLoadListParams, setKeyword } = useTable(postUserTableByOrgId, {
|
||||||
|
@ -93,6 +100,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
|
setLoadListParams({ organizationId: props.organizationId });
|
||||||
await loadList();
|
await loadList();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -104,16 +112,21 @@
|
||||||
userVisible.value = false;
|
userVisible.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleRemove = (record: TableData) => {
|
const handleRemove = async (record: TableData) => {
|
||||||
// TODO: remove user
|
deleteUserFromOrgOrProject(props.organizationId, record.id)
|
||||||
// eslint-disable-next-line no-console
|
.then(() => {
|
||||||
console.log(record);
|
Message.success(t('common.removeSuccess'));
|
||||||
|
fetchData();
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.organizationId,
|
() => props.organizationId,
|
||||||
(organizationId) => {
|
() => {
|
||||||
setLoadListParams({ organizationId });
|
|
||||||
fetchData();
|
fetchData();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -6,6 +6,8 @@ export default {
|
||||||
'system.organization.edit': 'Edit',
|
'system.organization.edit': 'Edit',
|
||||||
'system.organization.save': 'Save',
|
'system.organization.save': 'Save',
|
||||||
'system.organization.end': 'End',
|
'system.organization.end': 'End',
|
||||||
|
'system.organization.removeName': 'Confirm to remove {name} this user',
|
||||||
|
'system.organization.removeTip': 'After removal, the organization permission will be lost',
|
||||||
'system.organization.addMember': 'Add Member',
|
'system.organization.addMember': 'Add Member',
|
||||||
'system.organization.addMemberPlaceholder': 'Please select member',
|
'system.organization.addMemberPlaceholder': 'Please select member',
|
||||||
'system.organization.addMemberRequired': 'Please select member',
|
'system.organization.addMemberRequired': 'Please select member',
|
||||||
|
|
|
@ -6,7 +6,8 @@ export default {
|
||||||
'system.organization.edit': '编辑',
|
'system.organization.edit': '编辑',
|
||||||
'system.organization.save': '保存',
|
'system.organization.save': '保存',
|
||||||
'system.organization.end': '结束',
|
'system.organization.end': '结束',
|
||||||
'system.organization.remove': '移除',
|
'system.organization.removeName': '确认移除 {name} 这个用户吗',
|
||||||
|
'system.organization.removeTip': '移除后,将失去组织权限',
|
||||||
'system.organization.addMember': '添加成员',
|
'system.organization.addMember': '添加成员',
|
||||||
'system.organization.addMemberPlaceholder': '请选择成员',
|
'system.organization.addMemberPlaceholder': '请选择成员',
|
||||||
'system.organization.addMemberRequired': '请选择成员',
|
'system.organization.addMemberRequired': '请选择成员',
|
||||||
|
|
Loading…
Reference in New Issue