function bookForm() { return { type: 'form', ...horizontalFormOptions(), body: [ { type: 'hidden', name: 'id', }, { type: 'input-text', name: 'name', label: '名称', required: true, ...formInputClearable(), }, { type: 'input-text', name: 'author', label: '作者', ...formInputClearable(), }, { type: 'input-text', name: 'source', label: '来源', ...formInputClearable(), validations: { isUrl: true, }, }, { type: 'input-tag', name: 'tags', label: '标签', clearable: true, joinValues: false, extractValue: true, max: 10, maxTagLength: 10, source: '${base}/book/tags' }, { type: 'textarea', name: 'description', label: '简介', required: true, ...formInputClearable(), showCounter: true, trimContents: true, minRows: 2, maxRows: 2, maxLength: 100, }, ], } } function bookAddDialog() { return { type: 'action', actionType: 'dialog', dialog: { title: '新增书籍', size: 'md', body: { ...bookForm(), api: '${base}/book/save', }, }, } } function bookDetailDialog() { return { type: 'action', actionType: 'dialog', dialog: { title: '编辑书籍', size: 'md', body: { ...bookForm(), initApi: '${base}/book/detail/${bookId}', api: '${base}/book/save', }, }, } }