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

update: 更新

上级 d6df1d22
<IbizDataPickerView
name="{{item.codeName}}"
:value="state.data.{{item.psEditor.name}}"
:data="state.data"
{{#if item.valueItemName}}
valueItem="{{item.valueItemName}}"
{{/if}}
{{#if item.psEditor.placeHolder}}
placeholder="{{item.psEditor.placeHolder}}"
{{/if}}
{{#if item.psEditor.disabled}}
disabled="{{item.psEditor.disabled}}"
{{/if}}
{{#if item.psEditor.psNavigateContexts}}
localContext="{{item.psEditor.psNavigateContexts}}"
{{/if}}
{{#if item.psEditor.psNavigateParams}}
localParam="{{item.psEditor.psNavigateParams}}"
{{/if}}
:contextProp="state.context"
:viewParamsProp="state.viewParams"
{{#if item.psEditor.psAppDEACMode.minorSortDir}}
sort="{{item.psEditor.psAppDEACMode.minorSortDir}}"
{{/if}}
{{#if item.psEditor.pickUpData}}
pickUpData="{{item.psEditor.pickUpData}}"
{{/if}}
@editorEvent="handleEditorEvent"/>
\ No newline at end of file
...@@ -36,29 +36,16 @@ ...@@ -36,29 +36,16 @@
{{#if item.psEditor.pickUpData}} {{#if item.psEditor.pickUpData}}
pickUpData="{{item.psEditor.pickUpData}}" pickUpData="{{item.psEditor.pickUpData}}"
{{/if}} {{/if}}
{{#eq item.psEditor.editorType "PICKEREX_LINKONLY"}} {{#if (or (eq item.psEditor.editorType "PICKEREX_LINKONLY") (eq item.psEditor.editorType "PICKEREX_LINK"))}}
:linkOnly="true" :linkOnly="true"
{{/eq}} {{/if}}
{{#eq item.psEditor.editorType "PICKEREX_LINK"}} {{#if (or (eq item.psEditor.editorType "PICKEREX_NOAC") (eq item.psEditor.editorType "PICKEREX_NOAC_LINK"))}}
:linkOnly="true"
{{/eq}}
{{#eq item.psEditor.editorType "PICKEREX_NOAC"}}
:noAC="true"
{{/eq}}
{{#eq item.psEditor.editorType "PICKEREX_NOAC_LINK"}}
:noAC="true" :noAC="true"
{{/eq}} {{/if}}
{{#eq item.psEditor.editorType "PICKEREX_TRIGGER"}} {{#if (or (eq item.psEditor.editorType "PICKEREX_TRIGGER") (eq item.psEditor.editorType "PICKEREX_TRIGGER_LINK"))}}
:isDropdown="true"
{{/eq}}
{{#eq item.psEditor.editorType "PICKEREX_TRIGGER_LINK"}}
:isDropdown="true" :isDropdown="true"
{{/eq}} {{/if}}
{{!-- {{#if (or (eq item.psEditor.editorType "PICKEREX_LINKONLY") (eq item.psEditor.editorType "PICKEREX_LINK"))}} --}} {{#if (or (eq item.psEditor.editorType "ADDRESSPICKUP") (eq item.psEditor.editorType "ADDRESSPICKUP_AC"))}}
{{!-- :linkOnly="true" --}} :multiple="true"
{{!-- {{else (or (eq item.psEditor.editorType "PICKEREX_NOAC") (eq item.psEditor.editorType "PICKEREX_NOAC_LINK"))}} --}} {{/if}}
{{!-- :noAC="true" --}}
{{!-- {{else (or (eq item.psEditor.editorType "PICKEREX_TRIGGER") (eq item.psEditor.editorType "PICKEREX_TRIGGER_LINK"))}} --}}
{{!-- :isDropdown="true" --}}
{{!-- {{/if}} --}}
@editorEvent="handleEditorEvent"/> @editorEvent="handleEditorEvent"/>
\ No newline at end of file
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
{{#*inline "PICKEREX_LINK"}}{{>@macro/editor/data-picker.hbs}}{{/inline}} {{#*inline "PICKEREX_LINK"}}{{>@macro/editor/data-picker.hbs}}{{/inline}}
{{#*inline "PICKEREX_DROPDOWNVIEW"}}{{>@macro/editor/data-picker.hbs}}{{/inline}} {{#*inline "PICKEREX_DROPDOWNVIEW"}}{{>@macro/editor/data-picker.hbs}}{{/inline}}
{{#*inline "PICKEREX_DROPDOWNVIEW_LINK"}}{{>@macro/editor/data-picker.hbs}}{{/inline}} {{#*inline "PICKEREX_DROPDOWNVIEW_LINK"}}{{>@macro/editor/data-picker.hbs}}{{/inline}}
{{#*inline "ADDRESSPICKUP"}}{{>@macro/editor/data-picker.hbs}}{{/inline}}
{{#*inline "ADDRESSPICKUP_AC"}}{{>@macro/editor/data-picker.hbs}}{{/inline}}
{{#*inline "DATEPICKEREX"}}{{>@macro/editor/date-picker.hbs}}{{/inline}} {{#*inline "DATEPICKEREX"}}{{>@macro/editor/date-picker.hbs}}{{/inline}}
{{#*inline "DATEPICKEREX_NOTIME"}}{{>@macro/editor/date-picker.hbs}}{{/inline}} {{#*inline "DATEPICKEREX_NOTIME"}}{{>@macro/editor/date-picker.hbs}}{{/inline}}
{{#*inline "DATEPICKER"}}{{>@macro/editor/date-picker.hbs}}{{/inline}} {{#*inline "DATEPICKER"}}{{>@macro/editor/date-picker.hbs}}{{/inline}}
...@@ -44,3 +46,5 @@ ...@@ -44,3 +46,5 @@
{{#*inline "FILEUPLOADER_ONE"}}{{>@macro/editor/upload.hbs}}{{/inline}} {{#*inline "FILEUPLOADER_ONE"}}{{>@macro/editor/upload.hbs}}{{/inline}}
{{#*inline "PICTURE"}}{{>@macro/editor/upload.hbs}}{{/inline}} {{#*inline "PICTURE"}}{{>@macro/editor/upload.hbs}}{{/inline}}
{{#*inline "PICTURE_ONE"}}{{>@macro/editor/upload.hbs}}{{/inline}} {{#*inline "PICTURE_ONE"}}{{>@macro/editor/upload.hbs}}{{/inline}}
{{#*inline "PICKEREX_DROPDOWNVIEW"}}{{>@macro/editor/data-picker-view.hbs}}{{/inline}}
{{#*inline "PICKEREX_DROPDOWNVIEW_LINK"}}{{>@macro/editor/data-picker-view.hbs}}{{/inline}}
\ No newline at end of file
<script setup lang="ts">
import { onBeforeMount, Ref, ref } from 'vue';
import { SearchOutlined, ExportOutlined } from '@ant-design/icons-vue';
import { deepCopy, IParam, IActionParam, EditorBase } from '@ibiz-core';
interface DataPickerViewProps {
/**
* @description 编辑器名称
*/
name: string;
/**
* @description 值项
*/
valueItem: string;
/**
* @description 编辑器值
*/
value: any;
/**
* @description 禁用
*/
disabled?: boolean;
/**
* @description 占位提示信息
*/
placeholder?: string;
/**
* @description 表单数据或表格行数据
*/
data?: any;
/**
* @description 上下文
*/
contextProp?: any;
/**
* @description 视图参数
*/
viewParamsProp?: any;
/**
* @description 局部上下文
*/
localContext?: any;
/**
* @description 局部视图参数
*/
localParam?: any;
/**
* @description 主信息属性
*/
deMajorField?: string;
/**
* @description 主键属性
*/
deKeyField?: string;
/**
* @description 选择视图
*/
pickUpView?: any;
/**
* @description 链接视图
*/
linkView?: any;
/**
* @description ac参数
*/
acParams?: any;
/**
* @description 排序
*/
sort?: string;
/**
* @description 外键值附加数据
*/
pickUpData?: string;
linkOnly: boolean;
isAC: boolean;
isDropdown: boolean;
}
interface EditorEmit {
(name: 'editorEvent', value: IActionParam): void;
}
const props = withDefaults(defineProps<DataPickerViewProps>(), {
deMajorField: 'srfmajortext',
deKeyField: 'srfkey',
linkOnly: false,
isAC: false,
isDropdown: false,
});
const emit = defineEmits<EditorEmit>();
const { handleEditorNavParams, openLinkView, openPickUpView } = new EditorBase();
const { navContext, navViewParam } = handleEditorNavParams(props);
let items: Ref<any[]> = ref([]);
/**
* @description 初始化items
*/
const initItems = () => {
if (props.valueItem && props.data) {
items.value.push({
[props.deMajorField]: props.value,
[props.deKeyField]: props.data[props.valueItem],
});
}
};
/**
* @description 填充外键值附加数据
* @param item 选中数据
*/
const fillPickUpData = (item: IParam) => {
if (props.pickUpData) {
let pickUpDataArray: string[] = props.pickUpData.split(';');
if (pickUpDataArray && pickUpDataArray.length > 0) {
for (let i = 0; i < pickUpDataArray.length; i++) {
if (item) {
emit('editorEvent', {
tag: pickUpDataArray[i],
action: 'valueChange',
data: item[pickUpDataArray[i]],
});
} else {
emit('editorEvent', {
tag: pickUpDataArray[i],
action: 'valueChange',
data: null,
});
}
}
}
}
};
/**
* @description 搜索
* @param value 搜索值
*/
const onSearch = (value: string) => {
let _navContext = deepCopy(navContext);
let _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',
},
];
};
const filterOption = (inputValue: string, option: IParam) => {
return option[props.deMajorField].toUpperCase().indexOf(inputValue.toUpperCase()) >= 0;
};
const onSelect = (value: any) => {
const selectItem = items.value.find((item: IParam) => Object.is(item[props.deKeyField], value));
emit('editorEvent', {
tag: props.name,
action: 'valueChange',
data: selectItem[props.deMajorField],
});
emit('editorEvent', { tag: props.valueItem, action: 'valueChange', data: selectItem[props.deKeyField] });
fillPickUpData(selectItem);
};
</script>
<template>
<a-select
:class="['app-data-picker', `app-data-picker-${name}`]"
allowClear
showSearch
v-model:value="value"
:disabled="disabled"
:filterOption="false"
:options="items"
@change="onChange"
@search="onSearch"
:placeholder="placeholder"
>
<template #suffixIcon>
<select-outlined v-if="linkView" @click="openLinkView" />
</template>
<template #option="item">
</template>
</a-select>
</template>
<style scoped></style>
...@@ -4,3 +4,4 @@ export * from './edit-view' ...@@ -4,3 +4,4 @@ export * from './edit-view'
export * from './index-view' export * from './index-view'
export * from './grid-view' export * from './grid-view'
export * from './pickup-view' export * from './pickup-view'
export * from './pickup-grid-view'
\ No newline at end of file
export * from './pickup-grid-view-prop'
export * from './pickup-grid-view-state'
export * from './pickup-grid-view'
\ No newline at end of file
import { MainViewProps } from "@ibiz-core";
/**
* @description 选择视图props
* @export
* @interface PickupGridViewProps
* @extends {MainViewProps}
*/
export interface PickupGridViewProps extends MainViewProps { }
\ No newline at end of file
import { ControlAction, MainViewState } from '@ibiz-core';
/**
* @description 选择视图状态
* @export
* @interface PickupGridViewState
* @extends {ViewStateBase}
*/
export interface PickupGridViewState extends MainViewState {
}
import { PickupView } from "../pickup-view";
import { PickupGridViewProps } from "./pickup-grid-view-prop";
import { PickupGridViewState } from "./pickup-grid-view-state";
/**
* @description 选择视图
* @export
* @class PickupGridView
* @extends {MainView}
*/
export class PickupGridView extends PickupView {
/**
* @description 视图状态
* @type {PickupGridViewState}
* @memberof PickupGridView
*/
public declare viewState: PickupGridViewState;
/**
* @description 使用加载功能模块
* @param {PickupGridViewProps} props 传入的props
* @memberof PickupGridView
*/
public useLoad(props: PickupGridViewProps) {
const { viewSubject } = this.viewState;
onMounted(() => {
viewSubject.next({ tag: 'grid', action: "load", data: {} })
})
}
/**
* @description 安装视图所有功能模块的方法
* @param {PickupGridViewProps} props 传入的Props
* @param {Function} [emit] [emit] 事件
* @return {*}
* @memberof PickupGridView
*/
public moduleInstall(props: PickupGridViewProps, emit?: Function) {
const superParams = super.moduleInstall(props, emit);
this.useLoad(props);
return {
...superParams,
state: this.viewState,
};
}
}
\ No newline at end of file
export { PickupView } from './pickup-view'; export * from './pickup-view-prop'
export { PickupViewProps } from './pickup-view-prop'; export * from './pickup-view-state'
export { PickupViewState } from './pickup-view-state'; export * from './pickup-view'
\ No newline at end of file \ No newline at end of file
...@@ -29,6 +29,22 @@ export class PickupView extends MainView { ...@@ -29,6 +29,22 @@ export class PickupView extends MainView {
}) })
} }
/**
* @description 取消
* @memberof PickupView
*/
public cancel() {
//todo
}
/**
* @description 确认
* @memberof PickupView
*/
public confirm() {
//todo
}
/** /**
* @description 安装视图所有功能模块的方法 * @description 安装视图所有功能模块的方法
* @param {PickupViewProps} props 传入的Props * @param {PickupViewProps} props 传入的Props
...@@ -42,6 +58,8 @@ export class PickupView extends MainView { ...@@ -42,6 +58,8 @@ export class PickupView extends MainView {
return { return {
...superParams, ...superParams,
state: this.viewState, state: this.viewState,
cancel: this.cancel.bind(this),
confirm: this.confirm.bind(this)
}; };
} }
} }
\ No newline at end of file
export { PickupViewPanelControlProps } from './pickupviewpanel-control-prop'; export * from './pickupviewpanel-control-prop'
export { PickupViewPanelControlState } from './pickupviewpanel-control-state'; export * from './pickupviewpanel-control-state'
export { PickupViewPanelControl } from './pickupviewpanel-control'; export * from './pickupviewpanel-control'
\ No newline at end of file \ No newline at end of file
export const ViewConfig = {
viewCodeName: '{{page.codeName}}',
viewName: '{{page.name}}',
viewCaption: '{{page.caption}}',
{{#page.ctrls}}
{{#eq controlType "GRID"}}
{{lowerCase codeName}}:{
name:'{{name}}',
codeName:'{{codeName}}',
action:{
'createAction': 'Create'
}
},
{{/eq}}
{{/page.ctrls}}
};
\ No newline at end of file
<script setup lang="ts">
import { Subject } from 'rxjs';
import { PickupGridView, IActionParam, IParam } from '@ibiz-core';
import { ViewConfig } from './{{spinalCase page.codeName}}-config';
{{#page.ctrls}}
{{#eq controlType "GRID"}}
import { {{codeName}}Grid } from '@widgets/{{spinalCase appEntity.codeName}}/{{spinalCase codeName}}-grid';
{{/eq}}
{{/page.ctrls}}
import { MainGrid } from '@widgets/example/main-grid';
// props声明和默认值处理
interface Props {
context: IParam;
viewParams?: IParam;
openType?: "ROUTE" | "MODAL" | "EMBED";
viewSubject?: Subject<IActionParam>;
}
const props = withDefaults(defineProps<Props>(), {
// 设定默认值,可选属性可以在这初始化
viewSubject: () => new Subject<IActionParam>()
})
// emit声明
interface ViewEmit {
(name: "viewEvent", value: IActionParam): void;
}
const emit = defineEmits<ViewEmit>();
// 安装功能模块,提供状态和能力方法
const { state } = new PickupGridView(ViewConfig).moduleInstall(props);
</script>
<template>
<IbizDefaultViewLayout class="ibiz-pickup-grid-view">
<template v-slot:header-left>
<IbizIconText class="ibiz-view__caption" size="large" :text="state.viewCaption" />
</template>
{{#page.ctrls}}
{{controlType}}
{{#eq controlType "GRID"}}
<{{codeName}}Grid
:context="state.context"
:multiple="false"
:rowEditState="state.rowEditState"
:rowActiveMode="state.gridRowActiveMode"
:showBusyIndicator="true"
:viewParams="state.viewParams"
:controlAction="state.controlsAction"
:viewSubject="state.viewSubject"
></{{codeName}}Grid>
{{/eq}}
{{/page.ctrls}}
<MainGrid
:context="state.context"
:multiple="false"
:rowEditState="state.rowEditState"
:rowActiveMode="state.gridRowActiveMode"
:showBusyIndicator="true"
:viewParams="state.viewParams"
:controlAction="state.controlsAction"
:viewSubject="state.viewSubject"
></MainGrid>
<template v-slot:footer>
<a-space class="ibiz-pickup-grid-view--footer">
<a-button @click="cancel">取消</a-button>
<a-button @click="confirm">确认</a-button>
</a-space>
</template>
</IbizDefaultViewLayout>
</template>
<style lang="scss">
.ibiz-pickup-grid-view {
position: relative;
.ibiz-pickup-grid-view--footer {
position: absolute;
bottom: 20px;
right: 35px;
}
}
</style>
\ No newline at end of file
...@@ -3,16 +3,6 @@ export const ViewConfig = { ...@@ -3,16 +3,6 @@ export const ViewConfig = {
viewName: '{{page.name}}', viewName: '{{page.name}}',
viewCaption: '{{page.caption}}', viewCaption: '{{page.caption}}',
{{#page.ctrls}} {{#page.ctrls}}
{{#eq controlType "TOOLBAR"}}
{{lowerCase codeName}}:{
name:'{{name}}',
items:[
{{#pSDEToolbarItems}}
{ name:'{{name}}',caption:'{{caption}}',groupExtractMode:'{{groupExtractMode}}',itemType:'{{itemType}}',noPrivDisplayMode:'{{noPrivDisplayMode}}',showIcon:{{showIcon}},showCaption:{{showCaption}},tooltip:'{{tooltip}}' },
{{/pSDEToolbarItems}}
]
},
{{/eq}}
{{#eq controlType "PICKUPVIEWPANEL"}} {{#eq controlType "PICKUPVIEWPANEL"}}
{{lowerCase codeName}}:{ {{lowerCase codeName}}:{
name:'{{name}}', name:'{{name}}',
......
<script setup lang="ts"> <script setup lang="ts">
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { PickupView, IActionParam, IParam } from '@ibiz-core'; import { PickupView, IActionParam, IParam } from '@ibiz-core';
import { ViewConfig } from './{{page.codeName.spinalCase}}-config'; import { ViewConfig } from './{{spinalCase page.codeName}}-config';
// props声明和默认值处理 // props声明和默认值处理
interface Props { interface Props {
...@@ -32,16 +32,5 @@ const { state } = new PickupView(ViewConfig).moduleInstall(props); ...@@ -32,16 +32,5 @@ const { state } = new PickupView(ViewConfig).moduleInstall(props);
<template v-slot:header-left> <template v-slot:header-left>
<IbizIconText class="ibiz-view__caption" size="large" :text="state.viewCaption" /> <IbizIconText class="ibiz-view__caption" size="large" :text="state.viewCaption" />
</template> </template>
<template v-slot:header-right>
{{#page.ctrls}}
{{#eq controlType "TOOLBAR"}}
<IbizToolbar
:toolbarModel="state.{{lowerCase codeName}}"
@toolbarEvent="handleToolbarEvent"
:context="state.context"
:viewParams="state.viewParams"/>
{{/eq}}
{{/page.ctrls}}
</template>
</IbizDefaultViewLayout> </IbizDefaultViewLayout>
</template> </template>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册