fix(项目管理): 修复应用管理保存传参

This commit is contained in:
RubyLiu 2024-02-01 16:38:05 +08:00 committed by Craftsman
parent 6fa3e4ad0f
commit f1e566062a
8 changed files with 102 additions and 21 deletions

View File

@ -167,14 +167,16 @@ export function getDeleteFake(data: FakeTableOperationParams) {
// JIRA插件key校验
export function validateJIRAKey(data: object, pluginId: string) {
return MSR.post<FakeTableListItem[]>({ url: `${Url.postValidateJiraKeyUrl}${pluginId}`, data });
return MSR.post<MenuTableConfigItem>({ url: `${Url.postValidateJiraKeyUrl}${pluginId}`, data });
}
// 缺陷管理-获取同步信息
export function getBugSyncInfo(projectId: string) {
return MSR.get<FakeTableListItem[]>({ url: `${Url.getBugSyncInfoUrl}${projectId}` });
return MSR.get<MenuTableConfigItem>({ url: `${Url.getBugSyncInfoUrl}${projectId}` });
}
// 用例管理-获取关联需求信息
export function getCaseRelatedInfo(projectId: string) {
return MSR.get<FakeTableListItem[]>({ url: `${Url.getCaseRelatedInfoUrl}${projectId}` });
return MSR.get<{ demand_platform_config: string; platform_key: string; case_enable: string }>({
url: `${Url.getCaseRelatedInfoUrl}${projectId}`,
});
}

View File

@ -1,10 +1,9 @@
<template>
<a-input
:value="props.modelValue"
v-model:model-value="inputValue"
:placeholder="t('project.menu.pleaseInputJiraKey')"
v-bind="attrs"
:max-length="255"
@change="(v: string) => emit('update:modelValue', v)"
@blur="handleBlur"
/>
<div class="flex flex-row items-center gap-[10px] text-[12px] leading-[16px]">
@ -22,6 +21,7 @@
</template>
<script setup lang="ts">
import { defineModel } from 'vue';
import { Message } from '@arco-design/web-vue';
import { validateJIRAKey } from '@/api/modules/project-management/menuManagement';
@ -29,16 +29,15 @@
import { useI18n } from '@/hooks/useI18n';
const attrs = useAttrs();
const { formCreateInject } = attrs;
const props = defineProps<{
modelValue: string;
instructionsIcon: string;
value?: string;
}>();
const previewIcon = ref<string>('');
const emit = defineEmits<{
(event: 'update:modelValue', value: string): void;
}>();
const inputValue = defineModel<string>();
const { t } = useI18n();
onMounted(() => {
@ -53,13 +52,18 @@
const pluginId = sessionStorage.getItem('platformKey') || '';
if (pluginId) {
try {
await validateJIRAKey({ name: '1231' }, pluginId);
await validateJIRAKey({ [(formCreateInject as { [key: string]: string }).field]: inputValue.value }, pluginId);
Message.success('common.validateSuccess');
} catch {
Message.error('common.validateFaild');
} catch (e) {
console.log(e);
}
}
};
watchEffect(() => {
if (props.value) {
inputValue.value = props.value;
}
});
</script>
<style scoped></style>

View File

@ -19,6 +19,8 @@
import { FormRuleItem } from './types';
import formCreate, { Rule } from '@form-create/arco-design';
defineOptions({ name: 'MsFormCreate' });
const { t } = useI18n();
formCreate.component('PassWord', PassWord);

View File

@ -83,7 +83,14 @@
<a-tooltip v-if="okDisabled" :content="t('project.menu.defect.enableAfterConfig')">
<a-switch size="small" type="line" disabled />
</a-tooltip>
<a-switch v-else v-model="form.SYNC_ENABLE" size="small" type="line" />
<a-switch
v-else
v-model="form.SYNC_ENABLE"
checked-value="true"
unchecked-value="false"
size="small"
type="line"
/>
<span class="text-[var(--color-text-1)]">
{{ t('project.menu.status') }}
</span>
@ -111,6 +118,7 @@
import type { FormItem, FormRuleItem } from '@/components/pure/ms-form-create/types';
import {
getBugSyncInfo,
getPlatformInfo,
getPlatformOptions,
postSaveDefectSync,
@ -129,6 +137,8 @@
const props = defineProps<{
visible: boolean;
}>();
const formCreateValue = ref<Record<string, any>>({});
const currentVisible = ref<boolean>(props.visible);
const platformOption = ref<PoolOption[]>([]);
const frequencyOption = ref([
@ -171,6 +181,13 @@
try {
if (value) {
const res = await getPlatformInfo(value as string, MenuEnum.bugManagement);
if (formCreateValue.value) {
res.formItems.forEach((item) => {
if (formCreateValue.value[item.name]) {
item.value = formCreateValue.value[item.name];
}
});
}
platformRules.value = res.formItems;
sessionStorage.setItem('platformKey', value as string);
} else {
@ -210,12 +227,30 @@
}
};
//
const initDetailInfo = async () => {
try {
await initPlatformOption();
const res = await getBugSyncInfo(currentProjectId.value);
if (res && res.platform_key) {
form.SYNC_ENABLE = res.sync_enable;
form.PLATFORM_KEY = res.platform_key;
formCreateValue.value = JSON.parse(res.bug_platform_config);
// keychange
await handlePlatformChange(res.platform_key);
}
} catch (e) {
// eslint-disable-next-line no-console
console.log(e);
}
};
watch(
() => props.visible,
(val) => {
currentVisible.value = val;
if (val) {
initPlatformOption();
initDetailInfo();
} else {
formRef.value?.resetFields();
platformRules.value = [];

View File

@ -40,7 +40,14 @@
<a-tooltip v-if="okDisabled" :content="t('project.menu.defect.enableAfterConfig')">
<a-switch size="small" type="line" disabled />
</a-tooltip>
<a-switch v-else v-model="form.SYNC_ENABLE" size="small" type="line" />
<a-switch
v-else
v-model="form.CASE_ENABLE"
checked-value="true"
unchecked-value="false"
size="small"
type="line"
/>
<span class="text-[var(--color-text-1)]">
{{ t('project.menu.status') }}
</span>
@ -68,6 +75,7 @@
import type { FormItem, FormRuleItem } from '@/components/pure/ms-form-create/types';
import {
getCaseRelatedInfo,
getPlatformInfo,
getPlatformOptions,
postSaveRelatedCase,
@ -98,9 +106,11 @@
const form = reactive({
PLATFORM_KEY: '',
SYNC_ENABLE: 'false', //
CASE_ENABLE: 'false', //
});
const formCreateValue = ref<Record<string, any>>({});
const okDisabled = computed(() => !form.PLATFORM_KEY);
const emit = defineEmits<{
@ -116,6 +126,13 @@
try {
if (value) {
const res = await getPlatformInfo(value as string, MenuEnum.caseManagement);
if (formCreateValue.value) {
res.formItems.forEach((item) => {
if (formCreateValue.value[item.name]) {
item.value = formCreateValue.value[item.name];
}
});
}
platformRules.value = res.formItems;
} else {
platformRules.value = [];
@ -156,13 +173,30 @@
console.log(error);
}
};
//
const initDetailInfo = async () => {
try {
await initPlatformOption();
const res = await getCaseRelatedInfo(currentProjectId.value);
if (res && res.platform_key) {
form.CASE_ENABLE = res.case_enable;
form.PLATFORM_KEY = res.platform_key;
formCreateValue.value = JSON.parse(res.demand_platform_config);
// keychange
await handlePlatformChange(res.platform_key);
}
} catch (e) {
// eslint-disable-next-line no-console
console.log(e);
}
};
watch(
() => props.visible,
(val) => {
currentVisible.value = val;
if (val) {
initPlatformOption();
initDetailInfo();
} else {
formRef.value?.resetFields();
platformRules.value = [];

View File

@ -142,7 +142,7 @@
(e: 'cancel', shouldSearch: boolean): void;
}>();
const allModuleIds = ['workstation', 'testPlan', 'bugManagement', 'caseManagement', 'apiTest', 'uiTest', 'loadTest'];
const allModuleIds = ['bugManagement', 'caseManagement', 'apiTest'];
const showPoolModuleIds = ['uiTest', 'apiTest', 'loadTest'];

View File

@ -9,7 +9,7 @@
}}</a-button>
<a-input-search
v-model="keyword"
:placeholder="t('system.user.searchUser')"
:placeholder="t('system.organization.searchIndexPlaceholder')"
class="w-[240px]"
allow-clear
@press-enter="fetchData"

View File

@ -60,7 +60,11 @@
</a-checkbox-group>
</a-form-item>
<a-form-item v-if="showPool" field="resourcePool" :label="t('system.project.resourcePool')">
<MsSystemPool v-model:modelValue="form.resourcePoolIds" :organization-id="form.organizationId" />
<MsSystemPool
v-model:modelValue="form.resourcePoolIds"
:module-ids="form.moduleIds"
:organization-id="form.organizationId"
/>
</a-form-item>
<a-form-item field="description" :label="t('system.organization.description')">
<a-textarea
@ -138,7 +142,7 @@
(e: 'cancel', shouldSearch: boolean): void;
}>();
const allModuleIds = ['workstation', 'testPlan', 'bugManagement', 'caseManagement', 'apiTest', 'uiTest', 'loadTest'];
const allModuleIds = ['bugManagement', 'caseManagement', 'apiTest'];
const showPoolModuleIds = ['uiTest', 'apiTest', 'loadTest'];