Browse Source

修复部分问题

main
likunming 3 months ago
parent
commit
1a139f77cd
  1. 1
      io.sc.platform.core.frontend/src/platform/components/grid/Td.vue
  2. 2
      io.sc.platform.core.frontend/src/platform/components/grid/WGrid.vue
  3. 32
      io.sc.platform.core.frontend/src/platform/components/grid/extra/inline-edit/CellEditor.vue
  4. 5
      io.sc.platform.core.frontend/src/platform/components/grid/ts/constant/src/EditStatus.ts
  5. 2
      io.sc.platform.core.frontend/src/platform/components/grid/ts/expose-api/ExposeApiManager.ts
  6. 22
      io.sc.platform.core.frontend/src/platform/components/grid/ts/expose-api/src/ComponentRef.ts
  7. 3
      io.sc.platform.core.frontend/src/platform/components/grid/ts/toolbar/buttons/CellEdit.ts

1
io.sc.platform.core.frontend/src/platform/components/grid/Td.vue

@ -150,6 +150,7 @@ const tdClick = () => {
} }
} }
} }
if (tools.table.store.inlineEditStatus === Constant.EDIT_STATUS.NONE && tools.props.selectMode === Constant.SELECT_MODE.CELL) { if (tools.table.store.inlineEditStatus === Constant.EDIT_STATUS.NONE && tools.props.selectMode === Constant.SELECT_MODE.CELL) {
tools.table.store.cellSelected = { tools.table.store.cellSelected = {
row: toRaw(props.scope.row), row: toRaw(props.scope.row),

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

@ -163,7 +163,7 @@ const addScrollListener = () => {
// TD // TD
if (tools.table.store.scrollLeft > 0) { if (tools.table.store.scrollLeft > 0) {
// //
} }
}); });
}; };

32
io.sc.platform.core.frontend/src/platform/components/grid/extra/inline-edit/CellEditor.vue

