fix(项目管理): 环境管理缺陷修复保存后操作列问题

This commit is contained in:
xinxin.wu 2024-03-13 11:21:44 +08:00 committed by 刘瑞斌
parent e6c660aa32
commit ad99fd8f92
5 changed files with 59 additions and 35 deletions

View File

@ -471,6 +471,7 @@
},
];
// json
const jsonPathDefaultParamItem = {
expression: '',
condition: '',
@ -479,6 +480,12 @@
moreSettingPopoverVisible: false,
disable: true,
};
// xpath
const xPathDefaultParamItem = {
expression: '',
enable: true,
valid: true,
};
const handleChange = (data: any[], type: string, isInit?: boolean) => {
switch (type) {
@ -543,11 +550,6 @@
},
];
const xPathDefaultParamItem = {
expression: '',
enable: true,
};
const documentColumns: ParamTableColumn[] = [
{
title: 'ms.assertion.paramsName',
@ -678,9 +680,9 @@
function copyItem(record) {
switch (activeTab.value) {
case ResponseBodyAssertionType.JSON_PATH:
const index = condition.value.jsonPathAssertion.assertions.findIndex((item) => item.id === record.id);
if (index > -1) {
condition.value.jsonPathAssertion.assertions.splice(index, 0, {
const jsonIndex = condition.value.jsonPathAssertion.assertions.findIndex((item) => item.id === record.id);
if (jsonIndex > -1) {
condition.value.jsonPathAssertion.assertions.splice(jsonIndex, 0, {
...record,
id: new Date().getTime().toString(),
});
@ -689,13 +691,14 @@
break;
case ResponseBodyAssertionType.XPATH:
condition.value.xpathAssertion.assertions.push({
...record,
id: new Date().getTime().toString(),
});
const xpathIndex = condition.value.xpathAssertion.assertions.findIndex((item) => item.id === record.id);
if (xpathIndex > -1) {
condition.value.xpathAssertion.assertions.splice(xpathIndex, 0, {
...record,
id: new Date().getTime().toString(),
});
}
emit('change', {
...defaultParamItem,
...condition.value,
assertionBodyType: activeTab.value,
responseFormat: activeResponseFormat.value,
@ -708,11 +711,14 @@
});
break;
case ResponseBodyAssertionType.REGEX:
condition.value.regexAssertion.assertions.push({
...record,
id: new Date().getTime().toString(),
});
emit('change', { ...defaultParamItem, ...condition.value, assertionBodyType: activeTab.value });
const regIndex = condition.value.xpathAssertion.assertions.findIndex((item) => item.id === record.id);
if (regIndex > -1) {
condition.value.regexAssertion.assertions.splice(regIndex, 0, {
...record,
id: new Date().getTime().toString(),
});
}
emit('change', { ...condition.value, assertionBodyType: activeTab.value });
break;
default:
break;

View File

@ -99,9 +99,14 @@
</div>
</div>
<StepProgress :report-detail="reportStepDetail" height="8px" radius="var(--border-radius-mini)" />
<div>
<div></div>
<div></div>
<div></div>
</div>
</div>
<div class="request-analyze"></div>
<div class="request-analyze"> </div>
</div>
<!-- 报告步骤分析和请求分析结束 -->
<!-- 报告明细开始 -->
@ -184,18 +189,21 @@
@apply mb-4 bg-white;
}
.analyze {
padding: 16px;
min-height: 196px;
border-radius: 4px;
@apply flex justify-between bg-white;
@apply mb-4 flex justify-between;
.step-analyze {
@apply mb-4 h-full;
padding: 16px;
border-radius: 4px;
@apply h-full bg-white;
.countItem {
@apply mr-6 flex items-center;
}
}
.request-analyze {
@apply h-full;
padding: 16px;
border-radius: 4px;
@apply h-full bg-white;
}
}
}

View File

@ -36,11 +36,11 @@
<div class="flex flex-row flex-nowrap">
<span v-permission="['PROJECT_BUG:READ+ADD']" class="flex flex-row">
<MsButton class="!mr-0" @click="handleCopy(record)">{{ t('common.copy') }}</MsButton>
<a-divider direction="vertical" />
<a-divider class="h-[16px]" direction="vertical" />
</span>
<span v-permission="['PROJECT_BUG:READ+UPDATE']" class="flex flex-row">
<MsButton class="!mr-0" @click="handleEdit(record)">{{ t('common.edit') }}</MsButton>
<a-divider direction="vertical" />
<a-divider class="h-[16px]" direction="vertical" />
</span>
<MsTableMoreAction
v-permission="['PROJECT_BUG:READ+DELETE']"

View File

@ -31,7 +31,7 @@
</a-select> -->
</div>
</div>
<MsBaseTable class="mt-[16px]" v-bind="propsRes" v-on="propsEvent" @change="changeHandler">
<MsBaseTable ref="tableRef" class="mt-[16px]" v-bind="propsRes" v-on="propsEvent" @change="changeHandler">
<template #type="{ record }">
<span>{{ getEnableScope(record.type) }}</span>
</template>
@ -41,7 +41,7 @@
</a-tooltip>
</template>
<template #operation="{ record }">
<div v-show="!store.currentEnvDetailInfo.mock" class="flex flex-row flex-nowrap items-center">
<div class="flex flex-row flex-nowrap items-center">
<MsButton class="!mr-0" @click="handleCopy(record)">{{ t('common.copy') }}</MsButton>
<a-divider class="h-[16px]" direction="vertical" />
<MsButton class="!mr-0" @click="handleEdit(record)">{{ t('common.edit') }}</MsButton>
@ -96,21 +96,17 @@
dataIndex: 'url',
slotName: 'url',
showTooltip: true,
showDrag: true,
showInTable: true,
},
{
title: 'project.environmental.http.desc',
dataIndex: 'description',
showDrag: true,
showInTable: true,
},
{
title: 'project.environmental.http.enableScope',
dataIndex: 'type',
slotName: 'type',
showDrag: true,
showInTable: true,
},
{
title: 'project.environmental.http.value',
@ -118,7 +114,6 @@
slotName: 'moduleValue',
showTooltip: false,
showDrag: true,
showInTable: true,
},
{
title: 'common.operation',
@ -128,7 +123,6 @@
width: 170,
},
];
await tableStore.initColumn(TableKeyEnum.PROJECT_MANAGEMENT_ENV_ENV_HTTP, columns);
const { propsRes, propsEvent } = useTable(undefined, {
columns,
scroll: { x: '100%' },
@ -281,6 +275,18 @@
}
return '-';
}
const tableRef = ref();
watch(
() => store.currentEnvDetailInfo.mock,
(val) => {
if (val) {
const tempColumn = columns.slice(0, columns.length - 1);
tableRef.value.initColumn(tempColumn);
} else {
tableRef.value.initColumn(columns);
}
}
);
</script>
<style lang="less" scoped>

View File

@ -187,7 +187,7 @@
<EnvParamBox
v-else-if="showType === 'PROJECT' && activeKey !== ALL_PARAM"
@reset-env="resetHandler"
@ok="initData()"
@ok="getDetail"
/>
<!-- 环境组 -->
<EnvGroupBox v-else-if="showType === 'PROJECT_GROUP'" @save-or-update="handleUpdateEnvGroup" />
@ -589,6 +589,10 @@
}
}
function getDetail() {
store.initEnvDetail();
}
onMounted(() => {
initData(keyword.value, true);
});