| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Row, Col, Select, Radio, Tooltip, Input, notification } from 'antd' |
| | | import { Form, Row, Col, Select, Radio, Tooltip, Input } from 'antd' |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | |
| | | import Api from '@/api' |
| | | import MkPrintTemps from '@/menu/components/share/actioncomponent/actionform/mkPrintTemps' |
| | | import CodeMirror from '@/templates/zshare/codemirror' |
| | | import './index.scss' |
| | | |
| | | const sysTempsIds = ['8IFltwzyKcu15iA8fqSyb6m-pMa88a3ZTu0No3vDHgo', 'LOB-bbt9jVncGh7IOAUdESh1Sgzcbt62UwOqSqcK9ok'] |
| | |
| | | verify: PropTypes.object, |
| | | unionFields: PropTypes.array, |
| | | notes: PropTypes.array, |
| | | emailCodes: PropTypes.array, |
| | | appType: PropTypes.any, |
| | | onChange: PropTypes.func |
| | | } |
| | |
| | | let error = '' |
| | | if (verify.noteEnable === 'true' && !verify.noteCode) { // 开启短信时,需要模板编码 |
| | | error = '开启短信时,需要选择短信模板!' |
| | | } else if (verify.emailEnable === 'true' && !verify.emailCode) { |
| | | error = '开启邮件发送时,需要选择邮件模板!' |
| | | } else if (verify.printEnable === 'true' && !verify.printTempId) { |
| | | error = '使用单据打印时,需要选择打印模板!' |
| | | } else if (verify.accountdate === 'true' && !verify.accountfield) { |
| | | error = '开启账期时,需要选择验证公司!' |
| | | } else if (verify.preHandle === 'true' && !verify.pre_func) { |
| | | error = '开启按钮预处理时,需要填写处理函数!' |
| | | } else if (verify.wxNote === 'true') { |
| | | if (!verify.wxTemplateId) { |
| | | error = '开启公众号消息推送时,需要选择消息模板!' |
| | |
| | | } |
| | | |
| | | onOptionChange = (value, key) => { |
| | | const { verify, setting } = this.props |
| | | const { verify } = this.props |
| | | |
| | | let _verify = {...verify, [key]: value} |
| | | |
| | | if (_verify.noteEnable !== 'true') { |
| | | _verify.noteCode = '' |
| | | _verify.noteId = '' |
| | | } |
| | | if (_verify.emailEnable !== 'true') { |
| | | _verify.emailCode = '' |
| | | _verify.emailId = '' |
| | | } |
| | | if (_verify.printEnable !== 'true') { |
| | | _verify.printTempId = '' |
| | |
| | | if (_verify.accountdate !== 'true') { |
| | | _verify.accountfield = '' |
| | | _verify.voucherdate = '' |
| | | } |
| | | if (_verify.preHandle !== 'true') { |
| | | _verify.pre_func = '' |
| | | } |
| | | if (_verify.wxNote !== 'true') { |
| | | _verify.wxTemplateId = '' |
| | |
| | | } |
| | | } |
| | | |
| | | if (verify.invalid !== 'true' && _verify.invalid === 'true' && setting.maxScript && setting.maxScript >= 300) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '数据源中自定义脚本过于复杂,不能使用失效验证!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.props.onChange(_verify) |
| | | } |
| | | |
| | |
| | | const { verify } = this.props |
| | | |
| | | let _verify = {...verify, noteCode: val, noteId: option.props.id} |
| | | |
| | | this.props.onChange(_verify) |
| | | } |
| | | |
| | | onEmailCodeChange = (val, option) => { |
| | | const { verify } = this.props |
| | | |
| | | let _verify = {...verify, emailCode: val, emailId: option.props.id} |
| | | |
| | | this.props.onChange(_verify) |
| | | } |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { unionFields, verify, notes, card, appType, columns } = this.props |
| | | const { unionFields, verify, notes, emailCodes, card, appType, columns } = this.props |
| | | const { wxTemps, selectTemp } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {card.intertype !== 'inner' ? <Col span={8}> |
| | | <Form.Item label={'失效验证'}> |
| | | <Radio.Group value={verify.invalid} onChange={(e) => {this.onOptionChange(e.target.value, 'invalid')}}> |
| | | <Form.Item label={ |
| | | verify.limitText ? <Tooltip placement="bottomLeft" title={verify.limitText}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 失效验证 |
| | | </Tooltip> : '失效验证' |
| | | }> |
| | | <Radio.Group value={verify.invalid} disabled={verify.limitInvalid} onChange={(e) => {this.onOptionChange(e.target.value, 'invalid')}}> |
| | | <Radio value="true">开启</Radio> |
| | | <Radio value="false">不开启</Radio> |
| | | </Radio.Group> |
| | |
| | | 短信模板 |
| | | </Tooltip> |
| | | } required> |
| | | <Select value={verify.noteCode} onSelect={this.onNoteCodeChange}> |
| | | <Select value={verify.noteCode || ''} onSelect={this.onNoteCodeChange}> |
| | | {notes.map(option => |
| | | <Select.Option key={option.value} id={option.id} value={option.value}> |
| | | {option.name} |
| | |
| | | 发送方式 |
| | | </Tooltip> |
| | | }> |
| | | <Radio.Group value={verify.noteType} onChange={(e) => {this.onOptionChange(e.target.value, 'noteType')}}> |
| | | <Radio.Group value={verify.noteType || 'N'} onChange={(e) => {this.onOptionChange(e.target.value, 'noteType')}}> |
| | | <Radio value="Y">实时</Radio> |
| | | <Radio value="N">定时</Radio> |
| | | </Radio.Group> |
| | |
| | | 短信内容 |
| | | </Tooltip> |
| | | }> |
| | | <Radio.Group value={verify.noteTemp} onChange={(e) => {this.onOptionChange(e.target.value, 'noteTemp')}}> |
| | | <Radio.Group value={verify.noteTemp || 'Y'} onChange={(e) => {this.onOptionChange(e.target.value, 'noteTemp')}}> |
| | | <Radio value="Y">相同</Radio> |
| | | <Radio value="N">不同</Radio> |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={24}></Col> |
| | | <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="bottomLeft" title={'选择发送邮件时,需完善邮件设置。'}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 发送邮件 |
| | | </Tooltip> |
| | | }> |
| | | <Radio.Group value={verify.emailEnable} onChange={(e) => {this.onOptionChange(e.target.value, 'emailEnable')}}> |
| | | <Radio value="true">开启</Radio> |
| | | <Radio value="false">不开启</Radio> |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> |
| | | {verify.emailEnable === 'true' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="bottomLeft" title={<span>邮件模板添加地址:<a target="_blank" rel="noopener noreferrer" href="https://cloud.mk9h.cn/admin/index.html">云中心</a>->应用服务->开发者中心->邮件模板。</span>}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 邮件模板 |
| | | </Tooltip> |
| | | } required> |
| | | <Select value={verify.emailCode || ''} onSelect={this.onEmailCodeChange}> |
| | | {emailCodes.map(option => |
| | | <Select.Option key={option.value} id={option.id} value={option.value}> |
| | | {option.name} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {verify.emailEnable === 'true' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="bottomLeft" title={'实时发送最多同时发送5个用户,定时发送最多同时发送100个用户。'}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 发送方式 |
| | | </Tooltip> |
| | | }> |
| | | <Radio.Group value={verify.emailType || 'N'} onChange={(e) => {this.onOptionChange(e.target.value, 'emailType')}}> |
| | | <Radio value="Y">实时</Radio> |
| | | <Radio value="N">定时</Radio> |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {verify.emailEnable === 'true' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="bottomLeft" title={'当向多个用户发送短信时,短信内容是否相同。'}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 邮件内容 |
| | | </Tooltip> |
| | | }> |
| | | <Radio.Group value={verify.emailTemp || 'Y'} onChange={(e) => {this.onOptionChange(e.target.value, 'emailTemp')}}> |
| | | <Radio value="Y">相同</Radio> |
| | | <Radio value="N">不同</Radio> |
| | | </Radio.Group> |
| | |
| | | </div> |
| | | </div> |
| | | </Col> : null} |
| | | <Col span={24}></Col> |
| | | <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topRight" title="运行时修改按钮参数,入参为(btn, systemType)。注:systemType为系统类型,正式系统为production"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 按钮预处理 |
| | | </Tooltip> |
| | | }> |
| | | <Radio.Group value={verify.preHandle || 'false'} onChange={(e) => {this.onOptionChange(e.target.value, 'preHandle')}}> |
| | | <Radio value="true">开启</Radio> |
| | | <Radio value="false">不开启</Radio> |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> |
| | | {verify.preHandle === 'true' ? <Col span={24} style={{paddingLeft: '50px'}}> |
| | | <CodeMirror mode="text/javascript" theme="cobalt" value={verify.pre_func || ''} onChange={(val) => {this.onOptionChange(val, 'pre_func')}} /> |
| | | </Col> : null} |
| | | </Row> |
| | | </Form> |
| | | ) |