From 0eacb2fbcaa01060f81219d1ce5b406ae50f0c80 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 06 四月 2023 17:48:10 +0800 Subject: [PATCH] Merge branch 'develop' --- src/templates/comtableconfig/updatetable/index.jsx | 103 +++++++++++++++++++++++++++++++++++---------------- 1 files changed, 71 insertions(+), 32 deletions(-) diff --git a/src/templates/comtableconfig/updatetable/index.jsx b/src/templates/comtableconfig/updatetable/index.jsx index d56aa9b..0523a29 100644 --- a/src/templates/comtableconfig/updatetable/index.jsx +++ b/src/templates/comtableconfig/updatetable/index.jsx @@ -264,7 +264,6 @@ uuid: btn.uuid, MenuID: btn.uuid, ParentId: tab.components[0].uuid, - enabled: false, MenuName: btn.label, tables: _config.tables || [], Template: 'BaseTable', @@ -272,6 +271,8 @@ viewType: 'popview', style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' } } + + btn.config.enabled = this.setEnabled(btn.config) } else { errors.push(tab.label + '涓寜閽��' + btn.label + '銆嬮厤缃俊鎭涪澶�') } @@ -288,7 +289,6 @@ uuid: btn.uuid, MenuID: btn.uuid, ParentId: tab.components[0].uuid, - enabled: false, MenuName: btn.label, tables: _config.tables || [], Template: 'BaseTable', @@ -296,6 +296,8 @@ viewType: 'popview', style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' } } + + btn.config.enabled = this.setEnabled(btn.config) } else { errors.push(tab.label + '涓寜閽��' + btn.label + '銆嬮厤缃俊鎭涪澶�') } @@ -313,7 +315,6 @@ uuid: btn.uuid, MenuID: btn.uuid, ParentId: item.uuid, - enabled: false, MenuName: btn.label, tables: _config.tables || [], Template: 'BaseTable', @@ -321,6 +322,8 @@ viewType: 'popview', style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' } } + + btn.config.enabled = this.setEnabled(btn.config) } else { errors.push('涓昏〃涓寜閽��' + btn.label + '銆嬮厤缃俊鎭涪澶�') } @@ -337,7 +340,6 @@ uuid: btn.uuid, MenuID: btn.uuid, ParentId: item.uuid, - enabled: false, MenuName: btn.label, tables: _config.tables || [], Template: 'BaseTable', @@ -345,6 +347,8 @@ viewType: 'popview', style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' } } + + btn.config.enabled = this.setEnabled(btn.config) } else { errors.push('涓昏〃涓寜閽��' + btn.label + '銆嬮厤缃俊鎭涪澶�') } @@ -359,6 +363,25 @@ } else { this.setPopForm(_resolve, _config, formActions, formTabs, errors) } + } + + setEnabled = (config) => { + let enabled = true + config.components.forEach(item => { + if (item.type === 'tabs') { + item.subtabs.forEach(tab => { + if (tab.components[0].errors.length > 0) { + enabled = false + } + }) + } else { + if (item.errors.length > 0) { + enabled = false + } + } + }) + + return enabled } setPopForm = (_resolve, _config, formActions, formTabs, errors) => { @@ -566,20 +589,6 @@ }) tab.components[0].$tables = getTables(tab.components[0]) - - tab.components[0].errors = [] - let columns = tab.components[0].columns.map(c => c.field) - if (tab.components[0].setting.interType === 'system' && tab.components[0].setting.execute !== 'false' && !tab.components[0].setting.dataresource) { - tab.components[0].errors.push({ level: 0, detail: '鏈缃暟鎹簮锛�'}) - } else if (tab.components[0].setting.interType === 'system' && tab.components[0].setting.execute === 'false' && tab.components[0].scripts.filter(script => script.status !== 'false').length === 0) { - tab.components[0].errors.push({ level: 0, detail: '鏁版嵁婧愪腑鏃犲彲鐢ㄨ剼鏈紒'}) - } else if (!tab.components[0].setting.primaryKey) { - tab.components[0].errors.push({ level: 0, detail: '鏈缃富閿紒'}) - } else if (!columns.includes(tab.components[0].setting.primaryKey)) { - tab.components[0].errors.push({ level: 0, detail: '涓婚敭宸插け鏁堬紒'}) - } else if (!tab.components[0].setting.supModule) { - tab.components[0].errors.push({ level: 0, detail: '鏈缃笂绾х粍浠讹紒'}) - } }) } else { item.action.forEach(btn => { @@ -597,20 +606,6 @@ }) item.$tables = getTables(item) - - item.errors = [] - let columns = item.columns.map(c => c.field) - if (item.setting.interType === 'system' && item.setting.execute !== 'false' && !item.setting.dataresource) { - item.errors.push({ level: 0, detail: '鏈缃暟鎹簮锛�'}) - } else if (item.setting.interType === 'system' && item.setting.execute === 'false' && item.scripts.filter(script => script.status !== 'false').length === 0) { - item.errors.push({ level: 0, detail: '鏁版嵁婧愪腑鏃犲彲鐢ㄨ剼鏈紒'}) - } else if (!item.setting.primaryKey) { - item.errors.push({ level: 0, detail: '鏈缃富閿紒'}) - } else if (!columns.includes(item.setting.primaryKey)) { - item.errors.push({ level: 0, detail: '涓婚敭宸插け鏁堬紒'}) - } else if (!item.setting.supModule) { - item.errors.push({ level: 0, detail: '鏈缃笂绾х粍浠讹紒'}) - } } }) @@ -1214,6 +1209,50 @@ _card.wrap.doubleClick = '' } + _card.errors = [] + let columns = _card.columns.map(c => c.field) + if (_card.setting.interType === 'system' && _card.setting.execute !== 'false' && !_card.setting.dataresource) { + _card.errors.push({ level: 0, detail: '鏈缃暟鎹簮锛�'}) + } else if (_card.setting.interType === 'system' && _card.setting.execute === 'false' && _card.scripts.filter(script => script.status !== 'false').length === 0) { + _card.errors.push({ level: 0, detail: '鏁版嵁婧愪腑鏃犲彲鐢ㄨ剼鏈紒'}) + } else if (!_card.setting.primaryKey) { + _card.errors.push({ level: 0, detail: '鏈缃富閿紒'}) + } else if (!columns.includes(_card.setting.primaryKey)) { + _card.errors.push({ level: 0, detail: '涓婚敭宸插け鏁堬紒'}) + } else if (!_card.setting.supModule) { + _card.errors.push({ level: 0, detail: '鏈缃笂绾х粍浠讹紒'}) + } + + _card.action.forEach(cell => { + if (cell.hidden === 'true') return + if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { + if (!cell.modal || cell.modal.fields.length === 0) { + _card.errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`}) + } + } else if (cell.OpenType === 'excelIn' && (!cell.verify || !cell.verify.sheet || !cell.verify.columns || cell.verify.columns.length === 0)) { + _card.errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑瀵煎叆鍒楁湭璁剧疆锛乣}) + } else if (cell.OpenType === 'excelOut' && (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0)) { + _card.errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑瀵煎嚭鍒楁湭璁剧疆锛乣}) + } + }) + + _card.cols.forEach(col => { + if (col.type !== 'action') return + + col.elements.forEach(cell => { + if (cell.hidden === 'true') return + if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { + if (!cell.modal || cell.modal.fields.length === 0) { + _card.errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`}) + } + } else if (cell.OpenType === 'excelIn' && (!cell.verify || !cell.verify.sheet || !cell.verify.columns || cell.verify.columns.length === 0)) { + _card.errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑瀵煎叆鍒楁湭璁剧疆锛乣}) + } else if (cell.OpenType === 'excelOut' && (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0)) { + _card.errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑瀵煎嚭鍒楁湭璁剧疆锛乣}) + } + }) + }) + return _card } -- Gitblit v1.8.0