fix(场景步骤): ts类型错误修复

This commit is contained in:
baiqi 2024-03-25 10:41:18 +08:00 committed by Craftsman
parent 8833f0e934
commit 6dce4ab078
5 changed files with 43 additions and 56 deletions

View File

@ -13,38 +13,38 @@ export default mergeConfig(
}, },
proxy: { proxy: {
'/ws': { '/ws': {
target: 'http://192.168.8.200:8081/', target: 'http://172.16.200.18:8081/',
changeOrigin: true, changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/front\/ws/, ''), rewrite: (path: string) => path.replace(/^\/front\/ws/, ''),
ws: true, ws: true,
}, },
'/front': { '/front': {
target: 'http://192.168.8.200:8081/', target: 'http://172.16.200.18:8081/',
changeOrigin: true, changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/front/, ''), rewrite: (path: string) => path.replace(/^\/front/, ''),
}, },
'/file': { '/file': {
target: 'http://192.168.8.200:8081/', target: 'http://172.16.200.18:8081/',
changeOrigin: true, changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/front\/file/, ''), rewrite: (path: string) => path.replace(/^\/front\/file/, ''),
}, },
'/attachment': { '/attachment': {
target: 'http://192.168.8.200:8081/', target: 'http://172.16.200.18:8081/',
changeOrigin: true, changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/front\/attachment/, ''), rewrite: (path: string) => path.replace(/^\/front\/attachment/, ''),
}, },
'/bug/attachment': { '/bug/attachment': {
target: 'http://192.168.8.200:8081/', target: 'http://172.16.200.18:8081/',
changeOrigin: true, changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/front\/bug\/attachment/, ''), rewrite: (path: string) => path.replace(/^\/front\/bug\/attachment/, ''),
}, },
'/plugin/image': { '/plugin/image': {
target: 'http://192.168.8.200:8081/', target: 'http://172.16.200.18:8081/',
changeOrigin: true, changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/front\/plugin\/image/, ''), rewrite: (path: string) => path.replace(/^\/front\/plugin\/image/, ''),
}, },
'/base-display': { '/base-display': {
target: 'http://192.168.8.200:8081/', target: 'http://172.16.200.18:8081/',
changeOrigin: true, changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/front\/base-display/, ''), rewrite: (path: string) => path.replace(/^\/front\/base-display/, ''),
}, },

View File

