mirror of
				https://github.com/Tencent/tmagic-editor.git
				synced 2025-10-30 11:53:31 +08:00 
			
		
		
		
	fix(form): group-list上移下移行为不对
This commit is contained in:
		
							parent
							
								
									26cd37be23
								
							
						
					
					
						commit
						aabc77d903
					
				| @ -132,6 +132,7 @@ const toggleMode = () => { | |||||||
|       text: null, |       text: null, | ||||||
|     }))) as any; |     }))) as any; | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
| const onAddDiffCount = () => emit('addDiffCount'); | const onAddDiffCount = () => emit('addDiffCount'); | ||||||
| 
 | 
 | ||||||
| const getLastValues = (item: any, index: number) => item?.[index] || {}; | const getLastValues = (item: any, index: number) => item?.[index] || {}; | ||||||
|  | |||||||
| @ -88,7 +88,13 @@ const title = computed(() => { | |||||||
|     return props.model[props.config.titleKey]; |     return props.model[props.config.titleKey]; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   return `组 ${String(props.index)}`; |   if (props.config.title) { | ||||||
|  |     return filterFunction(mForm, props.config.title, props); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   const titlePrefix = props.config.titlePrefix || '组'; | ||||||
|  | 
 | ||||||
|  |   return `${titlePrefix} ${String(props.index + 1)}`; | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| const length = computed(() => props.groupModel?.length || 0); | const length = computed(() => props.groupModel?.length || 0); | ||||||
| @ -113,7 +119,7 @@ const showDelete = (index: number) => { | |||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| // 调换顺序 | // 调换顺序 | ||||||
| const changeOrder = (offset = 0) => emit('swap-item', props.index, `${String(props.index)}${offset}`); | const changeOrder = (offset = 0) => emit('swap-item', props.index, props.index + offset); | ||||||
| 
 | 
 | ||||||
| const movable = () => { | const movable = () => { | ||||||
|   const { movable } = props.config; |   const { movable } = props.config; | ||||||
|  | |||||||
| @ -680,6 +680,8 @@ export interface GroupListConfig extends FormItem { | |||||||
|   groupItems?: FormConfig; |   groupItems?: FormConfig; | ||||||
|   tableItems?: FormConfig; |   tableItems?: FormConfig; | ||||||
|   titleKey?: string; |   titleKey?: string; | ||||||
|  |   titlePrefix?: string; | ||||||
|  |   title?: string | FilterFunction; | ||||||
|   itemExtra?: string | FilterFunction; |   itemExtra?: string | FilterFunction; | ||||||
|   expandAll?: boolean; |   expandAll?: boolean; | ||||||
|   addable?: (mForm: FormState | undefined, data: any) => boolean | 'undefined' | boolean; |   addable?: (mForm: FormState | undefined, data: any) => boolean | 'undefined' | boolean; | ||||||
|  | |||||||
| @ -193,6 +193,7 @@ export const filterFunction = (mForm: FormState | undefined, config: any, props: | |||||||
|     formValue: mForm?.values || props.model, |     formValue: mForm?.values || props.model, | ||||||
|     prop: props.prop, |     prop: props.prop, | ||||||
|     config: props.config, |     config: props.config, | ||||||
|  |     index: props.index, | ||||||
|   }); |   }); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user