diff --git a/src/components/common/table/baseTable.vue b/src/components/common/table/baseTable.vue index 3bf20739..91dd0fa6 100644 --- a/src/components/common/table/baseTable.vue +++ b/src/components/common/table/baseTable.vue @@ -244,6 +244,7 @@ interface Props { hideSearchKeys?: any; hideSearch?: boolean; // 隐藏整个搜索栏 showSetting?: boolean; // 是否显示设置按钮 + data?: any; // 设置默认表格数据 } const props = withDefaults(defineProps(), { @@ -274,6 +275,7 @@ const props = withDefaults(defineProps(), { hideSearchKeys: [], hideSearch: false, showSetting: true, + data: [], }); const tableData = ref([]); @@ -346,6 +348,14 @@ watch( { deep: true, immediate: true } ); +watch( + () => props.data, + (val) => { + setDataFun(val); + }, + { deep: true } +); + onMounted(() => { initFun(); }); @@ -396,6 +406,10 @@ const getHeadDataFun = () => { }; // 获取表单数据 const getTableDataFun = () => { + if (props.data.length > 0) { + setDataFun(props.data); + return; + } const reqParams: ApiParams = { current: current.value, size: size.value, diff --git a/src/views/index/approvalPreview/components/knowledge.vue b/src/views/index/approvalPreview/components/knowledge.vue index b89dd593..f3b20e42 100644 --- a/src/views/index/approvalPreview/components/knowledge.vue +++ b/src/views/index/approvalPreview/components/knowledge.vue @@ -11,6 +11,7 @@ :tableName="TABLE_NAME.SIMULATION_KNOWLEDGE_APPROVE_PREVIEW" showIndex :actionList="actionList" + :data="knowledgeList" hidePagination >