| | |
| | | |
| | | let type = formlist.filter(cell => cell.key === 'type')[0].initVal |
| | | let resourceType = formlist.filter(cell => cell.key === 'resourceType')[0].initVal |
| | | let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required'] // 默认显示项 |
| | | let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden'] // 默认显示项 |
| | | |
| | | if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '0') { // 选择类型、自定义资源 |
| | | _options = [..._options, 'resourceType', 'options'] |
| | |
| | | form.type = 'select' |
| | | } else if (type === 'number' && form.key === 'initval') { |
| | | form.type = 'number' |
| | | form.initVal = 0 |
| | | } |
| | | form.hidden = !_options.includes(form.key) |
| | | form.show = _options.includes(form.key) |
| | | return form |
| | | }) |
| | | }) |
| | |
| | | |
| | | openTypeChange = (key, value) => { |
| | | if (key === 'type') { |
| | | let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required'] |
| | | let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden'] |
| | | |
| | | if ((value === 'multiselect' || value === 'select' || value === 'link') && this.state.resourceType === '0') { // 选择类型、自定义资源 |
| | | _options = [..._options, 'resourceType', 'options'] |
| | |
| | | this.setState({ |
| | | openType: value, |
| | | formlist: this.state.formlist.map(form => { |
| | | form.hidden = !_options.includes(form.key) |
| | | form.show = _options.includes(form.key) |
| | | if (form.key === 'initval') { |
| | | if (dateOptions.hasOwnProperty(value)) { |
| | | form.options = dateOptions[value] |
| | | form.type = 'select' |
| | | form.initVal = '' |
| | | } else if (value === 'number') { |
| | | form.type = 'number' |
| | | form.initVal = 0 |
| | | } else { |
| | | form.type = 'text' |
| | | form.initVal = '' |
| | | } |
| | | form.hidden = true |
| | | form.initVal = '' |
| | | form.show = false |
| | | } |
| | | return form |
| | | }) |
| | |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(form => { |
| | | if (form.key === 'initval' && value !== 'fileupload' && value !== 'funcvar') { |
| | | form.hidden = false |
| | | form.show = true |
| | | } |
| | | return form |
| | | }) |
| | |
| | | this.setState({ |
| | | resourceType: value, |
| | | formlist: this.state.formlist.map(form => { |
| | | form.hidden = !_options.includes(form.key) |
| | | form.show = _options.includes(form.key) |
| | | return form |
| | | }) |
| | | }) |
| | |
| | | const fields = [] |
| | | |
| | | this.state.formlist.forEach((item, index) => { |
| | | if (item.hidden) return |
| | | if (!item.show) return |
| | | |
| | | if (item.type === 'text') { // 文本搜索 |
| | | let rules = [] |