@ -1,6 +1,17 @@
<template> <template>
<w-dialog ref="dialogRef" :title="dialog.title" v-bind="tools.props.editor?.cellEditor" :buttons="dialog.buttons"> <w-dialog
<w-form ref="dialogFormRef" :cols-num="1" :fields="fieldsComputed" class="pt-1.5 px-1.5"></w-form> ref="dialogRef"
:title="dialog.title"
v-bind="bindDialogComputed"
:buttons="dialog.buttons"
@hide="
() => {
saveLoading = false;
tools.table.store.inlineEditStatus = Constant.EDIT_STATUS.NONE;
}
"
>
<w-form ref="dialogFormRef" v-bind="bindFormComputed" :cols-num="1" :fields="fieldsComputed" class="pt-1.5 px-1.5"></w-form>
</w-dialog> </w-dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -13,6 +24,23 @@ const dialogFormRef = ref();
const tools = <GridTools>inject('tools'); const tools = <GridTools>inject('tools');
const bindDialogComputed = computed(() => {
if (tools.props.editor?.cellDialog) {
return tools.props.editor.cellDialog;
} else if (tools.props.editor?.dialog) {
return tools.props.editor.dialog;
}
return undefined;
});
const bindFormComputed = computed(() => {
if (tools.props.editor?.cellForm) {
return tools.props.editor.cellForm;
} else if (tools.props.editor?.form) {
return tools.props.editor.form;
}
return undefined;
});
const fieldsComputed = computed(() => { const fieldsComputed = computed(() => {
const fields = <any>[]; const fields = <any>[];
const cellSelected = tools.table.store.cellSelected; const cellSelected = tools.table.store.cellSelected;

5
io.sc.platform.core.frontend/src/platform/components/grid/ts/constant/src/EditStatus.ts

@ -10,6 +10,10 @@ export class EditStatus {
* *
*/ */
public static CELL = 'cellEdit'; public static CELL = 'cellEdit';
/**
*
*/
public static CELL_DIALOG = 'cellDialogEdit';
/** /**
* *
*/ */
@ -27,6 +31,7 @@ export class EditStatus {
return { return {
[EditStatus.NONE]: EditStatus.NONE, [EditStatus.NONE]: EditStatus.NONE,
[EditStatus.CELL]: EditStatus.CELL, [EditStatus.CELL]: EditStatus.CELL,
[EditStatus.CELL_DIALOG]: EditStatus.CELL_DIALOG,
[EditStatus.ROW]: EditStatus.ROW, [EditStatus.ROW]: EditStatus.ROW,
[EditStatus.ROWS]: EditStatus.ROWS, [EditStatus.ROWS]: EditStatus.ROWS,
}; };

2
io.sc.platform.core.frontend/src/platform/components/grid/ts/expose-api/ExposeApiManager.ts

@ -67,9 +67,7 @@ export class ExposeApiManager {
// 获取子组件ref的api // 获取子组件ref的api
getQueryForm: tools.apiFM.componentRef.getQueryForm, getQueryForm: tools.apiFM.componentRef.getQueryForm,
getEditorDialog: tools.apiFM.componentRef.getEditorDialog, getEditorDialog: tools.apiFM.componentRef.getEditorDialog,
getCellEditorDialog: tools.apiFM.componentRef.getCellEditorDialog,
getEditorForm: tools.apiFM.componentRef.getEditorForm, getEditorForm: tools.apiFM.componentRef.getEditorForm,
getCellEditorForm: tools.apiFM.componentRef.getCellEditorForm,
getViewerDrawer: tools.apiFM.componentRef.getViewerDrawer, getViewerDrawer: tools.apiFM.componentRef.getViewerDrawer,
getViewerPanel: tools.apiFM.componentRef.getViewerPanel, getViewerPanel: tools.apiFM.componentRef.getViewerPanel,

22
io.sc.platform.core.frontend/src/platform/components/grid/ts/expose-api/src/ComponentRef.ts

@ -1,5 +1,5 @@
import { Base } from '../../Base'; import { Base } from '../../Base';
import { PropsType, TableType } from '../../index'; import { PropsType, TableType, Constant } from '../../index';
/** /**
* w-grid ref对象API * w-grid ref对象API
@ -9,9 +9,7 @@ export class ComponentRef extends Base {
super(props, table); super(props, table);
this.getQueryForm = this.getQueryForm.bind(this); this.getQueryForm = this.getQueryForm.bind(this);
this.getEditorDialog = this.getEditorDialog.bind(this); this.getEditorDialog = this.getEditorDialog.bind(this);
this.getCellEditorDialog = this.getCellEditorDialog.bind(this);
this.getEditorForm = this.getEditorForm.bind(this); this.getEditorForm = this.getEditorForm.bind(this);
this.getCellEditorForm = this.getCellEditorForm.bind(this);
this.getViewerDrawer = this.getViewerDrawer.bind(this); this.getViewerDrawer = this.getViewerDrawer.bind(this);
this.getViewerPanel = this.getViewerPanel.bind(this); this.getViewerPanel = this.getViewerPanel.bind(this);
} }
@ -20,16 +18,18 @@ export class ComponentRef extends Base {
return this.table.componentRef.getTopRef().getQueryForm(); return this.table.componentRef.getTopRef().getQueryForm();
} }
getEditorDialog() { getEditorDialog() {
return this.table.componentRef.getEditorRef()?.getDialog(); if (this.table.store.inlineEditStatus === Constant.EDIT_STATUS.CELL_DIALOG) {
} return this.table.componentRef.getCellEditorRef()?.getDialog();
getCellEditorDialog() { } else {
return this.table.componentRef.getCellEditorRef()?.getDialog(); return this.table.componentRef.getEditorRef()?.getDialog();
}
} }
getEditorForm() { getEditorForm() {
return this.table.componentRef.getEditorRef()?.getForm(); if (this.table.store.inlineEditStatus === Constant.EDIT_STATUS.CELL_DIALOG) {
} return this.table.componentRef.getCellEditorRef()?.getForm();
getCellEditorForm() { } else {
return this.table.componentRef.getCellEditorRef()?.getForm(); return this.table.componentRef.getEditorRef()?.getForm();
}
} }
getViewerDrawer() { getViewerDrawer() {
return this.table.componentRef.getViewRef()?.getViewerDrawer(); return this.table.componentRef.getViewRef()?.getViewerDrawer();

3
io.sc.platform.core.frontend/src/platform/components/grid/ts/toolbar/buttons/CellEdit.ts

@ -24,8 +24,9 @@ export class CellEdit extends Button {
console.warn('[w-grid]The column selected is not configured with a component type for editing.'); console.warn('[w-grid]The column selected is not configured with a component type for editing.');
return false; return false;
} }
this.table.store.inlineEditStatus = Constant.EDIT_STATUS.CELL_DIALOG;
// 弹出模态框编辑,但是只编辑该列的值 // 弹出模态框编辑,但是只编辑该列的值
args.grid.getCellEditorDialog().show(); args.grid.getEditorDialog().show();
const this_ = this; const this_ = this;
nextTick(() => { nextTick(() => {
this_.tools?.em.afterEditorOpen(toRaw(args.selected)); this_.tools?.em.afterEditorOpen(toRaw(args.selected));

Loading…
Cancel
Save