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

update:更新

1、新增选择树视图支持
2、新增表单部件服务获取跨实体数据集方法
3、调整多数据视图部件事件处理逻辑
4、调整数据选择、自动填充编辑器数据记载逻辑
5、调整编辑器acParams和sort属性获取逻辑
上级 ef7c98ba
......@@ -40,12 +40,12 @@
deMajorField="{{lowerCase item.psEditor.psAppDataEntity.majorPSAppDEField.codeName}}"
deKeyField="{{lowerCase item.psEditor.psAppDataEntity.keyPSAppDEField.codeName}}"
{{/if}}
{{#if item.psEditor.editorParams.acParams}}
:acParams="{{item.psEditor.editorParams.acParams}}"
{{/if}}
{{#if item.psEditor.editorParams.sort}}
sort="{{item.psEditor.editorParams.sort}}"
{{/if}}
{{#and item.psEditor.psAppDataEntity item.psEditor.psAppDEDataSet}}
:acParams="{ serviceName: '{{item.psEditor.psAppDataEntity.codeName}}', interfaceName: '{{item.psEditor.psAppDEDataSet.codeName}}' }"
{{/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.defaultOpen}}
:defaultOpen="{{item.psEditor.editorParams.defaultOpen}}"
{{/if}}
......@@ -64,6 +64,7 @@
{{#eq item.psEditor.editorType "AC_FS_NOBUTTON"}}
:showButton="false"
{{/eq}}
:service="state.controlService"
{{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
:value="state.data.{{item.psEditor.name}}"
@editorEvent="onEditorEvent"
......
......@@ -44,12 +44,12 @@
pickUpView="{{item.psEditor.pickupPSAppView.codeName}}"
{{/if}}
{{!-- :linkView="getLinkView({{item.psEditor}})" --}}
{{#if item.psEditor.editorParams.acParams}}
:acParams="{{item.psEditor.editorParams.acParams}}"
{{/if}}
{{#if item.psEditor.psAppDEACMode.minorSortDir}}
sort="{{item.psEditor.psAppDEACMode.minorSortDir}}"
{{/if}}
{{#and item.psEditor.psAppDataEntity item.psEditor.psAppDEDataSet}}
:acParams="{ serviceName: '{{item.psEditor.psAppDataEntity.codeName}}', interfaceName: '{{item.psEditor.psAppDEDataSet.codeName}}' }"
{{/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.pickUpData}}
pickUpData="{{item.psEditor.editorParams.pickUpData}}"
{{/if}}
......@@ -65,6 +65,7 @@
{{#if (or (eq item.psEditor.editorType "ADDRESSPICKUP") (eq item.psEditor.editorType "ADDRESSPICKUP_AC"))}}
:multiple="true"
{{/if}}
:service="state.controlService"
{{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
:value="state.data.{{item.psEditor.name}}"
@editorEvent="onEditorEvent"
......
......@@ -19,9 +19,12 @@
{{#if item.psEditor.editorParams.valueType}}
:valueType="{{item.psEditor.editorParams.valueType}}"
{{/if}}
{{#if item.psEditor.editorParams.acParams}}
:acParams="{{item.psEditor.editorParams.acParams}}"
{{/if}}
{{#and item.psEditor.psAppDataEntity item.psEditor.psAppDEDataSet}}
:acParams="{ serviceName: '{{item.psEditor.psAppDataEntity.codeName}}', interfaceName: '{{item.psEditor.psAppDEDataSet.codeName}}' }"
{{/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}}
:multiple="{{item.psEditor.editorParams.multiple}}"
{{/if}}
......@@ -54,6 +57,7 @@
{{/if}}
:context="state.context"
:viewParams="state.viewParams"
:service="state.controlService"
{{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
:value="state.data.{{item.psEditor.name}}"
@editorEvent="onEditorEvent"
......
......@@ -45,12 +45,12 @@ interface AutoCompleteProps {
/**
* @description 主信息属性
*/
deMajorField?: string;
deMajorField: string;
/**
* @description 主键属性
*/
deKeyField?: string;
deKeyField: string;
/**
* @description ac参数
......@@ -86,6 +86,11 @@ interface AutoCompleteProps {
* @description 只读
*/
readonly?: boolean;
/**
* @description 部件服务
*/
service?: any;
}
interface EditorEmit {
(name: "editorEvent", value: IActionParam): void;
......@@ -108,31 +113,28 @@ let items: Ref<any[]> = ref([]);
* @param value 搜索值
*/
const onSearch = (value: string) => {
let _navContext = deepCopy(navContext);
let _navViewParam = deepCopy(navViewParam);
const _navContext = deepCopy(navContext);
const _navViewParam = deepCopy(navViewParam);
Object.assign(_navViewParam, { query: value, size: 1000 });
if (props.sort) {
Object.assign(_navViewParam, { sort: props.sort });
}
// TODO数据服务请求数据
items.value = [
{
srfkey: "4646",
srfmajortext: "Jack",
},
{
srfkey: "49897",
srfmajortext: "Lucy",
},
{
srfkey: "164646",
srfmajortext: "Disabled",
},
{
srfkey: "4646",
srfmajortext: "Yiminghe",
},
];
if (!props.service) {
App.getNotificationService().warning({ message: '获取数据失败', desription: '部件服务不存在' });
} else if (!props.acParams) {
App.getNotificationService().warning({ message: '获取数据失败', desription: '查询参数不存在' });
} else {
const { serviceName, interfaceName } = props.acParams;
props.service.getItems(serviceName, interfaceName, _navContext, _navViewParam).then((response: any) => {
if (!response) {
App.getNotificationService().warning({ message: '获取数据失败', desription: '' });
return;
}
items.value = [...response];
}).catch((error: any) => {
App.getNotificationService().warning({ message: '获取数据失败', desription: error?.message });
})
}
};
const filterOption= (inputValue: string,option: IParam) => {
......@@ -165,7 +167,7 @@ const onSelect = (value: any) => {
:defaultOpen="true"
>
<template #option="option">
<div @click="onSelect(option[deKeyField!])">\{{option[deMajorField!]}}</div>
<div @click="onSelect(option[deKeyField!])">{{option[deMajorField!]}}</div>
</template>
<a-input :placeholder="placeholder">
<template #suffix><search-outlined v-if="showButton" class="certain-category-icon" /></template>
......
......@@ -61,12 +61,12 @@ interface DataPickerProps {
/**
* @description 主信息属性
*/
deMajorField?: string;
deMajorField: string;
/**
* @description 主键属性
*/
deKeyField?: string;
deKeyField: string;
/**
* @description 选择视图
......@@ -93,19 +93,39 @@ interface DataPickerProps {
*/
separator?: string;
/**
* @description 部件服务
*/
service?: any;
/**
* @description 外键值附加数据
*/
pickUpData?: string;
/**
* @description 仅链接
*/
linkOnly?: boolean;
/**
* @description 支持AC
*/
isAC?: boolean;
/**
* @description 无AC
*/
noAc?:boolean;
/**
* @description 显示按钮
*/
showButton?:boolean;
/**
* @description 是否下拉
*/
isDropdown?: boolean;
}
interface EditorEmit {
......@@ -174,25 +194,22 @@ const onSearch = (value: string) => {
if (props.sort) {
Object.assign(_navViewParam, { sort: props.sort });
}
// TODO数据服务请求数据
items.value = [
{
[props.deKeyField]: '4646',
[props.deMajorField]: 'Jack',
},
{
[props.deKeyField]: '49897',
[props.deMajorField]: 'Lucy',
},
{
[props.deKeyField]: '164646',
[props.deMajorField]: 'Disabled',
},
{
[props.deKeyField]: '4646',
[props.deMajorField]: 'Yiminghe',
},
];
if (!props.service) {
App.getNotificationService().warning({ message: '获取数据失败', desription: '部件服务不存在' });
} else if (!props.acParams) {
App.getNotificationService().warning({ message: '获取数据失败', desription: '查询参数不存在' });
} else {
const { serviceName, interfaceName } = props.acParams;
props.service.getItems(serviceName, interfaceName, _navContext, _navViewParam).then((response: any) => {
if (!response) {
App.getNotificationService().warning({ message: '获取数据失败', desription: '' });
return;
}
items.value = [...response];
}).catch((error: any) => {
App.getNotificationService().warning({ message: '获取数据失败', desription: error?.message });
})
}
};
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">
import { IActionParam } from "@core";
interface StepperProps {
import { IContext, IParam, IActionParam } from '@core';
interface IStepProps {
/**
* 传入值
* @type {any}
* @memberof AppSlider
* @type {number}
* @memberof AppStepper
*/
value?: number;
value: number;
/**
* 是否禁用
* @type {Boolean}
* @memberof AppStepper
*/
disabled?: Boolean;
/**
* 属性项名称
*
......@@ -19,87 +38,101 @@ interface StepperProps {
/**
* 数值精度
* @type {number}
* @memberof AppSlider
* @memberof AppStepper
*/
precision?: number;
/**
* 步长
* @type {number}
* @memberof AppSlider
* @memberof AppStepper
*/
step?: number;
/**
* 最小值
* @type {number}
* @memberof AppSlider
* @memberof AppStepper
*/
min?: number;
/**
* 最大值
* @type {number}
* @memberof AppSlider
* @memberof AppStepper
*/
max?: number;
/**
* 只读模式
*
* @type {boolean}
* 应用上下文
* @type {IContext}
* @memberof AppStepper
*/
readonly?: boolean;
context: IContext;
/**
* 是否禁用
* @type {boolean}
* @memberof AppSlider
* 视图导航参数
* @type {IParam}
* @memberof AppStepper
*/
disabled?: boolean;
}
interface EditorEmit {
(name: "editorEvent", value: IActionParam): void;
viewParams: IParam;
}
const props = withDefaults(defineProps<StepperProps>(), {
const props = withDefaults(defineProps<IStepProps>(), {
step: 1,
disabled: false,
readonly: false,
precision: 0
min: 0,
max: 100,
});
interface EditorEmit {
(name: 'editorEvent', value: IActionParam): void;
}
const emit = defineEmits<EditorEmit>();
const onChange = (value: number) => {
emit("editorEvent", {
emit('editorEvent', {
tag: props.name,
action: "valueChange",
action: 'valueChange',
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}`]">
<a-input-number
:value="value"
:min="min"
:max="max"
:step="step"
:precision="precision"
:disabled="disabled || readonly"
@change="onChange"
/>
</div>
</template>
// 减少
const btnReduce = () => {
result.value -= props.step;
};
// 增加
const btnIcrease = () => {
result.value += props.step;
};
</script>
<style scoped>
.app-editor-container {
width: 100%;
height: 100%;
}
.app-editor-container .ant-input-number {
width: 100%;
<style lang="scss">
.app-stepper {
.ant-btn {
width: 30px;
height: 28px;
padding: 0;
&: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;
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);
}
}
/**
* 获取多数据部件
*
......
......@@ -13,4 +13,5 @@ export * from './tree-view'
export * from './portal-view'
export * from './tab-exp-view'
export * from './list-view'
export * from './panel-view'
\ No newline at end of file
export * from './panel-view'
export * from './pickup-tree-view'
\ No newline at end of file
......@@ -96,6 +96,13 @@ export class MDView extends MainView {
if (Object.is(tag, 'searchform') || Object.is(tag, 'quicksearchform')) {
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
* @interface PickupGridViewProps
* @extends {MainViewProps}
* @extends {GridViewProps}
*/
export interface PickupGridViewProps extends MainViewProps { }
\ No newline at end of file
export interface PickupGridViewProps extends GridViewProps { }
\ No newline at end of file
import { ControlAction, MainViewState } from '@core';
import { GridViewState } from '@core';
/**
* @description 选择视图状态
* @export
* @interface PickupGridViewState
* @extends {ViewStateBase}
* @extends {GridViewState}
*/
export interface PickupGridViewState extends MainViewState {
export interface PickupGridViewState extends GridViewState {
}
import { IActionParam, IParam } from "@core";
import { MDView } from "../md-view";
import { GridView } from "../grid-view";
import { PickupGridViewProps } from "./pickup-grid-view-prop";
import { PickupGridViewState } from "./pickup-grid-view-state";
......@@ -9,7 +8,7 @@ import { PickupGridViewState } from "./pickup-grid-view-state";
* @class PickupGridView
* @extends {MainView}
*/
export class PickupGridView extends MDView {
export class PickupGridView extends GridView {
/**
* @description 视图状态
......@@ -19,74 +18,10 @@ export class PickupGridView extends MDView {
public declare state: PickupGridViewState;
/**
* 当前视图表格部件
*
* @type {IParam}
* @description 视图输入参数
* @type {PickupGridViewProps}
* @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";
/**
......@@ -31,22 +31,6 @@ export class TreeView extends MDView {
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 {
public onCtrlEvent(actionParam: IActionParam) {
const { tag, action, data } = actionParam;
switch (action) {
case 'selectionchange':
case 'selectionChange':
this.onSelectionChange(data);
break;
}
......
......@@ -207,7 +207,7 @@ export class ListControl extends MDControl {
}
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 {
}
const { isBranchAvailable, currentSelectedNode, isMultiple } = 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) {
currentSelectedNode.value.srfchecked = 0;
}
......@@ -47,7 +47,7 @@ export class TreeControl extends MDControl {
// 多选树树选中不识别,使用checkbox多选
if (!isMultiple) {
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 {
if (isBranchAvailable || defaultData.isLeaf) {
selectedNodes.splice(0, selectedNodes.length);
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 {
selectedKeys.splice(0, selectedKeys.length);
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) {
......@@ -388,7 +388,7 @@ export class TreeControl extends MDControl {
val.used = true;
selectedNodes.push(val);
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;
}
})
......@@ -421,7 +421,7 @@ export class TreeControl extends MDControl {
selectedNodes.push(node);
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 {
* @description 计算导航参数
* @protected
* @param {*} arg
* @return {*} \{{ tempContext: any, tempViewParams: any }}
* @return {*} {{ tempContext: any, tempViewParams: any }}
* @memberof TreeExpBarControl
*/
protected computeNavParams(arg: any): { tempContext: any, tempViewParams: any } {
......
......@@ -125,4 +125,57 @@ export class EditFormService<T extends ControlVOBase> extends ControlServiceBase
public getRemoteCopyData() {
// 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({
server: {
proxy: {
'/api': {
target: 'http://10.19.1.128:8080',
target: 'http://172.16.100.209:8080',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册