king
2022-04-26 5046d0d13dc6a8563b8e54e31913bc44cfa1072f
src/views/menudesign/index.jsx
@@ -917,7 +917,7 @@
  }
  verifyConfig = (show) => {
    const { config } = this.state
    const { config, MenuType } = this.state
    let error = ''
    let check = (components) => {
@@ -931,7 +931,12 @@
        } else if (item.type === 'group') {
          check(item.components)
          return
        } else if (item.subtype === 'propcard' && item.subcards.length === 0) {
          error = `组件《${item.name}》中卡片不可为空!`
          return
        }
        if (['voucher'].includes(item.subtype)) return
        if (['propcard', 'brafteditor', 'sandbox', 'stepform', 'tabform'].includes(item.subtype) && item.wrap.datatype === 'static') return
        if (['balcony'].includes(item.type) && item.wrap.datatype === 'static') return
  
@@ -957,7 +962,12 @@
        } else if (item.type === 'tree' && (!item.wrap.valueField || !item.wrap.labelField || !item.wrap.parentField)) {
          error = `组件《${item.name}》基本信息尚未设置!`
        } else if (item.type === 'table' && item.wrap.doubleClick) {
          if (item.action.findIndex((m) => m.uuid === item.wrap.doubleClick) === -1) {
          let _actions = [...item.action]
          item.cols.forEach(col => {
            if (col.type !== 'action') return
            _actions.push(...col.elements)
          })
          if (_actions.findIndex((m) => m.uuid === item.wrap.doubleClick) === -1) {
            error = `组件《${item.name}》绑定的双击按钮已删除!`
          }
        }
@@ -974,6 +984,39 @@
      })
    }
    if (MenuType === 'billPrint' && !error) {
      let forbid = {
        tabs: '标签页',
        search: '搜索条件',
        form: '表单',
        carousel: '轮播',
        tree: '树形列表',
        chart: '自定义图表',
        editor: '富文本',
        group: '分组'
      }
      let subforbid = {
        editable: '可编辑表格',
        voucher: '凭证'
      }
      config.components.forEach(item => {
        if (!error && forbid[item.type]) {
          error = '打印模板中不可使用' + forbid[item.type]
        } else if (!error && subforbid[item.type]) {
          error = '打印模板中不可使用' + subforbid[item.type]
        }
      })
      if (show && error) {
        notification.warning({
          top: 92,
          message: error,
          duration: 5
        })
      }
    }
    return error
  }