From c7df5603e14b98d6f80da425fab31d30574ca417 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 22 一月 2021 19:10:18 +0800 Subject: [PATCH] 2021-01-22 --- src/templates/zshare/verifycard/index.jsx | 132 +++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 124 insertions(+), 8 deletions(-) diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index fab8318..d93f37e 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -11,6 +11,7 @@ import ContrastForm from './contrastform' import CustomForm from './customform' import CustomScript from './customscript' +import CallBackCustomScript from './callbackcustomscript' import BillcodeForm from './billcodeform' import VoucherForm from './voucherform' import asyncComponent from '@/utils/asyncComponent' @@ -355,6 +356,73 @@ </div>) } ], + cbScriptsColumns: [ + { + title: 'SQL', + dataIndex: 'sql', + width: '60%', + render: (text) => { + let title = text.match(/^\s*\/\*.+\*\//) + title = title && title[0] ? title[0] : '' + text = title ? text.replace(title, '') : text + + return ( + <div> + {title ? <span style={{color: '#a50'}}>{title}</span> : null} + <Paragraph copyable ellipsis={{ rows: 4, expandable: true }}>{text}</Paragraph> + </div> + ) + } + }, + { + title: '鎵ц浣嶇疆', + dataIndex: 'position', + width: '10%', + render: (text, record) => { + if (record.position === 'front') { + return 'sql鍓�' + } else { + return 'sql鍚�' + } + } + }, + { + title: '鐘舵��', + dataIndex: 'status', + width: '10%', + render: (text, record) => record.status === 'false' ? + ( + <div> + {this.props.dict['model.status.forbidden']} + <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" /> + </div> + ) : + ( + <div> + {this.props.dict['model.status.open']} + <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" /> + </div> + ) + }, + { + title: '鎿嶄綔', + align: 'center', + width: '20%', + dataIndex: 'operation', + render: (text, record) => + (<div style={{textAlign: 'center'}}> + <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'cbscripts')} style={{color: '#1890ff'}}><Icon type="edit" /></span> + <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'cbscripts')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> + <Popconfirm + overlayClassName="popover-confirm" + title={this.props.dict['model.query.delete']} + onConfirm={() => this.handleDelete(record, 'cbscripts') + }> + <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> + </Popconfirm> + </div>) + } + ], orderColumns: [ { title: this.props.dict['header.form.funcvar'], @@ -485,10 +553,15 @@ _verify.billcodes = _verify.billcodes || [] _verify.voucher = _verify.voucher || {enabled: false} _verify.scripts = _verify.scripts || [] + _verify.cbScripts = _verify.cbScripts || [] this.setState({ verify: _verify }) + + if (config.Template !== 'FormTab' && (card.intertype === 'inner' || card.intertype === 'outer')) { // 鍐呴儴鎴栧閮ㄦ帴鍙� + return + } new Promise(resolve => { let _fields = [] @@ -523,11 +596,7 @@ } if (!_LongParam) { - notification.warning({ - top: 92, - message: '鏈幏鍙栧埌琛ㄥ崟淇℃伅锛岄儴鍒嗛獙璇佸皢鏃犳硶璁剧疆锛�', - duration: 5 - }) + message.warning('鏈幏鍙栧埌琛ㄥ崟淇℃伅锛岄儴鍒嗛獙璇佸皢鏃犳硶璁剧疆锛�') } else { if (_LongParam.groups.length > 0) { _LongParam.groups.forEach(group => { @@ -989,6 +1058,25 @@ this.setState({ verify }) } + cbScriptsChange = (values) => { + let verify = fromJS(this.state.verify).toJS() + + if (values.uuid) { + verify.cbScripts = verify.cbScripts.map(item => { + if (item.uuid === values.uuid) { + return values + } else { + return item + } + }) + } else { + values.uuid = Utils.getuuid() + verify.cbScripts.push(values) + } + + this.setState({ verify }) + } + orderChange = (values) => { let verify = fromJS(this.state.verify).toJS() @@ -1050,6 +1138,8 @@ verify.billcodes = verify.billcodes.filter(item => item.uuid !== record.uuid) } else if (type === 'scripts') { verify.scripts = verify.scripts.filter(item => item.uuid !== record.uuid) + } else if (type === 'cbscripts') { + verify.cbScripts = verify.cbScripts.filter(item => item.uuid !== record.uuid) } this.setState({ verify }) @@ -1062,6 +1152,8 @@ this.orderForm.edit(record) } else if (type === 'scripts') { this.scriptsForm.edit(record) + } else if (type === 'cbscripts') { + this.cbscriptsForm.edit(record) } let node = document.getElementById('verify-card-box-tab').parentNode @@ -1102,6 +1194,14 @@ }) } else if (type === 'scripts') { verify.scripts = verify.scripts.map(item => { + if (item.uuid === record.uuid) { + return record + } else { + return item + } + }) + } else if (type === 'cbscripts') { + verify.cbScripts = verify.cbScripts.map(item => { if (item.uuid === record.uuid) { return record } else { @@ -1267,7 +1367,7 @@ render() { const { card } = this.props - const { verify, fields, uniqueFields, uniqueColumns, unionFields, onceUniqueColumns, columnsFields, contrastColumns, customColumns, orderColumns, scriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail, notes } = this.state + const { verify, fields, uniqueFields, uniqueColumns, unionFields, onceUniqueColumns, columnsFields, contrastColumns, customColumns, orderColumns, scriptsColumns, cbScriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail, notes } = this.state const formItemLayout = { labelCol: { xs: { span: 24 }, @@ -1281,7 +1381,7 @@ return ( <div id="verify-card-box-tab"> - {card.intertype === 'system' ? <Tabs defaultActiveKey="1" className="verify-card-box"> + {card.intertype === 'system' || card.intertype === 'custom' ? <Tabs defaultActiveKey="1" className="verify-card-box"> <TabPane tab="鍩虹楠岃瘉" key="1"> <Form {...formItemLayout}> <Row gutter={24}> @@ -1482,6 +1582,22 @@ /> <EditTable actions={['move']} data={verify.scripts} columns={scriptsColumns} onChange={(scripts) => {this.setState({verify: {...verify, scripts}})}}/> </TabPane> + {card.callbackType === 'script' && card.intertype === 'custom' ? <TabPane tab={ + <span> + 鍥炶皟鑴氭湰 + {verify.cbScripts.length ? <span className="count-tip">{verify.cbScripts.length}</span> : null} + </span> + } key="6a"> + <CallBackCustomScript + dict={this.props.dict} + btn={this.props.card} + customScripts={verify.cbScripts} + systemScripts={this.state.systemScripts} + scriptsChange={this.cbScriptsChange} + wrappedComponentRef={(inst) => this.cbscriptsForm = inst} + /> + <EditTable actions={['move']} data={verify.cbScripts} columns={cbScriptsColumns} onChange={(cbScripts) => {this.setState({verify: {...verify, cbScripts}})}}/> + </TabPane> : null} <TabPane tab="淇℃伅鎻愮ず" key="7"> <Form {...formItemLayout}> <Row gutter={24}> @@ -1570,7 +1686,7 @@ </Form> </TabPane> </Tabs> : null} - {card.intertype !== 'system' ? <Tabs defaultActiveKey="7" className="verify-card-box"> + {card.intertype !== 'system' && card.intertype !== 'custom' ? <Tabs defaultActiveKey="7" className="verify-card-box"> <TabPane tab="淇℃伅鎻愮ず" key="7"> <Form {...formItemLayout}> <Row gutter={24}> -- Gitblit v1.8.0