feat(系统设置): 组织与项目数量&代码结构调整
This commit is contained in:
parent
7bb1602c5c
commit
dbbac51244
|
@ -1,5 +1,5 @@
|
||||||
import MSR from '@/api/http/index';
|
import MSR from '@/api/http/index';
|
||||||
import * as orgUrl from '@/api/requrls/setting/system/organizationAndProject';
|
import * as orgUrl from '@/api/requrls/setting/organizationAndProject';
|
||||||
import { TableQueryParams } from '@/models/common';
|
import { TableQueryParams } from '@/models/common';
|
||||||
import { AddUserToOrgOrProjectParams } from '@/models/setting/systemOrg';
|
import { AddUserToOrgOrProjectParams } from '@/models/setting/systemOrg';
|
||||||
import {
|
import {
|
||||||
|
@ -91,3 +91,8 @@ export function createOrUpdateProject(data: CreateOrUpdateSystemProjectParams) {
|
||||||
export function getAllUser() {
|
export function getAllUser() {
|
||||||
return MSR.get({ url: orgUrl.getOrgOrProjectAdminUrl });
|
return MSR.get({ url: orgUrl.getOrgOrProjectAdminUrl });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取项目和组织的总数
|
||||||
|
export function getOrgAndProjectCount() {
|
||||||
|
return MSR.get({ url: orgUrl.getOrgAndProjectCountUrl });
|
||||||
|
}
|
|
@ -52,3 +52,6 @@ export const getEnableProjectUrl = '/system/project/enable/';
|
||||||
export const getDisableProjectUrl = '/system/project/disable/';
|
export const getDisableProjectUrl = '/system/project/disable/';
|
||||||
// 获取组织或项目的管理员
|
// 获取组织或项目的管理员
|
||||||
export const getOrgOrProjectAdminUrl = '/system/project/user-list';
|
export const getOrgOrProjectAdminUrl = '/system/project/user-list';
|
||||||
|
|
||||||
|
// 获取项目和组织的总数
|
||||||
|
export const getOrgAndProjectCountUrl = '/system/organization/total';
|
|
@ -23,7 +23,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useI18n } from '@/hooks/useI18n';
|
import { useI18n } from '@/hooks/useI18n';
|
||||||
import { ref, onMounted, watch } from 'vue';
|
import { ref, onMounted, watch } from 'vue';
|
||||||
import { getUserByOrganizationOrProject, getAllUser } from '@/api/modules/setting/system/organizationAndProject';
|
import { getUserByOrganizationOrProject, getAllUser } from '@/api/modules/setting/organizationAndProject';
|
||||||
|
|
||||||
export interface MsUserSelectorProps {
|
export interface MsUserSelectorProps {
|
||||||
value: string[];
|
value: string[];
|
||||||
|
@ -100,3 +100,4 @@
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
@/api/modules/setting/organizationAndProject
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
import { reactive, ref, watchEffect, computed } from 'vue';
|
import { reactive, ref, watchEffect, computed } from 'vue';
|
||||||
import type { FormInstance, ValidatedError } from '@arco-design/web-vue';
|
import type { FormInstance, ValidatedError } from '@arco-design/web-vue';
|
||||||
import MsUserSelector from '@/components/business/ms-user-selector/index.vue';
|
import MsUserSelector from '@/components/business/ms-user-selector/index.vue';
|
||||||
import { createOrUpdateOrg } from '@/api/modules/setting/system/organizationAndProject';
|
import { createOrUpdateOrg } from '@/api/modules/setting/organizationAndProject';
|
||||||
import { Message } from '@arco-design/web-vue';
|
import { Message } from '@arco-design/web-vue';
|
||||||
import { CreateOrUpdateSystemOrgParams } from '@/models/setting/system/orgAndProject';
|
import { CreateOrUpdateSystemOrgParams } from '@/models/setting/system/orgAndProject';
|
||||||
|
|
||||||
|
@ -119,3 +119,4 @@
|
||||||
});
|
});
|
||||||
const isEdit = computed(() => !!props.currentOrganization?.id);
|
const isEdit = computed(() => !!props.currentOrganization?.id);
|
||||||
</script>
|
</script>
|
||||||
|
@/api/modules/setting/organizationAndProject
|
||||||
|
|
|
@ -85,7 +85,7 @@
|
||||||
import { reactive, ref, watchEffect, computed } from 'vue';
|
import { reactive, ref, watchEffect, computed } from 'vue';
|
||||||
import type { FormInstance, ValidatedError } from '@arco-design/web-vue';
|
import type { FormInstance, ValidatedError } from '@arco-design/web-vue';
|
||||||
import MsUserSelector from '@/components/business/ms-user-selector/index.vue';
|
import MsUserSelector from '@/components/business/ms-user-selector/index.vue';
|
||||||
import { createOrUpdateProject, getSystemOrgOption } from '@/api/modules/setting/system/organizationAndProject';
|
import { createOrUpdateProject, getSystemOrgOption } from '@/api/modules/setting/organizationAndProject';
|
||||||
import { Message } from '@arco-design/web-vue';
|
import { Message } from '@arco-design/web-vue';
|
||||||
import MsIcon from '@/components/pure/ms-icon-font/index.vue';
|
import MsIcon from '@/components/pure/ms-icon-font/index.vue';
|
||||||
import { CreateOrUpdateSystemProjectParams, SystemOrgOption } from '@/models/setting/system/orgAndProject';
|
import { CreateOrUpdateSystemProjectParams, SystemOrgOption } from '@/models/setting/system/orgAndProject';
|
||||||
|
@ -184,3 +184,4 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@/api/modules/setting/organizationAndProject
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useI18n } from '@/hooks/useI18n';
|
import { useI18n } from '@/hooks/useI18n';
|
||||||
import { reactive, ref, watchEffect, onUnmounted } from 'vue';
|
import { reactive, ref, watchEffect, onUnmounted } from 'vue';
|
||||||
import { addUserToOrgOrProject } from '@/api/modules/setting/system/organizationAndProject';
|
import { addUserToOrgOrProject } from '@/api/modules/setting/organizationAndProject';
|
||||||
import { Message, type FormInstance, type ValidatedError } from '@arco-design/web-vue';
|
import { Message, type FormInstance, type ValidatedError } from '@arco-design/web-vue';
|
||||||
import MsUserSelector from '@/components/business/ms-user-selector/index.vue';
|
import MsUserSelector from '@/components/business/ms-user-selector/index.vue';
|
||||||
|
|
||||||
|
@ -101,3 +101,4 @@
|
||||||
color: var(--color-text-4);
|
color: var(--color-text-4);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@/api/modules/setting/organizationAndProject
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { postProjectTableByOrgId } from '@/api/modules/setting/system/organizationAndProject';
|
import { postProjectTableByOrgId } from '@/api/modules/setting/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';
|
||||||
|
@ -104,3 +104,4 @@
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
@/api/modules/setting/organizationAndProject
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
deleteOrg,
|
deleteOrg,
|
||||||
enableOrDisableOrg,
|
enableOrDisableOrg,
|
||||||
revokeDeleteOrg,
|
revokeDeleteOrg,
|
||||||
} from '@/api/modules/setting/system/organizationAndProject';
|
} from '@/api/modules/setting/organizationAndProject';
|
||||||
import { TableKeyEnum } from '@/enums/tableEnum';
|
import { TableKeyEnum } from '@/enums/tableEnum';
|
||||||
import { MsTableColumn } from '@/components/pure/ms-table/type';
|
import { MsTableColumn } from '@/components/pure/ms-table/type';
|
||||||
import MsTableMoreAction from '@/components/pure/ms-table-more-action/index.vue';
|
import MsTableMoreAction from '@/components/pure/ms-table-more-action/index.vue';
|
||||||
|
@ -285,3 +285,4 @@
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@/api/modules/setting/organizationAndProject
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
deleteProject,
|
deleteProject,
|
||||||
enableOrDisableProject,
|
enableOrDisableProject,
|
||||||
revokeDeleteProject,
|
revokeDeleteProject,
|
||||||
} from '@/api/modules/setting/system/organizationAndProject';
|
} from '@/api/modules/setting/organizationAndProject';
|
||||||
import { TableKeyEnum } from '@/enums/tableEnum';
|
import { TableKeyEnum } from '@/enums/tableEnum';
|
||||||
import { MsTableColumn } from '@/components/pure/ms-table/type';
|
import { MsTableColumn } from '@/components/pure/ms-table/type';
|
||||||
import MsTableMoreAction from '@/components/pure/ms-table-more-action/index.vue';
|
import MsTableMoreAction from '@/components/pure/ms-table-more-action/index.vue';
|
||||||
|
@ -278,3 +278,4 @@
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@/api/modules/setting/organizationAndProject
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
import {
|
import {
|
||||||
postUserTableByOrgIdOrProjectId,
|
postUserTableByOrgIdOrProjectId,
|
||||||
deleteUserFromOrgOrProject,
|
deleteUserFromOrgOrProject,
|
||||||
} from '@/api/modules/setting/system/organizationAndProject';
|
} from '@/api/modules/setting/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';
|
||||||
|
@ -161,3 +161,4 @@
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
@/api/modules/setting/organizationAndProject
|
||||||
|
|
|
@ -33,13 +33,14 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, onMounted, watch, nextTick } from 'vue';
|
import { ref, watch, nextTick, onBeforeMount } from 'vue';
|
||||||
import { useI18n } from '@/hooks/useI18n';
|
import { useI18n } from '@/hooks/useI18n';
|
||||||
import MsCard from '@/components/pure/ms-card/index.vue';
|
import MsCard from '@/components/pure/ms-card/index.vue';
|
||||||
import AddOrganizationModal from './components/addOrganizationModal.vue';
|
import AddOrganizationModal from './components/addOrganizationModal.vue';
|
||||||
import SystemOrganization from './components/systemOrganization.vue';
|
import SystemOrganization from './components/systemOrganization.vue';
|
||||||
import SystemProject from './components/systemProject.vue';
|
import SystemProject from './components/systemProject.vue';
|
||||||
import AddProjectModal from './components/addProjectModal.vue';
|
import AddProjectModal from './components/addProjectModal.vue';
|
||||||
|
import { getOrgAndProjectCount } from '@/api/modules/setting/organizationAndProject';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const currentTable = ref('project');
|
const currentTable = ref('project');
|
||||||
|
@ -94,13 +95,27 @@
|
||||||
tableSearch();
|
tableSearch();
|
||||||
organizationVisible.value = false;
|
organizationVisible.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 初始化项目数量和组织数量
|
||||||
|
const initOrgAndProjectCount = async () => {
|
||||||
|
try {
|
||||||
|
const res = await getOrgAndProjectCount();
|
||||||
|
organizationCount.value = res.organizationTotal;
|
||||||
|
projectCount.value = res.projectTotal;
|
||||||
|
} catch (error) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => currentTable.value,
|
() => currentTable.value,
|
||||||
() => {
|
() => {
|
||||||
tableSearch();
|
tableSearch();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
onMounted(() => {
|
onBeforeMount(() => {
|
||||||
tableSearch();
|
tableSearch();
|
||||||
|
initOrgAndProjectCount();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useI18n } from '@/hooks/useI18n';
|
import { useI18n } from '@/hooks/useI18n';
|
||||||
import { reactive, ref, watchEffect, onUnmounted, onMounted } from 'vue';
|
import { reactive, ref, watchEffect, onMounted } from 'vue';
|
||||||
import { UserTableItem } from '@/models/setting/usergroup';
|
import { UserTableItem } from '@/models/setting/usergroup';
|
||||||
import { useUserGroupStore } from '@/store';
|
import { useUserGroupStore } from '@/store';
|
||||||
import { getUserList, addUserToUserGroup } from '@/api/modules/setting/usergroup';
|
import { getUserList, addUserToUserGroup } from '@/api/modules/setting/usergroup';
|
||||||
|
@ -78,30 +78,32 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
|
labelCache.clear();
|
||||||
|
form.name = [];
|
||||||
emit('cancel');
|
emit('cancel');
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleBeforeOk = () => {
|
const handleBeforeOk = () => {
|
||||||
loading.value = true;
|
|
||||||
formRef.value?.validate(async (errors: undefined | Record<string, ValidatedError>) => {
|
formRef.value?.validate(async (errors: undefined | Record<string, ValidatedError>) => {
|
||||||
if (errors) {
|
if (errors) {
|
||||||
loading.value = false;
|
return;
|
||||||
return false;
|
}
|
||||||
|
try {
|
||||||
|
loading.value = true;
|
||||||
|
await addUserToUserGroup({ roleId: store.currentId, userIds: form.name });
|
||||||
|
handleCancel();
|
||||||
|
} catch (e) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log(e);
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
}
|
}
|
||||||
await addUserToUserGroup({ roleId: store.currentId, userIds: form.name });
|
|
||||||
return true;
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
initUserList();
|
initUserList();
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
|
||||||
labelCache.clear();
|
|
||||||
form.name = [];
|
|
||||||
loading.value = false;
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|
|
@ -187,6 +187,7 @@
|
||||||
item.indeterminate = false;
|
item.indeterminate = false;
|
||||||
item.perChecked = allChecked.value ? item.permissions?.map((ele) => ele.id) : [];
|
item.perChecked = allChecked.value ? item.permissions?.map((ele) => ele.id) : [];
|
||||||
});
|
});
|
||||||
|
if (!canSave.value) canSave.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 表格总全选联动触发事件
|
// 表格总全选联动触发事件
|
||||||
|
|
|
@ -80,6 +80,7 @@
|
||||||
userVisible.value = true;
|
userVisible.value = true;
|
||||||
};
|
};
|
||||||
const handleAddUserModalCancel = () => {
|
const handleAddUserModalCancel = () => {
|
||||||
|
fetchData();
|
||||||
userVisible.value = false;
|
userVisible.value = false;
|
||||||
};
|
};
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
|
|
Loading…
Reference in New Issue