| | |
| | | } |
| | | |
| | | state = { |
| | | dict: (!localStorage.getItem('lang') || localStorage.getItem('lang') === 'zh-CN') ? zhCN : enUS, |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | tabgroups: [], // 标签组 |
| | | card: [], // 编辑标签 |
| | | group: [], // 编辑组 |
| | |
| | | if (group.uuid === _group.uuid) { |
| | | isuptab = false |
| | | group.sublist.forEach(tab => { // 可关联的同级标签 |
| | | if (tab.level) { |
| | | if (tab.level || tab.level === 0) { |
| | | levels[tab.uuid] = tab.level |
| | | } |
| | | |
| | |
| | | }) |
| | | } else if (isuptab) { |
| | | group.sublist.forEach(tab => { |
| | | if (tab.level) { |
| | | if (tab.level || tab.level === 0) { |
| | | levels[tab.uuid] = tab.level |
| | | } |
| | | |
| | |
| | | |
| | | confirm({ |
| | | content: `确定删除<<${card.label}>>吗?`, |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | onOk() { |
| | | tabgroups = tabgroups.map(_group => { |
| | | if (_group.uuid === group.uuid) { |
| | |
| | | _this.setState({ |
| | | tabgroups: tabgroups |
| | | }, () => { |
| | | _this.props.updatetabs({...config, tabgroups: tabgroups}, [card]) |
| | | _this.props.updatetabs({...config, tabgroups: tabgroups}) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | |
| | | confirm({ |
| | | content: `确定新建标签组吗?`, |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | onOk() { |
| | | if (_tabgroups.length === 1) { |
| | | _tabgroups.forEach(group => { |
| | |
| | | |
| | | confirm({ |
| | | content: `确定删除标签组吗?`, |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | onOk() { |
| | | _tabgroups = _tabgroups.filter(_group => _group.uuid !== group.uuid) |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新 |
| | | */ |
| | |
| | | handleMenu={(card) => this.handleTab(card, group)} |
| | | deleteMenu={(card) => this.deleteElement(card, group)} |
| | | doubleClickCard={this.props.setSubConfig} |
| | | placeholder={this.state.dict['header.form.tab.placeholder']} |
| | | placeholder={dict['form.required.add'] + dict['model.form.tab']} |
| | | /> |
| | | </div>) |
| | | })} |
| | | {/* 标签编辑 */} |
| | | <Modal |
| | | title={this.state.dict['header.modal.tabs.edit']} |
| | | title={dict['header.modal.tabs.edit']} |
| | | visible={visible} |
| | | width={750} |
| | | maskClosable={false} |
| | |
| | | destroyOnClose |
| | | > |
| | | <TabForm |
| | | dict={this.state.dict} |
| | | dict={dict} |
| | | card={this.state.card} |
| | | tabs={this.props.tabs} |
| | | levels={this.state.levels} |