king
2023-07-25 2a3cc4e6cecfc6dab8b60adf93f7fde898ddc939
src/views/pcdesign/menuform/index.jsx
@@ -16,42 +16,16 @@
  state = {}
  // 一二级菜单切换
  selectChange = (key, value) => {
    const { config } = this.props
    if (key === 'cacheUseful') {
      this.props.updateConfig({...config, cacheUseful: value})
    } else if (key === 'timeUnit') {
      this.props.updateConfig({...config, timeUnit: value})
    } else if (key === 'mask') {
      this.props.updateConfig({...config, mask: value})
    } else if (key === 'cacheLocal') {
      this.props.updateConfig({...config, cacheLocal: value})
    // } else if (key === 'permission') {
    //   this.props.updateConfig({...config, permission: value})
    if (key === 'cacheTime' || key === 'localCacheTime') {
      if (typeof(value) !== 'number') {
        value = ''
      }
    }
  }
  // 菜单名称
  changeName = (e) => {
    this.props.updateConfig({...this.props.config, MenuName: e.target.value})
  }
  // 菜单参数
  changeNo = (e) => {
    this.props.updateConfig({...this.props.config, MenuNo: e.target.value})
  }
  changeRemark = (e) => {
    this.props.updateConfig({...this.props.config, Remark: e.target.value})
  }
  changeCacheDay = (val) => {
    if (typeof(val) !== 'number') {
      val = ''
    }
    this.props.updateConfig({...this.props.config, cacheTime: val})
    this.props.updateConfig({...config, [key]: value})
  }
  render() {
@@ -81,7 +55,7 @@
                    message: '请输入菜单名称!'
                  }
                ]
              })(<Input placeholder="" autoComplete="off" onChange={this.changeName}/>)}
              })(<Input placeholder="" autoComplete="off" onChange={(e) => {this.selectChange('MenuName', e.target.value)}}/>)}
            </Form.Item>
          </Col>
          <Col span={24}>
@@ -94,7 +68,7 @@
                    message: '请输入菜单参数!'
                  }
                ]
              })(<Input placeholder="" autoComplete="off" onChange={this.changeNo}/>)}
              })(<Input placeholder="" autoComplete="off" onChange={(e) => {this.selectChange('MenuNo', e.target.value)}}/>)}
            </Form.Item>
          </Col>
          <Col span={24}>
@@ -114,6 +88,20 @@
              )}
            </Form.Item>
          </Col>
          {config.cacheLocal === 'true' ? <Col span={24}>
            <Form.Item label={
              <Tooltip placement="topLeft" title="设置本地缓存时长后,在缓存期限内不向后台请求数据,时长最大为5天(即7200分钟)。注:时长为空时缓存数据只用于页面快速呈现,不影响接口请求。">
                <QuestionCircleOutlined className="mk-form-tip" />
                时长(分)
              </Tooltip>
            }>
              {getFieldDecorator('localCacheTime', {
                initialValue: config.localCacheTime
              })(
                <InputNumber min={1} max={7200} precision={0} onChange={(val) => {this.selectChange('localCacheTime', val)}}/>
              )}
            </Form.Item>
          </Col> : null}
          <Col span={24}>
            <Form.Item label={
              <Tooltip placement="topLeft" title="对于不经常性变动的信息,缓存数据有助于提高查询效率。">
@@ -206,7 +194,7 @@
                  }
                ]
              })(
                <InputNumber min={1} max={config.timeUnit === 'day' ? 7 : (config.timeUnit === 'hour' ? 23 : 59)} precision={0} onChange={this.changeCacheDay}/>
                <InputNumber min={1} max={config.timeUnit === 'day' ? 7 : (config.timeUnit === 'hour' ? 23 : 59)} precision={0} onChange={(val) => {this.selectChange('cacheTime', val)}}/>
              )}
            </Form.Item>
          </Col> : null}
@@ -220,7 +208,7 @@
                    message: '备注最多512个字符!'
                  }
                ]
              })(<TextArea rows={2} placeholder={''} onChange={this.changeRemark} />)}
              })(<TextArea rows={2} placeholder={''} onChange={(e) => {this.selectChange('Remark', e.target.value)}}/>)}
            </Form.Item>
          </Col>
        </Row>