提交 56be7c6c 编写于 作者: RedPig97's avatar RedPig97

update:命名标准---u1

上级 8bcb839d
...@@ -4,15 +4,20 @@ ...@@ -4,15 +4,20 @@
<template> <template>
<AppViewBaseLayout> <AppViewBaseLayout>
<template v-slot:header-top>
<slot name="topMessage" />
</template>
<template v-slot:header-left> <template v-slot:header-left>
<slot name="caption" /> <slot name="caption" />
</template> </template>
<template v-slot:header-right> <template v-slot:header-content>
<slot name="quickSearch" /> <slot name="quickSearch" />
</template>
<template v-slot:header-right>
<slot name="toolbar" /> <slot name="toolbar" />
</template> </template>
<template v-slot:header-bottom> <template v-slot:header-bottom>
<slot name="topMessage" /> <slot name="quickGroupSearch" />
<slot name="quickSearchForm" /> <slot name="quickSearchForm" />
<slot name="searchForm" /> <slot name="searchForm" />
</template> </template>
......
...@@ -18,7 +18,7 @@ interface ToolbarProps { ...@@ -18,7 +18,7 @@ interface ToolbarProps {
actionModel: IParam[]; actionModel: IParam[];
} }
interface toolbarEmit { interface toolbarEmit {
(name: "toolbarEvent", value: IActionParam): void; (name: "onToolbarEvent", value: IActionParam): void;
} }
const props = withDefaults(defineProps<ToolbarProps>(), { const props = withDefaults(defineProps<ToolbarProps>(), {
mode: 'button', mode: 'button',
...@@ -26,7 +26,7 @@ const props = withDefaults(defineProps<ToolbarProps>(), { ...@@ -26,7 +26,7 @@ const props = withDefaults(defineProps<ToolbarProps>(), {
const emit = defineEmits<toolbarEmit>(); const emit = defineEmits<toolbarEmit>();
const items: Ref<IParam[]> = ref(props.actionModel || []); const items: Ref<IParam[]> = ref(props.actionModel || []);
const itemClick = (item: IParam) => { const itemClick = (item: IParam) => {
emit("toolbarEvent", { emit("onToolbarEvent", {
tag: props.name, tag: props.name,
action: "toolbarEvent", action: "toolbarEvent",
data: item, data: item,
......
...@@ -69,7 +69,7 @@ export class MDView extends MainView { ...@@ -69,7 +69,7 @@ export class MDView extends MainView {
public handleCtrlEvent(actionParam: IActionParam) { public handleCtrlEvent(actionParam: IActionParam) {
const { tag, action, data } = actionParam; const { tag, action, data } = actionParam;
if (Object.is(tag, 'searchform')) { if (Object.is(tag, 'searchform')) {
this.searchFormEvent(action, data); this.handleSearchFormEvent(action, data);
} }
} }
...@@ -80,7 +80,7 @@ export class MDView extends MainView { ...@@ -80,7 +80,7 @@ export class MDView extends MainView {
* @param {*} [args={}] * @param {*} [args={}]
* @memberof MDView * @memberof MDView
*/ */
public searchFormEvent(eventName: string, args: any = {}): void { public handleSearchFormEvent(eventName: string, args: any = {}): void {
if (Object.is(eventName, 'load')) { if (Object.is(eventName, 'load')) {
this.onSearchFormLoad(args); this.onSearchFormLoad(args);
} }
......
...@@ -54,7 +54,7 @@ export class FormControl extends MainControl { ...@@ -54,7 +54,7 @@ export class FormControl extends MainControl {
* @param {*} value 表单项值 * @param {*} value 表单项值
* @memberof FormControl * @memberof FormControl
*/ */
public formDataChange(name: string, value: any) { public handleFormDataChange(name: string, value: any) {
const { enableAutoSave } = this.state; const { enableAutoSave } = this.state;
const { data } = toRefs(this.state); const { data } = toRefs(this.state);
data.value[name] = value; data.value[name] = value;
...@@ -75,9 +75,9 @@ export class FormControl extends MainControl { ...@@ -75,9 +75,9 @@ export class FormControl extends MainControl {
const { detailsModel } = this.state; const { detailsModel } = this.state;
Object.values(detailsModel).forEach((item: IParam) => { Object.values(detailsModel).forEach((item: IParam) => {
if (item.resetItemName && Object.is(name, item.resetItemName)) { if (item.resetItemName && Object.is(name, item.resetItemName)) {
this.formDataChange(item.name, null); this.handleFormDataChange(item.name, null);
if (item.valueItemName) { if (item.valueItemName) {
this.formDataChange(item.valueItemName, null); this.handleFormDataChange(item.valueItemName, null);
} }
} }
}) })
...@@ -609,7 +609,7 @@ export class FormControl extends MainControl { ...@@ -609,7 +609,7 @@ export class FormControl extends MainControl {
const { tag, action, data } = actionParam; const { tag, action, data } = actionParam;
switch (action) { switch (action) {
case 'valueChange': case 'valueChange':
this.formDataChange(tag, data); this.handleFormDataChange(tag, data);
break; break;
default: default:
break; break;
......
...@@ -33,7 +33,7 @@ export class GridControl extends MDControl { ...@@ -33,7 +33,7 @@ export class GridControl extends MDControl {
const { controlName, selectFirstDefault, rowEditState, rowActiveMode } = this.state; const { controlName, selectFirstDefault, rowEditState, rowActiveMode } = this.state;
const { selectedRowKeys } = toRefs(this.state); const { selectedRowKeys } = toRefs(this.state);
// 滚动条配置 // 滚动条配置
const scrollOption = computed(() => { const useScrollOption = computed(() => {
return { return {
scrollToFirstRowOnChange: true, scrollToFirstRowOnChange: true,
x: '110%', x: '110%',
...@@ -41,15 +41,15 @@ export class GridControl extends MDControl { ...@@ -41,15 +41,15 @@ export class GridControl extends MDControl {
} }
}); });
// 指定表格行key // 指定表格行key
const rowKey = (record: IParam) => { const useRowKey = (record: IParam) => {
return record.srfkey; return record.srfkey;
} }
// 表格行样式 // 表格行样式
const rowClassName = (record: IParam, index: number) => { const useRowClassName = (record: IParam, index: number) => {
return index % 2 === 1 ? "table-striped" : null; return index % 2 === 1 ? "table-striped" : null;
} }
// 表格行自定义 // 表格行自定义
const customRow = (record: IParam, index: number) => { const useCustomRow = (record: IParam, index: number) => {
return { return {
onClick: () => { onClick: () => {
if (!rowEditState) { if (!rowEditState) {
...@@ -70,7 +70,7 @@ export class GridControl extends MDControl { ...@@ -70,7 +70,7 @@ export class GridControl extends MDControl {
}; };
} }
// 表格选择功能配置 // 表格选择功能配置
const rowSelectionOption = computed(() => { const useRowSelectionOption = computed(() => {
if (selectFirstDefault) { if (selectFirstDefault) {
return false; return false;
} }
...@@ -91,23 +91,23 @@ export class GridControl extends MDControl { ...@@ -91,23 +91,23 @@ export class GridControl extends MDControl {
}; };
}); });
// 列拖动 // 列拖动
const resizeColumn = (width: number, column: IParam) => { const handleResizeColumn = (width: number, column: IParam) => {
column.width = width; column.width = width;
} }
// 处理表格变化(分页,过滤,排序) // 处理表格变化(分页,过滤,排序)
const onGridChange = (pagination: IParam, filters: IParam, sorter: IParam, data: IParam) => { const handleGridChange = (pagination: IParam, filters: IParam, sorter: IParam, data: IParam) => {
if (pagination) { if (pagination) {
this.useLoad().load(); this.useLoad().load();
} }
} }
return { return {
scrollOption, useScrollOption,
rowKey, useRowKey,
rowClassName, useRowClassName,
customRow, useCustomRow,
rowSelectionOption, useRowSelectionOption,
resizeColumn, handleResizeColumn,
onGridChange handleGridChange
} }
} }
...@@ -431,7 +431,7 @@ export class GridControl extends MDControl { ...@@ -431,7 +431,7 @@ export class GridControl extends MDControl {
const superParams = super.moduleInstall(); const superParams = super.moduleInstall();
return { return {
...superParams, ...superParams,
custom: this.useCustom() useCustom: this.useCustom()
}; };
} }
} }
...@@ -21,7 +21,7 @@ export class QuickSearchFormControl extends FormControl { ...@@ -21,7 +21,7 @@ export class QuickSearchFormControl extends FormControl {
*/ */
public handleEditorEvent(actionParam: IActionParam) { public handleEditorEvent(actionParam: IActionParam) {
super.handleEditorEvent(actionParam); super.handleEditorEvent(actionParam);
this.emit("ctrlEvent", { this.emit("onCtrlEvent", {
tag: this.state.controlName, tag: this.state.controlName,
action: "selectionChange", action: "selectionChange",
data: this.state.data, data: this.state.data,
...@@ -39,8 +39,6 @@ export class QuickSearchFormControl extends FormControl { ...@@ -39,8 +39,6 @@ export class QuickSearchFormControl extends FormControl {
const { loadDraft } = this.useLoadDraft(); const { loadDraft } = this.useLoadDraft();
return { return {
...superParams, ...superParams,
loadDraft,
handleEditorEvent: this.handleEditorEvent.bind(this),
}; };
} }
} }
...@@ -20,7 +20,7 @@ export class SearchFormControl extends FormControl { ...@@ -20,7 +20,7 @@ export class SearchFormControl extends FormControl {
*/ */
public onSearch() { public onSearch() {
const { controlName } = this.state; const { controlName } = this.state;
this.emit("ctrlEvent", { this.emit("onCtrlEvent", {
tag: controlName, tag: controlName,
action: "selectionChange", action: "selectionChange",
data: this.state.data, data: this.state.data,
...@@ -78,13 +78,10 @@ export class SearchFormControl extends FormControl { ...@@ -78,13 +78,10 @@ export class SearchFormControl extends FormControl {
const { loadDraft } = this.useLoadDraft(); const { loadDraft } = this.useLoadDraft();
return { return {
...superParams, ...superParams,
loadDraft,
onSearch: this.onSearch.bind(this), onSearch: this.onSearch.bind(this),
onCancel: this.onCancel.bind(this), onCancel: this.onCancel.bind(this),
addHistoryItem: this.addHistoryItem.bind(this), addHistoryItem: this.addHistoryItem.bind(this),
removeHistoryItem: this.removeHistoryItem.bind(this), removeHistoryItem: this.removeHistoryItem.bind(this),
handleEditorEvent: this.handleEditorEvent.bind(this),
handleComponentEvent: this.handleComponentEvent.bind(this),
}; };
} }
} }
...@@ -12,14 +12,15 @@ ...@@ -12,14 +12,15 @@
flex-direction: column; flex-direction: column;
padding: 0 10px; padding: 0 10px;
background-color: var(--app-view-layout-header-bg-color); background-color: var(--app-view-layout-header-bg-color);
border-bottom: 1px solid var(--app-view-layout-header-border-bottom);
} }
.app-view-layout__header-content { .app-view-layout__header-content {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
height: var(--app-view-layout-header-height); height: var(--app-view-layout-header-height);
border-bottom: 1px solid var(--app-view-layout-header-border-bottom);
margin: --app-view-layout-header-padding; margin: --app-view-layout-header-padding;
.app-view__caption { .app-view__caption {
white-space: nowrap;
font-size: var(--app-view-caption-font-size); font-size: var(--app-view-caption-font-size);
} }
} }
......
.app-view-layout--default { .app-view-layout--default {
.app-view-layout__header {
.app-view-layout__header-content {
white-space: nowrap;
}
}
.app-quick-search { .app-quick-search {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.app-quick-search-form {
padding-top: 12px;
}
} }
\ No newline at end of file
...@@ -23,7 +23,7 @@ const props = withDefaults(defineProps<Props>(), { ...@@ -23,7 +23,7 @@ const props = withDefaults(defineProps<Props>(), {
// emit声明 // emit声明
interface ViewEmit { interface ViewEmit {
(name: "viewEvent", value: IActionParam): void; (name: "onViewEvent", value: IActionParam): void;
} }
const emit = defineEmits<ViewEmit>(); const emit = defineEmits<ViewEmit>();
...@@ -51,7 +51,7 @@ const { state, form, handleToolbarEvent } = new EditView(viewState, props, emit) ...@@ -51,7 +51,7 @@ const { state, form, handleToolbarEvent } = new EditView(viewState, props, emit)
mode="button" mode="button"
name="{{lowerCase codeName}}" name="{{lowerCase codeName}}"
:actionModel="state.toolbar" :actionModel="state.toolbar"
@toolbarEvent="handleToolbarEvent"/> @onToolbarEvent="handleToolbarEvent"/>
</template> </template>
{{/eq}} {{/eq}}
{{#eq controlType "FORM"}} {{#eq controlType "FORM"}}
......
...@@ -30,13 +30,13 @@ const props = withDefaults(defineProps<Props>(), { ...@@ -30,13 +30,13 @@ const props = withDefaults(defineProps<Props>(), {
// emit声明 // emit声明
interface ViewEmit { interface ViewEmit {
(name: "viewEvent", value: IActionParam): void; (name: "onViewEvent", value: IActionParam): void;
} }
const emit = defineEmits<ViewEmit>(); const emit = defineEmits<ViewEmit>();
// 安装功能模块,提供状态和能力方法 // 安装功能模块,提供状态和能力方法
const { state, grid, handleCtrlEvent, handleToolbarEvent, onSearchFormSearch } = new GridView(viewState, props, emit).moduleInstall(); const { state, grid, handleCtrlEvent, handleToolbarEvent } = new GridView(viewState, props, emit).moduleInstall();
</script> </script>
...@@ -52,14 +52,14 @@ const { state, grid, handleCtrlEvent, handleToolbarEvent, onSearchFormSearch } = ...@@ -52,14 +52,14 @@ const { state, grid, handleCtrlEvent, handleToolbarEvent, onSearchFormSearch } =
mode="button" mode="button"
name="{{lowerCase codeName}}" name="{{lowerCase codeName}}"
:actionModel="state.toolbar" :actionModel="state.toolbar"
@toolbarEvent="handleToolbarEvent"/> @onToolbarEvent="handleToolbarEvent"/>
</template> </template>
{{/eq}} {{/eq}}
{{#if (and (eq controlType "SEARCHFORM") (eq name 'searchform'))}} {{#if (and (eq controlType "SEARCHFORM") (eq name 'searchform'))}}
{{#if page.enableFilter}} {{#if page.enableFilter}}
<template v-slot:quickSearch> <template v-slot:quickSearch>
<div class='app-quick-search'> <div class='app-quick-search'>
<a-input @click="onSearchFormSearch"/> <a-input/>
<a-popover trigger="click" :overlayStyle="{width: '50%'}"> <a-popover trigger="click" :overlayStyle="{width: '50%'}">
<template #content> <template #content>
<{{codeName}}SearchForm <{{codeName}}SearchForm
...@@ -67,7 +67,7 @@ const { state, grid, handleCtrlEvent, handleToolbarEvent, onSearchFormSearch } = ...@@ -67,7 +67,7 @@ const { state, grid, handleCtrlEvent, handleToolbarEvent, onSearchFormSearch } =
:viewParams="state.viewParams" :viewParams="state.viewParams"
:controlAction="state.{{camelCase name}}.action" :controlAction="state.{{camelCase name}}.action"
:viewSubject="state.viewSubject" :viewSubject="state.viewSubject"
@ctrlEvent="handleCtrlEvent" @onCtrlEvent="handleCtrlEvent"
></{{codeName}}SearchForm> ></{{codeName}}SearchForm>
</template> </template>
<a-button><filter-outlined /></a-button> <a-button><filter-outlined /></a-button>
...@@ -81,7 +81,7 @@ const { state, grid, handleCtrlEvent, handleToolbarEvent, onSearchFormSearch } = ...@@ -81,7 +81,7 @@ const { state, grid, handleCtrlEvent, handleToolbarEvent, onSearchFormSearch } =
:viewParams="state.viewParams" :viewParams="state.viewParams"
:controlAction="state.{{camelCase name}}.action" :controlAction="state.{{camelCase name}}.action"
:viewSubject="state.viewSubject" :viewSubject="state.viewSubject"
@ctrlEvent="handleCtrlEvent" @onCtrlEvent="handleCtrlEvent"
></{{codeName}}SearchForm> ></{{codeName}}SearchForm>
</template> </template>
{{/if}} {{/if}}
...@@ -93,7 +93,7 @@ const { state, grid, handleCtrlEvent, handleToolbarEvent, onSearchFormSearch } = ...@@ -93,7 +93,7 @@ const { state, grid, handleCtrlEvent, handleToolbarEvent, onSearchFormSearch } =
:viewParams="state.viewParams" :viewParams="state.viewParams"
:controlAction="state.{{camelCase name}}.action" :controlAction="state.{{camelCase name}}.action"
:viewSubject="state.viewSubject" :viewSubject="state.viewSubject"
@ctrlEvent="handleCtrlEvent" @onCtrlEvent="handleCtrlEvent"
></{{codeName}}QuickSearchForm> ></{{codeName}}QuickSearchForm>
</template> </template>
{{/if}} {{/if}}
...@@ -107,7 +107,7 @@ const { state, grid, handleCtrlEvent, handleToolbarEvent, onSearchFormSearch } = ...@@ -107,7 +107,7 @@ const { state, grid, handleCtrlEvent, handleToolbarEvent, onSearchFormSearch } =
:viewParams="state.viewParams" :viewParams="state.viewParams"
:controlAction="state.{{name}}.action" :controlAction="state.{{name}}.action"
:viewSubject="state.viewSubject" :viewSubject="state.viewSubject"
@ctrlEvent="handleCtrlEvent" @onCtrlEvent="handleCtrlEvent"
></{{codeName}}Grid> ></{{codeName}}Grid>
{{/eq}} {{/eq}}
{{/page.ctrls}} {{/page.ctrls}}
......
...@@ -19,7 +19,7 @@ const props = withDefaults(defineProps < Props > (), { ...@@ -19,7 +19,7 @@ const props = withDefaults(defineProps < Props > (), {
// emit声明 // emit声明
interface CtrlEmit { interface CtrlEmit {
(name: "ctrlEvent", value: IActionParam): void; (name: "onCtrlEvent", value: IActionParam): void;
} }
const emit = defineEmits < CtrlEmit > (); const emit = defineEmits < CtrlEmit > ();
......
...@@ -27,11 +27,11 @@ const props = withDefaults(defineProps < Props > (), { ...@@ -27,11 +27,11 @@ const props = withDefaults(defineProps < Props > (), {
}) })
// emit声明 // emit声明
const emit = defineEmits<{(event: 'ctrlevent', value: IActionParam): void;}>(); const emit = defineEmits<{(event: 'onCtrlevent', value: IActionParam): void;}>();
// 安装功能模块,提供状态和能力 // 安装功能模块,提供状态和能力
const { state, custom } = new GridControl(ctrlState, props, emit).moduleInstall(); const { state, useCustom } = new GridControl(ctrlState, props, emit).moduleInstall();
const { scrollOption, rowKey, rowClassName, customRow, rowSelectionOption, resizeColumn, onGridChange } = custom; const { useScrollOption, useRowKey, useRowClassName, useCustomRow, useRowSelectionOption, handleResizeColumn, handleGridChange } = useCustom;
// 暴露内部状态及能力 // 暴露内部状态及能力
defineExpose({ state, name: '{{ctrl.name}}' }); defineExpose({ state, name: '{{ctrl.name}}' });
...@@ -51,8 +51,8 @@ defineExpose({ state, name: '{{ctrl.name}}' }); ...@@ -51,8 +51,8 @@ defineExpose({ state, name: '{{ctrl.name}}' });
:pagination="state.mdCtrlPaging.pagination" :pagination="state.mdCtrlPaging.pagination"
:customRow="customRow" :customRow="customRow"
:rowClassName="rowClassName" :rowClassName="rowClassName"
@change="onGridChange" @change="handleGridChange"
@resizeColumn="resizeColumn" @resizeColumn="handleResizeColumn"
> >
<template #emptyText> <template #emptyText>
<div class="not-data"> <div class="not-data">
......
...@@ -20,7 +20,7 @@ const props = withDefaults(defineProps<Props>(), { ...@@ -20,7 +20,7 @@ const props = withDefaults(defineProps<Props>(), {
// emit声明 // emit声明
interface CtrlEmit { interface CtrlEmit {
(name: "ctrlEvent", value: IActionParam): void; (name: "onCtrlEvent", value: IActionParam): void;
} }
const emit = defineEmits<CtrlEmit>(); const emit = defineEmits<CtrlEmit>();
......
...@@ -20,7 +20,7 @@ const props = withDefaults(defineProps<Props>(), { ...@@ -20,7 +20,7 @@ const props = withDefaults(defineProps<Props>(), {
// emit声明 // emit声明
interface CtrlEmit { interface CtrlEmit {
(name: "ctrlEvent", value: IActionParam): void; (name: "onCtrlEvent", value: IActionParam): void;
} }
const emit = defineEmits<CtrlEmit>(); const emit = defineEmits<CtrlEmit>();
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册