king
2021-01-21 0647a7a6251c05466c2ea5c64878959da4b1b625
增加check验证
6个文件已修改
188 ■■■■■ 已修改文件
src/menu/popview/index.jsx 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/actionList/normalbutton/index.jsx 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/comtableconfig/index.jsx 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/subtableconfig/index.jsx 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/verifycard/customscript/index.jsx 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/menudesign/index.jsx 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/popview/index.jsx
@@ -246,37 +246,40 @@
          traversal(item.components)
        } else if (item.type === 'card' || (item.type === 'table' && item.subtype === 'tablecard')) {
          item.action && item.action.forEach(btn => {
            this.checkBtn(btn)
            buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`)
            _sort++
          })
          item.subcards.forEach(card => {
            card.elements && card.elements.forEach(cell => {
              if (cell.eleType !== 'button') return
              this.checkBtn(cell)
              buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`)
              _sort++
            })
            card.backElements && card.backElements.forEach(cell => {
              if (cell.eleType !== 'button') return
              this.checkBtn(cell)
              buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`)
              _sort++
            })
          })
        } else if (item.type === 'line' || item.type === 'bar') {
          item.action && item.action.forEach(btn => {
            this.checkBtn(btn)
            buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`)
            _sort++
          })
        } else if (item.type === 'table' && item.subtype === 'normaltable') {
          item.action && item.action.forEach(btn => {
            if (btn.origin) return
            this.checkBtn(btn)
            buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`)
            _sort++
          })
          item.cols && item.cols.forEach(col => {
            if (col.type !== 'action') return
            col.elements.forEach(btn => {
              this.checkBtn(btn)
              buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`)
              _sort++
            })
