提交 c685ce7e 编写于 作者: zhujiamin's avatar zhujiamin

update: 提交搜索栏部件文件

上级 2f4cc689
......@@ -20,6 +20,7 @@
<template v-slot:header-bottom>
<slot name="quickSearchForm" />
<slot name="searchForm" />
<slot name="searchBar" />
</template>
<template v-slot:body-top>
<slot name="bodyMessage" />
......
<script setup lang="ts">
import { IActionParam, IParam } from "@core";
interface FilterTreeProps{
datas:any[]
fields:any[]
}
const props = withDefaults(defineProps<FilterTreeProps>(), {
});
onMounted(() => {
console.log(props)
});
</script>
<template>
<div class="app-filter-tree">暂未支持</div>
</template>
<style lang="scss">
</style>
\ No newline at end of file
......@@ -9,4 +9,5 @@ export * from './pickup-view-panel-control'
export * from './tree-exp-bar-control'
export * from './tree-control'
export * from './search-form-control'
export * from './quick-search-form-control'
\ No newline at end of file
export * from './quick-search-form-control'
export * from './searchbar-control'
export * from './searchbar-control-prop'
export * from './searchbar-control-state'
export * from './searchbar-control'
\ No newline at end of file
import { IParam, MainControlProps } from "@core";
/**
* @description 搜索栏部件的props
* @export
* @interface SearchBarControlProps
* @extends {MainControlProps}
*/
export interface SearchBarControlProps extends MainControlProps {
}
\ No newline at end of file
import { IParam, MainControlState } from '@core';
/**
* @description 搜索栏部件状态
* @export
* @interface SearchBarControlState
* @extends {MainControlState}
*/
export interface SearchBarControlState extends MainControlState {
}
\ No newline at end of file
import { UIUtil, deepCopy, IActionParam, IParam, MainControl, SearchBarControlState, SearchBarControlProps } from '@core';
/**
* @description 搜索栏部件
* @export
* @class SearchBarControl
* @extends {MainControl}
*/
export class SearchBarControl extends MainControl {
/**
* @description 部件状态
* @type {SearchBarControlState}
* @memberof SearchBarControl
*/
public declare state: SearchBarControlState;
/**
* @description
* @param {SearchBarControlProps} props
* @memberof SearchBarControl
*/
public setState(props: SearchBarControlState) {
super.setState(props);
this.state.filterFields = Object.values(this.state.detailsModel);
this.state.filterItems = [];
}
/**
* @description 安装部件所有功能模块的方法
* @param {SearchBarControlProps} props
* @param {Function} [emit]
* @return {*}
* @memberof SearchBarControl [emit] 事件
*/
public moduleInstall(props: SearchBarControlProps, emit?: Function) {
const superParams = super.moduleInstall(props, emit);
return {
...superParams,
state: this.state,
};
}
}
\ No newline at end of file
......@@ -13,6 +13,9 @@ import { {{codeName}}SearchForm } from '@widgets/{{spinalCase appEntity.codeName
{{#if (and (eq controlType "SEARCHFORM") (eq name 'quicksearchform'))}}
import { {{codeName}}QuickSearchForm } from '@widgets/{{spinalCase appEntity.codeName}}/{{spinalCase codeName}}-quick-search-form';
{{/if}}
{{#eq controlType "SEARCHBAR"}}
import { {{codeName}}SearchBar } from '@widgets/{{spinalCase appEntity.codeName}}/{{spinalCase codeName}}-searchBar';
{{/eq}}
{{/page.ctrls}}
// props声明和默认值处理
......@@ -102,6 +105,13 @@ const { state, grid, onCtrlEvent, onToolbarEvent, onQuickGroupEvent } = new Grid
></{{codeName}}QuickSearchForm>
</template>
{{/if}}
{{#eq controlType "SEARCHBAR"}}
<template v-slot:searchBar>
<{{codeName}}SearchBar
:controlAction="state.{{camelCase name}}.action"
:viewSubject="state.viewSubject"/>
</template>
{{/eq}}
{{#eq controlType "GRID"}}
<{{codeName}}Grid
ref="grid"
......
import {{ctrl.codeName}}SearchBar from "./{{spinalCase ctrl.codeName}}-searchBar.vue";
export { {{ctrl.codeName}}SearchBar };
\ No newline at end of file
export const CtrlConfig = {
controlCodeName: "{{ctrl.codeName}}",
controlName: "{{ctrl.name}}",
detailsModel: {
{{#each ctrl.psSearchBarFilters as | filter | }}
{{filter.name}} : {
label: '{{filter.psAppDEField.logicName}}',
name: '{{filter.name}}',
prop: '{{lowerCase filter.psAppDEField.codeName}}',
disabled: false,
{{#if filter.psDEFSearchMode}}mode: '{{filter.psDEFSearchMode.valueOP}}',{{/if}}
},
{{/each}}
},
}
\ No newline at end of file
<script setup lang="ts">
import { Subject } from 'rxjs';
import { CtrlConfig } from './{{spinalCase ctrl.codeName}}-searchBar-config';
import { SearchBarControl, IActionParam, IParam, IContext, ControlAction, deepCopy } from '@core';
interface Props {
controlAction: ControlAction;
viewSubject: Subject<IActionParam>;
}
const props = withDefaults(defineProps<Props>(), {
})
// emit声明
interface CtrlEmit {
(name: "ctrlEvent", value: IActionParam): void;
}
const emit = defineEmits<CtrlEmit>();
// 安装功能模块,提供状态和能力方法
const { state } = new SearchBarControl(CtrlConfig).moduleInstall(props, emit);
// 暴露内部状态及能力
defineExpose({ state, name: '{{ctrl.name}}' });
</script>
<template>
<div class="search-bar">
<app-filter-tree :datas="state.filterItems" :fields="state.filterFields"/>
</div>
</template>
<style lang="scss">
</style>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册