| | |
| | | config: null, // 页面配置信息,包括组件等 |
| | | mainSearch: null, |
| | | userConfig: null, // 用户自定义设置 |
| | | arr_field: '', // 使用 sPC_Get_TableData 时的查询字段集 |
| | | setting: null, // 页面全局设置:数据源、按钮及显示列固定、主键等 |
| | | data: null, // 列表数据集 |
| | | loading: false, // 列表数据加载中 |
| | | visible: false, // 标签页控制 |
| | |
| | | let config = '' |
| | | let userConfig = null |
| | | |
| | | setTimeout(() => { // 延时加载状态 |
| | | this.setState({ |
| | | loadingview: false |
| | | }) |
| | | }, 1500) |
| | | |
| | | try { // 配置信息解析 |
| | | config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) |
| | | } catch (e) { |
| | |
| | | // 页面配置解析错误时提示 |
| | | if (!config) { |
| | | this.setState({ |
| | | viewlost: true |
| | | viewlost: true, |
| | | loadingview: false |
| | | }) |
| | | return |
| | | } |
| | |
| | | if (!config.enabled) { |
| | | this.setState({ |
| | | viewlost: true, |
| | | loadingview: false, |
| | | lostmsg: this.state.dict['main.view.unenabled'] |
| | | }) |
| | | return |
| | |
| | | }) |
| | | |
| | | let params = [] |
| | | config.components = this.formatSetting(config.components, params, mainSearch, permAction) |
| | | let BID = param && param.BID ? param.BID : '' |
| | | config.components = this.formatSetting(config.components, params, mainSearch, permAction, BID) |
| | | |
| | | this.setState({ |
| | | BID: param && param.BID ? param.BID : '', |
| | | BID: BID, |
| | | userConfig: userConfig, |
| | | setting: config.setting, |
| | | config, |
| | | mainSearch |
| | | }, () => { |
| | | if (!params || params.length === 0) { |
| | | setTimeout(() => { // 延时加载状态 |
| | | this.setState({ |
| | | loadingview: false |
| | | }) |
| | | }, 1000) |
| | | } else { |
| | | this.loadmaindata(params) |
| | | } |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | |
| | | } |
| | | |
| | | // 格式化默认设置 |
| | | formatSetting = (components, params, mainSearch, permAction) => { |
| | | formatSetting = (components, params, mainSearch, permAction, BID) => { |
| | | return components.map(component => { |
| | | if (component.type === 'tabs') { |
| | | component.subtabs = component.subtabs.map(tab => { |
| | |
| | | // dataName 系统生成的数据源名称 |
| | | // pageable 是否分页,组件属性,不分页的组件才可以统一查询 |
| | | if (component.floor === 1 && component.dataName && (!component.pageable || (component.pageable && !component.setting.laypage)) && component.setting.onload === 'true' && component.setting.sync === 'true') { |
| | | let param = this.getDefaultParam(component, mainSearch) |
| | | let param = this.getDefaultParam(component, mainSearch, BID) |
| | | params.push(param) |
| | | } else if (component.floor === 1) { |
| | | component.setting.sync = 'false' |
| | |
| | | /** |
| | | * @description 获取系统存储过程 sPC_Get_TableData 的参数 |
| | | */ |
| | | getDefaultParam = (component, mainSearch) => { |
| | | getDefaultParam = (component, mainSearch, BID) => { |
| | | const { columns, search, setting, dataName, format } = component |
| | | |
| | | let searchlist = [] |
| | |
| | | let _dataresource = setting.dataresource |
| | | let _customScript = setting.customScript |
| | | |
| | | |
| | | if (setting.queryType === 'statistics' || _customScript) { |
| | | let allSearch = Utils.getAllSearchOptions(searchlist) |
| | | let regoptions = allSearch.map(item => { |
| | |
| | | if (_dataresource && setting.queryType === 'statistics') { |
| | | _dataresource = _dataresource.replace(item.reg, item.value) |
| | | } |
| | | if (_customScript) { |
| | | _customScript = _customScript.replace(item.reg, item.value) |
| | | } |
| | | }) |
| | | |
| | | _dataresource = _dataresource.replace(/@BID@/ig, BID) |
| | | _customScript = _customScript.replace(/@BID@/ig, BID) |
| | | } |
| | | |
| | | let _search = '' |
| | |
| | | * @description 主表数据加载 |
| | | */ |
| | | loadmaindata = (params) => { |
| | | if (!params || params.length === 0) return |
| | | let LText_field = [] |
| | | let LText = params.map((item, index) => { |
| | | let _sql = item.sql |
| | |
| | | param.LText_field = Utils.formatOptions(param.LText_field) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | this.setState({loading: true, loadingview: false}) |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | if (result.status) { |
| | |
| | | |
| | | render() { |
| | | const { menuType, MenuNo } = this.props |
| | | const { loadingview, viewlost, config } = this.state |
| | | const { loadingview, viewlost, config, loading } = this.state |
| | | |
| | | return ( |
| | | <div className="custom-page-wrap" id={this.state.ContainerId} style={config ? config.style : null}> |
| | | {loadingview && <Spin size="large" />} |
| | | {(loadingview || loading) ? <Spin size="large" /> : null} |
| | | <Row>{this.getComponents()}</Row> |
| | | {MenuNo && options.sysType !== 'cloud' && menuType !== 'HS' ? <Button |
| | | icon="copy" |