| | |
| | | }) |
| | | } |
| | | } else if (type === 'tab') { |
| | | if (item.type === 'SubTable') { |
| | | if (item.type === 'SubTable' || item.tabType === 'SubTable') { |
| | | this.setState({ |
| | | editMenu: originMenu, |
| | | editTab: config, |
| | |
| | | margin-bottom: 0; |
| | | } |
| | | .ant-tabs-tab { |
| | | padding: 18px 16px 6px; |
| | | padding: 18px 16px 6px 6px; |
| | | cursor: default; |
| | | span.tab-control i { |
| | | position: relative; |
| | | left: 7px; |
| | | top: -6px; |
| | | position: absolute; |
| | | right: -7px; |
| | | top: 10px; |
| | | font-size: 10px; |
| | | margin: 0px; |
| | | padding: 5px; |
| | | cursor: pointer; |
| | | } |
| | | span.tab-name { |
| | | cursor: pointer; |
| | | padding: 6px 0px 6px 10px; |
| | | } |
| | | } |
| | | iframe { |
| | |
| | | 'header.menu.func.create': '创建存储过程', |
| | | 'header.menu.tab': '标签页', |
| | | 'header.menu.tab.subtable': '子表', |
| | | 'header.form.tabType': '标签类型', |
| | | 'header.form.search.placeholder': 'Please add search criteria', |
| | | 'header.form.modal.placeholder': 'Please add the form', |
| | | 'header.form.action.placeholder': 'Please add buttons', |
| | |
| | | 'header.form.refresh.never': 'Don\'t refresh', |
| | | 'header.form.refresh.view': 'Refresh the page', |
| | | 'header.form.refresh.grid': 'Refresh the table', |
| | | 'header.form.refresh.maingrid': '刷新主表', |
| | | 'header.form.refresh.subgrid': '刷新子表', |
| | | 'header.form.popClose': '标签关闭', |
| | | 'header.form.toolbar': 'The toolbar', |
| | | 'header.form.grid': 'Table', |
| | | 'header.form.intertype': 'The interface type', |
| | |
| | | 'main.reset': 'Reset', |
| | | 'main.confirm': 'OK', |
| | | 'main.return': 'Cancel', |
| | | 'main.close': '关闭', |
| | | 'main.all': 'All', |
| | | 'main.copy.success': 'Copy success', |
| | | 'main.pagination.of': 'of', |
| | |
| | | 'header.menu.func.create': '创建存储过程', |
| | | 'header.menu.tab': '标签页', |
| | | 'header.menu.tab.subtable': '子表', |
| | | 'header.form.tabType': '标签类型', |
| | | 'header.form.search.placeholder': '请添加搜索条件', |
| | | 'header.form.modal.placeholder': '请添加表单', |
| | | 'header.form.action.placeholder': '请添加按钮', |
| | |
| | | 'header.form.refresh.never': '不刷新', |
| | | 'header.form.refresh.view': '刷新页面', |
| | | 'header.form.refresh.grid': '刷新表格', |
| | | 'header.form.refresh.maingrid': '刷新主表', |
| | | 'header.form.refresh.subgrid': '刷新子表', |
| | | 'header.form.popClose': '标签关闭', |
| | | 'header.form.toolbar': '工具栏', |
| | | 'header.form.grid': '表格', |
| | | 'header.form.intertype': '接口类型', |
| | |
| | | 'main.reset': '重置', |
| | | 'main.confirm': '确定', |
| | | 'main.return': '返回', |
| | | 'main.close': '关闭', |
| | | 'main.all': '全部', |
| | | 'main.copy.success': '复制成功', |
| | | 'main.pagination.of': '共', |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { BackTop, notification, Spin, Tabs, Icon, Switch} from 'antd' |
| | | import { BackTop, notification, Spin, Tabs, Icon, Switch, Modal, Button} from 'antd' |
| | | import moment from 'moment' |
| | | import Api from '@/api' |
| | | import MainTable from './mainTable' |
| | |
| | | import MainSearch from '@/tabviews/tableshare/topSearch' |
| | | import SubTable from '@/tabviews/subtable' |
| | | import NotFount from '@/components/404' |
| | | // import asyncComponent from '@/utils/asyncLoadComponent' |
| | | import asyncComponent from '@/utils/asyncLoadComponent' |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | | |
| | | // const SubTabTable = asyncComponent(() => import('@/tabviews/subtabtable')) |
| | | const SubTabTable = asyncComponent(() => import('@/tabviews/subtabtable')) |
| | | const { TabPane } = Tabs |
| | | |
| | | export default class NormalTable extends Component { |
| | |
| | | loadingview: true, // 页面加载中 |
| | | viewlost: false, // 页面丢失:1、未获取到配置-页面丢失;2、页面未启用 |
| | | 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: '', |
| | | configMap: {}, |
| | | BIDs: {}, |
| | | setsingle: false, |
| | | pickup: false, |
| | | isLinkMain: false |
| | | config: {}, // 页面配置信息,包括按钮、搜索、显示列、标签等 |
| | | searchlist: null, // 搜索条件 |
| | | actions: null, // 按钮集 |
| | | columns: null, // 显示列 |
| | | arr_field: '', // 使用 sPC_Get_TableData 时的查询字段集 |
| | | setting: null, // 页面全局设置:数据源、按钮及显示列固定、主键等 |
| | | data: null, // 列表数据集 |
| | | total: 0, // 总数 |
| | | loading: false, // 列表数据加载中 |
| | | pageIndex: 1, // 页码 |
| | | pageSize: 10, // 每页数据条数 |
| | | orderColumn: '', // 排序字段 |
| | | orderType: 'asc', // 排序方式 |
| | | search: '', // 搜索条件数组,使用时需分场景处理 |
| | | configMap: {}, // 页面配置信息:下拉、按钮等 |
| | | BIDs: {}, // 上级表id |
| | | setsingle: false, // 主表单选多选切换 |
| | | pickup: false, // 主表数据隐藏显示切换 |
| | | isLinkMain: false, // 是否存在与主表关联的子表 |
| | | popAction: false, // 弹框页面,按钮信息 |
| | | popData: false, // 弹框页面,所选的表格数据 |
| | | visible: false // 弹框显示隐藏控制 |
| | | } |
| | | |
| | | /** |
| | |
| | | }) |
| | | } |
| | | |
| | | // 过滤工具栏按钮(未经过权限过滤) |
| | | let _actions = config.action.filter(item => item.position === 'toolbar') |
| | | let _tab = config.tabs.filter(tab => tab.supMenu === 'mainTable') |
| | | let _actions = config.action.filter(item => item.position === 'toolbar') // 过滤工具栏按钮(未经过权限过滤) |
| | | let _tab = config.tabs.filter(tab => tab.supMenu === 'mainTable') // 检查是否有与主表关联的子表 |
| | | |
| | | let supmenus = {} |
| | | config.tabgroups.forEach(group => { |
| | | if (config[group] && config[group].length > 0) { |
| | | config[group] = config[group].map(tab => { |
| | | if (tab.subtabs.length > 0) { |
| | | tab.subtabs.forEach(id => { |
| | | supmenus[id] = tab.uuid |
| | | }) |
| | | } |
| | | if (config.setting.subtabs.includes(tab.uuid)) { |
| | | tab.supMenu = 'mainTable' |
| | | } else if (supmenus[tab.uuid]) { |
| | | tab.supMenu = supmenus[tab.uuid] |
| | | } |
| | | |
| | | return tab |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | loadingview: false, |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 搜索条件下拉选项预加载 |
| | | */ |
| | | improveSearch = () => { |
| | | let searchlist = JSON.parse(JSON.stringify(this.state.searchlist)) |
| | | let deffers = [] |
| | |
| | | } |
| | | }) |
| | | |
| | | this.setState({searchlist: JSON.parse(JSON.stringify(searchlist))}) |
| | | |
| | | if (deffers.length === 0) return |
| | | if (deffers.length === 0) { |
| | | this.setState({searchlist: JSON.parse(JSON.stringify(searchlist))}) |
| | | return |
| | | } |
| | | |
| | | Promise.all(deffers).then(result => { |
| | | result.forEach(res => { |
| | |
| | | searchlist = searchlist.map(item => { |
| | | if (item.uuid === res.search.uuid) { |
| | | res.data.forEach(cell => { |
| | | item.options.push({ |
| | | 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 |
| | |
| | | }) |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @description 主表数据加载 |
| | | */ |
| | | async loadmaindata () { |
| | | const { setting, BIDs } = this.state |
| | | let param = '' |
| | |
| | | } else { |
| | | param = this.getDefaultParam() |
| | | } |
| | | |
| | | this.handleTableId('mainTable', '') |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 获取用户自定义存储过程传参 |
| | | */ |
| | | getCustomParam = () => { |
| | | const { pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state |
| | | |
| | |
| | | return param |
| | | } |
| | | |
| | | /** |
| | | * @description 获取系统存储过程 sPC_Get_TableData 的参数 |
| | | */ |
| | | getDefaultParam = () => { |
| | | const { arr_field, pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state |
| | | |
| | |
| | | return param |
| | | } |
| | | |
| | | /** |
| | | * @description 搜索条件改变时,重置表格数据 |
| | | * 含有初始不加载的页面,修改设置 |
| | | */ |
| | | refreshbysearch = (searches) => { |
| | | const { setting } = this.state |
| | | // 搜索条件变化 |
| | | |
| | | if (setting.onload === 'false') { |
| | | this.setState({ |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 表格条件改变时重置数据(分页或排序) |
| | | */ |
| | | refreshbytable = (pagination, filters, sorter) => { |
| | | // 表格查询条件修改 |
| | | if (sorter.order) { |
| | | let _chg = { |
| | | ascend: 'asc', |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 表格刷新 |
| | | */ |
| | | reloadtable = () => { |
| | | this.refs.mainTable.resetTable() |
| | | this.setState({ |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 页面刷新,重新获取配置 |
| | | */ |
| | | reloadview = () => { |
| | | this.setState({ |
| | | loadingview: true, // 页面加载中 |
| | | viewlost: false, // 页面丢失:1、未获取到配置-页面丢失;2、页面未启用 |
| | | lostmsg: '', // 页面丢失时的提示信息 |
| | | loadingview: true, |
| | | viewlost: false, |
| | | lostmsg: '', |
| | | config: {}, |
| | | searchlist: null, |
| | | actions: null, |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮操作完成后(成功或失败),页面刷新,重置页码及选择项 |
| | | */ |
| | | refreshbyaction = (btn, type) => { |
| | | // 按钮操作后刷新表格,重置页码及选择项 |
| | | if (btn.execSuccess === 'grid' && type === 'success') { |
| | | this.reloadtable() |
| | | } else if (btn.execError === 'grid' && type === 'error') { |
| | |
| | | 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 |
| | |
| | | _arr_label_field = _arr_label_field.join(',') |
| | | |
| | | let _search = Utils.joinMainSearchkey(search) |
| | | _search = _search ? 'where (' + _search + ')' : '' |
| | | // 获取列表数据 |
| | | _search = _search ? 'where ' + _search : '' |
| | | |
| | | // 获取excel数据,与获取列表数据不同为未设置页码等参数 |
| | | let param = { |
| | | func: 'sPC_Get_TableData', |
| | | obj_name: 'data', |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @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) => { |
| | | const { BIDs } = this.state |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 表格单选多选切换 |
| | | */ |
| | | checkChange = () => { |
| | | const { setsingle, BIDs } = this.state |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 数据展开合并切换 |
| | | */ |
| | | pickupChange = () => { |
| | | const { pickup } = this.state |
| | | this.setState({ |
| | | pickup: !pickup |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 触发按钮弹窗(标签页) |
| | | */ |
| | | triggerPopview = (btn, data) => { |
| | | this.setState({ |
| | | popAction: btn, |
| | | popData: data[0] ? data[0] : null, |
| | | visible: true |
| | | }) |
| | | } |
| | | |
| | | popclose = () => { |
| | | this.setState({ |
| | | visible: false |
| | | }) |
| | | this.refreshbyaction(this.state.popAction, 'pop') |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | * @description 组件销毁,清除state更新 |
| | | */ |
| | | componentWillUnmount () { |
| | | this.setState = (state, callback) => { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | } |
| | |
| | | dict={this.state.dict} |
| | | MenuID={this.props.MenuID} |
| | | refreshdata={this.refreshbyaction} |
| | | triggerPopview={this.triggerPopview} |
| | | gettableselected={this.gettableselected} |
| | | /> : null |
| | | } |
| | |
| | | if (config[group].length === 0) return null |
| | | |
| | | return ( |
| | | <Tabs defaultActiveKey="0" tabPosition="top" key={group}> |
| | | <Tabs defaultActiveKey="0" key={group}> |
| | | {config[group].map((_tab, index) => { |
| | | return !_tab.supMenu || (_tab.supMenu && this.state.BIDs[_tab.supMenu]) ? |
| | | // return !_tab.supMenu || (_tab.supMenu && this.state.BIDs[_tab.supMenu]) ? |
| | | return ( |
| | | <TabPane tab={ |
| | | <span> |
| | | {_tab.icon ? <Icon type={_tab.icon} /> : null} |
| | | {_tab.label} |
| | | </span> |
| | | } key={`${index}`}> |
| | | {_tab.type === 'SubTable' ? <SubTable SupMenuID={this.props.MenuID} MenuID={_tab.linkTab} Tab={_tab} BID={this.state.BIDs[_tab.supMenu] || ''} /> : null} |
| | | </TabPane> : null |
| | | {_tab.type === 'SubTable' ? |
| | | <SubTable |
| | | Tab={_tab} |
| | | MenuID={_tab.linkTab} |
| | | SupMenuID={this.props.MenuID} |
| | | BID={this.state.BIDs[_tab.supMenu] || ''} |
| | | handleTableId={this.handleTableId} |
| | | handleMainTable={this.handleMainTable} |
| | | /> : null} |
| | | </TabPane> |
| | | ) |
| | | })} |
| | | </Tabs> |
| | | ) |
| | | }) |
| | | } |
| | | {/* {<SubTabTable SupMenuID={this.props.SupMenuID} MenuID={this.props.MenuID} Tab={this.props.Tab} BID={this.props.BID} />} */} |
| | | <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 SupMenuID={this.props.MenuID} MenuID={this.state.popAction.linkTab} BID={''} ID={this.state.popData ? this.state.popData[setting.primaryKey] : ''} />} |
| | | </Modal> |
| | | <BackTop> |
| | | <div className="ant-back-top"> |
| | | <div className="ant-back-top-content"> |
| | |
| | | .ant-back-top { |
| | | bottom: 30px; |
| | | right: 30px; |
| | | } |
| | | .popview-modal { |
| | | .ant-modal-body { |
| | | min-height: 300px; |
| | | } |
| | | } |
| | |
| | | let _id = '' |
| | | |
| | | if (data && data.length > 0 && index !== '') { |
| | | _id = data[index][setting.primaryKey] |
| | | _id = data[index][setting.primaryKey] || '' |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { notification, Spin} from 'antd' |
| | | import { notification, Spin, Modal, Button} from 'antd' |
| | | import moment from 'moment' |
| | | import Api from '@/api' |
| | | import SubTable from './subTable' |
| | | import SubAction from '@/tabviews/tableshare/actionList' |
| | | import SubSearch from '@/tabviews/tableshare/topSearch' |
| | | // import asyncComponent from '@/utils/asyncLoadComponent' |
| | | import asyncComponent from '@/utils/asyncLoadComponent' |
| | | import NotFount from '@/components/404' |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | | |
| | | // const SubTabTable = asyncComponent(() => import('@/tabviews/subtabtable')) |
| | | const SubTabTable = asyncComponent(() => import('@/tabviews/subtabtable')) |
| | | |
| | | export default class NormalTable extends Component { |
| | | static propTpyes = { |
| | | Tab: PropTypes.object, // 标签信息 |
| | | BID: PropTypes.string, // 上级数据ID |
| | | MenuID: PropTypes.string, // 菜单Id |
| | | SupMenuID: PropTypes.string // 上级菜单Id |
| | | Tab: PropTypes.object, // 标签信息 |
| | | BID: PropTypes.string, // 上级数据ID |
| | | MenuID: PropTypes.string, // 菜单Id |
| | | SupMenuID: PropTypes.string, // 上级菜单Id |
| | | handleTableId: PropTypes.func, // 控制表格数据切换时,更新在主表中的id |
| | | handleMainTable: PropTypes.func // 控制表格数据切换时,更新在主表中的id |
| | | } |
| | | |
| | | state = { |
| | |
| | | loadingview: true, // 页面加载中 |
| | | viewlost: false, // 页面丢失:1、未获取到配置-页面丢失;2、页面未启用 |
| | | lostmsg: '', // 页面丢失时的提示信息 |
| | | config: {}, |
| | | searchlist: null, |
| | | actions: null, |
| | | columns: null, |
| | | arr_field: '', |
| | | setting: null, |
| | | data: [], |
| | | total: 0, |
| | | loading: false, |
| | | pageIndex: 1, |
| | | pageSize: 10, |
| | | orderColumn: '', |
| | | orderType: 'asc', |
| | | search: '', |
| | | configMap: {} |
| | | config: {}, // 页面配置信息,包括按钮、搜索、显示列、标签等 |
| | | searchlist: null, // 搜索条件 |
| | | actions: null, // 按钮集 |
| | | columns: null, // 显示列 |
| | | arr_field: '', // 使用 sPC_Get_TableData 时的查询字段集 |
| | | setting: null, // 页面全局设置:数据源、按钮及显示列固定、主键等 |
| | | data: null, // 列表数据集 |
| | | total: 0, // 总数 |
| | | loading: false, // 列表数据加载中 |
| | | pageIndex: 1, // 页码 |
| | | pageSize: 10, // 每页数据条数 |
| | | orderColumn: '', // 排序字段 |
| | | orderType: 'asc', // 排序方式 |
| | | search: '', // 搜索条件数组,使用时需分场景处理 |
| | | configMap: {}, // 页面配置信息:下拉、按钮等 |
| | | popAction: false, // 弹框页面,按钮信息 |
| | | popData: false, // 弹框页面,所选的表格数据 |
| | | visible: false // 弹框显示隐藏控制 |
| | | } |
| | | |
| | | /** |
| | | * @description 上级菜单id变化时,刷新数据 |
| | | */ |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | if (this.props.Tab.supMenu && !is(fromJS(this.props.BID), fromJS(nextProps.BID))) { |
| | | this.loadmaindata() |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 搜索条件下拉选项预加载 |
| | | */ |
| | | improveSearch = () => { |
| | | let searchlist = JSON.parse(JSON.stringify(this.state.searchlist)) |
| | | let deffers = [] |
| | |
| | | } |
| | | }) |
| | | |
| | | this.setState({searchlist: JSON.parse(JSON.stringify(searchlist))}) |
| | | |
| | | if (deffers.length === 0) return |
| | | if (deffers.length === 0) { |
| | | this.setState({searchlist: JSON.parse(JSON.stringify(searchlist))}) |
| | | return |
| | | } |
| | | |
| | | Promise.all(deffers).then(result => { |
| | | result.forEach(res => { |
| | |
| | | searchlist = searchlist.map(item => { |
| | | if (item.uuid === res.search.uuid) { |
| | | res.data.forEach(cell => { |
| | | item.options.push({ |
| | | 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 |
| | |
| | | }) |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @description 子表数据加载 |
| | | */ |
| | | async loadmaindata () { |
| | | const { setting } = this.state |
| | | let param = '' |
| | |
| | | } else { |
| | | param = this.getDefaultParam() |
| | | } |
| | | |
| | | this.handleTableId('') |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 获取用户自定义存储过程传参 |
| | | */ |
| | | getCustomParam = () => { |
| | | const { pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state |
| | | |
| | |
| | | return param |
| | | } |
| | | |
| | | /** |
| | | * @description 获取系统存储过程 sPC_Get_TableData 的参数 |
| | | */ |
| | | getDefaultParam = () => { |
| | | const { arr_field, pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state |
| | | |
| | |
| | | return param |
| | | } |
| | | |
| | | /** |
| | | * @description 搜索条件改变时,重置表格数据 |
| | | * 含有初始不加载的页面,修改设置 |
| | | */ |
| | | refreshbysearch = (searches) => { |
| | | // 搜索条件变化 |
| | | this.refs.subTable.resetTable() |
| | | |
| | | this.setState({ |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 表格条件改变时重置数据(分页或排序) |
| | | */ |
| | | refreshbytable = (pagination, filters, sorter) => { |
| | | // 表格查询条件修改 |
| | | if (sorter.order) { |
| | | let _chg = { |
| | | ascend: 'asc', |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 表格刷新 |
| | | */ |
| | | reloadtable = () => { |
| | | this.refs.subTable.resetTable() |
| | | this.setState({ |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 页面刷新,重新获取配置 |
| | | */ |
| | | reloadview = () => { |
| | | this.setState({ |
| | | loadingview: true, // 页面加载中 |
| | | viewlost: false, // 页面丢失:1、未获取到配置-页面丢失;2、页面未启用 |
| | | lostmsg: '', // 页面丢失时的提示信息 |
| | | loadingview: true, |
| | | viewlost: false, |
| | | lostmsg: '', |
| | | config: {}, |
| | | searchlist: null, |
| | | actions: null, |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮操作完成后(成功或失败),页面刷新,重置页码及选择项 |
| | | */ |
| | | refreshbyaction = (btn, type) => { |
| | | // 按钮操作后刷新表格,重置页码及选择项 |
| | | if (btn.execSuccess === 'grid' && type === 'success') { |
| | | this.reloadtable() |
| | | } else if (btn.execError === 'grid' && type === 'error') { |
| | |
| | | this.reloadtable() |
| | | } else if (btn.execError === 'view' && type === 'error') { |
| | | this.reloadview() |
| | | } else if (btn.popClose === 'maingrid' && type === 'pop') { |
| | | this.props.handleMainTable() |
| | | } else if (btn.popClose === 'subgrid' && type === 'pop') { |
| | | this.reloadtable() |
| | | } else if (type === 'excelOut') { |
| | | this.handleDefaultExcelout(btn) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 使用默认存储过程 sPC_Get_TableData 导出excel表格 |
| | | */ |
| | | handleDefaultExcelout = (btn) => { |
| | | const { MenuName } = this.props |
| | | const { arr_field, orderColumn, orderType, search, setting, config } = this.state |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 获取表格选择项 |
| | | */ |
| | | gettableselected = () => { |
| | | // 获取表格选择项 |
| | | let data = [] |
| | | this.refs.subTable.state.selectedRowKeys.forEach(item => { |
| | | data.push(this.refs.subTable.props.data[item]) |
| | |
| | | return data |
| | | } |
| | | |
| | | /** |
| | | * @description 表格中,按钮触发事件传递 |
| | | */ |
| | | buttonTrigger = (btn, record) => { |
| | | this.refs.subButton.actionTrigger(btn, record) |
| | | } |
| | | |
| | | /** |
| | | * @description 表格Id变化 |
| | | */ |
| | | handleTableId = (id = '') => { |
| | | this.props.handleTableId(this.props.Tab.uuid, id) |
| | | } |
| | | |
| | | /** |
| | | * @description 触发按钮弹窗(标签页) |
| | | */ |
| | | triggerPopview = (btn, data) => { |
| | | this.setState({ |
| | | popAction: btn, |
| | | popData: data[0] ? data[0] : null, |
| | | visible: true |
| | | }) |
| | | } |
| | | |
| | | popclose = () => { |
| | | this.setState({ |
| | | visible: false |
| | | }) |
| | | this.refreshbyaction(this.state.popAction, 'pop') |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | * @description 组件销毁,清除state更新 |
| | | */ |
| | | componentWillUnmount () { |
| | | this.setState = (state, callback) => { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | } |
| | |
| | | dict={this.state.dict} |
| | | MenuID={this.props.SupMenuID} |
| | | refreshdata={this.refreshbyaction} |
| | | triggerPopview={this.triggerPopview} |
| | | gettableselected={this.gettableselected} |
| | | /> |
| | | } |
| | |
| | | loading={this.state.loading} |
| | | refreshdata={this.refreshbytable} |
| | | buttonTrigger={this.buttonTrigger} |
| | | handleTableId={this.handleTableId} |
| | | /> |
| | | } |
| | | {/* {<SubTabTable SupMenuID={this.props.SupMenuID} MenuID={this.props.MenuID} Tab={this.props.Tab} BID={this.props.BID} />} */} |
| | | <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 SupMenuID={this.props.MenuID} MenuID={this.state.popAction.linkTab} BID={''} ID={this.state.popData ? this.state.popData[setting.primaryKey] : ''} />} |
| | | </Modal> |
| | | {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} |
| | | </div> |
| | | ) |
| | |
| | | .ant-back-top { |
| | | bottom: 30px; |
| | | right: 30px; |
| | | } |
| | | .popview-modal { |
| | | .ant-modal-body { |
| | | min-height: 300px; |
| | | } |
| | | } |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | // import { is, fromJS } from 'immutable' |
| | | import { Table, message, Button } from 'antd' |
| | | import './index.scss' |
| | | |
| | |
| | | total: PropTypes.number, // 总数 |
| | | loading: PropTypes.bool, // 表格加载中 |
| | | refreshdata: PropTypes.func, // 表格中排序列、页码的变化时刷新 |
| | | buttonTrigger: PropTypes.func // 表格中按钮触发操作 |
| | | buttonTrigger: PropTypes.func, // 表格中按钮触发操作 |
| | | handleTableId: PropTypes.func // 控制表格数据切换时,更新在主表中的id |
| | | } |
| | | |
| | | state = { |
| | |
| | | } |
| | | |
| | | onSelectChange = selectedRowKeys => { |
| | | let index = '' |
| | | if (selectedRowKeys.length > 0) { |
| | | index = selectedRowKeys[selectedRowKeys.length - 1] |
| | | } |
| | | |
| | | this.changedata(index) |
| | | this.setState({ selectedRowKeys }) |
| | | } |
| | | |
| | |
| | | let _re = newkeys.includes(index) |
| | | |
| | | if (this.props.setting.tableType === 'radio') { |
| | | this.changedata(index) |
| | | this.setState({ selectedRowKeys: [index] }) |
| | | } else { |
| | | if (_re) { |
| | | newkeys = newkeys.filter(item => item !== index) |
| | | this.changedata('') |
| | | } else { |
| | | newkeys.push(index) |
| | | this.changedata(index) |
| | | } |
| | | |
| | | this.setState({ selectedRowKeys: newkeys }) |
| | |
| | | }) |
| | | } |
| | | |
| | | changedata = (index) => { |
| | | const { data, setting } = this.props |
| | | let _id = '' |
| | | |
| | | if (data && data.length > 0 && index !== '') { |
| | | _id = data[index][setting.primaryKey] || '' |
| | | } |
| | | |
| | | this.props.handleTableId(_id) |
| | | } |
| | | |
| | | render() { |
| | | let { selectedRowKeys } = this.state |
| | | |
| | |
| | | |
| | | export default class NormalTable extends Component { |
| | | static propTpyes = { |
| | | Tab: PropTypes.object, // 标签信息 |
| | | BID: PropTypes.string, // 上级数据ID |
| | | MenuID: PropTypes.string, // 菜单Id |
| | | SupMenuID: PropTypes.string // 上级菜单Id |
| | | BID: PropTypes.string, // 上级数据ID |
| | | MenuID: PropTypes.string, // 菜单Id |
| | | SupMenuID: PropTypes.string // 上级菜单Id |
| | | } |
| | | |
| | | state = { |
| | |
| | | loadingview: true, // 页面加载中 |
| | | viewlost: false, // 页面丢失:1、未获取到配置-页面丢失;2、页面未启用 |
| | | lostmsg: '', // 页面丢失时的提示信息 |
| | | config: {}, |
| | | searchlist: null, |
| | | actions: null, |
| | | columns: null, |
| | | arr_field: '', |
| | | setting: null, |
| | | data: [], |
| | | total: 0, |
| | | loading: false, |
| | | pageIndex: 1, |
| | | pageSize: 10, |
| | | orderColumn: '', |
| | | orderType: 'asc', |
| | | search: '', |
| | | configMap: {} |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | if (this.props.Tab.supMenu && !is(fromJS(this.props.BID), fromJS(nextProps.BID))) { |
| | | this.loadmaindata() |
| | | } |
| | | config: {}, // 页面配置信息,包括按钮、搜索、显示列、标签等 |
| | | searchlist: null, // 搜索条件 |
| | | actions: null, // 按钮集 |
| | | columns: null, // 显示列 |
| | | arr_field: '', // 使用 sPC_Get_TableData 时的查询字段集 |
| | | setting: null, // 页面全局设置:数据源、按钮及显示列固定、主键等 |
| | | data: null, // 列表数据集 |
| | | total: 0, // 总数 |
| | | loading: false, // 列表数据加载中 |
| | | pageIndex: 1, // 页码 |
| | | pageSize: 10, // 每页数据条数 |
| | | orderColumn: '', // 排序字段 |
| | | orderType: 'asc', // 排序方式 |
| | | search: '', // 搜索条件数组,使用时需分场景处理 |
| | | configMap: {} // 页面配置信息:下拉、按钮等 |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 搜索条件下拉选项预加载 |
| | | */ |
| | | improveSearch = () => { |
| | | let searchlist = JSON.parse(JSON.stringify(this.state.searchlist)) |
| | | let deffers = [] |
| | |
| | | }) |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @description 子表数据加载 |
| | | */ |
| | | async loadmaindata () { |
| | | const { setting } = this.state |
| | | let param = '' |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 获取用户自定义存储过程传参 |
| | | */ |
| | | getCustomParam = () => { |
| | | const { pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state |
| | | |
| | |
| | | return param |
| | | } |
| | | |
| | | /** |
| | | * @description 获取系统存储过程 sPC_Get_TableData 的参数 |
| | | */ |
| | | getDefaultParam = () => { |
| | | const { arr_field, pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state |
| | | |
| | |
| | | return param |
| | | } |
| | | |
| | | /** |
| | | * @description 搜索条件改变时,重置表格数据 |
| | | * 含有初始不加载的页面,修改设置 |
| | | */ |
| | | refreshbysearch = (searches) => { |
| | | // 搜索条件变化 |
| | | this.refs.subTable.resetTable() |
| | | |
| | | this.setState({ |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 表格条件改变时重置数据(分页或排序) |
| | | */ |
| | | refreshbytable = (pagination, filters, sorter) => { |
| | | // 表格查询条件修改 |
| | | if (sorter.order) { |
| | | let _chg = { |
| | | ascend: 'asc', |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 表格刷新 |
| | | */ |
| | | reloadtable = () => { |
| | | this.refs.subTable.resetTable() |
| | | this.setState({ |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 页面刷新,重新获取配置 |
| | | */ |
| | | reloadview = () => { |
| | | this.setState({ |
| | | loadingview: true, // 页面加载中 |
| | | viewlost: false, // 页面丢失:1、未获取到配置-页面丢失;2、页面未启用 |
| | | lostmsg: '', // 页面丢失时的提示信息 |
| | | loadingview: true, |
| | | viewlost: false, |
| | | lostmsg: '', |
| | | config: {}, |
| | | searchlist: null, |
| | | actions: null, |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮操作完成后(成功或失败),页面刷新,重置页码及选择项 |
| | | */ |
| | | refreshbyaction = (btn, type) => { |
| | | // 按钮操作后刷新表格,重置页码及选择项 |
| | | if (btn.execSuccess === 'grid' && type === 'success') { |
| | | this.reloadtable() |
| | | } else if (btn.execError === 'grid' && type === 'error') { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 使用默认存储过程 sPC_Get_TableData 导出excel表格 |
| | | */ |
| | | handleDefaultExcelout = (btn) => { |
| | | const { MenuName } = this.props |
| | | const { arr_field, orderColumn, orderType, search, setting, config } = this.state |
| | |
| | | |
| | | Api.getExcelOut(param, name).then(res => { |
| | | if (res && res.status === false) { |
| | | this.refs.subButton.execError(res, btn) |
| | | this.refs.subtabButton.execError(res, btn) |
| | | } else { |
| | | this.refs.subButton.execSuccess(btn) |
| | | this.refs.subtabButton.execSuccess(btn) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 获取表格选择项 |
| | | */ |
| | | gettableselected = () => { |
| | | // 获取表格选择项 |
| | | let data = [] |
| | | this.refs.subTable.state.selectedRowKeys.forEach(item => { |
| | | data.push(this.refs.subTable.props.data[item]) |
| | |
| | | return data |
| | | } |
| | | |
| | | /** |
| | | * @description 表格中,按钮触发事件传递 |
| | | */ |
| | | buttonTrigger = (btn, record) => { |
| | | this.refs.subButton.actionTrigger(btn, record) |
| | | this.refs.subtabButton.actionTrigger(btn, record) |
| | | } |
| | | |
| | | /** |
| | | * @description 表格Id变化 |
| | | */ |
| | | handleTableId = () => {} |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | // 组件加载时,获取菜单数据 |
| | |
| | | * @description 组件销毁,清除state更新 |
| | | */ |
| | | componentWillUnmount () { |
| | | this.setState = (state, callback) => { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | } |
| | |
| | | const { setting, searchlist, actions, columns, loadingview, viewlost } = this.state |
| | | |
| | | return ( |
| | | <div className="subtable" id={'subtable' + this.props.MenuID}> |
| | | <div className="subtabtable" id={'subtabtable' + this.props.MenuID}> |
| | | {loadingview && <Spin size="large" />} |
| | | {searchlist && searchlist.length > 0 ? |
| | | <SubSearch |
| | |
| | | } |
| | | {actions && |
| | | <SubAction |
| | | ref="subButton" |
| | | type="sub" |
| | | ref="subtabButton" |
| | | type="subtab" |
| | | setting={setting} |
| | | actions={actions} |
| | | BID={this.props.BID} |
| | |
| | | loading={this.state.loading} |
| | | refreshdata={this.refreshbytable} |
| | | buttonTrigger={this.buttonTrigger} |
| | | handleTableId={this.handleTableId} |
| | | /> |
| | | } |
| | | {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} |
| | |
| | | .subtable { |
| | | .subtabtable { |
| | | position: relative; |
| | | min-height: 200px; |
| | | padding-top: 16px; |
| | |
| | | } |
| | | > .button-list { |
| | | padding: 10px 0px 5px; |
| | | button { |
| | | margin-right: 15px; |
| | | margin-bottom: 10px; |
| | | } |
| | | .ant-spin { |
| | | position: fixed; |
| | | z-index: 1010; |
| | | left: 50vw; |
| | | top: calc(50vh - 70px); |
| | | } |
| | | } |
| | | .box404 { |
| | | padding-top: 30px; |
| | |
| | | MenuID: PropTypes.string, |
| | | actions: PropTypes.array, // 搜索条件列表 |
| | | dict: PropTypes.object, // 字典项 |
| | | setting: PropTypes.any |
| | | setting: PropTypes.any, |
| | | triggerPopview: PropTypes.func |
| | | } |
| | | |
| | | state = { |
| | |
| | | } else if (item.OpenType === 'excelOut') { |
| | | this.setState({loadingUuid: item.uuid}) |
| | | this.refreshdata(item, 'excelOut') |
| | | } else if (item.OpenType === 'popview' && this.props.type !== 'subtab') { |
| | | this.props.triggerPopview(item, data) |
| | | } else if (item.OpenType === 'popview' && this.props.type === 'subtab') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '弹窗页面不支持此设置!', |
| | | duration: 10 |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | } |
| | | } |
| | | |
| | | if (this.props.type === 'subtab') { |
| | | container = document.body |
| | | } |
| | | |
| | | return ( |
| | | <Modal |
| | | title={title} |
| | |
| | | item.options = [...item.options, ...this.props.configMap[item.uuid]] |
| | | } |
| | | |
| | | item.oriOptions = item.options |
| | | item.oriOptions = JSON.parse(JSON.stringify(item.options)) |
| | | } |
| | | |
| | | if (!/^date/.test(item.type) && this.props.data && this.props.data.hasOwnProperty(item.field)) { |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Button, Select, DatePicker } from 'antd' |
| | | import { Form, Row, Col, Input, Button, Select, DatePicker, notification } from 'antd' |
| | | import moment from 'moment' |
| | | import './index.scss' |
| | | |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | let searchlist = JSON.parse(JSON.stringify(this.props.searchlist)) |
| | | let match = {} |
| | | let style = {} |
| | | let _list = [] |
| | | let fieldMap = new Map() |
| | | |
| | | this.props.searchlist.forEach(item => { |
| | | searchlist.forEach(item => { |
| | | if (fieldMap.has(item.field)) { |
| | | item.field = item.field + '@tail@' |
| | | } |
| | |
| | | match[item.field] = item.match |
| | | style[item.field] = item.type |
| | | |
| | | if (item.type === 'select' || item.type === 'link') { |
| | | item.oriOptions = JSON.parse(JSON.stringify(item.options)) |
| | | } |
| | | |
| | | _list.push(item) |
| | | }) |
| | | |
| | | let error = false |
| | | |
| | | _list = _list.map(item => { |
| | | if (item.type === 'link') { |
| | | let supItem = _list.filter(form => form.field === item.linkField)[0] |
| | | |
| | | if (!supItem) { |
| | | error = true |
| | | } else { |
| | | item.options = item.oriOptions.filter(option => option.parentId === supItem.initval) |
| | | } |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | if (error) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '关联菜单设置错误!', |
| | | duration: 10 |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | match: match, |
| | | style: style, |
| | | searchlist: _list |
| | | }) |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps() { |
| | | let searchlist = JSON.parse(JSON.stringify(this.props.searchlist)) |
| | | let _list = [] |
| | | let fieldMap = new Map() |
| | | |
| | | searchlist.forEach(item => { |
| | | if (fieldMap.has(item.field)) { |
| | | item.field = item.field + '@tail@' |
| | | } |
| | | fieldMap.set(item.field, true) |
| | | |
| | | if (item.type === 'select' || item.type === 'link') { |
| | | item.oriOptions = JSON.parse(JSON.stringify(item.options)) |
| | | } |
| | | |
| | | _list.push(item) |
| | | }) |
| | | |
| | | _list = _list.map(item => { |
| | | if (item.type === 'link') { |
| | | let supItem = _list.filter(form => form.field === item.linkField)[0] |
| | | |
| | | if (supItem) { |
| | | item.options = item.oriOptions.filter(option => option.parentId === supItem.initval) |
| | | } |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | searchlist: _list |
| | | }) |
| | | } |
| | | |
| | | resetform = (formlist, supfields, index) => { |
| | | index++ |
| | | let subfields = [] |
| | | |
| | | supfields.forEach(supfield => { |
| | | formlist = formlist.map(item => { |
| | | if (item.type === 'link' && item.linkField === supfield.field) { |
| | | item.options = item.oriOptions.filter(option => option.parentId === supfield.initval) |
| | | item.initval = item.options[0] ? item.options[0].Value : '' |
| | | item.hiden = true |
| | | |
| | | subfields.push(item) |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | |
| | | if (subfields.length === 0 || index > 6) { |
| | | return formlist |
| | | } else { |
| | | return this.resetform(formlist, subfields, index) |
| | | } |
| | | } |
| | | |
| | | selectChange = (_field, value) => { |
| | | let formlist = JSON.parse(JSON.stringify(this.state.searchlist)) |
| | | |
| | | let subfields = [] |
| | | formlist = formlist.map(item => { |
| | | if (item.type === 'link' && item.linkField === _field.field) { |
| | | item.options = item.oriOptions.filter(option => option.parentId === value) |
| | | item.initval = item.options[0] ? item.options[0].Value : '' |
| | | item.hiden = true |
| | | |
| | | subfields.push(item) |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | if (subfields.length === 0) { |
| | | this.searchChange() |
| | | return |
| | | } |
| | | |
| | | formlist = this.resetform(formlist, subfields, 0) |
| | | |
| | | this.setState({ |
| | | searchlist: formlist |
| | | }, () => { |
| | | this.setState({ |
| | | searchlist: formlist.map(item => { |
| | | item.hiden = false |
| | | return item |
| | | }) |
| | | }, () => { |
| | | this.searchChange() |
| | | }) |
| | | }) |
| | | } |
| | | |
| | |
| | | {getFieldDecorator(item.field, {initialValue: item.initval })( |
| | | <Select |
| | | showSearch |
| | | onChange={this.searchChange} |
| | | // onChange={this.searchChange} |
| | | onChange={(value) => {this.selectChange(item, value)}} |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | > |
| | | {item.options.map(option => |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber, Button, Modal, message } from 'antd' |
| | | import { btnIcons, btnClasses } from '@/utils/option.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | | |
| | | const { TextArea } = Input |
| | | |
| | | class MainSearch extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | formlist: PropTypes.any, |
| | | card: PropTypes.any |
| | | dict: PropTypes.object, // 字典项 |
| | | formlist: PropTypes.any, // 表单信息 |
| | | card: PropTypes.any, // 按钮信息 |
| | | tabs: PropTypes.array // 所有标签页 |
| | | } |
| | | |
| | | state = { |
| | | formlist: null, |
| | | openType: null, |
| | | errorType: 'E', |
| | | interType: null, |
| | | position: null, |
| | | formlist: null, // 表单信息 |
| | | openType: null, // 打开方式 |
| | | errorType: 'E', // 报错类型 |
| | | interType: null, // 接口类型:内部、外部 |
| | | position: null, // 按钮位置 |
| | | reqOptionSgl: [{ |
| | | MenuID: 'requiredSgl', |
| | | value: 'requiredSgl', |
| | | text: this.props.dict['header.form.requiredSgl'] |
| | | }], |
| | | reqOptions: [{ |
| | | MenuID: 'notRequired', |
| | | value: 'notRequired', |
| | | text: this.props.dict['header.form.notRequired'] |
| | | }, { |
| | | MenuID: 'requiredSgl', |
| | | value: 'requiredSgl', |
| | | text: this.props.dict['header.form.requiredSgl'] |
| | | }], |
| | | reqOptionsMutil: [{ |
| | | MenuID: 'notRequired', |
| | | value: 'notRequired', |
| | | text: this.props.dict['header.form.notRequired'] |
| | | }, { |
| | | MenuID: 'requiredSgl', |
| | | value: 'requiredSgl', |
| | | text: this.props.dict['header.form.requiredSgl'] |
| | | }, { |
| | | MenuID: 'required', |
| | | value: 'required', |
| | | text: this.props.dict['header.form.required'] |
| | | }, { |
| | | MenuID: 'requiredOnce', |
| | | value: 'requiredOnce', |
| | | text: this.props.dict['header.form.requiredOnce'] |
| | | }], |
| | | insertUpdateOptions: [{ |
| | | MenuID: '', |
| | | value: '', |
| | | text: this.props.dict['header.form.empty'] |
| | | }, { |
| | | MenuID: 'insert', |
| | | value: 'insert', |
| | | text: this.props.dict['header.form.action.insert'] |
| | | }, { |
| | | MenuID: 'update', |
| | | value: 'update', |
| | | text: this.props.dict['header.form.action.update'] |
| | | }], |
| | | deleteOptions: [{ |
| | | MenuID: '', |
| | | value: '', |
| | | text: this.props.dict['header.form.empty'] |
| | | }, { |
| | | MenuID: 'LogicDelete', |
| | | value: 'LogicDelete', |
| | | text: this.props.dict['header.form.action.LogicDelete'] |
| | | }, { |
| | | MenuID: 'delete', |
| | | value: 'delete', |
| | | text: this.props.dict['header.form.action.delete'] |
| | | }] |
| | | } |
| | |
| | | let _intertype = '' |
| | | let _position = '' |
| | | let _errorType = '' |
| | | let _tabType = '' |
| | | let _linkTab = '' |
| | | let _options = null |
| | | |
| | | this.props.formlist.forEach(form => { |
| | |
| | | _position = form.initVal |
| | | } else if (form.key === 'errorTip') { |
| | | _errorType = form.initVal |
| | | } else if (form.key === 'tabType') { |
| | | _tabType = form.initVal |
| | | } else if (form.key === 'linkTab') { |
| | | _linkTab = form.initVal |
| | | } |
| | | }) |
| | | |
| | | if (_opentype === 'innerpage') { // 新页面(内部),可选模板 |
| | | let _tabs = this.props.tabs.filter(tab => tab.type === _tabType) |
| | | let initTab = _tabs.filter(tab => tab.uuid === _linkTab)[0] |
| | | |
| | | if (_opentype === 'innerpage') { // 新页面(内部),可选模板 |
| | | _options = ['label', 'Ot', 'OpenType', 'pageTemplate', 'icon', 'class', 'position'] |
| | | } else if (_opentype === 'outerpage') { // 新页面(外部),需要页面地址 |
| | | } else if (_opentype === 'outerpage') { // 新页面(外部),需要页面地址 |
| | | _options = ['label', 'Ot', 'OpenType', 'url', 'icon', 'class', 'position'] |
| | | } else if (_opentype === 'blank' || _opentype === 'tab' || _opentype === 'popview') { |
| | | } else if (_opentype === 'blank' || _opentype === 'tab') { // 新标签或当前页面替换 |
| | | _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position'] |
| | | } else if (_opentype === 'excelIn' || _opentype === 'excelOut') { |
| | | } else if (_opentype === 'popview') { // 模态框标签页 |
| | | _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose'] |
| | | } else if (_opentype === 'excelIn' || _opentype === 'excelOut') { // 导入导出 |
| | | if (_intertype === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError', 'method'] |
| | | } else { |
| | |
| | | } else { |
| | | item.options = this.state.insertUpdateOptions |
| | | } |
| | | } else if (item.key === 'linkTab') { |
| | | item.options = [ |
| | | { |
| | | value: '', |
| | | text: '新建' |
| | | }, |
| | | ..._tabs |
| | | ] |
| | | if (!initTab) { |
| | | item.initVal = '' |
| | | } |
| | | } |
| | | item.hidden = !_options.includes(item.key) |
| | | return item |
| | |
| | | _options = ['label', 'Ot', 'OpenType', 'pageTemplate', 'icon', 'class', 'position'] |
| | | } else if (value === 'outerpage') { |
| | | _options = ['label', 'Ot', 'OpenType', 'url', 'icon', 'class', 'position'] |
| | | } else if (value === 'blank' || value === 'tab' || value === 'popview') { |
| | | } else if (value === 'blank' || value === 'tab') { |
| | | _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position'] |
| | | } else if (value === 'popview') { |
| | | _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose'] |
| | | } else if (value === 'excelIn' || value === 'excelOut') { |
| | | if (this.state.interType === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError', 'method'] |
| | |
| | | this.setState({ |
| | | errorType: value |
| | | }) |
| | | } else if (key === 'tabType') { |
| | | let _tabs = this.props.tabs.filter(tab => tab.type === value) |
| | | |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | | if (item.key === 'linkTab') { |
| | | item.options = [ |
| | | { |
| | | value: '', |
| | | text: '新建' |
| | | }, |
| | | ..._tabs |
| | | ] |
| | | item.initVal = '' |
| | | item.hidden = true |
| | | } |
| | | return item |
| | | }) |
| | | }, () => { |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | | if (item.key === 'linkTab') { |
| | | item.hidden = false |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | getFields() { |
| | | const { getFieldDecorator } = this.props.form |
| | | const fields = [] |
| | | |
| | | this.state.formlist.forEach((item, index) => { |
| | | if (item.hidden) return |
| | | |
| | |
| | | onChange={(value) => {this.openTypeChange(item.key, value)}} |
| | | getPopupContainer={() => document.getElementById('winter')} |
| | | > |
| | | {item.options.map(option => |
| | | <Select.Option id={option.MenuID} title={option.text} key={option.MenuID} value={option.MenuID}> |
| | | {item.key === 'icon' && option.MenuID && <Icon type={option.MenuID} />} {option.text} |
| | | {item.options.map((option, index) => |
| | | <Select.Option id={`${index}`} title={option.text} key={`${index}`} value={option.value}> |
| | | {item.key === 'icon' && option.value && <Icon type={option.value} />} {option.text} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |
| | |
| | | { |
| | | item.options.map(option => { |
| | | return ( |
| | | <Radio key={option.MenuID} value={option.MenuID}>{option.text}</Radio> |
| | | <Radio key={option.value} value={option.value}>{option.text}</Radio> |
| | | ) |
| | | }) |
| | | } |
| | |
| | | if (values.OpenType === 'excelIn' || values.OpenType === 'excelOut') { |
| | | values.position = 'toolbar' |
| | | values.Ot = 'notRequired' |
| | | } else if (values.OpenType === 'popview' && !values.linkTab) { // 没有关联标签(新建时),创建新标签Id |
| | | values.linkTab = Utils.getuuid() |
| | | } |
| | | |
| | | if (values.innerFunc === '' && values.sql === '') { |
| | |
| | | }) |
| | | } |
| | | |
| | | _config.tabs = _config.tabs || [] |
| | | _config.tabgroups = _config.tabgroups || ['tabs'] |
| | | _config.setting.subtabs = _config.setting.subtabs || [] |
| | | // _config.tabs = _config.tabs || [] |
| | | // _config.tabgroups = _config.tabgroups || ['tabs'] |
| | | // _config.setting.subtabs = _config.setting.subtabs || [] |
| | | |
| | | this.setState({ |
| | | originActions: _oriActions, |
| | |
| | | initVal: card.OpenType, |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'pop', |
| | | value: 'pop', |
| | | text: this.state.dict['header.form.popform'] |
| | | }, { |
| | | MenuID: 'prompt', |
| | | value: 'prompt', |
| | | text: this.state.dict['header.form.prompt'] |
| | | }, { |
| | | MenuID: 'exec', |
| | | value: 'exec', |
| | | text: this.state.dict['header.form.exec'] |
| | | }, { |
| | | MenuID: 'excelIn', |
| | | value: 'excelIn', |
| | | text: this.state.dict['header.form.excelIn'] |
| | | }, { |
| | | MenuID: 'excelOut', |
| | | value: 'excelOut', |
| | | text: this.state.dict['header.form.excelOut'] |
| | | }, { |
| | | MenuID: 'popview', |
| | | value: 'popview', |
| | | text: this.state.dict['header.form.popview'] |
| | | }, { |
| | | MenuID: 'tab', |
| | | value: 'tab', |
| | | text: this.state.dict['header.form.tab'] |
| | | }, { |
| | | MenuID: 'blank', |
| | | value: 'blank', |
| | | text: this.state.dict['header.form.blank'] |
| | | }, { |
| | | MenuID: 'innerpage', |
| | | value: 'innerpage', |
| | | text: this.state.dict['header.form.newpage.inner'] |
| | | }, { |
| | | MenuID: 'outerpage', |
| | | value: 'outerpage', |
| | | text: this.state.dict['header.form.newpage.outer'] |
| | | }] |
| | | }, { |
| | | type: 'select', |
| | | key: 'tabType', |
| | | label: this.state.dict['header.form.tabType'], |
| | | initVal: card.tabType || 'SubTable', |
| | | required: true, |
| | | options: [{ |
| | | value: 'SubTable', |
| | | text: this.state.dict['header.menu.tab.subtable'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'linkTab', |
| | | label: '关联标签', |
| | | initVal: card.linkTab || '', |
| | | required: false, |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | initVal: card.intertype, |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'inner', |
| | | value: 'inner', |
| | | text: this.state.dict['header.form.interface.inner'] |
| | | }, { |
| | | MenuID: 'outer', |
| | | value: 'outer', |
| | | text: this.state.dict['header.form.interface.outer'] |
| | | }] |
| | | }, |
| | |
| | | initVal: card.position || 'toolbar', |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'toolbar', |
| | | value: 'toolbar', |
| | | text: this.state.dict['header.form.toolbar'] |
| | | }, { |
| | | MenuID: 'grid', |
| | | value: 'grid', |
| | | text: this.state.dict['header.form.grid'] |
| | | }] |
| | | }, |
| | |
| | | initVal: card.execSuccess || 'never', |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'never', |
| | | value: 'never', |
| | | text: this.state.dict['header.form.refresh.never'] |
| | | }, { |
| | | MenuID: 'grid', |
| | | value: 'grid', |
| | | text: this.state.dict['header.form.refresh.grid'] |
| | | }, { |
| | | MenuID: 'view', |
| | | value: 'view', |
| | | text: this.state.dict['header.form.refresh.view'] |
| | | }] |
| | | }, |
| | |
| | | initVal: card.execError || 'never', |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'never', |
| | | value: 'never', |
| | | text: this.state.dict['header.form.refresh.never'] |
| | | }, { |
| | | MenuID: 'grid', |
| | | value: 'grid', |
| | | text: this.state.dict['header.form.refresh.grid'] |
| | | }, { |
| | | MenuID: 'view', |
| | | value: 'view', |
| | | text: this.state.dict['header.form.refresh.view'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'popClose', |
| | | label: this.state.dict['header.form.popClose'], |
| | | initVal: card.popClose || 'never', |
| | | required: true, |
| | | options: [{ |
| | | value: 'never', |
| | | text: this.state.dict['header.form.refresh.never'] |
| | | }, { |
| | | value: 'grid', |
| | | text: this.state.dict['header.form.refresh.grid'] |
| | | }, { |
| | | value: 'view', |
| | | text: this.state.dict['header.form.refresh.view'] |
| | | }] |
| | | }, |
| | |
| | | tooltipClass: 'middle', |
| | | required: false, |
| | | options: [{ |
| | | MenuID: 'S', |
| | | value: 'S', |
| | | text: 'S(提醒框-0)' |
| | | }, { |
| | | MenuID: '-1', |
| | | value: '-1', |
| | | text: '-1(不提示)' |
| | | }, { |
| | | MenuID: 'N', |
| | | value: 'N', |
| | | text: 'N(提醒框-1)' |
| | | }, { |
| | | MenuID: 'F', |
| | | value: 'F', |
| | | text: 'F(提醒框-2)' |
| | | }, { |
| | | MenuID: 'E', |
| | | value: 'E', |
| | | text: 'E(确认框)' |
| | | }, { |
| | | MenuID: 'NM', |
| | | value: 'NM', |
| | | text: 'NM(顶部提示)' |
| | | }] |
| | | }, |
| | |
| | | initVal: card.type, |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'text', |
| | | value: 'text', |
| | | text: this.state.dict['header.form.text'] |
| | | }, { |
| | | MenuID: 'number', |
| | | value: 'number', |
| | | text: this.state.dict['header.form.number'] |
| | | }, { |
| | | MenuID: 'picture', |
| | | value: 'picture', |
| | | text: this.state.dict['header.form.picture'] |
| | | }, { |
| | | MenuID: 'textarea', |
| | | value: 'textarea', |
| | | text: this.state.dict['header.form.textarea'] |
| | | }] |
| | | }, |
| | |
| | | initVal: card.Align, |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'left', |
| | | value: 'left', |
| | | text: this.state.dict['header.form.alignLeft'] |
| | | }, { |
| | | MenuID: 'right', |
| | | value: 'right', |
| | | text: this.state.dict['header.form.alignRight'] |
| | | }, { |
| | | MenuID: 'center', |
| | | value: 'center', |
| | | text: this.state.dict['header.form.alignCenter'] |
| | | }] |
| | | }, |
| | |
| | | initVal: card.Hide, |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'true', |
| | | value: 'true', |
| | | text: this.state.dict['header.form.true'] |
| | | }, { |
| | | MenuID: 'false', |
| | | value: 'false', |
| | | text: this.state.dict['header.form.false'] |
| | | }] |
| | | }, |
| | |
| | | initVal: card.IsSort, |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'true', |
| | | value: 'true', |
| | | text: this.state.dict['header.form.true'] |
| | | }, { |
| | | MenuID: 'false', |
| | | value: 'false', |
| | | text: this.state.dict['header.form.false'] |
| | | }] |
| | | }, |
| | |
| | | label: this.state.dict['header.form.format'], |
| | | initVal: card.format || '', |
| | | options: [{ |
| | | MenuID: '', |
| | | value: '', |
| | | text: this.state.dict['header.form.empty'] |
| | | }, { |
| | | MenuID: 'thdSeparator', |
| | | value: 'thdSeparator', |
| | | text: this.state.dict['header.form.thdSeparator'] |
| | | }], |
| | | required: false |
| | |
| | | label: this.state.dict['header.form.match'], |
| | | initVal: card.match || '', |
| | | options: [{ |
| | | MenuID: '', |
| | | value: '', |
| | | text: this.state.dict['header.form.empty'] |
| | | }, { |
| | | MenuID: '>', |
| | | value: '>', |
| | | text: '>' |
| | | }, { |
| | | MenuID: '<', |
| | | value: '<', |
| | | text: '<' |
| | | }, { |
| | | MenuID: '>=', |
| | | value: '>=', |
| | | text: '>=' |
| | | }, { |
| | | MenuID: '<=', |
| | | value: '<=', |
| | | text: '<=' |
| | | }], |
| | | required: false |
| | |
| | | label: this.state.dict['header.form.color'], |
| | | initVal: card.color || '', |
| | | options: [{ |
| | | MenuID: '', |
| | | value: '', |
| | | text: this.state.dict['header.form.empty'] |
| | | }, { |
| | | MenuID: 'red', |
| | | value: 'red', |
| | | text: '红色(内容)' |
| | | }, { |
| | | MenuID: 'redbg', |
| | | value: 'redbg', |
| | | text: '红色(背景)' |
| | | }, { |
| | | MenuID: 'orange', |
| | | value: 'orange', |
| | | text: '橙色(内容)' |
| | | }, { |
| | | MenuID: 'orangebg', |
| | | value: 'orangebg', |
| | | text: '橙色(背景)' |
| | | }, { |
| | | MenuID: 'green', |
| | | value: 'green', |
| | | text: '绿色(内容)' |
| | | }, { |
| | | MenuID: 'greenbg', |
| | | value: 'greenbg', |
| | | text: '绿色(背景)' |
| | | }], |
| | | required: false |
| | |
| | | _usedTabMap.set(subtab, true) |
| | | }) |
| | | }) |
| | | console.log(config) |
| | | |
| | | config.setting.subtabs.forEach(subtab => { // 主表已选的下级标签 |
| | | _usedTabMap.set(subtab, true) |
| | | }) |
| | |
| | | { |
| | | type: 'select', |
| | | key: 'type', |
| | | label: this.state.dict['header.form.type'], |
| | | initVal: card.type || '', |
| | | label: this.state.dict['header.form.tabType'], |
| | | initVal: card.type || 'SubTable', |
| | | required: true, |
| | | options: [{ |
| | | value: 'SubTable', |
| | |
| | | * @description 设置可配置按钮 |
| | | */ |
| | | setSubConfig = (btn, type) => { |
| | | console.log(btn) |
| | | const { menu } = this.props |
| | | const { config, originMenu } = this.state |
| | | |
| | |
| | | message: '菜单配置已修改,请保存!', |
| | | duration: 10 |
| | | }) |
| | | } else if (type === 'button') { |
| | | } else { |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | |
| | | let uuid = '' |
| | | let _type = type |
| | | if (type === 'button' && btn.OpenType === 'popview') { |
| | | _type = 'tab' |
| | | } |
| | | |
| | | if (_type === 'button') { |
| | | uuid = btn.uuid |
| | | } else { |
| | | uuid = btn.linkTab |
| | | } |
| | | |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: btn.uuid |
| | | MenuID: uuid |
| | | }).then(res => { |
| | | if (res.status) { |
| | | this.setState({ |
| | |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | this.props.handleSubConfig(btn, originMenu, _LongParam, type) |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | } else if (type === 'tab') { |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: btn.linkTab |
| | | }).then(res => { |
| | | if (res.status) { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | let _LongParam = '' |
| | | if (res.LongParam) { |
| | | _LongParam = window.decodeURIComponent(window.atob(res.LongParam)) |
| | | try { |
| | | _LongParam = JSON.parse(_LongParam) |
| | | } catch (e) { |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | if (!_LongParam) { |
| | | |
| | | if (_type === 'tab' && !_LongParam) { |
| | | _LongParam = { |
| | | ...btn, |
| | | uuid: btn.linkTab, |
| | |
| | | } |
| | | } |
| | | |
| | | this.props.handleSubConfig(btn, originMenu, _LongParam, type) |
| | | this.props.handleSubConfig(btn, originMenu, _LongParam, _type) |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | <ActionForm |
| | | dict={this.state.dict} |
| | | card={this.state.card} |
| | | tabs={this.state.tabviews} |
| | | formlist={this.state.formlist} |
| | | wrappedComponentRef={(inst) => this.formRef = inst} |
| | | /> : null |
| | |
| | | |
| | | class MainSearch extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | formlist: PropTypes.any, |
| | | card: PropTypes.any |
| | | dict: PropTypes.object, // 字典项 |
| | | formlist: PropTypes.any, // 表单信息 |
| | | card: PropTypes.any, // 按钮信息 |
| | | tabs: PropTypes.array // 所有标签页 |
| | | } |
| | | |
| | | state = { |
| | |
| | | interType: null, |
| | | position: null, |
| | | reqOptionSgl: [{ |
| | | MenuID: 'requiredSgl', |
| | | value: 'requiredSgl', |
| | | text: this.props.dict['header.form.requiredSgl'] |
| | | }], |
| | | reqOptionsMutil: [{ |
| | | MenuID: 'notRequired', |
| | | value: 'notRequired', |
| | | text: this.props.dict['header.form.notRequired'] |
| | | }, { |
| | | MenuID: 'requiredSgl', |
| | | value: 'requiredSgl', |
| | | text: this.props.dict['header.form.requiredSgl'] |
| | | }, { |
| | | MenuID: 'required', |
| | | value: 'required', |
| | | text: this.props.dict['header.form.required'] |
| | | }, { |
| | | MenuID: 'requiredOnce', |
| | | value: 'requiredOnce', |
| | | text: this.props.dict['header.form.requiredOnce'] |
| | | }], |
| | | insertUpdateOptions: [{ |
| | | MenuID: '', |
| | | value: '', |
| | | text: this.props.dict['header.form.empty'] |
| | | }, { |
| | | MenuID: 'insert', |
| | | value: 'insert', |
| | | text: this.props.dict['header.form.action.insert'] |
| | | }, { |
| | | MenuID: 'update', |
| | | value: 'update', |
| | | text: this.props.dict['header.form.action.update'] |
| | | }], |
| | | deleteOptions: [{ |
| | | MenuID: '', |
| | | value: '', |
| | | text: this.props.dict['header.form.empty'] |
| | | }, { |
| | | MenuID: 'LogicDelete', |
| | | value: 'LogicDelete', |
| | | text: this.props.dict['header.form.action.LogicDelete'] |
| | | }, { |
| | | MenuID: 'delete', |
| | | value: 'delete', |
| | | text: this.props.dict['header.form.action.delete'] |
| | | }] |
| | | } |
| | |
| | | let _intertype = '' |
| | | let _position = '' |
| | | let _errorType = '' |
| | | let _tabType = '' |
| | | let _linkTab = '' |
| | | let _options = null |
| | | |
| | | this.props.formlist.forEach(form => { |
| | |
| | | _position = form.initVal |
| | | } else if (form.key === 'errorTip') { |
| | | _errorType = form.initVal |
| | | } else if (form.key === 'tabType') { |
| | | _tabType = form.initVal |
| | | } else if (form.key === 'linkTab') { |
| | | _linkTab = form.initVal |
| | | } |
| | | }) |
| | | |
| | | if (_opentype === 'excelIn' || _opentype === 'excelOut') { |
| | | let _tabs = this.props.tabs.filter(tab => tab.type === _tabType) |
| | | let initTab = _tabs.filter(tab => tab.uuid === _linkTab)[0] |
| | | |
| | | if (_opentype === 'popview') { |
| | | _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose'] |
| | | } else if (_opentype === 'excelIn' || _opentype === 'excelOut') { |
| | | if (_intertype === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError', 'method'] |
| | | } else { |
| | |
| | | } else { |
| | | item.options = this.state.insertUpdateOptions |
| | | } |
| | | } else if (item.key === 'linkTab') { |
| | | item.options = [ |
| | | { |
| | | value: '', |
| | | text: '新建' |
| | | }, |
| | | ..._tabs |
| | | ] |
| | | if (!initTab) { |
| | | item.initVal = '' |
| | | } |
| | | } |
| | | item.hidden = !_options.includes(item.key) |
| | | return item |
| | |
| | | openTypeChange = (key, value) => { |
| | | if (key === 'OpenType') { |
| | | let _options = null |
| | | if (value === 'excelIn' || value === 'excelOut') { |
| | | |
| | | if (value === 'popview') { |
| | | _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose'] |
| | | } else if (value === 'excelIn' || value === 'excelOut') { |
| | | if (this.state.interType === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError', 'method'] |
| | | } else { |
| | |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'errorTip', 'errorTime', 'interface', 'outerFunc', 'callbackFunc', 'method'] |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | openType: value, |
| | | formlist: this.state.formlist.map(item => { |
| | |
| | | } else if (key === 'errorTip') { |
| | | this.setState({ |
| | | errorType: value |
| | | }) |
| | | } else if (key === 'tabType') { |
| | | let _tabs = this.props.tabs.filter(tab => tab.type === value) |
| | | |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | | if (item.key === 'linkTab') { |
| | | item.options = [ |
| | | { |
| | | value: '', |
| | | text: '新建' |
| | | }, |
| | | ..._tabs |
| | | ] |
| | | item.initVal = '' |
| | | item.hidden = true |
| | | } |
| | | return item |
| | | }) |
| | | }, () => { |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | | if (item.key === 'linkTab') { |
| | | item.hidden = false |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | |
| | | onChange={(value) => {this.openTypeChange(item.key, value)}} |
| | | getPopupContainer={() => document.getElementById('winter')} |
| | | > |
| | | {item.options.map(option => |
| | | <Select.Option id={option.MenuID} title={option.text} key={option.MenuID} value={option.MenuID}> |
| | | {item.key === 'icon' && option.MenuID && <Icon type={option.MenuID} />} {option.text} |
| | | {item.options.map((option, index) => |
| | | <Select.Option id={`${index}`} title={option.text} key={`${index}`} value={option.value}> |
| | | {item.key === 'icon' && option.value && <Icon type={option.value} />} {option.text} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |
| | |
| | | { |
| | | item.options.map(option => { |
| | | return ( |
| | | <Radio key={option.MenuID} value={option.MenuID}>{option.text}</Radio> |
| | | <Radio key={option.value} value={option.value}>{option.text}</Radio> |
| | | ) |
| | | }) |
| | | } |
| | |
| | | originActions: null, // 原始按钮信息,使用已有用户模板 |
| | | delActions: [], // 删除按钮列表 |
| | | funcLoading: false, // 存储过程创建中 |
| | | showColumnName: false // 显示列字段名控制 |
| | | showColumnName: false, // 显示列字段名控制 |
| | | tabviews: [] // 所有标签页 |
| | | } |
| | | |
| | | /** |
| | |
| | | this.setState({ |
| | | tableColumns: _columns |
| | | }) |
| | | }) |
| | | |
| | | Api.getSystemConfig({func: 'sPC_Get_UserTemp', TypeCharTwo: 'tab'}).then(res => { |
| | | if (res.status) { |
| | | this.setState({ |
| | | tabviews: res.UserTemp.map(temp => { |
| | | return { |
| | | uuid: temp.MenuID, |
| | | value: temp.MenuID, |
| | | text: temp.MenuName, |
| | | type: temp.Template, |
| | | MenuNo: temp.MenuNo |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | initVal: card.OpenType, |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'pop', |
| | | value: 'pop', |
| | | text: this.state.dict['header.form.popform'] |
| | | }, { |
| | | MenuID: 'prompt', |
| | | value: 'prompt', |
| | | text: this.state.dict['header.form.prompt'] |
| | | }, { |
| | | MenuID: 'exec', |
| | | value: 'exec', |
| | | text: this.state.dict['header.form.exec'] |
| | | }, { |
| | | MenuID: 'excelIn', |
| | | value: 'excelIn', |
| | | text: this.state.dict['header.form.excelIn'] |
| | | }, { |
| | | MenuID: 'excelOut', |
| | | value: 'excelOut', |
| | | text: this.state.dict['header.form.excelOut'] |
| | | }, { |
| | | value: 'popview', |
| | | text: this.state.dict['header.form.popview'] |
| | | }] |
| | | }, { |
| | | type: 'select', |
| | | key: 'tabType', |
| | | label: this.state.dict['header.form.tabType'], |
| | | initVal: card.tabType || 'SubTable', |
| | | required: true, |
| | | options: [{ |
| | | value: 'SubTable', |
| | | text: this.state.dict['header.menu.tab.subtable'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'linkTab', |
| | | label: '关联标签', |
| | | initVal: card.linkTab || '', |
| | | required: false, |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | initVal: card.intertype, |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'inner', |
| | | value: 'inner', |
| | | text: this.state.dict['header.form.interface.inner'] |
| | | }, { |
| | | MenuID: 'outer', |
| | | value: 'outer', |
| | | text: this.state.dict['header.form.interface.outer'] |
| | | }] |
| | | }, |
| | |
| | | initVal: card.position || 'toolbar', |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'toolbar', |
| | | value: 'toolbar', |
| | | text: this.state.dict['header.form.toolbar'] |
| | | }, { |
| | | MenuID: 'grid', |
| | | value: 'grid', |
| | | text: this.state.dict['header.form.grid'] |
| | | }] |
| | | }, |
| | |
| | | initVal: card.execSuccess || 'never', |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'never', |
| | | value: 'never', |
| | | text: this.state.dict['header.form.refresh.never'] |
| | | }, { |
| | | MenuID: 'grid', |
| | | value: 'grid', |
| | | text: this.state.dict['header.form.refresh.grid'] |
| | | }, { |
| | | MenuID: 'view', |
| | | value: 'view', |
| | | text: this.state.dict['header.form.refresh.view'] |
| | | }] |
| | | }, |
| | |
| | | initVal: card.execError || 'never', |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'never', |
| | | value: 'never', |
| | | text: this.state.dict['header.form.refresh.never'] |
| | | }, { |
| | | MenuID: 'grid', |
| | | value: 'grid', |
| | | text: this.state.dict['header.form.refresh.grid'] |
| | | }, { |
| | | MenuID: 'view', |
| | | value: 'view', |
| | | text: this.state.dict['header.form.refresh.view'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'popClose', |
| | | label: this.state.dict['header.form.popClose'], |
| | | initVal: card.popClose || 'never', |
| | | required: true, |
| | | options: [{ |
| | | value: 'never', |
| | | text: this.state.dict['header.form.refresh.never'] |
| | | }, { |
| | | value: 'maingrid', |
| | | text: this.state.dict['header.form.refresh.maingrid'] |
| | | }, { |
| | | value: 'subgrid', |
| | | text: this.state.dict['header.form.refresh.subgrid'] |
| | | }] |
| | | }, |
| | | { |
| | |
| | | tooltipClass: 'middle', |
| | | required: false, |
| | | options: [{ |
| | | MenuID: 'S', |
| | | value: 'S', |
| | | text: 'S(提醒框-0)' |
| | | }, { |
| | | MenuID: '-1', |
| | | value: '-1', |
| | | text: '-1(不提示)' |
| | | }, { |
| | | MenuID: 'N', |
| | | value: 'N', |
| | | text: 'N(提醒框-1)' |
| | | }, { |
| | | MenuID: 'F', |
| | | value: 'F', |
| | | text: 'F(提醒框-2)' |
| | | }, { |
| | | MenuID: 'E', |
| | | value: 'E', |
| | | text: 'E(确认框)' |
| | | }, { |
| | | MenuID: 'NM', |
| | | value: 'NM', |
| | | text: 'NM(顶部提示)' |
| | | }] |
| | | }, |
| | |
| | | initVal: card.type, |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'text', |
| | | value: 'text', |
| | | text: this.state.dict['header.form.text'] |
| | | }, { |
| | | MenuID: 'picture', |
| | | value: 'picture', |
| | | text: this.state.dict['header.form.picture'] |
| | | }, { |
| | | MenuID: 'number', |
| | | value: 'number', |
| | | text: this.state.dict['header.form.number'] |
| | | }, { |
| | | MenuID: 'textarea', |
| | | value: 'textarea', |
| | | text: this.state.dict['header.form.textarea'] |
| | | }] |
| | | }, |
| | |
| | | initVal: card.Align, |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'left', |
| | | value: 'left', |
| | | text: this.state.dict['header.form.alignLeft'] |
| | | }, { |
| | | MenuID: 'right', |
| | | value: 'right', |
| | | text: this.state.dict['header.form.alignRight'] |
| | | }, { |
| | | MenuID: 'center', |
| | | value: 'center', |
| | | text: this.state.dict['header.form.alignCenter'] |
| | | }] |
| | | }, |
| | |
| | | initVal: card.Hide, |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'true', |
| | | value: 'true', |
| | | text: this.state.dict['header.form.true'] |
| | | }, { |
| | | MenuID: 'false', |
| | | value: 'false', |
| | | text: this.state.dict['header.form.false'] |
| | | }] |
| | | }, |
| | |
| | | initVal: card.IsSort, |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'true', |
| | | value: 'true', |
| | | text: this.state.dict['header.form.true'] |
| | | }, { |
| | | MenuID: 'false', |
| | | value: 'false', |
| | | text: this.state.dict['header.form.false'] |
| | | }] |
| | | }, |
| | |
| | | label: this.state.dict['header.form.format'], |
| | | initVal: card.format || '', |
| | | options: [{ |
| | | MenuID: '', |
| | | value: '', |
| | | text: this.state.dict['header.form.empty'] |
| | | }, { |
| | | MenuID: 'thdSeparator', |
| | | value: 'thdSeparator', |
| | | text: this.state.dict['header.form.thdSeparator'] |
| | | }], |
| | | required: false |
| | |
| | | label: this.state.dict['header.form.match'], |
| | | initVal: card.match || '', |
| | | options: [{ |
| | | MenuID: '', |
| | | value: '', |
| | | text: this.state.dict['header.form.empty'] |
| | | }, { |
| | | MenuID: '>', |
| | | value: '>', |
| | | text: '>' |
| | | }, { |
| | | MenuID: '<', |
| | | value: '<', |
| | | text: '<' |
| | | }, { |
| | | MenuID: '>=', |
| | | value: '>=', |
| | | text: '>=' |
| | | }, { |
| | | MenuID: '<=', |
| | | value: '<=', |
| | | text: '<=' |
| | | }], |
| | | required: false |
| | |
| | | label: this.state.dict['header.form.color'], |
| | | initVal: card.color || '', |
| | | options: [{ |
| | | MenuID: '', |
| | | value: '', |
| | | text: this.state.dict['header.form.empty'] |
| | | }, { |
| | | MenuID: 'red', |
| | | value: 'red', |
| | | text: '红色(内容)' |
| | | }, { |
| | | MenuID: 'redbg', |
| | | value: 'redbg', |
| | | text: '红色(背景)' |
| | | }, { |
| | | MenuID: 'orange', |
| | | value: 'orange', |
| | | text: '橙色(内容)' |
| | | }, { |
| | | MenuID: 'orangebg', |
| | | value: 'orangebg', |
| | | text: '橙色(背景)' |
| | | }, { |
| | | MenuID: 'green', |
| | | value: 'green', |
| | | text: '绿色(内容)' |
| | | }, { |
| | | MenuID: 'greenbg', |
| | | value: 'greenbg', |
| | | text: '绿色(背景)' |
| | | }], |
| | | required: false |
| | |
| | | <ActionForm |
| | | dict={this.state.dict} |
| | | card={this.state.card} |
| | | tabs={this.state.tabviews} |
| | | formlist={this.state.formlist} |
| | | wrappedComponentRef={(inst) => this.formRef = inst} |
| | | /> : null |
| | |
| | | onChange={(value) => {this.typeChange(item.key, value)}} |
| | | getPopupContainer={() => document.getElementById('columnwinter')} |
| | | > |
| | | {item.options.map(option => |
| | | <Select.Option id={option.MenuID} title={option.text} key={option.MenuID} value={option.MenuID}> |
| | | {item.options.map((option, index) => |
| | | <Select.Option id={`${index}`} title={option.text} key={`${index}`} value={option.value}> |
| | | {option.text} |
| | | </Select.Option> |
| | | )} |
| | |
| | | { |
| | | item.options.map(option => { |
| | | return ( |
| | | <Radio key={option.MenuID} value={option.MenuID}>{option.text}</Radio> |
| | | <Radio key={option.value} value={option.value}>{option.text}</Radio> |
| | | ) |
| | | }) |
| | | } |
| | |
| | | newcard.sqlType = '' |
| | | newcard.Ot = 'requiredSgl' |
| | | newcard.OpenType = item.subType |
| | | newcard.tabType = 'SubTable' |
| | | newcard.linkTab = '' |
| | | newcard.icon = '' |
| | | newcard.class = 'default' |
| | | newcard.intertype = 'inner' |
| | |
| | | newcard.position = 'toolbar' |
| | | newcard.execSuccess = 'grid' |
| | | newcard.execError = 'never' |
| | | newcard.popClose = 'never' |
| | | newcard.errorTime = 15 |
| | | newcard.callbackFunc = '' |
| | | newcard.pageTemplate = '' |
| | |
| | | } |
| | | |
| | | handleChange = (nextTargetKeys, direction, moveKeys) => { |
| | | console.log(direction) |
| | | console.log(moveKeys) |
| | | console.log(nextTargetKeys) |
| | | this.setState({ targetKeys: nextTargetKeys }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | export const btnIcons = [{ |
| | | MenuID: '', |
| | | value: '', |
| | | text: 'unset' |
| | | }, { |
| | | MenuID: 'plus', |
| | | value: 'plus', |
| | | text: 'plus' |
| | | }, { |
| | | MenuID: 'plus-circle', |
| | | value: 'plus-circle', |
| | | text: 'plus-circle' |
| | | }, { |
| | | MenuID: 'edit', |
| | | value: 'edit', |
| | | text: 'edit' |
| | | }, { |
| | | MenuID: 'form', |
| | | value: 'form', |
| | | text: 'form' |
| | | }, { |
| | | MenuID: 'close', |
| | | value: 'close', |
| | | text: 'close' |
| | | }, { |
| | | MenuID: 'close-circle', |
| | | value: 'close-circle', |
| | | text: 'close-circle' |
| | | }, { |
| | | MenuID: 'delete', |
| | | value: 'delete', |
| | | text: 'delete' |
| | | }] |
| | | |
| | | export const btnClasses = [{ |
| | | MenuID: 'default', |
| | | value: 'default', |
| | | text: '默认(黑边白底)' |
| | | }, { |
| | | MenuID: 'primary', |
| | | value: 'primary', |
| | | text: '蓝色' |
| | | }, { |
| | | MenuID: 'yellow', |
| | | value: 'yellow', |
| | | text: '黄色' |
| | | }, { |
| | | MenuID: 'danger', |
| | | value: 'danger', |
| | | text: '红色' |
| | | }, { |
| | | MenuID: 'green', |
| | | value: 'green', |
| | | text: '绿色' |
| | | }, { |
| | | MenuID: 'dgreen', |
| | | value: 'dgreen', |
| | | text: '深绿色' |
| | | }, { |
| | | MenuID: 'purple', |
| | | value: 'purple', |
| | | text: '紫色' |
| | | }, { |
| | | MenuID: 'gray', |
| | | value: 'gray', |
| | | text: '灰色' |
| | | }, { |
| | | MenuID: 'dashed', |
| | | value: 'dashed', |
| | | text: '白底虚框' |
| | | }, { |
| | | MenuID: 'border-primary', |
| | | value: 'border-primary', |
| | | text: '白底蓝框' |
| | | }, { |
| | | MenuID: 'border-yellow', |
| | | value: 'border-yellow', |
| | | text: '白底黄框' |
| | | }, { |
| | | MenuID: 'border-danger', |
| | | value: 'border-danger', |
| | | text: '白底红框' |
| | | }, { |
| | | MenuID: 'border-green', |
| | | value: 'border-green', |
| | | text: '白底绿框' |
| | | }, { |
| | | MenuID: 'border-dgreen', |
| | | value: 'border-dgreen', |
| | | text: '白底深绿框' |
| | | }, { |
| | | MenuID: 'border-purple', |
| | | value: 'border-purple', |
| | | text: '白底紫框' |
| | | }] |