import React, {Component} from 'react'
|
import PropTypes from 'prop-types'
|
import {connect} from 'react-redux'
|
import { is, fromJS } from 'immutable'
|
import { notification, Spin, Tabs, Icon, Switch, Modal, Button} from 'antd'
|
import moment from 'moment'
|
|
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 asyncComponent from '@/utils/asyncLoadComponent'
|
import {refreshTabView, modifyTabview} from '@/store/action'
|
|
import MainTable from './mainTable'
|
import MainAction from '@/tabviews/tableshare/actionList'
|
import MainSearch from '@/tabviews/tableshare/topSearch'
|
import SubTable from '@/tabviews/subtable'
|
import NotFount from '@/components/404'
|
import './index.scss'
|
|
const SubTabTable = asyncComponent(() => import('@/tabviews/subtabtable'))
|
const FormTab = asyncComponent(() => import('@/tabviews/formtab'))
|
const { TabPane } = Tabs
|
|
class NormalTable extends Component {
|
static propTpyes = {
|
MenuNo: PropTypes.string, // 菜单参数
|
MenuName: PropTypes.string, // 菜单参数
|
MenuID: PropTypes.string // 菜单Id
|
}
|
|
state = {
|
dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
|
ContainerId: Utils.getuuid(), // 菜单外层html Id
|
view: 'commontable', // 当前页面默认为主表
|
loadingview: true, // 页面加载中
|
viewlost: false, // 页面丢失:1、未获取到配置-页面丢失;2、页面未启用
|
lostmsg: '', // 页面丢失时的提示信息
|
config: {}, // 页面配置信息,包括按钮、搜索、显示列、标签等
|
searchlist: null, // 搜索条件
|
actions: null, // 按钮集
|
columns: null, // 显示列
|
logcolumns: null, // 日志中显示的列信息 (增加至全部列,除去合并列)
|
arr_field: '', // 使用 sPC_Get_TableData 时的查询字段集
|
setting: null, // 页面全局设置:数据源、按钮及显示列固定、主键等
|
data: null, // 列表数据集
|
total: 0, // 总数
|
loading: false, // 列表数据加载中
|
pageIndex: 1, // 页码
|
pageSize: 10, // 每页数据条数
|
orderColumn: '', // 排序字段
|
orderType: 'asc', // 排序方式
|
search: '', // 搜索条件数组,使用时需分场景处理
|
BIDs: {}, // 上级表id
|
setsingle: false, // 主表单选多选切换
|
pickup: false, // 主表数据隐藏显示切换
|
isLinkMain: false, // 是否存在与主表关联的子表
|
popAction: false, // 弹框页面,按钮信息
|
popData: false, // 弹框页面,所选的表格数据
|
visible: false // 弹框显示隐藏控制
|
}
|
|
/**
|
* @description 获取页面配置信息
|
*/
|
async loadconfig () {
|
const { permAction } = this.props
|
|
let param = {
|
func: 'sPC_Get_LongParam',
|
MenuID: this.props.MenuID
|
}
|
let result = await Api.getSystemCacheConfig(param)
|
if (result.status) {
|
let config = ''
|
|
try { // 配置信息解析
|
config = window.decodeURIComponent(window.atob(result.LongParam))
|
config = JSON.parse(config)
|
} catch (e) {
|
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() // 用于字段过滤
|
|
// 权限过滤
|
config.action = config.action.filter(item => permAction[item.uuid])
|
// config.tabgroups.forEach(group => {
|
// if (!config[group]) return
|
// config[group] = config[group].filter(tab => permAction[tab.uuid])
|
// })
|
|
|
// 1、筛选字段集,2、过滤隐藏列及合并列中的字段uuid
|
config.columns.forEach(col => {
|
if (col.field) {
|
_arrField.push(col.field)
|
|
_logcolumns.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 => {
|
if (_hideCol.includes(col.uuid)) return
|
|
if (col.type === 'colspan' && col.sublist) {
|
let _col = JSON.parse(JSON.stringify(col))
|
let subColumn = []
|
_col.sublist.forEach(sub => {
|
if (colMap.has(sub)) {
|
subColumn.push(colMap.get(sub))
|
}
|
})
|
_col.subColumn = subColumn
|
_columns.push(_col)
|
} else {
|
_columns.push(col)
|
}
|
})
|
|
let _actions = config.action.filter(item => item.position === 'toolbar') // 过滤工具栏按钮
|
let _operations = config.action.filter(item => item.position === 'grid') // 添加操作列(存在时)
|
|
if (config.gridBtn && config.gridBtn.display && _operations.length > 0) {
|
_columns.push({
|
...config.gridBtn,
|
operations: _operations
|
})
|
}
|
|
|
let _isLinkMain = false // 检查是否有与主表关联的子表
|
let supmenus = {}
|
config.tabgroups.forEach(group => {
|
if (config[group] && config[group].length > 0) {
|
config[group] = config[group].map(tab => {
|
if (tab.subtabs && tab.subtabs.length > 0) {
|
tab.subtabs.forEach(id => {
|
supmenus[id] = tab.uuid
|
})
|
}
|
if (config.setting.subtabs.includes(tab.uuid)) {
|
tab.supMenu = 'mainTable'
|
_isLinkMain = true
|
} else if (supmenus[tab.uuid]) {
|
tab.supMenu = supmenus[tab.uuid]
|
}
|
|
return tab
|
})
|
}
|
})
|
|
this.setState({
|
loadingview: false,
|
config: config,
|
setting: config.setting,
|
searchlist: config.search,
|
actions: _actions,
|
columns: _columns,
|
logcolumns: _logcolumns,
|
isLinkMain: _isLinkMain,
|
arr_field: _arrField.join(','),
|
search: Utils.initMainSearch(config.search) // 搜索条件初始化(含有时间格式,需要转化)
|
}, () => {
|
this.improveSearch()
|
|
if (config.setting.onload !== 'false') { // 初始化可加载
|
this.setState({
|
loading: true
|
})
|
this.loadmaindata()
|
}
|
})
|
} else {
|
this.setState({
|
loadingview: false,
|
viewlost: true
|
})
|
notification.warning({
|
top: 92,
|
message: result.message,
|
duration: 10
|
})
|
}
|
}
|
|
/**
|
* @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
|
}
|
|
param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
|
param.secretkey = Utils.encrypt(param.LText, param.timestamp)
|
|
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: 10
|
})
|
}
|
})
|
|
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: 10
|
})
|
}
|
})
|
|
this.setState({searchlist})
|
})
|
}
|
|
/**
|
* @description 主表数据加载
|
*/
|
async loadmaindata () {
|
const { setting, BIDs } = this.state
|
let param = ''
|
|
if (setting.interType !== 'inner' || (setting.interType === 'inner' && setting.innerFunc)) {
|
param = this.getCustomParam()
|
} else {
|
param = this.getDefaultParam()
|
}
|
|
this.setState({
|
pickup: false
|
})
|
|
this.handleTableId('mainTable', '', '')
|
|
if (!param) { // 未获取参数时,不发请求
|
return
|
}
|
|
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,
|
loading: false,
|
BIDs: {
|
...BIDs,
|
mainTable: ''
|
}
|
})
|
} else {
|
this.setState({
|
loading: false
|
})
|
notification.error({
|
top: 92,
|
message: result.message,
|
duration: 15
|
})
|
}
|
}
|
|
/**
|
* @description 获取用户自定义存储过程传参
|
*/
|
getCustomParam = () => {
|
const { pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state
|
|
let _search = Utils.formatCustomMainSearch(search)
|
|
let param = {
|
PageIndex: pageIndex,
|
PageSize: pageSize,
|
OrderCol: orderColumn,
|
OrderType: orderType,
|
..._search
|
}
|
|
if (setting.interType === 'inner') {
|
param.func = setting.innerFunc
|
} else {
|
if (setting.sysInterface === 'true') {
|
param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi
|
} else {
|
param.rduri = setting.interface
|
}
|
|
param.appkey = window.GLOB.appkey || '' // 调用外部接口增加appkey
|
|
if (setting.outerFunc) {
|
param.func = setting.outerFunc
|
}
|
}
|
|
return param
|
}
|
|
/**
|
* @description 获取系统存储过程 sPC_Get_TableData 的参数
|
*/
|
getDefaultParam = () => {
|
const { arr_field, pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state
|
|
if (!arr_field) {
|
notification.warning({
|
top: 92,
|
message: '未设置显示列!',
|
duration: 10
|
})
|
return null
|
}
|
|
let _search = Utils.joinMainSearchkey(search)
|
|
_search = _search ? 'where ' + _search : ''
|
|
let param = {
|
func: 'sPC_Get_TableData',
|
obj_name: 'data',
|
arr_field: arr_field,
|
appkey: window.GLOB.appkey || ''
|
}
|
|
let orderBy = orderColumn ? (orderColumn + ' ' + orderType) : setting.order
|
let _dataresource = setting.dataresource
|
|
if (/\s/.test(_dataresource)) {
|
_dataresource = '(' + _dataresource + ') tb'
|
}
|
|
if (setting.queryType === 'statistics') { // 统计数据源,内容替换
|
let fieldmap = new Map()
|
let options = search.map(item => {
|
let _field = item.key
|
|
if (fieldmap.has(_field)) {
|
_field = _field + '1'
|
}
|
|
fieldmap.set(item.key, true)
|
|
return {
|
reg: new RegExp('@' + _field, 'ig'),
|
value: item.value
|
}
|
})
|
|
options.reverse()
|
|
options.forEach(item => {
|
_dataresource = _dataresource.replace(item.reg, `'${item.value}'`)
|
})
|
|
_search = ''
|
}
|
|
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)
|
console.log(DateCount)
|
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)
|
|
return param
|
}
|
|
/**
|
* @description 搜索条件改变时,重置表格数据
|
* 含有初始不加载的页面,修改设置
|
*/
|
refreshbysearch = (searches) => {
|
const { setting } = this.state
|
|
if (setting.onload === 'false') {
|
this.setState({
|
loading: true,
|
pageIndex: 1,
|
search: searches,
|
setting: {...setting, onload: 'true'}
|
}, () => {
|
this.loadmaindata()
|
})
|
} else {
|
this.refs.mainTable.resetTable()
|
|
this.setState({
|
loading: true,
|
pageIndex: 1,
|
search: searches
|
}, () => {
|
this.loadmaindata()
|
})
|
}
|
}
|
|
/**
|
* @description 表格条件改变时重置数据(分页或排序)
|
*/
|
refreshbytable = (pagination, filters, sorter) => {
|
if (sorter.order) {
|
let _chg = {
|
ascend: 'asc',
|
descend: 'desc'
|
}
|
sorter.order = _chg[sorter.order]
|
}
|
|
this.setState({
|
loading: true,
|
pageIndex: pagination.current,
|
pageSize: pagination.pageSize,
|
orderColumn: sorter.field || this.state.setting.orderColumn,
|
orderType: sorter.order || 'asc'
|
}, () => {
|
this.loadmaindata()
|
})
|
}
|
|
/**
|
* @description 表格刷新
|
*/
|
reloadtable = () => {
|
this.refs.mainTable.resetTable()
|
this.setState({
|
loading: true,
|
pageIndex: 1
|
}, () => {
|
this.loadmaindata()
|
})
|
}
|
|
/**
|
* @description 页面刷新,重新获取配置
|
*/
|
reloadview = () => {
|
this.setState({
|
view: 'commontable',
|
loadingview: true,
|
viewlost: false,
|
lostmsg: '',
|
config: {},
|
searchlist: null,
|
actions: null,
|
columns: null,
|
arr_field: '',
|
setting: null,
|
data: null,
|
total: 0,
|
loading: false,
|
pageIndex: 1,
|
pageSize: 10,
|
orderColumn: '',
|
orderType: 'asc',
|
search: '',
|
BIDs: {},
|
setsingle: false,
|
pickup: false,
|
isLinkMain: false
|
}, () => {
|
this.loadconfig()
|
})
|
}
|
|
/**
|
* @description 按钮操作完成后(成功或失败),页面刷新,重置页码及选择项
|
*/
|
refreshbyaction = (btn, type) => {
|
if (btn.execSuccess === 'grid' && type === 'success') {
|
this.reloadtable()
|
} else if (btn.execError === 'grid' && type === 'error') {
|
this.reloadview()
|
} else if (btn.execSuccess === 'view' && type === 'success') {
|
this.reloadtable()
|
} else if (btn.execError === 'view' && type === 'error') {
|
this.reloadview()
|
} else if (btn.popClose === 'view' && type === 'pop') {
|
this.reloadview()
|
} else if (btn.popClose === 'grid' && type === 'pop') {
|
this.reloadtable()
|
} else if (type === 'excelOut') {
|
this.handleDefaultExcelout(btn)
|
}
|
}
|
|
/**
|
* @description 子表操作完成后刷新主表
|
*/
|
handleMainTable = () => {
|
this.reloadtable()
|
}
|
|
/**
|
* @description 使用默认存储过程 sPC_Get_TableData 导出excel表格
|
*/
|
handleDefaultExcelout = (btn) => {
|
const { MenuName } = this.props
|
const { arr_field, orderColumn, orderType, search, setting, config } = this.state
|
|
let _arr_labels = [] // 列名称集
|
let _arr_label_field = [] // 列名称字段集
|
|
config.columns.forEach(col => {
|
if (col.field) {
|
_arr_labels.push(col.label)
|
_arr_label_field.push(`${col.field} as ${col.label}`)
|
}
|
})
|
|
_arr_labels = _arr_labels.join(',')
|
_arr_label_field = _arr_label_field.join(',')
|
|
let _search = Utils.joinMainSearchkey(search)
|
_search = _search ? 'where ' + _search : ''
|
|
// 获取excel数据,与获取列表数据不同为未设置页码等参数
|
let param = {
|
func: 'sPC_Get_TableData',
|
obj_name: 'data',
|
arr_field: _arr_labels,
|
appkey: window.GLOB.appkey || ''
|
}
|
|
let orderBy = orderColumn ? (orderColumn + ' ' + orderType) : setting.order
|
let _dataresource = setting.dataresource
|
|
if (/\s/.test(_dataresource)) {
|
_dataresource = '(' + _dataresource + ') tb'
|
}
|
|
let LText = `select ${_arr_label_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows`
|
|
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 = ''
|
|
let name = `${MenuName}${moment().format('YYYYMMDDHHmmss')}.xlsx`
|
|
Api.getExcelOut(param, name).then(res => {
|
if (res && res.status === false) {
|
this.refs.mainButton.execError(res, btn)
|
} else {
|
this.refs.mainButton.execSuccess(btn)
|
}
|
})
|
}
|
|
/**
|
* @description 获取表格选择项
|
*/
|
gettableselected = () => {
|
let data = []
|
this.refs.mainTable.state.selectedRowKeys.forEach(item => {
|
data.push(this.refs.mainTable.props.data[item])
|
})
|
return data
|
}
|
|
/**
|
* @description 表格中,按钮触发事件传递
|
*/
|
buttonTrigger = (btn, record) => {
|
this.refs.mainButton.actionTrigger(btn, record)
|
}
|
|
/**
|
* @description 表格Id变化
|
*/
|
handleTableId = (type, id, data) => {
|
const { BIDs } = this.state
|
|
this.setState({
|
BIDs: {
|
...BIDs,
|
[type]: id,
|
[type + 'data']: data
|
}
|
})
|
}
|
|
/**
|
* @description 表格单选多选切换
|
*/
|
checkChange = () => {
|
const { setsingle, BIDs } = this.state
|
|
let _BIDs = JSON.parse(JSON.stringify(BIDs))
|
_BIDs.mainTable = ''
|
|
this.setState({
|
setsingle: !setsingle,
|
pickup: false,
|
BIDs: _BIDs
|
})
|
}
|
|
/**
|
* @description 数据展开合并切换
|
*/
|
pickupChange = () => {
|
const { pickup } = this.state
|
this.setState({
|
pickup: !pickup
|
})
|
}
|
|
/**
|
* @description 触发按钮弹窗(标签页)
|
*/
|
triggerPopview = (btn, data) => {
|
const { setting } = this.state
|
|
let _primaryId = ''
|
|
if (data && data[0] && setting.primaryKey) {
|
_primaryId = data[0][setting.primaryKey] || ''
|
}
|
|
if (btn.OpenType === 'popview') {
|
this.setState({
|
popAction: btn,
|
popData: data[0] ? data[0] : null,
|
visible: true
|
})
|
} else if (btn.OpenType === 'tab') {
|
const { tabviews, MenuNo, MenuID } = this.props
|
let newtab = {
|
MenuNo: MenuNo,
|
MenuID: btn.uuid,
|
MenuName: btn.label,
|
type: btn.tabTemplate,
|
selected: true,
|
param: {
|
btn: btn,
|
data: data,
|
primaryId: _primaryId,
|
arr_field: this.state.arr_field
|
}
|
}
|
|
let index = 0
|
let tabs = tabviews.map((tab, i) => {
|
if (tab.MenuID === MenuID) {
|
index = i
|
}
|
tab.selected = false
|
|
return tab
|
})
|
|
tabs.splice(index + 1, 0, newtab)
|
|
this.props.modifyTabview(tabs)
|
} else if (btn.OpenType === 'blank') {
|
this.setState({
|
view: 'formtab',
|
tabBtn: btn,
|
tabParam: {
|
btn: btn,
|
data: data,
|
primaryId: _primaryId,
|
arr_field: this.state.arr_field
|
}
|
})
|
}
|
}
|
|
popclose = () => {
|
this.setState({
|
visible: false
|
})
|
this.refreshbyaction(this.state.popAction, 'pop')
|
}
|
|
UNSAFE_componentWillMount () {
|
// 组件加载时,获取菜单数据
|
this.loadconfig()
|
}
|
|
shouldComponentUpdate (nextProps, nextState) {
|
return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState))
|
}
|
|
/**
|
* @description 组件销毁,清除state更新
|
*/
|
componentWillUnmount () {
|
this.setState = () => {
|
return
|
}
|
}
|
|
render() {
|
const { view, setting, searchlist, actions, columns, loadingview, viewlost, setsingle, pickup, isLinkMain, config } = this.state
|
|
return (
|
<div>
|
{view === 'commontable' ? <div className={'commontable ' + (isLinkMain ? 'pick-control' : '')} id={this.state.ContainerId}>
|
{loadingview && <Spin size="large" />}
|
{searchlist && searchlist.length > 0 ?
|
<MainSearch
|
dict={this.state.dict}
|
searchlist={searchlist}
|
refreshdata={this.refreshbysearch}
|
/> : null
|
}
|
{actions && setting.onload !== 'false' ?
|
<MainAction
|
ref="mainButton"
|
BID=""
|
type="main"
|
setting={setting}
|
actions={actions}
|
dict={this.state.dict}
|
MenuID={this.props.MenuID}
|
logcolumns={this.state.logcolumns}
|
ContainerId={this.state.ContainerId}
|
refreshdata={this.refreshbyaction}
|
triggerPopview={this.triggerPopview}
|
gettableselected={this.gettableselected}
|
/> : null
|
}
|
{columns && setting.onload !== 'false' ?
|
<div className="main-table-box">
|
{isLinkMain ?
|
<div className="pickchange">
|
{setting.tableType === 'checkbox' ? <Switch title="单选切换" checkedChildren="单" unCheckedChildren="多" defaultChecked={setsingle} onChange={this.checkChange} /> : null}
|
{this.state.BIDs.mainTable && (setting.tableType === 'radio' || setsingle) ? <Switch title="收起" checkedChildren="开" unCheckedChildren="关" defaultChecked={pickup} onChange={this.pickupChange} /> : null}
|
</div> : null
|
}
|
<MainTable
|
ref="mainTable"
|
pickup={pickup}
|
setting={setting}
|
columns={columns}
|
setsingle={setsingle}
|
dict={this.state.dict}
|
data={this.state.data}
|
total={this.state.total}
|
MenuID={this.props.MenuID}
|
loading={this.state.loading}
|
refreshdata={this.refreshbytable}
|
buttonTrigger={this.buttonTrigger}
|
handleTableId={this.handleTableId}
|
/>
|
</div> : null
|
}
|
{setting && setting.onload !== 'false' &&
|
config.tabgroups.map(group => {
|
if (config[group].length === 0) return null
|
|
return (
|
<Tabs defaultActiveKey="0" key={group}>
|
{config[group].map((_tab, index) => {
|
return (
|
<TabPane tab={
|
<span>
|
{_tab.icon ? <Icon type={_tab.icon} /> : null}
|
{_tab.label}
|
</span>
|
} key={`${index}`}>
|
{_tab.type === 'SubTable' ?
|
<SubTable
|
Tab={_tab}
|
MenuID={_tab.linkTab}
|
SupMenuID={this.props.MenuID}
|
ContainerId={this.state.ContainerId}
|
BID={this.state.BIDs[_tab.supMenu] || ''}
|
BData={this.state.BIDs[_tab.supMenu + 'data'] || ''}
|
handleTableId={this.handleTableId}
|
handleMainTable={this.handleMainTable}
|
/> : null}
|
</TabPane>
|
)
|
})}
|
</Tabs>
|
)
|
})
|
}
|
<Modal
|
className="popview-modal"
|
title={this.state.popAction.label}
|
width={'80vw'}
|
maskClosable={false}
|
visible={this.state.visible}
|
onCancel={this.popclose}
|
footer={[
|
<Button key="cancel" onClick={this.popclose}>{this.state.dict['main.close']}</Button>
|
]}
|
destroyOnClose
|
>
|
{<SubTabTable
|
BID={''}
|
SupMenuID={this.props.MenuID}
|
MenuID={this.state.popAction.linkTab}
|
BData={this.state.BIDs['mainTabledata'] || ''}
|
ContainerId={this.state.ContainerId}
|
ID={this.state.popData ? this.state.popData[setting.primaryKey] : ''}
|
refreshSupView={this.reloadtable}
|
/>}
|
</Modal>
|
{viewlost ? <NotFount msg={this.state.lostmsg} /> : null}
|
</div> : null}
|
{view === 'formtab' ? <FormTab MenuID={this.state.tabBtn.uuid} param={this.state.tabParam}/> : null}
|
</div>
|
)
|
}
|
}
|
|
const mapStateToProps = (state) => {
|
return {
|
tabviews: state.tabviews,
|
refreshTab: state.refreshTab,
|
permAction: state.permAction
|
}
|
}
|
|
const mapDispatchToProps = (dispatch) => {
|
return {
|
refreshTabView: (refreshTab) => dispatch(refreshTabView(refreshTab)),
|
modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews))
|
}
|
}
|
|
export default connect(mapStateToProps, mapDispatchToProps)(NormalTable)
|