king
2023-11-08 076c2b693da1d42cf3a468c0f3d631c1ed424285
src/templates/zshare/verifycard/baseform/index.jsx
@@ -1,10 +1,11 @@
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 './index.scss'
const sysTempsIds = ['8IFltwzyKcu15iA8fqSyb6m-pMa88a3ZTu0No3vDHgo', 'LOB-bbt9jVncGh7IOAUdESh1Sgzcbt62UwOqSqcK9ok']
@@ -22,8 +23,7 @@
  state = {
    wxTemps: [],
    selectTemp: null,
    miniTemps: [],
    printTemps: []
    miniTemps: []
  }
  componentDidMount() {
@@ -78,11 +78,6 @@
      this.resetTemps(wxTemps)
    }
    let printTemps = sessionStorage.getItem('printTemps')
    printTemps = printTemps ? JSON.parse(printTemps) : []
    this.setState({printTemps})
  }
  resetTemps = (wxTemps) => {
@@ -151,7 +146,7 @@
  }
  onOptionChange = (value, key) => {
    const { verify, setting } = this.props
    const { verify } = this.props
    let _verify = {...verify, [key]: value}
@@ -178,15 +173,6 @@
      if (this.state.selectTemp) {
        this.setState({selectTemp: null})
      }
    }
    if (verify.invalid !== 'true' && _verify.invalid === 'true' && setting.maxScript && setting.maxScript >= 300) {
      notification.warning({
        top: 92,
        message: '数据源中自定义脚本过于复杂,不能使用失效验证!',
        duration: 5
      })
      return
    }
    this.props.onChange(_verify)
@@ -284,8 +270,8 @@
  }
  render() {
    const { unionFields, verify, notes, card, appType } = this.props
    const { wxTemps, selectTemp, printTemps } = this.state
    const { unionFields, verify, notes, card, appType, columns } = this.props
    const { wxTemps, selectTemp } = this.state
    const formItemLayout = {
      labelCol: {
        xs: { span: 24 },
@@ -295,6 +281,17 @@
        xs: { span: 24 },
        sm: { span: 16 }
      }
    }
    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
        return true
      })
    }
    return (
@@ -314,8 +311,13 @@
            </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>
@@ -428,10 +430,56 @@
          </Col> : null}
          {verify.printEnable === 'true' ? <Col span={8}>
            <Form.Item label="打印模板" required>
              <Select value={verify.printTempId} onSelect={this.onPrintIdChange}>
                {printTemps.map(option =>
                  <Select.Option key={option.value} value={option.value}>
                    {option.text}
              <MkPrintTemps value={verify.printTempId} onChange={this.onPrintIdChange}/>
            </Form.Item>
          </Col> : null}
          <Col span={24}></Col>
          {window.GLOB.process ? <Col span={8}>
            <Form.Item label={
              <Tooltip placement="bottomLeft" title="在菜单开启工作流时有效。">
                <QuestionCircleOutlined className="mk-form-tip" />
                工作流
              </Tooltip>
            }>
              <Radio.Group value={verify.workFlow} onChange={(e) => {this.onOptionChange(e.target.value, 'workFlow')}}>
                <Radio value="true">开启</Radio>
                <Radio value="false">不开启</Radio>
              </Radio.Group>
            </Form.Item>
          </Col> : null}
          {window.GLOB.process && 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>
                <Radio value="approval">审批</Radio>
                <Radio value="reject">驳回</Radio>
              </Radio.Group>
            </Form.Item>
          </Col> : null}
          {window.GLOB.process && verify.workFlow === 'true' ? <Col span={8}>
            <Form.Item label={
              <Tooltip placement="bottomLeft" title="执行位置在系统默认sql之后。">
                <QuestionCircleOutlined className="mk-form-tip" />
                默认sql(工作流)
              </Tooltip>
            }>
              <Radio.Group value={verify.flowSql} onChange={(e) => {this.onOptionChange(e.target.value, 'flowSql')}}>
                <Radio value="true">执行</Radio>
                <Radio value="false">不执行</Radio>
              </Radio.Group>
            </Form.Item>
          </Col> : null}
          {window.GLOB.process && verify.workFlow === 'true' && verify.flowType === 'approval' ? <Col span={8}>
            <Form.Item label={
              <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>