| | |
| | | |
| | | class CustomMenuForm extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | config: PropTypes.object, |
| | | MenuId: PropTypes.string, |
| | | adapters: PropTypes.array, |
| | |
| | | |
| | | // 一二级菜单切换 |
| | | selectChange = (key, value, hex) => { |
| | | if (key === 'cacheTime' || key === 'localCacheTime') { |
| | | if (typeof(value) !== 'number') { |
| | | value = '' |
| | | } |
| | | } |
| | | |
| | | let _config = {...this.props.config, [key]: value} |
| | | |
| | | if (key === 'statusBarbgColor' && hex) { |
| | | _config.statusBarHexColor = hex |
| | | if (key === 'statusBarbgColor') { // 小程序状态栏 |
| | | if (hex) { |
| | | _config.statusBarHexColor = hex |
| | | } else { |
| | | delete _config.statusBarHexColor |
| | | } |
| | | } |
| | | |
| | | this.props.updateConfig(_config) |
| | | // if (key === 'cacheUseful') { |
| | | // this.props.updateConfig({...config, cacheUseful: value}) |
| | | // } else if (key === 'timeUnit') { |
| | | // this.props.updateConfig({...config, timeUnit: value}) |
| | | // } else if (key === 'advertUrl') { |
| | | // this.props.updateConfig({...config, advertUrl: value}) |
| | | // } else if (key === 'advertTime') { |
| | | // this.props.updateConfig({...config, advertTime: value}) |
| | | // } else if (key === 'pullRefresh') { |
| | | // this.props.updateConfig({...config, pullRefresh: value}) |
| | | // } else if (key === 'statusBarbgColor') { |
| | | // this.props.updateConfig({...config, statusBarbgColor: value}) |
| | | // } else if (key === 'permission') { |
| | | // this.props.updateConfig({...config, permission: value}) |
| | | // } else if (key === 'share') { |
| | | // this.props.updateConfig({...config, share: 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}) |
| | | } |
| | | |
| | | render() { |
| | | const { dict, config, adapters } = this.props |
| | | const { config, adapters } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const formItemLayout = { |
| | | labelCol: { |
| | |
| | | <Form {...formItemLayout} className="custom-menu-form"> |
| | | <Row> |
| | | <Col span={24}> |
| | | <Form.Item label={dict['mob.menu'] + dict['mob.name']}> |
| | | <Form.Item label="菜单名称"> |
| | | {getFieldDecorator('MenuName', { |
| | | initialValue: config.MenuName, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: dict['mob.required.input'] + dict['mob.menu'] + dict['mob.name'] + '!' |
| | | 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}> |
| | | <Form.Item label={dict['mob.menu'] + dict['mob.param']}> |
| | | <Form.Item label="菜单参数"> |
| | | {getFieldDecorator('MenuNo', { |
| | | initialValue: config.MenuNo, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: dict['mob.required.input'] + dict['mob.menu'] + dict['mob.param'] + '!' |
| | | 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}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="数据会缓存到用户本地,方便页面快速呈现。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 本地缓存 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('cacheLocal', { |
| | | initialValue: config.cacheLocal || 'false' |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.selectChange('cacheLocal', e.target.value)}}> |
| | | <Radio value="true">使用</Radio> |
| | | <Radio value="false">不使用</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </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="对于不经常性变动的信息,缓存数据有助于提高查询效率。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 缓存数据 |
| | | 后端缓存 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('cacheUseful', { |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | | {/* <Col span={24}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="跳过权限验证时,页面中组件及按钮不在进行权限控制。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | </Col> */} |
| | | <Col span={24}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="使用登录验证后,用户必须登录系统后才可以访问,注:含有登录组件的页面中无效。"> |
| | |
| | | {getFieldDecorator('timeUnit', { |
| | | initialValue: config.timeUnit || 'day' |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> |
| | | <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> |
| | | <Radio value="day">天</Radio> |
| | | <Radio value="hour">小时</Radio> |
| | | <Radio value="minute">分钟</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: dict['mob.required.input'] + '时长!' |
| | | message: '请输入时长!' |
| | | } |
| | | ] |
| | | })( |
| | | <InputNumber min={1} max={config.timeUnit !== 'hour' ? 7 : 23} 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} |
| | |
| | | <Radio.Group onChange={(e) => {this.selectChange('pullRefresh', e.target.value)}}> |
| | | <Radio value="false">关闭</Radio> |
| | | <Radio value="true">开启</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | | <Form.Item label="屏幕方向"> |
| | | {getFieldDecorator('direction', { |
| | | initialValue: config.direction || 'vertical' |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.selectChange('direction', e.target.value)}}> |
| | | <Radio value="vertical">竖屏</Radio> |
| | | <Radio value="horizontal">横屏</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: dict['mob.required.input'] + '停留时间!' |
| | | message: '请输入停留时间!' |
| | | } |
| | | ] |
| | | })( |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={24}> |
| | | <Col span={24} className="red-font"> |
| | | <Form.Item label="备注"> |
| | | {getFieldDecorator('Remark', { |
| | | initialValue: config.Remark || '', |
| | |
| | | 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> |