king
2025-01-16 d5ed6bd23455c63b5de88f8740c7325658f5241e
src/utils/utils-custom.js
@@ -451,11 +451,7 @@
            card.elements = card.elements.map(cell => {
              if (cell.eleType === 'button') {
                cell.uuid = md5(commonId + cell.uuid)
                if (clear && cell.pageTemplate === 'linkpage' && cell.linkmenu) {
                  cell.pageTemplate = ''
                  cell.linkmenu = ''
                }
                this.resetBtn(cell, commonId)
                this.resetBtn(cell, commonId, clear)
              } else {
                cell.uuid = this.getuuid()
              }
@@ -467,11 +463,7 @@
            card.backElements = card.backElements.map(cell => {
              if (cell.eleType === 'button') {
                cell.uuid = md5(commonId + cell.uuid)
                if (clear && cell.pageTemplate === 'linkpage' && cell.linkmenu) {
                  cell.pageTemplate = ''
                  cell.linkmenu = ''
                }
                this.resetBtn(cell, commonId)
                this.resetBtn(cell, commonId, clear)
              } else {
                cell.uuid = this.getuuid()
              }
@@ -491,11 +483,7 @@
          item.elements = item.elements.map(cell => {
            if (cell.eleType === 'button') {
              cell.uuid = md5(commonId + cell.uuid)
              if (clear && cell.pageTemplate === 'linkpage' && cell.linkmenu) {
                cell.pageTemplate = ''
                cell.linkmenu = ''
              }
              this.resetBtn(cell, commonId)
              this.resetBtn(cell, commonId, clear)
            } else {
              cell.uuid = this.getuuid()
            }
@@ -528,12 +516,7 @@
                cell.uuid = md5(commonId + cell.uuid)
                if (cell.eleType === 'button') {
                  if (clear && cell.pageTemplate === 'linkpage' && cell.linkmenu) {
                    cell.pageTemplate = ''
                    cell.linkmenu = ''
                  }
                  this.resetBtn(cell, commonId)
                  this.resetBtn(cell, commonId, clear)
                }
                return cell
@@ -572,11 +555,15 @@
          })
          if (cell.subButton) {
            this.resetBtn(cell.subButton, commonId)
            this.resetBtn(cell.subButton, commonId, clear)
          }
          return cell
        })
      } else if (item.type === 'login') {
        if (clear) {
          item.wrap.linkmenu = ''
        }
      }
  
      if (item.btnlog) {
@@ -587,12 +574,7 @@
        item.action = item.action.map(cell => {
          cell.uuid = md5(commonId + cell.uuid)
          if (clear && cell.pageTemplate === 'linkpage' && cell.linkmenu) {
            cell.pageTemplate = ''
            cell.linkmenu = ''
          }
          this.resetBtn(cell, commonId)
          this.resetBtn(cell, commonId, clear)
          return cell
        })
@@ -650,7 +632,7 @@
  /**
   * @description 按钮重置
   */
  static resetBtn (btn, commonId) {
  static resetBtn (btn, commonId, clear = false) {
    if (btn.OpenType === 'pop' || (btn.OpenType === 'funcbutton' && btn.execMode === 'pop')) {
      if (btn.modal && btn.modal.fields && btn.modal.fields.length > 0) {
        btn.modal.fields = btn.modal.fields.map(m => {
@@ -659,6 +641,16 @@
        })
      }
    }
    if (clear) {
      if (btn.pageTemplate === 'linkpage') {
        btn.pageTemplate = ''
      }
      delete btn.linkmenu
      delete btn.openmenu
      delete btn.refreshTab
    }
    if (btn.switchTab && btn.switchTab.length > 0) {
      btn.switchTab = btn.switchTab.map(m => md5(commonId + m))
    }
@@ -666,6 +658,15 @@
      btn.anchors = btn.anchors.map(m => md5(commonId + m))
    }
    if (btn.syncComponent && btn.syncComponent[0] === 'multiComponent' && btn.syncComponents) {
      if (btn.syncComponents[0] && Array.isArray(btn.syncComponents[0])) {
        btn.syncComponents = btn.syncComponents.map((item, i) => {
          return {
            syncComId: item,
            label: '',
            uuid: 'fixed' + i
          }
        })
      }
      btn.syncComponents = btn.syncComponents.map(m => {
        m.syncComId = m.syncComId.map(n => {
          if (/\$focus/.test(n)) {
@@ -1934,6 +1935,10 @@
          })
        }
        let emptys = []
        if (cell.Ot !== 'notRequired') {
          forms.push(...columns)
        }
        cell.verify.uniques.forEach(m => {
          if (m.status === 'false') return
@@ -1945,21 +1950,25 @@
        })
        if (emptys.length) {
          errors.push({ level: 0, detail: `按钮“${cell.label}”唯一性验证字段${emptys.join('、')},在表单中不存在!`})
          if (cell.Ot === 'notRequired') {
            errors.push({ level: 0, detail: `按钮“${cell.label}”唯一性验证字段${emptys.join('、')},在表单中不存在!`})
          } else {
            errors.push({ level: 0, detail: `按钮“${cell.label}”唯一性验证字段${emptys.join('、')},在表单与字段集中不存在!`})
          }
        }
      }
      if (cell.OpenType === 'form' && cell.formType === 'count_line') return
     
      if (cell.intertype === 'system') {
        if (cell.Ot === 'notRequired' && cell.verify && cell.verify.voucher && cell.verify.voucher.enabled) {
          errors.push({ level: 0, detail: `按钮“${cell.label}”使用了创建凭证函数,需要选择行!`})
        }
        // if (cell.Ot === 'notRequired' && cell.verify && cell.verify.voucher && cell.verify.voucher.enabled) {
        //   errors.push({ level: 0, detail: `按钮“${cell.label}”使用了创建凭证函数,需要选择行!`})
        // }
      } else if (cell.intertype === 'custom' || cell.intertype === 'outer') {
        if (cell.callbackType === 'script' && (!cell.verify || !cell.verify.cbScripts || cell.verify.cbScripts.filter(item => item.status !== 'false').length === 0)) {
          errors.push({ level: 0, detail: `按钮“${cell.label}”使用了自定义脚本回调,回调脚本不可为空!`})
        } else if (cell.procMode === 'system' && cell.Ot === 'notRequired' && cell.verify && cell.verify.voucher && cell.verify.voucher.enabled) {
          errors.push({ level: 0, detail: `按钮“${cell.label}”使用了创建凭证函数,需要选择行!`})
        // } else if (cell.procMode === 'system' && cell.Ot === 'notRequired' && cell.verify && cell.verify.voucher && cell.verify.voucher.enabled) {
        //   errors.push({ level: 0, detail: `按钮“${cell.label}”使用了创建凭证函数,需要选择行!`})
        }
      }
    } else if (cell.OpenType === 'funcbutton') {
@@ -3385,7 +3394,9 @@
          })
        }
        filterComponent(cell.config.components, _mainSearch, '-' + cell.label, true)
        let label = (item.name ? '-' + item.name : '') + '-' + cell.label
        filterComponent(cell.config.components, _mainSearch, label, true)
      }
    }
  }
