mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-02 12:09:13 +08:00
feat(项目管理): 菜单管理页面重构
This commit is contained in:
parent
baee47946f
commit
9a00d86d56
@ -5,4 +5,4 @@
|
||||
|
||||
**/*.svg
|
||||
**/*.sh
|
||||
src/auto-imports.js
|
||||
src/auto-import.d.ts
|
@ -4,6 +4,7 @@ import type {
|
||||
MenuTableListItem,
|
||||
MenuTableListParams,
|
||||
MenuTableConfigItem,
|
||||
PoolOption,
|
||||
} from '@/models/projectManagement/menuManagement';
|
||||
import { MenuEnum } from '@/enums/commonEnum';
|
||||
|
||||
@ -20,6 +21,30 @@ export async function postTabletList(params: TableQueryParams): Promise<CommonLi
|
||||
return Promise.resolve(result);
|
||||
}
|
||||
|
||||
// 获取资源池
|
||||
export async function getPoolOptions(projectId: string, type: MenuEnum) {
|
||||
let suffix = '';
|
||||
if (type === MenuEnum.apiTest) {
|
||||
suffix = 'api';
|
||||
}
|
||||
if (type === MenuEnum.uiTest) {
|
||||
suffix = 'ui';
|
||||
}
|
||||
return MSR.get<PoolOption[]>({ url: `/project/application/${suffix}/resource/pool/${projectId}` });
|
||||
}
|
||||
|
||||
// 获取审核人
|
||||
export async function getAuditorOptions(projectId: string, type: MenuEnum) {
|
||||
let suffix = '';
|
||||
if (type === MenuEnum.loadTest) {
|
||||
suffix = 'performance-test';
|
||||
}
|
||||
if (type === MenuEnum.apiTest) {
|
||||
suffix = 'api';
|
||||
}
|
||||
return MSR.get<PoolOption[]>({ url: `/project/application/${suffix}/user/${projectId}` });
|
||||
}
|
||||
|
||||
export function postUpdateMenu(data: MenuTableListParams) {
|
||||
let suffix = '';
|
||||
switch (data.type) {
|
||||
@ -73,5 +98,5 @@ export function getConfigByMenuItem(data: MenuTableListParams) {
|
||||
suffix = 'performance-test';
|
||||
break;
|
||||
}
|
||||
return MSR.post<MenuTableConfigItem[]>({ url: `${Url.getConfigByMenuTypeUrl}${suffix}`, data });
|
||||
return MSR.post<MenuTableConfigItem>({ url: `${Url.getConfigByMenuTypeUrl}${suffix}`, data });
|
||||
}
|
||||
|
118
frontend/src/auto-import.d.ts
vendored
118
frontend/src/auto-import.d.ts
vendored
@ -5,73 +5,61 @@
|
||||
// Generated by unplugin-auto-import
|
||||
export {}
|
||||
declare global {
|
||||
const EffectScope: typeof import('vue')['EffectScope'];
|
||||
const computed: typeof import('vue')['computed'];
|
||||
const createApp: typeof import('vue')['createApp'];
|
||||
const customRef: typeof import('vue')['customRef'];
|
||||
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent'];
|
||||
const defineComponent: typeof import('vue')['defineComponent'];
|
||||
const effectScope: typeof import('vue')['effectScope'];
|
||||
const getCurrentInstance: typeof import('vue')['getCurrentInstance'];
|
||||
const getCurrentScope: typeof import('vue')['getCurrentScope'];
|
||||
const h: typeof import('vue')['h'];
|
||||
const inject: typeof import('vue')['inject'];
|
||||
const isProxy: typeof import('vue')['isProxy'];
|
||||
const isReactive: typeof import('vue')['isReactive'];
|
||||
const isReadonly: typeof import('vue')['isReadonly'];
|
||||
const isRef: typeof import('vue')['isRef'];
|
||||
const markRaw: typeof import('vue')['markRaw'];
|
||||
const nextTick: typeof import('vue')['nextTick'];
|
||||
const onActivated: typeof import('vue')['onActivated'];
|
||||
const onBeforeMount: typeof import('vue')['onBeforeMount'];
|
||||
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount'];
|
||||
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate'];
|
||||
const onDeactivated: typeof import('vue')['onDeactivated'];
|
||||
const onErrorCaptured: typeof import('vue')['onErrorCaptured'];
|
||||
const onMounted: typeof import('vue')['onMounted'];
|
||||
const onRenderTracked: typeof import('vue')['onRenderTracked'];
|
||||
const onRenderTriggered: typeof import('vue')['onRenderTriggered'];
|
||||
const onScopeDispose: typeof import('vue')['onScopeDispose'];
|
||||
const onServerPrefetch: typeof import('vue')['onServerPrefetch'];
|
||||
const onUnmounted: typeof import('vue')['onUnmounted'];
|
||||
const onUpdated: typeof import('vue')['onUpdated'];
|
||||
const provide: typeof import('vue')['provide'];
|
||||
const reactive: typeof import('vue')['reactive'];
|
||||
const readonly: typeof import('vue')['readonly'];
|
||||
const ref: typeof import('vue')['ref'];
|
||||
const resolveComponent: typeof import('vue')['resolveComponent'];
|
||||
const shallowReactive: typeof import('vue')['shallowReactive'];
|
||||
const shallowReadonly: typeof import('vue')['shallowReadonly'];
|
||||
const shallowRef: typeof import('vue')['shallowRef'];
|
||||
const toRaw: typeof import('vue')['toRaw'];
|
||||
const toRef: typeof import('vue')['toRef'];
|
||||
const toRefs: typeof import('vue')['toRefs'];
|
||||
const toValue: typeof import('vue')['toValue'];
|
||||
const triggerRef: typeof import('vue')['triggerRef'];
|
||||
const unref: typeof import('vue')['unref'];
|
||||
const useAttrs: typeof import('vue')['useAttrs'];
|
||||
const useCssModule: typeof import('vue')['useCssModule'];
|
||||
const useCssVars: typeof import('vue')['useCssVars'];
|
||||
const useSlots: typeof import('vue')['useSlots'];
|
||||
const watch: typeof import('vue')['watch'];
|
||||
const watchEffect: typeof import('vue')['watchEffect'];
|
||||
const watchPostEffect: typeof import('vue')['watchPostEffect'];
|
||||
const watchSyncEffect: typeof import('vue')['watchSyncEffect'];
|
||||
const EffectScope: typeof import('vue')['EffectScope']
|
||||
const computed: typeof import('vue')['computed']
|
||||
const createApp: typeof import('vue')['createApp']
|
||||
const customRef: typeof import('vue')['customRef']
|
||||
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
|
||||
const defineComponent: typeof import('vue')['defineComponent']
|
||||
const effectScope: typeof import('vue')['effectScope']
|
||||
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
|
||||
const getCurrentScope: typeof import('vue')['getCurrentScope']
|
||||
const h: typeof import('vue')['h']
|
||||
const inject: typeof import('vue')['inject']
|
||||
const isProxy: typeof import('vue')['isProxy']
|
||||
const isReactive: typeof import('vue')['isReactive']
|
||||
const isReadonly: typeof import('vue')['isReadonly']
|
||||
const isRef: typeof import('vue')['isRef']
|
||||
const markRaw: typeof import('vue')['markRaw']
|
||||
const nextTick: typeof import('vue')['nextTick']
|
||||
const onActivated: typeof import('vue')['onActivated']
|
||||
const onBeforeMount: typeof import('vue')['onBeforeMount']
|
||||
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
|
||||
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
|
||||
const onDeactivated: typeof import('vue')['onDeactivated']
|
||||
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
|
||||
const onMounted: typeof import('vue')['onMounted']
|
||||
const onRenderTracked: typeof import('vue')['onRenderTracked']
|
||||
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
|
||||
const onScopeDispose: typeof import('vue')['onScopeDispose']
|
||||
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
|
||||
const onUnmounted: typeof import('vue')['onUnmounted']
|
||||
const onUpdated: typeof import('vue')['onUpdated']
|
||||
const provide: typeof import('vue')['provide']
|
||||
const reactive: typeof import('vue')['reactive']
|
||||
const readonly: typeof import('vue')['readonly']
|
||||
const ref: typeof import('vue')['ref']
|
||||
const resolveComponent: typeof import('vue')['resolveComponent']
|
||||
const shallowReactive: typeof import('vue')['shallowReactive']
|
||||
const shallowReadonly: typeof import('vue')['shallowReadonly']
|
||||
const shallowRef: typeof import('vue')['shallowRef']
|
||||
const toRaw: typeof import('vue')['toRaw']
|
||||
const toRef: typeof import('vue')['toRef']
|
||||
const toRefs: typeof import('vue')['toRefs']
|
||||
const toValue: typeof import('vue')['toValue']
|
||||
const triggerRef: typeof import('vue')['triggerRef']
|
||||
const unref: typeof import('vue')['unref']
|
||||
const useAttrs: typeof import('vue')['useAttrs']
|
||||
const useCssModule: typeof import('vue')['useCssModule']
|
||||
const useCssVars: typeof import('vue')['useCssVars']
|
||||
const useSlots: typeof import('vue')['useSlots']
|
||||
const watch: typeof import('vue')['watch']
|
||||
const watchEffect: typeof import('vue')['watchEffect']
|
||||
const watchPostEffect: typeof import('vue')['watchPostEffect']
|
||||
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
|
||||
}
|
||||
// for type re-export
|
||||
declare global {
|
||||
// @ts-ignore
|
||||
export type {
|
||||
Component,
|
||||
ComponentPublicInstance,
|
||||
ComputedRef,
|
||||
ExtractDefaultPropTypes,
|
||||
ExtractPropTypes,
|
||||
ExtractPublicPropTypes,
|
||||
InjectionKey,
|
||||
PropType,
|
||||
Ref,
|
||||
VNode,
|
||||
WritableComputedRef,
|
||||
} from 'vue';
|
||||
export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
|
||||
}
|
||||
|
@ -210,7 +210,6 @@
|
||||
noDisable?: boolean;
|
||||
showSetting?: boolean;
|
||||
columns: MsTableColumn;
|
||||
expandedKeys?: string[];
|
||||
spanMethod?: (params: { record: TableData; rowIndex: number; columnIndex: number }) => void;
|
||||
}>();
|
||||
const emit = defineEmits<{
|
||||
@ -221,7 +220,7 @@
|
||||
(e: 'rowSelectChange', key: string): void;
|
||||
(e: 'selectAllChange', value: SelectAllEnum): void;
|
||||
(e: 'sorterChange', value: { [key: string]: string }): void;
|
||||
(e: 'expand', record: TableData): void;
|
||||
(e: 'expand', record: TableData): void | Promise<any>;
|
||||
(e: 'clearSelector'): void;
|
||||
}>();
|
||||
const attrs = useAttrs();
|
||||
|
@ -21,14 +21,17 @@
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const props = defineProps<{ modelValue: string }>();
|
||||
const props = defineProps<{ modelValue?: string; defaultValue?: string }>();
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:modelValue', value: string): void;
|
||||
(e: 'change', value: string): void;
|
||||
}>();
|
||||
|
||||
function parseValue(v: string) {
|
||||
function parseValue(v?: string) {
|
||||
// 使用正则表达式匹配输入字符串,提取类型和值
|
||||
if (!v) {
|
||||
return { type: 'H', value: undefined, max: Number.MAX_VALUE };
|
||||
}
|
||||
const match = v.match(/^(\d+)([MYHD])$/);
|
||||
if (match) {
|
||||
const value = parseInt(match[1], 10); // 提取值并将其转换为整数
|
||||
@ -51,7 +54,7 @@
|
||||
// 如果输入字符串不匹配格式,可以抛出错误或返回一个默认值
|
||||
return { type: 'H', value: undefined, max: Number.MAX_VALUE };
|
||||
}
|
||||
const current = reactive(parseValue(props.modelValue));
|
||||
const current = reactive(parseValue(props.modelValue || props.defaultValue));
|
||||
|
||||
const handleBlur = () => {
|
||||
const result = current.value ? `${current.value}${current.type}` : '';
|
||||
|
@ -1,9 +1,7 @@
|
||||
import { MenuEnum } from '@/enums/commonEnum';
|
||||
|
||||
export interface MenuTableConfigItem {
|
||||
projectId: string;
|
||||
type: string;
|
||||
typeValue: string;
|
||||
[key: string]: any;
|
||||
}
|
||||
export interface MenuTableListItem {
|
||||
module: string;
|
||||
@ -17,3 +15,7 @@ export interface MenuTableListParams {
|
||||
type?: MenuEnum;
|
||||
typeValue?: boolean;
|
||||
}
|
||||
export interface PoolOption {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
@ -4,6 +4,8 @@ export default {
|
||||
'可根据使用场景配置各功能开关关闭后,将隐藏功能入口,成员无法访问该功能和数据;已产生的数据不够此规则影响;再次开启时,即恢复至关闭前状态',
|
||||
'project.menu.name': '菜单名称',
|
||||
'project.menu.description': '描述',
|
||||
'project.menu.pleaseConfig': '请配置',
|
||||
'project.menu.count': '条',
|
||||
|
||||
'project.menu.WORKSTATION_SYNC_RULE': '接口测试待更新同步规则',
|
||||
'project.menu.TEST_PLAN_CLEAN_REPORT': '报告保留时间范围',
|
||||
@ -24,8 +26,8 @@ export default {
|
||||
|
||||
'project.menu.CASE_PUBLIC': '公共用例库',
|
||||
'project.menu.CASE_RE_REVIEW': '重新提审',
|
||||
'project.menu.CASE_ENABLE': '关联需求',
|
||||
'project.menu.ISSUE_SYNC': '同步缺陷',
|
||||
'project.menu.CASE_RELATED': '关联需求',
|
||||
'project.menu.BUG_SYNC': '同步缺陷',
|
||||
'project.menu.CRON_EXPRESSION': '同步频率',
|
||||
'project.menu.SYNC_ENABLE': '状态',
|
||||
'project.menu.MECHANISM': '接口测试待更新同步规则',
|
||||
|
@ -7,7 +7,7 @@
|
||||
</div>
|
||||
</a-tooltip>
|
||||
</div>
|
||||
<MsBaseTable class="mt-[16px]" v-bind="propsRes" v-on="propsEvent" @expand="expandChange">
|
||||
<MsBaseTable class="mt-[16px]" v-bind="propsRes" @expand="expandChange" v-on="propsEvent">
|
||||
<template #module="{ record }">
|
||||
<div v-if="record.children">
|
||||
<MsIcon class="text-[var(--color-text-4)]" :type="getMenuIcon(record.module)" />
|
||||
@ -22,6 +22,7 @@
|
||||
<a-switch
|
||||
v-else-if="showEnableConfigList.includes(record.type)"
|
||||
v-model="record.moduleEnable"
|
||||
:default-checked="defaultChecked.includes(record.type)"
|
||||
@change="handleMenuStatusChange(record)"
|
||||
/>
|
||||
</template>
|
||||
@ -32,13 +33,13 @@
|
||||
</div>
|
||||
<div v-if="record.type === 'TEST_PLAN_CLEAN_REPORT'">
|
||||
<!-- 测试计划 报告保留时间范围 -->
|
||||
<MsTimeSelectorVue v-model="record.typeValue" />
|
||||
<MsTimeSelectorVue v-model="allValueMap['TEST_PLAN_CLEAN_REPORT']" />
|
||||
</div>
|
||||
<div v-if="record.type === 'TEST_PLAN_SHARE_REPORT'">
|
||||
<!-- 测试计划 报告链接有效期 -->
|
||||
<MsTimeSelectorVue v-model="record.typeValue" />
|
||||
<MsTimeSelectorVue v-model="allValueMap['TEST_PLAN_SHARE_REPORT']" />
|
||||
</div>
|
||||
<div v-if="record.type === 'ISSUE_SYNC'">
|
||||
<div v-if="record.type === 'BUG_SYNC'">
|
||||
<!-- 缺陷同步 -->
|
||||
<span>{{ t('project.menu.row2') }}</span>
|
||||
<div class="ml-[8px] text-[rgb(var(--primary-7))]" @click="showDefectDrawer">{{ t('project.menu.sd') }}</div>
|
||||
@ -47,7 +48,7 @@
|
||||
<!-- 用例 公共用例库 -->
|
||||
{{ t('project.menu.row3') }}
|
||||
</div>
|
||||
<div v-if="record.type === 'CASE_ENABLE'" class="flex flex-row">
|
||||
<div v-if="record.type === 'CASE_RELATED'" class="flex flex-row">
|
||||
<!-- 用例 关联需求 -->
|
||||
<div>{{ t('project.menu.row4') }}</div>
|
||||
<div class="ml-[8px] text-[rgb(var(--primary-7))]" @click="showDefectDrawer">{{ t('project.menu.rr') }}</div>
|
||||
@ -61,15 +62,20 @@
|
||||
{{ t('project.menu.row6') }}
|
||||
</div>
|
||||
<div v-if="record.type === 'API_CLEAN_REPORT'">
|
||||
<MsTimeSelectorVue v-model="record.typeValue" />
|
||||
<MsTimeSelectorVue v-model="allValueMap['API_CLEAN_REPORT']" />
|
||||
</div>
|
||||
<div v-if="record.type === 'API_SHARE_REPORT'">
|
||||
<!--接口测试 报告链接有效期 -->
|
||||
<MsTimeSelectorVue v-model="record.typeValue" />
|
||||
<MsTimeSelectorVue v-model="allValueMap['API_SHARE_REPORT']" />
|
||||
</div>
|
||||
<div v-if="record.type === 'API_RESOURCE_POOL'" class="flex flex-row items-center">
|
||||
<!--接口测试 执行资源池 -->
|
||||
<a-select v-model="record.typeValue" />
|
||||
<a-select
|
||||
v-model="allValueMap['API_RESOURCE_POOL']"
|
||||
:field-names="{ label: 'name', value: 'id' }"
|
||||
:options="apiPoolOption"
|
||||
class="w-[120px]"
|
||||
/>
|
||||
<a-tooltip :content="t('project.menu.manageTip')" position="bl">
|
||||
<div>
|
||||
<MsIcon class="ml-[4px] text-[var(--color-text-4)]" type="icon-icon-maybe_outlined" />
|
||||
@ -78,7 +84,12 @@
|
||||
</div>
|
||||
<div v-if="record.type === 'API_SCRIPT_REVIEWER'" class="flex flex-row items-center">
|
||||
<!--接口测试 脚本审核 -->
|
||||
<a-select v-model="record.typeValue" />
|
||||
<a-select
|
||||
v-model="allValueMap['API_SCRIPT_REVIEWER']"
|
||||
:field-names="{ label: 'name', value: 'id' }"
|
||||
:options="apiAuditorOption"
|
||||
class="w-[120px]"
|
||||
/>
|
||||
<a-tooltip :content="t('project.menu.manageTip')" position="bl">
|
||||
<div>
|
||||
<MsIcon class="ml-[4px] text-[var(--color-text-4)]" type="icon-icon-maybe_outlined" />
|
||||
@ -87,7 +98,18 @@
|
||||
</div>
|
||||
<div v-if="record.type === 'API_ERROR_REPORT_RULE'" class="flex w-[100%] flex-row items-center">
|
||||
<!--接口测试 误报规则 -->
|
||||
<a-select v-model="record.typeValue" class="w-[120px]" />
|
||||
<div class="error-report">
|
||||
<a-input
|
||||
v-model="allValueMap['API_ERROR_REPORT_RULE']"
|
||||
class="w-[120px]"
|
||||
disabled
|
||||
:placeholder="t('project.menu.pleaseConfig')"
|
||||
>
|
||||
<template #append>
|
||||
<div>{{ t('project.menu.count') }}</div>
|
||||
</template>
|
||||
</a-input>
|
||||
</div>
|
||||
<div class="ml-[8px] text-[rgb(var(--primary-7))]" @click="showDefectDrawer">{{ t('project.menu.far') }}</div>
|
||||
<a-tooltip :content="t('project.menu.manageTip')" position="bl">
|
||||
<div>
|
||||
@ -106,7 +128,12 @@
|
||||
</div>
|
||||
<div v-if="record.type === 'UI_RESOURCE_POOL'" class="flex flex-row items-center">
|
||||
<!--UI 执行资源池 -->
|
||||
<a-select v-model="record.typeValue" class="w-[120px]" />
|
||||
<a-select
|
||||
v-model="record.typeValue"
|
||||
:field-names="{ label: 'name', value: 'id' }"
|
||||
:options="uiPoolOption"
|
||||
class="w-[120px]"
|
||||
/>
|
||||
<a-tooltip :content="t('project.menu.manageTip')" position="bl">
|
||||
<div>
|
||||
<MsIcon class="ml-[4px] text-[var(--color-text-4)]" type="icon-icon-maybe_outlined" />
|
||||
@ -115,15 +142,27 @@
|
||||
</div>
|
||||
<div v-if="record.type === 'PERFORMANCE_TEST_CLEAN_REPORT'">
|
||||
<!--性能测试 报告保留时间范围 -->
|
||||
<MsTimeSelectorVue v-model="record.typeValue" />
|
||||
<MsTimeSelectorVue
|
||||
v-model="allValueMap['PERFORMANCE_TEST_CLEAN_REPORT']"
|
||||
:field-names="{ label: 'name', value: 'id' }"
|
||||
:default-value="defaultValueMap['PERFORMANCE_TEST_CLEAN_REPORT']"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="record.type === 'PERFORMANCE_TEST_SHARE_REPORT'">
|
||||
<!--UI 报告链接有效期 -->
|
||||
<MsTimeSelectorVue v-model="record.typeValue" />
|
||||
<MsTimeSelectorVue
|
||||
v-model="allValueMap['PERFORMANCE_TEST_SHARE_REPORT']"
|
||||
:default-value="defaultValueMap['PERFORMANCE_TEST_SHARE_REPORT']"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="record.type === 'PERFORMANCE_TEST_SCRIPT_REVIEWER'" class="flex flex-row items-center">
|
||||
<!--UI 脚本审核 -->
|
||||
<a-select v-model="record.typeValue" class="w-[120px]" />
|
||||
<a-select
|
||||
v-model="allValueMap['PERFORMANCE_TEST_SCRIPT_REVIEWER']"
|
||||
:field-names="{ label: 'name', value: 'id' }"
|
||||
:options="performanceAuditorOption"
|
||||
class="w-[120px]"
|
||||
/>
|
||||
<a-tooltip :content="t('project.menu.manageTip')" position="bl">
|
||||
<div>
|
||||
<MsIcon class="ml-[4px] text-[var(--color-text-4)]" type="icon-icon-maybe_outlined" />
|
||||
@ -134,7 +173,7 @@
|
||||
</MsBaseTable>
|
||||
<MsDrawer
|
||||
v-model:visible="defectDrawerVisible"
|
||||
:title="t('project.menu.ISSUE_SYNC')"
|
||||
:title="t('project.menu.BUG_SYNC')"
|
||||
:destroy-on-close="true"
|
||||
:closable="true"
|
||||
:mask-closable="false"
|
||||
@ -155,9 +194,15 @@
|
||||
import useTable from '@/components/pure/ms-table/useTable';
|
||||
import MsIcon from '@/components/pure/ms-icon-font/index.vue';
|
||||
import { MsTableColumn } from '@/components/pure/ms-table/type';
|
||||
import { postTabletList, postUpdateMenu, getConfigByMenuItem } from '@/api/modules/project-management/menuManagement';
|
||||
import {
|
||||
postTabletList,
|
||||
postUpdateMenu,
|
||||
getConfigByMenuItem,
|
||||
getPoolOptions,
|
||||
getAuditorOptions,
|
||||
} from '@/api/modules/project-management/menuManagement';
|
||||
import { useAppStore } from '@/store';
|
||||
import { MenuTableListItem } from '@/models/projectManagement/menuManagement';
|
||||
import { MenuTableConfigItem, MenuTableListItem, PoolOption } from '@/models/projectManagement/menuManagement';
|
||||
import { MenuEnum } from '@/enums/commonEnum';
|
||||
import { Message, TableData } from '@arco-design/web-vue';
|
||||
import MsTimeSelectorVue from '@/components/pure/ms-time-selector/MsTimeSelector.vue';
|
||||
@ -168,10 +213,17 @@
|
||||
const currentProjectId = computed(() => appStore.currentProjectId);
|
||||
const { t } = useI18n();
|
||||
const defectDrawerVisible = ref(false);
|
||||
const apiPoolOption = ref<PoolOption[]>([]);
|
||||
const uiPoolOption = ref<PoolOption[]>([]);
|
||||
const apiAuditorOption = ref<PoolOption[]>([]);
|
||||
const performanceAuditorOption = ref<PoolOption[]>([]);
|
||||
|
||||
const expandedKeys = ref<string[]>([]);
|
||||
|
||||
// 需要显示开关的配置项
|
||||
const showEnableConfigList = [
|
||||
'WORKSTATION_SYNC_RULE',
|
||||
'ISSUE_SYNC',
|
||||
'BUG_SYNC',
|
||||
'CASE_PUBLIC',
|
||||
'CASE_RE_REVIEW',
|
||||
'CASE_RELATED',
|
||||
@ -179,6 +231,26 @@
|
||||
'API_SYNC_CASE',
|
||||
'PERFORMANCE_TEST_SCRIPT_REVIEWER',
|
||||
];
|
||||
// 默认勾选的配置项
|
||||
const defaultChecked = [
|
||||
'WORKSTATION_SYNC_RULE',
|
||||
'CASE_RELATED',
|
||||
'CASE_RE_REVIEW',
|
||||
'PERFORMANCE_TEST_SCRIPT_REVIEWER',
|
||||
];
|
||||
// 默认初始值的配置项
|
||||
const defaultValueMap = {
|
||||
TEST_PLAN_CLEAN_REPORT: '30D',
|
||||
TEST_PLAN_SHARE_REPORT: '30D',
|
||||
API_CLEAN_REPORT: '30D',
|
||||
API_SHARE_REPORT: '30D',
|
||||
UI_CLEAN_REPORT: '30D',
|
||||
UI_SHARE_REPORT: '30D',
|
||||
PERFORMANCE_TEST_CLEAN_REPORT: '30D',
|
||||
PERFORMANCE_TEST_SHARE_REPORT: '30D',
|
||||
};
|
||||
|
||||
const allValueMap = ref<MenuTableConfigItem>(defaultValueMap);
|
||||
|
||||
const columns: MsTableColumn = [
|
||||
{
|
||||
@ -202,6 +274,109 @@
|
||||
},
|
||||
];
|
||||
|
||||
const getChildren = (record: MenuTableListItem) => {
|
||||
let children: MenuTableConfigItem[] = [];
|
||||
switch (record.module) {
|
||||
case MenuEnum.workstation: {
|
||||
children = [
|
||||
{
|
||||
type: 'WORKSTATION_SYNC_RULE', // 待更新列表
|
||||
},
|
||||
];
|
||||
break;
|
||||
}
|
||||
case MenuEnum.testPlan: {
|
||||
children = [
|
||||
{
|
||||
type: 'TEST_PLAN_CLEAN_REPORT', // 报告保留时间范围
|
||||
},
|
||||
{
|
||||
type: 'TEST_PLAN_SHARE_REPORT', // 报告链接有效期
|
||||
},
|
||||
];
|
||||
break;
|
||||
}
|
||||
case MenuEnum.bugManagement: {
|
||||
children = [
|
||||
{
|
||||
type: 'BUG_SYNC', // 缺陷同步
|
||||
typeEnable: 'BUG_SYNC_SYNC_ENABLE', // 缺陷同步开关
|
||||
},
|
||||
];
|
||||
break;
|
||||
}
|
||||
case MenuEnum.caseManagement: {
|
||||
children = [
|
||||
{
|
||||
type: 'CASE_PUBLIC', // 公共用例库
|
||||
},
|
||||
{
|
||||
type: 'CASE_RE_REVIEW', // 重新提审
|
||||
},
|
||||
{
|
||||
type: 'CASE_RELATED',
|
||||
typeEnable: 'CASE_RELATED_CASE_ENABLE', // 关联需求开关
|
||||
},
|
||||
];
|
||||
break;
|
||||
}
|
||||
case MenuEnum.apiTest: {
|
||||
children = [
|
||||
{
|
||||
type: 'API_URL_REPEATABLE', // 接口定义URL可重复
|
||||
},
|
||||
{
|
||||
type: 'API_CLEAN_REPORT', // 报告保留时间范围
|
||||
},
|
||||
{
|
||||
type: 'API_SHARE_REPORT', // 报告链接有效期
|
||||
},
|
||||
{
|
||||
type: 'API_RESOURCE_POOL', // 执行资源池
|
||||
},
|
||||
{
|
||||
type: 'API_SCRIPT_REVIEWER', // 脚本审核
|
||||
},
|
||||
{
|
||||
type: 'API_ERROR_REPORT_RULE', // 误报规则
|
||||
},
|
||||
{
|
||||
type: 'API_SYNC_CASE', // 用例同步
|
||||
},
|
||||
];
|
||||
break;
|
||||
}
|
||||
case MenuEnum.uiTest: {
|
||||
children = [
|
||||
{
|
||||
type: 'UI_CLEAN_REPORT', // 报告保留时间范围
|
||||
},
|
||||
{
|
||||
type: 'UI_SHARE_REPORT', // 报告链接有效期
|
||||
},
|
||||
{
|
||||
type: 'UI_RESOURCE_POOL', // 执行资源池
|
||||
},
|
||||
];
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
children = [
|
||||
{
|
||||
type: 'PERFORMANCE_TEST_CLEAN_REPORT', // 报告保留时间范围
|
||||
},
|
||||
{
|
||||
type: 'PERFORMANCE_TEST_SHARE_REPORT', // 报告链接有效期
|
||||
},
|
||||
{
|
||||
type: 'PERFORMANCE_TEST_SCRIPT_REVIEWER', // 脚本审核
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
return children;
|
||||
};
|
||||
|
||||
const { propsRes, propsEvent, loadList, setLoadListParams } = useTable(
|
||||
postTabletList,
|
||||
{
|
||||
@ -214,12 +389,42 @@
|
||||
showExpand: true,
|
||||
emptyDataShowLine: false,
|
||||
},
|
||||
(item) => ({
|
||||
...item,
|
||||
children: [],
|
||||
})
|
||||
(item) => {
|
||||
const children = getChildren(item);
|
||||
return { ...item, children };
|
||||
}
|
||||
);
|
||||
|
||||
const expandChange = async (record: TableData) => {
|
||||
try {
|
||||
if (expandedKeys.value.includes(record.module)) {
|
||||
// 收起
|
||||
expandedKeys.value = expandedKeys.value.filter((item) => item !== record.module);
|
||||
return;
|
||||
}
|
||||
expandedKeys.value = [...expandedKeys.value, record.module];
|
||||
const resultObj = await getConfigByMenuItem({
|
||||
projectId: currentProjectId.value,
|
||||
type: record.module as MenuEnum,
|
||||
});
|
||||
allValueMap.value = { ...allValueMap.value, ...resultObj };
|
||||
if (record.module === MenuEnum.apiTest && !apiPoolOption.value.length) {
|
||||
apiPoolOption.value = await getPoolOptions(currentProjectId.value, record.module);
|
||||
}
|
||||
if (record.module === MenuEnum.uiTest && !uiPoolOption.value.length) {
|
||||
uiPoolOption.value = await getPoolOptions(currentProjectId.value, record.module);
|
||||
}
|
||||
if (record.module === MenuEnum.apiTest && !apiAuditorOption.value.length) {
|
||||
apiAuditorOption.value = await getAuditorOptions(currentProjectId.value, record.module);
|
||||
}
|
||||
if (record.module === MenuEnum.loadTest && !performanceAuditorOption.value.length) {
|
||||
performanceAuditorOption.value = await getAuditorOptions(currentProjectId.value, record.module);
|
||||
}
|
||||
} catch (e) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(e);
|
||||
}
|
||||
};
|
||||
const getMenuIcon = (type: MenuEnum) => {
|
||||
switch (type) {
|
||||
case MenuEnum.workstation:
|
||||
@ -256,15 +461,6 @@
|
||||
await loadList();
|
||||
};
|
||||
|
||||
const expandChange = async (record: TableData) => {
|
||||
if (record.children && record.children.length > 0) {
|
||||
// 有子项
|
||||
return false;
|
||||
}
|
||||
record.children =
|
||||
(await getConfigByMenuItem({ projectId: currentProjectId.value, type: record.module as MenuEnum })) || [];
|
||||
};
|
||||
|
||||
const showDefectDrawer = () => {
|
||||
defectDrawerVisible.value = true;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user