| | |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | |
| | | import Api from '@/api' |
| | | import options from '@/store/options.js' |
| | | // import './index.scss' |
| | | |
| | | class CustomMenuForm extends Component { |
| | |
| | | updateConfig: PropTypes.func |
| | | } |
| | | |
| | | state = { |
| | | menulist: [] |
| | | } |
| | | state = {} |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | let _param = {func: 's_get_pc_menus', systemType: options.sysType, debug: 'Y'} |
| | | _param.pro_sys = window.GLOB.systemType === 'production' ? 'Y' : '' |
| | | if (sessionStorage.getItem('thdMenuList') && sessionStorage.getItem('fstMenuList')) { |
| | | |
| | | Api.getSystemConfig(_param).then(result => { |
| | | } else { |
| | | this.getMenus() |
| | | } |
| | | } |
| | | |
| | | getMenus = () => { |
| | | Api.getCloudConfig({func: 's_get_pc_menus', systemType: window.GLOB.sysType, debug: 'Y'}).then(result => { |
| | | if (result.status) { |
| | | let thdMenuList = [] |
| | | let menulist = result.fst_menu.map(fst => { |
| | |
| | | EasyCode: trd.EasyCode, |
| | | value: trd.MenuID, |
| | | label: trd.MenuName, |
| | | type: 'CommonTable', |
| | | type: 'CustomPage', |
| | | disabled: false |
| | | } |
| | | |
| | | if (trd.PageParam) { |
| | | try { |
| | | trd.PageParam = JSON.parse(trd.PageParam) |
| | | trdItem.type = trd.PageParam.Template || 'CommonTable' |
| | | trdItem.type = trd.PageParam.Template || 'CustomPage' |
| | | } catch (e) { |
| | | |
| | | } |
| | |
| | | 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}) |
| | | if (key === 'cacheTime' || key === 'localCacheTime') { |
| | | if (typeof(value) !== 'number') { |
| | | value = '' |
| | | } |
| | | } |
| | | } |
| | | |
| | | changeCacheDay = (val) => { |
| | | if (typeof(val) !== 'number') { |
| | | val = '' |
| | | } |
| | | this.props.updateConfig({...this.props.config, cacheTime: val}) |
| | | |
| | | this.props.updateConfig({...config, [key]: value}) |
| | | } |
| | | |
| | | render() { |
| | |
| | | <Row> |
| | | <Col span={24}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="首页不进行权限控制。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 权限验证 |
| | | </Tooltip> |
| | | }> |
| | | <Radio.Group value={'false'} disabled={true}> |
| | | <Radio value="true">使用</Radio> |
| | | <Radio value="false">不使用</Radio> |
| | | </Radio.Group> |
| | | </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', { |
| | |
| | | {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> |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <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} |
| | | <Col span={24}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="数据加载时的遮罩是否显示。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 加载遮罩 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('mask', { |
| | | initialValue: config.mask || 'true' |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.selectChange('mask', e.target.value)}}> |
| | | <Radio value="true">显示</Radio> |
| | | <Radio value="false">隐藏</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | </Form> |
| | | ) |