From 407c0f1765c7d085218a91ad8842784977383d05 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 23 十月 2020 00:18:13 +0800 Subject: [PATCH] 2020-10-23 --- src/templates/sharecomponent/actioncomponent/index.jsx | 189 +++++++++++++++++++++-------------------------- 1 files changed, 84 insertions(+), 105 deletions(-) diff --git a/src/templates/sharecomponent/actioncomponent/index.jsx b/src/templates/sharecomponent/actioncomponent/index.jsx index 6abe036..1c9d9bc 100644 --- a/src/templates/sharecomponent/actioncomponent/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/index.jsx @@ -5,6 +5,7 @@ import moment from 'moment' import Api from '@/api' +import options from '@/store/options.js' import Utils from '@/utils/utils.js' import DevUtils from '@/utils/devutils.js' import zhCN from '@/locales/zh-CN/model.js' @@ -28,7 +29,6 @@ type: PropTypes.string, // 鑿滃崟绫诲瀷锛屼富琛ㄦ垨瀛愯〃 menu: PropTypes.object, // 鑿滃崟淇℃伅锛堣彍鍗昳d锛岃彍鍗曞弬鏁帮紝鑿滃崟鍚嶇О锛� config: PropTypes.object, // 鑿滃崟閰嶇疆淇℃伅 - menuformRef: PropTypes.any, // 鑿滃崟鍩烘湰淇℃伅琛ㄥ崟瀵硅薄 pasteContent: PropTypes.object, // 绮樿创閰嶇疆淇℃伅 usefulFields: PropTypes.array, // 鑷畾涔夊嚱鏁板彲鐢ㄥ瓧娈� tabs: PropTypes.array, // 鎵�鏈夋爣绛� @@ -86,20 +86,84 @@ } /** - * @description 鎼滅储鏉′欢缂栬緫锛岃幏鍙栨悳绱㈡潯浠惰〃鍗曚俊鎭� + * @description 鎸夐挳缂栬緫锛岃幏鍙栨寜閽〃鍗曚俊鎭� */ handleAction = (card) => { + const { menu } = this.props let ableField = this.props.usefulFields.join(', ') let functip = <div> <p style={{marginBottom: '5px'}}>{this.state.dict['model.tooltip.func.innerface'].replace('@ableField', ableField)}</p> <p>{this.state.dict['model.tooltip.func.outface']}</p> </div> - this.setState({ - visible: true, - card: card, - formlist: getActionForm(card, functip, this.props.config, this.props.usefulFields, this.props.type) - }) + let menulist = [] + if (menu.fstMenuList) { + menulist = menu.fstMenuList.map(item => { + return { + value: item.MenuID, + label: item.text, + isLeaf: false + } + }) + } + + if (menu.fstMenuList && card.linkmenu && card.linkmenu.length > 0) { + let _param = { + func: 'sPC_Get_FunMenu', + ParentID: card.linkmenu[0], + systemType: options.sysType, + debug: 'Y' + } + + 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: 5 + }) + } + + this.setState({ + visible: true, + card: card, + formlist: getActionForm(card, functip, this.props.config, this.props.usefulFields, this.props.type, menulist) + }) + }) + } else { + this.setState({ + visible: true, + card: card, + formlist: getActionForm(card, functip, this.props.config, this.props.usefulFields, this.props.type, menulist) + }) + } } /** @@ -134,14 +198,9 @@ * 4銆佷笅鎷夎彍鍗曟暟鎹簮璇硶楠岃瘉 */ handleSubmit = () => { - const { config, menuformRef } = this.props + const { config, menu } = this.props const { card } = this.state let _actionlist = fromJS(this.state.actionlist).toJS() - let menu = fromJS(this.props.menu).toJS() // 鑿滃崟淇℃伅锛屽瓨鍦ㄨ〃鍗曞璞℃椂锛屼粠鑿滃崟涓洿鏂� - - if (menuformRef) { - menu = {...menu, MenuName: menuformRef.props.form.getFieldValue('MenuName'), MenuNo: menuformRef.props.form.getFieldValue('MenuNo')} - } this.actionFormRef.handleConfirm().then(btn => { _actionlist = _actionlist.filter(item => !item.origin || item.uuid === btn.uuid) @@ -437,7 +496,7 @@ btnParam.LText = btnParam.LText.join(' union all ') btnParam.LText = Utils.formatOptions(btnParam.LText) - btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_tab))) @@ -546,8 +605,6 @@ confirm({ content: dict['model.confirm'] + dict['model.delete'] + ` - ${card.label} 锛焋, - okText: dict['model.confirm'], - cancelText: this.state.dict['header.cancel'], onOk() { let _actionlist = fromJS(_this.state.actionlist).toJS() @@ -606,7 +663,6 @@ this.verifyRef.handleConfirm().then(res => { let _actionlist = fromJS(this.state.actionlist).toJS() - _actionlist = _actionlist.filter(item => !item.origin || item.uuid === card.uuid) _actionlist = _actionlist.map(item => { @@ -630,50 +686,19 @@ * @description 鍒涘缓鎸夐挳瀛樺偍杩囩▼ */ creatFunc = () => { - const { config, menuformRef } = this.props + const { menu } = this.props let _config = fromJS(this.props.config).toJS() - let menu = fromJS(this.props.menu).toJS() // 鑿滃崟淇℃伅锛屽瓨鍦ㄨ〃鍗曞璞℃椂锛屼粠鑿滃崟涓洿鏂� - - if (menuformRef) { - menu = {...menu, MenuName: menuformRef.props.form.getFieldValue('MenuName'), MenuNo: menuformRef.props.form.getFieldValue('MenuNo')} - } this.actionFormRef.handleConfirm().then(res => { let btn = res // 鎸夐挳淇℃伅 let newLText = '' // 鍒涘缓瀛樺偍杩囩▼sql let DelText = '' // 鍒犻櫎瀛樺偍杩囩▼sql - let _actionlist = fromJS(this.state.actionlist).toJS() - - _actionlist = _actionlist.filter(item => !item.origin || item.uuid === btn.uuid) - - let labelrepet = false - _actionlist = _actionlist.map(item => { - if (item.uuid !== btn.uuid && item.label === btn.label) { - labelrepet = true - } - - if (item.uuid === btn.uuid) { - return btn - } else { - return item - } - }) - - if (labelrepet) { - notification.warning({ - top: 92, - message: this.state.dict['model.name.exist'] + ' !', - duration: 5 - }) - return - } - // 鍒涘缓瀛樺偍杩囩▼锛屽繀椤诲~鍐欏唴閮ㄥ嚱鏁板悕 - if (!btn.innerFunc) { + if (btn.intertype !== 'inner') { notification.warning({ top: 92, - message: '璇峰~鍐欏唴閮ㄥ嚱鏁帮紒', + message: '浣跨敤鍐呴儴鍑芥暟鏃讹紝鎵嶅彲浠ュ垱寤哄瓨鍌ㄨ繃绋嬶紒', duration: 5 }) return @@ -765,35 +790,7 @@ }).then(res => { if (!res) return - this.refs.btnCreatFunc.exec(btn.innerFunc, newLText, DelText).then(result => { - if (result !== 'success') return - - // 鍒ゆ柇鏄惁瀛樺湪鎿嶄綔鍒� - let _hasGridbtn = _actionlist.filter(act => act.position === 'grid').length > 0 - let _gridBtn = config.gridBtn ? fromJS(config.gridBtn).toJS() : null - - if (_gridBtn) { - _gridBtn.display = _hasGridbtn - } else { - _gridBtn = { - display: _hasGridbtn, - Align: 'center', - IsSort: 'false', - uuid: Utils.getuuid(), - label: this.state.dict['model.form.column.action'], - type: 'action', - style: 'button', - show: 'horizontal', - Width: 120 - } - } - - this.setState({ - actionlist: _actionlist - }, () => { - this.props.updateaction({...config, action: _actionlist, gridBtn: _gridBtn}) - }) - }) + this.refs.btnCreatFunc.exec(btn.innerFunc, newLText, DelText) }) }) } @@ -802,22 +799,9 @@ * @description 鍒涘缓鎸夐挳鎺ュ彛锛堝啓鍏ワ級 */ btnCreatInterface = () => { - const { config, type, menuformRef } = this.props - let menu = fromJS(this.props.menu).toJS() // 鑿滃崟淇℃伅锛屽瓨鍦ㄨ〃鍗曞璞℃椂锛屼粠鑿滃崟涓洿鏂� - - if (menuformRef) { - menu = {...menu, MenuName: menuformRef.props.form.getFieldValue('MenuName'), MenuNo: menuformRef.props.form.getFieldValue('MenuNo')} - } + const { config, type, menu } = this.props this.actionFormRef.handleConfirm().then(result => { - if (result.Ot === 'requiredOnce') { - notification.warning({ - top: 92, - message: '澶氳鎷兼帴鏃讹紝涓嶅彲鍒涘缓鎺ュ彛锛�', - duration: 5 - }) - return - } let _menu = { type: type, MenuID: menu.MenuID, @@ -861,13 +845,8 @@ const { config } = this.props const { actionlist, visible, card, dict, copying, profVisible } = this.state - let hasbtncrtinter = false - if (card && !card.copyType && config.setting.interType === 'inner' && !config.setting.innerFunc && config.setting.dataresource) { - hasbtncrtinter = true - } - return ( - <div className="model-table-action-list" style={config.charts.length > 1 ? {paddingTop: 15} : null}> + <div className="model-table-action-list" style={config.charts.length > 1 ? {paddingTop: 25} : null}> <Tooltip placement="bottomLeft" overlayClassName="middle" title={dict['model.tooltip.action.guide']}> <Icon type="question-circle" /> </Tooltip> @@ -889,9 +868,9 @@ maskClosable={false} onCancel={this.editModalCancel} footer={[ - hasbtncrtinter ? <CreateInterface key="interface" dict={dict} ref="btnCreatInterface" trigger={this.btnCreatInterface}/> : null, - card && !card.copyType ? <CreateFunc key="create" dict={dict} ref="btnCreatFunc" trigger={this.creatFunc}/> : null, - <Button key="cancel" onClick={this.editModalCancel}>{dict['header.cancel']}</Button>, + <CreateInterface key="interface" dict={dict} ref="btnCreatInterface" trigger={this.btnCreatInterface}/>, + <CreateFunc key="create" dict={dict} ref="btnCreatFunc" trigger={this.creatFunc}/>, + <Button key="cancel" onClick={this.editModalCancel}>{dict['model.cancel']}</Button>, <Button key="confirm" type="primary" loading={copying} onClick={this.handleSubmit}>{dict['model.confirm']}</Button> ]} destroyOnClose @@ -914,14 +893,13 @@ width={'75vw'} maskClosable={false} style={{minWidth: '900px', maxWidth: '1200px'}} - okText={dict['header.submit']} + okText={dict['model.submit']} onOk={this.verifySubmit} onCancel={() => { this.setState({ profVisible: false }) }} destroyOnClose > {card && !card.execMode && card.OpenType !== 'excelIn' && card.OpenType !== 'excelOut' ? <VerifyCard - floor={this.props.type} card={card} dict={dict} config={config} @@ -949,6 +927,7 @@ <VerifyExcelOut card={card} dict={dict} + config={config} wrappedComponentRef={(inst) => this.verifyRef = inst} /> : null } -- Gitblit v1.8.0