提交 d53d981f 编写于 作者: zhangkang's avatar zhangkang

update:datapicker选择器值抛出逻辑

上级 fe3f56b6
...@@ -83,6 +83,11 @@ interface DataPickerProps { ...@@ -83,6 +83,11 @@ interface DataPickerProps {
*/ */
sort?: string; sort?: string;
/**
* @description 分割符
*/
separator?: string;
/** /**
* @description 外键值附加数据 * @description 外键值附加数据
*/ */
...@@ -103,6 +108,7 @@ const props = withDefaults(defineProps<DataPickerProps>(), { ...@@ -103,6 +108,7 @@ const props = withDefaults(defineProps<DataPickerProps>(), {
linkOnly: false, linkOnly: false,
isAC: false, isAC: false,
isDropdown: false, isDropdown: false,
separator: ';',
}); });
const emit = defineEmits<EditorEmit>(); const emit = defineEmits<EditorEmit>();
const { handleEditorNavParams, openLinkView, openPickUpView } = new EditorBase(); const { handleEditorNavParams, openLinkView, openPickUpView } = new EditorBase();
...@@ -195,8 +201,19 @@ const onSelect = (value: any) => { ...@@ -195,8 +201,19 @@ const onSelect = (value: any) => {
fillPickUpData(selectItem); fillPickUpData(selectItem);
}; };
const initValue = (data: any) => { // 编辑器抛值
// todo const doEditorEmit = (data: any[]): any => {
let majorValue: any = '';
let keyValue: any = '';
data.forEach((item: any) => {
majorValue = majorValue + (majorValue ? props.separator : '') + item[props.deMajorField];
keyValue = keyValue + (keyValue ? props.separator : '') + item[props.deKeyField];
});
if (props.valueItem) {
emit('editorEvent', { tag: props.valueItem, action: 'valueChange', data: keyValue });
}
emit('editorEvent', { tag: props.name, action: 'valueChange', data: majorValue });
return;
}; };
// 打开视图 // 打开视图
...@@ -211,8 +228,7 @@ const openView = () => { ...@@ -211,8 +228,7 @@ const openView = () => {
const subject = App.getOpenViewService().openView(view, {}); const subject = App.getOpenViewService().openView(view, {});
const subjectEvent = subject?.subscribe((data: any) => { const subjectEvent = subject?.subscribe((data: any) => {
if (data?.ret == 'OK' && data.resultData) { if (data?.ret == 'OK' && data.resultData) {
const value = initValue(data.resultData); doEditorEmit(data.resultData);
emit('editorEvent', { tag: props.valueItem, action: 'valueChange', data: value });
} }
subjectEvent?.unsubscribe(); subjectEvent?.unsubscribe();
}); });
...@@ -221,7 +237,7 @@ const openView = () => { ...@@ -221,7 +237,7 @@ const openView = () => {
<template> <template>
<template v-if="linkOnly" :class="['app-data-picker', `app-data-picker-${name}`]"> <template v-if="linkOnly" :class="['app-data-picker', `app-data-picker-${name}`]">
<a @click="openLinkView">{{ value }}</a> <a @click="openLinkView"></a>
</template> </template>
<template v-else-if="!isAC && !isDropdown"> <template v-else-if="!isAC && !isDropdown">
<a-auto-complete <a-auto-complete
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册