fix(用例管理): 修改紧急用例编辑回显bug

This commit is contained in:
xinxin.wu 2024-03-04 17:26:43 +08:00 committed by 刘瑞斌
parent ebeffd0669
commit 3b64b8ca76
6 changed files with 50 additions and 19 deletions

View File

@ -58,6 +58,7 @@ const useProjectEnvStore = defineStore(
const currentEnvDetailInfo = ref<EnvDetailItem>({
projectId: '',
name: '',
description: '',
config: envParamsDefaultConfig,
});
const backupEnvDetailInfo = ref<EnvDetailItem>({

View File

@ -560,11 +560,11 @@
try {
isLoading.value = true;
const detailResult: DetailCase = await getCaseDetail(props.caseId);
const fileIds = (detailResult.attachments || []).map((item: any) => item.id);
const fileIds = (detailResult.attachments || []).map((item: any) => item.id) || [];
if (fileIds.length) {
checkUpdateFileIds.value = await checkFileIsUpdateRequest(fileIds);
getDetailData(detailResult);
}
getDetailData(detailResult);
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
@ -770,17 +770,15 @@
const caseId = ref(props.caseId);
watchEffect(() => {
onBeforeMount(async () => {
caseId.value = '';
caseId.value = props.caseId;
initSelectTree();
if (caseId.value) {
getCaseInfo();
} else {
initDefaultFields();
}
initSelectTree();
});
onBeforeMount(() => {
caseId.value = '';
});
defineExpose({

View File

@ -29,6 +29,7 @@
allow-clear
:auto-size="{ minRows: 1 }"
:max-length="1000"
@blur="store.currentEnvDetailInfo.description = form.description"
/>
</a-form-item>
</a-form>
@ -86,6 +87,10 @@
import { ContentTabItem, EnvPluginListItem } from '@/models/projectManagement/environmental';
const emit = defineEmits<{
(e: 'ok'): void;
}>();
const activeKey = ref('envParams');
const envForm = ref();
const canSave = ref(false);
@ -182,13 +187,9 @@
store.currentEnvDetailInfo.mock = true;
// TODO
const res = await updateOrAddEnv({ fileList: [], request: store.currentEnvDetailInfo });
console.log(
store.currentEnvDetailInfo,
'store.currentEnvDetailInfostore.currentEnvDetailInfostore.currentEnvDetailInfo'
);
store.currentEnvDetailInfo = res;
Message.success(t('common.saveSuccess'));
emit('ok');
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
@ -208,6 +209,7 @@
if (store.currentEnvDetailInfo) {
const { currentEnvDetailInfo } = store;
form.name = currentEnvDetailInfo.name;
form.description = currentEnvDetailInfo.description as string;
}
});
watchEffect(() => {

View File

@ -184,7 +184,7 @@
<!-- 全局参数 -->
<AllParamBox v-if="showType === 'PROJECT' && activeKey === ALL_PARAM" />
<!-- 环境变量 -->
<EnvParamBox v-else-if="showType === 'PROJECT' && activeKey !== ALL_PARAM" />
<EnvParamBox v-else-if="showType === 'PROJECT' && activeKey !== ALL_PARAM" @ok="initData()" />
<!-- 环境组 -->
<EnvGroupBox v-else-if="showType === 'PROJECT_GROUP'" @save-or-update="handleUpdateEnvGroup" />
</template>
@ -407,12 +407,38 @@
}
const _oldIndex = oldIndex as number;
const _newIndex = newIndex as number;
const params = {
projectId: appStore.currentProjectId,
targetId: type === EnvAuthTypeEnum.ENVIRONMENT ? envList.value[_oldIndex].id : evnGroupList.value[_oldIndex].id,
moveId: type === EnvAuthTypeEnum.ENVIRONMENT ? envList.value[_newIndex].id : evnGroupList.value[_newIndex].id,
moveMode: _oldIndex > _newIndex ? 'BEFORE' : 'AFTER',
targetId: type === EnvAuthTypeEnum.ENVIRONMENT ? envList.value[_newIndex].id : evnGroupList.value[_newIndex].id,
moveId: '',
moveMode: 'AFTER',
};
if (type === EnvAuthTypeEnum.ENVIRONMENT) {
if (envList.value[_newIndex + 1].id) {
params.moveMode = 'BEFORE';
params.moveId = envList.value[_newIndex + 1].id;
return;
}
if (envList.value[_newIndex - 1].id) {
params.moveMode = 'AFTER';
params.moveId = envList.value[_newIndex - 1].id;
return;
}
}
if (type === EnvAuthTypeEnum.ENVIRONMENT_GROUP) {
if (evnGroupList.value[_newIndex + 1].id) {
params.moveMode = 'AFTER';
params.moveId = evnGroupList.value[_newIndex + 1].id;
return;
}
if (evnGroupList.value[_newIndex - 1].id) {
params.moveMode = 'BEFORE';
params.moveId = evnGroupList.value[_newIndex - 1].id;
return;
}
}
if (type === EnvAuthTypeEnum.ENVIRONMENT) {
await editPosEnv(params);
} else if (type === EnvAuthTypeEnum.ENVIRONMENT_GROUP) {

View File

@ -47,7 +47,9 @@ export default {
'project.environmental.http.add': 'Add HTTP',
'project.environmental.http.hostName': 'Host Name',
'project.environmental.http.hostNameRequired': 'Host name is required',
'project.environmental.http.hostNamePlaceholder': 'For example: http://127.0.0.1',
'project.environmental.http.httpHostNamePlaceholder': 'For example: http://127.0.0.1',
'project.environmental.http.httpsHostNamePlaceholder': 'For example: https://127.0.0.1',
'project.environmental.http.selectApiModule': 'Select interface module',
'project.environmental.http.applyModule': 'Apply Module',
'project.environmental.http.enableCondition': 'Enable Condition',
'project.environmental.http.none': 'None',

View File

@ -54,8 +54,10 @@ export default {
'project.environmental.http.add': '添加HTTP',
'project.environmental.http.hostName': '域名',
'project.environmental.http.hostNameRequired': '域名必填',
'project.environmental.http.hostNamePlaceholder': '例如http://127.0.0.1',
'project.environmental.http.httpHostNamePlaceholder': '例如http://127.0.0.1',
'project.environmental.http.httpsHostNamePlaceholder': '例如https://127.0.0.1',
'project.environmental.http.applyModule': '应用模块',
'project.environmental.http.selectApiModule': '选择接口模块',
'project.environmental.http.enableCondition': '启用条件',
'project.environmental.http.none': '无',
'project.environmental.http.module': '模块',