fix(bug): bugFix

This commit is contained in:
baiqi 2024-11-19 11:56:04 +08:00
parent d3603bc0ff
commit 7e4341db3b
10 changed files with 32 additions and 167 deletions

View File

@ -87,7 +87,6 @@
"vue-echarts": "^6.7.3",
"vue-i18n": "^9.13.1",
"vue-router": "^4.4.0",
"vue3-ace-editor": "^2.2.4",
"vue3-colorpicker": "^2.3.0",
"xml-beautify": "^1.2.3",
"xpath": "^0.0.34"

View File

@ -1,112 +0,0 @@
<template>
<v-ace-editor
:value="currentValue"
:lang="props.lang"
:theme="props.theme"
:style="{ height: props.height, width: props.width }"
@init="editorInit"
/>
</template>
<script lang="ts" setup>
import { computed, onUnmounted, PropType, ref, watch } from 'vue';
import 'ace-builds/src-min-noconflict/ext-language_tools';
import 'ace-builds/src-min-noconflict/ext-beautify';
import 'ace-builds/src-min-noconflict/theme-github_dark';
import 'ace-builds/src-min-noconflict/theme-github';
import 'ace-builds/src-min-noconflict/theme-chrome';
import 'ace-builds/src-min-noconflict/mode-javascript';
import 'ace-builds/src-min-noconflict/mode-html';
import 'ace-builds/src-min-noconflict/mode-xml';
import 'ace-builds/src-min-noconflict/mode-json';
import 'ace-builds/src-min-noconflict/mode-java';
import ace from 'ace-builds';
import workerHtmlUrl from 'ace-builds/src-min-noconflict/worker-html?url';
import workerJavascriptUrl from 'ace-builds/src-min-noconflict/worker-javascript?url';
import workerJsonUrl from 'ace-builds/src-min-noconflict/worker-json?url';
import workerXmlUrl from 'ace-builds/src-min-noconflict/worker-xml?url';
import { VAceEditor } from 'vue3-ace-editor';
export type LangType = 'javascript' | 'html' | 'xml' | 'json' | 'java' | 'text';
export type ThemeType = 'github_dark' | 'github' | 'chrome';
const props = defineProps({
content: {
type: String,
required: true,
default: '',
},
init: {
type: Function,
},
lang: {
type: String as PropType<LangType>,
default: 'javascript',
},
theme: {
type: String as PropType<ThemeType>,
default: 'github_dark',
},
height: {
type: String,
default: '500px',
},
width: {
type: String,
default: '100%',
},
});
const emit = defineEmits(['update:content']);
const editorInstance = ref<any>(null);
const currentValue = computed({
get() {
return props.content;
},
set(val) {
emit('update:content', val);
},
});
const onLangChange = () => {
let useWorker = true;
if (props.lang === 'javascript') {
ace.config.setModuleUrl('ace/mode/javascript_worker', workerJavascriptUrl);
} else if (props.lang === 'json') {
ace.config.setModuleUrl('ace/mode/json_worker', workerJsonUrl);
} else if (props.lang === 'xml') {
ace.config.setModuleUrl('ace/mode/xml_worker', workerXmlUrl);
} else if (props.lang === 'html') {
ace.config.setModuleUrl('ace/mode/html_worker', workerHtmlUrl);
} else {
useWorker = false;
}
return useWorker;
};
const editorInit = (editor: any) => {
if (props.init) props.init(editor);
editorInstance.value = editor;
const useWorker = onLangChange();
editor.setOptions({
enableBasicAutocompletion: true,
enableSnippets: false,
enableLiveAutocompletion: true,
wrap: true,
useWorker,
});
};
watch(
() => props.lang,
() => {
onLangChange();
}
);
onUnmounted(() => {
editorInstance.value.destroy();
});
</script>

View File

@ -39,35 +39,22 @@
<ExecStatus :status="record.execStatus" />
</template>
<template #operation="{ record, rowIndex }">
<div v-if="record.historyDeleted">
<a-tooltip
v-if="record.execStatus !== ExecuteStatusEnum.PENDING"
:content="t('common.executionResultCleaned')"
position="top"
>
<MsButton
:disabled="
record.historyDeleted ||
!hasAnyPermission(['PROJECT_API_DEFINITION_CASE:READ+EXECUTE', 'PROJECT_API_REPORT:READ'])
"
class="!mr-0"
@click="showResult(record, rowIndex)"
>{{ t('apiScenario.executeHistory.execution.operation') }}
</MsButton>
</a-tooltip>
</div>
<div v-else>
<a-tooltip
v-if="record.execStatus !== ExecuteStatusEnum.PENDING"
:content="t('common.executionResultCleaned')"
position="top"
:disabled="!record.resultDeleted"
>
<MsButton
v-if="record.execStatus !== ExecuteStatusEnum.PENDING"
:disabled="
record.historyDeleted ||
record.resultDeleted ||
!hasAnyPermission(['PROJECT_API_DEFINITION_CASE:READ+EXECUTE', 'PROJECT_API_REPORT:READ'])
"
class="!mr-0"
@click="showResult(record, rowIndex)"
>{{ t('apiScenario.executeHistory.execution.operation') }}
</MsButton>
</div>
</a-tooltip>
</template>
</ms-base-table>
</div>

