| | |
| | | }, () => { |
| | | if (this.state.setting) { |
| | | this.loadmaindata(nextProps.BID, 'refresh') |
| | | this.getStatFieldsValue(nextProps.BID, 'refresh') |
| | | } |
| | | }) |
| | | } else if (!this.props.Tab.supMenu && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | | if (this.state.setting) { |
| | | this.setState({}, () => { |
| | | this.loadmaindata() |
| | | this.getStatFieldsValue() |
| | | }) |
| | | } |
| | | } |
| | |
| | | |
| | | try { // 配置信息解析 |
| | | config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) |
| | | config.setting.MenuName = Tab.label |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | config = '' |
| | |
| | | config.setting.execute = config.setting.default !== 'false' // 默认sql是否执行,转为boolean 统一格式 |
| | | config.setting.customScript = '' // 自定义脚本 |
| | | |
| | | if (config.setting.interType === 'system') { |
| | | if (config.setting.interType === 'system' || (config.setting.interType === 'custom' && config.setting.requestMode === 'system')) { |
| | | if (config.setting.scripts && config.setting.scripts.length > 0) { |
| | | let _customScript = '' |
| | | config.setting.scripts.forEach(item => { |
| | |
| | | }, () => { |
| | | if (config.setting.onload !== 'false' && (!Tab.supMenu || BID || Tab.isTreeNode) && valid) { // 初始化可加载 |
| | | this.loadmaindata() |
| | | this.getStatFieldsValue() |
| | | } |
| | | }) |
| | | } else { |
| | |
| | | if (!bid) { // 主表ID不存在时,不查询子表 |
| | | this.setState({ |
| | | data: [], |
| | | statFValue: [], |
| | | total: 0 |
| | | }) |
| | | return |
| | |
| | | _BID = bid |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | selectedData: [], |
| | | loading: true |
| | |
| | | } |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | |
| | | this.getStatFieldsValue(_BID, searches) |
| | | |
| | | if (result.status) { |
| | | this.setState({ |
| | | data: result.data.map((item, index) => { |
| | |
| | | /** |
| | | * @description 获取合计字段值 |
| | | */ |
| | | getStatFieldsValue = (bid, type) => { |
| | | const { mainSearch } = this.props |
| | | const { setting, search, orderBy, statFields } = this.state |
| | | getStatFieldsValue = (bid, searches) => { |
| | | const { setting, orderBy, statFields } = this.state |
| | | |
| | | let _BID = this.props.BID |
| | | let searches = fromJS(search).toJS() |
| | | if (mainSearch && mainSearch.length > 0) { // 主表搜索条件 |
| | | searches = [...mainSearch, ...searches] |
| | | } |
| | | |
| | | if (statFields.length === 0 || setting.interType !== 'system' || !setting.dataresource) return |
| | | |
| | | let requireFields = search.filter(item => item.required && (!item.value || item.value.length === 0)) |
| | | if (requireFields.length > 0) { |
| | | return |
| | | } |
| | | |
| | | if (type === 'refresh') { |
| | | if (!bid) { // 主表ID不存在时,不查询子表合计值 |
| | | this.setState({ |
| | | statFValue: [] |
| | | }) |
| | | return |
| | | } else { |
| | | _BID = bid |
| | | } |
| | | } |
| | | if (statFields.length === 0 || !(setting.interType === 'system' || (setting.interType === 'custom' && setting.requestMode === 'system')) || !setting.dataresource) return |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getStatQueryDataParams(setting, statFields, searches, _orderBy, _BID, this.props.menuType) |
| | | let param = UtilsDM.getStatQueryDataParams(setting, statFields, searches, _orderBy, bid, this.props.menuType) |
| | | |
| | | if (param.func === 'sPC_Get_TableData') { |
| | | param.menuname = this.props.Tab.label || '' |
| | |
| | | search: searches, |
| | | }, () => { |
| | | this.loadmaindata() |
| | | this.getStatFieldsValue() |
| | | }) |
| | | } |
| | | |
| | |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadmaindata() |
| | | this.getStatFieldsValue() |
| | | }) |
| | | } else { |
| | | MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid, 'false') // 列表重置 |
| | | this.loadmaindata() |
| | | this.getStatFieldsValue() |
| | | } |
| | | } |
| | | |