From 34e7681fd12b1c4e4994d3bea1a553870e10bc50 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 11 三月 2023 17:58:54 +0800 Subject: [PATCH] 2023-03-11 --- src/templates/comtableconfig/index.jsx | 191 ++++++++++++++++------------------------------- 1 files changed, 67 insertions(+), 124 deletions(-) diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index 6717638..62ac181 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -28,6 +28,7 @@ const Versions = asyncComponent(() => import('@/menu/versions')) const UrlFieldComponent = asyncComponent(() => import('@/menu/urlfieldcomponent')) const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) +const UpdateTable = asyncComponent(() => import('./updatetable')) const Unattended = asyncComponent(() => import('@/templates/zshare/unattended')) const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) const SettingComponent = asyncComponent(() => import('@/templates/sharecomponent/settingcomponent')) @@ -57,11 +58,9 @@ delActions: [], // 鍒犻櫎鎸夐挳鍒楄〃 copyActions: [], // 澶嶅埗鎸夐挳缁� tabviews: [], // 鎵�鏈夋爣绛鹃〉 - thawButtons: [], // 宸查�夋嫨瑕佽В鍐荤殑鎸夐挳 activeKey: '0', // 榛樿灞曞紑鍩烘湰淇℃伅 chartview: null, // 褰撳墠瑙嗗浘 openEdition: '', // 缂栬緫鐗堟湰鏍囪锛岄槻姝㈠浜烘搷浣� - modalStatus: false // 寮圭獥鏄惁寮�鍚紝鍒ゆ柇ctrl+s鏄惁鍙敤 } /** @@ -163,10 +162,23 @@ let _shortcut = `${preKey}+${keyCode}` if (_shortcut === 'ctrl+83') { - if (this.state.modalStatus) { + let modals = document.querySelectorAll('.mk-pop-modal') + let msg = null + for (let i = 0; i < modals.length; i++) { + if (msg) { + break + } + + let node = modals[i].querySelector('.mk-com-name') + + if (node) { + msg = node.innerText + } + } + if (msg) { notification.warning({ top: 92, - message: '璇蜂繚瀛�' + this.state.modalStatus, + message: '璇蜂繚瀛�' + msg, duration: 5 }) return false @@ -179,8 +191,6 @@ return false } } - - MKEmitter.addListener('modalStatus', this.modalStatus) } /** @@ -191,11 +201,6 @@ return } document.onkeydown = () => {} - MKEmitter.removeListener('modalStatus', this.modalStatus) - } - - modalStatus = (val) => { - this.setState({modalStatus: val}) } /** @@ -288,7 +293,7 @@ */ submitConfig = () => { const { menu } = this.props - const { delActions, thawButtons, openEdition } = this.state + const { delActions, openEdition } = this.state let _config = fromJS(this.state.config).toJS() @@ -374,7 +379,7 @@ } let _sort = 0 - let btntabs = [] + // let btntabs = [] let btnParam = { // 娣诲姞鑿滃崟鎸夐挳 func: 'sPC_Button_AddUpt', @@ -390,14 +395,14 @@ _config.action.forEach(item => { if (item.hidden === 'true') return _sort++ - if (item.OpenType === 'popview') { - btntabs.push({ - uuid: item.uuid, - linkTab: item.linkTab, - label: item.label, - sort: _sort - }) - } + // if (item.OpenType === 'popview') { + // btntabs.push({ + // uuid: item.uuid, + // linkTab: item.linkTab, + // label: item.label, + // sort: _sort + // }) + // } btnParam.LText.push(`select '${item.uuid}' as menuid, '${item.label}' as menuname, '${_sort * 10}' as Sort`) }) @@ -407,33 +412,33 @@ btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) - let tabParam = { // 娣诲姞鑿滃崟tab椤� - func: 'sPC_sMenusTab_AddUpt', - MenuID: menu.MenuID - } + // let tabParam = { // 娣诲姞鑿滃崟tab椤� + // func: 'sPC_sMenusTab_AddUpt', + // MenuID: menu.MenuID + // } - let _LText = [] + // let _LText = [] - btntabs.forEach(item => { - _LText.push(`select '${item.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${item.sort * 10}' as Sort`) - }) - _config.tabgroups.forEach(group => { - group.sublist.forEach(item => { - _sort++ - _LText.push(`select '${menu.MenuID}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${_sort * 10}' as Sort`) - }) - }) + // btntabs.forEach(item => { + // _LText.push(`select '${item.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${item.sort * 10}' as Sort`) + // }) + // _config.tabgroups.forEach(group => { + // group.sublist.forEach(item => { + // _sort++ + // _LText.push(`select '${menu.MenuID}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${_sort * 10}' as Sort`) + // }) + // }) - _LText = _LText.join(' union all ') + // _LText = _LText.join(' union all ') // 娓呯┖鑿滃崟涓嬪叧鑱旂殑鏍囩 - if (!_LText) { - _LText = `select '${menu.MenuID}' as MenuID ,'' as Tabid,'' as TabName ,'0' as Sort` - } + // if (!_LText) { + // _LText = `select '${menu.MenuID}' as MenuID ,'' as Tabid,'' as TabName ,'0' as Sort` + // } - tabParam.LText = Utils.formatOptions(_LText) - tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) + // tabParam.LText = Utils.formatOptions(_LText) + // tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + // tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) let _vals = this.getFuncNames(_config) @@ -532,26 +537,7 @@ }).then(resp => { if (resp === false) return - if (thawButtons.length > 0) { - let defers = thawButtons.map(item => { - return new Promise((resolve) => { - Api.getSystemConfig({ - func: 'sPC_MainMenu_ReDel', - MenuID: item - }).then(res => { - if (res.status) { - resolve('') - } else { - resolve(res.message) - } - }) - }) - }) - - return Promise.all(defers) - } else { - return true - } + return true }).then(res => { if (res === true || res === false) return res @@ -564,9 +550,6 @@ }) return false } else { - this.setState({ - thawButtons: [] - }) return true } }).then(resp => { @@ -590,7 +573,7 @@ delete localParam.EasyCode delete localParam.open_edition - this.submitAction(btnParam, tabParam, localParam) + this.submitAction(btnParam, localParam) } else { this.setState({ menuloading: false, @@ -610,52 +593,29 @@ /** * @description 淇濆瓨鎴栦慨鏀硅彍鍗曟寜閽泦 */ - submitAction = (btnParam, tabParam, localParam) => { + submitAction = (btnParam, localParam) => { const { config } = this.state new Promise(resolve => { - let deffers = [] - - let defer = new Promise(resolve => { - Api.getSystemConfig(tabParam).then(result => { - resolve(result) - }) - }) - deffers.push(defer) - if (btnParam.LText) { - let defer = new Promise(resolve => { - Api.getSystemConfig(btnParam).then(result => { - if (result.status) { - this.setState({ // 淇濆瓨鎴愬姛鍚庢竻绌哄鍒跺垪琛� - copyActions: [] - }) - } + Api.getSystemConfig(btnParam).then(result => { + if (result.status) { + this.setState({ // 淇濆瓨鎴愬姛鍚庢竻绌哄鍒跺垪琛� + copyActions: [] + }) resolve(result) - }) - }) - deffers.push(defer) - } - - Promise.all(deffers).then(result => { - let error = false - result.forEach(res => { - if (!res.status) { - error = res + } else { + notification.warning({ + top: 92, + message: result.message, + duration: 5 + }) + resolve(false) } }) - - if (error) { - notification.warning({ - top: 92, - message: error.message, - duration: 5 - }) - resolve(false) - } else { - resolve(true) - } - }) + } else { + resolve(true) + } }).then(response => { if (response === false) return response @@ -969,23 +929,6 @@ }) 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, @@ -1035,7 +978,6 @@ */ editConfig = (res) => { this.setState({ - thawButtons: res.thawButtons, config: res.config }) } @@ -1261,7 +1203,8 @@ <Unattended config={config} updateConfig={this.updateconfig}/> <Versions MenuId={menu.MenuID} open_edition={openEdition} updateConfig={this.refreshConfig}/> <ReplaceField type="table" config={config} updateConfig={this.updateconfig}/> - <EditComponent type="table" options={['search', 'form', 'action', 'columns']} config={this.state.config} MenuID={this.props.menu.MenuID} thawButtons={this.state.thawButtons} refresh={this.editConfig}/> + <EditComponent type="table" options={['search', 'form', 'action', 'columns']} config={this.state.config} refresh={this.editConfig}/> + <UpdateTable config={config}/> <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>淇濆瓨</Button> <Button onClick={this.cancelConfig}>鍏抽棴</Button> -- Gitblit v1.8.0