提交 0ec874ff 编写于 作者: Mosher's avatar Mosher

update:更新

1、新增选择树视图支持
2、新增表单部件服务获取跨实体数据集方法
3、调整多数据视图部件事件处理逻辑
4、调整数据选择、自动填充编辑器数据记载逻辑
5、调整编辑器acParams和sort属性获取逻辑
上级 ef7c98ba
...@@ -40,12 +40,12 @@ ...@@ -40,12 +40,12 @@
deMajorField="{{lowerCase item.psEditor.psAppDataEntity.majorPSAppDEField.codeName}}" deMajorField="{{lowerCase item.psEditor.psAppDataEntity.majorPSAppDEField.codeName}}"
deKeyField="{{lowerCase item.psEditor.psAppDataEntity.keyPSAppDEField.codeName}}" deKeyField="{{lowerCase item.psEditor.psAppDataEntity.keyPSAppDEField.codeName}}"
{{/if}} {{/if}}
{{#if item.psEditor.editorParams.acParams}} {{#and item.psEditor.psAppDataEntity item.psEditor.psAppDEDataSet}}
:acParams="{{item.psEditor.editorParams.acParams}}" :acParams="{ serviceName: '{{item.psEditor.psAppDataEntity.codeName}}', interfaceName: '{{item.psEditor.psAppDEDataSet.codeName}}' }"
{{/if}} {{/and}}
{{#if item.psEditor.editorParams.sort}} {{#and item.psEditor.psAppDEACMode item.psEditor.psAppDEACMode.minorSortPSAppDEField}}
sort="{{item.psEditor.editorParams.sort}}" sort="{{lowerCase item.psEditor.psAppDEACMode.minorSortPSAppDEField}},{{#if item.psEditor.psAppDEACMode.minorSortDir}}{{item.psEditor.psAppDEACMode.minorSortDir}}{{else}}asc{{/if}}"
{{/if}} {{/and}}
{{#if item.psEditor.editorParams.defaultOpen}} {{#if item.psEditor.editorParams.defaultOpen}}
:defaultOpen="{{item.psEditor.editorParams.defaultOpen}}" :defaultOpen="{{item.psEditor.editorParams.defaultOpen}}"
{{/if}} {{/if}}
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
{{#eq item.psEditor.editorType "AC_FS_NOBUTTON"}} {{#eq item.psEditor.editorType "AC_FS_NOBUTTON"}}
:showButton="false" :showButton="false"
{{/eq}} {{/eq}}
:service="state.controlService"
{{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}} {{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
:value="state.data.{{item.psEditor.name}}" :value="state.data.{{item.psEditor.name}}"
@editorEvent="onEditorEvent" @editorEvent="onEditorEvent"
......
...@@ -44,12 +44,12 @@ ...@@ -44,12 +44,12 @@
pickUpView="{{item.psEditor.pickupPSAppView.codeName}}" pickUpView="{{item.psEditor.pickupPSAppView.codeName}}"
{{/if}} {{/if}}
{{!-- :linkView="getLinkView({{item.psEditor}})" --}} {{!-- :linkView="getLinkView({{item.psEditor}})" --}}
{{#if item.psEditor.editorParams.acParams}} {{#and item.psEditor.psAppDataEntity item.psEditor.psAppDEDataSet}}
:acParams="{{item.psEditor.editorParams.acParams}}" :acParams="{ serviceName: '{{item.psEditor.psAppDataEntity.codeName}}', interfaceName: '{{item.psEditor.psAppDEDataSet.codeName}}' }"
{{/if}} {{/and}}
{{#if item.psEditor.psAppDEACMode.minorSortDir}} {{#and item.psEditor.psAppDEACMode item.psEditor.psAppDEACMode.minorSortPSAppDEField}}
sort="{{item.psEditor.psAppDEACMode.minorSortDir}}" sort="{{lowerCase item.psEditor.psAppDEACMode.minorSortPSAppDEField}},{{#if item.psEditor.psAppDEACMode.minorSortDir}}{{item.psEditor.psAppDEACMode.minorSortDir}}{{else}}asc{{/if}}"
{{/if}} {{/and}}
{{#if item.psEditor.editorParams.pickUpData}} {{#if item.psEditor.editorParams.pickUpData}}
pickUpData="{{item.psEditor.editorParams.pickUpData}}" pickUpData="{{item.psEditor.editorParams.pickUpData}}"
{{/if}} {{/if}}
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
{{#if (or (eq item.psEditor.editorType "ADDRESSPICKUP") (eq item.psEditor.editorType "ADDRESSPICKUP_AC"))}} {{#if (or (eq item.psEditor.editorType "ADDRESSPICKUP") (eq item.psEditor.editorType "ADDRESSPICKUP_AC"))}}
:multiple="true" :multiple="true"
{{/if}} {{/if}}
:service="state.controlService"
{{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}} {{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
:value="state.data.{{item.psEditor.name}}" :value="state.data.{{item.psEditor.name}}"
@editorEvent="onEditorEvent" @editorEvent="onEditorEvent"
......
...@@ -19,9 +19,12 @@ ...@@ -19,9 +19,12 @@
{{#if item.psEditor.editorParams.valueType}} {{#if item.psEditor.editorParams.valueType}}
:valueType="{{item.psEditor.editorParams.valueType}}" :valueType="{{item.psEditor.editorParams.valueType}}"
{{/if}} {{/if}}
{{#if item.psEditor.editorParams.acParams}} {{#and item.psEditor.psAppDataEntity item.psEditor.psAppDEDataSet}}
:acParams="{{item.psEditor.editorParams.acParams}}" :acParams="{ serviceName: '{{item.psEditor.psAppDataEntity.codeName}}', interfaceName: '{{item.psEditor.psAppDEDataSet.codeName}}' }"
{{/if}} {{/and}}
{{#and item.psEditor.psAppDEACMode item.psEditor.psAppDEACMode.minorSortPSAppDEField}}
sort="{{lowerCase item.psEditor.psAppDEACMode.minorSortPSAppDEField}},{{#if item.psEditor.psAppDEACMode.minorSortDir}}{{item.psEditor.psAppDEACMode.minorSortDir}}{{else}}asc{{/if}}"
{{/and}}
{{#if item.psEditor.editorParams.multiple}} {{#if item.psEditor.editorParams.multiple}}
:multiple="{{item.psEditor.editorParams.multiple}}" :multiple="{{item.psEditor.editorParams.multiple}}"
{{/if}} {{/if}}
...@@ -54,6 +57,7 @@ ...@@ -54,6 +57,7 @@
{{/if}} {{/if}}
:context="state.context" :context="state.context"
:viewParams="state.viewParams" :viewParams="state.viewParams"
:service="state.controlService"
{{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}} {{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
:value="state.data.{{item.psEditor.name}}" :value="state.data.{{item.psEditor.name}}"
@editorEvent="onEditorEvent" @editorEvent="onEditorEvent"
......
...@@ -45,12 +45,12 @@ interface AutoCompleteProps { ...@@ -45,12 +45,12 @@ interface AutoCompleteProps {
/** /**
* @description 主信息属性 * @description 主信息属性
*/ */
deMajorField?: string; deMajorField: string;
/** /**
* @description 主键属性 * @description 主键属性
*/ */
deKeyField?: string; deKeyField: string;
/** /**
* @description ac参数 * @description ac参数
...@@ -86,6 +86,11 @@ interface AutoCompleteProps { ...@@ -86,6 +86,11 @@ interface AutoCompleteProps {
* @description 只读 * @description 只读
*/ */
readonly?: boolean; readonly?: boolean;
/**
* @description 部件服务
*/
service?: any;
} }
interface EditorEmit { interface EditorEmit {
(name: "editorEvent", value: IActionParam): void; (name: "editorEvent", value: IActionParam): void;
...@@ -108,31 +113,28 @@ let items: Ref<any[]> = ref([]); ...@@ -108,31 +113,28 @@ let items: Ref<any[]> = ref([]);
* @param value 搜索值 * @param value 搜索值
*/ */
const onSearch = (value: string) => { const onSearch = (value: string) => {
let _navContext = deepCopy(navContext); const _navContext = deepCopy(navContext);
let _navViewParam = deepCopy(navViewParam); const _navViewParam = deepCopy(navViewParam);
Object.assign(_navViewParam, { query: value, size: 1000 }); Object.assign(_navViewParam, { query: value, size: 1000 });
if (props.sort) { if (props.sort) {
Object.assign(_navViewParam, { sort: props.sort }); Object.assign(_navViewParam, { sort: props.sort });
} }
// TODO数据服务请求数据 if (!props.service) {
items.value = [ App.getNotificationService().warning({ message: '获取数据失败', desription: '部件服务不存在' });
{ } else if (!props.acParams) {
srfkey: "4646", App.getNotificationService().warning({ message: '获取数据失败', desription: '查询参数不存在' });
srfmajortext: "Jack", } else {
}, const { serviceName, interfaceName } = props.acParams;
{ props.service.getItems(serviceName, interfaceName, _navContext, _navViewParam).then((response: any) => {
srfkey: "49897", if (!response) {
srfmajortext: "Lucy", App.getNotificationService().warning({ message: '获取数据失败', desription: '' });
}, return;
{ }
srfkey: "164646", items.value = [...response];
srfmajortext: "Disabled", }).catch((error: any) => {
}, App.getNotificationService().warning({ message: '获取数据失败', desription: error?.message });
{ })
srfkey: "4646", }
srfmajortext: "Yiminghe",
},
];
}; };
const filterOption= (inputValue: string,option: IParam) => { const filterOption= (inputValue: string,option: IParam) => {
...@@ -165,7 +167,7 @@ const onSelect = (value: any) => { ...@@ -165,7 +167,7 @@ const onSelect = (value: any) => {
:defaultOpen="true" :defaultOpen="true"
> >
<template #option="option"> <template #option="option">
<div @click="onSelect(option[deKeyField!])">\{{option[deMajorField!]}}</div> <div @click="onSelect(option[deKeyField!])">{{option[deMajorField!]}}</div>
</template> </template>
<a-input :placeholder="placeholder"> <a-input :placeholder="placeholder">
<template #suffix><search-outlined v-if="showButton" class="certain-category-icon" /></template> <template #suffix><search-outlined v-if="showButton" class="certain-category-icon" /></template>
......
...@@ -61,12 +61,12 @@ interface DataPickerProps { ...@@ -61,12 +61,12 @@ interface DataPickerProps {
/** /**
* @description 主信息属性 * @description 主信息属性
*/ */
deMajorField?: string; deMajorField: string;
/** /**
* @description 主键属性 * @description 主键属性
*/ */
deKeyField?: string; deKeyField: string;
/** /**
* @description 选择视图 * @description 选择视图
...@@ -93,19 +93,39 @@ interface DataPickerProps { ...@@ -93,19 +93,39 @@ interface DataPickerProps {
*/ */
separator?: string; separator?: string;
/**
* @description 部件服务
*/
service?: any;
/** /**
* @description 外键值附加数据 * @description 外键值附加数据
*/ */
pickUpData?: string; pickUpData?: string;
/**
* @description 仅链接
*/
linkOnly?: boolean; linkOnly?: boolean;
/**
* @description 支持AC
*/
isAC?: boolean; isAC?: boolean;
/**
* @description 无AC
*/
noAc?:boolean; noAc?:boolean;
/**
* @description 显示按钮
*/
showButton?:boolean; showButton?:boolean;
/**
* @description 是否下拉
*/
isDropdown?: boolean; isDropdown?: boolean;
} }
interface EditorEmit { interface EditorEmit {
...@@ -174,25 +194,22 @@ const onSearch = (value: string) => { ...@@ -174,25 +194,22 @@ const onSearch = (value: string) => {
if (props.sort) { if (props.sort) {
Object.assign(_navViewParam, { sort: props.sort }); Object.assign(_navViewParam, { sort: props.sort });
} }
// TODO数据服务请求数据 if (!props.service) {
items.value = [ App.getNotificationService().warning({ message: '获取数据失败', desription: '部件服务不存在' });
{ } else if (!props.acParams) {
[props.deKeyField]: '4646', App.getNotificationService().warning({ message: '获取数据失败', desription: '查询参数不存在' });
[props.deMajorField]: 'Jack', } else {
}, const { serviceName, interfaceName } = props.acParams;
{ props.service.getItems(serviceName, interfaceName, _navContext, _navViewParam).then((response: any) => {
[props.deKeyField]: '49897', if (!response) {
[props.deMajorField]: 'Lucy', App.getNotificationService().warning({ message: '获取数据失败', desription: '' });
}, return;
{ }
[props.deKeyField]: '164646', items.value = [...response];
[props.deMajorField]: 'Disabled', }).catch((error: any) => {
}, App.getNotificationService().warning({ message: '获取数据失败', desription: error?.message });
{ })
[props.deKeyField]: '4646', }
[props.deMajorField]: 'Yiminghe',
},
];
}; };
const filterOption = (inputValue: string, option: IParam) => { const filterOption = (inputValue: string, option: IParam) => {
......
<template>
<div class="app-stepper">
<a-input :value="result" :min="min" :max="max" :step="step" :precision="precision" :disabled="disabled || readonly">
<template #addonBefore>
<a-button type="text" :disabled="disabled || readonly || result <= min" @click="btnReduce">-</a-button>
</template>
<template #addonAfter>
<a-button type="text" :disabled="disabled || readonly || result >= max" @click="btnIcrease">+</a-button>
</template>
</a-input>
</div>
</template>
<script setup lang="ts"> <script setup lang="ts">
import { IActionParam } from "@core"; import { IContext, IParam, IActionParam } from '@core';
interface StepperProps { interface IStepProps {
/** /**
* 传入值 * 传入值
* @type {any} * @type {number}
* @memberof AppSlider * @memberof AppStepper
*/ */
value?: number; value: number;
/**
* 是否禁用
* @type {Boolean}
* @memberof AppStepper
*/
disabled?: Boolean;
/** /**
* 属性项名称 * 属性项名称
* *
...@@ -19,87 +38,101 @@ interface StepperProps { ...@@ -19,87 +38,101 @@ interface StepperProps {
/** /**
* 数值精度 * 数值精度
* @type {number} * @type {number}
* @memberof AppSlider * @memberof AppStepper
*/ */
precision?: number; precision?: number;
/** /**
* 步长 * 步长
* @type {number} * @type {number}
* @memberof AppSlider * @memberof AppStepper
*/ */
step?: number; step?: number;
/** /**
* 最小值 * 最小值
* @type {number} * @type {number}
* @memberof AppSlider * @memberof AppStepper
*/ */
min?: number; min?: number;
/** /**
* 最大值 * 最大值
* @type {number} * @type {number}
* @memberof AppSlider * @memberof AppStepper
*/ */
max?: number; max?: number;
/** /**
* 只读模式 * 应用上下文
* * @type {IContext}
* @type {boolean} * @memberof AppStepper
*/ */
readonly?: boolean; context: IContext;
/** /**
* 是否禁用 * 视图导航参数
* @type {boolean} * @type {IParam}
* @memberof AppSlider * @memberof AppStepper
*/ */
disabled?: boolean; viewParams: IParam;
}
interface EditorEmit {
(name: "editorEvent", value: IActionParam): void;
} }
const props = withDefaults(defineProps<IStepProps>(), {
const props = withDefaults(defineProps<StepperProps>(), {
step: 1, step: 1,
disabled: false, min: 0,
readonly: false, max: 100,
precision: 0
}); });
interface EditorEmit {
(name: 'editorEvent', value: IActionParam): void;
}
const emit = defineEmits<EditorEmit>(); const emit = defineEmits<EditorEmit>();
const onChange = (value: number) => { const onChange = (value: number) => {
emit("editorEvent", { emit('editorEvent', {
tag: props.name, tag: props.name,
action: "valueChange", action: 'valueChange',
data: value, data: value,
}); });
}; };
</script> const result = computed({
get: () => (props.value ? props.value : 0),
set: val => {
if (val > props.max) {
onChange(props.max);
} else if (val < props.min) {
onChange(props.min);
} else {
onChange(val);
}
},
});
<template> // 减少
<div :class="['app-editor-container', 'app-stepper', `app-stepper-${name}`]"> const btnReduce = () => {
<a-input-number result.value -= props.step;
:value="value" };
:min="min" // 增加
:max="max" const btnIcrease = () => {
:step="step" result.value += props.step;
:precision="precision" };
:disabled="disabled || readonly" </script>
@change="onChange"
/>
</div>
</template>
<style scoped> <style lang="scss">
.app-editor-container { .app-stepper {
width: 100%; .ant-btn {
height: 100%; width: 30px;
} height: 28px;
.app-editor-container .ant-input-number { padding: 0;
width: 100%; &:hover,
&:focus {
background: transparent;
}
}
.ant-input-group-addon {
padding: 0;
}
.ant-input {
text-align: center;
}
} }
</style> </style>
\ No newline at end of file
<script setup lang="ts">
</script>
<template>
<AppViewBaseLayout>
<template v-slot:header-top>
<slot name="topMessage" />
</template>
<template v-slot:header-left>
<slot name="caption" />
</template>
<template v-slot:header-content>
<slot name="quickGroupSearch" />
<slot name="quickSearch" />
</template>
<template v-slot:header-right>
<slot name="toolbar" />
</template>
<template v-slot:header-bottom>
<slot name="quickSearchForm" />
<slot name="searchForm" />
</template>
<template v-slot:body-top>
<slot name="bodyMessage" />
</template>
<slot />
<template v-slot:footer-content>
<slot name="bottomMessage" />
<slot name="footer" />
</template>
</AppViewBaseLayout>
</template>
\ No newline at end of file
...@@ -35,20 +35,6 @@ public declare state: GridViewState; ...@@ -35,20 +35,6 @@ public declare state: GridViewState;
this.grid = ref(null); this.grid = ref(null);
} }
/**
* 处理部件事件
*
* @param {IActionParam} actionParam
* @memberof MDView
*/
public onCtrlEvent(actionParam: IActionParam) {
super.onCtrlEvent(actionParam);
const { tag, action, data } = actionParam;
if (Object.is(tag, 'grid')) {
this.MDCtrlEvent(action, data);
}
}
/** /**
* 获取多数据部件 * 获取多数据部件
* *
......
...@@ -14,3 +14,4 @@ export * from './portal-view' ...@@ -14,3 +14,4 @@ export * from './portal-view'
export * from './tab-exp-view' export * from './tab-exp-view'
export * from './list-view' export * from './list-view'
export * from './panel-view' export * from './panel-view'
export * from './pickup-tree-view'
\ No newline at end of file
...@@ -96,6 +96,13 @@ export class MDView extends MainView { ...@@ -96,6 +96,13 @@ export class MDView extends MainView {
if (Object.is(tag, 'searchform') || Object.is(tag, 'quicksearchform')) { if (Object.is(tag, 'searchform') || Object.is(tag, 'quicksearchform')) {
this.handleSearchFormEvent(action, data); this.handleSearchFormEvent(action, data);
} }
if (Object.is(tag, this.state.xDataControlName)) {
this.MDCtrlEvent(action, data);
// selectionChange视图抛出(用于适配选择面板)
if (action === 'selectionChange') {
this.emit('viewEvent', actionParam)
}
}
} }
/** /**
......
import { MainViewProps } from "@core"; import { GridViewProps } from "@core";
/** /**
* @description 选择视图props * @description 选择表格视图props
* @export * @export
* @interface PickupGridViewProps * @interface PickupGridViewProps
* @extends {MainViewProps} * @extends {GridViewProps}
*/ */
export interface PickupGridViewProps extends MainViewProps { } export interface PickupGridViewProps extends GridViewProps { }
\ No newline at end of file \ No newline at end of file
import { ControlAction, MainViewState } from '@core'; import { GridViewState } from '@core';
/** /**
* @description 选择视图状态 * @description 选择视图状态
* @export * @export
* @interface PickupGridViewState * @interface PickupGridViewState
* @extends {ViewStateBase} * @extends {GridViewState}
*/ */
export interface PickupGridViewState extends MainViewState { export interface PickupGridViewState extends GridViewState {
} }
import { IActionParam, IParam } from "@core"; import { GridView } from "../grid-view";
import { MDView } from "../md-view";
import { PickupGridViewProps } from "./pickup-grid-view-prop"; import { PickupGridViewProps } from "./pickup-grid-view-prop";
import { PickupGridViewState } from "./pickup-grid-view-state"; import { PickupGridViewState } from "./pickup-grid-view-state";
...@@ -9,7 +8,7 @@ import { PickupGridViewState } from "./pickup-grid-view-state"; ...@@ -9,7 +8,7 @@ import { PickupGridViewState } from "./pickup-grid-view-state";
* @class PickupGridView * @class PickupGridView
* @extends {MainView} * @extends {MainView}
*/ */
export class PickupGridView extends MDView { export class PickupGridView extends GridView {
/** /**
* @description 视图状态 * @description 视图状态
...@@ -19,74 +18,10 @@ export class PickupGridView extends MDView { ...@@ -19,74 +18,10 @@ export class PickupGridView extends MDView {
public declare state: PickupGridViewState; public declare state: PickupGridViewState;
/** /**
* 当前视图表格部件 * @description 视图输入参数
* * @type {PickupGridViewProps}
* @type {IParam}
* @memberof PickupGridView * @memberof PickupGridView
*/ */
public declare grid: IParam; public declare props: PickupGridViewProps;
/**
* @description 处理视图初始化
*
* @memberof PickupGridView
*/
public useViewInit() {
super.useViewInit();
// 初始化搜索表格引用
this.grid = ref(null);
}
/**
* @description 使用加载功能模块
* @param {PickupGridViewProps} props 传入的props
* @memberof PickupGridView
*/
public useLoad(props: PickupGridViewProps) {
const { viewSubject } = this.state;
onMounted(() => {
viewSubject.next({ tag: 'grid', action: "load", data: {} })
})
}
/**
* 部件事件
*
* @param {IActionParam} actionParam
* @memberof PickupGridView
*/
public onCtrlEvent(actionParam: IActionParam) {
const { tag, action, data } = actionParam;
if (tag !== 'grid') {
return;
}
if (action === 'selectionChange') {
this.emit('viewEvent', actionParam)
}
}
/**
* 获取多数据部件
*
* @return {*} {*}
* @memberof PickupGridView
*/
public getMDCtrl(): any {
return unref(this.grid);
}
/**
* @description 安装视图所有功能模块的方法
* @param {PickupGridViewProps} props 传入的Props
* @param {Function} [emit] [emit] 事件
* @return {*}
* @memberof PickupGridView
*/
public moduleInstall() {
const superParams = super.moduleInstall();
return {
...superParams,
grid: this.grid
};
}
} }
\ No newline at end of file
export * from './pickup-tree-view-prop'
export * from './pickup-tree-view-state'
export * from './pickup-tree-view'
\ No newline at end of file
import { TreeViewProps } from "../tree-view";
/**
* 选择树视图输入参数
*
* @export
* @interface PickupTreeViewProps
* @extends {TreeViewProps}
*/
export interface PickupTreeViewProps extends TreeViewProps {
}
\ No newline at end of file
import { TreeViewState } from "../tree-view";
/**
* 选择树视图状态
*
* @export
* @interface PickupTreeViewState
* @extends {TreeViewState}
*/
export interface PickupTreeViewState extends TreeViewState {
}
\ No newline at end of file
import { TreeView } from "../tree-view";
import { PickupTreeViewProps } from "./pickup-tree-view-prop";
import { PickupTreeViewState } from "./pickup-tree-view-state";
/**
* 选择树视图
*
* @export
* @class PickupTreeView
* @extends {TreeView}
*/
export class PickupTreeView extends TreeView {
/**
* 选择树视图状态
*
* @type {PickupTreeViewState}
* @memberof PickupTreeView
*/
public declare state: PickupTreeViewState;
/**
* 选择树视图输入参数
*
* @type {PickupTreeViewProps}
* @memberof PickupTreeView
*/
public declare props: PickupTreeViewProps;
}
\ No newline at end of file
import { IActionParam, IParam, MDView } from "@core"; import { IParam, MDView } from "@core";
import { TreeViewState } from "./tree-view-state"; import { TreeViewState } from "./tree-view-state";
/** /**
...@@ -31,22 +31,6 @@ export class TreeView extends MDView { ...@@ -31,22 +31,6 @@ export class TreeView extends MDView {
this.tree = ref(null); this.tree = ref(null);
} }
/**
* 处理部件事件
*
* @param {IActionParam} actionParam
* @memberof TreeView
*/
public onCtrlEvent(actionParam: IActionParam) {
const { tag, action, data } = actionParam;
const { xDataControlName } = this.state;
if (Object.is(tag, xDataControlName)) {
this.MDCtrlEvent(action, data);
return;
}
super.onCtrlEvent(actionParam);
}
/** /**
* 获取多数据部件 * 获取多数据部件
* *
......
...@@ -48,7 +48,7 @@ export class ExpBarControl extends MainControl { ...@@ -48,7 +48,7 @@ export class ExpBarControl extends MainControl {
public onCtrlEvent(actionParam: IActionParam) { public onCtrlEvent(actionParam: IActionParam) {
const { tag, action, data } = actionParam; const { tag, action, data } = actionParam;
switch (action) { switch (action) {
case 'selectionchange': case 'selectionChange':
this.onSelectionChange(data); this.onSelectionChange(data);
break; break;
} }
......
...@@ -207,7 +207,7 @@ export class ListControl extends MDControl { ...@@ -207,7 +207,7 @@ export class ListControl extends MDControl {
} }
selectedData.value.push(item); selectedData.value.push(item);
} }
this.emit('ctrlEvent', { tag: this.props.name, action: 'selectionchange', data: selectedData }); this.emit('ctrlEvent', { tag: this.props.name, action: 'selectionChange', data: selectedData.value });
} }
/** /**
......
...@@ -38,7 +38,7 @@ export class TreeControl extends MDControl { ...@@ -38,7 +38,7 @@ export class TreeControl extends MDControl {
} }
const { isBranchAvailable, currentSelectedNode, isMultiple } = this.state; const { isBranchAvailable, currentSelectedNode, isMultiple } = this.state;
let { selectedNodes } = this.state; let { selectedNodes } = this.state;
if (isBranchAvailable && e.node.isLeaf) { if (isBranchAvailable || e.node.isLeaf) {
if (currentSelectedNode.value && Object.keys(currentSelectedNode.value).length > 0) { if (currentSelectedNode.value && Object.keys(currentSelectedNode.value).length > 0) {
currentSelectedNode.value.srfchecked = 0; currentSelectedNode.value.srfchecked = 0;
} }
...@@ -47,7 +47,7 @@ export class TreeControl extends MDControl { ...@@ -47,7 +47,7 @@ export class TreeControl extends MDControl {
// 多选树树选中不识别,使用checkbox多选 // 多选树树选中不识别,使用checkbox多选
if (!isMultiple) { if (!isMultiple) {
selectedNodes = [currentSelectedNode.value]; selectedNodes = [currentSelectedNode.value];
this.emit("ctrlEvent", { tag: this.props.name, action: 'selectionchange', data: deepCopy(selectedNodes) }); this.emit("ctrlEvent", { tag: this.props.name, action: 'selectionChange', data: deepCopy(selectedNodes) });
} }
} }
} }
...@@ -359,7 +359,7 @@ export class TreeControl extends MDControl { ...@@ -359,7 +359,7 @@ export class TreeControl extends MDControl {
if (isBranchAvailable || defaultData.isLeaf) { if (isBranchAvailable || defaultData.isLeaf) {
selectedNodes.splice(0, selectedNodes.length); selectedNodes.splice(0, selectedNodes.length);
selectedNodes.push(currentSelectedNode.value); selectedNodes.push(currentSelectedNode.value);
this.emit("ctrlEvent", { tag: this.props.name, action: "selectionchange", data: selectedNodes }); this.emit("ctrlEvent", { tag: this.props.name, action: "selectionChange", data: selectedNodes });
} }
} }
} }
...@@ -378,7 +378,7 @@ export class TreeControl extends MDControl { ...@@ -378,7 +378,7 @@ export class TreeControl extends MDControl {
selectedKeys.splice(0, selectedKeys.length); selectedKeys.splice(0, selectedKeys.length);
selectedKeys.push(defualtSelect.id); selectedKeys.push(defualtSelect.id);
} }
this.emit("ctrlEvent", { tag: this.props.name, action: "selectionchange", data: selectedNodes }); this.emit("ctrlEvent", { tag: this.props.name, action: "selectionChange", data: selectedNodes });
} }
// 回显已选数据 // 回显已选数据
if (echoSelectedNodes && echoSelectedNodes.length > 0) { if (echoSelectedNodes && echoSelectedNodes.length > 0) {
...@@ -388,7 +388,7 @@ export class TreeControl extends MDControl { ...@@ -388,7 +388,7 @@ export class TreeControl extends MDControl {
val.used = true; val.used = true;
selectedNodes.push(val); selectedNodes.push(val);
selectedKeys.push(val.id); selectedKeys.push(val.id);
this.emit("ctrlEvent", { tag: this.props.name, action: "selectionchange", data: selectedNodes }); this.emit("ctrlEvent", { tag: this.props.name, action: "selectionChange", data: selectedNodes });
return true; return true;
} }
}) })
...@@ -421,7 +421,7 @@ export class TreeControl extends MDControl { ...@@ -421,7 +421,7 @@ export class TreeControl extends MDControl {
selectedNodes.push(node); selectedNodes.push(node);
selectedKeys.push(node.id); selectedKeys.push(node.id);
}); });
this.emit("ctrlEvent", { tag: this.props.name, action: 'selectionchange', data: selectedNodes }); this.emit("ctrlEvent", { tag: this.props.name, action: 'selectionChange', data: selectedNodes });
} }
} }
......
...@@ -111,7 +111,7 @@ export class TreeExpBarControl extends ExpBarControl { ...@@ -111,7 +111,7 @@ export class TreeExpBarControl extends ExpBarControl {
* @description 计算导航参数 * @description 计算导航参数
* @protected * @protected
* @param {*} arg * @param {*} arg
* @return {*} \{{ tempContext: any, tempViewParams: any }} * @return {*} {{ tempContext: any, tempViewParams: any }}
* @memberof TreeExpBarControl * @memberof TreeExpBarControl
*/ */
protected computeNavParams(arg: any): { tempContext: any, tempViewParams: any } { protected computeNavParams(arg: any): { tempContext: any, tempViewParams: any } {
......
...@@ -125,4 +125,57 @@ export class EditFormService<T extends ControlVOBase> extends ControlServiceBase ...@@ -125,4 +125,57 @@ export class EditFormService<T extends ControlVOBase> extends ControlServiceBase
public getRemoteCopyData() { public getRemoteCopyData() {
// return this.remoteCopyData; // return this.remoteCopyData;
} }
/**
* 获取跨实体数据集合
*
* @param {string} entityKey 实体标识
* @param {string} interfaceName 行为标识
* @param {*} [context={}] 应用上下文
* @param {*} [data={}] 参数
* @return {*} {Promise<any>}
* @memberof EditFormService
*/
getItems(entityKey: string, interfaceName: string, context: any = {}, data: any = {}): Promise<any> {
return new Promise((resolve: any, reject: any) => {
App.getDataService(entityKey.toLowerCase(), context).then((service: any) => {
if (service && hasFunction(service, interfaceName)) {
resolve(this.doItems(service[interfaceName](context, data), service.appEntityKeyCodeName, service.appEntityCodeName));
} else {
resolve([]);
}
}).catch((error: any) => {
resolve([]);
});
})
}
/**
* 处理跨实体数据
*
* @param {Promise<any>} promise
* @param {string} deKeyField 实体主键
* @param {string} deName 实体标识
* @return {*}
* @memberof EditFormService
*/
doItems(promise: Promise<any>, deKeyField: string, deName: string) {
return new Promise((resolve: any, reject: any) => {
promise.then((response: any) => {
if (response && response.status === 200) {
const items: any[] = [];
response.data.forEach((item: any) => {
item = this.newControlVO(item);
item[deName] = item[deKeyField];
items.push(item);
});
resolve(items);
} else {
resolve([]);
}
}).catch((error: any) => {
resolve([]);
});
});
}
} }
import {{page.codeName}} from "./{{spinalCase page.codeName}}.vue";
export default {{page.codeName}};
export const viewState = {
enableQuickSearch: {{#if page.enableQuickSearch}}{{page.enableQuickSearch}}{{else}}false{{/if}},
expandSearchForm: {{#if page.expandSearchForm}}{{page.expandSearchForm}}{{else}}false{{/if}},
{{> @macro/front-end/views/view-base-config.hbs}}
};
\ No newline at end of file
<script setup lang="ts">
import { Subject } from 'rxjs';
import { FilterOutlined } from '@ant-design/icons-vue';
import { PickupTreeView, IActionParam, IParam, IContext } from '@core';
import { viewState } from './{{spinalCase page.codeName}}-state';
{{#each page.ctrls as |control|}}
{{#if (eq control.controlType 'TREEVIEW') }}
import { {{control.codeName}}Tree } from '@widgets/{{spinalCase psAppDataEntity.codeName}}/{{spinalCase codeName}}-tree';
{{/if}}
{{#if (and (eq controlType "SEARCHFORM") (eq name 'searchform'))}}
import { {{codeName}}SearchForm } from '@widgets/{{spinalCase psAppDataEntity.codeName}}/{{spinalCase codeName}}-search-form';
{{/if}}
{{#if (and (eq controlType "SEARCHFORM") (eq name 'quicksearchform'))}}
import { {{codeName}}QuickSearchForm } from '@widgets/{{spinalCase psAppDataEntity.codeName}}/{{spinalCase codeName}}-quick-search-form';
{{/if}}
{{/each}}
// props声明和默认值处理
interface Props {
context?: IContext;
viewParams?: IParam;
openType?: "ROUTE" | "MODAL" | "EMBED";
viewSubject?: Subject<IActionParam>;
selectedData?: string;
}
const props = withDefaults(defineProps<Props>(), {
openType:'ROUTE',
viewSubject: () => new Subject<IActionParam>()
})
// emit声明
interface ViewEmit {
(name: "viewEvent", value: IActionParam): void;
}
const emit = defineEmits<ViewEmit>();
// 安装功能模块,提供状态和能力方法
const pickupTreeView = new PickupTreeView(viewState, props, emit).moduleInstall();
const { state, tree, onCtrlEvent, onQuickGroupEvent, onQuickSearchEvent } = pickupTreeView;
</script>
<template>
<AppPickupTreeViewLayout :class="['app-pickup-tree-view', state.viewSysCss]">
<template v-slot:header-left>
<AppIconText class="app-view__caption" size="large" :text="state.viewCaption" />
</template>
{{#if page.enableQuickGroup}}
<template v-slot:quickGroupSearch>
<AppQuickGroup v-if="state.enableQuickGroup" :quickGroupModel="state.quickGroupPSCodeList" :context="state.context" :viewParams="state.viewParams" @onQuickGroupEvent="onQuickGroupEvent" />
</template>
{{/if}}
{{#page.ctrls}}
{{#if (and (eq controlType "SEARCHFORM") (eq name 'searchform'))}}
{{#if page.enableFilter}}
<template v-slot:quickSearch>
<div class='app-quick-search'>
<a-input v-if="state.enableQuickSearch" @pressEnter="onQuickSearchEvent($event)" allowClear/>
<a-popover trigger="click" :overlayStyle="{width: '50%'}">
<template #content>
<{{codeName}}SearchForm
v-if="state.expandSearchForm"
name="{{name}}"
:context="state.context"
:viewParams="state.viewParams"
:controlAction="state.{{camelCase name}}.action"
:viewSubject="state.viewSubject"
@ctrlEvent="onCtrlEvent"
></{{codeName}}SearchForm>
</template>
<a-button><filter-outlined /></a-button>
</a-popover>
</div>
</template>
{{else}}
<template v-slot:searchForm>
<{{codeName}}SearchForm
v-if="state.expandSearchForm"
name="{{name}}"
:context="state.context"
:viewParams="state.viewParams"
:controlAction="state.{{camelCase name}}.action"
:viewSubject="state.viewSubject"
@ctrlEvent="onCtrlEvent"
></{{codeName}}SearchForm>
</template>
{{/if}}
{{/if}}
{{#if (and (eq controlType "SEARCHFORM") (eq name 'quicksearchform'))}}
<template v-slot:quickSearchForm>
<{{codeName}}QuickSearchForm
name="{{name}}"
:context="state.context"
:viewParams="state.viewParams"
:controlAction="state.{{camelCase name}}.action"
:viewSubject="state.viewSubject"
@ctrlEvent="onCtrlEvent"
></{{codeName}}QuickSearchForm>
</template>
{{/if}}
{{#eq controlType "TREEVIEW"}}
<{{codeName}}Tree
ref="tree"
name="{{name}}"
:multiple="false"
:context="state.context"
:showBusyIndicator="true"
:viewParams="state.viewParams"
:controlAction="state.{{name}}.action"
:viewSubject="state.viewSubject"
:parent="pickupTreeView"
@ctrlEvent="onCtrlEvent"
></{{codeName}}Tree>
{{/eq}}
{{/page.ctrls}}
</AppPickupTreeViewLayout>
</template>
...@@ -27,7 +27,7 @@ export default defineConfig({ ...@@ -27,7 +27,7 @@ export default defineConfig({
server: { server: {
proxy: { proxy: {
'/api': { '/api': {
target: 'http://10.19.1.128:8080', target: 'http://172.16.100.209:8080',
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '') rewrite: (path) => path.replace(/^\/api/, '')
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册