fix(用例管理): 排查详情tabbug

This commit is contained in:
xinxin.wu 2024-02-27 15:35:33 +08:00 committed by 刘瑞斌
parent 88fa490872
commit 649b819328
5 changed files with 110 additions and 143 deletions

View File

@ -63,6 +63,7 @@
<ScriptDefined
v-model:language="form.type"
v-model:code="form.script"
v-model:execution-result="form.result"
:show-type="scriptType"
:enable-radio-selected="props.enableRadioSelected"
/>
@ -219,13 +220,6 @@
}
);
// watchEffect(() => {
// editScriptId.value = props.scriptId;
// if (editScriptId.value) {
// getDetail();
// }
// });
watch(
() => showScriptDrawer.value,
(val) => {
@ -247,10 +241,10 @@
try {
const { type, script } = form.value;
const parameters = innerParams.value
.filter((item: any) => item.name && item.value)
.filter((item: any) => item.key && item.value)
.map((item) => {
return {
key: item.name,
key: item.key,
value: item.value,
valid: item.mustContain,
};
@ -272,41 +266,16 @@
run();
}
const executionResult = ref<string>('');
// TODO
function onDebugMessage(e: any) {
// console.log(e.data);
if (e.data) {
try {
// websocket.value.close();
executionResult.value = JSON.parse(e.data);
console.log(JSON.parse(e.data));
} catch (error) {
// websocket.value.close();
console.log(error);
}
}
}
// TODO
function debugSocket() {
websocket.value = getSocket(reportId.value);
websocket.value.onmessage = onDebugMessage;
websocket.value.onopen = onOpen;
websocket.value.addEventListener('open', (event) => {
console.log('打开:', event);
});
websocket.value.addEventListener('message', (event) => {
console.log('接收:', event.data);
});
websocket.value.addEventListener('close', (event) => {
console.log('关闭:', event);
});
websocket.value.addEventListener('error', (event) => {
console.error('错误:', event);
websocket.value.addEventListener('message', (event: any) => {
const result = JSON.parse(event.data);
if (result.msgType === 'EXEC_RESULT') {
form.value.result = result.taskResult.console;
scriptType.value = 'executionResult';
websocket.value.close();
}
});
}
@ -323,10 +292,6 @@
}
}
);
// onBeforeUnmount(() => {
// editScriptId.value = '';
// });
</script>
<style scoped></style>

View File

@ -184,6 +184,7 @@ ${item.script}
insertHandler,
undoHandler,
clearCode,
executionResultValue,
});
</script>

View File

@ -45,7 +45,7 @@ export interface ParamsRequestType {
max: number;
min: number;
mustContain: boolean; // 必填
name: string;
key: string;
required: boolean;
type: string;
value: string;

View File

@ -92,7 +92,7 @@
height: 'calc(100% - 86px)',
}"
>
<MsSplitBox
<!-- <MsSplitBox
ref="wrapperRef"
class="h-[calc(100% - 78px)]"
expand-direction="right"
@ -100,101 +100,101 @@
:min="0.7"
:size="900"
>
<template #first>
<div class="leftWrapper">
<div class="header h-[50px]">
<a-menu mode="horizontal" :default-selected-keys="[activeTab || 'detail']" @menu-item-click="clickMenu">
<a-menu-item key="detail">{{ t('caseManagement.featureCase.detail') }} </a-menu-item>
<a-menu-item v-for="tab of tabSetting" :key="tab.key">
<div class="flex items-center">
<span>{{ t(tab.title) }}</span>
<a-badge
class="ml-1"
:class="activeTab === tab.key ? 'active' : ''"
:text="getTotal(tab.total)"
/> </div
></a-menu-item>
<a-menu-item key="setting">
<span @click="showMenuSetting">{{
t('caseManagement.featureCase.detailDisplaySetting')
}}</span></a-menu-item
>
</a-menu>
</div>
<div class="leftContent mt-4 px-4">
<TabDetail
v-if="activeTab === 'detail'"
ref="tabDetailRef"
:form="detailInfo"
:allow-edit="true"
:form-rules="formItem"
@update-success="updateSuccess"
/>
<TabDemand v-else-if="activeTab === 'requirement'" :case-id="props.detailId" />
<TabCaseTable v-else-if="activeTab === 'case'" :case-id="props.detailId" />
<TabDefect v-else-if="activeTab === 'bug'" :case-id="props.detailId" />
<TabDependency v-else-if="activeTab === 'dependency'" :case-id="props.detailId" />
<TabCaseReview v-else-if="activeTab === 'caseReview'" :case-id="props.detailId" />
<TabTestPlan v-else-if="activeTab === 'testPlan'" />
<TabComment v-else-if="activeTab === 'comments'" ref="commentRef" :case-id="props.detailId" />
<TabChangeHistory v-else-if="activeTab === 'changeHistory'" :case-id="props.detailId" />
</div>
</div>
</template>
<template #second>
<div class="rightWrapper p-[24px]">
<div class="mb-4 font-medium">{{ t('caseManagement.featureCase.basicInfo') }}</div>
<div class="baseItem">
<span class="label"> {{ t('caseManagement.featureCase.tableColumnModule') }}</span>
<span class="w-[calc(100%-36%)]">
<a-tree-select
v-model="detailInfo.moduleId"
:data="caseTree"
class="w-full"
:allow-search="true"
:field-names="{
title: 'name',
key: 'id',
children: 'children',
}"
:tree-props="{
virtualListProps: {
height: 200,
},
}"
@change="handleChangeModule"
></a-tree-select>
</span>
</div>
<!-- 自定义字段开始 -->
<MsFormCreate
v-if="formRules.length"
ref="formCreateRef"
v-model:api="fApi"
v-model:form-item="formItem"
:form-rule="formRules"
<template #first> -->
<div class="leftWrapper">
<div class="header h-[50px]">
<a-menu mode="horizontal" :default-selected-keys="[activeTab || 'detail']" @menu-item-click="clickMenu">
<a-menu-item key="detail">{{ t('caseManagement.featureCase.detail') }} </a-menu-item>
<a-menu-item v-for="tab of tabSetting" :key="tab.key">
<div class="flex items-center">
<span>{{ t(tab.title) }}</span>
<a-badge
class="ml-1"
:class="activeTab === tab.key ? 'active' : ''"
:text="getTotal(tab.total)"
/> </div
></a-menu-item>
<a-menu-item key="setting">
<span @click="showMenuSetting">{{
t('caseManagement.featureCase.detailDisplaySetting')
}}</span></a-menu-item
>
</a-menu>
</div>
<div class="leftContent mt-4 px-4">
<TabDetail
v-if="activeTab === 'detail'"
ref="tabDetailRef"
:form="detailInfo"
:allow-edit="true"
:form-rules="formItem"
@update-success="updateSuccess"
/>
<TabDemand v-else-if="activeTab === 'requirement'" :case-id="props.detailId" />
<TabCaseTable v-else-if="activeTab === 'case'" :case-id="props.detailId" />
<TabDefect v-else-if="activeTab === 'bug'" :case-id="props.detailId" />
<TabDependency v-else-if="activeTab === 'dependency'" :case-id="props.detailId" />
<TabCaseReview v-else-if="activeTab === 'caseReview'" :case-id="props.detailId" />
<TabTestPlan v-else-if="activeTab === 'testPlan'" />
<TabComment v-else-if="activeTab === 'comments'" ref="commentRef" :case-id="props.detailId" />
<TabChangeHistory v-else-if="activeTab === 'changeHistory'" :case-id="props.detailId" />
</div>
</div>
<!-- </template> -->
<!-- <template #second> -->
<div class="rightWrapper p-[24px]">
<div class="mb-4 font-medium">{{ t('caseManagement.featureCase.basicInfo') }}</div>
<div class="baseItem">
<span class="label"> {{ t('caseManagement.featureCase.tableColumnModule') }}</span>
<span class="w-[calc(100%-36%)]">
<a-tree-select
v-model="detailInfo.moduleId"
:data="caseTree"
class="w-full"
:option="options"
@change="changeHandler"
/>
<!-- 自定义字段结束 -->
<div class="baseItem">
<span class="label"> {{ t('caseManagement.featureCase.tableColumnCreateUser') }}</span>
<span>{{ detailInfo?.createUserName }}</span>
</div>
<div class="baseItem">
<span class="label"> {{ t('caseManagement.featureCase.tableColumnCreateTime') }}</span>
<span>{{ dayjs(detailInfo?.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
</div>
<div class="baseItem">
<span class="label"> {{ t('caseManagement.featureCase.tableColumnCreateTime') }}</span>
<span>
<MsTag v-for="item of detailInfo.tags" :key="item"> {{ item }} </MsTag>
</span>
</div>
</div>
</template>
</MsSplitBox>
:allow-search="true"
:field-names="{
title: 'name',
key: 'id',
children: 'children',
}"
:tree-props="{
virtualListProps: {
height: 200,
},
}"
@change="handleChangeModule"
></a-tree-select>
</span>
</div>
<!-- 自定义字段开始 -->
<MsFormCreate
v-if="formRules.length"
ref="formCreateRef"
v-model:api="fApi"
v-model:form-item="formItem"
:form-rule="formRules"
class="w-full"
:option="options"
@change="changeHandler"
/>
<!-- 自定义字段结束 -->
<div class="baseItem">
<span class="label"> {{ t('caseManagement.featureCase.tableColumnCreateUser') }}</span>
<span>{{ detailInfo?.createUserName }}</span>
</div>
<div class="baseItem">
<span class="label"> {{ t('caseManagement.featureCase.tableColumnCreateTime') }}</span>
<span>{{ dayjs(detailInfo?.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
</div>
<div class="baseItem">
<span class="label"> {{ t('caseManagement.featureCase.tableColumnCreateTime') }}</span>
<span>
<MsTag v-for="item of detailInfo.tags" :key="item"> {{ item }} </MsTag>
</span>
</div>
</div>
<!-- </template> -->
<!-- </MsSplitBox> -->
<inputComment
v-model:content="content"
v-model:notice-user-ids="noticeUserIds"

View File

@ -152,7 +152,7 @@
slotName: 'tags',
showInTable: true,
isTag: true,
width: 150,
width: 456,
showDrag: true,
},
{
@ -195,7 +195,7 @@
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector, setProps } = useTable(
getCommonScriptPage,
{
scroll: { x: '100%' },
scroll: { x: 1200 },
tableKey: TableKeyEnum.ORGANIZATION_PROJECT_COMMON_SCRIPT,
heightUsed: 290,
showSetting: true,
@ -302,6 +302,7 @@
}
function addCommonScript() {
isEditId.value = '';
showScriptDrawer.value = true;
}