feat: 表格异步初始化column
This commit is contained in:
parent
85b5d49bd6
commit
721f9115c1
|
@ -39,7 +39,7 @@ export default function useTableProps<T>(
|
||||||
data: [], // 表格数据
|
data: [], // 表格数据
|
||||||
/**
|
/**
|
||||||
* 表格列配置
|
* 表格列配置
|
||||||
* 当showSetting为true时,此配置无效,通过TableStore.initColumn(tableKey: string, column: MsTableColumn)初始化。
|
* 当showSetting为true时,此配置无效,通过 await tableStore.initColumn(tableKey: string, column: MsTableColumn)初始化。
|
||||||
* 当showSetting为false时,此配置生效
|
* 当showSetting为false时,此配置生效
|
||||||
*/
|
*/
|
||||||
columns: [] as MsTableColumn,
|
columns: [] as MsTableColumn,
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
<transition name="fade" mode="out-in" appear>
|
<transition name="fade" mode="out-in" appear>
|
||||||
<!-- transition内必须有且只有一个根元素,不然会导致二级路由的组件无法渲染 -->
|
<!-- transition内必须有且只有一个根元素,不然会导致二级路由的组件无法渲染 -->
|
||||||
<div v-show="true" class="page-content">
|
<div v-show="true" class="page-content">
|
||||||
<component :is="Component" v-if="!route.meta.isCache" :key="route.fullPath" />
|
<Suspense v-if="!route.meta.isCache">
|
||||||
|
<component :is="Component" :key="route.fullPath" />
|
||||||
|
</Suspense>
|
||||||
<keep-alive v-else>
|
<keep-alive v-else>
|
||||||
<component :is="Component" :key="route.fullPath" />
|
<component :is="Component" :key="route.fullPath" />
|
||||||
</keep-alive>
|
</keep-alive>
|
||||||
|
|
|
@ -157,7 +157,7 @@
|
||||||
|
|
||||||
const tableStore = useTableStore();
|
const tableStore = useTableStore();
|
||||||
|
|
||||||
tableStore.initColumn(TableKeyEnum.API_TEST, columns, 'drawer');
|
await tableStore.initColumn(TableKeyEnum.API_TEST, columns, 'drawer');
|
||||||
|
|
||||||
const { propsRes, propsEvent, loadList } = useTable(getTableList, {
|
const { propsRes, propsEvent, loadList } = useTable(getTableList, {
|
||||||
columns,
|
columns,
|
||||||
|
|
|
@ -168,7 +168,7 @@
|
||||||
showInTable: true,
|
showInTable: true,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
tableStore.initColumn(TableKeyEnum.PROJECT_MEMBER, columns, 'drawer');
|
await tableStore.initColumn(TableKeyEnum.PROJECT_MEMBER, columns, 'drawer');
|
||||||
|
|
||||||
const tableBatchActions = {
|
const tableBatchActions = {
|
||||||
baseAction: [
|
baseAction: [
|
||||||
|
|
|
@ -204,7 +204,7 @@
|
||||||
showDrag: false,
|
showDrag: false,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
tableStore.initColumn(TableKeyEnum.ORGANIZATION_MEMBER, columns, 'drawer');
|
await tableStore.initColumn(TableKeyEnum.ORGANIZATION_MEMBER, columns, 'drawer');
|
||||||
|
|
||||||
const tableBatchActions = {
|
const tableBatchActions = {
|
||||||
baseAction: [
|
baseAction: [
|
||||||
|
|
|
@ -171,7 +171,7 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
tableStore.initColumn(TableKeyEnum.ORGANIZATION_PROJECT, organizationColumns, 'drawer');
|
await tableStore.initColumn(TableKeyEnum.ORGANIZATION_PROJECT, organizationColumns, 'drawer');
|
||||||
|
|
||||||
const { propsRes, propsEvent, loadList, setKeyword, setLoadListParams } = useTable(
|
const { propsRes, propsEvent, loadList, setKeyword, setLoadListParams } = useTable(
|
||||||
postProjectTableByOrg,
|
postProjectTableByOrg,
|
||||||
|
|
|
@ -129,7 +129,7 @@
|
||||||
showDrag: false,
|
showDrag: false,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
tableStore.initColumn(TableKeyEnum.ORGANIZATION_TEMPLATE_FIELD_SETTING, fieldColumns, 'drawer');
|
await tableStore.initColumn(TableKeyEnum.ORGANIZATION_TEMPLATE_FIELD_SETTING, fieldColumns, 'drawer');
|
||||||
|
|
||||||
const { propsRes, propsEvent, loadList, setLoadListParams, setProps } = useTable(getFieldList, {
|
const { propsRes, propsEvent, loadList, setLoadListParams, setProps } = useTable(getFieldList, {
|
||||||
tableKey: TableKeyEnum.ORGANIZATION_TEMPLATE_FIELD_SETTING,
|
tableKey: TableKeyEnum.ORGANIZATION_TEMPLATE_FIELD_SETTING,
|
||||||
|
|
|
@ -107,7 +107,7 @@
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
tableStore.initColumn(TableKeyEnum.ORGANIZATION_TEMPLATE_MANAGEMENT, fieldColumns, 'drawer');
|
await tableStore.initColumn(TableKeyEnum.ORGANIZATION_TEMPLATE_MANAGEMENT, fieldColumns, 'drawer');
|
||||||
const { propsRes, propsEvent, loadList, setLoadListParams, setProps } = useTable(getOrganizeTemplateList, {
|
const { propsRes, propsEvent, loadList, setLoadListParams, setProps } = useTable(getOrganizeTemplateList, {
|
||||||
tableKey: TableKeyEnum.ORGANIZATION_TEMPLATE_MANAGEMENT,
|
tableKey: TableKeyEnum.ORGANIZATION_TEMPLATE_MANAGEMENT,
|
||||||
scroll: { x: '1000px' },
|
scroll: { x: '1000px' },
|
||||||
|
|
|
@ -139,7 +139,7 @@
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
tableStore.initColumn(TableKeyEnum.ORGANIZATION_TEMPLATE_MANAGEMENT_FIELD, columns.value, 'drawer');
|
await tableStore.initColumn(TableKeyEnum.ORGANIZATION_TEMPLATE_MANAGEMENT_FIELD, columns.value, 'drawer');
|
||||||
const { propsRes, propsEvent, setProps } = useTable(undefined, {
|
const { propsRes, propsEvent, setProps } = useTable(undefined, {
|
||||||
tableKey: TableKeyEnum.ORGANIZATION_TEMPLATE_MANAGEMENT_FIELD,
|
tableKey: TableKeyEnum.ORGANIZATION_TEMPLATE_MANAGEMENT_FIELD,
|
||||||
scroll: { x: '1800px' },
|
scroll: { x: '1800px' },
|
||||||
|
|
|
@ -156,7 +156,6 @@
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
tableStore.initColumn(TableKeyEnum.ORGANIZATION_TEMPLATE_MANAGEMENT_STEP, templateFieldColumns, 'drawer');
|
|
||||||
const { propsRes, propsEvent, setProps } = useTable(undefined, {
|
const { propsRes, propsEvent, setProps } = useTable(undefined, {
|
||||||
tableKey: TableKeyEnum.ORGANIZATION_TEMPLATE_MANAGEMENT_STEP,
|
tableKey: TableKeyEnum.ORGANIZATION_TEMPLATE_MANAGEMENT_STEP,
|
||||||
scroll: { x: '800px' },
|
scroll: { x: '800px' },
|
||||||
|
@ -235,15 +234,15 @@
|
||||||
formRules.value = result;
|
formRules.value = result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
defineExpose({
|
||||||
|
getFormRules,
|
||||||
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
setProps({ data: [{ id: 1, showStep: false, showExpected: false }] });
|
setProps({ data: [{ id: 1, showStep: false, showExpected: false }] });
|
||||||
getFormRules();
|
getFormRules();
|
||||||
});
|
});
|
||||||
|
await tableStore.initColumn(TableKeyEnum.ORGANIZATION_TEMPLATE_MANAGEMENT_STEP, templateFieldColumns, 'drawer');
|
||||||
defineExpose({
|
|
||||||
getFormRules,
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
|
|
|
@ -158,8 +158,6 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
tableStore.initColumn(TableKeyEnum.SYSTEM_ORGANIZATION, organizationColumns, 'drawer');
|
|
||||||
|
|
||||||
const { propsRes, propsEvent, loadList, setKeyword, setLoading } = useTable(
|
const { propsRes, propsEvent, loadList, setKeyword, setLoading } = useTable(
|
||||||
postOrgTable,
|
postOrgTable,
|
||||||
{
|
{
|
||||||
|
@ -306,9 +304,15 @@
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
fetchData,
|
fetchData,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
fetchData();
|
||||||
|
});
|
||||||
|
await tableStore.initColumn(TableKeyEnum.SYSTEM_ORGANIZATION, organizationColumns, 'drawer');
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -156,8 +156,6 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
tableStore.initColumn(TableKeyEnum.SYSTEM_PROJECT, organizationColumns, 'drawer');
|
|
||||||
|
|
||||||
const { propsRes, propsEvent, loadList, setKeyword } = useTable(
|
const { propsRes, propsEvent, loadList, setKeyword } = useTable(
|
||||||
postProjectTable,
|
postProjectTable,
|
||||||
{
|
{
|
||||||
|
@ -304,6 +302,8 @@
|
||||||
defineExpose({
|
defineExpose({
|
||||||
fetchData,
|
fetchData,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await tableStore.initColumn(TableKeyEnum.SYSTEM_PROJECT, organizationColumns, 'drawer');
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
Loading…
Reference in New Issue