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: {
'/ws': {
target: 'http://192.168.8.200:8081/',
target: 'http://172.16.200.18:8081/',
changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/front\/ws/, ''),
ws: true,
},
'/front': {
target: 'http://192.168.8.200:8081/',
target: 'http://172.16.200.18:8081/',
changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/front/, ''),
},
'/file': {
target: 'http://192.168.8.200:8081/',
target: 'http://172.16.200.18:8081/',
changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/front\/file/, ''),
},
'/attachment': {
target: 'http://192.168.8.200:8081/',
target: 'http://172.16.200.18:8081/',
changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/front\/attachment/, ''),
},
'/bug/attachment': {
target: 'http://192.168.8.200:8081/',
target: 'http://172.16.200.18:8081/',
changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/front\/bug\/attachment/, ''),
},
'/plugin/image': {
target: 'http://192.168.8.200:8081/',
target: 'http://172.16.200.18:8081/',
changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/front\/plugin\/image/, ''),
},
'/base-display': {
target: 'http://192.168.8.200:8081/',
target: 'http://172.16.200.18:8081/',
changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/front\/base-display/, ''),
},

View File

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

View File

@ -10,7 +10,7 @@
@close="handleClose"
>
<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
v-if="activeStep?.name"
v-show="isShowEditStepNameInput"
@ -130,10 +130,6 @@
const activeStep = defineModel<ScenarioStepItem>('activeStep', {
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 = {
id: `case-${Date.now()}`,
@ -205,17 +201,17 @@
const requestVModel = ref<RequestParam>(props.request || cloneDeep(defaultCaseParams));
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 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(() => {
stepName.value = props.activeStep?.name;
stepName.value = activeStep.value?.name;
});
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 stepInsertStepTrigger from './createAction/stepInsertStepTrigger.vue';
import conditionContent from './stepNodeComposition/conditionContent.vue';
import customApiContent from './stepNodeComposition/customApiContent.vue';
import loopControlContent from './stepNodeComposition/loopContent.vue';
import quoteContent from './stepNodeComposition/quoteContent.vue';
import waitTimeContent from './stepNodeComposition/waitTimeContent.vue';
@ -330,8 +329,6 @@
return quoteContent;
}
switch (step.stepType) {
case ScenarioStepType.CUSTOM_REQUEST:
return customApiContent;
case ScenarioStepType.LOOP_CONTROLLER:
return loopControlContent;
case ScenarioStepType.IF_CONTROLLER: