提交 2f4cc689 编写于 作者: RedPig97's avatar RedPig97

update: 优化事件回调参数

上级 4bbf7cb6
...@@ -44,6 +44,6 @@ ...@@ -44,6 +44,6 @@
{{/if}} {{/if}}
{{#eq ctrlType 'grid'}} {{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}" :value="record.{{item.psEditor.name}}"
@editorEvent="($event: any) => onEditorEvent(index,$event)" @editorEvent="onEditorEvent($event,index)"
{{/eq}} {{/eq}}
/> />
...@@ -26,6 +26,6 @@ ...@@ -26,6 +26,6 @@
{{/if}} {{/if}}
{{#eq ctrlType 'grid'}} {{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}" :value="record.{{item.psEditor.name}}"
@editorEvent="($event: any) => onEditorEvent(index,$event)" @editorEvent="onEditorEvent($event,index)"
{{/eq}} {{/eq}}
/> />
...@@ -12,6 +12,6 @@ ...@@ -12,6 +12,6 @@
{{/if}} {{/if}}
{{#eq ctrlType 'grid'}} {{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}" :value="record.{{item.psEditor.name}}"
@editorEvent="($event: any) => onEditorEvent(index,$event)" @editorEvent="onEditorEvent($event,index)"
{{/eq}} {{/eq}}
/> />
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
{{/if}} {{/if}}
{{#eq ctrlType 'grid'}} {{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}" :value="record.{{item.psEditor.name}}"
@editorEvent="($event: any) => onEditorEvent(index,$event)" @editorEvent="onEditorEvent($event,index)"
{{/eq}} {{/eq}}
:context="state.context" :context="state.context"
:viewParams="state.viewParams"/> :viewParams="state.viewParams"/>
\ No newline at end of file
...@@ -30,6 +30,6 @@ ...@@ -30,6 +30,6 @@
{{/if}} {{/if}}
{{#eq ctrlType 'grid'}} {{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}" :value="record.{{item.psEditor.name}}"
@editorEvent="($event: any) => onEditorEvent(index,$event)" @editorEvent="onEditorEvent($event,index)"
{{/eq}} {{/eq}}
/> />
\ No newline at end of file
...@@ -57,6 +57,6 @@ ...@@ -57,6 +57,6 @@
{{/if}} {{/if}}
{{#eq ctrlType 'grid'}} {{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}" :value="record.{{item.psEditor.name}}"
@editorEvent="($event: any) => onEditorEvent(index,$event)" @editorEvent="onEditorEvent($event,index)"
{{/eq}} {{/eq}}
/> />
\ No newline at end of file
...@@ -51,6 +51,6 @@ ...@@ -51,6 +51,6 @@
{{/if}} {{/if}}
{{#eq ctrlType 'grid'}} {{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}" :value="record.{{item.psEditor.name}}"
@editorEvent="($event: any) => onEditorEvent(index,$event)" @editorEvent="onEditorEvent($event,index)"
{{/eq}} {{/eq}}
/> />
...@@ -33,6 +33,6 @@ ...@@ -33,6 +33,6 @@
{{#eq ctrlType 'grid'}} {{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}" :value="record.{{item.psEditor.name}}"
:data="record" :data="record"
@editorEvent="($event: any) => onEditorEvent(index,$event)" @editorEvent="onEditorEvent($event,index)"
{{/eq}} {{/eq}}
/> />
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
{{/if}} {{/if}}
{{#eq ctrlType 'grid'}} {{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}" :value="record.{{item.psEditor.name}}"
@editorEvent="($event: any) => onEditorEvent(index,$event)" @editorEvent="onEditorEvent($event,index)"
{{/eq}} {{/eq}}
/> />
...@@ -42,6 +42,6 @@ ...@@ -42,6 +42,6 @@
{{/if}} {{/if}}
{{#eq ctrlType 'grid'}} {{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}" :value="record.{{item.psEditor.name}}"
@editorEvent="($event: any) => onEditorEvent(index,$event)" @editorEvent="onEditorEvent($event,index)"
{{/eq}} {{/eq}}
/> />
...@@ -42,6 +42,6 @@ ...@@ -42,6 +42,6 @@
{{/if}} {{/if}}
{{#eq ctrlType 'grid'}} {{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}" :value="record.{{item.psEditor.name}}"
@editorEvent="($event: any) => onEditorEvent(index,$event)" @editorEvent="onEditorEvent($event,index)"
{{/eq}} {{/eq}}
/> />
...@@ -26,6 +26,6 @@ ...@@ -26,6 +26,6 @@
{{/if}} {{/if}}
{{#eq ctrlType 'grid'}} {{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}" :value="record.{{item.psEditor.name}}"
@editorEvent="($event: any) => onEditorEvent(index,$event)" @editorEvent="onEditorEvent($event,index)"
{{/eq}} {{/eq}}
/> />
\ No newline at end of file
...@@ -18,6 +18,6 @@ ...@@ -18,6 +18,6 @@
{{/if}} {{/if}}
{{#eq ctrlType 'grid'}} {{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}" :value="record.{{item.psEditor.name}}"
@editorEvent="($event: any) => onEditorEvent(index,$event)" @editorEvent="onEditorEvent($event,index)"
{{/eq}} {{/eq}}
/> />
...@@ -16,6 +16,6 @@ ...@@ -16,6 +16,6 @@
{{/if}} {{/if}}
{{#eq ctrlType 'grid'}} {{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}" :value="record.{{item.psEditor.name}}"
@editorEvent="($event: any) => onEditorEvent(index,$event)" @editorEvent="onEditorEvent($event,index)"
{{/eq}} {{/eq}}
/> />
...@@ -25,6 +25,6 @@ ...@@ -25,6 +25,6 @@
{{#eq ctrlType 'grid'}} {{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}" :value="record.{{item.psEditor.name}}"
:data="record" :data="record"
@editorEvent="($event: any) => onEditorEvent(index,$event)" @editorEvent="onEditorEvent($event,index)"
{{/eq}} {{/eq}}
/> />
...@@ -22,6 +22,6 @@ ...@@ -22,6 +22,6 @@
{{/if}} {{/if}}
{{#eq ctrlType 'grid'}} {{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}" :value="record.{{item.psEditor.name}}"
@editorEvent="($event: any) => onEditorEvent(index,$event)" @editorEvent="onEditorEvent($event,index)"
{{/eq}} {{/eq}}
/> />
...@@ -24,6 +24,6 @@ ...@@ -24,6 +24,6 @@
{{/if}} {{/if}}
{{#eq ctrlType 'grid'}} {{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}" :value="record.{{item.psEditor.name}}"
@editorEvent="($event: any) => onEditorEvent(index,$event)" @editorEvent="onEditorEvent($event,index)"
{{/eq}} {{/eq}}
/> />
...@@ -15,6 +15,6 @@ ...@@ -15,6 +15,6 @@
{{/if}} {{/if}}
{{#eq ctrlType 'grid'}} {{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}" :value="record.{{item.psEditor.name}}"
@editorEvent="($event: any) => onEditorEvent(index,$event)" @editorEvent="onEditorEvent($event,index)"
{{/eq}} {{/eq}}
/> />
...@@ -35,6 +35,6 @@ ...@@ -35,6 +35,6 @@
{{/if}} {{/if}}
{{#eq ctrlType 'grid'}} {{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}" :value="record.{{item.psEditor.name}}"
@editorEvent="($event: any) => onEditorEvent(index,$event)" @editorEvent="onEditorEvent($event,index)"
{{/eq}} {{/eq}}
/> />
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
mode="link" mode="link"
name="{{lowerCase item.codeName}}" name="{{lowerCase item.codeName}}"
:actionModel="record.{{lowerCase item.codeName}}" :actionModel="record.{{lowerCase item.codeName}}"
@onToolbarEvent="($event: IActionParam) => onToolbarEvent(record, $event)"/> @onToolbarEvent="onToolbarEvent($event, record)"/>
{{/if}} {{/if}}
</div> </div>
{{/unless}} {{/unless}}
......
...@@ -116,7 +116,7 @@ export class GridControl extends MDControl { ...@@ -116,7 +116,7 @@ export class GridControl extends MDControl {
* @param {IActionParam} actionParam 行为参数 * @param {IActionParam} actionParam 行为参数
* @memberof GridControl * @memberof GridControl
*/ */
public onEditorEvent(rowIndex: number, actionParam: IActionParam) { public onEditorEvent(actionParam: IActionParam, rowIndex: number) {
const { tag, action, data } = actionParam; const { tag, action, data } = actionParam;
switch (action) { switch (action) {
case "valueChange": case "valueChange":
...@@ -131,6 +131,16 @@ export class GridControl extends MDControl { ...@@ -131,6 +131,16 @@ export class GridControl extends MDControl {
} }
} }
/**
* @description 操作列事件触发
* @param {IActionParam} action
* @param {IParam} record
* @memberof GridControl
*/
public onToolbarEvent(action: IActionParam, record: IParam) {
//todo 界面行为
}
/** /**
* @description 处理表格操作列事件 * @description 处理表格操作列事件
* @param {IActionParam} actionParam 行为参数 * @param {IActionParam} actionParam 行为参数
...@@ -433,6 +443,7 @@ export class GridControl extends MDControl { ...@@ -433,6 +443,7 @@ export class GridControl extends MDControl {
...superParams, ...superParams,
useCustom: this.useCustom(), useCustom: this.useCustom(),
onEditorEvent: this.onEditorEvent.bind(this), onEditorEvent: this.onEditorEvent.bind(this),
onToolbarEvent: this.onToolbarEvent.bind(this)
}; };
} }
} }
...@@ -30,7 +30,7 @@ const props = withDefaults(defineProps < Props > (), { ...@@ -30,7 +30,7 @@ const props = withDefaults(defineProps < Props > (), {
const emit = defineEmits<{(event: 'onCtrlEvent', value: IActionParam): void;}>(); const emit = defineEmits<{(event: 'onCtrlEvent', value: IActionParam): void;}>();
// 安装功能模块,提供状态和能力 // 安装功能模块,提供状态和能力
const { state, useCustom, onEditorEvent } = new GridControl(ctrlState, props, emit).moduleInstall(); const { state, useCustom, onEditorEvent, onToolbarEvent } = new GridControl(ctrlState, props, emit).moduleInstall();
const { useScrollOption, useRowKey, useRowClassName, useCustomRow, useRowSelectionOption, onResizeColumn, onGridChange } = useCustom; const { useScrollOption, useRowKey, useRowClassName, useCustomRow, useRowSelectionOption, onResizeColumn, onGridChange } = useCustom;
// 暴露内部状态及能力 // 暴露内部状态及能力
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册