| | |
| | | let chartId = config.charts[0] ? config.charts[0].uuid : '' |
| | | |
| | | // 字段权限黑名单 |
| | | config.search = config.search.filter(item => { |
| | | if (!item.blacklist || item.blacklist.length === 0) return true |
| | | config.search = config.search.map(item => { |
| | | item.oriInitval = item.initval |
| | | if (['text', 'select', 'link'].includes(item.type) && param) { |
| | | if (param.searchkey === item.field) { |
| | | item.initval = param.searchval |
| | | } else if (param.BID && item.field === 'BID') { |
| | | item.initval = param.BID |
| | | } |
| | | } |
| | | |
| | | if (!item.blacklist || item.blacklist.length === 0) return item |
| | | |
| | | let _black = item.blacklist.filter(v => { |
| | | return this.props.permRoles.indexOf(v) !== -1 |
| | | }) |
| | | |
| | | if (_black.length > 0) { |
| | | return false |
| | | } else { |
| | | return true |
| | | item.Hide = 'true' |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | config.columns = config.columns.filter(col => { |
| | | if (!col.field || !col.blacklist || col.blacklist.length === 0 || config.setting.primaryKey === col.field) return true |
| | | config.columns = config.columns.map(col => { |
| | | if (!col.field || !col.blacklist || col.blacklist.length === 0 || config.setting.primaryKey === col.field) return col |
| | | |
| | | let _black = col.blacklist.filter(v => { |
| | | return this.props.permRoles.indexOf(v) !== -1 |
| | | }) |
| | | |
| | | if (_black.length > 0) { |
| | | return false |
| | | } else { |
| | | return true |
| | | col.Hide = 'true' |
| | | } |
| | | |
| | | return col |
| | | }) |
| | | |
| | | // 标记主页面,用于按钮固定及表单挂载设置 |
| | |
| | | col.sort = index |
| | | |
| | | if (col.type === 'colspan' && col.sublist) { |
| | | let _col = JSON.parse(JSON.stringify(col)) |
| | | let _col = fromJS(col).toJS() |
| | | let subColumn = [] |
| | | _col.sublist.forEach(sub => { |
| | | if (colMap.has(sub)) { |
| | |
| | | |
| | | let valid = true // 搜索条件必填验证, 初始搜索条件, 如通过上级透视,写入搜索条件 |
| | | let initSearch = config.search.map(item => { |
| | | let _item = JSON.parse(JSON.stringify(item)) |
| | | if (_item.type === 'text' && param && param.searchkey === _item.field) { |
| | | _item.initval = param.searchval |
| | | } |
| | | let _item = fromJS(item).toJS() |
| | | |
| | | if (_item.required === 'true' && !_item.initval) { |
| | | valid = false |
| | |
| | | arr_field: _arrField.join(','), |
| | | search: Utils.initMainSearch(initSearch) // 搜索条件初始化(含有时间格式,需要转化) |
| | | }, () => { |
| | | this.improveSearch() |
| | | if (config.setting.onload !== 'false' && valid) { // 初始化可加载 |
| | | this.loadmaindata() |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 搜索条件下拉选项预加载 |
| | | */ |
| | | improveSearch = () => { |
| | | let searchlist = JSON.parse(JSON.stringify(this.state.searchlist)) |
| | | let deffers = [] |
| | | searchlist.forEach(item => { |
| | | if (item.type !== 'multiselect' && item.type !== 'select' && item.type !== 'link') return |
| | | if (item.setAll === 'true') { |
| | | item.options.unshift({ |
| | | key: Utils.getuuid(), |
| | | Value: '', |
| | | Text: this.state.dict['main.all'] |
| | | }) |
| | | } |
| | | |
| | | if (item.resourceType === '1' && item.dataSource) { |
| | | let _option = Utils.getSelectQueryOptions(item) |
| | | let _sql = Utils.formatOptions(_option.sql) |
| | | let isSSO = item.database === 'sso' |
| | | |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: _sql, |
| | | obj_name: 'data', |
| | | arr_field: _option.field |
| | | } |
| | | |
| | | if (this.state.BID) { |
| | | param.BID = this.state.BID |
| | | } |
| | | |
| | | if (this.props.dataManager) { // 数据权限 |
| | | param.LText = param.LText.replace(/\$@/ig, '/*') |
| | | param.LText = param.LText.replace(/@\$/ig, '*/') |
| | | } else { |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '') |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | if (this.props.menuType === 'HS') { // 云端数据验证 |
| | | param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) |
| | | } |
| | | |
| | | let defer = new Promise(resolve => { |
| | | Api.getSystemCacheConfig(param, isSSO).then(res => { |
| | | res.search = item |
| | | resolve(res) |
| | | }) |
| | | }) |
| | | deffers.push(defer) |
| | | } else if (item.resourceType === '1' && !item.dataSource) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: item.label + ': ' + this.state.dict['main.datasource.settingerror'], |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | if (deffers.length === 0) { |
| | | this.setState({searchlist: JSON.parse(JSON.stringify(searchlist))}) |
| | | return |
| | | } |
| | | |
| | | Promise.all(deffers).then(result => { |
| | | result.forEach(res => { |
| | | if (res.status) { |
| | | searchlist = searchlist.map(item => { |
| | | if (item.uuid === res.search.uuid) { |
| | | res.data.forEach(cell => { |
| | | let _item = { |
| | | key: Utils.getuuid(), |
| | | Value: cell[res.search.valueField], |
| | | Text: cell[res.search.valueText] |
| | | } |
| | | |
| | | if (res.search.type === 'link') { |
| | | _item.parentId = cell[res.search.linkField] |
| | | } |
| | | |
| | | item.options.push(_item) |
| | | }) |
| | | } |
| | | return item |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.search.label + ':' + res.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | this.setState({searchlist}) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 主表数据加载 |
| | | */ |
| | | async loadmaindata () { |
| | |
| | | param = this.getDefaultParam() |
| | | } |
| | | |
| | | param.BID = BID |
| | | if (BID) { |
| | | param.BID = BID |
| | | } |
| | | // 数据管理权限 |
| | | if (this.props.dataManager) { |
| | | param.dataM = 'Y' |
| | | } |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | |
| | | let param = { |
| | | OrderCol: orderBy || setting.order, |
| | | dataM: this.props.dataManager ? 'Y' : '', |
| | | ..._search |
| | | } |
| | | |
| | |
| | | if (setting.interType === 'inner') { |
| | | param.func = setting.innerFunc |
| | | } else { |
| | | if (setting.sysInterface === 'true' && window.GLOB.mainSystemApi) { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } else if (setting.sysInterface !== 'true') { |
| | | param.rduri = setting.interface |
| | | if (this.props.menuType === 'HS') { |
| | | if (setting.sysInterface === 'true' && options.cloudServiceApi) { |
| | | param.rduri = options.cloudServiceApi |
| | | } else if (setting.sysInterface !== 'true') { |
| | | param.rduri = setting.interface |
| | | } |
| | | } else { |
| | | if (setting.sysInterface === 'true' && window.GLOB.mainSystemApi) { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } else if (setting.sysInterface !== 'true') { |
| | | param.rduri = setting.interface |
| | | } |
| | | } |
| | | |
| | | if (setting.outerFunc) { |
| | |
| | | obj_name: 'data', |
| | | arr_field: arr_field, |
| | | custom_script: setting.customScript || '', |
| | | default_sql: setting.default || 'true', |
| | | dataM: this.props.dataManager ? 'Y' : '' |
| | | default_sql: setting.default || 'true' |
| | | } |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | |
| | | {loadingview && <Spin size="large" />} |
| | | {searchlist && searchlist.length > 0 ? |
| | | <MainSearch |
| | | BID={BID} |
| | | dict={this.state.dict} |
| | | searchlist={searchlist} |
| | | menuType={this.props.menuType} |
| | | dataManager={this.props.dataManager} |
| | | refreshdata={this.refreshbysearch} |
| | | /> : null |
| | | } |
| | |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | | <ChartComponent |
| | | BID={BID} |
| | | plot={item} |
| | | config={config} |
| | | data={this.state.data} |
| | | getexceloutparam={this.getexceloutparam} |
| | | loading={this.state.loading} |
| | | /> |
| | | </Col> |