king
2024-05-12 735955be17afba088e389c85ad36145656b3d750
src/templates/zshare/verifycard/baseform/index.jsx
@@ -17,6 +17,7 @@
    verify: PropTypes.object,
    unionFields: PropTypes.array,
    notes: PropTypes.array,
    emailCodes: PropTypes.array,
    appType: PropTypes.any,
    onChange: PropTypes.func
  }
@@ -129,12 +130,16 @@
    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.linkEnable === 'true' && !verify.linkUrl) {
      error = '打开链接开启时,需要添加链接地址!'
    } else if (verify.accountdate === 'true' && !verify.accountfield) {
      error = '开启账期时,需要选择验证公司!'
    } else if (verify.preHandle === 'true' && !verify.pre_func) {
      error = '开启按钮预处理时,需要填写处理函数!'
      error = '开启自定义脚本时,需要填写处理函数!'
    } else if (verify.wxNote === 'true') {
      if (!verify.wxTemplateId) {
        error = '开启公众号消息推送时,需要选择消息模板!'
@@ -155,9 +160,18 @@
    if (_verify.noteEnable !== 'true') {
      _verify.noteCode = ''
      _verify.noteId = ''
    }
    if (_verify.emailEnable !== 'true') {
      _verify.emailCode = ''
      _verify.emailId = ''
    }
    if (_verify.printEnable !== 'true') {
      _verify.printTempId = ''
    }
    if (_verify.linkEnable !== 'true') {
      delete _verify.linkUrl
      delete _verify.linkProUrl
    }
    if (_verify.accountdate !== 'true') {
      _verify.accountfield = ''
@@ -188,6 +202,14 @@
    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)
  }
@@ -276,7 +298,7 @@
  }
  render() {
    const { unionFields, verify, notes, card, appType, columns } = this.props
    const { unionFields, verify, notes, emailCodes, card, appType, columns, fields } = this.props
    const { wxTemps, selectTemp } = this.state
    const formItemLayout = {
      labelCol: {
@@ -290,13 +312,29 @@
    }
    let _columns = []
    if (window.GLOB.process) {
      _columns = columns.filter(col => {
        if (!col.field) return false
        if (col.field.toLowerCase() === 'id') return false
        if (col.type === 'text' && col.fieldlength > 100)  return false
    let remarks = []
    if (window.GLOB.process && card.intertype !== 'inner') {
      let cols = []
      fields.forEach(col => {
        if (!col.field) return
        cols.push(col.field.toLowerCase())
        _columns.push(col)
        if ((col.type === 'text' || col.type === 'textarea') && col.field !== 'BID') {
          remarks.push(col)
        }
      })
      columns.forEach(col => {
        if (!col.field) return
        let key = col.field.toLowerCase()
        if (key === 'id' || cols.includes(key)) return
        if (col.type === 'text' && col.fieldlength > 100)  return
  
        return true
        _columns.push(col)
      })
    }
@@ -385,7 +423,7 @@
                短信模板
              </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}
@@ -401,7 +439,7 @@
                发送方式
              </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>
@@ -414,7 +452,63 @@
                短信内容
              </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>-&gt;应用服务-&gt;开发者中心-&gt;邮件模板。</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>
@@ -435,12 +529,48 @@
            </Form.Item>
          </Col> : null}
          {verify.printEnable === 'true' ? <Col span={8}>
            <Form.Item label="打印模板" required>
            <Form.Item label="打印模板" required help={(() => {
              if (verify.printTempId) {
                return <span onClick={() => {
                  sessionStorage.setItem('mk-print-temp', verify.printTempId)
                  window.open('#/hs')
                  setTimeout(() => {
                    sessionStorage.removeItem('mk-print-temp')
                  }, 50)
                }} style={{color: '#1890ff', cursor: 'pointer', fontSize: '13px'}}>#查看模板</span>
              }
              return null
            })()}>
              <MkPrintTemps value={verify.printTempId} onChange={this.onPrintIdChange}/>
            </Form.Item>
          </Col> : null}
          <Col span={24}></Col>
          {window.GLOB.process ? <Col span={8}>
          <Col span={8}>
            <Form.Item label={
              <Tooltip placement="bottomLeft" title="按钮执行成功后需要打开的链接地址。">
                <QuestionCircleOutlined className="mk-form-tip" />
                打开链接
              </Tooltip>
            }>
              <Radio.Group value={verify.linkEnable || 'false'} onChange={(e) => {this.onOptionChange(e.target.value, 'linkEnable')}}>
                <Radio value="true">开启</Radio>
                <Radio value="false">不开启</Radio>
              </Radio.Group>
            </Form.Item>
          </Col>
          {verify.linkEnable === 'true' ? <Col span={24} className="dz-link">
            <Form.Item label="链接地址" required>
              <Input.TextArea autoComplete="off" value={verify.linkUrl || ''} onChange={(e) => {this.onOptionChange(e.target.value, 'linkUrl')}}/>
            </Form.Item>
          </Col> : null}
          {verify.linkEnable === 'true' ? <Col span={24} className="dz-link">
            <Form.Item label="正式地址">
              <Input.TextArea autoComplete="off" value={verify.linkProUrl || ''} onChange={(e) => {this.onOptionChange(e.target.value, 'linkProUrl')}}/>
            </Form.Item>
          </Col> : null}
          <Col span={24}></Col>
          {window.GLOB.process && card.intertype !== 'inner' ? <Col span={8}>
            <Form.Item label={
              <Tooltip placement="bottomLeft" title="在菜单开启工作流时有效。">
                <QuestionCircleOutlined className="mk-form-tip" />
@@ -453,7 +583,7 @@
              </Radio.Group>
            </Form.Item>
          </Col> : null}
          {window.GLOB.process && verify.workFlow === 'true' ? <Col span={8}>
          {window.GLOB.process && card.intertype !== 'inner' && verify.workFlow === 'true' ? <Col span={8}>
            <Form.Item label="类型">
              <Radio.Group value={verify.flowType} onChange={(e) => {this.onOptionChange(e.target.value, 'flowType')}}>
                <Radio value="start">发起</Radio>
@@ -462,7 +592,7 @@
              </Radio.Group>
            </Form.Item>
          </Col> : null}
          {window.GLOB.process && verify.workFlow === 'true' ? <Col span={8}>
          {window.GLOB.process && card.intertype !== 'inner' && verify.workFlow === 'true' ? <Col span={8}>
            <Form.Item label={
              <Tooltip placement="bottomLeft" title="执行位置在系统默认sql之后。">
                <QuestionCircleOutlined className="mk-form-tip" />
@@ -475,15 +605,31 @@
              </Radio.Group>
            </Form.Item>
          </Col> : null}
          {window.GLOB.process && verify.workFlow === 'true' && verify.flowType === 'approval' ? <Col span={8}>
          {window.GLOB.process && card.intertype !== 'inner' && verify.workFlow === 'true' && verify.flowType === 'approval' ? <Col span={8}>
            <Form.Item label={
              <Tooltip placement="bottomLeft" title="如果审批存在多条分支,可添加审批流程的控制字段,通过行信息控制流程走向。注:需在流程图中完善分支的执行条件。">
              <Tooltip placement="bottomLeft" title="如果审批存在多条分支,可添加审批流程的控制字段,通过表单信息或行信息控制流程走向。注:需在流程图中完善分支的执行条件。">
                <QuestionCircleOutlined className="mk-form-tip" />
                流程控制
              </Tooltip>
            }>
              <Select allowClear value={verify.flowBranch} onChange={(val) => {this.onOptionChange(val || '', 'flowBranch')}}>
                {_columns.map(option =>
                  <Select.Option key={option.field} value={option.field}>
                    {option.label}
                  </Select.Option>
                )}
              </Select>
            </Form.Item>
          </Col> : null}
          {window.GLOB.process && card.intertype !== 'inner' && verify.workFlow === 'true' && verify.flowType !== 'start' ? <Col span={8}>
            <Form.Item label={
              <Tooltip placement="bottomLeft" title="可通过表单字段填写审批或驳回的备注信息。">
                <QuestionCircleOutlined className="mk-form-tip" />
                备注字段
              </Tooltip>
            }>
              <Select allowClear value={verify.flowRemark} onChange={(val) => {this.onOptionChange(val || '', 'flowRemark')}}>
                {remarks.map(option =>
                  <Select.Option key={option.field} value={option.field}>
                    {option.label}
                  </Select.Option>
@@ -625,9 +771,9 @@
          <Col span={24}></Col>
          <Col span={8}>
            <Form.Item label={
              <Tooltip placement="topRight" title="运行时修改按钮参数,入参为(btn, systemType)。注:systemType为系统类型,正式系统为production">
              <Tooltip placement="topRight" title="运行时修改按钮参数,入参为(btn, position, systemType),标记#position-(init,inner,outer,callback)">
                <QuestionCircleOutlined className="mk-form-tip" />
                按钮预处理
                自定义脚本
              </Tooltip>
            }>
              <Radio.Group value={verify.preHandle || 'false'} onChange={(e) => {this.onOptionChange(e.target.value, 'preHandle')}}>