wangshaoping 1 month ago
parent
commit
9552ce5e38
  1. 12
      io.sc.platform.core.frontend/src/platform/components/grid/WGrid.vue
  2. 1
      io.sc.platform.core.frontend/src/platform/components/grid/ts/Init.ts
  3. 1
      io.sc.platform.core.frontend/src/platform/components/grid/ts/types/PropsType.ts

12
io.sc.platform.core.frontend/src/platform/components/grid/WGrid.vue

@ -76,8 +76,8 @@
</template>
<script setup lang="ts">
import { getCurrentInstance, nextTick, onMounted, provide, ref, useAttrs, watch, watchEffect, onActivated } from 'vue';
import { $t, Tools, VueTools, eventBus } from '@/platform';
import { getCurrentInstance, nextTick, onMounted, provide, ref, useAttrs, watch, watchEffect } from 'vue';
import Body from './Body.vue';
import Editor from './extra/Editor.vue';
import CellEditor from './extra/inline-edit/CellEditor.vue';
@ -177,7 +177,7 @@ onMounted(async () => {
tools.titleFM.handleColumnTitle();
}
topRef.value?.handleQueryFormShowField();
if (props.autoFetchData && (!Tools.isEmpty(props.dataUrl) || !Tools.isEmpty(props.fetchDataUrl))) {
if (!props.refreshAfterActive && props.autoFetchData && (!Tools.isEmpty(props.dataUrl) || !Tools.isEmpty(props.fetchDataUrl))) {
await tools.reqApiFM.fetchData({
pagination: tools.table.store.pagination,
});
@ -186,6 +186,14 @@ onMounted(async () => {
}
tools.opFM.setStripe();
});
//
onActivated(() => {
if (props.refreshAfterActive) {
tools.reqApiFM.fetchData({
pagination: tools.table.store.pagination,
});
}
});
const getTableRef = () => {
return tableRef.value;

1
io.sc.platform.core.frontend/src/platform/components/grid/ts/Init.ts

@ -11,6 +11,7 @@ export class Init {
*/
public static createProps() {
return {
refreshAfterActive: { type: Boolean, default: false },// 当组件被激活时刷新一次
height: { type: Number, default: 0 }, // 表格高度
title: { type: String, default: '' }, // 表格标题
autoFetchData: { type: Boolean, default: true }, // 自动加载数据

1
io.sc.platform.core.frontend/src/platform/components/grid/ts/types/PropsType.ts

@ -1,4 +1,5 @@
export type PropsType = {
refreshAfterActive: Boolean,// 当组件被激活时自动刷新一次
/**
*
*/

Loading…
Cancel
Save