From 28ebe609e47b28794450cefc72d3e0f62fd904e7 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 09 五月 2022 01:04:19 +0800 Subject: [PATCH] 2022-05-09 --- src/templates/sharecomponent/actioncomponent/index.jsx | 116 ++++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 73 insertions(+), 43 deletions(-) diff --git a/src/templates/sharecomponent/actioncomponent/index.jsx b/src/templates/sharecomponent/actioncomponent/index.jsx index abfa8a0..9f3c992 100644 --- a/src/templates/sharecomponent/actioncomponent/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/index.jsx @@ -24,6 +24,7 @@ const VerifyCard = asyncSpinComponent(() => import('@/templates/zshare/verifycard')) const VerifyPrint = asyncSpinComponent(() => import('@/templates/sharecomponent/actioncomponent/verifyprint')) const VerifyExcelIn = asyncSpinComponent(() => import('@/templates/sharecomponent/actioncomponent/verifyexcelin')) +const VerifyMegvii = asyncSpinComponent(() => import('@/templates/sharecomponent/actioncomponent/verifymegvii')) const VerifyExcelOut = asyncSpinComponent(() => import('@/templates/sharecomponent/actioncomponent/verifyexcelout')) class ActionComponent extends Component { @@ -44,7 +45,8 @@ copying: false, // 鎸夐挳澶嶅埗涓� visible: false, // 妯℃�佹鎺у埗 printTemps: [], // 鍗曟嵁鎵撳嵃妯℃澘 - profVisible: false // 楠岃瘉淇℃伅妯℃�佹 + profVisible: false, // 楠岃瘉淇℃伅妯℃�佹 + record: null } /** @@ -58,7 +60,14 @@ componentDidMount () { this.getBillPrintTemp() + MKEmitter.addListener('revert', this.revert) MKEmitter.addListener('pasteButton', this.pasteButton) + } + + revert = () => { + this.setState({ + actionlist: fromJS(this.props.config.action).toJS() + }) } pasteButton = (MenuId, btn) => { @@ -178,7 +187,7 @@ this.setState({ visible: true, card: card, - formlist: getActionForm(card, this.props.config, usefulFields, this.props.type, menulist, this.state.printTemps) + formlist: getActionForm(card, this.props.config, usefulFields, this.props.type, menulist, this.state.printTemps, this.props.tabs) }) } @@ -847,16 +856,62 @@ this.setState = () => { return } + MKEmitter.removeListener('revert', this.revert) MKEmitter.removeListener('pasteButton', this.pasteButton) + } + + getVerify = (card) => { + const { config } = this.props + const { dict } = this.state + + if (!card) return null + + if (['pop', 'prompt', 'exec'].includes(card.OpenType)) { + return <VerifyCard + card={card} + dict={dict} + config={config} + columns={config.columns} + wrappedComponentRef={(inst) => this.verifyRef = inst} + /> + } else if (card.OpenType === 'excelIn') { + return <VerifyExcelIn + card={card} + dict={dict} + columns={config.columns} + wrappedComponentRef={(inst) => this.verifyRef = inst} + /> + } else if (card.OpenType === 'excelOut') { + return <VerifyExcelOut + card={card} + dict={dict} + config={config} + wrappedComponentRef={(inst) => this.verifyRef = inst} + /> + } else if (card.OpenType === 'funcbutton' && card.funcType === 'print') { + return <VerifyPrint + card={card} + dict={dict} + columns={config.columns} + wrappedComponentRef={(inst) => this.verifyRef = inst} + /> + } else if (card.OpenType === 'funcbutton' && card.funcType === 'megvii') { + return <VerifyMegvii + card={card} + dict={dict} + columns={config.columns} + wrappedComponentRef={(inst) => this.verifyRef = inst} + /> + } } render() { const { config } = this.props - const { actionlist, visible, card, dict, copying, profVisible } = this.state + const { actionlist, visible, card, dict, copying, profVisible, record } = this.state return ( <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']}> + <Tooltip placement="bottomLeft" overlayClassName="middle" title="鍦ㄥ乏渚у伐鍏锋爮銆婃寜閽�嬩腑锛岄�夋嫨瀵瑰簲绫诲瀷鐨勬寜閽嫋鑷虫澶勬坊鍔狅紝濡傞�夋嫨鎸夐挳绫诲瀷涓鸿〃鍗曘�佹柊鏍囩椤电瓑鍚湁閰嶇疆椤甸潰鐨勬寜閽紝鍙湪宸︿晶宸ュ叿鏍�-鎸夐挳-鍙厤缃寜閽锛岀偣鍑绘寜閽畬鎴愮浉鍏抽厤缃�傛敞锛氬綋璁剧疆鎸夐挳鏄剧ず浣嶇疆涓鸿〃鏍兼椂锛屾樉绀哄垪浼氬鍔犳搷浣滃垪銆�"> <QuestionCircleOutlined style={{color: '#c49f47', position: 'absolute', left: '5px', top: '5px'}} /> </Tooltip> <DragElement @@ -867,7 +922,6 @@ deleteMenu={this.deleteElement} profileMenu={this.profileAction} doubleClickCard={this.btnDoubleClick} - placeholder={dict['header.form.action.placeholder']} /> {/* 缂栬緫鎸夐挳锛氬鍒躲�佺紪杈� */} <Modal @@ -878,8 +932,8 @@ maskClosable={false} onCancel={this.editModalCancel} footer={[ - <CreateInterface key="interface" dict={dict} ref="btnCreatInterface" trigger={this.btnCreatInterface}/>, - <CreateFunc key="create" dict={dict} ref="btnCreatFunc" trigger={this.creatFunc}/>, + record && ['pop', 'exec', 'prompt'].includes(record.OpenType) && record.intertype === 'system' ? <CreateInterface key="interface" dict={dict} ref="btnCreatInterface" trigger={this.btnCreatInterface}/> : null, + record && record.intertype === 'inner' ? <CreateFunc key="create" dict={dict} ref="btnCreatFunc" trigger={this.creatFunc}/> : null, <Button key="cancel" onClick={this.editModalCancel}>{dict['model.cancel']}</Button>, <Button key="confirm" type="primary" loading={copying} onClick={this.handleSubmit}>{dict['model.confirm']}</Button> ]} @@ -888,10 +942,10 @@ <ActionForm dict={dict} card={card} - tabs={this.props.tabs} formlist={this.state.formlist} inputSubmit={this.handleSubmit} setting={config.setting} + updRecord={(record) => this.setState({record: fromJS(record).toJS()})} wrappedComponentRef={(inst) => this.actionFormRef = inst} /> </Modal> @@ -900,46 +954,22 @@ wrapClassName="model-table-action-verify-modal" title={(card && card.label ? card.label + ' - ' : '') + '楠岃瘉淇℃伅'} visible={profVisible} - width={'75vw'} + width={'90vw'} maskClosable={false} okText={dict['model.submit']} onOk={this.verifySubmit} - onCancel={() => { this.setState({ profVisible: false }) }} + onCancel={() => { + if (this.verifyRef.handleCancel) { + this.verifyRef.handleCancel().then(() => { + this.setState({ profVisible: false }) + }) + } else { + this.setState({ profVisible: false }) + } + }} destroyOnClose > - {card && !card.execMode && card.OpenType !== 'excelIn' && card.OpenType !== 'excelOut' ? - <VerifyCard - card={card} - dict={dict} - config={config} - columns={config.columns} - wrappedComponentRef={(inst) => this.verifyRef = inst} - /> : null - } - {card && card.execMode ? - <VerifyPrint - card={card} - dict={dict} - columns={config.columns} - wrappedComponentRef={(inst) => this.verifyRef = inst} - /> : null - } - {card && card.OpenType === 'excelIn' ? - <VerifyExcelIn - card={card} - dict={dict} - columns={config.columns} - wrappedComponentRef={(inst) => this.verifyRef = inst} - /> : null - } - {card && card.OpenType === 'excelOut' ? - <VerifyExcelOut - card={card} - dict={dict} - config={config} - wrappedComponentRef={(inst) => this.verifyRef = inst} - /> : null - } + {this.getVerify(card)} </Modal> </div> ) -- Gitblit v1.8.0