king
2024-02-20 12d591d4ed4880ee87bdda444424b9acaa73d9f7
src/templates/zshare/verifycard/customscript/index.jsx
@@ -11,13 +11,14 @@
class CustomForm extends Component {
  static propTpyes = {
    type: PropTypes.any,
    btn: PropTypes.object,          // 按钮信息
    usefulfields: PropTypes.string, // 可用字段
    initsql: PropTypes.string,      // sql前缀
    defaultsql: PropTypes.array,    // 默认sql
    systemScripts: PropTypes.array, // 系统脚本
    customScripts: PropTypes.array, // 自定义脚本
    scriptsChange: PropTypes.func   // 表单
    btn: PropTypes.object,
    usefulfields: PropTypes.string,
    initsql: PropTypes.string,
    defaultsql: PropTypes.string,
    useDefaultSql: PropTypes.any,
    systemScripts: PropTypes.array,
    customScripts: PropTypes.array,
    scriptsChange: PropTypes.func
  }
  state = {
@@ -44,7 +45,7 @@
  }
  handleConfirm = () => {
    const { type, workFlow, flowType } = this.props
    const { type, workFlow, flowType, useDefaultSql, defaultsql } = this.props
    const { editItem, skip } = this.state
    // 表单提交时检查输入值是否正确
    this.props.form.validateFieldsAndScroll((err, values) => {
@@ -126,7 +127,15 @@
          }
        }
        let sql = this.props.initsql + _initCustomScript + _prevCustomScript + _backCustomScript + tail
        let sql = this.props.initsql + _initCustomScript + _prevCustomScript
        if (useDefaultSql) {
          sql += `\n/* 默认sql */
            ${defaultsql}
          `
        }
        sql += _backCustomScript + tail
        if (window.GLOB.funcs && window.GLOB.funcs.length > 0) {
          window.GLOB.funcs.forEach(item => {
@@ -137,7 +146,8 @@
        // 数据权限
        sql = sql.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '')
        sql = sql.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'1949-10-01 15:00:00'`)
        sql = sql.replace(/@datam@/ig, `''`)
        sql = sql.replace(/@typename@/ig, `'debug'`)
        if (window.GLOB.process && workFlow === 'true') {
          sql = sql.replace(/@works_flow_code@/ig, `'works_flow_code'`)