feat(系统设置): 项目增加资源池参数
This commit is contained in:
parent
c6ba62bf15
commit
15711f3a31
|
@ -167,3 +167,11 @@ export function getUserByProjectByOrg(organizationId: string, projectId: string,
|
||||||
params: { keyword },
|
params: { keyword },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 系统或组织-获取项目下的资源池options
|
||||||
|
export function getPoolOptionsByOrgOrSystem(organizationId?: string) {
|
||||||
|
return MSR.get({
|
||||||
|
url: orgUrl.getProjectPoolByOrgOrSystemUrl,
|
||||||
|
params: { organizationId },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -86,3 +86,5 @@ export const getDeleteProjectByOrgUrl = '/organization/project/delete/';
|
||||||
export const getUserByOrganizationOrProjectUrl = '/organization/project/user-member-list/';
|
export const getUserByOrganizationOrProjectUrl = '/organization/project/user-member-list/';
|
||||||
// 获取管理员下拉选项
|
// 获取管理员下拉选项
|
||||||
export const getAdminByOrganizationOrProjectUrl = '/organization/project/user-admin-list/';
|
export const getAdminByOrganizationOrProjectUrl = '/organization/project/user-admin-list/';
|
||||||
|
// 系统或组织-获取项目资源池下拉选项
|
||||||
|
export const getProjectPoolByOrgOrSystemUrl = '/system/project/pool-options';
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
<template>
|
||||||
|
<a-select v-model="value" multiple allow-search allow-clear :options="options" :field-names="fieldNames" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, watchEffect, computed } from 'vue';
|
||||||
|
import { getPoolOptionsByOrgOrSystem } from '@/api/modules/setting/organizationAndProject';
|
||||||
|
|
||||||
|
const options = ref([]);
|
||||||
|
const fieldNames = { value: 'id', label: 'name' };
|
||||||
|
const props = defineProps<{ organizationId?: string; modelValue: string[] }>();
|
||||||
|
const loading = ref(false);
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'update:modelValue', value: string[]): void;
|
||||||
|
}>();
|
||||||
|
const value = computed({
|
||||||
|
get() {
|
||||||
|
return props.modelValue;
|
||||||
|
},
|
||||||
|
set(v) {
|
||||||
|
emit('update:modelValue', v);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const loadList = async (id?: string) => {
|
||||||
|
try {
|
||||||
|
loading.value = true;
|
||||||
|
options.value = await getPoolOptionsByOrgOrSystem(id);
|
||||||
|
} catch (error) {
|
||||||
|
options.value = [];
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log(error);
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
watchEffect(() => {
|
||||||
|
loadList(props.organizationId);
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -21,6 +21,8 @@ export interface CreateOrUpdateSystemProjectParams {
|
||||||
moduleIds?: string[];
|
moduleIds?: string[];
|
||||||
// 所属组织
|
// 所属组织
|
||||||
organizationId?: string;
|
organizationId?: string;
|
||||||
|
// 资源池
|
||||||
|
resourcePoolIds: string[];
|
||||||
// 列表里的
|
// 列表里的
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +33,7 @@ export interface CreateOrUpdateOrgProjectParams {
|
||||||
enable?: boolean;
|
enable?: boolean;
|
||||||
userIds?: string[];
|
userIds?: string[];
|
||||||
organizationId?: string;
|
organizationId?: string;
|
||||||
|
resourcePoolIds?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SystemOrgOption {
|
export interface SystemOrgOption {
|
||||||
|
@ -54,4 +57,5 @@ export interface OrgProjectTableItem {
|
||||||
createTime: number;
|
createTime: number;
|
||||||
memberCount: number;
|
memberCount: number;
|
||||||
userIds: string[];
|
userIds: string[];
|
||||||
|
resourcePoolIds: string[];
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,13 +23,14 @@
|
||||||
:label="t('system.project.name')"
|
:label="t('system.project.name')"
|
||||||
:rules="[{ required: true, message: t('system.project.projectNameRequired') }]"
|
:rules="[{ required: true, message: t('system.project.projectNameRequired') }]"
|
||||||
>
|
>
|
||||||
<a-input v-model="form.name" :placeholder="t('system.project.projectNamePlaceholder')" />
|
<a-input v-model="form.name" allow-clear :placeholder="t('system.project.projectNamePlaceholder')" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item field="organizationId" :label="t('system.project.affiliatedOrg')">
|
<a-form-item field="organizationId" :label="t('system.project.affiliatedOrg')">
|
||||||
<a-select
|
<a-select
|
||||||
v-model="form.organizationId"
|
v-model="form.organizationId"
|
||||||
disabled
|
disabled
|
||||||
allow-search
|
allow-search
|
||||||
|
allow-clear
|
||||||
:options="affiliatedOrgOption"
|
:options="affiliatedOrgOption"
|
||||||
:default-value="isXpack ? '' : '100001'"
|
:default-value="isXpack ? '' : '100001'"
|
||||||
:placeholder="t('system.project.affiliatedOrgPlaceholder')"
|
:placeholder="t('system.project.affiliatedOrgPlaceholder')"
|
||||||
|
@ -54,8 +55,16 @@
|
||||||
</template>
|
</template>
|
||||||
</a-checkbox-group>
|
</a-checkbox-group>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<a-form-item field="resourcePool" :label="t('system.project.resourcePool')">
|
||||||
|
<MsSystemPool v-model:modelValue="form.resourcePoolIds" :organization-id="currentOrgId" />
|
||||||
|
</a-form-item>
|
||||||
<a-form-item field="description" :label="t('system.organization.description')">
|
<a-form-item field="description" :label="t('system.organization.description')">
|
||||||
<a-input v-model="form.description" :placeholder="t('system.organization.descriptionPlaceholder')" />
|
<a-textarea
|
||||||
|
v-model="form.description"
|
||||||
|
:placeholder="t('system.organization.descriptionPlaceholder')"
|
||||||
|
allow-clear
|
||||||
|
:auto-size="{ minRows: 1 }"
|
||||||
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -93,6 +102,7 @@
|
||||||
import useLicenseStore from '@/store/modules/setting/license';
|
import useLicenseStore from '@/store/modules/setting/license';
|
||||||
import { useAppStore } from '@/store';
|
import { useAppStore } from '@/store';
|
||||||
import { UserRequesetTypeEnum } from '@/components/business/ms-user-selector/utils';
|
import { UserRequesetTypeEnum } from '@/components/business/ms-user-selector/utils';
|
||||||
|
import MsSystemPool from '@/components/business/ms-system-pool/MsSystemPool.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
@ -127,6 +137,7 @@
|
||||||
userIds: [],
|
userIds: [],
|
||||||
organizationId: currentOrgId.value,
|
organizationId: currentOrgId.value,
|
||||||
description: '',
|
description: '',
|
||||||
|
resourcePoolIds: [],
|
||||||
enable: true,
|
enable: true,
|
||||||
moduleIds: [],
|
moduleIds: [],
|
||||||
});
|
});
|
||||||
|
@ -148,6 +159,7 @@
|
||||||
form.description = '';
|
form.description = '';
|
||||||
form.enable = true;
|
form.enable = true;
|
||||||
form.moduleIds = [];
|
form.moduleIds = [];
|
||||||
|
form.resourcePoolIds = [];
|
||||||
};
|
};
|
||||||
const handleCancel = (shouldSearch: boolean) => {
|
const handleCancel = (shouldSearch: boolean) => {
|
||||||
formReset();
|
formReset();
|
||||||
|
@ -193,6 +205,7 @@
|
||||||
form.userIds = props.currentProject.userIds;
|
form.userIds = props.currentProject.userIds;
|
||||||
form.organizationId = props.currentProject.organizationId;
|
form.organizationId = props.currentProject.organizationId;
|
||||||
form.moduleIds = props.currentProject.moduleIds;
|
form.moduleIds = props.currentProject.moduleIds;
|
||||||
|
form.resourcePoolIds = props.currentProject.resourcePoolIds;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -73,4 +73,5 @@ export default {
|
||||||
'system.project.affiliatedOrgRequired': 'Affiliated organization cannot be empty',
|
'system.project.affiliatedOrgRequired': 'Affiliated organization cannot be empty',
|
||||||
'system.project.createProjectSuccess': 'Create project success',
|
'system.project.createProjectSuccess': 'Create project success',
|
||||||
'system.project.updateProjectSuccess': 'Update project success',
|
'system.project.updateProjectSuccess': 'Update project success',
|
||||||
|
'system.project.resourcePool': 'Resource pool',
|
||||||
};
|
};
|
||||||
|
|
|
@ -68,4 +68,5 @@ export default {
|
||||||
'system.project.affiliatedOrgRequired': '所属组织不能为空',
|
'system.project.affiliatedOrgRequired': '所属组织不能为空',
|
||||||
'system.project.createProjectSuccess': '创建项目成功',
|
'system.project.createProjectSuccess': '创建项目成功',
|
||||||
'system.project.updateProjectSuccess': '更新项目成功',
|
'system.project.updateProjectSuccess': '更新项目成功',
|
||||||
|
'system.project.resourcePool': '资源池',
|
||||||
};
|
};
|
||||||
|
|
|
@ -250,7 +250,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const showAddProjectModal = (record: any) => {
|
const showAddProjectModal = (record: any) => {
|
||||||
const { id, name, description, enable, adminList, organizationId, moduleIds } = record;
|
const { id, name, description, enable, adminList, organizationId, moduleIds, resourcePoolList } = record;
|
||||||
currentUpdateProject.value = {
|
currentUpdateProject.value = {
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
|
@ -259,6 +259,7 @@
|
||||||
userIds: adminList.map((item: UserItem) => item.id),
|
userIds: adminList.map((item: UserItem) => item.id),
|
||||||
organizationId,
|
organizationId,
|
||||||
moduleIds,
|
moduleIds,
|
||||||
|
resourcePoolIds: resourcePoolList.map((item: { id: string }) => item.id),
|
||||||
};
|
};
|
||||||
addProjectVisible.value = true;
|
addProjectVisible.value = true;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<a-modal
|
<a-modal
|
||||||
v-model:visible="currentVisible"
|
v-model:visible="currentVisible"
|
||||||
width="680px"
|
|
||||||
class="ms-modal-form ms-modal-medium"
|
class="ms-modal-form ms-modal-medium"
|
||||||
:ok-text="isEdit ? t('common.update') : t('common.create')"
|
:ok-text="isEdit ? t('common.update') : t('common.create')"
|
||||||
title-align="start"
|
title-align="start"
|
||||||
|
@ -18,7 +17,7 @@
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<div class="form">
|
<div class="form">
|
||||||
<a-form ref="formRef" :model="form" :style="{ width: '600px' }" layout="vertical">
|
<a-form ref="formRef" :model="form" layout="vertical">
|
||||||
<a-form-item
|
<a-form-item
|
||||||
field="name"
|
field="name"
|
||||||
required
|
required
|
||||||
|
@ -51,9 +50,6 @@
|
||||||
placeholder="system.project.projectAdminPlaceholder"
|
placeholder="system.project.projectAdminPlaceholder"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item field="description" :label="t('system.organization.description')">
|
|
||||||
<a-input v-model="form.description" :placeholder="t('system.organization.descriptionPlaceholder')" />
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item field="module" :label="t('system.project.moduleSetting')">
|
<a-form-item field="module" :label="t('system.project.moduleSetting')">
|
||||||
<a-checkbox-group v-model="form.moduleIds" :options="moduleOption">
|
<a-checkbox-group v-model="form.moduleIds" :options="moduleOption">
|
||||||
<template #label="{ data }">
|
<template #label="{ data }">
|
||||||
|
@ -61,6 +57,17 @@
|
||||||
</template>
|
</template>
|
||||||
</a-checkbox-group>
|
</a-checkbox-group>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<a-form-item field="resourcePool" :label="t('system.project.resourcePool')">
|
||||||
|
<MsSystemPool v-model:modelValue="form.resourcePoolIds" :organization-id="form.organizationId" />
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item field="description" :label="t('system.organization.description')">
|
||||||
|
<a-textarea
|
||||||
|
v-model="form.description"
|
||||||
|
:placeholder="t('system.organization.descriptionPlaceholder')"
|
||||||
|
allow-clear
|
||||||
|
:auto-size="{ minRows: 1 }"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
</div>
|
</div>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
|
@ -96,6 +103,7 @@
|
||||||
import { CreateOrUpdateSystemProjectParams, SystemOrgOption } from '@/models/setting/system/orgAndProject';
|
import { CreateOrUpdateSystemProjectParams, SystemOrgOption } from '@/models/setting/system/orgAndProject';
|
||||||
import useLicenseStore from '@/store/modules/setting/license';
|
import useLicenseStore from '@/store/modules/setting/license';
|
||||||
import { UserRequesetTypeEnum } from '@/components/business/ms-user-selector/utils';
|
import { UserRequesetTypeEnum } from '@/components/business/ms-user-selector/utils';
|
||||||
|
import MsSystemPool from '@/components/business/ms-system-pool/MsSystemPool.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
@ -130,6 +138,7 @@
|
||||||
description: '',
|
description: '',
|
||||||
enable: true,
|
enable: true,
|
||||||
moduleIds: [],
|
moduleIds: [],
|
||||||
|
resourcePoolIds: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
const currentVisible = ref(props.visible);
|
const currentVisible = ref(props.visible);
|
||||||
|
@ -151,8 +160,8 @@
|
||||||
form.moduleIds = [];
|
form.moduleIds = [];
|
||||||
};
|
};
|
||||||
const handleCancel = (shouldSearch: boolean) => {
|
const handleCancel = (shouldSearch: boolean) => {
|
||||||
formReset();
|
|
||||||
emit('cancel', shouldSearch);
|
emit('cancel', shouldSearch);
|
||||||
|
formReset();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleBeforeOk = async () => {
|
const handleBeforeOk = async () => {
|
||||||
|
@ -195,6 +204,7 @@
|
||||||
form.userIds = props.currentProject.userIds;
|
form.userIds = props.currentProject.userIds;
|
||||||
form.organizationId = props.currentProject.organizationId;
|
form.organizationId = props.currentProject.organizationId;
|
||||||
form.moduleIds = props.currentProject.moduleIds;
|
form.moduleIds = props.currentProject.moduleIds;
|
||||||
|
form.resourcePoolIds = props.currentProject.resourcePoolIds;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -151,18 +151,17 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// tableStore.initColumn(TableKeyEnum.SYSTEM_PROJECT, organizationColumns, 'drawer');
|
tableStore.initColumn(TableKeyEnum.SYSTEM_PROJECT, organizationColumns, 'drawer');
|
||||||
|
|
||||||
const { propsRes, propsEvent, loadList, setKeyword } = useTable(
|
const { propsRes, propsEvent, loadList, setKeyword } = useTable(
|
||||||
postProjectTable,
|
postProjectTable,
|
||||||
{
|
{
|
||||||
columns: organizationColumns,
|
|
||||||
tableKey: TableKeyEnum.SYSTEM_PROJECT,
|
tableKey: TableKeyEnum.SYSTEM_PROJECT,
|
||||||
scroll: { x: '1600px' },
|
scroll: { x: '1600px' },
|
||||||
selectable: false,
|
selectable: false,
|
||||||
noDisable: false,
|
noDisable: false,
|
||||||
size: 'default',
|
size: 'default',
|
||||||
// showSetting: true,
|
showSetting: true,
|
||||||
editKey: 'name',
|
editKey: 'name',
|
||||||
},
|
},
|
||||||
undefined,
|
undefined,
|
||||||
|
@ -235,7 +234,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const showAddProjectModal = (record: any) => {
|
const showAddProjectModal = (record: any) => {
|
||||||
const { id, name, description, enable, adminList, organizationId, moduleIds } = record;
|
const { id, name, description, enable, adminList, organizationId, moduleIds, resourcePoolList } = record;
|
||||||
addProjectVisible.value = true;
|
addProjectVisible.value = true;
|
||||||
currentUpdateProject.value = {
|
currentUpdateProject.value = {
|
||||||
id,
|
id,
|
||||||
|
@ -245,6 +244,7 @@
|
||||||
userIds: adminList.map((item: UserItem) => item.id),
|
userIds: adminList.map((item: UserItem) => item.id),
|
||||||
organizationId,
|
organizationId,
|
||||||
moduleIds,
|
moduleIds,
|
||||||
|
resourcePoolIds: resourcePoolList.map((item: { id: string }) => item.id),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue