mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2025-09-09 20:57:17 +08:00
refactor(GiForm): 优化 GiForm 代码
This commit is contained in:
@@ -109,49 +109,39 @@ const colVShow = (index: number) => {
|
|||||||
// 组件的默认props配置
|
// 组件的默认props配置
|
||||||
const getComponentBindProps = (item: ColumnsItem) => {
|
const getComponentBindProps = (item: ColumnsItem) => {
|
||||||
const obj: Partial<ColumnsItem['props'] & { placeholder: string }> = {}
|
const obj: Partial<ColumnsItem['props'] & { placeholder: string }> = {}
|
||||||
if (item.type === 'input') {
|
switch (item.type) {
|
||||||
|
case 'input':
|
||||||
|
case 'input-password':
|
||||||
|
case 'input-number':
|
||||||
obj.allowClear = true
|
obj.allowClear = true
|
||||||
obj.placeholder = `请输入${item.label}`
|
obj.placeholder = `请输入${item.label}`
|
||||||
}
|
break
|
||||||
if (item.type === 'input-password') {
|
case 'textarea':
|
||||||
obj.allowClear = true
|
|
||||||
obj.placeholder = `请输入${item.label}`
|
|
||||||
}
|
|
||||||
if (item.type === 'input-number') {
|
|
||||||
obj.allowClear = true
|
|
||||||
obj.placeholder = `请输入${item.label}`
|
|
||||||
}
|
|
||||||
if (item.type === 'textarea') {
|
|
||||||
obj.placeholder = `请输入${item.label}`
|
obj.placeholder = `请输入${item.label}`
|
||||||
obj.maxLength = 200
|
obj.maxLength = 200
|
||||||
}
|
break
|
||||||
if (item.type === 'select') {
|
case 'select':
|
||||||
|
case 'cascader':
|
||||||
obj.allowClear = true
|
obj.allowClear = true
|
||||||
obj.placeholder = `请选择${item.label}`
|
obj.placeholder = `请选择${item.label}`
|
||||||
obj.options = dicData[item.field] || item.options
|
obj.options = dicData[item.field] || item.options
|
||||||
}
|
break
|
||||||
if (item.type === 'cascader') {
|
case 'tree-select':
|
||||||
obj.allowClear = true
|
|
||||||
obj.placeholder = `请选择${item.label}`
|
|
||||||
obj.options = dicData[item.field] || item.options
|
|
||||||
}
|
|
||||||
if (item.type === 'tree-select') {
|
|
||||||
obj.allowClear = true
|
obj.allowClear = true
|
||||||
obj.placeholder = `请选择${item.label}`
|
obj.placeholder = `请选择${item.label}`
|
||||||
obj.data = dicData[item.field] || item.data
|
obj.data = dicData[item.field] || item.data
|
||||||
}
|
break
|
||||||
if (item.type === 'radio-group') {
|
case 'radio-group':
|
||||||
|
case 'checkbox-group':
|
||||||
obj.options = dicData[item.field] || item.options
|
obj.options = dicData[item.field] || item.options
|
||||||
}
|
break
|
||||||
if (item.type === 'checkbox-group') {
|
case 'date-picker':
|
||||||
obj.options = dicData[item.field] || item.options
|
|
||||||
}
|
|
||||||
if (item.type === 'date-picker') {
|
|
||||||
obj.placeholder = '请选择日期'
|
obj.placeholder = '请选择日期'
|
||||||
}
|
break
|
||||||
if (item.type === 'time-picker') {
|
case 'time-picker':
|
||||||
obj.allowClear = true
|
obj.allowClear = true
|
||||||
obj.placeholder = `请选择时间`
|
obj.placeholder = `请选择时间`
|
||||||
|
break
|
||||||
}
|
}
|
||||||
return { ...obj, ...item.props }
|
return { ...obj, ...item.props }
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user