From c2d795423ff37243b6e3399e92a40b64af6e4cfa Mon Sep 17 00:00:00 2001 From: iv <398778994@qq.com> Date: Tue, 12 Dec 2023 23:15:23 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"feat:=20table=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E5=80=BC=E5=8F=91=E7=94=9F=E6=94=B9=E5=8F=98?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E8=A7=A6=E5=8F=91reload=20(#3378)"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 1ca3f7c2c0c0c00e8395e26c59796c875d34e12c. --- .../Form/src/components/FormItem.vue | 26 +------------ src/components/Form/src/props.ts | 3 -- src/components/Form/src/types/form.ts | 6 --- src/views/demo/table/tableData.tsx | 39 ------------------- 4 files changed, 1 insertion(+), 73 deletions(-) diff --git a/src/components/Form/src/components/FormItem.vue b/src/components/Form/src/components/FormItem.vue index ec23e4b3518..c0021519846 100644 --- a/src/components/Form/src/components/FormItem.vue +++ b/src/components/Form/src/components/FormItem.vue @@ -24,7 +24,6 @@ import { cloneDeep, upperFirst } from 'lodash-es'; import { useItemLabelWidth } from '../hooks/useLabelWidth'; import { useI18n } from '@/hooks/web/useI18n'; - import { useDebounceFn } from '@vueuse/core'; export default defineComponent({ name: 'BasicFormItem', @@ -271,8 +270,6 @@ component, field, changeEvent = 'change', - watchEventNames = ['search', 'change'], - enableWatchEvent = true, valueField, } = props.schema; @@ -280,27 +277,6 @@ const eventKey = `on${upperFirst(changeEvent)}`; - const { autoSetPlaceHolder, size, watchEvent } = props.formProps; - let eventNames = {}; - if (watchEvent && enableWatchEvent) { - // table search 开启才触发事件 - let immediateEvents = ['search']; // 立即执行的事件 - watchEventNames.forEach((item) => { - let timer: number = 500; - if (immediateEvents.includes(item)) { - timer = 0; - } - eventNames[`on${upperFirst(item)}`] = useDebounceFn( - (...args: Nullable>[]) => { - // todo 后续需要优化input中文输入的问题 - console.log(args); - const { reload = () => {} } = props.tableAction || {}; - reload(); - }, - timer, - ); - }); - } const on = { [eventKey]: (...args: Nullable>[]) => { const [e] = args; @@ -314,6 +290,7 @@ }; const Comp = componentMap.get(component) as ReturnType; + const { autoSetPlaceHolder, size } = props.formProps; const propsData: Recordable = { allowClear: true, size, @@ -338,7 +315,6 @@ const compAttr: Recordable = { ...propsData, ...on, - ...eventNames, ...bindValue, }; diff --git a/src/components/Form/src/props.ts b/src/components/Form/src/props.ts index 8f017745f7f..fb96e471e8f 100644 --- a/src/components/Form/src/props.ts +++ b/src/components/Form/src/props.ts @@ -100,7 +100,4 @@ export const basicProps = { labelAlign: propTypes.string, rowProps: Object as PropType, - - // table 开启监听表单监听事件,触发table reload - watchEvent: propTypes.bool.def(false), }; diff --git a/src/components/Form/src/types/form.ts b/src/components/Form/src/types/form.ts index e6c15eee0ff..0838de8b7d6 100644 --- a/src/components/Form/src/types/form.ts +++ b/src/components/Form/src/types/form.ts @@ -124,7 +124,6 @@ export interface FormProps { submitFunc?: () => Promise; transformDateFunc?: (date: any) => string; colon?: boolean; - watchEvent?: boolean; } export type RenderOpts = { disabled: boolean; @@ -224,11 +223,6 @@ interface BaseFormSchema { dynamicReadonly?: boolean | ((renderCallbackParams: RenderCallbackParams) => boolean); dynamicRules?: (renderCallbackParams: RenderCallbackParams) => Rule[]; - - watchEventNames?: string[]; - - // 禁用事件监听触发reload - enableWatchEvent?: boolean; } export interface ComponentFormSchema extends BaseFormSchema { // render component diff --git a/src/views/demo/table/tableData.tsx b/src/views/demo/table/tableData.tsx index a1397ee9f81..a4eb7855c0f 100644 --- a/src/views/demo/table/tableData.tsx +++ b/src/views/demo/table/tableData.tsx @@ -259,45 +259,6 @@ export function getFormConfig(): Partial { xxl: 8, }, }, - { - field: `field12`, - label: `input值改变`, - component: 'InputSearch', - enableWatchEvent: true, - componentProps: { - placeholder: '需要开启watchEvent', - }, - colProps: { - xl: 12, - xxl: 8, - }, - }, - { - field: 'field13', - component: 'Select', - label: 'select值改变', - componentProps: { - placeholder: '需要开启watchEvent', - options: [ - { - label: '公开', - value: '1', - }, - { - label: '部分公开', - value: '2', - }, - { - label: '不公开', - value: '3', - }, - ], - }, - colProps: { - xl: 12, - xxl: 8, - }, - }, ], }; }