| | |
| | | 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 options from '@/store/options.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncLoadComponent from '@/utils/asyncLoadComponent' |
| | | import {refreshTabView, modifyTabview} from '@/store/action' |
| | | |
| | | import MainTable from '@/tabviews/commontable/mainTable' |
| | | import MainAction from '@/tabviews/tableshare/actionList' |
| | | import MainSearch from '@/tabviews/tableshare/topSearch' |
| | | import SubTable from '@/tabviews/subtable' |
| | | import MainTable from '@/tabviews/zshare/normalTable' |
| | | import MainAction from '@/tabviews/zshare/actionList' |
| | | import MainSearch from '@/tabviews/zshare/topSearch' |
| | | import NotFount from '@/components/404' |
| | | import './index.scss' |
| | | |
| | | const SubTable = asyncLoadComponent(() => import('@/tabviews/subtable')) |
| | | const SubTabTable = asyncComponent(() => import('@/tabviews/subtabtable')) |
| | | const FormTab = asyncComponent(() => import('@/tabviews/formtab')) |
| | | |
| | | const { TabPane } = Tabs |
| | | const { TreeNode } = Tree |
| | | const { Paragraph } = Typography |
| | |
| | | orderBy: '', // 排序 |
| | | search: '', // 搜索条件数组,使用时需分场景处理 |
| | | BIDs: {}, // 上级表id |
| | | setsingle: false, // 主表单选多选切换 |
| | | pickup: false, // 主表数据隐藏显示切换 |
| | | isLinkMain: false, // 是否存在与主表关联的子表 |
| | | popAction: false, // 弹框页面,按钮信息 |
| | | popData: false, // 弹框页面,所选的表格数据 |
| | | visible: false, // 弹框显示隐藏控制 |
| | |
| | | let config = '' |
| | | |
| | | try { // 配置信息解析 |
| | | config = window.decodeURIComponent(window.atob(result.LongParam)) |
| | | config = JSON.parse(config) |
| | | config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | config = '' |
| | | } |
| | | |
| | |
| | | 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 => { |
| | |
| | | }) |
| | | } |
| | | |
| | | |
| | | let _isLinkMain = false // 检查是否有与主表关联的子表 |
| | | config.tabgroups.forEach(groupId => { |
| | | if (!config[groupId] || config[groupId].length === 0) return |
| | | |
| | | config[groupId].forEach(tab => { |
| | | if (tab.supMenu === 'mainTable') { |
| | | _isLinkMain = true |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | this.setState({ |
| | | loadingview: false, |
| | | config: config, |
| | |
| | | actions: _actions, |
| | | columns: _columns, |
| | | logcolumns: _logcolumns, |
| | | isLinkMain: _isLinkMain, |
| | | arr_field: _arrField.join(','), |
| | | search: Utils.initMainSearch(config.search) // 搜索条件初始化(含有时间格式,需要转化) |
| | | }, () => { |
| | |
| | | if (setting.interType === 'inner') { |
| | | param.func = setting.innerFunc |
| | | } else { |
| | | if (setting.sysInterface === 'true') { |
| | | param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi |
| | | } else { |
| | | if (setting.sysInterface === 'true' && options.cloudServiceApi) { |
| | | param.rduri = options.cloudServiceApi |
| | | } else if (setting.sysInterface !== 'true') { |
| | | param.rduri = setting.interface |
| | | } |
| | | |
| | |
| | | orderBy: '', |
| | | search: '', |
| | | BIDs: {}, |
| | | setsingle: false, |
| | | pickup: false, |
| | | isLinkMain: false |
| | | pickup: false |
| | | }, () => { |
| | | this.loadconfig() |
| | | }) |
| | |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @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 数据展开合并切换 |
| | |
| | | type: btn.tabTemplate, |
| | | selected: true, |
| | | param: { |
| | | menuType: 'HS', |
| | | parentId: this.props.MenuID, |
| | | btn: btn, |
| | | data: data[0] || null, |
| | |
| | | view: 'formtab', |
| | | tabBtn: btn, |
| | | tabParam: { |
| | | menuType: 'HS', |
| | | btn: btn, |
| | | data: data[0] || null, |
| | | primaryId: btn.Ot !== 'notRequired' ? _primaryId : '', |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { view, setting, searchlist, actions, columns, loadingview, viewlost, setsingle, pickup, isLinkMain, config } = this.state |
| | | const { view, setting, searchlist, actions, columns, loadingview, viewlost, pickup, config } = this.state |
| | | |
| | | return ( |
| | | <div> |
| | | {view === 'commontable' ? <div className={'commontable ' + (isLinkMain ? 'pick-control' : '')} id={this.state.ContainerId}> |
| | | {view === 'commontable' ? <div className="commontable pick-control" id={this.state.ContainerId}> |
| | | {loadingview && <Spin size="large" />} |
| | | {searchlist && searchlist.length > 0 ? |
| | | <MainSearch |
| | |
| | | ref="mainButton" |
| | | BID="" |
| | | type="main" |
| | | menuType="HS" |
| | | setting={setting} |
| | | actions={actions} |
| | | dict={this.state.dict} |
| | |
| | | } |
| | | {columns && setting.onload !== 'false' ? |
| | | <div className="main-table-box"> |
| | | {isLinkMain ? |
| | | {this.state.data && this.state.data.length > 0 ? |
| | | <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} |
| | | <Switch title="收起" checkedChildren="开" unCheckedChildren="关" defaultChecked={pickup} onChange={this.pickupChange} /> |
| | | </div> : null |
| | | } |
| | | <MainTable |
| | | ref="mainTable" |
| | | tableId="mainTable" |
| | | pickup={pickup} |
| | | setting={setting} |
| | | columns={columns} |
| | | setsingle={setsingle} |
| | | dict={this.state.dict} |
| | | data={this.state.data} |
| | | total={this.state.total} |
| | |
| | | } key={`${index}`}> |
| | | {_tab.type === 'SubTable' ? |
| | | <SubTable |
| | | menuType="HS" |
| | | Tab={_tab} |
| | | MenuID={_tab.linkTab} |
| | | SupMenuID={this.props.MenuID} |
| | |
| | | > |
| | | {<SubTabTable |
| | | BID={''} |
| | | menuType="HS" |
| | | SupMenuID={this.props.MenuID} |
| | | MenuID={this.state.popAction.linkTab} |
| | | BData={this.state.BIDs['mainTabledata'] || ''} |