king
2020-12-31 eebe63a6727e6495321d1433ebd2779b5a36d45a
src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx
@@ -11,10 +11,9 @@
class SettingForm extends Component {
  static propTpyes = {
    type: PropTypes.string,       // 菜单类型,main或subtable
    config: PropTypes.object,     // 页面配置
    dict: PropTypes.object,       // 字典项
    menu: PropTypes.object,       // 菜单信息
    permFuncField: PropTypes.any, // 存储过程可用开始字符
    setting: PropTypes.object,    // 数据源配置
    columns: PropTypes.array,     // 列设置
    scripts: PropTypes.array,     // 自定义脚本
@@ -27,14 +26,25 @@
  }
  UNSAFE_componentWillMount () {
    const { setting, permFuncField } = this.props
    const { setting } = this.props
    let usefulFields = sessionStorage.getItem('permFuncField')
    if (usefulFields) {
      try {
        usefulFields = JSON.parse(usefulFields)
      } catch {
        usefulFields = []
      }
    } else {
      usefulFields = []
    }
    let tooltip = null
    let rules = []
    if (permFuncField && permFuncField.length > 0) {
      tooltip = '开头可用字符:' + permFuncField.join(', ')
      let str = '^(' + permFuncField.join('|') + ')'
    if (usefulFields.length > 0) {
      tooltip = '开头可用字符:' + usefulFields.join(', ')
      let str = '^(' + usefulFields.join('|') + ')'
      let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g')
      rules.push({
@@ -164,7 +174,7 @@
  }
  render() {
    const { setting, dict, menu, type, columns } = this.props
    const { setting, dict, menu, config, columns } = this.props
    const { getFieldDecorator } = this.props.form
    const { interType, funcRules, funcTooltip } = this.state
@@ -390,7 +400,7 @@
                </Radio.Group>)}
              </Form.Item>
            </Col>
            {type === 'main' ? <Col span={12}>
            {config.Template === 'CommonTable' ? <Col span={12}>
              <Form.Item label="按钮固定">
                {getFieldDecorator('actionfixed', {
                  initialValue: setting.actionfixed === 'true' || setting.actionfixed === true ? 'true' : 'false'
@@ -401,8 +411,13 @@
                </Radio.Group>)}
              </Form.Item>
            </Col> : null}
            {type === 'main' ? <Col span={12}>
              <Form.Item label="表头固定">
            {config.Template === 'CommonTable' ? <Col span={12}>
              <Form.Item label={
                <Tooltip placement="topLeft" title={'含有合并列或表格出现横向滚动时会显示异常,请慎用!'}>
                  <Icon type="question-circle" />
                  表头固定
                </Tooltip>
              }>
                {getFieldDecorator('columnfixed', {
                  initialValue: setting.columnfixed === 'true' || setting.columnfixed === true ? 'true' : 'false'
                })(
@@ -412,6 +427,35 @@
                </Radio.Group>)}
              </Form.Item>
            </Col> : null}
            <Col span={12}>
              <Form.Item label="边框">
                {getFieldDecorator('bordered', {
                  initialValue: setting.bordered || 'true'
                })(
                <Radio.Group>
                  <Radio value="true">有</Radio>
                  <Radio value="false">无</Radio>
                </Radio.Group>)}
              </Form.Item>
            </Col>
            <Col span={12}>
              <Form.Item label={
                <Tooltip placement="topLeft" title="双击表格中行,触发的按钮。">
                  <Icon type="question-circle" />
                  双击事件
                </Tooltip>
              }>
                {getFieldDecorator('doubleClick', {
                  initialValue: setting.doubleClick || ''
                })(
                  <Select allowClear>
                    {config.action.map(option =>
                      <Select.Option key={option.uuid} value={option.uuid}>{option.label}</Select.Option>
                    )}
                  </Select>
                )}
              </Form.Item>
            </Col>
          </Row>
        </Form>
      </div>