View File

@ -29,35 +29,22 @@
<ExecStatus :status="record.execStatus" />
</template>
<template #operation="{ record }">
<div v-if="record.historyDeleted">
<a-tooltip
v-if="record.execStatus !== ExecuteStatusEnum.PENDING"
:content="t('common.executionResultCleaned')"
position="top"
>
<MsButton
:disabled="
record.historyDeleted ||
!hasAnyPermission(['PROJECT_API_SCENARIO:READ+EXECUTE', 'PROJECT_API_REPORT:READ'])
"
class="!mr-0"
@click="showResult(record)"
>{{ t('apiScenario.executeHistory.execution.operation') }}
</MsButton>
</a-tooltip>
</div>
<div v-else>
<a-tooltip
v-if="record.execStatus !== ExecuteStatusEnum.PENDING"
:content="t('common.executionResultCleaned')"
position="top"
:disabled="!record.resultDeleted"
>
<MsButton
v-if="record.execStatus !== ExecuteStatusEnum.PENDING"
:disabled="
record.historyDeleted ||
record.resultDeleted ||
!hasAnyPermission(['PROJECT_API_SCENARIO:READ+EXECUTE', 'PROJECT_API_REPORT:READ'])
"
class="!mr-0"
@click="showResult(record)"
>{{ t('apiScenario.executeHistory.execution.operation') }}
</MsButton>
</div>
</a-tooltip>
</template>
</ms-base-table>
<!-- 场景报告抽屉 -->

View File

@ -64,16 +64,12 @@
</MsButton>
<MsButton
v-if="record.result === ExecuteResultEnum.ERROR"
v-permission="['SYSTEM_USER:READ+DELETE']"
v-permission="getCurrentPermission('STOP')"
@click="rerunTask(record)"
>
{{ t('ms.taskCenter.rerun') }}
</MsButton>
<MsButton
v-if="record.status === ExecuteStatusEnum.COMPLETED"
v-permission="['SYSTEM_USER:READ+DELETE']"
@click="checkReport(record)"
>
<MsButton v-if="record.status === ExecuteStatusEnum.COMPLETED" @click="checkReport(record)">
{{ t('ms.taskCenter.checkReport') }}
</MsButton>
</template>

View File

@ -24,10 +24,10 @@
<a-tooltip
v-if="record.execStatus !== ExecuteStatusEnum.PENDING"
:content="t('common.executionResultCleaned')"
:disabled="!record.deleted"
:disabled="!record.resultDeleted"
>
<MsButton
:disabled="record.deleted || !hasAnyPermission(['PROJECT_TEST_PLAN_REPORT:READ'])"
:disabled="record.resultDeleted || !hasAnyPermission(['PROJECT_TEST_PLAN_REPORT:READ'])"
class="!mr-0"
@click="toReport(record)"
>{{ t('apiScenario.executeHistory.execution.operation') }}

View File

@ -1,7 +1,9 @@
<template>
<div class="work-bench-content">
<div class="header-setting pb-[4px]">
<div class="setting flex items-center justify-between">
<div
class="setting sticky top-0 z-[999999] mb-[-16px] flex items-center justify-between bg-[var(--color-bg-3)] pb-[16px]"
>
<div class="flex items-center gap-[8px]">
<a-radio-group
v-model:model-value="timeForm.dayNumber"

View File

@ -1,7 +1,9 @@
<template>
<div class="flex flex-col gap-[16px]">
<template v-if="appStore.projectList.length > 0">
<div class="flex items-center justify-end gap-[12px]">
<div
class="sticky top-0 z-[999999] mb-[-16px] flex items-center justify-end gap-[12px] bg-[var(--color-bg-3)] pb-[16px]"
>
<MsProjectSelect
v-model:project="currentProject"
class="w-[240px]"

View File

@ -1,7 +1,9 @@
<template>
<div class="flex flex-col gap-[16px]">
<template v-if="appStore.projectList.length > 0">
<div class="flex items-center justify-end gap-[12px]">
<div
class="sticky top-0 z-[999999] mb-[-16px] flex items-center justify-end gap-[12px] bg-[var(--color-bg-3)] pb-[16px]"
>
<MsProjectSelect
v-model:project="currentProject"
class="w-[240px]"

View File

@ -1,7 +1,9 @@
<template>
<div class="flex flex-col gap-[16px]">
<template v-if="appStore.projectList.length > 0">
<div class="flex items-center justify-end gap-[12px]">
<div
class="sticky top-0 z-[999999] mb-[-16px] flex items-center justify-end gap-[12px] bg-[var(--color-bg-3)] pb-[16px]"
>
<MsProjectSelect
v-model:project="currentProject"
class="w-[240px]"