fix(all): 修复严重 bug

This commit is contained in:
baiqi 2024-04-10 11:55:50 +08:00 committed by 刘瑞斌
parent d3bf4cc11c
commit 8af35fe57c
7 changed files with 64 additions and 46 deletions

View File

@ -284,5 +284,5 @@ export function updateScenarioPro(id: string | number, priority: CaseLevel | und
// 获取跨项目信息 // 获取跨项目信息
export function getStepProjectInfo(id: string, type: ScenarioStepType) { export function getStepProjectInfo(id: string, type: ScenarioStepType) {
return MSR.get<ScenarioStepResourceInfo>({ url: GetStepProjectInfoUrl, params: id, data: { resourceType: type } }); return MSR.get<ScenarioStepResourceInfo>({ url: `${GetStepProjectInfoUrl}/${id}`, params: { resourceType: type } });
} }

View File

@ -197,21 +197,6 @@
init(true); init(true);
}); });
const filterTreeData = ref<MsTreeNodeData[]>([]); //
watch(
() => data.value,
(val) => {
if (!props.keyword) {
filterTreeData.value = cloneDeep(val);
}
},
{
deep: true,
immediate: true,
}
);
/** /**
* 根据关键字过滤树节点 * 根据关键字过滤树节点
* @param keyword 搜索关键字 * @param keyword 搜索关键字
@ -240,6 +225,8 @@
return search(data.value); return search(data.value);
} }
const filterTreeData = ref<MsTreeNodeData[]>([]); //
// //
const updateDebouncedSearch = debounce(() => { const updateDebouncedSearch = debounce(() => {
if (props.keyword) { if (props.keyword) {
@ -251,11 +238,26 @@
} }
}, props.searchDebounce); }, props.searchDebounce);
watch(
() => data.value,
(val) => {
if (!props.keyword) {
filterTreeData.value = val;
} else {
updateDebouncedSearch();
}
},
{
deep: true,
immediate: true,
}
);
watch( watch(
() => props.keyword, () => props.keyword,
(val) => { (val) => {
if (!val) { if (!val) {
filterTreeData.value = cloneDeep(data.value); filterTreeData.value = data.value;
} else { } else {
updateDebouncedSearch(); updateDebouncedSearch();
} }

View File

@ -107,6 +107,7 @@ const useUserStore = defineStore('user', {
appStore.setCurrentOrgId(res.lastOrganizationId || ''); appStore.setCurrentOrgId(res.lastOrganizationId || '');
appStore.setCurrentProjectId(res.lastProjectId || ''); appStore.setCurrentProjectId(res.lastProjectId || '');
this.setInfo(res); this.setInfo(res);
this.initLocalConfig(); // 获取本地执行配置
} catch (err) { } catch (err) {
clearToken(); clearToken();
throw err; throw err;

View File

@ -6,6 +6,7 @@
:show-continue="true" :show-continue="true"
:footer="requestVModel.isNew === true" :footer="requestVModel.isNew === true"
:ok-disabled="requestVModel.executeLoading || (isHttpProtocol && !requestVModel.url)" :ok-disabled="requestVModel.executeLoading || (isHttpProtocol && !requestVModel.url)"
show-full-screen
@confirm="handleSave" @confirm="handleSave"
@continue="handleContinue" @continue="handleContinue"
@close="handleClose" @close="handleClose"
@ -23,21 +24,21 @@
</a-tooltip> </a-tooltip>
</div> </div>
<div <div
v-if=" v-if="props.step && !props.step.isQuoteScenarioStep"
props.step && class="right-operation-button-icon ml-auto flex items-center"
!props.step.isQuoteScenarioStep &&
props.step.resourceId &&
props.step?.stepType !== ScenarioStepType.CUSTOM_REQUEST
"
class="ml-auto"
> >
<replaceButton <replaceButton
v-if="props.step.resourceId && props.step?.stepType !== ScenarioStepType.CUSTOM_REQUEST"
:steps="props.steps" :steps="props.steps"
:step="props.step" :step="props.step"
:resource-id="props.step.resourceId" :resource-id="props.step.resourceId"
:scenario-id="scenarioId" :scenario-id="scenarioId"
@replace="handleReplace" @replace="handleReplace"
/> />
<MsButton class="mr-4" type="icon" status="secondary" @click="emit('deleteStep')">
<MsIcon type="icon-icon_delete-trash_outlined" />
{{ t('common.delete') }}
</MsButton>
</div> </div>
<div <div
v-if="!props.step || props.step?.stepType === ScenarioStepType.CUSTOM_REQUEST" v-if="!props.step || props.step?.stepType === ScenarioStepType.CUSTOM_REQUEST"
@ -330,6 +331,7 @@
import { Message, SelectOptionData } from '@arco-design/web-vue'; import { Message, SelectOptionData } from '@arco-design/web-vue';
import { cloneDeep, debounce } from 'lodash-es'; import { cloneDeep, debounce } from 'lodash-es';
import MsButton from '@/components/pure/ms-button/index.vue';
import MsDrawer from '@/components/pure/ms-drawer/index.vue'; import MsDrawer from '@/components/pure/ms-drawer/index.vue';
import MsFormCreate from '@/components/pure/ms-form-create/formCreate.vue'; import MsFormCreate from '@/components/pure/ms-form-create/formCreate.vue';
import MsIcon from '@/components/pure/ms-icon-font/index.vue'; import MsIcon from '@/components/pure/ms-icon-font/index.vue';
@ -437,6 +439,7 @@
(e: 'applyStep', request: RequestParam): void; (e: 'applyStep', request: RequestParam): void;
(e: 'execute', request: RequestParam, executeType?: 'localExec' | 'serverExec'): void; (e: 'execute', request: RequestParam, executeType?: 'localExec' | 'serverExec'): void;
(e: 'stopDebug'): void; (e: 'stopDebug'): void;
(e: 'deleteStep'): void;
(e: 'replace', newStep: ScenarioStepItem): void; (e: 'replace', newStep: ScenarioStepItem): void;
}>(); }>();
@ -446,7 +449,7 @@
// //
const scenarioId = inject<string | number>('scenarioId'); const scenarioId = inject<string | number>('scenarioId');
const currentEnvConfig = inject<Ref<EnvConfig>>('currentEnvConfig'); const currentEnvConfig = inject<Ref<EnvConfig>>('currentEnvConfig');
const hasLocalExec = inject<Ref<boolean>>('isPriorityLocalExec'); const hasLocalExec = inject<Ref<boolean>>('hasLocalExec');
const isPriorityLocalExec = inject<Ref<boolean>>('isPriorityLocalExec'); const isPriorityLocalExec = inject<Ref<boolean>>('isPriorityLocalExec');
const visible = defineModel<boolean>('visible', { required: true }); const visible = defineModel<boolean>('visible', { required: true });

View File

@ -29,13 +29,13 @@
<MsIcon type="icon-icon_edit_outlined" class="edit-script-name-icon" @click="showEditScriptNameInput" /> <MsIcon type="icon-icon_edit_outlined" class="edit-script-name-icon" @click="showEditScriptNameInput" />
</div> </div>
<div <div
v-if="activeStep && !activeStep.isQuoteScenarioStep && requestVModel.resourceId" v-if="activeStep && !activeStep.isQuoteScenarioStep && activeStep.resourceId"
class="right-operation-button-icon flex items-center" class="right-operation-button-icon flex items-center"
> >
<replaceButton <replaceButton
:steps="props.steps" :steps="props.steps"
:step="activeStep" :step="activeStep"
:resource-id="requestVModel.resourceId" :resource-id="activeStep.resourceId"
:scenario-id="scenarioId" :scenario-id="scenarioId"
@replace="handleReplace" @replace="handleReplace"
/> />
@ -350,6 +350,7 @@
// //
const scenarioId = inject<string | number>('scenarioId'); const scenarioId = inject<string | number>('scenarioId');
const isPriorityLocalExec = inject<Ref<boolean>>('isPriorityLocalExec'); const isPriorityLocalExec = inject<Ref<boolean>>('isPriorityLocalExec');
const hasLocalExec = inject<Ref<boolean>>('hasLocalExec');
const defaultApiParams: RequestParam = { const defaultApiParams: RequestParam = {
name: '', name: '',
@ -620,8 +621,6 @@
} }
} }
const hasLocalExec = ref(false); // api
const pluginScriptMap = ref<Record<string, PluginConfig>>({}); // const pluginScriptMap = ref<Record<string, PluginConfig>>({}); //
const temporaryPluginFormMap: Record<string, any> = {}; // API const temporaryPluginFormMap: Record<string, any> = {}; // API
const pluginLoading = ref(false); const pluginLoading = ref(false);

View File

@ -13,6 +13,7 @@
> >
<MsIcon type="icon-icon-draft" class="text-[var(--color-text-4)] hover:text-[rgb(var(--primary-5))]" /> <MsIcon type="icon-icon-draft" class="text-[var(--color-text-4)] hover:text-[rgb(var(--primary-5))]" />
<template #content> <template #content>
<a-spin class="h-full w-full" :loading="loading">
<div class="flex flex-col gap-[16px]"> <div class="flex flex-col gap-[16px]">
<div> <div>
<div class="mb-[2px] text-[var(--color-text-4)]">{{ t('apiScenario.belongProject') }}</div> <div class="mb-[2px] text-[var(--color-text-4)]">{{ t('apiScenario.belongProject') }}</div>
@ -27,6 +28,7 @@
</div> </div>
</div> </div>
</div> </div>
</a-spin>
</template> </template>
</a-popover> </a-popover>
<MsTag <MsTag
@ -68,11 +70,19 @@
const { openNewPage } = useOpenNewPage(); const { openNewPage } = useOpenNewPage();
const originProjectInfo = ref<ScenarioStepResourceInfo>(); const originProjectInfo = ref<ScenarioStepResourceInfo>();
const loading = ref(false);
async function handleVisibleChange(val: boolean) { async function handleVisibleChange(val: boolean) {
try {
loading.value = true;
if (val && props.data.originProjectId) { if (val && props.data.originProjectId) {
originProjectInfo.value = await getStepProjectInfo(props.data.resourceId || '', props.data.stepType); originProjectInfo.value = await getStepProjectInfo(props.data.resourceId || '', props.data.stepType);
} }
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
} finally {
loading.value = false;
}
} }
function goDetail() { function goDetail() {

View File

@ -220,6 +220,7 @@
:permission-map="permissionMap" :permission-map="permissionMap"
:steps="steps" :steps="steps"
@add-step="addCustomApiStep" @add-step="addCustomApiStep"
@delete-step="deleteStep(activeStep)"
@apply-step="applyApiStep" @apply-step="applyApiStep"
@stop-debug="handleStopExecute(activeStep)" @stop-debug="handleStopExecute(activeStep)"
@execute="handleApiExecute" @execute="handleApiExecute"
@ -235,7 +236,7 @@
:step-responses="scenario.stepResponses" :step-responses="scenario.stepResponses"
:permission-map="permissionMap" :permission-map="permissionMap"
@apply-step="applyApiStep" @apply-step="applyApiStep"
@delete-step="deleteCaseStep(activeStep)" @delete-step="deleteStep(activeStep)"
@stop-debug="handleStopExecute(activeStep)" @stop-debug="handleStopExecute(activeStep)"
@execute="(request, executeType) => handleApiExecute((request as unknown as RequestParam), executeType)" @execute="(request, executeType) => handleApiExecute((request as unknown as RequestParam), executeType)"
@replace="handleReplaceStep" @replace="handleReplaceStep"
@ -1525,12 +1526,14 @@
/** /**
* 删除 * 删除
*/ */
function deleteCaseStep(step?: ScenarioStepItem) { function deleteStep(step?: ScenarioStepItem) {
if (step) { if (step) {
customCaseDrawerVisible.value = false; customCaseDrawerVisible.value = false;
customApiDrawerVisible.value = false;
deleteNode(steps.value, step.uniqueId, 'uniqueId'); deleteNode(steps.value, step.uniqueId, 'uniqueId');
activeStep.value = undefined; activeStep.value = undefined;
scenario.value.unSaved = true; scenario.value.unSaved = true;
Message.success(t('common.deleteSuccess'));
} }
} }