feat(系统设置): 项目增加资源池参数
This commit is contained in:
parent
c6ba62bf15
commit
15711f3a31
|
@ -167,3 +167,11 @@ export function getUserByProjectByOrg(organizationId: string, projectId: string,
|
|||
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 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[];
|
||||
// 所属组织
|
||||
organizationId?: string;
|
||||
// 资源池
|
||||
resourcePoolIds: string[];
|
||||
// 列表里的
|
||||
}
|
||||
|
||||
|
@ -31,6 +33,7 @@ export interface CreateOrUpdateOrgProjectParams {
|
|||
enable?: boolean;
|
||||
userIds?: string[];
|
||||
organizationId?: string;
|
||||
resourcePoolIds?: string[];
|
||||
}
|
||||
|
||||
export interface SystemOrgOption {
|
||||
|
@ -54,4 +57,5 @@ export interface OrgProjectTableItem {
|
|||
createTime: number;
|
||||
memberCount: number;
|
||||
userIds: string[];
|
||||
resourcePoolIds: string[];
|
||||
}
|
||||
|
|
|
@ -23,13 +23,14 @@
|
|||
:label="t('system.project.name')"
|
||||
: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 field="organizationId" :label="t('system.project.affiliatedOrg')">
|
||||
<a-select
|
||||
v-model="form.organizationId"
|
||||
disabled
|
||||
allow-search
|
||||
allow-clear
|
||||
:options="affiliatedOrgOption"
|
||||
:default-value="isXpack ? '' : '100001'"
|
||||
:placeholder="t('system.project.affiliatedOrgPlaceholder')"
|
||||
|
@ -54,8 +55,16 @@
|
|||
</template>
|
||||
</a-checkbox-group>
|
||||
</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-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>
|
||||
</div>
|
||||
|
@ -93,6 +102,7 @@
|
|||
import useLicenseStore from '@/store/modules/setting/license';
|
||||
import { useAppStore } from '@/store';
|
||||
import { UserRequesetTypeEnum } from '@/components/business/ms-user-selector/utils';
|
||||
import MsSystemPool from '@/components/business/ms-system-pool/MsSystemPool.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps<{
|
||||
|
@ -127,6 +137,7 @@
|
|||
userIds: [],
|
||||
organizationId: currentOrgId.value,
|
||||
description: '',
|
||||
resourcePoolIds: [],
|
||||
enable: true,
|
||||
moduleIds: [],
|
||||
});
|
||||
|
@ -148,6 +159,7 @@
|
|||
form.description = '';
|
||||
form.enable = true;
|
||||
form.moduleIds = [];
|
||||
form.resourcePoolIds = [];
|
||||
};
|
||||
const handleCancel = (shouldSearch: boolean) => {
|
||||
formReset();
|
||||
|
@ -193,6 +205,7 @@
|
|||
form.userIds = props.currentProject.userIds;
|
||||
form.organizationId = props.currentProject.organizationId;
|
||||
form.moduleIds = props.currentProject.moduleIds;
|
||||
form.resourcePoolIds = props.currentProject.resourcePoolIds;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -73,4 +73,5 @@ export default {
|
|||
'system.project.affiliatedOrgRequired': 'Affiliated organization cannot be empty',
|
||||
'system.project.createProjectSuccess': 'Create project success',
|
||||
'system.project.updateProjectSuccess': 'Update project success',
|
||||
'system.project.resourcePool': 'Resource pool',
|
||||
};
|
||||
|
|
|
@ -68,4 +68,5 @@ export default {
|
|||
'system.project.affiliatedOrgRequired': '所属组织不能为空',
|
||||
'system.project.createProjectSuccess': '创建项目成功',
|
||||
'system.project.updateProjectSuccess': '更新项目成功',
|
||||
'system.project.resourcePool': '资源池',
|
||||
};
|
||||
|
|
|
@ -250,7 +250,7 @@
|
|||
};
|
||||
|
||||
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 = {
|
||||
id,
|
||||
name,
|
||||
|
@ -259,6 +259,7 @@
|
|||
userIds: adminList.map((item: UserItem) => item.id),
|
||||
organizationId,
|
||||
moduleIds,
|
||||
resourcePoolIds: resourcePoolList.map((item: { id: string }) => item.id),
|
||||
};
|
||||
addProjectVisible.value = true;
|
||||
};
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<template>
|
||||
<a-modal
|
||||
v-model:visible="currentVisible"
|
||||
width="680px"
|
||||
class="ms-modal-form ms-modal-medium"
|
||||
:ok-text="isEdit ? t('common.update') : t('common.create')"
|
||||
title-align="start"
|
||||
|
@ -18,7 +17,7 @@
|
|||
</span>
|
||||
</template>
|
||||
<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
|
||||
field="name"
|
||||
required
|
||||
|
@ -51,9 +50,6 @@
|
|||
placeholder="system.project.projectAdminPlaceholder"
|
||||
/>
|
||||
</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-checkbox-group v-model="form.moduleIds" :options="moduleOption">
|
||||
<template #label="{ data }">
|
||||
|
@ -61,6 +57,17 @@
|
|||
</template>
|
||||
</a-checkbox-group>
|
||||
</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>
|
||||
</div>
|
||||
<template #footer>
|
||||
|
@ -96,6 +103,7 @@
|
|||
import { CreateOrUpdateSystemProjectParams, SystemOrgOption } from '@/models/setting/system/orgAndProject';
|
||||
import useLicenseStore from '@/store/modules/setting/license';
|
||||
import { UserRequesetTypeEnum } from '@/components/business/ms-user-selector/utils';
|
||||
import MsSystemPool from '@/components/business/ms-system-pool/MsSystemPool.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps<{
|
||||
|
@ -130,6 +138,7 @@
|
|||
description: '',
|
||||
enable: true,
|
||||
moduleIds: [],
|
||||
resourcePoolIds: [],
|
||||
});
|
||||
|
||||
const currentVisible = ref(props.visible);
|
||||
|
@ -151,8 +160,8 @@
|
|||
form.moduleIds = [];
|
||||
};
|
||||
const handleCancel = (shouldSearch: boolean) => {
|
||||
formReset();
|
||||
emit('cancel', shouldSearch);
|
||||
formReset();
|
||||
};
|
||||
|
||||
const handleBeforeOk = async () => {
|
||||
|
@ -195,6 +204,7 @@
|
|||
form.userIds = props.currentProject.userIds;
|
||||
form.organizationId = props.currentProject.organizationId;
|
||||
form.moduleIds = props.currentProject.moduleIds;
|
||||
form.resourcePoolIds = props.currentProject.resourcePoolIds;
|
||||
}
|
||||
});
|
||||
</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(
|
||||
postProjectTable,
|
||||
{
|
||||
columns: organizationColumns,
|
||||
tableKey: TableKeyEnum.SYSTEM_PROJECT,
|
||||
scroll: { x: '1600px' },
|
||||
selectable: false,
|
||||
noDisable: false,
|
||||
size: 'default',
|
||||
// showSetting: true,
|
||||
showSetting: true,
|
||||
editKey: 'name',
|
||||
},
|
||||
undefined,
|
||||
|
@ -235,7 +234,7 @@
|
|||
};
|
||||
|
||||
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;
|
||||
currentUpdateProject.value = {
|
||||
id,
|
||||
|
@ -245,6 +244,7 @@
|
|||
userIds: adminList.map((item: UserItem) => item.id),
|
||||
organizationId,
|
||||
moduleIds,
|
||||
resourcePoolIds: resourcePoolList.map((item: { id: string }) => item.id),
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue