|
@ -64,6 +64,19 @@ export default { |
|
|
gridRow: `span ${item.gridRow || 1}`, |
|
|
gridRow: `span ${item.gridRow || 1}`, |
|
|
gridColumn: `span ${item.gridColumn || 1}`, |
|
|
gridColumn: `span ${item.gridColumn || 1}`, |
|
|
}) |
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
getText() { |
|
|
|
|
|
return (item) => { |
|
|
|
|
|
const result = this.data[item.key]; |
|
|
|
|
|
|
|
|
|
|
|
if (item.enum) return EnumMap[item.enum][result]?.text; |
|
|
|
|
|
|
|
|
|
|
|
const templateResult = item.key?.replace(/\$\{[^}]+\}/g, (key) => this.data[key.slice(2, -1)]); |
|
|
|
|
|
|
|
|
|
|
|
if (templateResult && templateResult != item.key) return templateResult |
|
|
|
|
|
|
|
|
|
|
|
return result || item.text; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
@ -72,17 +85,6 @@ export default { |
|
|
gridTemplateColumns: `repeat(${this.column}, 1fr)`, |
|
|
gridTemplateColumns: `repeat(${this.column}, 1fr)`, |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
getText(item) { |
|
|
|
|
|
const result = this.data[item.key]; |
|
|
|
|
|
|
|
|
|
|
|
if (item.enum) return EnumMap[item.enum][result]?.text; |
|
|
|
|
|
|
|
|
|
|
|
const templateResult = item.key?.replace(/\$\{[^}]+\}/g, (key) => this.data[key.slice(2, -1)]); |
|
|
|
|
|
|
|
|
|
|
|
if (templateResult && templateResult != item.key) return templateResult |
|
|
|
|
|
|
|
|
|
|
|
return result || item.text; |
|
|
|
|
|
}, |
|
|
|
|
|
getComponent(type) { |
|
|
getComponent(type) { |
|
|
return `Form${type.replace(/^[a-z]/, word => word.toUpperCase())}` |
|
|
return `Form${type.replace(/^[a-z]/, word => word.toUpperCase())}` |
|
|
}, |
|
|
}, |
|
|