| | |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import options from '@/store/options.js' |
| | | import { buttonConfig, tabConfig, refCodes } from './config' |
| | | import MKEmitter from '@/utils/events.js' |
| | | |
| | | import asyncSpinComponent from '@/utils/asyncSpinComponent' |
| | | import SubAction from './actionList' |
| | |
| | | setting: null, // 页面全局设置:数据源、按钮及显示列固定、主键等 |
| | | data: null, // 列表数据集 |
| | | selectedData: [], // 已选表格数据 |
| | | resetTable: false, // 表格重置,值在true与false之间切换,切换时表格重置 |
| | | loading: false, // 列表数据加载中 |
| | | visible: false, // 弹框显示隐藏控制 |
| | | pickup: false, // 子表数据隐藏显示切换 |
| | |
| | | */ |
| | | 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, |
| | | selectedData: [], |
| | | resetTable: !this.state.resetTable, |
| | | }, () => { |
| | | this.loadmaindata(nextProps.BID, 'refresh') |
| | | }) |
| | |
| | | config.columns.forEach(col => { |
| | | if (col.field) { |
| | | _arrField.push(col.field) |
| | | |
| | | } |
| | | 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 (col.type === 'colspan') { |
| | | if (col.unfold !== 'true') { // 不展开为旧版合并列 |
| | | col.type = 'old_colspan' |
| | | } |
| | | |
| | | let _col = fromJS(col).toJS() |
| | | let subcols = [] |
| | | _col.sublist && _col.sublist.forEach(sub => { |
| | | if (colMap.has(sub)) { |
| | | subColumn.push(colMap.get(sub)) |
| | | subcols.push(colMap.get(sub)) |
| | | } |
| | | }) |
| | | _col.subColumn = subColumn |
| | | _col.subcols = subcols |
| | | _columns.push(_col) |
| | | } else { |
| | | _columns.push(col) |
| | |
| | | * @description 表格刷新 |
| | | */ |
| | | reloadtable = () => { |
| | | MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid) // 列表重置 |
| | | this.setState({ |
| | | loading: true, |
| | | selectedData: [], |
| | | resetTable: !this.state.resetTable |
| | | }, () => { |
| | | this.loadmaindata() |
| | | }) |
| | |
| | | const { setting, actions, columns, pickup, config, selectedData } = this.state |
| | | |
| | | return ( |
| | | <div className="subtable" id={'subtable' + this.props.MenuID}> |
| | | <div className="secretKey-subtable" id={'subtable' + this.props.MenuID}> |
| | | <div className="sub-action"> |
| | | <SubAction |
| | | setting={setting} |
| | |
| | | <SubTable |
| | | tableId={this.props.Tab.uuid} |
| | | pickup={pickup} |
| | | config={config} |
| | | setting={setting} |
| | | columns={columns} |
| | | dict={this.state.dict} |