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

update: 更新

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