| | |
| | | }) |
| | | } |
| | | |
| | | // _config.tabs = _config.tabs || [] |
| | | // _config.tabgroups = _config.tabgroups || ['tabs'] |
| | | // _config.setting.subtabs = _config.setting.subtabs || [] |
| | | _config.tabs = _config.tabs || [] |
| | | _config.tabgroups = _config.tabgroups || ['tabs'] |
| | | _config.setting.subtabs = _config.setting.subtabs || [] |
| | | |
| | | this.setState({ |
| | | originActions: _oriActions, |
| | | config: _config, |
| | | originActions: _oriActions, |
| | | originMenu: JSON.parse(JSON.stringify(menu)), |
| | | selectedTables: _config.tables || [], |
| | | menuformlist: [ |
| | |
| | | key: 'field', |
| | | label: this.state.dict['header.form.field'], |
| | | initVal: card.field, |
| | | tooltip: '字段名可以使用逗号分隔,进行多字段综合搜索,注:综合搜索仅在文本类型时有效', |
| | | tooltipClass: 'middle', |
| | | required: true, |
| | | rules: [{ |
| | | pattern: /^[\u4E00-\u9FA50-9a-zA-Z,_]*$/ig, |
| | | message: '字段名只允许包含数字、字母、汉字以及_' |
| | | }, { |
| | | max: 50, |
| | | message: '字段名最多50个字符!' |
| | | }], |
| | | readonly: false |
| | | }, |
| | | { |
| | |
| | | }, { |
| | | value: 'select', |
| | | text: this.state.dict['header.form.select'] |
| | | }, { |
| | | value: 'multiselect', |
| | | text: this.state.dict['header.form.multiselect'] |
| | | }, { |
| | | value: 'link', |
| | | text: this.state.dict['header.form.link'] |
| | |
| | | label: this.state.dict['header.form.field'], |
| | | initVal: card.field, |
| | | required: true, |
| | | rules: [{ |
| | | pattern: /^[\u4E00-\u9FA50-9a-zA-Z_]*$/ig, |
| | | message: '字段名只允许包含数字、字母、汉字以及_' |
| | | }, { |
| | | max: 50, |
| | | message: '字段名最多50个字符!' |
| | | }], |
| | | readonly: false |
| | | }, |
| | | { |
| | |
| | | |
| | | if (res.type === 'search') { |
| | | if ((res.values.type === 'select' || res.values.type === 'link') && res.values.resourceType === '1') { |
| | | let sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ' from ' + res.values.dataSource |
| | | let _datasource = res.values.dataSource |
| | | |
| | | if (/\s/.test(_datasource)) { |
| | | _datasource = '(' + _datasource + ') tb' |
| | | } |
| | | |
| | | let sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ' from ' + _datasource |
| | | if (res.values.type === 'link') { |
| | | sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ',' + res.values.linkField + ' from ' + res.values.dataSource |
| | | sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ',' + res.values.linkField + ' from ' + _datasource |
| | | } |
| | | if (res.values.orderBy) { |
| | | sql = sql + ' order by ' + res.values.orderBy + ' ' + res.values.orderType |
| | |
| | | cancelText: this.state.dict['header.cancel'], |
| | | onOk() { |
| | | let _config = JSON.parse(JSON.stringify(_this.state.config)) |
| | | |
| | | if (element.type === 'tabs') { |
| | | _config[element.card.groupId] = _config[element.card.groupId].filter(item => { |
| | | if (item.uuid === element.card.uuid) { |
| | | return false |
| | | } else { |
| | | return true |
| | | } |
| | | }) |
| | | } else { |
| | | _config[element.type] = _config[element.type].filter(item => { |
| | | if (item.uuid === element.card.uuid) { |
| | | return false |
| | |
| | | return true |
| | | } |
| | | }) |
| | | } |
| | | |
| | | let refreshtype = element.type + 'loading' |
| | | |
| | |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } |
| | | |
| | | profileAction = (element) => { |
| | | console.log(element) |
| | | } |
| | | |
| | | changeTemplate = () => { |
| | |
| | | let _LongParam = '' |
| | | let _config = {...config, tables: this.state.selectedTables} |
| | | let _pageParam = {...menu.PageParam, OpenType: res.opentype} |
| | | |
| | | // 未设置数据源或标签不合法时,启用状态为false |
| | | if (_config.setting.interType === 'inner' && !_config.setting.innerFunc && !_config.setting.dataresource) { |
| | | _config.enabled = false |
| | | } else if (_config.tabgroups.length > 1) { |
| | | _config.tabgroups.forEach(group => { |
| | | if (_config[group].length === 0) { |
| | | _config.enabled = false |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 保存时删除配置类型,system 、user |
| | | delete _config.type |
| | |
| | | } |
| | | } |
| | | |
| | | onEnabledChange = () => { |
| | | onEnabledChange = (val, e) => { |
| | | const { config } = this.state |
| | | |
| | | let tabinvalid = true |
| | | if (config.tabgroups.length > 1) { |
| | | config.tabgroups.forEach(group => { |
| | | if (config[group].length === 0) { |
| | | tabinvalid = false |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (config.setting.interType === 'inner' && !config.setting.innerFunc && !config.setting.dataresource) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单尚未设置数据源,不可启用!', |
| | | duration: 10 |
| | | }) |
| | | } else if (!tabinvalid) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单标签页设置错误(多行标签内,行标签不可为空),不可启用!', |
| | | duration: 10 |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | config: {...config, enabled: !config.enabled} |
| | | }) |
| | | } |
| | | } |
| | | |
| | | onColumnNameChange = () => { |
| | |
| | | const configAction = this.state.config.action.filter(_action => |
| | | !_action.origin && (_action.OpenType === 'pop' || _action.OpenType === 'popview' || _action.OpenType === 'blank' || _action.OpenType === 'tab') |
| | | ) |
| | | |
| | | let configTabs = [] |
| | | this.state.config.tabgroups.forEach(group => { |
| | | configTabs.push(...this.state.config[group]) |
| | | }) |
| | | |
| | | return ( |
| | | <div className="common-table-board"> |
| | |
| | | <Button |
| | | icon={item.icon} |
| | | style={{marginBottom: '10px'}} |
| | | className={'mk-btn mk-' + item.class} |
| | | className={'config-button mk-btn mk-' + item.class} |
| | | onClick={() => this.setSubConfig(item, 'button')} |
| | | >{item.label}</Button> |
| | | </div> |
| | |
| | | return (<SourceElement key={index} content={item}/>) |
| | | })} |
| | | </div> |
| | | {this.state.config.tabs.length > 0 ? |
| | | {configTabs.length > 0 ? |
| | | <p className="config-btn-title"> |
| | | <Tooltip placement="topLeft" title="点击按钮,可完成或查看标签配置信息。"> |
| | | <Icon type="question-circle" /> |
| | |
| | | {this.state.dict['header.menu.tab.configurable']} |
| | | </p> : null |
| | | } |
| | | {this.state.config.tabs.map((item, index) => { |
| | | {configTabs.map((item, index) => { |
| | | return ( |
| | | <div key={index}> |
| | | <Button |
| | | className="config-button" |
| | | icon={item.icon} |
| | | style={{marginBottom: '10px'}} |
| | | onClick={() => this.setSubConfig(item, 'tab')} |
| | |
| | | <div className="setting"> |
| | | <Card title={this.state.dict['header.menu.page.configurable']} bordered={false} extra={ |
| | | <div> |
| | | <Switch className="big" checkedChildren="启" unCheckedChildren="停" defaultChecked={this.state.config.enabled} onChange={this.onEnabledChange} /> |
| | | <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> |
| | | <Button type="primary" onClick={this.changeTemplate}>{this.state.dict['header.menu.template.change']}</Button> |
| | | <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['header.save']}</Button> |
| | | <Button onClick={this.cancelConfig}>{this.state.dict['header.return']}</Button> |
| | |
| | | handleMenu={this.handleAction} |
| | | copyElement={(val) => this.handleAction(val, 'copy')} |
| | | deleteMenu={this.deleteElement} |
| | | profileMenu={this.profileAction} |
| | | placeholder={this.state.dict['header.form.action.placeholder']} |
| | | /> : null |
| | | } |