| | |
| | | |
| | | import { formRule } from '@/utils/option.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import MenuUtils from '@/utils/utils-custom.js' |
| | | import CodeMirror from '@/templates/zshare/codemirror' |
| | | import './index.scss' |
| | | |
| | |
| | | UNSAFE_componentWillMount () { |
| | | const { menu, config } = this.props |
| | | |
| | | let modules = this.getModules(menu.components, config.uuid) |
| | | let modules = MenuUtils.getSupModules(menu.components, config.uuid) |
| | | if (!modules) { |
| | | modules = [] |
| | | } |
| | |
| | | } |
| | | |
| | | this.setState({modules, usefulFields}) |
| | | } |
| | | |
| | | getModules = (components, selfId) => { |
| | | let modules = components.map(item => { |
| | | if (item.uuid === selfId) { |
| | | return { |
| | | children: null |
| | | } |
| | | } else if (item.switchable) { |
| | | return { |
| | | value: item.uuid, |
| | | label: item.name |
| | | } |
| | | } else if (item.type === 'tabs') { |
| | | let _item = { |
| | | value: item.uuid, |
| | | label: item.name, |
| | | children: item.subtabs.map(f_tab => { |
| | | let subItem = { |
| | | value: f_tab.uuid, |
| | | label: f_tab.label, |
| | | children: this.getModules(f_tab.components, selfId) |
| | | } |
| | | |
| | | if (!subItem.children || subItem.children.length === 0) { |
| | | return {children: null} |
| | | } |
| | | return subItem |
| | | }) |
| | | } |
| | | |
| | | _item.children = _item.children.filter(t => t.children !== null) |
| | | |
| | | if (_item.children.length === 0) { |
| | | return {children: null} |
| | | } |
| | | |
| | | return _item |
| | | } else { |
| | | return { |
| | | children: null |
| | | } |
| | | } |
| | | }) |
| | | |
| | | modules = modules.filter(mod => mod.children !== null) |
| | | |
| | | if (modules.length === 0) { |
| | | return null |
| | | } |
| | | return modules |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + '表名!' |
| | | }, |
| | | { |
| | | max: 50, |
| | | message: '表名最长为50个字符!' |
| | | } |
| | | ] |
| | | })(<Input placeholder={''} autoComplete="off" />)} |
| | | </Form.Item> |
| | |
| | | {config.format === 'array' ? <Col span={8}> |
| | | <Form.Item label="默认排序"> |
| | | {getFieldDecorator('order', { |
| | | initialValue: setting.order || '', |
| | | initialValue: setting.order || 'ID desc', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title={'该组件如果受其他组件控制,请选项相应的组件,没有时选“无”。'}> |
| | | <Icon type="question-circle" /> |
| | | 上级模块 |
| | | 上级组件 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('supModule', { |
| | |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.select'] + '上级模块!' |
| | | message: this.props.dict['form.required.select'] + '上级组件!' |
| | | } |
| | | ] |
| | | })( |
| | |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title={'优先使用同级的搜索条件组件,同级搜索不存在时,依次向上选取,与当前组件的搜索条件一同用作数据过滤(当前组件的搜索条件优先)。'}> |
| | | <Icon type="question-circle" /> |
| | | 外层搜索 |
| | | 外部搜索 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('useMSearch', { |
| | | initialValue: setting.useMSearch || 'false' |
| | | initialValue: setting.useMSearch || 'true' |
| | | })( |
| | | <Radio.Group onChange={(e) => this.setState({useMSearch: e.target.value})}> |
| | | <Radio value="true">使用</Radio> |