@@ -3736,22 +3747,21 @@
    if (formdata && verify.billcodes && verify.billcodes.length > 0) {
      verify.billcodes.forEach(item => {
        let _key = item.field.toLowerCase()
        let _linkKey = item.linkField ? item.linkField.toLowerCase() : ''
  
        if (!formkeys.includes(_key)) return // 表单中不含单号生成字段
  
        let _lpline = ''
        if (item.TypeCharOne === 'Lp') {
          if (_linkKey === 'bid' && BID) { // 替换bid
          if (/^BID$/ig.test(item.linkField)) {
            _lpline = `set @ModularDetailCode= 'Lp'+ right('${item.mark || btn.uuid}'+@BID@,48)`
          } else {
            _lpline = `set @ModularDetailCode= 'Lp'+ right('${item.mark || btn.uuid}'+@${_linkKey},48)`
            _lpline = `set @ModularDetailCode= 'Lp'+ right('${item.mark || btn.uuid}'+@${item.linkField},48)`
          }
        } else if (item.TypeCharOne === 'BN') {
          if (_linkKey === 'bid' && BID) { // 替换bid
          if (/^BID$/ig.test(item.linkField)) {
            _lpline = `set @ModularDetailCode= 'BN'+ right(@BID@,48)`
          } else {
            _lpline = `set @ModularDetailCode= 'BN'+ right(@${_linkKey},48)`
            _lpline = `set @ModularDetailCode= 'BN'+ right(@${item.linkField},48)`
          }
        } else {
          _lpline = `set @ModularDetailCode= right('${item.ModularDetailCode}',50)`
@@ -3794,24 +3804,26 @@
          let _val2 = ''
  
          arr.push(_key)
          if (_key === 'bid') { // 表单中没有bid则使用系统bid变量
          if (_key === 'bid') {
            _val = BID
          } else {
            _val = `'@mk_${_key}_mk@'`
            // _val = `'@mk_${_key}_mk@'`
            _val = `@${_field}`
          }
          _fieldValue.push(`${_key}=${_val}`)
          if (_key === 'bid') { // 表单中没有bid则使用系统bid变量
          if (_key === 'bid') {
            _val2 = `' + ${BID} + '`
          } else {
            _val2 = `@mk_${_key}_mk@`
            // _val2 = `@mk_${_key}_mk@`
            _val2 = `' + @${_field} + '`
          }
          _value.push(`${_labels[index] || ''}:${_val2}`)
        })
  
        if (!arr.includes(primaryKey.toLowerCase())) {
        if (!arr.includes(primaryKey.toLowerCase()) && btn.Ot !== 'notRequired') {
          _fieldValue.push(`${primaryKey} !=${primaryId}`)
        }
  
@@ -3862,15 +3874,20 @@
    let hasvoucher = false
  
    // 凭证-显示列中选取,必须选行
    if (verify.voucher && verify.voucher.enabled && btn.Ot !== 'requiredOnce') {
    if (verify.voucher && verify.voucher.enabled) {
      let _voucher = verify.voucher
      let linkField = `@${_voucher.linkField}`
      if (/^BID$/ig.test(_voucher.linkField)) {
        linkField = BID
      }
  
      hasvoucher = true
  
      _sql += `
        /* 创建凭证 */
        exec s_BVoucher_Create
          @Bill ='0',
          @Bill = ${linkField},
          @BVoucherType ='${_voucher.BVoucherType}',
          @VoucherTypeOne ='${_voucher.VoucherTypeOne}',
          @VoucherTypeTwo ='${_voucher.VoucherTypeTwo}',
@@ -4065,7 +4082,9 @@
        _sql += `
          /* 工作流异常sql */
          if @works_flow_error@ != ''
          select @ErrorCode='E',@retmsg=@works_flow_error@ goto aaa
          begin
            select @ErrorCode='E',@retmsg=@works_flow_error@ goto aaa
          end
          /* 工作流默认sql */
          insert into s_my_works_flow (works_flow_id,works_flow_code,works_flow_name,works_flow_param,status,statusname,work_group,works_flow_detail_id,work_grade,bid,createuserid,CreateUser,CreateStaff,upid)
@@ -4084,7 +4103,9 @@
        _sql += `
          /* 工作流异常sql */
          if @works_flow_error@ != ''
          select @ErrorCode='E',@retmsg=@works_flow_error@ goto aaa
          begin
            select @ErrorCode='E',@retmsg=@works_flow_error@ goto aaa
          end
          if @works_flow_countersign@ = 'Y'
          begin
@@ -5216,7 +5237,9 @@
        sql += `
        /* 工作流异常sql */
        if @works_flow_error@ != ''
        select @ErrorCode='E',@retmsg=@works_flow_error@ goto aaa
        begin
          select @ErrorCode='E',@retmsg=@works_flow_error@ goto aaa
        end
        /* 工作流默认sql */
        insert into s_my_works_flow (works_flow_id,works_flow_code,works_flow_name,works_flow_param,status,statusname,work_group,works_flow_detail_id,work_grade,bid,createuserid,CreateUser,CreateStaff,upid)
@@ -6423,25 +6446,27 @@
  let keys = sqls.map(item => item.uuid)
  if (keys.length > Array.from(new Set(keys)).length) {
    let m = new Map()
    let n = new Map()
    sqls.forEach(item => {
      if (m.has(item.uuid)) {
        if (!n.has(item.uuid)) {
          window.mkInfo(m.get(item.uuid))
          n.set(item.uuid, true)
    if (window.backend) {
      let m = new Map()
      let n = new Map()
      sqls.forEach(item => {
        if (m.has(item.uuid)) {
          if (!n.has(item.uuid)) {
            window.mkInfo(m.get(item.uuid))
            n.set(item.uuid, true)
          }
          window.mkInfo(item)
        } else {
          m.set(item.uuid, item)
        }
        window.mkInfo(item)
      } else {
        m.set(item.uuid, item)
      }
    })
    notification.warning({
      top: 92,
      message: '存在重复的后端脚本ID!',
      duration: 5
    })
      })
      notification.warning({
        top: 92,
        message: '存在重复的后端脚本ID!',
        duration: 5
      })
    }
    return []
  }