From 29c5821ce140e89a8b35e53f41672dd86da56982 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 18 二月 2020 18:43:38 +0800 Subject: [PATCH] 2020-02-18 --- src/templates/formtabconfig/index.jsx | 72 +++++++++++++++++++----------------- 1 files changed, 38 insertions(+), 34 deletions(-) diff --git a/src/templates/formtabconfig/index.jsx b/src/templates/formtabconfig/index.jsx index e2b0def..14f1533 100644 --- a/src/templates/formtabconfig/index.jsx +++ b/src/templates/formtabconfig/index.jsx @@ -374,42 +374,38 @@ handleTab = (card) => { const { config } = this.state - let index = 0 // 绛涢�変笅涓�缁� + let menus = [{value: 'mainTable', text: '涓绘暟鎹�'}] + let equalTabs = [] + let supMenu = card.supMenu || '' + let equalTab = card.equalTab || [] + let isuptab = true + let equalTabIds = [] + config.tabgroups.forEach((groupId, i) => { if (groupId === card.groupId) { - index = i + isuptab = false + config[card.groupId].forEach(tab => { // 鍙叧鑱旂殑鍚岀骇鏍囩 + if (tab.uuid === card.uuid) return + + equalTabIds.push(tab.uuid) + equalTabs.push(tab) + }) + } else if (isuptab) { + config[groupId].forEach(tab => { + menus.push({ + value: tab.uuid, + text: tab.label + }) + }) } }) - let menus = [] - let subtabs = card.subtabs || [] - let nextTabId = config.tabgroups[index + 1] + if (supMenu && menus.filter(menu => menu.value === supMenu).length === 0) { + supMenu = '' + } - if (nextTabId) { - let _tabMap = new Map() - let _usedTabMap = new Map() - - config[nextTabId].forEach(tab => { // 涓嬬骇鎵�鏈夌殑鏍囩 - menus.push(tab) - _tabMap.set(tab.uuid, true) - }) - - config[card.groupId].forEach(tab => { // 鍚岀骇鏍囩宸查�夌殑涓嬬骇鏍囩 - if (tab.uuid === card.uuid) return - - tab.subtabs.forEach(subtab => { - _usedTabMap.set(subtab, true) - }) - }) - - config.setting.subtabs.forEach(subtab => { // 涓昏〃宸查�夌殑涓嬬骇鏍囩 - _usedTabMap.set(subtab, true) - }) - - subtabs = subtabs.filter(tab => _tabMap.has(tab.uuid) && !_usedTabMap.has(tab.uuid)) - menus = menus.filter(tab => !_usedTabMap.has(tab.uuid)) - } else { - subtabs = [] + if (equalTab.length > 0) { + equalTab = equalTab.filter(tabId => equalTabIds.includes(tabId)) } this.setState({ @@ -466,12 +462,20 @@ }] }, { - type: 'mutilselect', - key: 'subtabs', - label: '涓嬬骇鏍囩', - initVal: subtabs, + type: 'select', + key: 'supMenu', + label: this.state.dict['header.form.supTab'], + initVal: supMenu, required: false, options: menus + }, + { + type: 'mutilselect', + key: 'equalTab', + label: this.state.dict['header.form.equalTab'], + initVal: equalTab, + required: false, + options: equalTabs } ] }) -- Gitblit v1.8.0