提交 3031388a 编写于 作者: WodahsOrez's avatar WodahsOrez

update: 统一事件规范

上级 ed79749d
......@@ -41,12 +41,12 @@ public declare state: GridViewState;
* @param {IActionParam} actionParam
* @memberof MDView
*/
public handleCtrlEvent(actionParam: IActionParam) {
public onCtrlEvent(actionParam: IActionParam) {
const { tag, action, data } = actionParam;
if (Object.is(tag, 'grid')) {
this.MDCtrlEvent(action, data);
}
super.handleCtrlEvent(actionParam);
super.onCtrlEvent(actionParam);
}
/**
......
......@@ -66,7 +66,7 @@ export class MDView extends MainView {
* @param {IActionParam} actionParam
* @memberof MDView
*/
public handleCtrlEvent(actionParam: IActionParam) {
public onCtrlEvent(actionParam: IActionParam) {
const { tag, action, data } = actionParam;
if (Object.is(tag, 'searchform')) {
this.handleSearchFormEvent(action, data);
......
......@@ -38,7 +38,7 @@ export class PickupGridView extends PickupView {
* @param {IActionParam} actionParam
* @memberof PickupGridView
*/
public handleCtrlEvent(actionParam: IActionParam) {
public onCtrlEvent(actionParam: IActionParam) {
const { tag, action, data } = actionParam;
if (tag !== 'grid') {
return;
......
......@@ -49,7 +49,7 @@ export class PickupView extends MainView {
this.emit('viewEvent', { data: this.selectData, tag: '', action: 'close' })
}
public handleCtrlEvent(actionParam: IActionParam) {
public onCtrlEvent(actionParam: IActionParam) {
const { tag, action, data } = actionParam;
// TODO
......
......@@ -21,7 +21,7 @@ export class ExpBarControl extends MainControl {
* @param {IActionParam} actionParam
* @memberof ExpBarControl
*/
public handleCtrlEvent(actionParam: IActionParam) {
public onCtrlEvent(actionParam: IActionParam) {
const { tag, action, data } = actionParam;
const { selection } = this.state;
switch (action) {
......@@ -73,7 +73,7 @@ export class ExpBarControl extends MainControl {
const superParams = super.moduleInstall();
return {
...superParams,
handleCtrlEvent: this.handleCtrlEvent.bind(this)
onCtrlEvent: this.onCtrlEvent.bind(this)
};
}
}
\ No newline at end of file
......@@ -55,16 +55,16 @@ export class GridControl extends MDControl {
if (!rowEditState) {
selectedRowKeys.value = [record.srfkey];
if (!record.children) {
this.emit("onCtrlEvent", { tag: controlName, action: "selectionChange", data: [deepCopy(record)] })
this.emit("ctrlEvent", { tag: this.props.name, action: "selectionChange", data: [deepCopy(record)] })
if (Object.is(rowActiveMode, 1)) {
this.emit("onCtrlEvent", { tag: controlName, action: "rowClick", data: [deepCopy(record)] })
this.emit("ctrlEvent", { tag: this.props.name, action: "rowClick", data: [deepCopy(record)] })
}
}
}
},
onDblclick: () => {
if (!record.children && Object.is(rowActiveMode, 2)) {
this.emit("onCtrlEvent", { tag: controlName, action: "rowDbClick", data: [deepCopy(record)] })
this.emit("ctrlEvent", { tag: this.props.name, action: "rowDbClick", data: [deepCopy(record)] })
}
}
};
......@@ -86,7 +86,7 @@ export class GridControl extends MDControl {
selection.push(select);
}
})
this.emit("onCtrlEvent", { tag: controlName, action: "selectionChange", data: selection })
this.emit("ctrlEvent", { tag: this.props.name, action: "selectionChange", data: selection })
},
};
});
......@@ -189,8 +189,8 @@ export class GridControl extends MDControl {
selectedRowKeys.value = _selectedRowKeys;
} else if (isSelectDefault) {
if (items && items.length > 0) {
this.emit("onCtrlEvent", {
tag: controlName,
this.emit("ctrlEvent", {
tag: this.props.name,
action: "selectionChange",
data: [deepCopy(items[0])],
});
......
......@@ -67,14 +67,14 @@ export class MDControl extends MainControl {
Object.assign(arg, tempViewParams);
// 组装视图其他查询参数
this.emit('ctrlevent', { tag: controlName.toLowerCase(), action: 'beforeload', data: arg });
this.emit("ctrlEvent", { tag: this.props.name, action: 'beforeload', data: arg });
const response = await controlService.search(tempContext, arg, {
action: controlAction.fetchAction,
isLoading: showBusyIndicator,
});
if (response.status || response.status == 200) {
this.state.items = response.data;
this.emit('ctrlevent', { tag: controlName.toLowerCase(), action: 'load', data: response.data });
this.emit("ctrlEvent", { tag: this.props.name, action: 'load', data: response.data });
if (enablePagingBar) {
this.state.mdCtrlPaging.pagination['total'] = response.total;
}
......
......@@ -49,7 +49,7 @@ export class PickupViewPanelControl extends MainControl {
const { tag, action, data } = actionParam;
const { controlName } = this.state;
if (Object.is("selectionChange", action)) {
this.emit('ctrlEvent', { tag: controlName, action: action, data: data });
this.emit("ctrlEvent", { tag: this.props.name, action: action, data: data });
}
}
......
......@@ -21,8 +21,8 @@ export class QuickSearchFormControl extends FormControl {
*/
public onEditorEvent(actionParam: IActionParam) {
super.onEditorEvent(actionParam);
this.emit("onCtrlEvent", {
tag: this.state.controlName,
this.emit("ctrlEvent", {
tag: this.props.name,
action: "selectionChange",
data: this.state.data,
});
......
......@@ -19,9 +19,8 @@ export class SearchFormControl extends FormControl {
* @memberof SearchFormControl
*/
public onSearch() {
const { controlName } = this.state;
this.emit("onCtrlEvent", {
tag: controlName,
this.emit("ctrlEvent", {
tag: this.props.name,
action: "selectionChange",
data: this.state.data,
});
......
......@@ -45,7 +45,7 @@ export class TreeControl extends MainControl {
currentselectedNode.value = e.node;
if (!multiple) {
selectedNodes.push(currentselectedNode.value);
this.emit("ctrlEvent", { tag: controlName, action: 'selectionchange', data: deepCopy(selectedNodes) });
this.emit("ctrlEvent", { tag: this.props.name, action: 'selectionchange', data: deepCopy(selectedNodes) });
}
}
}
......@@ -125,7 +125,7 @@ export class TreeControl extends MainControl {
const isSelectedAll = node.checked;
// TODO 默认选中
// this.setDefaultSelection(items, isRoot, isSelectedAll);
this.emit("ctrlEvent", { tag: controlName, action: "load", data: items });
this.emit("ctrlEvent", { tag: this.props.name, action: "load", data: items });
} catch (error) {
console.error(error);
}
......
......@@ -75,7 +75,7 @@ const { state, grid, onCtrlEvent, onToolbarEvent, onQuickGroupEvent } = new Grid
:viewParams="state.viewParams"
:controlAction="state.{{camelCase name}}.action"
:viewSubject="state.viewSubject"
@onCtrlEvent="onCtrlEvent"
@ctrlEvent="onCtrlEvent"
></{{codeName}}SearchForm>
</template>
<a-button><filter-outlined /></a-button>
......@@ -89,7 +89,7 @@ const { state, grid, onCtrlEvent, onToolbarEvent, onQuickGroupEvent } = new Grid
:viewParams="state.viewParams"
:controlAction="state.{{camelCase name}}.action"
:viewSubject="state.viewSubject"
@onCtrlEvent="onCtrlEvent"
@ctrlEvent="onCtrlEvent"
></{{codeName}}SearchForm>
</template>
{{/if}}
......@@ -101,7 +101,7 @@ const { state, grid, onCtrlEvent, onToolbarEvent, onQuickGroupEvent } = new Grid
:viewParams="state.viewParams"
:controlAction="state.{{camelCase name}}.action"
:viewSubject="state.viewSubject"
@onCtrlEvent="onCtrlEvent"
@ctrlEvent="onCtrlEvent"
></{{codeName}}QuickSearchForm>
</template>
{{/if}}
......@@ -122,7 +122,7 @@ const { state, grid, onCtrlEvent, onToolbarEvent, onQuickGroupEvent } = new Grid
:viewParams="state.viewParams"
:controlAction="state.{{name}}.action"
:viewSubject="state.viewSubject"
@onCtrlEvent="onCtrlEvent"
@ctrlEvent="onCtrlEvent"
></{{codeName}}Grid>
{{/eq}}
{{/page.ctrls}}
......
......@@ -32,7 +32,7 @@ interface ViewEmit {
const emit = defineEmits<ViewEmit>();
// 安装功能模块,提供状态和能力方法
const { state, confirm, handleCtrlEvent } = new PickupGridView(viewState, props, emit).moduleInstall();
const { state, confirm, onCtrlEvent } = new PickupGridView(viewState, props, emit).moduleInstall();
</script>
<template>
......@@ -62,7 +62,7 @@ const { state, confirm, handleCtrlEvent } = new PickupGridView(viewState, props,
:viewParams="state.viewParams"
:controlAction="state.controlsAction.grid"
:viewSubject="state.viewSubject"
@ctrlEvent="handleCtrlEvent"
@ctrlEvent="onCtrlEvent"
></MainGrid>
</AppPickerUpGridViewLayout>
</template>
......@@ -28,7 +28,7 @@ interface ViewEmit {
const emit = defineEmits<ViewEmit>();
// 安装功能模块,提供状态和能力方法
const { state, cancel, confirm,handleCtrlEvent } = new PickupView(viewState, props, emit).moduleInstall();
const { state, cancel, confirm,onCtrlEvent } = new PickupView(viewState, props, emit).moduleInstall();
</script>
<template>
......@@ -56,7 +56,7 @@ const { state, cancel, confirm,handleCtrlEvent } = new PickupView(viewState, pro
:viewParams="state.viewParams"
:controlAction="state.controlsAction.{{name}}"
:viewSubject="state.viewSubject"
@ctrlEvent="handleCtrlEvent"
@ctrlEvent="onCtrlEvent"
></{{codeName}}PickUpViewPanel>
{{/eq}}
{{/page.ctrls}}
......
......@@ -25,7 +25,7 @@ interface ViewEmit {
const emit = defineEmits<ViewEmit>();
// 安装功能模块
const { state, handleCtrlEvent, onToolbarEvent } = new TreeExpView(viewState, props, emit).moduleInstall();
const { state, onCtrlEvent, onToolbarEvent } = new TreeExpView(viewState, props, emit).moduleInstall();
</script>
<template>
......@@ -49,7 +49,7 @@ const { state, handleCtrlEvent, onToolbarEvent } = new TreeExpView(viewState, pr
:showBusyIndicator="true"
:viewParams="state.viewParams"
:viewSubject="state.viewSubject"
@ctrlEvent="handleCtrlEvent"
@ctrlEvent="onCtrlEvent"
></{{codeName}}TreeExpBar>
{{/eq}}
{{/page.ctrls}}
......
......@@ -18,7 +18,7 @@ const props = withDefaults(defineProps < Props > (), {
interface CtrlEmit {
(name: "ctrlEvent", value: IActionParam): void;
}
const emit = defineEmits < CtrlEmit > ();
const emit = defineEmits <CtrlEmit> ();
const { state, menuSelect } = new MenuControl(ctrlState, props, emit).moduleInstall();
......
......@@ -19,10 +19,10 @@ const props = withDefaults(defineProps < Props > (), {
// emit声明
interface CtrlEmit {
(name: "onCtrlEvent", value: IActionParam): void;
(name: "ctrlEvent", value: IActionParam): void;
}
const emit = defineEmits < CtrlEmit > ();
const emit = defineEmits <CtrlEmit> ();
// 安装功能模块,提供状态和能力方法
const { state, onEditorEvent, onComponentEvent } = new FormControl(ctrlState, props, emit).moduleInstall();
......
......@@ -27,7 +27,12 @@ const props = withDefaults(defineProps < Props > (), {
})
// emit声明
const emit = defineEmits<{(event: 'onCtrlEvent', value: IActionParam): void;}>();
interface CtrlEmit {
(name: "ctrlEvent", value: IActionParam): void;
}
// emit声明
const emit = defineEmits<CtrlEmit>();
// 安装功能模块,提供状态和能力
const { state, useCustom, onEditorEvent, onToolbarEvent } = new GridControl(ctrlState, props, emit).moduleInstall();
......
......@@ -28,7 +28,7 @@ interface CtrlEmit {
(name: "ctrlEvent", value: IActionParam): void;
}
const emit = defineEmits < CtrlEmit > ();
const emit = defineEmits <CtrlEmit> ();
// 安装功能模块,提供状态和能力方法
const { state, inited, viewdata, viewparam } = new PickupViewPanelControl(ctrlState, props, emit).moduleInstall();
......
......@@ -20,7 +20,7 @@ const props = withDefaults(defineProps<Props>(), {
// emit声明
interface CtrlEmit {
(name: "onCtrlEvent", value: IActionParam): void;
(name: "ctrlEvent", value: IActionParam): void;
}
const emit = defineEmits<CtrlEmit>();
......
......@@ -20,7 +20,7 @@ const props = withDefaults(defineProps<Props>(), {
// emit声明
interface CtrlEmit {
(name: "onCtrlEvent", value: IActionParam): void;
(name: "ctrlEvent", value: IActionParam): void;
}
const emit = defineEmits<CtrlEmit>();
......
......@@ -32,10 +32,10 @@ interface CtrlEmit {
(name: "ctrlEvent", value: IActionParam): void;
}
const emit = defineEmits < CtrlEmit > ();
const emit = defineEmits <CtrlEmit> ();
// 安装功能模块,提供状态和能力方法
const { state, handleCtrlEvent } = new TreeExpBarControl(ctrlState, props, emit).moduleInstall();
const { state, onCtrlEvent } = new TreeExpBarControl(ctrlState, props, emit).moduleInstall();
// 暴露内部状态及能力
defineExpose({ state, name: '{{ctrl.name}}' });
......@@ -53,7 +53,7 @@ defineExpose({ state, name: '{{ctrl.name}}' });
:viewParams="state.viewParams"
:viewSubject="state.viewSubject"
:isBranchAvailable="true"
@ctrlEvent="handleCtrlEvent"
@ctrlEvent="onCtrlEvent"
></{{codeName}}Tree>
{{/eq}}
{{/ctrl.ctrls}}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册