| | |
| | | let formActions = [] |
| | | let popActions = [] |
| | | let errors = [] |
| | | let formTabs = [] |
| | | let mainTb = {name: '主表', uuid: Utils.getuuid(), useMSearch: 'false', isMain: true} |
| | | |
| | | let oldtabs = { |
| | | mainTable: mainTb.uuid |
| | | } |
| | | |
| | | let tbl = this.getTable(config, mainTb, errors, formActions, formTabs, popActions, oldtabs) |
| | | let tbl = this.getTable(config, mainTb, errors, formActions, popActions, oldtabs) |
| | | |
| | | if (config.autoMatic && config.autoMatic.enable === 'true') { |
| | | if (tbl.action.filter(item => item.uuid === config.autoMatic.action && (['pop', 'prompt', 'exec'].includes(item.OpenType) || (item.OpenType === 'funcbutton' && item.funcType === 'print'))).length === 0) { |
| | |
| | | let _tbs = [] |
| | | if (config.tabgroups && config.tabgroups.length > 0) { |
| | | config.tabgroups.forEach(m => { |
| | | if (!m.sublist || m.sublist.length === 0) return |
| | | if (!m.sublist) return |
| | | |
| | | m.sublist = m.sublist.filter(c => !!c.linkTab) |
| | | |
| | | if (m.sublist.length === 0) return |
| | | |
| | | let tabs = { |
| | | uuid: Utils.getuuid(), |
| | |
| | | setting: {}, |
| | | style: {}, |
| | | subtabs: m.sublist.map(n => { |
| | | let tab = { uuid: Utils.getuuid(), label: n.label, icon: n.icon, permission: 'false', components: [ |
| | | let tab = { uuid: Utils.getuuid(), label: n.label, icon: n.icon, permission: 'true', components: [ |
| | | { |
| | | uuid: Utils.getuuid(), |
| | | linkTab: n.linkTab, |
| | |
| | | let defers = _tbs.map((item, i) => { |
| | | return new Promise((resolve) => { |
| | | setTimeout(() => { |
| | | Api.getSystemConfig({ |
| | | Api.getCloudConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: item.linkTab |
| | | }).then(res => { |
| | |
| | | } |
| | | }) |
| | | |
| | | let supIds = [] |
| | | _config.components = _config.components.map(item => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs = item.subtabs.map(tab => { |
| | | tab.components[0] = this.getTable(menus[tab.components[0].linkTab], tab.components[0], errors, formActions, formTabs, popActions, oldtabs) |
| | | tab.components[0] = this.getTable(menus[tab.components[0].linkTab], tab.components[0], errors, formActions, popActions, oldtabs) |
| | | supIds.push([item.uuid, tab.uuid, tab.components[0].uuid]) |
| | | |
| | | return tab |
| | | }) |
| | |
| | | return item |
| | | }) |
| | | |
| | | this.setPopView(_resolve, _config, formActions, formTabs, popActions, errors) |
| | | _config.components = _config.components.map(item => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs = item.subtabs.map(tab => { |
| | | if (tab.components[0].setting.supModule && tab.components[0].setting.supModule.length === 1) { |
| | | supIds.forEach(ids => { |
| | | if (ids[2] === tab.components[0].setting.supModule[0]) { |
| | | tab.components[0].setting.supModule = ids |
| | | } |
| | | }) |
| | | } |
| | | return tab |
| | | }) |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | this.setPopView(_resolve, _config, formActions, popActions, errors) |
| | | }) |
| | | } else { |
| | | this.setPopView(_resolve, _config, formActions, formTabs, popActions, errors) |
| | | this.setPopView(_resolve, _config, formActions, popActions, errors) |
| | | } |
| | | } |
| | | |
| | | setPopView = (_resolve, _config, formActions, formTabs, popActions, errors) => { |
| | | setPopView = (_resolve, _config, formActions, popActions, errors) => { |
| | | if (popActions.length > 0) { |
| | | let defers = popActions.map((item, i) => { |
| | | return new Promise((resolve) => { |
| | | setTimeout(() => { |
| | | Api.getSystemConfig({ |
| | | Api.getCloudConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: item.linkTab |
| | | }).then(res => { |
| | |
| | | MenuName: btn.label, |
| | | tables: _config.tables || [], |
| | | Template: 'BaseTable', |
| | | components: [this.getTable(menus[btn.uuid], mainTb, errors, formActions, formTabs)], |
| | | components: [this.getTable(menus[btn.uuid], mainTb, errors, formActions)], |
| | | viewType: 'popview', |
| | | style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' } |
| | | } |
| | |
| | | MenuName: btn.label, |
| | | tables: _config.tables || [], |
| | | Template: 'BaseTable', |
| | | components: [this.getTable(menus[btn.uuid], mainTb, errors, formActions, formTabs)], |
| | | components: [this.getTable(menus[btn.uuid], mainTb, errors, formActions)], |
| | | viewType: 'popview', |
| | | style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' } |
| | | } |
| | |
| | | MenuName: btn.label, |
| | | tables: _config.tables || [], |
| | | Template: 'BaseTable', |
| | | components: [this.getTable(menus[btn.uuid], mainTb, errors, formActions, formTabs)], |
| | | components: [this.getTable(menus[btn.uuid], mainTb, errors, formActions)], |
| | | viewType: 'popview', |
| | | style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' } |
| | | } |
| | |
| | | MenuName: btn.label, |
| | | tables: _config.tables || [], |
| | | Template: 'BaseTable', |
| | | components: [this.getTable(menus[btn.uuid], mainTb, errors, formActions, formTabs)], |
| | | components: [this.getTable(menus[btn.uuid], mainTb, errors, formActions)], |
| | | viewType: 'popview', |
| | | style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' } |
| | | } |
| | |
| | | } |
| | | }) |
| | | |
| | | this.setPopForm(_resolve, _config, formActions, formTabs, errors) |
| | | this.setPopForm(_resolve, _config, formActions, errors) |
| | | }) |
| | | } else { |
| | | this.setPopForm(_resolve, _config, formActions, formTabs, errors) |
| | | this.setPopForm(_resolve, _config, formActions, errors) |
| | | } |
| | | } |
| | | |
| | |
| | | return enabled |
| | | } |
| | | |
| | | setPopForm = (_resolve, _config, formActions, formTabs, errors) => { |
| | | setPopForm = (_resolve, _config, formActions, errors) => { |
| | | if (formActions.length > 0) { |
| | | let defers = formActions.map((item, i) => { |
| | | return new Promise((resolve) => { |
| | | setTimeout(() => { |
| | | Api.getSystemConfig({ |
| | | Api.getCloudConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: item.origin |
| | | }).then(res => { |
| | |
| | | } |
| | | }) |
| | | |
| | | this.saveConfig(_resolve, _config, errors, formTabs) |
| | | this.saveConfig(_resolve, _config, errors) |
| | | }) |
| | | } else { |
| | | this.saveConfig(_resolve, _config, errors, formTabs) |
| | | this.saveConfig(_resolve, _config, errors) |
| | | } |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | saveConfig = (_resolve, _config, errors, formTabs) => { |
| | | saveConfig = (_resolve, _config, errors) => { |
| | | let err = errors.join(';') |
| | | let _this = this |
| | | |
| | |
| | | content: '', |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.saveNewMenu(resolve, _config, formTabs) |
| | | _this.saveNewMenu(resolve, _config) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | this.saveNewMenu(_resolve, _config, formTabs) |
| | | this.saveNewMenu(_resolve, _config) |
| | | } |
| | | } |
| | | |
| | | saveNewMenu = (_resolve, _config, formTabs) => { |
| | | saveNewMenu = (_resolve, _config) => { |
| | | _config.components.forEach(item => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | |
| | | } |
| | | }) |
| | | |
| | | // if (formTabs.length > 0) { |
| | | // this.transformTabs(_resolve, _config, formTabs) |
| | | // } else { |
| | | this.submitConfig(_resolve, _config) |
| | | // } |
| | | } |
| | | |
| | | transformTabs = (_resolve, _config, formTabs) => { |
| | | let tab = formTabs.shift() |
| | | |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: tab.uuid |
| | | }).then(res => { |
| | | if (res.status) { |
| | | let _LongParam = '' |
| | | if (res.LongParam) { |
| | | try { |
| | | _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | |
| | | if (_LongParam && (_LongParam.type === 'FormTab' || _LongParam.Template === 'FormTab') && _LongParam.enabled) { |
| | | if (!_LongParam.tabgroups) { |
| | | _LongParam.tabgroups = [] |
| | | } else if (typeof(_LongParam.tabgroups[0]) === 'string') { |
| | | let _tabgroups = [] |
| | | _LongParam.tabgroups.forEach(groupId => { |
| | | let _group = { |
| | | uuid: groupId, |
| | | sublist: fromJS(_LongParam[groupId]).toJS() |
| | | } |
| | | |
| | | delete _LongParam[groupId] |
| | | |
| | | _tabgroups.push(_group) |
| | | }) |
| | | |
| | | _LongParam.tabgroups = _tabgroups |
| | | } |
| | | |
| | | _LongParam.tabgroups = _LongParam.tabgroups.filter(group => group.sublist.length > 0) |
| | | |
| | | _LongParam.tabgroups.forEach(group => { |
| | | group.sublist = group.sublist.map(tab => { |
| | | if (tab.supMenu === 'mainTable') { |
| | | tab.supMenu = '' |
| | | } |
| | | return tab |
| | | }) |
| | | }) |
| | | |
| | | _LongParam.action = _LongParam.action.map(item => { |
| | | if (item.intertype === 'inner' && !item.innerFunc) { |
| | | item.intertype = 'system' |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | delete _LongParam.funcs |
| | | delete _LongParam.tables |
| | | } else { |
| | | _config.components[0].action = _config.components[0].action.filter(btn => btn.uuid !== tab.uuid) |
| | | } |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | _resolve() |
| | | } |
| | | }) |
| | | this.submitConfig(_resolve, _config) |
| | | } |
| | | |
| | | checkBtns = (card) => { |
| | |
| | | let save = false |
| | | |
| | | new Promise(resolve => { |
| | | Api.getSystemConfig(param).then(res => { |
| | | Api.getCloudConfig(param).then(res => { |
| | | resolve(res) |
| | | }) |
| | | }).then(res => { // 删除原菜单 |
| | |
| | | |
| | | if (this.delButtons.length === 0) return res |
| | | |
| | | return Api.getSystemConfig({ |
| | | return Api.getCloudConfig({ |
| | | func: 'sPC_MainMenu_Del', |
| | | up_type: 'Y', |
| | | MenuID: this.delButtons.join(',') |
| | |
| | | }) |
| | | } |
| | | |
| | | getTable = (config, newCon, errors, formActions, formTabs, popActions, oldtabs) => { |
| | | getTable = (config, newCon, errors, formActions, popActions, oldtabs) => { |
| | | let _card = { |
| | | uuid: newCon.uuid, |
| | | type: 'table', |
| | |
| | | action: [], |
| | | subtype: 'basetable', |
| | | setting: { useMSearch: newCon.useMSearch }, |
| | | wrap: {}, |
| | | wrap: {name: newCon.name}, |
| | | style: {}, |
| | | headerStyle: {}, |
| | | columns: [], |
| | |
| | | let lineMarks = [] |
| | | config.columns.forEach(col => { |
| | | if (col.type === 'colspan') { |
| | | _colspan.push(...col.subfield.split(', ')) |
| | | if (col.subfield) { |
| | | _colspan.push(...col.subfield.split(', ')) |
| | | } else if (col.sublist && col.sublist.length > 0) { |
| | | _colspan.push(...col.sublist) |
| | | } |
| | | } |
| | | if (!col.field) return |
| | | |
| | |
| | | if (_colspan.includes(col.field)) { |
| | | _col.Hide = 'true' |
| | | } |
| | | |
| | | _col.uuid = Utils.getuuid() |
| | | _card.cols.push(_col) |
| | | } |
| | | |
| | |
| | | label: col.label, |
| | | marks: [], |
| | | isSub: false, |
| | | uuid: col.uuid, |
| | | uuid: Utils.getuuid(), |
| | | blacklist: [] |
| | | } |
| | | let _subs = [] |
| | | if (col.subfield) { |
| | | _subs = col.subfield.split(', ') |
| | | } else if (col.sublist) { |
| | | _subs = col.sublist |
| | | } |
| | | |
| | | if (col.unfold === 'true') { |
| | | ucol.type = 'colspan' |
| | | ucol.subcols = [] |
| | | |
| | | col.subfield.split(', ').forEach(sub => { |
| | | _subs.forEach(sub => { |
| | | if (_cols[sub]) { |
| | | let _col = fromJS(_cols[sub]).toJS() |
| | | _col.Hide = 'false' |
| | |
| | | ucol.elements = [] |
| | | ucol.style = {paddingTop: '12px', paddingLeft: '8px', paddingBottom: '12px', paddingRight: '8px'} |
| | | |
| | | col.subfield.split(', ').forEach(sub => { |
| | | _subs.forEach(sub => { |
| | | if (_cols[sub]) { |
| | | let _col = { |
| | | copyable: 'false', |
| | |
| | | if (btn.tabTemplate === 'FormTab') { |
| | | errors.push(newCon.name + '中按钮《' + btn.label + '》不在支持') |
| | | return |
| | | // if (newCon.isMain !== true) { |
| | | // errors.push(newCon.name + '中按钮《' + btn.label + '》不在支持') |
| | | // return |
| | | // } |
| | | |
| | | // delete _btn.tabTemplate |
| | | |
| | | // _btn.MenuID = 'tab' + md5(btn.uuid).substr(3) |
| | | // _btn.MenuName = this.baseMsg.MenuName + '-' + btn.label |
| | | // _btn.MenuNo = this.baseMsg.MenuNo + '_' + _btn.MenuID.substr(-4).toUpperCase() |
| | | // _btn.hidden = _btn.hidden || 'false' |
| | | // _btn.tabType = 'CustomPage' |
| | | // _btn.linkmenu = [this.baseMsg.fstMenuId, this.baseMsg.parentId, _btn.MenuID] |
| | | |
| | | // let _tab = {...btn} |
| | | |
| | | // _tab.MenuID = _btn.MenuID |
| | | // _tab.MenuNo = _btn.MenuNo |
| | | // _tab.MenuName = _btn.MenuName |
| | | |
| | | // formTabs.push(_tab) |
| | | } else if (!btn.linkmenu || btn.linkmenu.length !== 3) { |
| | | |
| | | errors.push(newCon.name + '中按钮《' + btn.label + '》不在支持') |
| | |
| | | }) |
| | | } |
| | | |
| | | let sets = ['tableName', 'interType', 'sysInterface', 'innerFunc', 'interface', 'proInterface', 'outerFunc', 'dataresource', ['queryType', 'query'], 'primaryKey', 'order', 'execute', ['laypage', 'true'], ['pageSize', 10], ['onload', 'true']] |
| | | let sets = ['tableName', 'interType', 'sysInterface', 'innerFunc', 'interface', 'proInterface', 'outerFunc', 'dataresource', ['queryType', 'query'], 'primaryKey', 'order', ['laypage', 'true'], ['pageSize', 10], ['onload', 'true']] |
| | | let wraps = ['tableType', ['bordered', 'true'], 'actionfixed', ['size', 'middle'], ['selected', 'false'], ['tableMode', 'compatible'], ['mask', 'show'], ['borderColor', '#e8e8e8'], 'height', 'controlField', 'controlVal'] |
| | | |
| | | _card.scripts = config.setting.scripts || [] |
| | |
| | | _card.wrap.doubleClick = '' |
| | | } |
| | | |
| | | _card.setting.execute = config.setting.default || 'true' |
| | | |
| | | _card.errors = [] |
| | | let columns = _card.columns.map(c => c.field) |
| | | if (_card.setting.interType === 'system' && _card.setting.execute !== 'false' && !_card.setting.dataresource) { |