king
2023-04-07 20185ab64a165df51515d9fa1c9b12a7a8c55f59
src/menu/components/share/actioncomponent/index.jsx
@@ -257,19 +257,24 @@
   */
  handleSubmit = () => {
    const { config } = this.props
    let color = { primary: '#1890ff', yellow: '#c49f47', orange: 'orange', danger: '#ff4d4f', green: '#26C281', dgreen: '#32c5d2', purple: '#8E44AD', cyan: '#13c2c2', gray: '#666666', default: 'rgba(0, 0, 0, 0.65)' }
    let color = { primary: '#1890ff', yellow: '#c49f47', orange: 'orange', danger: '#ff4d4f', green: '#26C281', dgreen: '#32c5d2', purple: '#8E44AD', cyan: '#13c2c2', gray: '#E7E7EF', default: 'rgba(0, 0, 0, 0.65)' }
    let _actionlist = fromJS(this.state.actionlist).toJS()
    
    this.actionFormRef.handleConfirm().then(btn => {
      _actionlist = _actionlist.filter(item => !item.origin || item.uuid === btn.uuid)
      if ((btn.OpenType === 'excelIn' || btn.OpenType === 'excelOut') && (!btn.verify || !btn.verify.columns) && config.subtype === 'basetable') {
      if ((btn.OpenType === 'excelIn' || btn.OpenType === 'excelOut') && (!btn.verify || !btn.verify.columns) && (config.subtype === 'basetable' || config.subtype === 'normaltable')) {
        let columns = []
        let maps = []
        let labels = {}
        if (config.subtype === 'normaltable') {
          config.columns.forEach(col => {
            labels[col.field] = col.label
          })
        }
        if (btn.OpenType === 'excelOut') {
          config.cols.forEach(item => {
            if (!item.field || item.Hide === 'true') return
          let pushcol = (item) => {
            let cell = {
              Column: item.field,
              Text: item.label,
@@ -287,14 +292,39 @@
            }
  
            columns.push(cell)
          }
          config.cols.forEach(item => {
            if (item.Hide === 'true') return
            if (config.subtype === 'normaltable') {
              if (item.type === 'colspan') {
                item.subcols.forEach(cell => {
                  if (!cell.field || cell.Hide === 'true' || maps.includes(cell.field)) return
                  maps.push(cell.field)
                  pushcol(cell)
                })
              } else if (item.type === 'custom') {
                item.elements.forEach(cell => {
                  if (!cell.field || maps.includes(cell.field)) return
                  maps.push(cell.field)
                  pushcol({...cell, label: labels[cell.field]})
                })
              }
            }
            if (!item.field || maps.includes(item.field)) return
            maps.push(item.field)
            pushcol(item)
          })
          btn.verify = btn.verify || {enable: 'false', dataType: 'default', scripts: []}
          btn.verify.columns = columns
        } else {
          config.cols.forEach(item => {
            if (!item.field || item.Hide === 'true') return
          let pushcol = (item) => {
            let _type = 'Nvarchar(50)'
            let _limit = '50'
            if (item.type === 'number' && !item.decimal) {
@@ -321,6 +351,33 @@
            }
  
            columns.push(_cell)
          }
          config.cols.forEach(item => {
            if (item.Hide === 'true') return
            if (config.subtype === 'normaltable') {
              if (item.type === 'colspan') {
                item.subcols.forEach(cell => {
                  if (!cell.field || cell.Hide === 'true' || maps.includes(cell.field)) return
                  maps.push(cell.field)
                  pushcol(cell)
                })
              } else if (item.type === 'custom') {
                item.elements.forEach(cell => {
                  if (!cell.field || maps.includes(cell.field)) return
                  maps.push(cell.field)
                  pushcol({...cell, label: labels[cell.field]})
                })
              }
            }
            if (!item.field || maps.includes(item.field)) return
            maps.push(item.field)
            pushcol(item)
          })
          btn.verify = btn.verify || {sheet: 'Sheet1', default: 'true', range: 1, scripts: [], uniques: []}
@@ -341,6 +398,8 @@
              btn.style = {color: 'rgba(0, 0, 0, 0.65)', backgroundColor: '#fff', borderColor: '#d9d9d9', marginRight: '15px'}
            } else if (btn.class.indexOf('border') > -1) {
              btn.style = {color: color[_c], backgroundColor: '#fff', borderColor: color[_c], marginRight: '15px'}
            } else if (btn.class === 'gray') {
              btn.style = {color: 'rgba(0, 0, 0, 0.65)', backgroundColor: color[_c], borderColor: color[_c], marginRight: '15px'}
            } else {
              btn.style = {color: '#fff', backgroundColor: color[_c], borderColor: color[_c], marginRight: '15px'}
            }
@@ -350,9 +409,23 @@
              if (btn.show === 'icon') {
                btn.style.color = color[btn.class]
                btn.style.backgroundColor = 'transparent'
              } else if (btn.class === 'default') {
                btn.style.color = 'rgba(0, 0, 0, 0.65)'
                btn.style.backgroundColor = '#fff'
                btn.style.borderColor = '#d9d9d9'
              } else if (btn.class.indexOf('border') > -1) {
                let _c = btn.class.replace('border-', '')
                btn.style.color = color[_c]
                btn.style.backgroundColor = '#fff'
                btn.style.borderColor = color[_c]
              } else if (btn.class === 'gray') {
                btn.style.color = 'rgba(0, 0, 0, 0.65)'
                btn.style.backgroundColor = color[btn.class]
                btn.style.borderColor = color[btn.class]
              } else {
                btn.style.color = '#ffffff'
                btn.style.backgroundColor = color[btn.class]
                btn.style.borderColor = color[btn.class]
              }
            }
          }