From 2cb65d99c9aebf8293cb2838fcfe3e09fb2739ce Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 06 十二月 2019 00:15:12 +0800 Subject: [PATCH] 2019-12-06 --- src/templates/comtableconfig/index.jsx | 110 +++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 74 insertions(+), 36 deletions(-) diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index 73a64e1..ab5751c 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -877,8 +877,7 @@ }) _this.setState({ config: _config, - [element.type + 'loading']: true, - visible: false + [element.type + 'loading']: true }, () => { _this.setState({ [element.type + 'loading']: false @@ -944,6 +943,25 @@ return } + let sql = [] + config.action.forEach((item, index) => { + sql.push(`'${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort`) + }) + sql = sql.join(' union all select ') + sql = 'select ' + sql + + sql = Utils.formatOptions(sql) + + let btnParam = { + func: 'sPC_Button_AddUpt', + ParentID: menu.MenuID, + MenuNo: res.menuNo, + Template: menu.PageParam.Template || '', + PageParam: '', + LongParam: '', + LongButton: sql + } + if (this.state.operaType === 'add') { // 鏂板缓鑿滃崟 let param = { func: 'sPC_TrdMenu_Add', @@ -955,6 +973,7 @@ PageParam: JSON.stringify(_pageParam), LongParam: _LongParam } + this.setState({ menuloading: true }) @@ -962,7 +981,6 @@ Api.getSystemConfig(param).then(response => { if (response.status) { this.setState({ - menuloading: false, operaType: 'edit', originMenu: { ...originMenu, @@ -973,11 +991,7 @@ ParentID: res.parentId } }) - notification.success({ - top: 92, - message: '淇濆瓨鎴愬姛', - duration: 10 - }) + this.submitAction(btnParam) } else { this.setState({ menuloading: false @@ -1006,26 +1020,17 @@ Api.getSystemConfig(param).then(response => { if (response.status) { - notification.success({ - top: 92, - message: '淇濆瓨鎴愬姛', - duration: 10 + this.setState({ + originMenu: { + ...originMenu, + LongParam: _config, + PageParam: _pageParam, + MenuName: res.menuName, + MenuNo: res.menuNo, + ParentID: res.parentId + } }) - if (this.state.closeVisible) { - this.props.handleConfig('') - } else { - this.setState({ - menuloading: false, - originMenu: { - ...originMenu, - LongParam: _config, - PageParam: _pageParam, - MenuName: res.menuName, - MenuNo: res.menuNo, - ParentID: res.parentId - } - }) - } + this.submitAction(btnParam) } else { this.setState({ menuloading: false @@ -1050,10 +1055,32 @@ /** * @description 淇濆瓨鎴栦慨鏀硅彍鍗曟寜閽� */ - submitAction = () => { - if (!is(fromJS(this.state.originActions), fromJS())) { - - } + submitAction = (param) => { + Api.getSystemConfig(param).then(response => { + if (response.status) { + notification.success({ + top: 92, + message: '淇濆瓨鎴愬姛', + duration: 10 + }) + if (this.state.closeVisible) { + this.props.handleConfig('') + } else { + this.setState({ + menuloading: false + }) + } + } else { + this.setState({ + menuloading: false + }) + notification.warning({ + top: 92, + message: response.message, + duration: 10 + }) + } + }) } cancelConfig = () => { @@ -1388,6 +1415,9 @@ }) } + /** + * @description 璁剧疆鍙厤缃寜閽� + */ setSubConfig = (btn) => { const { menu } = this.props const { config, originMenu } = this.state @@ -1422,16 +1452,24 @@ loading: true }) Api.getSystemConfig({ - func: 'sPC_Get_FrozenMenu', - ParentID: btn.uuid, - TYPE: 30 + func: 'sPC_Get_LongParam', + MenuID: btn.uuid }).then(res => { if (res.status) { - let btnconfig = '' this.setState({ loading: false }) - this.props.handleSubConfig(btn, originMenu, btnconfig) + let _LongParam = '' + if (res.LongParam) { + _LongParam = window.decodeURIComponent(window.atob(res.LongParam)) + try { + _LongParam = JSON.parse(_LongParam) + } catch (e) { + _LongParam = '' + } + } + + this.props.handleSubConfig(btn, originMenu, _LongParam) } else { this.setState({ loading: false -- Gitblit v1.8.0