style: 修改前后置公共脚本style&断言style

This commit is contained in:
xinxin.wu 2024-04-23 17:23:54 +08:00 committed by 刘瑞斌
parent 23a1fc0fb1
commit 0e03e09a4b
13 changed files with 32 additions and 27 deletions

View File

@ -16,7 +16,7 @@
:selectable="true" :selectable="true"
:response="props.response" :response="props.response"
:columns="jsonPathColumns" :columns="jsonPathColumns"
:scroll="{ minWidth: '700px' }" :scroll="{ minWidth: '100%' }"
:default-param-item="jsonPathDefaultParamItem" :default-param-item="jsonPathDefaultParamItem"
@change="(data:any[],isInit?: boolean) => handleChange(data, ResponseBodyAssertionType.JSON_PATH,isInit)" @change="(data:any[],isInit?: boolean) => handleChange(data, ResponseBodyAssertionType.JSON_PATH,isInit)"
@more-action-select="(e,r)=> handleExtractParamMoreActionSelect(e,r as ExpressionConfig)" @more-action-select="(e,r)=> handleExtractParamMoreActionSelect(e,r as ExpressionConfig)"
@ -123,7 +123,7 @@
:disabled-except-param="props.disabled" :disabled-except-param="props.disabled"
:selectable="true" :selectable="true"
:columns="xPathColumns" :columns="xPathColumns"
:scroll="{ minWidth: '700px' }" :scroll="{ minWidth: '100%' }"
:default-param-item="defaultAssertParamsItem" :default-param-item="defaultAssertParamsItem"
@change="(data:any[],isInit?: boolean) => handleChange(data, ResponseBodyAssertionType.XPATH,isInit)" @change="(data:any[],isInit?: boolean) => handleChange(data, ResponseBodyAssertionType.XPATH,isInit)"
@more-action-select="(e,r)=> handleExtractParamMoreActionSelect(e,r as ExpressionConfig)" @more-action-select="(e,r)=> handleExtractParamMoreActionSelect(e,r as ExpressionConfig)"
@ -220,9 +220,7 @@
:disabled-except-param="props.disabled" :disabled-except-param="props.disabled"
:selectable="false" :selectable="false"
:columns="documentColumns" :columns="documentColumns"
:scroll="{ :scroll="{ minWidth: '100%' }"
minWidth: '700px',
}"
:height-used="580" :height-used="580"
:default-param-item="documentDefaultParamItem" :default-param-item="documentDefaultParamItem"
:span-method="documentSpanMethod" :span-method="documentSpanMethod"
@ -272,7 +270,7 @@
:selectable="true" :selectable="true"
:disabled-except-param="props.disabled" :disabled-except-param="props.disabled"
:columns="regexColumns" :columns="regexColumns"
:scroll="{ minWidth: '700px' }" :scroll="{ minWidth: '100%' }"
:default-param-item="regexDefaultParamItem" :default-param-item="regexDefaultParamItem"
@change="(data) => handleChange(data, ResponseBodyAssertionType.REGEX)" @change="(data) => handleChange(data, ResponseBodyAssertionType.REGEX)"
@more-action-select="(e,r)=> handleExtractParamMoreActionSelect(e,r as ExpressionConfig)" @more-action-select="(e,r)=> handleExtractParamMoreActionSelect(e,r as ExpressionConfig)"

View File

@ -4,7 +4,7 @@
v-model:params="condition.assertions" v-model:params="condition.assertions"
:selectable="true" :selectable="true"
:columns="columns" :columns="columns"
:scroll="{ minWidth: '700px' }" :scroll="{ minWidth: '100%' }"
:default-param-item="defaultParamItem" :default-param-item="defaultParamItem"
:disabled-except-param="props.disabled" :disabled-except-param="props.disabled"
@change="handleParamTableChange" @change="handleParamTableChange"

View File

@ -1,5 +1,11 @@
<template> <template>
<conditionContent v-model:data="condition" :disabled="props.disabled" @delete="deleteItem" @copy="emit('copy')" /> <conditionContent
v-model:data="condition"
:disabled="props.disabled"
:script-code-editor-height="props.scriptCodeEditorHeight"
@delete="deleteItem"
@copy="emit('copy')"
/>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -14,6 +20,7 @@
interface ScriptTabProps { interface ScriptTabProps {
data: any; data: any;
disabled?: boolean; disabled?: boolean;
scriptCodeEditorHeight?: string; //
} }
const props = defineProps<ScriptTabProps>(); const props = defineProps<ScriptTabProps>();

