From fb64bcf1fab18b33d21470c83f28d4cda8d309ce Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 26 十月 2022 12:15:59 +0800 Subject: [PATCH] 2022-10-26 --- src/utils/utils-custom.js | 172 ++++++++++++++++----------------------------------------- 1 files changed, 48 insertions(+), 124 deletions(-) diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js index 19c7836..7284446 100644 --- a/src/utils/utils-custom.js +++ b/src/utils/utils-custom.js @@ -342,73 +342,6 @@ } /** - * @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浣島uid string + 鏃堕棿 * @return {String} uuid */ @@ -433,6 +366,10 @@ return item } + if (item.subtype === 'tablecard') { // 鍏煎 + item.type = 'card' + } + uuids[item.uuid] = this.getuuid() item.uuid = uuids[item.uuid] @@ -454,7 +391,7 @@ } 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] } @@ -514,7 +451,7 @@ 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() @@ -678,9 +615,13 @@ * @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() @@ -707,7 +648,7 @@ 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) { @@ -715,14 +656,7 @@ 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 }) } @@ -731,14 +665,7 @@ 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 }) } @@ -749,18 +676,11 @@ 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() @@ -798,14 +718,7 @@ 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 }) } @@ -833,9 +746,7 @@ }) } - if (item.btnlog) { - item.btnlog = null - } + delete item.btnlog let oriUids = {} if (item.action) { @@ -846,13 +757,6 @@ 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 @@ -976,8 +880,12 @@ 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) + } } }) @@ -986,8 +894,12 @@ 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) + } } }) } @@ -998,8 +910,12 @@ 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) + } } }) } @@ -1009,16 +925,24 @@ 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) + } } }) -- Gitblit v1.8.0