From 2ff464f30d94235b3ad04475593b75a74a354de9 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 09 四月 2020 19:04:01 +0800 Subject: [PATCH] 2020-04-09 --- src/templates/subtableconfig/index.jsx | 229 ++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 184 insertions(+), 45 deletions(-) diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index 4cb409d..8bab18e 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -8,6 +8,7 @@ import moment from 'moment' import Api from '@/api' +import options from '@/store/options.js' import zhCN from '@/locales/zh-CN/comtable.js' import enUS from '@/locales/en-US/comtable.js' import Utils from '@/utils/utils.js' @@ -416,12 +417,10 @@ * @description 鎼滅储鏉′欢缂栬緫锛岃幏鍙栨悳绱㈡潯浠惰〃鍗曚俊鎭� */ handleSearch = (card) => { - const { menu } = this.props - this.setState({ modaltype: 'search', card: card, - formlist: getSearchForm(card, menu.roleList) + formlist: getSearchForm(card, this.props.sysRoles) }) } @@ -449,11 +448,76 @@ const { menu } = this.props if (card.type !== 'colspan') { - this.setState({ - modaltype: 'columns', - card: card, - formlist: getColumnForm(card, menu.roleList) + let menulist = menu.fstMenuList.map(item => { + return { + value: item.MenuID, + label: item.text, + isLeaf: false + } }) + + if ((card.type === 'text' || card.type === 'number') && card.linkmenu && card.linkmenu.length > 0) { + let _param = { + func: 'sPC_Get_FunMenu', + ParentID: card.linkmenu[0], + systemType: options.systemType, + debug: 'Y' + } + + this.setState({ + loading: true + }) + + Api.getSystemConfig(_param).then(result => { + if (result.status) { + menulist = menulist.map(item => { + if (item.value === card.linkmenu[0]) { + item.children = result.data.map(item => { + let submenu = { + value: item.ParentID, + label: item.MenuNameP, + children: item.FunMenu.map(cell => { + return { + value: cell.MenuID, + label: cell.MenuName, + MenuID: cell.MenuID, + MenuName: cell.MenuName, + MenuNo: cell.MenuNo, + Ot: cell.Ot, + PageParam: cell.PageParam, + LinkUrl: cell.LinkUrl, + disabled: cell.MenuID === menu.MenuID + } + }) + } + + return submenu + }) + } + return item + }) + } else { + notification.warning({ + top: 92, + message: result.message, + duration: 10 + }) + } + + this.setState({ + loading: false, + modaltype: 'columns', + card: card, + formlist: getColumnForm(card, this.props.sysRoles, menulist) + }) + }) + } else { + this.setState({ + modaltype: 'columns', + card: card, + formlist: getColumnForm(card, this.props.sysRoles, menulist) + }) + } } else { this.setState({ modaltype: 'colspan', @@ -496,13 +560,41 @@ }) } + let fieldrepet = false // 瀛楁閲嶅 + let labelrepet = false // 鎻愮ず鏂囧瓧閲嶅 + let _search = config.search.map(item => { + if (item.uuid !== res.uuid && res.field && item.field) { + if (item.field === res.field) { + fieldrepet = true + } else if (item.label === res.label) { + labelrepet = true + } + } + if (item.uuid === res.uuid) { return res } else { return item } }) + + if (fieldrepet) { + notification.warning({ + top: 92, + message: '瀛楁宸插瓨鍦紒', + duration: 10 + }) + return + } else if (labelrepet) { + notification.warning({ + top: 92, + message: '鍚嶇О宸插瓨鍦紒', + duration: 10 + }) + return + } + _search = _search.filter(item => !item.origin) this.setState({ @@ -610,13 +702,41 @@ }) } else if (modaltype === 'columns' || modaltype === 'colspan') { this.columnFormRef.handleConfirm().then(res => { + let fieldrepet = false // 瀛楁閲嶅 + let labelrepet = false // 鎻愮ず鏂囧瓧閲嶅 + let _columns = config.columns.map(item => { + if (item.uuid !== res.uuid && res.field && item.field) { + if (item.field === res.field) { + fieldrepet = true + } else if (item.label === res.label) { + labelrepet = true + } + } + if (item.uuid === res.uuid) { return res } else { return item } }) + + if (fieldrepet) { + notification.warning({ + top: 92, + message: '瀛楁宸插瓨鍦紒', + duration: 10 + }) + return + } else if (labelrepet) { + notification.warning({ + top: 92, + message: '鍚嶇О宸插瓨鍦紒', + duration: 10 + }) + return + } + _columns = _columns.filter(item => !item.origin) this.setState({ @@ -831,20 +951,6 @@ return } - if (/[^\s]+\s+[^\s]+/ig.test(setting.dataresource) && config.setting.dataresource !== setting.dataresource) { - let param = { - func: 's_DataSrc_Save', - LText: setting.dataresource, - MenuID: config.uuid - } - - param.LText = Utils.formatOptions(param.LText) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - - Api.getLocalConfig(param) - } - let _config = {...config, setting: setting} let newLText = Utils.formatOptions(Utils.getTableFunc(setting, {MenuID: _config.uuid, MenuName: _config.tabName, MenuNo: _config.tabNo}, _config)) // 鍒涘缓瀛樺偍杩囩▼sql let DelText = Utils.formatOptions(Utils.dropfunc(setting.innerFunc)) // 鍒犻櫎瀛樺偍杩囩▼sql @@ -901,6 +1007,21 @@ profileVisible: true, card: element }) + } + + /** + * @description 鎸夐挳鍙屽嚮瑙﹀彂瀛愰厤缃� + */ + btnDoubleClick = (element) => { + if (!element.origin && (element.OpenType === 'pop' || element.OpenType === 'popview' || element.OpenType === 'blank' || element.OpenType === 'tab')) { + this.setSubConfig(element) + } else { + notification.warning({ + top: 92, + message: '姝ゆ寜閽棤瀛愰厤缃」锛�', + duration: 10 + }) + } } /** @@ -2014,6 +2135,35 @@ } /** + * @description 鍒涘缓鎸夐挳鎺ュ彛锛堝啓鍏ワ級 + */ + btnCreatInterface = () => { + const { config } = this.state + + this.menuformRef.handleConfirm().then(res => { + this.actionFormRef.handleConfirm().then(result => { + if (!['pop', 'exec', 'prompt'].includes(result) || result.funcType || result.intertype !== 'inner' || result.innerFunc ) { + notification.warning({ + top: 92, + message: '鎵撳紑鏂瑰紡涓� 寮圭獥锛堣〃鍗曪級銆佹彁绀烘鎴栫洿鎺ユ墽琛岋紝涓斾娇鐢ㄧ郴缁熷嚱鏁版椂锛屾墠鍙互鍒涘缓鎺ュ彛锛�', + duration: 10 + }) + return + } + + let _menu = { + type: 'subtable', + MenuID: config.uuid, + menuName: res.tabName, + menuNo: res.tabNo + } + + this.refs.btnCreatInterface.triggerInInterface(result, config, _menu) + }) + }) + } + + /** * @description 鍒涘缓琛ㄦ牸鎺ュ彛 */ tableCreatInterface = () => { @@ -2021,21 +2171,6 @@ this.menuformRef.handleConfirm().then(res => { this.settingRef.handleConfirm().then(setting => { - - if (/[^\s]+\s+[^\s]+/ig.test(setting.dataresource) && config.setting.dataresource !== setting.dataresource) { - let param = { - func: 's_DataSrc_Save', - LText: setting.dataresource, - MenuID: config.uuid - } - - param.LText = Utils.formatOptions(param.LText) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - - Api.getLocalConfig(param) - } - if (setting.interType !== 'inner' || setting.innerFunc) { notification.warning({ top: 92, @@ -2053,13 +2188,7 @@ menuNo: res.tabNo } - this.refs.tableCreatInterface.exec(_menu, _config).then(result => { - if (result === 'success') { - this.setState({ - config: _config - }) - } - }) + this.refs.tableCreatInterface.triggerOutInterface(_menu, _config) }) }) } @@ -2091,10 +2220,16 @@ } render () { - const { modaltype, activeKey } = this.state - const configAction = this.state.config.action.filter(_action => + const { modaltype, activeKey, config } = this.state + + const configAction = config.action.filter(_action => !_action.origin && (_action.OpenType === 'pop' || _action.OpenType === 'popview' || _action.OpenType === 'blank' || _action.OpenType === 'tab') ) + + let hasbtncrtinter = false + if (modaltype === 'actionEdit' && config.setting.interType === 'inner' && !config.setting.innerFunc && config.setting.dataresource) { + hasbtncrtinter = true + } return ( <div className="common-table-board"> @@ -2244,6 +2379,7 @@ copyElement={(val) => this.handleAction(val, 'copy')} deleteMenu={this.deleteElement} profileMenu={this.profileAction} + doubleClickCard={this.btnDoubleClick} placeholder={this.state.dict['header.form.action.placeholder']} /> </div> @@ -2295,6 +2431,7 @@ maskClosable={false} onCancel={this.editModalCancel} footer={[ + hasbtncrtinter ? <CreateInterface key="interface" dict={this.state.dict} ref="btnCreatInterface" trigger={this.btnCreatInterface}/> : null, modaltype === 'actionEdit' ? <CreateFunc key="create" dict={this.state.dict} ref="btnCreatFunc" trigger={this.creatFunc}/> : null, <Button key="cancel" onClick={this.editModalCancel}>{this.state.dict['header.cancel']}</Button>, <Button key="confirm" type="primary" onClick={this.handleSubmit}>{this.state.dict['header.confirm']}</Button> @@ -2324,6 +2461,7 @@ <ColumnForm dict={this.state.dict} card={this.state.card} + MenuID={this.props.menu.MenuID} inputSubmit={this.handleSubmit} formlist={this.state.formlist} wrappedComponentRef={(inst) => this.columnFormRef = inst} @@ -2506,6 +2644,7 @@ const mapStateToProps = (state) => { return { + sysRoles: state.sysRoles, permFuncField: state.permFuncField } } -- Gitblit v1.8.0