fix(all): 修复bug

This commit is contained in:
baiqi 2024-04-10 20:49:23 +08:00 committed by Craftsman
parent b41ef8a22f
commit 214620dbe5
12 changed files with 48 additions and 52 deletions

View File

@ -26,6 +26,7 @@ export default {
'ms.paramsInput.floatIntegerMin': 'Minimum value of integer part',
'ms.paramsInput.floatIntegerMax': 'Maximum value of integer part',
'ms.paramsInput.commonPlaceholder': 'Please input',
'ms.paramsInput.commonDescPlaceholder': 'Please input description',
'ms.paramsInput.commonSelectPlaceholder': 'Please select',
'ms.paramsInput.bool': 'Boolean',
'ms.paramsInput.boolDesc': 'Generate a random boolean value',

View File

@ -24,6 +24,7 @@ export default {
'ms.paramsInput.floatIntegerMin': '整数部分最小值',
'ms.paramsInput.floatIntegerMax': '整数部分最大值',
'ms.paramsInput.commonPlaceholder': '请输入',
'ms.paramsInput.commonDescPlaceholder': '请输入描述',
'ms.paramsInput.commonSelectPlaceholder': '请选择',
'ms.paramsInput.bool': '布尔值',
'ms.paramsInput.boolDesc': '随机生成一个布尔值',

View File

@ -199,7 +199,7 @@
</div>
</div>
<div v-else class="flex h-[calc(100%-47px)] flex-col">
<div class="mb-[16px] flex w-full items-center bg-[var(--color-text-n9)] p-[12px]">
<div class="mb-[8px] flex w-full items-center bg-[var(--color-text-n9)] p-[12px]">
<div class="break-word max-w-[70%] break-all text-[var(--color-text-2)]">
{{ condition.commonScriptInfo?.name || '-' }}
</div>
@ -247,17 +247,16 @@
</template>
<!-- SQL操作 -->
<template v-else-if="condition.processorType === RequestConditionProcessor.SQL">
<div class="mb-[16px]">
<div class="mb-[8px] text-[var(--color-text-1)]">{{ t('common.desc') }}</div>
<div class="mb-[8px]">
<a-input
v-model:model-value="condition.name"
:disabled="props.disabled"
:placeholder="t('apiTestDebug.commonPlaceholder')"
:placeholder="t('ms.paramsInput.commonDescPlaceholder')"
:max-length="255"
@input="() => emit('change')"
/>
</div>
<div class="mb-[16px] flex w-full items-center bg-[var(--color-text-n9)] p-[12px]">
<div class="mb-[8px] flex w-full items-center bg-[var(--color-text-n9)] p-[12px]">
<div class="max-w-[70%] break-words text-[var(--color-text-2)]">
{{ condition.dataSourceName || '-' }}
</div>
@ -272,12 +271,12 @@
</MsButton>
</div>
<div class="mb-[8px] text-[var(--color-text-1)]">{{ t('apiTestDebug.sqlScript') }}</div>
<div class="mb-[16px] h-[300px]">
<div class="mb-[8px] h-[300px]">
<MsCodeEditor
v-model:model-value="condition.script"
:read-only="props.disabled"
theme="vs"
height="276px"
height="120px"
:language="LanguageEnum.SQL"
:show-full-screen="false"
:show-theme-change="false"
@ -285,7 +284,7 @@
>
</MsCodeEditor>
</div>
<div class="mb-[16px]">
<div class="mb-[8px]">
<div class="mb-[8px] flex items-center text-[var(--color-text-1)]">
{{ t('apiTestDebug.storageByCol') }}
<a-tooltip position="right" :content="t('apiTestDebug.storageColTip')">
@ -318,7 +317,7 @@
@change="handleSqlSourceParamTableChange"
/>
</div>
<div class="mt-[16px]">
<div class="mt-[8px]">
<div class="mb-[8px] flex items-center text-[var(--color-text-1)]">
{{ t('apiTestDebug.storageByResult') }}
<a-tooltip position="right" :content="t('apiTestDebug.storageResultTip')">

View File

@ -87,7 +87,7 @@
v-if="columnConfig.inputType === 'autoComplete'"
v-model:model-value="record[columnConfig.dataIndex as string]"
:disabled="props.disabledExceptParam || columnConfig.disabledColumn"
:data="columnConfig.autoCompleteParams?.filter((e) => e.isShow === true)"
:data="record[columnConfig.dataIndex as string] !== '' ? columnConfig.autoCompleteParams?.filter((e) => e.isShow === true) : columnConfig.autoCompleteParams"
class="ms-form-table-input"
:trigger-props="{ contentClass: 'ms-form-table-input-trigger' }"
:filter-option="false"
@ -99,11 +99,6 @@
<template #option="{ data: opt }">
<div class="w-[350px]">
{{ t(opt.raw.label) }}
<!-- <a-tooltip :content="t(opt.raw.label)" position="bl" :mouse-enter-delay="300">
<div class="one-line-text max-w-full">
{{ t(opt.raw.label) }}
</div>
</a-tooltip> -->
</div>
</template>
</a-auto-complete>

View File

@ -30,14 +30,12 @@
import paramTable, { ParamTableColumn } from '@/views/api-test/components/paramTable.vue';
import { responseHeaderOption } from '@/config/apiTest';
import { useI18n } from '@/hooks/useI18n';
import { EnableKeyValueParam } from '@/models/apiTest/common';
import { filterKeyValParams } from '../utils';
import { defaultHeaderParamsItem } from '@/views/api-test/components/config';
const { t } = useI18n();
const props = defineProps<{
params: EnableKeyValueParam[];
layout: 'horizontal' | 'vertical';

View File

@ -76,7 +76,7 @@
<template v-if="hasLocalExec">
<a-dropdown-button
v-if="!requestVModel.executeLoading"
:disabled="requestVModel.executeLoading || (isHttpProtocol && !requestVModel.url)"
:disabled="requestVModel.executeLoading || (isHttpProtocol && !requestVModel.path)"
class="exec-btn"
@click="() => execute(isPriorityLocalExec ? 'localExec' : 'serverExec')"
@select="execute"

View File

@ -43,7 +43,7 @@
</a-tooltip>
</div>
<a-form-item v-if="form.stepWaitTime" class="flex-1">
<a-form-item v-if="form.stepWaitTime !== null || form.stepWaitTime !== undefined" class="flex-1">
<template #label>
<div class="flex items-center">
{{ t('apiScenario.setting.waitTime') }}
@ -56,8 +56,9 @@
:step="100"
:min="0"
:max="600000"
model-event="input"
class="w-[160px]"
@change="emit('change')"
@blur="handleInputChange"
/>
</a-form-item>
@ -90,6 +91,12 @@
const form = defineModel<OtherConfig>('otherConfig', {
required: true,
});
function handleInputChange() {
if (!form.value.stepWaitTime) {
form.value.stepWaitTime = 1000;
}
}
</script>
<style lang="less" scoped></style>

View File

@ -46,9 +46,8 @@
});
function handleInputChange() {
console.log('innerData.value.delay', innerData.value.delay);
if (!innerData.value.delay) {
innerData.value.delay = 1;
innerData.value.delay = 1000;
}
nextTick(() => {
emit('change', innerData.value);

View File

@ -67,7 +67,9 @@ export default function updateStepStatus(
}
}
} else if (node.stepType === ScenarioStepType.CONSTANT_TIMER) {
node.executeStatus = ScenarioExecuteStatus.SUCCESS;
node.executeStatus = stepResponses[node.uniqueId]
? ScenarioExecuteStatus.SUCCESS
: ScenarioExecuteStatus.UN_EXECUTE;
} else if (node.executeStatus === ScenarioExecuteStatus.EXECUTING) {
// 非逻辑控制器直接更改本身状态
if (stepResponses[node.uniqueId] && stepResponses[node.uniqueId].length > 0) {

View File

@ -38,18 +38,19 @@
</a-form-item>
</a-form>
<paramsTable
v-model:params="innerParams"
:params="innerParams"
:show-setting="false"
:columns="columns"
:selectable="false"
:default-param-item="defaultParamItem"
@change="handleParamTableChange"
/>
</div>
<div v-permission="['PROJECT_ENVIRONMENT:READ+UPDATE']" class="footer" :style="{ width: '100%' }">
<a-button :disabled="!canSave" @click="handleReset">{{ t('common.cancel') }}</a-button>
<a-button :disabled="!canSave" :loading="loading" type="primary" @click="handleSave">{{
t('common.save')
}}</a-button>
<a-button :disabled="!canSave" :loading="loading" type="primary" @click="handleSave">
{{ t('common.save') }}
</a-button>
</div>
</template>
<template v-else>
@ -86,6 +87,13 @@
});
const store = useProjectEnvStore();
const defaultParamItem = {
projectId: '',
environmentId: '',
host: '',
description: '',
enable: true,
};
const columns = computed<ParamTableColumn[]>(() => [
{
title: 'project.environmental.project',

View File

@ -22,7 +22,7 @@
/>
</div>
<paramsTable
v-model:params="innerParams"
:params="innerParams"
:table-key="props.tableKey"
:columns="columns"
:draggable="true"
@ -34,8 +34,6 @@
</template>
<script setup lang="ts">
import { useVModel } from '@vueuse/core';
import batchAddKeyVal from '@/views/api-test/components/batchAddKeyVal.vue';
import paramsTable, { type ParamTableColumn } from '@/views/api-test/components/paramTable.vue';
@ -47,7 +45,6 @@
const props = withDefaults(
defineProps<{
params: any[];
tableKey: TableKeyEnum;
}>(),
{
@ -55,7 +52,6 @@
}
);
const emit = defineEmits<{
(e: 'update:params', value: any[]): void;
(e: 'change'): void; //
}>();
@ -63,13 +59,15 @@
const { t } = useI18n();
const innerParams = useVModel(props, 'params', emit);
const backupParams = ref(props.params);
const innerParams = defineModel<any[]>('params', {
required: true,
});
const backupParams = ref(innerParams.value);
const firstSearch = ref(true);
const defaultParamItem = {
key: '',
type: '',
paramType: '',
value: '',
description: '',
tags: [],

View File

@ -1,5 +1,8 @@
<template>
<AllPrams v-model:params="allParams" :table-key="TableKeyEnum.PROJECT_MANAGEMENT_ENV_ENV_PARAM" />
<AllPrams
v-model:params="projectEnvStore.currentEnvDetailInfo.config.commonVariables"
:table-key="TableKeyEnum.PROJECT_MANAGEMENT_ENV_ENV_PARAM"
/>
</template>
<script lang="ts" setup>
@ -9,22 +12,7 @@
import { TableKeyEnum } from '@/enums/tableEnum';
const store = useProjectEnvStore();
const allParams = computed({
set: (value: any) => {
store.currentEnvDetailInfo.config.commonVariables = value;
},
get: () => {
return store.currentEnvDetailInfo.config?.commonVariables.map((e: any) => {
return {
...e,
tags: e.tags || [],
description: e.description || '',
};
});
},
});
const projectEnvStore = useProjectEnvStore();
</script>
<style lang="less" scoped></style>