Browse Source

Merge remote-tracking branch 'origin/master'

master
zhaoxuebing 11 months ago
parent
commit
ff1f5ffaad
  1. 12
      src/components/BasicForm/src/BasicForm.vue
  2. 11
      src/components/Form/src/Form.vue

12
src/components/BasicForm/src/BasicForm.vue

@ -14,6 +14,7 @@
:schema="formSchema" :schema="formSchema"
:is-col="true" :is-col="true"
@opensearchTable="opensearchTable" @opensearchTable="opensearchTable"
@onChange="onChange"
> >
<template #crontab="formSchema" v-if="fromeWhere == 'countPlan'"> <template #crontab="formSchema" v-if="fromeWhere == 'countPlan'">
<crontab v-model="formSchema.crontab" /> <crontab v-model="formSchema.crontab" />
@ -464,7 +465,8 @@ const emit = defineEmits([
'selectChangeDetail', 'selectChangeDetail',
'tableFormChange', 'tableFormChange',
'buttonOperationClick', 'buttonOperationClick',
'inputStringBlur' 'inputStringBlur',
'onChange'
]) ])
// //
const formSelectChange = (field, val, row) => { const formSelectChange = (field, val, row) => {
@ -513,6 +515,14 @@ const inpuFocus = (headerItem, row, index) => {
row row
) )
} }
/**
* 监听改变事件
* @param field 当前操作字段
* @param cur 改变后值
*/
const onChange = (field, cur) => {
emit('onChange', field, cur)
}
// //
const selectChange = (field, val) => { const selectChange = (field, val) => {

11
src/components/Form/src/Form.vue

@ -54,7 +54,7 @@ export default defineComponent({
vLoading: propTypes.bool.def(false), vLoading: propTypes.bool.def(false),
labelPosition: propTypes.string.def('left'), labelPosition: propTypes.string.def('left'),
}, },
emits: ['register','opensearchTable'], emits: ['register','opensearchTable', 'onChange'],
setup(props, { slots, expose, emit }) { setup(props, { slots, expose, emit }) {
// element form // element form
const elFormRef = ref<ComponentRef<typeof ElForm>>() const elFormRef = ref<ComponentRef<typeof ElForm>>()
@ -180,6 +180,14 @@ export default defineComponent({
}) })
} }
/**
* 监听改变事件
* @param field 当前操作字段
* @param cur 改变后值
*/
const onChange = (field, cur) => {
emit('onChange', field, cur)
}
// formItem // formItem
const renderFormItem = (item: FormSchema) => { const renderFormItem = (item: FormSchema) => {
// options // options
@ -282,6 +290,7 @@ export default defineComponent({
{...(autoSetPlaceholder && setTextPlaceholder(item))} {...(autoSetPlaceholder && setTextPlaceholder(item))}
{...setComponentProps(item)} {...setComponentProps(item)}
style={item.componentProps?.style} style={item.componentProps?.style}
onChange={(e)=>{onChange(item.field, e)}}
{...(notRenderOptions.includes(item?.component as string) && {...(notRenderOptions.includes(item?.component as string) &&
item?.componentProps?.options item?.componentProps?.options
? { options: item?.componentProps?.options || [] } ? { options: item?.componentProps?.options || [] }

Loading…
Cancel
Save