提交 3b328b69 编写于 作者: 邱定凯's avatar 邱定凯

update: 更新表格部件批操作列点击事件

上级 6a982f62
......@@ -87,6 +87,7 @@ export class GridControl extends MDControl {
selectedRowKeys: this.state.selectedRowKeys,
checkStrictly: false,
onSelect: (record: IParam, selected: boolean, selectedRows: IParam[], $event: any) => {
const { selections } = toRefs(this.state);
if (selected) {
const { appDeKeyFieldName } = this.state;
const selectedRowKey: string = record[appDeKeyFieldName] || record.srfkey;
......@@ -94,6 +95,9 @@ export class GridControl extends MDControl {
if (Object.is(index,-1) && record.children && record.children.length > 0) {
useExpandedRowKeys.value.push(selectedRowKey);
}
selections.value.push(selectedRows);
this.emit("ctrlEvent", { tag: this.props.name, action: "selectionChange", data: selection })
}
},
onChange: (_selectedRowKeys: string[], selectedRows: any[]) => {
......@@ -273,35 +277,6 @@ export class GridControl extends MDControl {
}
}
/**
* @description 操作列事件触发
* @param {IActionParam} actionParam
* @param {IParam} record
* @memberof GridControl
*/
public onToolbarEvent(actionParam: IActionParam) {
const { data } = actionParam;
if (!data) {
console.warn("工具栏执行参数不足");
return;
}
const { uIAction } = data;
if (!uIAction) {
console.warn("工具栏执行参数不足");
return;
}
// 准备参数
const inputParam = {
context: this.state.context,
viewParams: this.state.viewParams,
data: this.getData(),
event: data.event,
actionEnvironment: this
};
// 执行行为
App.getAppActionService().execute(uIAction, inputParam);
}
/**
* @description 处理表格行事件(操作列,界面行为)
* @param {IActionParam} actionParam 行为参数
......@@ -819,7 +794,6 @@ export class GridControl extends MDControl {
...superParams,
useCustom: this.useCustom(),
onEditorEvent: this.onEditorEvent.bind(this),
onToolbarEvent: this.onToolbarEvent.bind(this),
onActionColEvent: this.onActionColEvent.bind(this)
};
}
......
......@@ -679,6 +679,34 @@ export class MDControl extends MainControl {
}
}
/**
* @description 操作列事件触发
* @param {IActionParam} actionParam
* @param {IParam} record
* @memberof MdControl
*/
public onToolbarEvent(actionParam: IActionParam) {
const { data } = actionParam;
if (!data) {
console.warn("工具栏执行参数不足");
return;
}
const { uIAction } = data;
if (!uIAction) {
console.warn("工具栏执行参数不足");
return;
}
// 准备参数
const inputParam = {
context: this.state.context,
viewParams: this.state.viewParams,
data: this.getData(),
event: data.event,
actionEnvironment: this
};
// 执行行为
App.getAppActionService().execute(uIAction, inputParam);
}
/**
* @description 安装部件所有功能模块的方法
* @return {*}
......@@ -693,7 +721,8 @@ export class MDControl extends MainControl {
remove: this.useRemove(),
newRow: this.useNewRow(),
refresh: this.useRefresh(),
exportExcel: this.useExportExcel()
exportExcel: this.useExportExcel(),
onToolbarEvent: this.onToolbarEvent.bind(this)
};
}
}
......@@ -45,13 +45,13 @@ const { useScrollOption, useRowKey, useRowClassName, useCustomRow, useRowSelecti
const renderBatchToolbar = (total: number, range: IParam[]) => {
return (
h('div', { class: 'app-grid-batchtoolbar-container' }, [
h(AppToolbar, {
state.selections? h(AppToolbar, {
mode: 'button',
class: 'app-grid-batchtoolbar',
name: '{{ctrl.batchToolBarName}}',
actionModel: state.batchToolbar,
onOnToolbarEvent: (event: any) => onToolbarEvent(event)
}),
}) : null,
`显示 ${range[0]} - ${range[1]} 条数据,共 ${total} 条数据`
])
)
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册