| | |
| | | |
| | | state = { |
| | | interType: this.props.setting.interType || 'system', |
| | | laypage: this.props.setting.laypage || 'true', |
| | | modules: [], |
| | | useMSearch: this.props.setting.useMSearch || 'false' |
| | | usefulFields: [], |
| | | useMSearch: this.props.setting.useMSearch || 'false', |
| | | supModule: this.props.setting.supModule || [] |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | label: '无' |
| | | }) |
| | | |
| | | this.setState({modules}) |
| | | let usefulFields = sessionStorage.getItem('permFuncField') |
| | | if (usefulFields) { |
| | | try { |
| | | usefulFields = JSON.parse(usefulFields) |
| | | } catch { |
| | | usefulFields = [] |
| | | } |
| | | } else { |
| | | usefulFields = [] |
| | | } |
| | | |
| | | this.setState({modules, usefulFields}) |
| | | } |
| | | |
| | | getModules = (components, selfId) => { |
| | |
| | | } |
| | | } |
| | | |
| | | changeSupModule = (val) => { |
| | | this.setState({supModule: val}) |
| | | } |
| | | |
| | | render() { |
| | | const { setting, menu, columns, config } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const { interType, modules, useMSearch } = this.state |
| | | const { interType, modules, useMSearch, laypage, supModule, usefulFields } = this.state |
| | | |
| | | const formItemLayout = { |
| | | labelCol: { |
| | |
| | | let tooltip = null |
| | | let rules = [] |
| | | |
| | | if (menu.permFuncField && menu.permFuncField.length > 0) { |
| | | tooltip = '开头可用字符:' + menu.permFuncField.join(', ') |
| | | let str = '^(' + menu.permFuncField.join('|') + ')' |
| | | if (usefulFields.length > 0) { |
| | | tooltip = '开头可用字符:' + usefulFields.join(', ') |
| | | let str = '^(' + usefulFields.join('|') + ')' |
| | | let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') |
| | | |
| | | rules.push({ |
| | |
| | | <div className="model-datasource-setting-form-box"> |
| | | <Form {...formItemLayout} className="model-setting-form"> |
| | | <Row gutter={24}> |
| | | |
| | | <Col span={8}> |
| | | <Form.Item label="表名"> |
| | | {getFieldDecorator('tableName', { |
| | |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | | </Col> |
| | | {interType === 'system' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title={'自定义脚本中的变量(除报错及可用字段外),需以此标识开头。'}> |
| | | <Icon type="question-circle" /> |
| | | 变量标识 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('varMark', { |
| | | initialValue: setting.varMark || '', |
| | | rules: [ |
| | | { |
| | | pattern: /^[a-zA-Z_]*$/ig, |
| | | message: '请使用字母或_' |
| | | }, |
| | | { |
| | | max: 3, |
| | | message: '最多三个字符。' |
| | | } |
| | | ] |
| | | })(<Input placeholder={''} autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'inner' ? <Col span={8}> |
| | | <Form.Item label={tooltip ? |
| | | <Tooltip placement="topLeft" title={tooltip}> |
| | |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={8}> |
| | | {menu.MenuType !== 'billPrint' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title={'该组件如果受其他组件控制,请选项相应的组件,没有时选“无”。'}> |
| | | <Icon type="question-circle" /> |
| | |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('supModule', { |
| | | initialValue: setting.supModule || [], |
| | | initialValue: supModule, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <Cascader options={modules} expandTrigger="hover" placeholder="" /> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | {!config.pageable ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title={'初始化加载时,是否与其他组件一同加载数据,注:仅在使用系统函数,且初始化加载数据时有效,分页请求时无效。'}> |
| | | <Icon type="question-circle" /> |
| | | 同步查询 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('sync', { |
| | | initialValue: setting.sync || 'true' |
| | | })( |
| | | <Radio.Group> |
| | | <Radio value="true">是</Radio> |
| | | <Radio value="false">否</Radio> |
| | | </Radio.Group> |
| | | <Cascader options={modules} onChange={this.changeSupModule} expandTrigger="hover" placeholder="" /> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {config.pageable ? <Col span={8}> |
| | | {menu.MenuType !== 'billPrint' && config.pageable ? <Col span={8}> |
| | | <Form.Item label="分页"> |
| | | {getFieldDecorator('laypage', { |
| | | initialValue: setting.laypage || 'false' |
| | | initialValue: setting.laypage || 'true' |
| | | })( |
| | | <Radio.Group> |
| | | <Radio.Group onChange={(e) => this.setState({laypage: e.target.value})}> |
| | | <Radio value="true">是</Radio> |
| | | <Radio value="false">否</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {config.pageable ? <Col span={8}> |
| | | {menu.MenuType !== 'billPrint' && config.pageable && laypage !== 'false' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="选择分页时有效。"> |
| | | <Icon type="question-circle" /> |
| | |
| | | })(<InputNumber min={1} max={500} precision={0} />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={8}> |
| | | {/* 1、不分页且不存在上级模块 2、打印时 */} |
| | | {((!config.pageable || (config.pageable && laypage === 'false')) && (!supModule || supModule.length === 0 || supModule[0] === 'empty')) || menu.MenuType === 'billPrint' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title={'初始化加载时,是否与其他组件一同加载数据,注:仅在使用系统函数,且初始化加载数据时有效,分页请求时无效。'}> |
| | | <Icon type="question-circle" /> |
| | | 同步查询 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('sync', { |
| | | initialValue: setting.sync || 'true' |
| | | })( |
| | | <Radio.Group> |
| | | <Radio value="true">是</Radio> |
| | | <Radio value="false">否</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {menu.MenuType !== 'billPrint' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title={'优先使用同级的搜索条件组件,同级搜索不存在时,依次向上选取,与当前组件的搜索条件一同用作数据过滤(当前组件的搜索条件优先)。'}> |
| | | <Icon type="question-circle" /> |
| | |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | {useMSearch === 'true' ? <Col span={8}> |
| | | </Col> : null} |
| | | {menu.MenuType !== 'billPrint' && useMSearch === 'true' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title={'外层搜索条件改变时,是否刷新当前组件数据。'}> |
| | | <Icon type="question-circle" /> |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={8}> |
| | | {menu.MenuType !== 'billPrint' ? <Col span={8}> |
| | | <Form.Item label="初始化数据"> |
| | | {getFieldDecorator('onload', { |
| | | initialValue: setting.onload || 'true' |
| | |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | </Col> : null} |
| | | </Row> |
| | | </Form> |
| | | </div> |