| | |
| | | import EditCard from '@/templates/tableshare/editcard' |
| | | import VerifyCard from '@/templates/tableshare/verifycard' |
| | | import VerifyCardExcelIn from '@/templates/tableshare/verifycardexcelin' |
| | | import VerifyCardExcelOut from '@/templates/tableshare/verifycardexcelout' |
| | | import MenuForm from '@/templates/tableshare/menuform' |
| | | import TabDragElement from '@/templates/tableshare/tabdragelement' |
| | | import SourceElement from '@/templates/tableshare/dragelement/source' |
| | |
| | | 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 (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(tabId => _tabMap.has(tabId) && !_usedTabMap.has(tabId)) |
| | | menus = menus.filter(tab => !_usedTabMap.has(tab.uuid)) |
| | | } else { |
| | | subtabs = [] |
| | | if (supMenu && menus.filter(menu => menu.value === supMenu).length === 0) { |
| | | supMenu = '' |
| | | } |
| | | |
| | | if (equalTab.length > 0) { |
| | | equalTab = equalTab.filter(tabId => equalTabIds.includes(tabId)) |
| | | } |
| | | |
| | | |
| | | this.setState({ |
| | | modaltype: 'tabs', |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'mutilselect', |
| | | key: 'subtabs', |
| | | label: this.state.dict['header.form.subTab'], |
| | | 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 |
| | | } |
| | | ] |
| | | }) |
| | |
| | | }) |
| | | resolve(false) |
| | | } |
| | | } else if (btn.OpenType === 'excelOut') { |
| | | let _param = { |
| | | innerFunc: btn.innerFunc |
| | | } |
| | | |
| | | newLText = Utils.formatOptions(Utils.getTableFunc(_param, menu, config )) |
| | | DelText = Utils.formatOptions(Utils.dropfunc(btn.innerFunc)) |
| | | resolve(true) |
| | | } else { |
| | | let _param = { |
| | | funcName: btn.innerFunc, |
| | |
| | | const { card } = this.state |
| | | let config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | if (card.OpenType !== 'excelIn') { |
| | | if (card.OpenType === 'excelIn') { |
| | | this.verifyRef.handleConfirm().then(res => { |
| | | |
| | | config.action = config.action.map(item => { |
| | | if (item.uuid === card.uuid) { |
| | | item.verify = res |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | profileVisible: false, |
| | | config: config, |
| | | card: '', |
| | | }) |
| | | }) |
| | | } else { |
| | | let _verify = this.verifyRef.state.verify |
| | | |
| | | if (_verify.default === 'false' && _verify.scripts.length === 0) { |
| | | if (card.OpenType !== 'excelOut' && _verify.default === 'false' && _verify.scripts.length === 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '不执行默认sql时,必须设置自定义脚本!', |
| | |
| | | profileVisible: false, |
| | | config: config, |
| | | card: '', |
| | | }) |
| | | } else if (card.OpenType === 'excelIn') { |
| | | this.verifyRef.handleConfirm().then(res => { |
| | | |
| | | config.action = config.action.map(item => { |
| | | if (item.uuid === card.uuid) { |
| | | item.verify = res |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | profileVisible: false, |
| | | config: config, |
| | | card: '', |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | |
| | | onCancel={() => { this.setState({ profileVisible: false }) }} |
| | | destroyOnClose |
| | | > |
| | | {this.state.card && this.state.card.OpenType !== 'excelIn' ? |
| | | {this.state.card && this.state.card.OpenType !== 'excelIn' && this.state.card.OpenType !== 'excelOut' ? |
| | | <VerifyCard |
| | | card={this.state.card} |
| | | dict={this.state.dict} |
| | |
| | | } |
| | | {this.state.card && this.state.card.OpenType === 'excelIn' ? |
| | | <VerifyCardExcelIn |
| | | card={this.state.card} |
| | | dict={this.state.dict} |
| | | wrappedComponentRef={(inst) => this.verifyRef = inst} |
| | | /> : null |
| | | } |
| | | {this.state.card && this.state.card.OpenType === 'excelOut' ? |
| | | <VerifyCardExcelOut |
| | | card={this.state.card} |
| | | dict={this.state.dict} |
| | | wrappedComponentRef={(inst) => this.verifyRef = inst} |
| | |
| | | <SettingForm |
| | | dict={this.state.dict} |
| | | menu={this.props.menu} |
| | | config={this.state.config} |
| | | data={this.state.config.setting} |
| | | columns={this.state.config.columns} |
| | | usefulFields={this.props.permFuncField} |