feat: 表格兼容string标签&应用管理误报规则默认展开
This commit is contained in:
parent
c461e3cf55
commit
0bde349e40
|
@ -83,13 +83,19 @@
|
||||||
</div>
|
</div>
|
||||||
</slot>
|
</slot>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="item.isTag">
|
<template v-else-if="item.isTag || item.isStringTag">
|
||||||
<template
|
<template
|
||||||
v-if="!record[item.dataIndex as string] || (Array.isArray(record[item.dataIndex as string]) && record[item.dataIndex as string].length === 0)"
|
v-if="!record[item.dataIndex as string] || (Array.isArray(record[item.dataIndex as string]) && record[item.dataIndex as string].length === 0)"
|
||||||
>
|
>
|
||||||
<slot :name="item.slotName" v-bind="{ record, rowIndex, column }"> - </slot>
|
<slot :name="item.slotName" v-bind="{ record, rowIndex, column }"> - </slot>
|
||||||
</template>
|
</template>
|
||||||
<MsTagGroup v-else :tag-list="record[item.dataIndex as string]" type="primary" theme="outline" />
|
<MsTagGroup
|
||||||
|
v-else
|
||||||
|
:is-string-tag="item.isStringTag"
|
||||||
|
:tag-list="record[item.dataIndex as string]"
|
||||||
|
type="primary"
|
||||||
|
theme="outline"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="item.slotName === SpecialColumnEnum.OPERATION">
|
<template v-else-if="item.slotName === SpecialColumnEnum.OPERATION">
|
||||||
<slot name="operation" v-bind="{ record, rowIndex }" />
|
<slot name="operation" v-bind="{ record, rowIndex }" />
|
||||||
|
|
|
@ -27,6 +27,8 @@ export interface MsTableColumnData extends TableColumnData {
|
||||||
disableTitle?: string;
|
disableTitle?: string;
|
||||||
// 当展示tooltip时,是否是Tag
|
// 当展示tooltip时,是否是Tag
|
||||||
isTag?: boolean;
|
isTag?: boolean;
|
||||||
|
// 为字符串Tag
|
||||||
|
isStringTag?: boolean;
|
||||||
// editType
|
// editType
|
||||||
editType?: ColumnEditTypeEnum;
|
editType?: ColumnEditTypeEnum;
|
||||||
// 撤销删除的组件
|
// 撤销删除的组件
|
||||||
|
|
|
@ -215,7 +215,7 @@ export default function useTableProps<T>(
|
||||||
// debug 模式下打印属性
|
// debug 模式下打印属性
|
||||||
if (propsRes.value.debug && import.meta.env.DEV) {
|
if (propsRes.value.debug && import.meta.env.DEV) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
// console.log('Table propsRes: ', propsRes.value);
|
console.log('Table propsRes: ', propsRes.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
<template>
|
<template>
|
||||||
<MsCard has-breadcrumb>
|
<MsCard simple>
|
||||||
|
<div class="mb-4">
|
||||||
|
<div class="back-btn" @click="handleBack">
|
||||||
|
<icon-arrow-left />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="mb-4 flex items-center justify-between">
|
<div class="mb-4 flex items-center justify-between">
|
||||||
<a-button type="primary" @click="showAddRule(undefined)">{{ t('project.menu.addFalseAlertRules') }}</a-button>
|
<a-button type="primary" @click="showAddRule(undefined)">{{ t('project.menu.addFalseAlertRules') }}</a-button>
|
||||||
<a-input-search
|
<a-input-search
|
||||||
|
@ -17,9 +22,6 @@
|
||||||
v-on="propsEvent"
|
v-on="propsEvent"
|
||||||
@batch-action="handleTableBatch"
|
@batch-action="handleTableBatch"
|
||||||
>
|
>
|
||||||
<template #label="{ record }">
|
|
||||||
<MsTagGroup is-string-tag theme="outline" :tag-list="record.typeList"> </MsTagGroup>
|
|
||||||
</template>
|
|
||||||
<template #operation="{ record }">
|
<template #operation="{ record }">
|
||||||
<template v-if="!record.enable">
|
<template v-if="!record.enable">
|
||||||
<MsButton class="!mr-0" @click="handleEnableOrDisableProject(record.id)">{{ t('common.enable') }}</MsButton>
|
<MsButton class="!mr-0" @click="handleEnableOrDisableProject(record.id)">{{ t('common.enable') }}</MsButton>
|
||||||
|
@ -69,6 +71,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
import { Message, TableData } from '@arco-design/web-vue';
|
import { Message, TableData } from '@arco-design/web-vue';
|
||||||
|
|
||||||
import MsButton from '@/components/pure/ms-button/index.vue';
|
import MsButton from '@/components/pure/ms-button/index.vue';
|
||||||
|
@ -79,7 +82,6 @@
|
||||||
import useTable from '@/components/pure/ms-table/useTable';
|
import useTable from '@/components/pure/ms-table/useTable';
|
||||||
import MsTableMoreAction from '@/components/pure/ms-table-more-action/index.vue';
|
import MsTableMoreAction from '@/components/pure/ms-table-more-action/index.vue';
|
||||||
import { ActionsItem } from '@/components/pure/ms-table-more-action/types';
|
import { ActionsItem } from '@/components/pure/ms-table-more-action/types';
|
||||||
import MsTagGroup from '@/components/pure/ms-tag/ms-tag-group.vue';
|
|
||||||
import MsBatchForm from '@/components/business/ms-batch-form/index.vue';
|
import MsBatchForm from '@/components/business/ms-batch-form/index.vue';
|
||||||
import { FormItemModel } from '@/components/business/ms-batch-form/types';
|
import { FormItemModel } from '@/components/business/ms-batch-form/types';
|
||||||
|
|
||||||
|
@ -95,12 +97,14 @@
|
||||||
import { useAppStore } from '@/store';
|
import { useAppStore } from '@/store';
|
||||||
|
|
||||||
import { FakeTableListItem } from '@/models/projectManagement/menuManagement';
|
import { FakeTableListItem } from '@/models/projectManagement/menuManagement';
|
||||||
|
import { ProjectManagementRouteEnum } from '@/enums/routeEnum';
|
||||||
import { TableKeyEnum } from '@/enums/tableEnum';
|
import { TableKeyEnum } from '@/enums/tableEnum';
|
||||||
|
|
||||||
type UserModalMode = 'create' | 'edit';
|
type UserModalMode = 'create' | 'edit';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
|
const router = useRouter();
|
||||||
const currentProjectId = computed(() => appStore.currentProjectId);
|
const currentProjectId = computed(() => appStore.currentProjectId);
|
||||||
const addVisible = ref(false);
|
const addVisible = ref(false);
|
||||||
const addLoading = ref(false);
|
const addLoading = ref(false);
|
||||||
|
@ -160,9 +164,8 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'project.menu.rule.label',
|
title: 'project.menu.rule.label',
|
||||||
dataIndex: 'type',
|
dataIndex: 'typeList',
|
||||||
slotName: 'label',
|
isStringTag: true,
|
||||||
isTag: true,
|
|
||||||
width: 146,
|
width: 146,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -203,9 +206,10 @@
|
||||||
selectable: true,
|
selectable: true,
|
||||||
noDisable: false,
|
noDisable: false,
|
||||||
size: 'default',
|
size: 'default',
|
||||||
|
debug: true,
|
||||||
},
|
},
|
||||||
(record: TableData) => {
|
(record: TableData) => {
|
||||||
record.typeList = record.type.split(',');
|
record.typeList = record.type ? record.type.split(',') : [];
|
||||||
record.ruleResult = getRowRuleString(record);
|
record.ruleResult = getRowRuleString(record);
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
@ -221,6 +225,12 @@
|
||||||
resetSelector();
|
resetSelector();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleBack = () => {
|
||||||
|
router.push({
|
||||||
|
name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_PERMISSION_MENU_MANAGEMENT,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const handleDelete = (v: string | BatchActionQueryParams) => {
|
const handleDelete = (v: string | BatchActionQueryParams) => {
|
||||||
openDeleteModal({
|
openDeleteModal({
|
||||||
title: t('project.menu.rule.deleteRule', { size: typeof v === 'string' ? 1 : v.currentSelectCount }),
|
title: t('project.menu.rule.deleteRule', { size: typeof v === 'string' ? 1 : v.currentSelectCount }),
|
||||||
|
@ -443,3 +453,19 @@
|
||||||
fetchData();
|
fetchData();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.back-btn {
|
||||||
|
@apply flex cursor-pointer items-center rounded-full;
|
||||||
|
|
||||||
|
margin-right: 8px;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
border: 1px solid #ffffff;
|
||||||
|
background: linear-gradient(90deg, rgb(var(--primary-9)) 3.36%, #ffffff 100%);
|
||||||
|
box-shadow: 0 0 7px rgb(15 0 78 / 9%);
|
||||||
|
.arco-icon {
|
||||||
|
color: rgb(var(--primary-5));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -87,4 +87,5 @@ export default {
|
||||||
'project.menu.rule.enableRuleTip': '开启后,展示在规则切换列表',
|
'project.menu.rule.enableRuleTip': '开启后,展示在规则切换列表',
|
||||||
'project.menu.rule.deleteRule': '确认删除 {size} 条误报规则吗?',
|
'project.menu.rule.deleteRule': '确认删除 {size} 条误报规则吗?',
|
||||||
'project.menu.rule.deleteRuleTip': '删除后,仅对新执行的测试报告生效,请谨慎操作!',
|
'project.menu.rule.deleteRuleTip': '删除后,仅对新执行的测试报告生效,请谨慎操作!',
|
||||||
|
'project.menu.rule.goBackMenu': '返回应用管理',
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,7 +7,14 @@
|
||||||
</div>
|
</div>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</div>
|
</div>
|
||||||
<MsBaseTable ref="tableRef" class="mt-[16px]" v-bind="propsRes" @expand="expandChange" v-on="propsEvent">
|
<MsBaseTable
|
||||||
|
ref="tableRef"
|
||||||
|
class="mt-[16px]"
|
||||||
|
v-bind="propsRes"
|
||||||
|
:expanded-keys="expandedKeys"
|
||||||
|
@expand="expandChange"
|
||||||
|
v-on="propsEvent"
|
||||||
|
>
|
||||||
<template #module="{ record }">
|
<template #module="{ record }">
|
||||||
<div v-if="record.children">
|
<div v-if="record.children">
|
||||||
<MsIcon class="text-[var(--color-text-4)]" :type="getMenuIcon(record.module)" />
|
<MsIcon class="text-[var(--color-text-4)]" :type="getMenuIcon(record.module)" />
|
||||||
|
@ -642,9 +649,19 @@
|
||||||
return pool?.name;
|
return pool?.name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const initExpendKeys = async () => {
|
||||||
|
if (router.currentRoute.value.redirectedFrom) {
|
||||||
|
// 从误报规则跳转回来的
|
||||||
|
await expandChange({ module: MenuEnum.apiTest });
|
||||||
|
} else {
|
||||||
|
expandedKeys.value = [];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
setLoadListParams({ projectId: currentProjectId.value });
|
setLoadListParams({ projectId: currentProjectId.value });
|
||||||
fetchData();
|
fetchData();
|
||||||
|
initExpendKeys();
|
||||||
});
|
});
|
||||||
watch(currentProjectId, () => {
|
watch(currentProjectId, () => {
|
||||||
fetchData();
|
fetchData();
|
||||||
|
|
Loading…
Reference in New Issue