import React, {Component} from 'react'
|
import PropTypes from 'prop-types'
|
import {connect} from 'react-redux'
|
import { is, fromJS } from 'immutable'
|
import { notification, Spin, Switch, Row, Col, Icon, Tabs} from 'antd'
|
|
import Api from '@/api'
|
import zhCN from '@/locales/zh-CN/main.js'
|
import enUS from '@/locales/en-US/main.js'
|
import Utils from '@/utils/utils.js'
|
import UtilsDM from '@/utils/utils-datamanage.js'
|
import UtilsUpdate from '@/utils/utils-update.js'
|
import { modifyTabview } from '@/store/action'
|
|
import SubSearch from '@/tabviews/zshare/topSearch'
|
import asyncComponent from '@/utils/asyncComponent'
|
import asyncSpinComponent from '@/utils/asyncSpinComponent'
|
import NotFount from '@/components/404'
|
import MKEmitter from '@/utils/events.js'
|
|
import './index.scss'
|
|
const { TabPane } = Tabs
|
const SubAction = asyncComponent(() => import('@/tabviews/zshare/actionList'))
|
const SubTable = asyncSpinComponent(() => import('@/tabviews/zshare/normalTable'))
|
const CardComponent = asyncSpinComponent(() => import('@/tabviews/zshare/cardcomponent'))
|
const ChartComponent = asyncSpinComponent(() => import('@/tabviews/zshare/chartcomponent'))
|
|
class SubTabViewTable extends Component {
|
static propTpyes = {
|
Tab: PropTypes.object, // 标签信息
|
BID: PropTypes.string, // 上级数据ID
|
BData: PropTypes.any, // 上级数据
|
MenuID: PropTypes.string, // 菜单Id
|
SupMenuID: PropTypes.string, // 上级菜单Id
|
mainSearch: PropTypes.any, // 主表搜索条件
|
ContainerId: PropTypes.any, // 三级菜单Container(html) ID
|
handleTableId: PropTypes.func, // 控制表格数据切换时,更新在主表中的id
|
userConfig: PropTypes.any, // 用户自定义设置
|
}
|
|
state = {
|
dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
|
loadingview: true, // 页面加载中
|
viewlost: false, // 页面丢失:1、未获取到配置-页面丢失;2、页面未启用
|
lostmsg: '', // 页面丢失时的提示信息
|
config: null, // 页面配置信息,包括按钮、搜索、显示列、标签等
|
searchlist: null, // 搜索条件
|
actions: null, // 按钮集
|
columns: null, // 显示列
|
logcolumns: null, // 日志中显示的列信息 (增加至全部列,除去合并列)
|
arr_field: '', // 使用 sPC_Get_TableData 时的查询字段集
|
setting: null, // 页面全局设置:数据源、按钮及显示列固定、主键等
|
data: null, // 列表数据集
|
selectedData: [], // 已选表格数据
|
total: 0, // 总数
|
loading: false, // 列表数据加载中
|
pageIndex: 1, // 页码
|
pageSize: 10, // 每页数据条数
|
orderBy: '', // 排序
|
search: [], // 搜索条件数组,使用时需分场景处理
|
pickup: false, // 子表数据隐藏显示切换
|
chartId: '', // 展开图表ID
|
statFields: [], // 合计字段
|
statFValue: [] // 合计值
|
}
|
|
/**
|
* @description 上级菜单id变化时,刷新数据
|
*/
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
if (this.state.config && this.props.Tab.supMenu && !is(fromJS(this.props.BID), fromJS(nextProps.BID))) {
|
MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid) // 列表重置
|
this.setState({
|
pageIndex: 1
|
}, () => {
|
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()
|
})
|
}
|
}
|
}
|
|
/**
|
* @description 获取页面配置信息
|
*/
|
async loadconfig () {
|
const { permAction, permMenus, Tab, BID, userConfig } = this.props
|
|
let param = {
|
func: 'sPC_Get_LongParam',
|
MenuID: this.props.MenuID
|
}
|
let result = await Api.getCacheConfig(param)
|
if (result.status) {
|
let config = ''
|
|
try { // 配置信息解析
|
config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam)))
|
} catch (e) {
|
console.warn('Parse Failure')
|
config = ''
|
}
|
|
// 页面配置解析错误时提示
|
if (!config) {
|
this.setState({
|
loadingview: false,
|
viewlost: true
|
})
|
return
|
}
|
|
// 页面未启用时,显示未启用页面
|
if (!config.enabled) {
|
this.setState({
|
loadingview: false,
|
viewlost: true,
|
lostmsg: this.state.dict['main.view.unenabled']
|
})
|
return
|
}
|
|
let _arrField = [] // 字段集
|
let _columns = [] // 显示列
|
let _logcolumns = [] // 日志显示列
|
let _hideCol = [] // 隐藏及合并列中字段的uuid集
|
let colMap = new Map()
|
let statFields = [] // 合计字段信息
|
|
// 版本兼容
|
config = UtilsUpdate.updateSubTable(config)
|
|
// 权限过滤
|
if (this.props.menuType !== 'HS') {
|
config.action = config.action.filter(item => permAction[item.uuid])
|
}
|
|
let roleId = sessionStorage.getItem('role_id') || '' // 角色ID
|
// 字段权限黑名单
|
config.search = config.search.map(item => {
|
item.oriInitval = item.initval
|
if (!item.blacklist || item.blacklist.length === 0) return item
|
if (item.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
|
item.Hide = 'true'
|
}
|
return item
|
})
|
|
config.columns = config.columns.map(col => {
|
if (!col.blacklist || col.blacklist.length === 0) return col
|
if (col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
|
col.Hide = 'true'
|
}
|
|
return col
|
})
|
|
// 视图权限
|
config.charts = config.charts.filter(item => {
|
if (item.Hide === 'true') return false
|
if (!item.blacklist || item.blacklist.length === 0) return true
|
return item.blacklist.filter(v => roleId.indexOf(v) > -1).length === 0
|
})
|
|
if (config.charts.length <= 1) {
|
config.expand = true
|
}
|
|
let chartId = config.charts[0] ? config.charts[0].uuid : ''
|
|
if (userConfig) {
|
config.action = config.action.map(item => {
|
if (userConfig.action[item.uuid]) {
|
delete userConfig.action[item.uuid].label
|
item = {...item, ...userConfig.action[item.uuid]}
|
}
|
|
if (item.execMode) {
|
item.OpenType = 'funcbutton'
|
}
|
|
if (item.OpenType === 'funcbutton' && item.funcType === 'print' && item.verify && item.printer) {
|
item.verify.defaultPrinter = item.printer.defaultPrinter || ''
|
if (item.verify.printerTypeList && item.printer.printerList) {
|
item.verify.printerTypeList = item.verify.printerTypeList.map(cell => {
|
cell.printer = item.printer.printerList[cell.Value] || ''
|
|
return cell
|
})
|
}
|
}
|
|
return item
|
})
|
}
|
|
// 1、筛选字段集,2、过滤隐藏列及合并列中的字段uuid
|
config.columns.forEach(col => {
|
if (col.field) {
|
_arrField.push(col.field)
|
_logcolumns.push(col)
|
|
col.nameField && _arrField.push(col.nameField) // 链接名字段
|
if (col.Hide !== 'true' && col.type === 'number' && col.sum === 'true') {
|
statFields.push(col)
|
}
|
}
|
if (col.type === 'colspan' && col.sublist) { // 筛选隐藏列
|
_hideCol = _hideCol.concat(col.sublist)
|
} else if (col.Hide === 'true') {
|
_hideCol.push(col.uuid)
|
}
|
colMap.set(col.uuid, col)
|
})
|
|
// 生成显示列,处理合并列中的字段
|
config.columns.forEach((col, index) => {
|
if (_hideCol.includes(col.uuid)) return
|
|
if (col.linkmenu && col.linkmenu.length > 0) {
|
let menu_id = col.linkmenu.slice(-1)[0]
|
col.linkThdMenu = permMenus.filter(m => m.MenuID === menu_id)[0] || ''
|
} else {
|
col.linkThdMenu = ''
|
}
|
|
col.sort = index
|
|
if (col.type === 'colspan' && col.sublist) {
|
let _col = JSON.parse(JSON.stringify(col))
|
let subcols = []
|
_col.sublist.forEach(sub => {
|
if (colMap.has(sub)) {
|
subcols.push(colMap.get(sub))
|
}
|
})
|
_col.subcols = subcols
|
_columns.push(_col)
|
} else {
|
_columns.push(col)
|
}
|
})
|
|
let _actions = [] // 工具栏按钮
|
let _operations = [] // 操作列按钮(存在时)
|
|
config.action.forEach(item => {
|
if (item.execMode) {
|
item.OpenType = 'funcbutton'
|
}
|
|
if (item.position === 'toolbar') {
|
_actions.push(item)
|
} else if (item.position === 'grid') {
|
_operations.push(item)
|
}
|
})
|
|
if (config.gridBtn && config.gridBtn.display && _operations.length > 0) {
|
config.gridBtn.operations = _operations
|
_columns.push(config.gridBtn)
|
}
|
|
let valid = true // 搜索条件必填验证
|
config.search.forEach(field => {
|
if (field.required === 'true' && !field.initval) {
|
valid = false
|
}
|
})
|
|
// 添加用户显示列设置
|
if (userConfig) {
|
_columns = _columns.map(item => {
|
if (userConfig.columns[item.uuid]) {
|
delete userConfig.columns[item.uuid].label
|
item = {...item, ...userConfig.columns[item.uuid]}
|
}
|
|
return item
|
})
|
|
_columns.sort((pre, next) => {
|
return pre.sort - next.sort
|
})
|
}
|
|
config.setting.tabType = 'sub'
|
// 数据源信息预处理
|
config.setting.laypage = config.setting.laypage !== 'false' // 是否分页,转为boolean 统一格式
|
config.setting.execute = config.setting.default !== 'false' // 默认sql是否执行,转为boolean 统一格式
|
config.setting.customScript = '' // 自定义脚本
|
|
if (config.setting.interType === 'system') {
|
if (config.setting.scripts && config.setting.scripts.length > 0) {
|
let _customScript = ''
|
config.setting.scripts.forEach(item => {
|
if (item.status === 'false') return
|
_customScript += `
|
${item.sql}
|
`
|
})
|
config.setting.customScript = _customScript
|
}
|
|
if (!config.setting.execute) { // 默认sql 不执行时 置空
|
config.setting.dataresource = ''
|
} else {
|
config.setting.dataresource = config.setting.dataresource || ''
|
}
|
if (/\s/.test(config.setting.dataresource)) {
|
config.setting.dataresource = '(' + config.setting.dataresource + ') tb'
|
}
|
|
if (sessionStorage.getItem('dataM') === 'true') { // 数据权限
|
config.setting.dataresource = config.setting.dataresource.replace(/\$@/ig, '/*')
|
config.setting.dataresource = config.setting.dataresource.replace(/@\$/ig, '*/')
|
config.setting.customScript = config.setting.customScript.replace(/\$@/ig, '/*')
|
config.setting.customScript = config.setting.customScript.replace(/@\$/ig, '*/')
|
} else {
|
config.setting.dataresource = config.setting.dataresource.replace(/@\$|\$@/ig, '')
|
config.setting.customScript = config.setting.customScript.replace(/@\$|\$@/ig, '')
|
}
|
}
|
|
this.setState({
|
loadingview: false,
|
chartId: chartId,
|
config: config,
|
statFields: statFields,
|
setting: config.setting,
|
searchlist: config.search,
|
actions: _actions,
|
columns: _columns,
|
logcolumns: _logcolumns,
|
arr_field: _arrField.join(','),
|
search: Utils.initMainSearch(config.search) // 搜索条件初始化(含有时间格式,需要转化)
|
}, () => {
|
if (config.setting.onload !== 'false' && (!Tab.supMenu || BID || Tab.isTreeNode) && valid) { // 初始化可加载
|
this.loadmaindata()
|
this.getStatFieldsValue()
|
}
|
})
|
} else {
|
this.setState({
|
loadingview: false,
|
viewlost: true
|
})
|
let prex = Tab && Tab.label ? Tab.label + ': ' : ''
|
|
notification.warning({
|
top: 92,
|
message: prex + result.message,
|
duration: 5
|
})
|
}
|
}
|
|
/**
|
* @description 子表数据加载
|
*/
|
async loadmaindata (bid, type) {
|
const { mainSearch } = this.props
|
const { setting, arr_field, search, orderBy, pageIndex, pageSize } = this.state
|
|
let _BID = this.props.BID
|
let searches = fromJS(search).toJS()
|
if (mainSearch && mainSearch.length > 0) { // 主表搜索条件
|
searches = [...mainSearch, ...searches]
|
}
|
|
let requireFields = search.filter(item => item.required && (!item.value || item.value.length === 0))
|
let prex = this.props.Tab && this.props.Tab.label ? this.props.Tab.label + '-' : ''
|
|
if (requireFields.length > 0) {
|
let labels = requireFields.map(item => item.label)
|
labels = Array.from(new Set(labels))
|
|
notification.warning({
|
top: 92,
|
message: prex + this.state.dict['form.required.input'] + labels.join('、') + ' !',
|
duration: 3
|
})
|
return
|
}
|
|
if (type === 'refresh') {
|
if (!bid) { // 主表ID不存在时,不查询子表
|
this.setState({
|
data: [],
|
total: 0
|
})
|
return
|
} else {
|
_BID = bid
|
}
|
}
|
this.setState({
|
selectedData: [],
|
loading: true
|
})
|
|
let _orderBy = orderBy || setting.order
|
let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, _BID, this.props.menuType)
|
|
this.handleTableId()
|
|
if (param.func === 'sPC_Get_TableData') {
|
param.menuname = this.props.Tab.label || ''
|
}
|
|
let result = await Api.genericInterface(param)
|
if (result.status) {
|
this.setState({
|
data: result.data.map((item, index) => {
|
item.key = index
|
return item
|
}),
|
total: result.total,
|
pickup: false,
|
loading: false
|
})
|
} else {
|
this.setState({
|
loading: false
|
})
|
|
notification.error({
|
top: 92,
|
message: prex + result.message,
|
duration: 10
|
})
|
}
|
}
|
|
/**
|
* @description 获取单行数据
|
*/
|
async loadmainLinedata (id) {
|
const { mainSearch, BID } = this.props
|
const { setting, arr_field, search, orderBy, pageIndex, pageSize } = this.state
|
|
let searches = fromJS(search).toJS()
|
if (mainSearch && mainSearch.length > 0) { // 主表搜索条件
|
searches = [...mainSearch, ...searches]
|
}
|
|
this.setState({
|
loading: true
|
})
|
|
let _orderBy = orderBy || setting.order
|
let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, this.props.menuType, id)
|
|
if (param.func === 'sPC_Get_TableData') {
|
param.menuname = this.props.Tab.label || ''
|
}
|
|
let result = await Api.genericInterface(param)
|
if (result.status) {
|
let data = fromJS(this.state.data).toJS()
|
if (result.data && result.data[0]) {
|
let _data = result.data[0]
|
|
try {
|
data = data.map(item => {
|
if (item[setting.primaryKey] === _data[setting.primaryKey]) {
|
_data.key = item.key
|
return _data
|
} else {
|
return item
|
}
|
})
|
} catch {
|
console.warn('数据查询错误')
|
}
|
}
|
|
this.setState({
|
data: data,
|
loading: false
|
})
|
} else {
|
this.setState({
|
loading: false
|
})
|
notification.error({
|
top: 92,
|
message: result.message,
|
duration: 10
|
})
|
}
|
}
|
|
/**
|
* @description 获取合计字段值
|
*/
|
getStatFieldsValue = (bid, type) => {
|
const { mainSearch } = this.props
|
const { setting, search, 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
|
}
|
}
|
|
let _orderBy = orderBy || setting.order
|
let param = UtilsDM.getStatQueryDataParams(setting, statFields, searches, _orderBy, _BID, this.props.menuType)
|
|
if (param.func === 'sPC_Get_TableData') {
|
param.menuname = this.props.Tab.label || ''
|
}
|
|
Api.genericInterface(param).then(res => {
|
if (res.status) {
|
let _data = res.data[0]
|
let values = []
|
|
if (_data) {
|
statFields.forEach(item => {
|
if (_data[item.field] || _data[item.field] === 0) {
|
let val = +_data[item.field]
|
if (isNaN(val)) {
|
val = 0
|
}
|
val = val.toFixed(item.decimal)
|
values.push({label: item.label, value: val})
|
}
|
})
|
}
|
this.setState({
|
statFValue: values
|
})
|
} else {
|
this.setState({
|
statFValue: []
|
})
|
notification.error({
|
top: 92,
|
message: res.message,
|
duration: 10
|
})
|
}
|
})
|
}
|
|
/**
|
* @description 搜索条件改变时,重置表格数据
|
* 含有初始不加载的页面,修改设置
|
*/
|
refreshbysearch = (searches) => {
|
MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid) // 列表重置
|
this.setState({
|
pageIndex: 1,
|
search: searches,
|
}, () => {
|
this.loadmaindata()
|
this.getStatFieldsValue()
|
})
|
}
|
|
/**
|
* @description 表格条件改变时重置数据(分页或排序)
|
*/
|
refreshbytable = (pagination, filters, sorter) => {
|
if (sorter.order) {
|
let _chg = {
|
ascend: 'asc',
|
descend: 'desc'
|
}
|
sorter.order = _chg[sorter.order]
|
}
|
|
this.setState({
|
pageIndex: pagination.current,
|
pageSize: pagination.pageSize,
|
orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : ''
|
}, () => {
|
this.loadmaindata()
|
})
|
}
|
|
/**
|
* @description 表格刷新
|
*/
|
reloadtable = (btn) => {
|
if (!btn || btn.resetPageIndex !== 'false') {
|
MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid) // 列表重置
|
this.setState({
|
pageIndex: 1
|
}, () => {
|
this.loadmaindata()
|
this.getStatFieldsValue()
|
})
|
} else {
|
MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid, 'false') // 列表重置
|
this.loadmaindata()
|
this.getStatFieldsValue()
|
}
|
}
|
|
/**
|
* @description 按钮操作完成后(成功或失败),页面刷新,重置页码及选择项
|
*/
|
refreshbyaction = (position, btn) => {
|
const { Tab, SupMenuID, BID } = this.props
|
|
if (position === 'grid' || position === 'view') {
|
this.reloadtable(btn)
|
} else if (position === 'maingrid' || position === 'mainline') {
|
this.reloadtable(btn)
|
if (Tab.supMenu === 'mainTable') {
|
MKEmitter.emit('reloadData', SupMenuID, (BID || 'empty')) // 主表重置
|
} else if (Tab.supMenu) {
|
MKEmitter.emit('reloadData', Tab.supMenu, (BID || 'empty')) // 主表重置
|
} else if (!Tab.supMenu && Tab.level === 0) {
|
MKEmitter.emit('reloadData', SupMenuID, (BID || 'empty')) // 树形结构,0级标签
|
}
|
} else if (position === 'equaltab') {
|
this.reloadtable(btn)
|
if (Tab.equalTab && Tab.equalTab.length > 0) {
|
MKEmitter.emit('reloadData', Tab.equalTab.join(',')) // 同级标签重置
|
}
|
}
|
}
|
|
/**
|
* @description 导出Excel时,获取页面搜索排序等参数
|
*/
|
getexceloutparam = () => {
|
const { Tab, mainSearch } = this.props
|
const { arr_field, orderBy, search, setting} = this.state
|
|
let searches = search
|
if (mainSearch && mainSearch.length > 0) { // 主表搜索条件
|
searches = [...mainSearch, ...search]
|
}
|
|
return {
|
arr_field: arr_field,
|
orderBy: orderBy || setting.order,
|
search: searches,
|
menuName: Tab.label
|
}
|
}
|
|
/**
|
* @description 表格选择项切换
|
*/
|
changeSelectedData = (selectedData) => {
|
this.setState({selectedData})
|
}
|
|
/**
|
* @description 表格Id变化
|
*/
|
handleTableId = (type = this.props.Tab.uuid, id = '', data = '') => {
|
this.props.handleTableId(type, id, data)
|
}
|
|
/**
|
* @description 数据展开合并切换
|
*/
|
pickupChange = () => {
|
const { pickup } = this.state
|
|
this.setState({
|
pickup: !pickup
|
})
|
}
|
|
/**
|
* @description 图表视图切换
|
*/
|
changeChart = (uuid) => {
|
this.setState({chartId: uuid})
|
}
|
|
reloadData = (menuId, id) => {
|
const { MenuID } = this.props
|
|
if (menuId.indexOf(MenuID) === -1) return
|
if (id === 'empty') return
|
|
if (!id) {
|
this.reloadtable()
|
} else {
|
this.loadmainLinedata(id)
|
}
|
}
|
|
UNSAFE_componentWillMount() {
|
// 组件加载时,获取菜单数据
|
this.loadconfig()
|
}
|
|
shouldComponentUpdate (nextProps, nextState) { // handleTableId 函数判断时不相等
|
return !is(fromJS({...this.props, handleTableId: ''}), fromJS({...nextProps, handleTableId: ''})) || !is(fromJS(this.state), fromJS(nextState))
|
}
|
|
componentDidMount () {
|
MKEmitter.addListener('reloadData', this.reloadData)
|
}
|
|
/**
|
* @description 组件销毁,清除state更新
|
*/
|
componentWillUnmount () {
|
this.setState = () => {
|
return
|
}
|
MKEmitter.removeListener('reloadData', this.reloadData)
|
}
|
|
render() {
|
const { config, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, chartId, selectedData } = this.state
|
|
return (
|
<div className="subtable" id={'subtable' + this.props.MenuID}>
|
{loadingview && <Spin />}
|
{searchlist && searchlist.length > 0 ?
|
<SubSearch
|
BID={this.props.BID}
|
dict={this.state.dict}
|
searchlist={searchlist}
|
menuType={this.props.menuType}
|
refreshdata={this.refreshbysearch}
|
/> : null
|
}
|
{config ? <Row className="chart-view" gutter={16}>
|
{/* 视图组 */}
|
{!config.expand ? <Tabs activeKey={chartId} onChange={this.changeChart}>
|
{config.charts.map(item => (
|
<TabPane tab={<Icon type={item.icon} />} key={item.uuid}></TabPane>
|
))}
|
</Tabs> : null}
|
{config.charts.map(item => {
|
if (!config.expand && chartId !== item.uuid) return null
|
if (item.chartType === 'table') {
|
return (
|
<Col span={item.width || 24} key={item.uuid}>
|
{config.charts.length > 1 ? <p className="chart-table chart-title">{item.title}</p> : null}
|
<div className="sub-action">
|
<SubAction
|
setting={setting}
|
actions={actions}
|
Tab={this.props.Tab}
|
BID={this.props.BID}
|
BData={this.props.BData}
|
MenuID={this.props.MenuID}
|
selectedData={selectedData}
|
MenuName={this.props.Tab.label}
|
logcolumns={this.state.logcolumns}
|
refreshdata={this.refreshbyaction}
|
ContainerId={this.props.ContainerId}
|
getexceloutparam={this.getexceloutparam}
|
/>
|
</div>
|
<div className="subtable-box">
|
{(setting.tableType === 'radio' || setting.tableType === 'checkbox') && this.state.data && this.state.data.length > 0 ?
|
<Switch title="收起" className="subtable-pickup" checkedChildren="开" unCheckedChildren="关" defaultChecked={pickup} onChange={this.pickupChange} /> : null
|
}
|
<SubTable
|
tableId={this.props.Tab.uuid}
|
pickup={pickup}
|
config={config}
|
setting={setting}
|
columns={columns}
|
pageSize={pageSize}
|
BID={this.props.BID}
|
dict={this.state.dict}
|
data={this.state.data}
|
BData={this.props.BData}
|
total={this.state.total}
|
MenuID={this.props.MenuID}
|
loading={this.state.loading}
|
MenuName={this.props.Tab.label}
|
refreshdata={this.refreshbytable}
|
logcolumns={this.state.logcolumns}
|
statFValue={this.state.statFValue}
|
handleTableId={this.handleTableId}
|
ContainerId={this.props.ContainerId}
|
refreshbyaction={this.refreshbyaction}
|
chgSelectData={this.changeSelectedData}
|
/>
|
</div>
|
</Col>
|
)
|
} else if (item.chartType === 'card') {
|
return (
|
<Col className="card-view" span={item.width} key={item.uuid}>
|
<CardComponent
|
plot={item}
|
config={config}
|
Tab={this.props.Tab}
|
BID={this.props.BID}
|
BData={this.props.BData}
|
data={this.state.data}
|
MenuID={this.props.MenuID}
|
loading={this.state.loading}
|
tableId={this.props.Tab.uuid}
|
MenuName={this.props.Tab.label}
|
logcolumns={this.state.logcolumns}
|
refreshdata={this.refreshbyaction}
|
handleTableId={this.handleTableId}
|
getexceloutparam={this.getexceloutparam}
|
/>
|
</Col>
|
)
|
} else {
|
return (
|
<Col span={item.width} key={item.uuid}>
|
<ChartComponent
|
plot={item}
|
config={config}
|
BID={this.props.BID}
|
Tab={this.props.Tab}
|
data={this.state.data}
|
MenuName={this.props.Tab.label}
|
getexceloutparam={this.getexceloutparam}
|
loading={this.state.loading}
|
/>
|
</Col>
|
)
|
}
|
})}
|
</Row> : null }
|
{viewlost ? <NotFount msg={this.state.lostmsg} /> : null}
|
</div>
|
)
|
}
|
}
|
|
const mapStateToProps = (state) => {
|
return {
|
tabviews: state.tabviews,
|
menuType: state.editLevel,
|
permAction: state.permAction,
|
permMenus: state.permMenus,
|
}
|
}
|
|
const mapDispatchToProps = (dispatch) => {
|
return {
|
modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews))
|
}
|
}
|
|
export default connect(mapStateToProps, mapDispatchToProps)(SubTabViewTable)
|