@@ -290,6 +293,26 @@
    return buttons
  }
  checkBtn = (btn) => {
    if (['prompt', 'exec', 'pop'].includes(btn.OpenType) && btn.Ot === 'required' && btn.verify && btn.verify.scripts && btn.verify.scripts.length > 0) {
      let hascheck = false
      btn.verify.scripts.forEach(item => {
        if (item.status === 'false') return
        if (/\$check@|@check\$/ig.test(item.sql)) {
          hascheck = true
        }
      })
      if (hascheck) {
        notification.warning({
          top: 92,
          message: `可选择多行的按钮《${btn.label}》中 $check@ 或 @check$ 将不会生效!`,
          duration: 5
        })
      }
    }
  }
  filterConfig = (components) => {
    return components.map(item => {
      if (item.type === 'tabs') {
src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -40,7 +40,8 @@
    confirmLoading: false,
    btnconfig: null,
    loading: false,
    loadingNumber: ''
    loadingNumber: '',
    checkParam: null
  }
  shouldComponentUpdate (nextProps, nextState) {
@@ -211,6 +212,7 @@
        let param = { // 系统存储过程
          func: 'sPC_TableData_InUpDe'
        }
        let check_param = null
        if (this.props.BID) {
          param.BID = this.props.BID
@@ -244,6 +246,16 @@
            param.exec_type = 'y' // 后台解码
            param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
            param.secretkey = Utils.encrypt('', param.timestamp)
            if (/\$check@|@check\$/ig.test(param.LText)) {
              check_param = fromJS(param).toJS()
              check_param.LText = check_param.LText.replace(/\$check@/ig, '/*')
              check_param.LText = check_param.LText.replace(/@check\$/ig, '*/')
              check_param.LText = Utils.formatOptions(check_param.LText)
              param.LText = param.LText.replace(/\$check@|@check\$/ig, '')
            }
            param.LText = Utils.formatOptions(param.LText)
          }
        } else if (btn.OpenType === 'pop') { // 表单
@@ -281,6 +293,16 @@
            param.exec_type = 'y' // 后台解码
            param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
            param.secretkey = Utils.encrypt('', param.timestamp)
            if (/\$check@|@check\$/ig.test(param.LText)) {
              check_param = fromJS(param).toJS()
              check_param.LText = check_param.LText.replace(/\$check@/ig, '/*')
              check_param.LText = check_param.LText.replace(/@check\$/ig, '*/')
              check_param.LText = Utils.formatOptions(check_param.LText)
              param.LText = param.LText.replace(/\$check@|@check\$/ig, '')
            }
            param.LText = Utils.formatOptions(param.LText)
          } else if (btn.sql) {
            param.ID = primaryId
@@ -296,12 +318,25 @@
            param.exec_type = 'y' // 后台解码
            param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
            param.secretkey = Utils.encrypt('', param.timestamp)
            if (/\$check@|@check\$/ig.test(param.LText)) {
              check_param = fromJS(param).toJS()
              check_param.LText = check_param.LText.replace(/\$check@/ig, '/*')
              check_param.LText = check_param.LText.replace(/@check\$/ig, '*/')
              check_param.LText = Utils.formatOptions(check_param.LText)
              param.LText = param.LText.replace(/\$check@|@check\$/ig, '')
            }
            param.LText = Utils.formatOptions(param.LText)
          }
        }
        if (this.props.menuType === 'HS' && param.timestamp) { // 函数 sPC_TableData_InUpDe 云端验证
          param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp)
          if (check_param) {
            check_param.open_key = Utils.encryptOpenKey(check_param.secretkey, check_param.timestamp)
          }
        } else if (this.props.menuType === 'HS' && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { // 函数 s_sDataDictb_TBBack 云端验证
          param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
          param.secretkey = Utils.encrypt(param.LTextOut, param.timestamp)
@@ -310,6 +345,12 @@
        if (param.func === 'sPC_TableData_InUpDe') {
          param.menuname = btn.logLabel
          if (check_param) {
            check_param.menuname = btn.logLabel
          }
        }
        if (check_param) {
          this.setState({checkParam: check_param})
        }
        Api.genericInterface(param).then((res) => {
@@ -360,6 +401,7 @@
              } else {
                param.LText = param.LText.replace(/@\$|\$@/ig, '')
              }
              param.LText = param.LText.replace(/\$check@|@check\$/ig, '')
              param.exec_type = 'y' // 后台解码
              param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
@@ -396,6 +438,7 @@
              } else {
                param.LText = param.LText.replace(/@\$|\$@/ig, '')
              }
              param.LText = param.LText.replace(/\$check@|@check\$/ig, '')
              param.exec_type = 'y' // 后台解码
              param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
@@ -411,6 +454,7 @@
              } else {
                param.LText = param.LText.replace(/@\$|\$@/ig, '')
              }
              param.LText = param.LText.replace(/\$check@|@check\$/ig, '')
              param.exec_type = 'y' // 后台解码
              param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
@@ -872,11 +916,52 @@
    } else if (res.ErrCode === 'NM') {
      message.error(res.message || res.ErrMesg)
    }
    this.setState({
      loading: false
    })
    if (res.ErrCode === 'C') {
      const _this = this
      if (this.state.checkParam) {
        let param = this.state.checkParam
        confirm({
          title: res.message || res.ErrMesg,
          onOk() {
            return new Promise(resolve => {
              Api.genericInterface(param).then((result) => {
                if (result.status) {
                  _this.execSuccess(result)
                } else {
                  _this.execError(result)
                }
                resolve()
              }, () => {
                _this.setState({
                  visible: false
                })
                resolve()
              })
            })
          },
          onCancel() {
            _this.setState({
              visible: false
            })
            if (btn.execError !== 'never') {
              MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn)
            }
          }
        })
        this.setState({checkParam: null})
        return
      } else {
        Modal.error({
          title: res.message || res.ErrMesg,
        })
      }
    }
    if (btn.execError !== 'never') {
      MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn)
    }