View File

@ -3,7 +3,7 @@
v-model:params="condition.variableAssertionItems" v-model:params="condition.variableAssertionItems"
:selectable="true" :selectable="true"
:columns="columns" :columns="columns"
:scroll="{ minWidth: '700px' }" :scroll="{ minWidth: '100%' }"
:default-param-item="defaultParamItem" :default-param-item="defaultParamItem"
:disabled-except-param="props.disabled" :disabled-except-param="props.disabled"
@change="handleParamTableChange" @change="handleParamTableChange"

View File

@ -85,6 +85,7 @@
:style="{ :style="{
overflow: 'auto', overflow: 'auto',
height: '100%', height: '100%',
width: '100%',
}" }"
> >
<!-- 响应头 --> <!-- 响应头 -->
@ -131,6 +132,7 @@
v-if="getCurrentItemState.assertionType === ResponseAssertionType.SCRIPT" v-if="getCurrentItemState.assertionType === ResponseAssertionType.SCRIPT"
v-model:data="getCurrentItemState" v-model:data="getCurrentItemState"
:disabled="props.disabled" :disabled="props.disabled"
:script-code-editor-height="props.scriptCodeEditorHeight"
@change="handleChange" @change="handleChange"
@delete-script-item="deleteScriptItem" @delete-script-item="deleteScriptItem"
@copy="copyItem" @copy="copyItem"
@ -188,6 +190,7 @@
response?: string; // response?: string; //
disabled?: boolean; // disabled?: boolean; //
showExtraction?: boolean; // showExtraction?: boolean; //
scriptCodeEditorHeight?: string; //
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
@ -454,11 +457,11 @@
<style lang="less" scoped> <style lang="less" scoped>
.ms-assertion { .ms-assertion {
width: 100%; width: 100%;
height: calc(100% - 22px); height: 100%;
&-body { &-body {
display: flex; display: flex;
margin-top: 8px; margin-top: 8px;
height: calc(100% - 42px); height: calc(100% - 52px);
flex-flow: row nowrap; flex-flow: row nowrap;
gap: 8px; gap: 8px;
&-left { &-left {
@ -528,6 +531,7 @@
} }
&-right { &-right {
display: flex; display: flex;
flex: 1;
flex-grow: 1; flex-grow: 1;
border-radius: 4px; border-radius: 4px;
background: var(--color-text-fff); background: var(--color-text-fff);

View File

@ -141,7 +141,6 @@
v-model:params="paramsList" v-model:params="paramsList"
:confirm-loading="confirmLoading" :confirm-loading="confirmLoading"
:script-id="isEditId" :script-id="isEditId"
ok-text="project.commonScript.apply"
:enable-radio-selected="radioSelected" :enable-radio-selected="radioSelected"
@save="saveHandler" @save="saveHandler"
/> />
@ -387,11 +386,7 @@
await addOrUpdateCommonScriptReq(paramsObj); await addOrUpdateCommonScriptReq(paramsObj);
showScriptDrawer.value = false; showScriptDrawer.value = false;
initData(); initData();
Message.success( Message.success(form.id ? t('common.updateSuccess') : t('common.createSuccess'));
form.status === 'DRAFT'
? t('project.commonScript.saveDraftSuccessfully')
: t('project.commonScript.appliedSuccessfully')
);
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} finally { } finally {

View File

@ -9,7 +9,7 @@
:ok-loading="props.confirmLoading" :ok-loading="props.confirmLoading"
:mask-closable="false" :mask-closable="false"
save-continue-text="project.commonScript.saveAsDraft" save-continue-text="project.commonScript.saveAsDraft"
ok-text="project.commonScript.apply" :ok-text="form.id ? t('common.update') : t('common.create')"
@confirm="handleDrawerConfirm" @confirm="handleDrawerConfirm"
@cancel="handleDrawerCancel" @cancel="handleDrawerCancel"
> >
@ -209,8 +209,8 @@
} }
function handleDrawerCancel() { function handleDrawerCancel() {
emit('close');
reset(); reset();
emit('close');
} }
const editScriptId = ref<string | undefined>(''); const editScriptId = ref<string | undefined>('');

View File

@ -20,13 +20,13 @@
</div> </div>
</div> </div>
<div v-if="props.showType === 'commonScript'" class="flex bg-[var(--color-bg-3)]"> <div v-if="props.showType === 'commonScript'" class="flex bg-[var(--color-bg-3)]">
<div class="relative w-full"> <div class="relative h-full w-full">
<MsCodeEditor <MsCodeEditor
ref="codeEditorRef" ref="codeEditorRef"
v-model:model-value="code" v-model:model-value="code"
title="" title=""
:width="expandMenu ? '100%' : '68%'" :width="expandMenu ? '100%' : '68%'"
height="460px" :height="props.scriptCodeEditorHeight || '460px'"
theme="vs" theme="vs"
:language="language" :language="language"
:read-only="props.disabled" :read-only="props.disabled"
@ -95,6 +95,7 @@
disabled?: boolean; disabled?: boolean;
enableRadioSelected?: boolean; enableRadioSelected?: boolean;
showHeader?: boolean; showHeader?: boolean;
scriptCodeEditorHeight?: string;
}>(), }>(),
{ {
showHeader: true, showHeader: true,

View File

@ -196,6 +196,7 @@
:disabled="props.disabled" :disabled="props.disabled"
show-type="commonScript" show-type="commonScript"
:show-header="false" :show-header="false"
:script-code-editor-height="props.scriptCodeEditorHeight"
@change="() => emit('change')" @change="() => emit('change')"
/> />
</div> </div>
@ -535,6 +536,7 @@
showPrePostRequest?: boolean; // showPrePostRequest?: boolean; //
totalList?: ExecuteConditionProcessor[]; // totalList?: ExecuteConditionProcessor[]; //
sqlCodeEditorHeight?: string; // sql sqlCodeEditorHeight?: string; // sql
scriptCodeEditorHeight?: string; //
}>(), }>(),
{ {
showAssociatedScene: false, showAssociatedScene: false,

View File

@ -4,6 +4,7 @@
:is-definition="false" :is-definition="false"
:assertion-config="assertionConfig" :assertion-config="assertionConfig"
:show-extraction="true" :show-extraction="true"
script-code-editor-height="calc(100vh - 340px)"
@change="emit('change')" @change="emit('change')"
/> />
</template> </template>

View File

@ -225,6 +225,7 @@
:disabled="!isEditableApi" :disabled="!isEditableApi"
:assertion-config="requestVModel.children[0].assertionConfig" :assertion-config="requestVModel.children[0].assertionConfig"
:show-extraction="true" :show-extraction="true"
script-code-editor-height="calc(100vh - 242px)"
/> />
<auth <auth
v-else-if="requestVModel.activeTab === RequestComposition.AUTH" v-else-if="requestVModel.activeTab === RequestComposition.AUTH"

View File

@ -29,6 +29,7 @@
v-model:data="activeItem" v-model:data="activeItem"
:disabled="isReadonly" :disabled="isReadonly"
:is-build-in="true" :is-build-in="true"
script-code-editor-height="calc(100vh - 306px)"
@change="unSaved = true" @change="unSaved = true"
/> />
</div> </div>

View File

@ -115,7 +115,6 @@
v-model:params="paramsList" v-model:params="paramsList"
:confirm-loading="confirmLoading" :confirm-loading="confirmLoading"
:script-id="isEditId" :script-id="isEditId"
ok-text="project.commonScript.apply"
:enable-radio-selected="radioSelected" :enable-radio-selected="radioSelected"
@save="saveHandler" @save="saveHandler"
/> />
@ -372,11 +371,7 @@
await addOrUpdateCommonScriptReq(paramsObj); await addOrUpdateCommonScriptReq(paramsObj);
showScriptDrawer.value = false; showScriptDrawer.value = false;
initData(); initData();
Message.success( Message.success(form.id ? t('common.updateSuccess') : t('common.createSuccess'));
form.status === 'DRAFT'
? t('project.commonScript.saveDraftSuccessfully')
: t('project.commonScript.appliedSuccessfully')
);
if (showDetailDrawer.value) { if (showDetailDrawer.value) {
scriptDetailDrawer.value.getDetail(); scriptDetailDrawer.value.getDetail();
} }