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

update: 更新

上级 293fd75e
......@@ -33,4 +33,10 @@
{{#if item.psEditor.editorParams.multiple}}
:multiple="{{item.psEditor.editorParams.multiple}}"
{{/if}}
{{#eq item.psEditor.editorType "AC_NOBUTTON"}}
:showButton="false"
{{/eq}}
{{#eq item.psEditor.editorType "AC_FS_NOBUTTON"}}
:showButton="false"
{{/eq}}
@editorEvent="handleEditorEvent"/>
......@@ -20,8 +20,12 @@
:contextProp="state.context"
:viewParamsProp="state.viewParams"
{{#if item.psEditor.psAppDataEntity}}
deMajorField="{{item.psEditor.psAppDataEntity.majorPSAppDEField.codename}}"
deKeyField="{{item.psEditor.psAppDataEntity.codeName}}"
{{!-- {{#each item.psEditor.psAppDataEntity as | filed |}} --}}
{{!-- {{#if filed.majorField}} --}}
{{!-- deMajorField="{{lowerCase filed.majorField.codeName}}" --}}
{{!-- {{/if}} --}}
{{!-- {{/each}} --}}
{{!-- deKeyField="{{item.psEditor.psAppDataEntity.codeName}}" --}}
{{/if}}
{{!-- :pickupView="getPickupView({{item.psEditor}})" --}}
{{!-- :linkView="getLinkView({{item.psEditor}})" --}}
......@@ -32,4 +36,29 @@
{{#if item.psEditor.pickUpData}}
pickUpData="{{item.psEditor.pickUpData}}"
{{/if}}
@editorEvent="handleEditorEvent"/>
{{#eq item.psEditor.editorType "PICKEREX_LINKONLY"}}
:linkOnly="true"
{{/eq}}
{{#eq item.psEditor.editorType "PICKEREX_LINK"}}
:linkOnly="true"
{{/eq}}
{{#eq item.psEditor.editorType "PICKEREX_NOAC"}}
:noAC="true"
{{/eq}}
{{#eq item.psEditor.editorType "PICKEREX_NOAC_LINK"}}
:noAC="true"
{{/eq}}
{{#eq item.psEditor.editorType "PICKEREX_TRIGGER"}}
:isDropdown="true"
{{/eq}}
{{#eq item.psEditor.editorType "PICKEREX_TRIGGER_LINK"}}
:isDropdown="true"
{{/eq}}
{{!-- {{#if (or (eq item.psEditor.editorType "PICKEREX_LINKONLY") (eq item.psEditor.editorType "PICKEREX_LINK"))}} --}}
{{!-- :linkOnly="true" --}}
{{!-- {{else (or (eq item.psEditor.editorType "PICKEREX_NOAC") (eq item.psEditor.editorType "PICKEREX_NOAC_LINK"))}} --}}
{{!-- :noAC="true" --}}
{{!-- {{else (or (eq item.psEditor.editorType "PICKEREX_TRIGGER") (eq item.psEditor.editorType "PICKEREX_TRIGGER_LINK"))}} --}}
{{!-- :isDropdown="true" --}}
{{!-- {{/if}} --}}
@editorEvent="handleEditorEvent"/>
\ No newline at end of file
<script setup lang="ts">
import { onBeforeMount, Ref, ref } from "vue";
import { SearchOutlined } from '@ant-design/icons-vue';
import { deepCopy, IParam, IActionParam, EditorBase } from "@ibiz-core";
interface AutoCompleteProps {
/**
......@@ -71,6 +72,11 @@ interface AutoCompleteProps {
*/
defaultOpen: boolean;
/**
* @description 是否显示按钮
*/
showButton: boolean;
/**
* @description 禁用
*/
......@@ -158,9 +164,12 @@ const onSelect = (value: any) => {
@search="onSearch"
:defaultOpen="true"
>
<template #option="{ srfmajortext: caption,srfkey: value }">
<div @click="onSelect(value)">\{{caption}}</div>
<template #option="option">
<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>
</a-input>
</a-auto-complete>
</template>
......
<script setup lang="ts">
import { onBeforeMount, Ref, ref } from "vue";
import { deepCopy, IParam, IActionParam, EditorBase } from "@ibiz-core";
import { onBeforeMount, Ref, ref } from 'vue';
import { SearchOutlined, ExportOutlined } from '@ant-design/icons-vue';
import { deepCopy, IParam, IActionParam, EditorBase } from '@ibiz-core';
interface DataPickerProps {
/**
* @description 编辑器名称
......@@ -11,7 +12,7 @@ interface DataPickerProps {
* @description 值项
*/
valueItem: string;
/**
* @description 编辑器值
*/
......@@ -51,7 +52,7 @@ interface DataPickerProps {
* @description 局部视图参数
*/
localParam?: any;
/**
* @description 主信息属性
*/
......@@ -86,13 +87,22 @@ interface DataPickerProps {
* @description 外键值附加数据
*/
pickUpData?: string;
linkOnly: boolean;
isAC: boolean;
isDropdown: boolean;
}
interface EditorEmit{
(name: 'editorEvent', value: IActionParam): void
interface EditorEmit {
(name: 'editorEvent', value: IActionParam): void;
}
const props = withDefaults(defineProps<DataPickerProps>(), {
deMajorField: 'srfmajortext',
deKeyField: 'srfkey',
linkOnly: false,
isAC: false,
isDropdown: false,
});
const emit = defineEmits<EditorEmit>();
const { handleEditorNavParams, openLinkView, openPickUpView } = new EditorBase();
......@@ -106,48 +116,37 @@ const initItems = () => {
if (props.valueItem && props.data) {
items.value.push({
[props.deMajorField]: props.value,
[props.deKeyField]: props.data[props.valueItem]
})
[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]]
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
} else {
emit('editorEvent', {
tag: pickUpDataArray[i],
action: 'valueChange',
data: null,
});
}
}
}
}
}
/**
* @description 选中项改变
* @param select 选中项值
* @param option 选中项数据
*/
const onChange = (select: any, option:any) => {
const selectItem = items.value.find(
(item: IParam) => Object.is(item[props.deKeyField], select)
);
emit('editorEvent', { tag: props.name, action: "valueChange", data: selectItem[props.deMajorField]});
emit('editorEvent', { tag: props.valueItem, action: "valueChange", data: selectItem[props.deKeyField]});
fillPickUpData(selectItem);
}
};
/**
* @description 搜索
......@@ -155,13 +154,14 @@ const onChange = (select: any, option:any) => {
*/
const onSearch = (value: string) => {
let _navContext = deepCopy(navContext);
let _navViewParam= deepCopy(navViewParam);
let _navViewParam = deepCopy(navViewParam);
Object.assign(_navViewParam, { query: value, size: 1000 });
if (props.sort) {
Object.assign(_navViewParam, { sort: props.sort});
Object.assign(_navViewParam, { sort: props.sort });
}
// TODO数据服务请求数据
items.value = [ {
items.value = [
{
srfkey: '4646',
srfmajortext: 'Jack',
},
......@@ -176,36 +176,83 @@ const onSearch = (value: string) => {
{
srfkey: '4646',
srfmajortext: 'Yiminghe',
}];
}
},
];
};
const filterOption = (inputValue: string, option: IParam) => {
return option[props.deMajorField].toUpperCase().indexOf(inputValue.toUpperCase()) >= 0;
};
onBeforeMount(() => {
initItems();
})
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-editor-container', `app-data-picker-${name}`]"
allowClear
showSearch
v-model:value="value"
:disabled="disabled"
:filterOption="false"
@change="onChange"
@search="onSearch"
:placeholder="placeholder">
<template #suffixIcon>
<search-outlined v-if="pickUpView" @click="openPickUpView"/>
<select-outlined v-if="linkView" @click="openLinkView"/>
</template>
<template v-if="linkOnly" :class="['app-data-picker', `app-data-picker-${name}`]">
<a @click="openLinkView">\{{ value }}</a>
</template>
<template v-else-if="!noAc && !isDropdown">
<a-auto-complete
:class="['app-data-picker', `app-data-picker-${name}`]"
:allowClear="true"
v-model:value="value"
:placeholder="placeholder"
:options="items"
:filterOption="filterOption"
:disabled="disabled || readonly"
@search="onSearch"
:defaultOpen="true"
>
<template #option="option">
<div @click="onSelect(option[deKeyField])">\{{ option[deMajorField] }}</div>
</template>
<a-input :placeholder="placeholder">
<template #suffix>
<search-outlined v-if="pickUpView && showButton" class="certain-category-icon" @click="openView" />
<export-outlined v-if="linkView" @click="openLinkView" />
</template>
</a-input>
</a-auto-complete>
</template>
<template v-else-if="noAc">
<a-input :class="['app-data-picker', `app-data-picker-${name}`]" :placeholder="placeholder">
<template #suffix>
<search-outlined v-if="pickUpView && showButton" class="certain-category-icon" @click="openView" />
<export-outlined v-if="linkView" @click="openLinkView" />
</template>
</a-input>
</template>
<template v-else-if="isDropdown">
<a-select
:class="['app-data-picker', `app-data-picker-${name}`]"
allowClear
showSearch
v-model:value="value"
:disabled="disabled"
:filterOption="false"
@change="onChange"
@search="onSearch"
:placeholder="placeholder"
>
<template #suffixIcon>
<search-outlined v-if="pickUpView" @click="openPickUpView" />
<select-outlined v-if="linkView" @click="openLinkView" />
</template>
<a-select-option v-for="(item, index) in items" :key="index" :value="item[deKeyField]">
\{{item[deMajorField]}}
\{{ item[deMajorField] }}
</a-select-option>
</a-select>
</a-select>
</template>
</template>
<style scoped>
</style>
\ No newline at end of file
<style scoped></style>
......@@ -144,17 +144,28 @@ const onChange = ($event: any) => {
</div>
</template>
<style scoped>
<style lang="scss">
.app-editor-container {
width: 100%;
height: 100%;
text-align: left;
}
.app-editor-container .ant-upload--limit .ant-upload-select-picture-card {
display: none;
}
.ant-upload-select-picture-card .ant-upload-text {
margin-top: 8px;
color: #666;
.ant-upload--limit {
.ant-upload-select-picture-card,.ant-upload-select-text {
display: none;
}
.ant-upload-list-text {
>div:first-child {
.ant-upload-list-item {
margin-top: 4px;
}
}
}
}
.ant-upload-select-picture-card {
.ant-upload-text {
margin-top: 8px;
color: #666;
}
}
}
</style>
<script setup lang="ts">
import { IParam, IActionParam, useContextParams } from "@ibiz-core";
import { IParam, IActionParam } from "@ibiz-core";
import { onBeforeMount, ref, Ref } from "vue";
interface ToolbarProps {
......@@ -14,7 +14,6 @@ interface toolbarEmit {
const props = withDefaults(defineProps<ToolbarProps>(), {});
const emit = defineEmits<toolbarEmit>();
const items: Ref<IParam[]> = ref(props.toolbarModel?.items || []);
const { context, viewParams } = useContextParams(props);
const getItemClass = (item: IParam) => {
//todo 样式表
return item.class;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册