| | |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | formlist: PropTypes.any, // 表单 |
| | | optionLibs: PropTypes.any, // 自定义下拉集 |
| | | card: PropTypes.object // 搜索条件信息 |
| | | } |
| | | |
| | |
| | | * 2、下拉选择,根据数据源类型显示相关配置 |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const { formlist } = this.props |
| | | const { formlist, optionLibs } = this.props |
| | | |
| | | 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', 'match'] // 默认显示项 |
| | | |
| | | if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '0') { // 下拉选择类型、选项为自定义资源 |
| | | _options = [..._options, 'resourceType', 'options', 'display'] |
| | | _options = [..._options, 'resourceType', 'options', 'display', 'quick'] |
| | | } else if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '1') { // 下拉选择类型、选项为后台数据源中获取 |
| | | _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display', 'database'] |
| | | } |
| | |
| | | } else if (type === 'dateweek' || type === 'daterange') { |
| | | form.options = matchReg.daterange |
| | | } |
| | | } else if (form.key === 'quick') { |
| | | form.options = [...optionLibs.values()].filter(cell => cell.uuid !== this.props.card.uuid) |
| | | form.options = form.options.map(cell => { |
| | | return { |
| | | value: cell.uuid, |
| | | text: cell.label + '(' + cell.parname + ')' |
| | | } |
| | | }) |
| | | } |
| | | form.hidden = !_options.includes(form.key) |
| | | return form |
| | |
| | | let _options = ['label', 'field', 'initval', 'type', 'match'] |
| | | |
| | | if ((value === 'multiselect' || value === 'select' || value === 'link') && resourceType === '0') { // 下拉选择类型、选项为自定义资源 |
| | | _options = [..._options, 'resourceType', 'options', 'display'] |
| | | _options = [..._options, 'resourceType', 'options', 'display', 'quick'] |
| | | } else if ((value === 'multiselect' || value === 'select' || value === 'link') && resourceType === '1') { // 下拉选择类型、选项为后台数据源中获取 |
| | | _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display', 'database'] |
| | | } |
| | |
| | | }) |
| | | }) |
| | | }) |
| | | } else if (key === 'quick') { |
| | | let option = this.props.optionLibs.get(value) |
| | | |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(form => { |
| | | if (form.key === 'options') { |
| | | form.initVal = option.options |
| | | } |
| | | |
| | | return form |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | let _options = ['label', 'field', 'initval', 'type', 'match', 'resourceType', 'display'] |
| | | |
| | | if (value === '0') { |
| | | _options = [..._options, 'options'] |
| | | _options = [..._options, 'options', 'quick'] |
| | | } else if (value === '1') { |
| | | _options = [..._options, 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database'] |
| | | } |