@ -322,6 +322,7 @@
RequestConditionProcessor, RequestConditionProcessor,
RequestMethods, RequestMethods,
ResponseComposition, ResponseComposition,
ScenarioStepRefType,
ScenarioStepType, ScenarioStepType,
} from '@/enums/apiEnum'; } from '@/enums/apiEnum';
@ -1065,36 +1066,36 @@
) { ) {
await initQuoteApiDetail(); await initQuoteApiDetail();
} }
// TODO: if (
// if ( props.step?.stepType === ScenarioStepType.API &&
// props.requestType === ScenarioStepType.QUOTE_API && props.step?.refType === ScenarioStepRefType.REF &&
// props.request.request && props.request.request &&
// requestVModel.value.request requestVModel.value.request
// ) { ) {
// // queryrest // queryrest
// ['headers', 'query', 'rest'].forEach((type) => { ['headers', 'query', 'rest'].forEach((type) => {
// props.request.request[type]?.forEach((item) => { props.request?.request?.[type]?.forEach((item) => {
// const index = requestVModel.value.request[type]?.findIndex((itemReq) => itemReq.key === item.key); const index = requestVModel.value.request?.[type]?.findIndex((itemReq) => itemReq.key === item.key);
// if (index > -1) { if (index > -1 && requestVModel.value.request) {
// requestVModel.value.request[type][index].value = item.value; requestVModel.value.request[type][index].value = item.value;
// requestVModel.value[type] = requestVModel.value.request[type]; requestVModel.value[type] = requestVModel.value.request?.[type];
// } }
// }); });
// }); });
// if (props.request.request.body.bodyType !== 'NONE') { if (props.request.request.body.bodyType !== 'NONE') {
// ['formDataBody', 'wwwFormBody'].forEach((type) => { ['formDataBody', 'wwwFormBody'].forEach((type) => {
// props.request.request.body[type].formValues.forEach((item) => { props.request?.request?.body[type].formValues.forEach((item) => {
// const index = requestVModel.value.request.body[type].formValues.findIndex( const index = requestVModel.value.request?.body[type].formValues.findIndex(
// (itemReq) => itemReq.key === item.key (itemReq) => itemReq.key === item.key
// ); );
// if (index > -1) { if (index > -1 && requestVModel.value.request?.body) {
// requestVModel.value.request.body[type]?.formValues[index].value = item.value; requestVModel.value.request.body[type].formValues[index].value = item.value;
// requestVModel.value.body = requestVModel.value.request?.body; requestVModel.value.body = requestVModel.value.request?.body;
// } }
// }); });
// }); });
// } }
// } }
handleActiveDebugProtocolChange(requestVModel.value.protocol); handleActiveDebugProtocolChange(requestVModel.value.protocol);
} else { } else {
requestVModel.value = cloneDeep({ requestVModel.value = cloneDeep({

View File

@ -10,7 +10,7 @@
@close="handleClose" @close="handleClose"
> >
<template #title> <template #title>
<stepType v-if="props.activeStep?.stepType" :step="props.activeStep" class="mr-[4px]" /> <stepType v-if="activeStep?.stepType" :step="activeStep" class="mr-[4px]" />
<a-input <a-input
v-if="activeStep?.name" v-if="activeStep?.name"
v-show="isShowEditStepNameInput" v-show="isShowEditStepNameInput"
@ -130,10 +130,6 @@
const activeStep = defineModel<ScenarioStepItem>('activeStep', { const activeStep = defineModel<ScenarioStepItem>('activeStep', {
required: false, required: false,
}); });
const isCopyNeedInit = computed(
() => activeStep.value?.type === ScenarioStepType.COPY_CASE && props.request?.request === null
);
const isQuote = computed(() => activeStep.value?.type === ScenarioStepType.QUOTE_CASE);
const defaultCaseParams: RequestParam = { const defaultCaseParams: RequestParam = {
id: `case-${Date.now()}`, id: `case-${Date.now()}`,
@ -205,17 +201,17 @@
const requestVModel = ref<RequestParam>(props.request || cloneDeep(defaultCaseParams)); const requestVModel = ref<RequestParam>(props.request || cloneDeep(defaultCaseParams));
const isCopyCase = computed( const isCopyCase = computed(
() => () =>
props.activeStep?.stepType === ScenarioStepType.API_CASE && props.activeStep?.refType === ScenarioStepRefType.COPY activeStep.value?.stepType === ScenarioStepType.API_CASE && activeStep.value?.refType === ScenarioStepRefType.COPY
); );
const isCopyNeedInit = computed(() => isCopyCase.value && props.request?.request === null); const isCopyNeedInit = computed(() => isCopyCase.value && props.request?.request === null);
const isQuote = computed( const isQuote = computed(
() => () =>
props.activeStep?.stepType === ScenarioStepType.API_CASE && props.activeStep?.refType === ScenarioStepRefType.REF activeStep.value?.stepType === ScenarioStepType.API_CASE && activeStep.value?.refType === ScenarioStepRefType.REF
); );
const stepName = ref(props.activeStep?.name); const stepName = ref(activeStep.value?.name);
watchEffect(() => { watchEffect(() => {
stepName.value = props.activeStep?.name; stepName.value = activeStep.value?.name;
}); });
const executeRef = ref<InstanceType<typeof executeButton>>(); const executeRef = ref<InstanceType<typeof executeButton>>();

View File

@ -1,7 +0,0 @@
<template>
<div>custom </div>
</template>
<script setup lang="ts"></script>
<style lang="less" scoped></style>

View File

@ -261,7 +261,6 @@
import createStepActions from './createAction/createStepActions.vue'; import createStepActions from './createAction/createStepActions.vue';
import stepInsertStepTrigger from './createAction/stepInsertStepTrigger.vue'; import stepInsertStepTrigger from './createAction/stepInsertStepTrigger.vue';
import conditionContent from './stepNodeComposition/conditionContent.vue'; import conditionContent from './stepNodeComposition/conditionContent.vue';
import customApiContent from './stepNodeComposition/customApiContent.vue';
import loopControlContent from './stepNodeComposition/loopContent.vue'; import loopControlContent from './stepNodeComposition/loopContent.vue';
import quoteContent from './stepNodeComposition/quoteContent.vue'; import quoteContent from './stepNodeComposition/quoteContent.vue';
import waitTimeContent from './stepNodeComposition/waitTimeContent.vue'; import waitTimeContent from './stepNodeComposition/waitTimeContent.vue';
@ -330,8 +329,6 @@
return quoteContent; return quoteContent;
} }
switch (step.stepType) { switch (step.stepType) {
case ScenarioStepType.CUSTOM_REQUEST:
return customApiContent;
case ScenarioStepType.LOOP_CONTROLLER: case ScenarioStepType.LOOP_CONTROLLER:
return loopControlContent; return loopControlContent;
case ScenarioStepType.IF_CONTROLLER: case ScenarioStepType.IF_CONTROLLER: