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

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

@ -54,7 +54,7 @@ export default defineComponent({
vLoading: propTypes.bool.def(false),
labelPosition: propTypes.string.def('left'),
},
emits: ['register','opensearchTable'],
emits: ['register','opensearchTable', 'onChange'],
setup(props, { slots, expose, emit }) {
// element form
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
const renderFormItem = (item: FormSchema) => {
// options
@ -282,6 +290,7 @@ export default defineComponent({
{...(autoSetPlaceholder && setTextPlaceholder(item))}
{...setComponentProps(item)}
style={item.componentProps?.style}
onChange={(e)=>{onChange(item.field, e)}}
{...(notRenderOptions.includes(item?.component as string) &&
item?.componentProps?.options
? { options: item?.componentProps?.options || [] }

Loading…
Cancel
Save