| | |
| | | return fields |
| | | } |
| | | |
| | | transfer = (options) => { |
| | | if (options.length === 0) return options |
| | | // transfer = (options) => { |
| | | // if (options.length === 0) return options |
| | | |
| | | let isNumber = true |
| | | options.forEach(item => { |
| | | if (!item.Value || isNaN(item.Value)) { |
| | | isNumber = false |
| | | } |
| | | }) |
| | | // let isNumber = true |
| | | // options.forEach(item => { |
| | | // if (!item.Value || isNaN(item.Value)) { |
| | | // isNumber = false |
| | | // } |
| | | // }) |
| | | |
| | | if (isNumber) { |
| | | return options.map(item => { |
| | | item.Value = +item.Value |
| | | return item |
| | | }) |
| | | } else { |
| | | return options.map(item => { |
| | | item.Value = item.Value + '' |
| | | return item |
| | | }) |
| | | } |
| | | } |
| | | // if (isNumber) { |
| | | // return options.map(item => { |
| | | // item.Value = +item.Value |
| | | // return item |
| | | // }) |
| | | // } else { |
| | | // return options.map(item => { |
| | | // item.Value = item.Value + '' |
| | | // return item |
| | | // }) |
| | | // } |
| | | // } |
| | | |
| | | transferCard = (options) => { |
| | | if (options.length === 0) return options |
| | | // transferCard = (options) => { |
| | | // if (options.length === 0) return options |
| | | |
| | | let isNumber = true |
| | | options.forEach(item => { |
| | | if (!/^([0-9]|[1-9]\d{0,2})$/.test(item.$value)) { |
| | | isNumber = false |
| | | } |
| | | }) |
| | | // let isNumber = true |
| | | // options.forEach(item => { |
| | | // if (!/^([0-9]|[1-9]\d{0,2})$/.test(item.$value)) { |
| | | // isNumber = false |
| | | // } |
| | | // }) |
| | | |
| | | if (isNumber) { |
| | | return options.map(item => { |
| | | item.$value = +item.$value |
| | | return item |
| | | }) |
| | | } else { |
| | | return options.map(item => { |
| | | item.$value = item.$value + '' |
| | | return item |
| | | }) |
| | | } |
| | | } |
| | | // if (isNumber) { |
| | | // return options.map(item => { |
| | | // item.$value = +item.$value |
| | | // return item |
| | | // }) |
| | | // } else { |
| | | // return options.map(item => { |
| | | // item.$value = item.$value + '' |
| | | // return item |
| | | // }) |
| | | // } |
| | | // } |
| | | |
| | | handleConfirm = () => { |
| | | const { card, fields } = this.props |
| | |
| | | if (['multiselect', 'select', 'link', 'radio', 'checkbox'].includes(values.type)) { |
| | | if (values.resourceType === '0') { |
| | | values.options = values.options || [] |
| | | values.options = values.options.map(item => { |
| | | item.Value = item.Value + '' |
| | | return item |
| | | }) |
| | | values.dataSource = '' |
| | | let type = values.type |
| | | if (values.type === 'radio' && values.linkField) { |
| | | type = 'link' |
| | | } |
| | | |
| | | values.options = this.transfer(values.options) |
| | | // values.options = this.transfer(values.options) |
| | | |
| | | if (values.options.filter(op => op.Text === '').length > 0) { |
| | | notification.warning({ |
| | |
| | | let linkSubFields = values.linkSubField || [] |
| | | values.options = values.options.map(m => { |
| | | m.ParentID = m.ParentID || '' |
| | | m.$value = m.$value + '' |
| | | |
| | | linkSubFields.forEach(n => { |
| | | m[n] = m[n] || '' |
| | |
| | | return m |
| | | }) |
| | | |
| | | values.options = this.transferCard(values.options) |
| | | // values.options = this.transferCard(values.options) |
| | | |
| | | let type = values.type |
| | | if (values.linkField) { |