src/templates/comtableconfig/index.jsx
@@ -973,6 +973,25 @@
      }
    })
    
    config.action && config.action.forEach((btn) => {
      if (['prompt', 'exec', 'pop'].includes(btn.OpenType) && btn.Ot === 'required' && btn.verify && btn.verify.scripts && btn.verify.scripts.length > 0) {
        let hascheck = false
        btn.verify.scripts.forEach(item => {
          if (item.status === 'false') return
          if (/\$check@|@check\$/ig.test(item.sql)) {
            hascheck = true
          }
        })
        if (hascheck) {
          notification.warning({
            top: 92,
            message: `可选择多行的按钮《${btn.label}》中 $check@ 或 @check$ 将不会生效!`,
            duration: 5
          })
        }
      }
    })
    if (config.setting.interType === 'system' && config.setting.default !== 'false' && !config.setting.dataresource) {
      return '菜单尚未设置数据源,不可启用!'
src/templates/subtableconfig/index.jsx
@@ -816,6 +816,26 @@
      }
    })
    config.action && config.action.forEach((btn) => {
      if (['prompt', 'exec', 'pop'].includes(btn.OpenType) && btn.Ot === 'required' && btn.verify && btn.verify.scripts && btn.verify.scripts.length > 0) {
        let hascheck = false
        btn.verify.scripts.forEach(item => {
          if (item.status === 'false') return
          if (/\$check@|@check\$/ig.test(item.sql)) {
            hascheck = true
          }
        })
        if (hascheck) {
          notification.warning({
            top: 92,
            message: `可选择多行的按钮《${btn.label}》中 $check@ 或 @check$ 将不会生效!`,
            duration: 5
          })
        }
      }
    })
    if (config.setting.interType === 'system' && config.setting.default !== 'false' && !config.setting.dataresource) {
      return '尚未设置数据源,不可启用!'
    } else if (!config.setting.primaryKey) {
src/templates/zshare/verifycard/customscript/index.jsx
@@ -122,6 +122,8 @@
        // 数据权限
        param.LText = param.LText.replace(/@\$|\$@/ig, '')
        // check
        param.LText = param.LText.replace(/\$check@|@check\$/ig, '')
        // 外联数据库替换
        if (window.GLOB.externalDatabase !== null) {
src/views/menudesign/index.jsx
@@ -341,37 +341,40 @@
          traversal(item.components)
        } else if (item.type === 'card' || (item.type === 'table' && item.subtype === 'tablecard')) {
          item.action && item.action.forEach(btn => {
            this.checkBtn(btn)
            buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`)
            _sort++
          })
          item.subcards.forEach(card => {
            card.elements && card.elements.forEach(cell => {
              if (cell.eleType !== 'button') return
              this.checkBtn(cell)
              buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`)
              _sort++
            })
            card.backElements && card.backElements.forEach(cell => {
              if (cell.eleType !== 'button') return
              this.checkBtn(cell)
              buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`)
              _sort++
            })
          })
        } else if (item.type === 'line' || item.type === 'bar') {
          item.action && item.action.forEach(btn => {
            this.checkBtn(btn)
            buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`)
            _sort++
          })
        } else if (item.type === 'table' && item.subtype === 'normaltable') {
          item.action && item.action.forEach(btn => {
            if (btn.origin) return
            this.checkBtn(btn)
            buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`)
            _sort++
          })
          item.cols && item.cols.forEach(col => {
            if (col.type !== 'action') return
            col.elements.forEach(btn => {
              this.checkBtn(btn)
              buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`)
              _sort++
            })
@@ -385,6 +388,26 @@
    return buttons
  }
  checkBtn = (btn) => {
    if (['prompt', 'exec', 'pop'].includes(btn.OpenType) && btn.Ot === 'required' && btn.verify && btn.verify.scripts && btn.verify.scripts.length > 0) {
      let hascheck = false
      btn.verify.scripts.forEach(item => {
        if (item.status === 'false') return
        if (/\$check@|@check\$/ig.test(item.sql)) {
          hascheck = true
        }
      })
      if (hascheck) {
        notification.warning({
          top: 92,
          message: `可选择多行的按钮《${btn.label}》中 $check@ 或 @check$ 将不会生效!`,
          duration: 5
        })
      }
    }
  }
  filterConfig = (components) => {
    return components.map(item => {
      if (item.type === 'tabs') {