| | |
| | | |
| | | 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 |
| | |
| | | */ |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | if (this.props.Tab.supMenu && !is(fromJS(this.props.BID), fromJS(nextProps.BID))) { |
| | | this.loadmaindata() |
| | | this.loadmaindata(nextProps.BID, 'refresh') |
| | | } |
| | | } |
| | | |
| | |
| | | /** |
| | | * @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('') |
| | |
| | | /** |
| | | * @description 获取用户自定义存储过程传参 |
| | | */ |
| | | getCustomParam = () => { |
| | | getCustomParam = (BID) => { |
| | | const { pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state |
| | | |
| | | let _search = Utils.formatCustomMainSearch(search) |
| | |
| | | PageSize: pageSize, |
| | | OrderCol: orderColumn, |
| | | OrderType: orderType, |
| | | BID: BID, |
| | | ..._search |
| | | } |
| | | |
| | |
| | | /** |
| | | * @description 获取系统存储过程 sPC_Get_TableData 的参数 |
| | | */ |
| | | getDefaultParam = () => { |
| | | getDefaultParam = (BID) => { |
| | | const { arr_field, pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state |
| | | |
| | | let _search = Utils.joinMainSearchkey(search) |
| | |
| | | func: 'sPC_Get_TableData', |
| | | obj_name: 'data', |
| | | arr_field: arr_field, |
| | | BID: this.props.BID |
| | | BID: BID |
| | | } |
| | | |
| | | let orderBy = orderColumn ? (orderColumn + ' ' + orderType) : setting.order |
| | |
| | | |
| | | 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 |
| | | } |
| | | |