king
2019-12-18 1a14ff6035932eadfb6ef7970e3adb24b4e158a6
src/tabviews/commontable/index.jsx
@@ -248,7 +248,7 @@
    let LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${setting.dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows`
    let DateCount = `select count(1) as total from ${setting.dataresource} ${_search}`
    console.log(LText)
    param.LText = Utils.formatOptions(LText)
    param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
    param.secretkey = Utils.encrypt(param.LText, param.timestamp)
@@ -368,7 +368,33 @@
      this.reloadtable()
    } else if (btn.execError === 'view' && type === 'error') {
      this.reloadview()
    } else if (type === 'excelOut') {
      this.handleExcelout()
    }
  }
  handleExcelout = () => {
    const { arr_field, orderColumn, orderType, search, setting } = this.state
    let _search = Utils.joinMainSearchkey(search)
    _search = _search ? 'where (' + _search + ')' : ''
    // 获取列表数据
    let param = {
      func: setting.innerFunc || 'sPC_Get_TableData',
      obj_name: 'data',
      arr_field: arr_field
    }
    let orderBy = orderColumn ? (orderColumn + ' ' + orderType) : setting.order
    let LText = `select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${setting.dataresource} ${_search}) tmptable order by tmptable.rows`
    param.LText = Utils.formatOptions(LText)
    param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
    param.secretkey = Utils.encrypt(param.LText, param.timestamp)
    param.DateCount = ''
    Api.genericInterface(param)
  }
  gettableselected = () => {
@@ -378,6 +404,10 @@
      data.push(this.refs.mainTable.props.data[item])
    })
    return data
  }
  buttonTrigger = (btn, record) => {
    this.refs.mainButton.actionTrigger(btn, record)
  }
  UNSAFE_componentWillMount () {
@@ -404,6 +434,7 @@
        }
        {actions &&
          <MainAction
            ref="mainButton"
            MenuID={this.props.MenuID}
            setting={setting}
            refreshdata={this.refreshbyaction}
@@ -415,14 +446,15 @@
        {columns &&
          <MainTable
            ref="mainTable"
            dict={this.state.dict}
            MenuID={this.props.MenuID}
            setting={setting}
            refreshdata={this.refreshbytable}
            columns={columns}
            data={this.state.data}
            total={this.state.total}
            loading={this.state.loading}
            dict={this.state.dict}
            refreshdata={this.refreshbytable}
            buttonTrigger={this.buttonTrigger}
          />
        }
        <BackTop>