提交 1502ef3e 编写于 作者: zhf's avatar zhf

feat: 更新模板

上级 f730a906
import { useNamespace } from '@ibiz-template/vue-util'; import { useNamespace } from '@ibiz-template/vue-util';
import { defineComponent, ref } from 'vue'; import { PropType, defineComponent, ref } from 'vue';
import '@ibiz-template/theme/style/components/common/data-import/data-import.scss'; import '@ibiz-template/theme/style/components/common/data-import/data-import.scss';
import { HttpError } from '@ibiz-template/core'; import { HttpError } from '@ibiz-template/core';
...@@ -14,6 +14,9 @@ export const DataImport = defineComponent({ ...@@ -14,6 +14,9 @@ export const DataImport = defineComponent({
type: String, type: String,
required: true, required: true,
}, },
dismiss: {
type: Function as PropType<(_result: IParams) => void>,
},
}, },
setup(props, { emit }) { setup(props, { emit }) {
const ns = useNamespace('data-import'); const ns = useNamespace('data-import');
...@@ -102,6 +105,7 @@ export const DataImport = defineComponent({ ...@@ -102,6 +105,7 @@ export const DataImport = defineComponent({
const onCancelButtonClick = () => { const onCancelButtonClick = () => {
emit('close', { ok: false, data: {} }); emit('close', { ok: false, data: {} });
props.dismiss?.({ ok: false, data: {} });
}; };
return { return {
......
...@@ -26,6 +26,9 @@ export const IBizPicker = defineComponent({ ...@@ -26,6 +26,9 @@ export const IBizPicker = defineComponent({
// 是否显示所有数据 // 是否显示所有数据
const isShowAll = ref(true); const isShowAll = ref(true);
// 自动完成组件
const autocomplete = ref();
watch( watch(
() => props.value, () => props.value,
newVal => { newVal => {
...@@ -83,6 +86,12 @@ export const IBizPicker = defineComponent({ ...@@ -83,6 +86,12 @@ export const IBizPicker = defineComponent({
// 往外抛值 // 往外抛值
const onACSelect = async (item: IData) => { const onACSelect = async (item: IData) => {
if (autocomplete.value) {
if (item[c.textName] === curValue.value) {
autocomplete.value.currentValue = curValue.value;
}
autocomplete.value.$refs?.select?.hideMenu?.();
}
await handleDataSelect(item); await handleDataSelect(item);
isShowAll.value = true; isShowAll.value = true;
emit('operate', false); emit('operate', false);
...@@ -132,6 +141,7 @@ export const IBizPicker = defineComponent({ ...@@ -132,6 +141,7 @@ export const IBizPicker = defineComponent({
c, c,
curValue, curValue,
items, items,
autocomplete,
openPickUpView, openPickUpView,
openLinkView, openLinkView,
onACSelect, onACSelect,
...@@ -195,6 +205,7 @@ export const IBizPicker = defineComponent({ ...@@ -195,6 +205,7 @@ export const IBizPicker = defineComponent({
h( h(
'IAutoComplete', 'IAutoComplete',
{ {
ref: 'autocomplete',
props: { props: {
...this.c.customProps, ...this.c.customProps,
value: this.curValue, value: this.curValue,
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册