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.floatIntegerMin': 'Minimum value of integer part',
'ms.paramsInput.floatIntegerMax': 'Maximum value of integer part', 'ms.paramsInput.floatIntegerMax': 'Maximum value of integer part',
'ms.paramsInput.commonPlaceholder': 'Please input', 'ms.paramsInput.commonPlaceholder': 'Please input',
'ms.paramsInput.commonDescPlaceholder': 'Please input description',
'ms.paramsInput.commonSelectPlaceholder': 'Please select', 'ms.paramsInput.commonSelectPlaceholder': 'Please select',
'ms.paramsInput.bool': 'Boolean', 'ms.paramsInput.bool': 'Boolean',
'ms.paramsInput.boolDesc': 'Generate a random boolean value', 'ms.paramsInput.boolDesc': 'Generate a random boolean value',

View File

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

View File

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

View File

@ -87,7 +87,7 @@
v-if="columnConfig.inputType === 'autoComplete'" v-if="columnConfig.inputType === 'autoComplete'"
v-model:model-value="record[columnConfig.dataIndex as string]" v-model:model-value="record[columnConfig.dataIndex as string]"
:disabled="props.disabledExceptParam || columnConfig.disabledColumn" :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" class="ms-form-table-input"
:trigger-props="{ contentClass: 'ms-form-table-input-trigger' }" :trigger-props="{ contentClass: 'ms-form-table-input-trigger' }"
:filter-option="false" :filter-option="false"
@ -99,11 +99,6 @@
<template #option="{ data: opt }"> <template #option="{ data: opt }">
<div class="w-[350px]"> <div class="w-[350px]">
{{ t(opt.raw.label) }} {{ 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> </div>
</template> </template>
</a-auto-complete> </a-auto-complete>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,8 @@
<template> <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> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -9,22 +12,7 @@
import { TableKeyEnum } from '@/enums/tableEnum'; import { TableKeyEnum } from '@/enums/tableEnum';
const store = useProjectEnvStore(); const projectEnvStore = 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 || '',
};
});
},
});
</script> </script>
<style lang="less" scoped></style> <style lang="less" scoped></style>