king
2020-01-03 4d62306be71cef7d62059f07199426f96353c412
src/tabviews/subtable/index.jsx
@@ -16,7 +16,7 @@
const SubTabTable = asyncComponent(() => import('@/tabviews/subtabtable'))
export default class NormalTable extends Component {
export default class SubTabViewTable extends Component {
  static propTpyes = {
    Tab: PropTypes.object,           // 标签信息
    BID: PropTypes.string,           // 上级数据ID
@@ -56,7 +56,7 @@
   */
  UNSAFE_componentWillReceiveProps(nextProps) {
    if (this.props.Tab.supMenu && !is(fromJS(this.props.BID), fromJS(nextProps.BID))) {
      this.loadmaindata()
      this.loadmaindata(nextProps.BID, 'refresh')
    }
  }
@@ -265,14 +265,19 @@
  /**
   * @description 子表数据加载
   */
  async loadmaindata () {
  async loadmaindata (bid, type) {
    const { setting } = this.state
    let param = ''
    let _BID = this.props.BID
    if (type === 'refresh') {
      _BID = bid
    }
    if (setting.interType !== 'inner' || (setting.interType === 'inner' && setting.innerFunc)) {
      param = this.getCustomParam()
      param = this.getCustomParam(_BID)
    } else {
      param = this.getDefaultParam()
      param = this.getDefaultParam(_BID)
    }
    this.handleTableId('')
@@ -302,7 +307,7 @@
  /**
   * @description 获取用户自定义存储过程传参
   */
  getCustomParam = () => {
  getCustomParam = (BID) => {
    const { pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state
    let _search = Utils.formatCustomMainSearch(search)
@@ -312,6 +317,7 @@
      PageSize: pageSize,
      OrderCol: orderColumn,
      OrderType: orderType,
      BID: BID,
      ..._search
    }
@@ -330,7 +336,7 @@
  /**
   * @description 获取系统存储过程 sPC_Get_TableData 的参数
   */
  getDefaultParam = () => {
  getDefaultParam = (BID) => {
    const { arr_field, pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state
    let _search = Utils.joinMainSearchkey(search)
@@ -340,7 +346,7 @@
      func: 'sPC_Get_TableData',
      obj_name: 'data',
      arr_field: arr_field,
      BID: this.props.BID
      BID: BID
    }
    let orderBy = orderColumn ? (orderColumn + ' ' + orderType) : setting.order
@@ -352,12 +358,12 @@
    let LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows`
    let DateCount = `select count(1) as total from ${_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)
    param.DateCount = Utils.formatOptions(DateCount)
    console.log(param)
    return param
  }