| | |
| | | const { TextArea } = Input |
| | | const ColorSketch = asyncComponent(() => import('@/mob/colorsketch')) |
| | | const FieldsTable = asyncComponent(() => import('./fieldtable')) |
| | | const DataTable = asyncComponent(() => import('./datatable')) |
| | | const MkEditIcon = asyncComponent(() => import('@/components/mkIcon')) |
| | | |
| | | const modalTypeOptions = { |
| | |
| | | this.record.options = this.record.options.map(cell => { |
| | | cell.Value = cell.Value || cell.$value || '' |
| | | cell.Text = cell[field] || '' |
| | | |
| | | delete cell.$value |
| | | return cell |
| | | }) |
| | | } else { |
| | | this.record.options = this.record.options.map(cell => { |
| | | cell.Value = cell.Value || cell.$value || '' |
| | | |
| | | delete cell.$value |
| | | return cell |
| | | }) |
| | | } |
| | |
| | | linkSubFields = [] |
| | | } |
| | | } |
| | | content = <EditTable type={type} module="form" transfield={transfield} linkSubFields={linkSubFields} onChange={this.changeOptions}/> |
| | | |
| | | let columns = [] |
| | | if (type === 'link') { |
| | | columns.push({ title: 'ParentID', key: 'ParentID', strict: true }) |
| | | } |
| | | columns.push({ title: 'Value', key: 'Value', strict: true }) |
| | | columns.push({ title: 'Text', key: 'Text' }) |
| | | |
| | | linkSubFields.forEach(field => { |
| | | if (field === 'Value' || field === 'Text') return |
| | | |
| | | columns.push({ title: transfield[field] || field, key: field }) |
| | | }) |
| | | |
| | | content = <EditTable columns={columns} module="form" onChange={this.changeOptions}/> |
| | | } else { |
| | | if (this.record.multiple === 'true') { |
| | | linkSubFields = [] |
| | |
| | | if (this.record.linkField) { |
| | | type = 'link' |
| | | } |
| | | content = <DataTable type={type} display={this.record.display} linkSubFields={linkSubFields} transfield={transfield} fields={this.record.fields || []} onChange={this.changeOptions}/> |
| | | |
| | | let columns = [] |
| | | let fields = this.record.fields || [] |
| | | let keys = ['ParentID', 'pid'] |
| | | |
| | | if (type === 'link') { |
| | | columns.push({ title: 'ParentID', key: 'ParentID', strict: true }) |
| | | } |
| | | columns.push({ title: 'Value', key: '$value', strict: true }) |
| | | |
| | | if (this.record.display === 'picture') { |
| | | columns.push({ title: 'url', key: '$url', type: 'file' }) |
| | | } else if (this.record.display === 'color') { |
| | | columns.push({ title: 'Color', key: '$color' }) |
| | | } |
| | | |
| | | fields.forEach(item => { |
| | | keys.push(item.field) |
| | | columns.push({ title: item.field, key: item.field }) |
| | | }) |
| | | |
| | | linkSubFields.forEach(m => { |
| | | if (keys.includes(m)) return |
| | | |
| | | columns.push({ title: transfield[m] || m, key: m }) |
| | | }) |
| | | |
| | | content = <EditTable columns={columns} onChange={this.changeOptions}/> |
| | | } |
| | | } else if (item.type === 'fields') { |
| | | span = 24 |
| | |
| | | |
| | | let isNumber = true |
| | | options.forEach(item => { |
| | | if (!/^([0-9]|[1-9]\d{0,2})$/.test(item.Value)) { |
| | | if (!item.Value || isNaN(item.Value)) { |
| | | isNumber = false |
| | | } |
| | | }) |