fix(工作台): 缺陷列表表头刷新
This commit is contained in:
parent
05bbd1cf80
commit
18dce26d2f
|
@ -5,7 +5,7 @@
|
||||||
{{ t('ms.workbench.myFollowed.feature.BUG') }}
|
{{ t('ms.workbench.myFollowed.feature.BUG') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<MsBaseTable class="mt-[16px]" v-bind="propsRes" v-on="propsEvent">
|
<MsBaseTable ref="tableRef" class="mt-[16px]" v-bind="propsRes" v-on="propsEvent">
|
||||||
<!-- ID -->
|
<!-- ID -->
|
||||||
<template #num="{ record }">
|
<template #num="{ record }">
|
||||||
<a-button type="text" class="px-0 text-[14px] leading-[22px]" @click="handleShowDetail(record.id)">
|
<a-button type="text" class="px-0 text-[14px] leading-[22px]" @click="handleShowDetail(record.id)">
|
||||||
|
@ -37,6 +37,7 @@
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { TableData } from '@arco-design/web-vue';
|
import { TableData } from '@arco-design/web-vue';
|
||||||
|
import { cloneDeep } from 'lodash-es';
|
||||||
|
|
||||||
import MsCard from '@/components/pure/ms-card/index.vue';
|
import MsCard from '@/components/pure/ms-card/index.vue';
|
||||||
import MsBaseTable from '@/components/pure/ms-table/base-table.vue';
|
import MsBaseTable from '@/components/pure/ms-table/base-table.vue';
|
||||||
|
@ -69,7 +70,8 @@
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { openNewPage } = useOpenNewPage();
|
const { openNewPage } = useOpenNewPage();
|
||||||
|
|
||||||
let columns: MsTableColumn = [
|
const tableRef = ref<InstanceType<typeof MsBaseTable>>();
|
||||||
|
const originColumns: MsTableColumn = [
|
||||||
{
|
{
|
||||||
title: 'bugManagement.ID',
|
title: 'bugManagement.ID',
|
||||||
dataIndex: 'num',
|
dataIndex: 'num',
|
||||||
|
@ -157,6 +159,7 @@
|
||||||
showInTable: true,
|
showInTable: true,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
let columns = cloneDeep(originColumns);
|
||||||
|
|
||||||
const statusOption = ref<BugOptionItem[]>([]);
|
const statusOption = ref<BugOptionItem[]>([]);
|
||||||
async function initFilterOptions() {
|
async function initFilterOptions() {
|
||||||
|
@ -202,15 +205,23 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await getColumnHeaders();
|
try {
|
||||||
columns.splice(2, 0, ...customColumns);
|
appStore.showLoading();
|
||||||
await initFilterOptions();
|
await getColumnHeaders();
|
||||||
|
columns.splice(2, 0, ...customColumns);
|
||||||
|
await initFilterOptions();
|
||||||
|
} catch (error) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log(error);
|
||||||
|
} finally {
|
||||||
|
appStore.hideLoading();
|
||||||
|
}
|
||||||
|
|
||||||
const workbenchBugPage = computed(() => {
|
const workbenchBugPage = computed(() => {
|
||||||
return props.type === 'my_todo' ? workbenchTodoBugList : workbenchBugList;
|
return props.type === 'my_todo' ? workbenchTodoBugList : workbenchBugList;
|
||||||
});
|
});
|
||||||
|
|
||||||
const { propsRes, propsEvent, setLoadListParams, loadList } = useTable(
|
const { propsRes, propsEvent, setLoadListParams, setLoading, loadList } = useTable(
|
||||||
workbenchBugPage.value,
|
workbenchBugPage.value,
|
||||||
{
|
{
|
||||||
columns,
|
columns,
|
||||||
|
@ -251,7 +262,7 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
async function init() {
|
||||||
setLoadListParams({
|
setLoadListParams({
|
||||||
projectId: props.project,
|
projectId: props.project,
|
||||||
viewId: props.type,
|
viewId: props.type,
|
||||||
|
@ -260,14 +271,29 @@
|
||||||
loadList();
|
loadList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function refresh() {
|
||||||
|
try {
|
||||||
|
setLoading(true);
|
||||||
|
columns = cloneDeep(originColumns);
|
||||||
|
await getColumnHeaders();
|
||||||
|
columns.splice(2, 0, ...customColumns);
|
||||||
|
await initFilterOptions();
|
||||||
|
tableRef.value?.initColumn(columns);
|
||||||
|
init();
|
||||||
|
} catch (error) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.refreshId,
|
() => props.refreshId,
|
||||||
() => {
|
() => {
|
||||||
init();
|
refresh();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onMounted(() => {
|
||||||
init();
|
init();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue