From c45a375e5b4ce0e33c7fc8a1aecdad67d60acc9e Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 01 三月 2021 15:09:06 +0800 Subject: [PATCH] 2021-03-01 --- src/templates/comtableconfig/index.jsx | 175 +++++++++++++++++++++++++--------------------------------- 1 files changed, 75 insertions(+), 100 deletions(-) diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index a6d10ff..5df380a 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -9,7 +9,7 @@ import Api from '@/api' import Utils from '@/utils/utils.js' -import UtilsUpdate from '@/utils/utils-update.js' +import { updateCommonTable } from '@/utils/utils-update.js' import zhCN from '@/locales/zh-CN/model.js' import enUS from '@/locales/en-US/model.js' @@ -42,7 +42,7 @@ } state = { - dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, + dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, config: null, // 椤甸潰閰嶇疆 tableFields: [], // 宸查�夌殑甯哥敤琛� formlist: null, // 鎼滅储鏉′欢銆佹寜閽�佹樉绀哄垪琛ㄥ崟瀛楁 @@ -90,7 +90,7 @@ _config.easyCode = _config.easyCode || '' // 鐗堟湰鍏煎 - _config = UtilsUpdate.updateCommonTable(_config) + _config = updateCommonTable(_config) let _oriActions = [] if (_config.type === 'user') { @@ -101,17 +101,17 @@ item.linkTab = '' } - if (item.OpenType === 'pop') { // 鍚湁瀛愰厤缃」鐨勬寜閽�(琛ㄥ崟) + if (item.OpenType === 'pop' || item.execMode === 'pop') { // 鍚湁瀛愰厤缃」鐨勬寜閽�(琛ㄥ崟) _oriActions.push({ prebtn: fromJS(item).toJS(), curuuid: uuid, Template: 'Modal' }) - } else if (item.OpenType === 'tab' || item.OpenType === 'blank') { // 鍚湁瀛愰厤缃」鐨勬寜閽�(鏍囩鍚庡綋鍓嶉〉鎵撳紑) + } else if (item.OpenType === 'tab' && item.tabTemplate === 'FormTab') { // 鍚湁瀛愰厤缃」鐨勬寜閽�(鏍囩椤垫墦寮�) _oriActions.push({ prebtn: fromJS(item).toJS(), curuuid: uuid, - Template: item.tabTemplate + Template: 'FormTab' }) } @@ -202,20 +202,37 @@ }) } - getFuncNames = (data) => { + getFuncNames = (config) => { let funcNames = [] let tableNames = [] - data.forEach(item => { - if (item.tableName) { - tableNames.push(item.tableName) - } - if (item.innerFunc) { - funcNames.push({func: item.innerFunc, label: item.label || ''}) + if (config.setting.tableName) { + tableNames.push(config.setting.tableName) + } + if (config.setting.innerFunc) { + funcNames.push({func: config.setting.innerFunc, label: config.MenuName || ''}) + } + if (config.setting.outerFunc) { + funcNames.push({func: config.setting.outerFunc, label: config.MenuName || ''}) + } + + config.action.forEach(item => { + let tablename = item.OpenType === 'excelIn' ? (item.sheet || '') : (item.sql || '') + + if (item.OpenType === 'excelOut' && item.intertype === 'system') { + tablename = config.setting.tableName || '' } - if (item.callbackFunc) { - funcNames.push({func: item.callbackFunc, label: item.label || ''}) + if (['pop', 'prompt', 'exec', 'excelIn', 'excelOut', 'funcbutton'].includes(item.OpenType)) { + if (tablename) { + tableNames.push(tablename) + } + if (item.innerFunc) { + funcNames.push({func: item.innerFunc, label: item.label || ''}) + } + if (item.callbackFunc) { + funcNames.push({func: item.callbackFunc, label: item.label || ''}) + } } }) @@ -279,70 +296,6 @@ if (vresult !== true) { _config.enabled = false } - - _config.funcs = [] // 椤甸潰鍙婂瓙椤甸潰瀛樺偍杩囩▼闆� - - _config.funcs.push({ - type: 'view', - subtype: 'view', - uuid: menu.MenuID, - intertype: _config.setting.interType || 'system', - interface: _config.setting.interface || '', - tableName: _config.setting.tableName || '', - innerFunc: _config.setting.innerFunc || '', - outerFunc: _config.setting.outerFunc || '' - }) - - _config.action.forEach(item => { - let tablename = item.OpenType === 'excelIn' ? (item.sheet || '') : (item.sql || '') - - if (item.OpenType === 'excelOut' && item.intertype === 'system') { - tablename = _config.setting.tableName || '' - } - - if (item.OpenType === 'tab' || item.OpenType === 'blank') { - _config.funcs.push({ - type: 'tab', - subtype: 'btn', - uuid: item.uuid, - label: item.label, - linkTab: item.uuid - }) - } else if (item.OpenType === 'popview') { - _config.funcs.push({ - type: 'tab', - subtype: 'btn', - uuid: item.uuid, - label: item.label, - linkTab: item.linkTab - }) - } else if (['pop', 'prompt', 'exec', 'excelIn', 'excelOut'].includes(item.OpenType)) { - _config.funcs.push({ - type: 'button', - subtype: 'btn', - uuid: item.uuid, - label: item.label, - tableName: tablename, - intertype: item.intertype, - interface: item.interface || '', - innerFunc: item.innerFunc || '', - outerFunc: item.outerFunc || '', - callbackFunc: item.callbackFunc || '' - }) - } - }) - - _config.tabgroups.forEach(group => { - group.sublist.forEach(tab => { - _config.funcs.push({ - type: 'tab', - subtype: 'tab', - uuid: tab.uuid, - label: tab.label, - linkTab: tab.linkTab - }) - }) - }) if (this.state.closeVisible) { // 鏄剧ず鍏抽棴瀵硅瘽妗嗘椂锛屾ā鎬佹涓繚瀛樻寜閽紝鏄剧ず淇濆瓨涓姸鎬� this.setState({ @@ -436,7 +389,7 @@ tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) - let _vals = this.getFuncNames(_config.funcs) + let _vals = this.getFuncNames(_config) let param = { func: 'sPC_TrdMenu_AddUpt', @@ -663,6 +616,8 @@ let curBtn = config.action.filter(cell => item.curuuid === cell.uuid)[0] // 鏌ョ湅鍒濆鍖栨寜閽槸鍚﹀瓨鍦� if (!curBtn) return if (curBtn.OpenType !== item.prebtn.OpenType) return + if (curBtn.OpenType === 'tab' && curBtn.tabTemplate !== 'FormTab') return + if (curBtn.OpenType === 'funcbutton' && curBtn.execMode !== 'pop') return oriActions.push({ prebtn: item.prebtn, @@ -822,16 +777,6 @@ duration: 5 }) } else { - // 鍩烘湰淇℃伅楠岃瘉 - if (!config.fstMenuId || !config.ParentId || !config.MenuName || !config.MenuNo) { - notification.warning({ - top: 92, - message: this.state.dict['model.menu.basemsg'], - duration: 5 - }) - this.setState({activeKey: '0'}) - return - } if (!is(fromJS(originMenu), fromJS(config))) { // 鑿滃崟淇℃伅鍙樺寲鏃讹紝鎻愮ず淇濆瓨 notification.warning({ top: 92, @@ -841,7 +786,7 @@ return } - let submenu = menu.fstMenuList.filter(item => item.MenuID === config.fstMenuId)[0] + let submenu = menu.fstMenuList.filter(_menu => _menu.MenuID === config.fstMenuId)[0] let _Menu = { ...menu, @@ -860,17 +805,17 @@ let isbutton = true let _btnTab = null - if (type === 'button' && item.OpenType === 'pop') { - _view = 'Modal' // 琛ㄥ崟椤甸潰 - } else if (type === 'button' && (item.OpenType === 'tab' || item.OpenType === 'blank')) { - _view = item.tabTemplate // 鏂版爣绛鹃〉妯℃澘 + if (type === 'button' && (item.OpenType === 'pop' || item.execMode === 'pop')) { + _view = 'Modal' // 琛ㄥ崟椤甸潰 + } else if (type === 'button' && item.OpenType === 'tab') { + _view = 'FormTab' // 琛ㄥ崟鏍囩椤垫ā鏉� _btnTab = item } else if (type === 'button' && item.OpenType === 'popview') { - _view = item.tabType // 鏂板脊绐楁爣绛炬ā鏉� + _view = 'SubTable' // 鏂板脊绐楁爣绛炬ā鏉� tabType 灞炴�у凡鍘婚櫎 uuid = item.linkTab isbutton = false } else if (type === 'tab') { - _view = item.type // 鏍囩妯℃澘 + _view = 'SubTable' // 鏍囩妯℃澘 uuid = item.linkTab isbutton = false } @@ -1020,9 +965,39 @@ } }) + config.action && config.action.forEach((btn) => { + if (['prompt', 'exec', 'pop'].includes(btn.OpenType) && btn.Ot === 'required' && btn.verify && btn.verify.scripts && btn.verify.scripts.length > 0) { + let hascheck = false + btn.verify.scripts.forEach(item => { + if (item.status === 'false') return + + if (/\$check@|@check\$/ig.test(item.sql)) { + hascheck = true + } + }) + if (hascheck) { + notification.warning({ + top: 92, + message: `鍙�夋嫨澶氳鐨勬寜閽��${btn.label}銆嬩腑 $check@ 鎴� @check$ 灏嗕笉浼氱敓鏁堬紒`, + duration: 5 + }) + } + } + if (btn.intertype === 'custom' && btn.callbackType === 'script' && (!btn.verify || !btn.verify.cbScripts || !btn.verify.cbScripts.filter(item => item.status !== 'false').length === 0)) { + notification.warning({ + top: 92, + message: `鎸夐挳銆�${btn.label}銆嬫湭璁剧疆鍥炶皟鑴氭湰锛� 灏嗕笉浼氱敓鏁堬紒`, + duration: 5 + }) + } + }) - if (config.setting.interType === 'system' && config.setting.default !== 'false' && !config.setting.dataresource) { - return '鑿滃崟灏氭湭璁剧疆鏁版嵁婧愶紝涓嶅彲鍚敤锛�' + if ((config.setting.interType === 'system' || config.setting.requestMode === 'system') && config.setting.default === 'false' && config.setting.scripts && config.setting.scripts.filter(item => item.status !== 'false').length === 0) { + return '鏁版嵁婧愪腑涓嶆墽琛岄粯璁ql锛屼笖鏈坊鍔犺嚜瀹氫箟鑴氭湰锛屼笉鍙惎鐢紒' + } else if (config.setting.interType === 'custom' && config.setting.procMode !== 'inner' && config.setting.preScripts && config.setting.preScripts.filter(item => item.status !== 'false').length === 0) { + return '鏁版嵁婧愭湭璁剧疆鍓嶇疆鑴氭湰锛屼笉鍙惎鐢紒' + } else if (config.setting.interType === 'custom' && config.setting.callbackType === 'script' && config.setting.cbScripts && config.setting.cbScripts.filter(item => item.status !== 'false').length === 0) { + return '鏁版嵁婧愭湭璁剧疆鍥炶皟鑴氭湰锛屼笉鍙惎鐢紒' } else if (!config.setting.primaryKey) { return '鑿滃崟灏氭湭璁剧疆涓婚敭锛屼笉鍙惎鐢紒' } else if (config.columns.length === 0) { @@ -1133,7 +1108,7 @@ const { menu } = this.props const { activeKey, config, chartview } = this.state - const confActions = config.action.filter(_action => !_action.origin && (['pop', 'popview', 'blank'].includes(_action.OpenType) || (_action.OpenType === 'tab' && _action.tabTemplate === 'FormTab'))) + const confActions = config.action.filter(_action => !_action.origin && (['pop', 'popview'].includes(_action.OpenType) || (_action.OpenType === 'tab' && _action.tabTemplate === 'FormTab') || (_action.OpenType === 'funcbutton' && _action.execMode === 'pop'))) let configTabs = [] config.tabgroups.forEach(group => { -- Gitblit v1.8.0