| | |
| | | } |
| | | |
| | | /** |
| | | * @description 获取删除按钮Id |
| | | * @return {String} name |
| | | */ |
| | | static getDelButtonIds (card) { |
| | | let appType = sessionStorage.getItem('appType') |
| | | let uuids = [] |
| | | |
| | | if (appType === 'mob') return uuids |
| | | |
| | | const getUuids = (item) => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | tab.components.forEach(c => { |
| | | getUuids(c) |
| | | }) |
| | | }) |
| | | } else if (item.type === 'group') { |
| | | item.components.forEach(c => { |
| | | getUuids(c) |
| | | }) |
| | | } else { |
| | | item.action && item.action.forEach(act => { |
| | | if (act.origin || (appType === 'pc' && act.OpenType !== 'popview')) return |
| | | |
| | | uuids.push(act.uuid) |
| | | }) |
| | | |
| | | if (['card', 'carousel', 'timeline'].includes(item.type) || (item.type === 'table' && item.subtype === 'tablecard')) { |
| | | item.subcards.forEach(_card => { |
| | | _card.elements && _card.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | if (appType === 'pc' && cell.OpenType !== 'popview') return |
| | | |
| | | uuids.push(cell.uuid) |
| | | }) |
| | | _card.backElements && _card.backElements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | if (appType === 'pc' && cell.OpenType !== 'popview') return |
| | | |
| | | uuids.push(cell.uuid) |
| | | }) |
| | | }) |
| | | } else if (item.type === 'table' && (item.subtype === 'normaltable' || item.subtype === 'editable')) { |
| | | item.cols && item.cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | col.elements && col.elements.forEach(cell => { |
| | | if (appType === 'pc' && cell.OpenType !== 'popview') return |
| | | |
| | | uuids.push(cell.uuid) |
| | | }) |
| | | }) |
| | | } else if (item.type === 'balcony') { |
| | | item.elements && item.elements.forEach(cell => { |
| | | if (appType === 'pc' && cell.OpenType !== 'popview') return |
| | | |
| | | uuids.push(cell.uuid) |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | getUuids(card) |
| | | |
| | | return uuids |
| | | } |
| | | |
| | | /** |
| | | * @description 生成32位uuid string + 时间 |
| | | * @return {String} uuid |
| | | */ |
| | |
| | | return item |
| | | } |
| | | |
| | | if (item.subtype === 'tablecard') { // 兼容 |
| | | item.type = 'card' |
| | | } |
| | | |
| | | uuids[item.uuid] = this.getuuid() |
| | | item.uuid = uuids[item.uuid] |
| | | |
| | |
| | | } |
| | | return cell |
| | | }) |
| | | } else if (['card', 'carousel', 'timeline'].includes(item.type) || (item.type === 'table' && item.subtype === 'tablecard')) { |
| | | } else if (['card', 'carousel', 'timeline'].includes(item.type)) { |
| | | if (item.wrap.datatype === 'public' && uuids[item.wrap.publicId]) { |
| | | item.wrap.publicId = uuids[item.wrap.publicId] |
| | | } |
| | |
| | | return cell |
| | | }) |
| | | } |
| | | } else if (item.type === 'table' && (item.subtype === 'normaltable' || item.subtype === 'editable') && item.cols) { |
| | | } else if (item.type === 'table' && item.cols) { |
| | | let loopCol = (col) => { |
| | | col.subcols = col.subcols.map(c => { |
| | | c.uuid = this.getuuid() |
| | |
| | | * @description 重置组件配置 |
| | | * @return {String} item 组件信息 |
| | | */ |
| | | static resetComponentConfig = (item, copyBtns, uuids = {}) => { |
| | | static resetComponentConfig = (item, uuids = {}) => { |
| | | if (item.type === 'navbar') { |
| | | return item |
| | | } |
| | | |
| | | if (item.subtype === 'tablecard') { // 兼容 |
| | | item.type = 'card' |
| | | } |
| | | |
| | | let _uuid = this.getuuid() |
| | |
| | | cell.uuid = this.getuuid() |
| | | return cell |
| | | }) |
| | | } else if (['card', 'carousel', 'timeline'].includes(item.type) || (item.type === 'table' && item.subtype === 'tablecard')) { |
| | | } else if (['card', 'carousel', 'timeline'].includes(item.type)) { |
| | | item.subcards.forEach(card => { |
| | | card.uuid = this.getuuid() |
| | | if (card.elements) { |
| | |
| | | card.elements = card.elements.filter(b => b.OpenType !== 'popview' && b.OpenType !== 'funcbutton') |
| | | } |
| | | card.elements = card.elements.map(cell => { |
| | | let _uuid = this.getuuid() |
| | | if (cell.OpenType === 'popview' && copyBtns) { |
| | | let _cell = JSON.parse(JSON.stringify(cell)) |
| | | _cell.$originUuid = _cell.uuid |
| | | _cell.uuid = _uuid |
| | | copyBtns.set(_uuid, _cell) |
| | | } |
| | | cell.uuid = _uuid |
| | | cell.uuid = this.getuuid() |
| | | return cell |
| | | }) |
| | | } |
| | |
| | | card.elements = card.elements.filter(b => b.OpenType !== 'popview' && b.OpenType !== 'funcbutton') |
| | | } |
| | | card.backElements = card.backElements.map(cell => { |
| | | let _uuid = this.getuuid() |
| | | if (cell.OpenType === 'popview' && copyBtns) { |
| | | let _cell = JSON.parse(JSON.stringify(cell)) |
| | | _cell.$originUuid = _cell.uuid |
| | | _cell.uuid = _uuid |
| | | copyBtns.set(_uuid, _cell) |
| | | } |
| | | cell.uuid = _uuid |
| | | cell.uuid = this.getuuid() |
| | | return cell |
| | | }) |
| | | } |
| | |
| | | item.elements = item.elements.filter(b => b.OpenType !== 'popview' && b.OpenType !== 'funcbutton') |
| | | } |
| | | item.elements = item.elements.map(cell => { |
| | | let _uuid = this.getuuid() |
| | | if (cell.OpenType === 'popview' && copyBtns) { |
| | | let _cell = JSON.parse(JSON.stringify(cell)) |
| | | _cell.$originUuid = _cell.uuid |
| | | _cell.uuid = _uuid |
| | | copyBtns.set(_uuid, _cell) |
| | | } |
| | | cell.uuid = _uuid |
| | | cell.uuid = this.getuuid() |
| | | return cell |
| | | }) |
| | | } |
| | | } else if (item.type === 'table' && (item.subtype === 'normaltable' || item.subtype === 'editable') && item.cols) { |
| | | } else if (item.type === 'table' && item.cols) { |
| | | let loopCol = (col) => { |
| | | col.subcols = col.subcols.map(c => { |
| | | c.uuid = this.getuuid() |
| | |
| | | col.elements = col.elements.filter(c => c.OpenType !== 'popview' && c.OpenType !== 'funcbutton') |
| | | } |
| | | col.elements = col.elements.map(cell => { |
| | | let _uuid = this.getuuid() |
| | | if (cell.OpenType === 'popview' && copyBtns) { |
| | | let _cell = JSON.parse(JSON.stringify(cell)) |
| | | _cell.$originUuid = _cell.uuid |
| | | _cell.uuid = _uuid |
| | | copyBtns.set(_uuid, _cell) |
| | | } |
| | | cell.uuid = _uuid |
| | | cell.uuid = this.getuuid() |
| | | return cell |
| | | }) |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | if (item.btnlog) { |
| | | item.btnlog = null |
| | | } |
| | | delete item.btnlog |
| | | |
| | | let oriUids = {} |
| | | if (item.action) { |
| | |
| | | let _uuid = this.getuuid() |
| | | |
| | | oriUids[cell.uuid] = _uuid |
| | | |
| | | if (cell.OpenType === 'popview' && copyBtns) { |
| | | let _cell = JSON.parse(JSON.stringify(cell)) |
| | | _cell.$originUuid = _cell.uuid |
| | | _cell.uuid = _uuid |
| | | copyBtns.set(_uuid, _cell) |
| | | } |
| | | |
| | | cell.uuid = _uuid |
| | | |
| | |
| | | if (cell.eleType !== 'button') return |
| | | if (['form', 'pop', 'prompt', 'exec', 'excelIn', 'excelOut'].includes(cell.OpenType)) { |
| | | action.push(cell) |
| | | } else if (pops && cell.OpenType === 'popview') { |
| | | pops.push({...cell, parentId: config.uuid}) |
| | | } else if (cell.OpenType === 'popview') { |
| | | if (pops) { |
| | | pops.push({...cell, parentId: config.uuid}) |
| | | } else if (cell.config && cell.config.$tables) { |
| | | tables.push(...cell.config.$tables) |
| | | } |
| | | } |
| | | }) |
| | | |
| | |
| | | if (cell.eleType !== 'button') return |
| | | if (['form', 'pop', 'prompt', 'exec', 'excelIn', 'excelOut'].includes(cell.OpenType)) { |
| | | action.push(cell) |
| | | } else if (pops && cell.OpenType === 'popview') { |
| | | pops.push({...cell, parentId: config.uuid}) |
| | | } else if (cell.OpenType === 'popview') { |
| | | if (pops) { |
| | | pops.push({...cell, parentId: config.uuid}) |
| | | } else if (cell.config && cell.config.$tables) { |
| | | tables.push(...cell.config.$tables) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | |
| | | col.elements.forEach(cell => { |
| | | if (['form', 'pop', 'prompt', 'exec', 'excelIn', 'excelOut'].includes(cell.OpenType)) { |
| | | action.push(cell) |
| | | } else if (pops && cell.OpenType === 'popview') { |
| | | pops.push({...cell, parentId: config.uuid}) |
| | | } else if (cell.OpenType === 'popview') { |
| | | if (pops) { |
| | | pops.push({...cell, parentId: config.uuid}) |
| | | } else if (cell.config && cell.config.$tables) { |
| | | tables.push(...cell.config.$tables) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | |
| | | if (cell.eleType !== 'button') return |
| | | if (['form', 'pop', 'prompt', 'exec', 'excelIn', 'excelOut'].includes(cell.OpenType)) { |
| | | action.push(cell) |
| | | } else if (pops && cell.OpenType === 'popview') { |
| | | pops.push({...cell, parentId: config.uuid}) |
| | | } else if (cell.OpenType === 'popview') { |
| | | if (pops) { |
| | | pops.push({...cell, parentId: config.uuid}) |
| | | } else if (cell.config && cell.config.$tables) { |
| | | tables.push(...cell.config.$tables) |
| | | } |
| | | } |
| | | }) |
| | | |
| | | config.action && config.action.forEach(cell => { |
| | | if (['pop', 'prompt', 'exec', 'excelIn', 'excelOut'].includes(cell.OpenType)) { |
| | | action.push(cell) |
| | | } else if (pops && cell.OpenType === 'popview') { |
| | | pops.push({...cell, parentId: config.uuid}) |
| | | } else if (cell.OpenType === 'popview') { |
| | | if (pops) { |
| | | pops.push({...cell, parentId: config.uuid}) |
| | | } else if (cell.config && cell.config.$tables) { |
| | | tables.push(...cell.config.$tables) |
| | | } |
| | | } |
| | | }) |
| | | |