update:优化setDataFun为入参
This commit is contained in:
@@ -244,6 +244,7 @@ interface Props {
|
||||
hideSearchKeys?: any;
|
||||
hideSearch?: boolean; // 隐藏整个搜索栏
|
||||
showSetting?: boolean; // 是否显示设置按钮
|
||||
data?: any; // 设置默认表格数据
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
@@ -274,6 +275,7 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
hideSearchKeys: [],
|
||||
hideSearch: false,
|
||||
showSetting: true,
|
||||
data: [],
|
||||
});
|
||||
|
||||
const tableData = ref<any>([]);
|
||||
@@ -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,
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
:tableName="TABLE_NAME.SIMULATION_KNOWLEDGE_APPROVE_PREVIEW"
|
||||
showIndex
|
||||
:actionList="actionList"
|
||||
:data="knowledgeList"
|
||||
hidePagination
|
||||
>
|
||||
<template #originalName="{ row }">
|
||||
@@ -53,15 +54,15 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
});
|
||||
const knowledgeBaseName = ref<string>('');
|
||||
const knowledgeList = ref<any[]>([]);
|
||||
const baseTableRef = ref<any>(null);
|
||||
// const baseTableRef = ref<any>(null);
|
||||
watchEffect(() => {
|
||||
if (props.data) {
|
||||
const approveContents = JSON.parse(props.data?.approveContents || '{}');
|
||||
knowledgeBaseName.value = approveContents.knowledgeBaseName || '';
|
||||
knowledgeList.value = approveContents.afterData || approveContents.beforeData || null;
|
||||
if (baseTableRef.value && knowledgeList.value) {
|
||||
baseTableRef.value?.setDataFun(knowledgeList.value);
|
||||
}
|
||||
// if (baseTableRef.value && knowledgeList.value) {
|
||||
// baseTableRef.value?.setDataFun(knowledgeList.value);
|
||||
// }
|
||||
}
|
||||
});
|
||||
const currentRow = ref<any>(null);
|
||||
|
||||
Reference in New Issue
Block a user