2 文件已重命名
23个文件已修改
10个文件已添加
2个文件已删除
New file |
| | |
| | | // 系统菜单 |
| | | export const SySMenuList = { |
| | | systemManageView: [{ |
| | | MenuID: 'systemManageViewConfig', |
| | | text: '配置', |
| | | PageParam: {Icon: 'folder'}, |
| | | children: [{ |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1581067625930haged11ieaivpavv77k', |
| | | MenuNo: 'sDatasM', |
| | | MenuName: '数据字典', |
| | | text: '数据字典' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1581734956310scks442ul2d955g9tu5', |
| | | MenuNo: 'sVersionM', |
| | | MenuName: '传输号管理', |
| | | text: '传输号管理' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1583991994144ndddg0bhh0is6shi0v1', |
| | | MenuNo: 'sVersionQueryM', |
| | | MenuName: '传输号查询', |
| | | text: '传输号查询' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'VerupTable'}, |
| | | type: 'VerupTable', |
| | | MenuID: '1583979633842550imkchl4qt4qppsiv', |
| | | MenuNo: 'sVersionMUpgrade', |
| | | MenuName: '版本升级', |
| | | text: '版本升级' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1578900109100np8aqd0a77q3na46oas', |
| | | MenuNo: 'sPrintTemplateM', |
| | | MenuName: '打印模板', |
| | | text: '打印模板' |
| | | }] |
| | | }, { |
| | | MenuID: 'systemManageViewInterface', |
| | | text: '接口', |
| | | PageParam: {Icon: 'folder'}, |
| | | children: [{ |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1582771068837vsv54a089lgp45migbg', |
| | | MenuNo: 'KUNTitleM', |
| | | MenuName: '接口主数据', |
| | | text: '接口主数据' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1582777675954ifu05upurs465omoth7', |
| | | MenuNo: 'KUNMainM', |
| | | MenuName: '查询接口', |
| | | text: '查询接口' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '158294809668898cklbv6c5bou8e1fpu', |
| | | MenuNo: 'KUNMainMOut_advanced', |
| | | MenuName: '高阶查询', |
| | | text: '高阶查询' |
| | | }] |
| | | }] |
| | | } |
| | |
| | | import {connect} from 'react-redux' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Menu, Icon, notification } from 'antd' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import {modifyTabview, resetEditLevel} from '@/store/action' |
| | | import { SySMenuList } from './config.js' |
| | | import zhCN from '@/locales/zh-CN/header.js' |
| | | import enUS from '@/locales/en-US/header.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import Api from '@/api' |
| | | import './index.scss' |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | enterManageView = () => { |
| | | let menulist = [{ |
| | | MenuID: Utils.getuuid(), |
| | | text: '配置', |
| | | PageParam: {Icon: 'folder'}, |
| | | children: [{ |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1581067625930haged11ieaivpavv77k', |
| | | MenuNo: 'sDatasM', |
| | | MenuName: '数据字典', |
| | | text: '数据字典' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1581734956310scks442ul2d955g9tu5', |
| | | MenuNo: 'sVersionM', |
| | | MenuName: '传输号管理', |
| | | text: '传输号管理' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1583991994144ndddg0bhh0is6shi0v1', |
| | | MenuNo: 'sVersionQueryM', |
| | | MenuName: '传输号查询', |
| | | text: '传输号查询' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1583979633842550imkchl4qt4qppsiv', |
| | | MenuNo: 'sVersionMUpgrade', |
| | | MenuName: '版本升级', |
| | | text: '版本升级' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1578900109100np8aqd0a77q3na46oas', |
| | | MenuNo: 'sPrintTemplateM', |
| | | MenuName: '打印模板', |
| | | text: '打印模板' |
| | | }] |
| | | }, { |
| | | MenuID: Utils.getuuid(), |
| | | text: '接口', |
| | | PageParam: {Icon: 'folder'}, |
| | | children: [{ |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1582771068837vsv54a089lgp45migbg', |
| | | MenuNo: 'KUNTitleM', |
| | | MenuName: '接口主数据', |
| | | text: '接口主数据' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1582777675954ifu05upurs465omoth7', |
| | | MenuNo: 'KUNMainM', |
| | | MenuName: '查询接口', |
| | | text: '查询接口' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '158294809668898cklbv6c5bou8e1fpu', |
| | | MenuNo: 'KUNMainMOut_advanced', |
| | | MenuName: '高阶查询', |
| | | text: '高阶查询' |
| | | }] |
| | | }] |
| | | enterManageView = (type) => { |
| | | let menulist = SySMenuList[type] |
| | | |
| | | this.setState({ |
| | | subMenulist: menulist, |
| | | rootSubmenuKeys: menulist.map(item => item.MenuID), |
| | |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | if (!is(fromJS(this.props.mainMenu), fromJS(nextProps.mainMenu)) && nextProps.mainMenu && nextProps.mainMenu.MenuID === 'systemManageView') { |
| | | this.enterManageView() |
| | | this.enterManageView(nextProps.mainMenu.MenuID) |
| | | } else if (!is(fromJS(this.props.mainMenu), fromJS(nextProps.mainMenu))) { |
| | | // 主菜单切换,请求2、3级菜单数据 |
| | | this.loadsubmenu(nextProps.mainMenu) |
| | |
| | | import {connect} from 'react-redux' |
| | | import { is, fromJS } from 'immutable' |
| | | import {Tabs, Icon, Button, ConfigProvider, message, BackTop} from 'antd' |
| | | import {modifyTabview, toggleIsiframe, refreshTabView} from '@/store/action' |
| | | // import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncComponent from '@/utils/asyncLoadComponent' |
| | | import NotFount from '@/components/404' |
| | | import enUS from 'antd/es/locale/en_US' |
| | | import zhCN from 'antd/es/locale/zh_CN' |
| | | import mzhCN from '@/locales/zh-CN/main.js' |
| | | import menUS from '@/locales/en-US/main.js' |
| | | import moment from 'moment' |
| | | import 'moment/locale/zh-cn' |
| | | |
| | | import {modifyTabview, toggleIsiframe, refreshTabView} from '@/store/action' |
| | | import asyncComponent from '@/utils/asyncLoadComponent' |
| | | import NotFount from '@/components/404' |
| | | import mzhCN from '@/locales/zh-CN/main.js' |
| | | import menUS from '@/locales/en-US/main.js' |
| | | |
| | | import './index.scss' |
| | | |
| | | const Home = asyncComponent(() => import('@/tabviews/home')) |
| | | const CommonTable = asyncComponent(() => import('@/tabviews/commontable')) |
| | | const VerupTable = asyncComponent(() => import('@/tabviews/verup')) |
| | | const ManageTable = asyncComponent(() => import('@/tabviews/managetable')) |
| | | const Iframe = asyncComponent(() => import('@/tabviews/iframe')) |
| | | const DataManage = asyncComponent(() => import('@/tabviews/datamanage')) |
| | | const RoleManage = asyncComponent(() => import('@/tabviews/rolemanage')) |
| | | const TabForm = asyncComponent(() => import('@/tabviews/tabform')) |
| | | const FormTab = asyncComponent(() => import('@/tabviews/formtab')) |
| | | |
| | | let Comps = {} |
| | | let service = window.GLOB.service ? (/\/$/.test(window.GLOB.service) ? window.GLOB.service : window.GLOB.service + '/') : '' |
| | | |
| | | if (process.env.NODE_ENV === 'production') { |
| | |
| | | selectcomponent = (view) => { |
| | | // 根据tab页中菜单信息,选择所需的组件 |
| | | if (view.type === 'Home') { |
| | | return (<Comps.Home MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) |
| | | return (<Home MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) |
| | | } else if (view.type === 'CommonTable') { |
| | | return (<Comps.CommonTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) |
| | | return (<CommonTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) |
| | | } else if (view.type === 'VerupTable') { |
| | | return (<VerupTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) |
| | | } else if (view.type === 'ManageTable') { |
| | | return (<Comps.CommonTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) |
| | | return (<ManageTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) |
| | | } else if (view.type === 'DataManage') { |
| | | return (<Comps.DataManage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) |
| | | return (<DataManage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) |
| | | } else if (view.type === 'RolePermission') { |
| | | return (<Comps.RoleManage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) |
| | | return (<RoleManage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) |
| | | } else if (view.type === 'TabForm') { |
| | | return (<Comps.TabForm MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) |
| | | return (<TabForm MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) |
| | | } else if (view.type === 'FormTab') { |
| | | return (<Comps.FormTab MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) |
| | | return (<FormTab MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) |
| | | } else if (view.type === 'iframe') { |
| | | return (<Comps.Iframe key={view.MenuID} title={view.MenuName} MenuName={view.MenuName} url={service + view.LinkUrl}/>) |
| | | return (<Iframe key={view.MenuID} title={view.MenuName} MenuName={view.MenuName} url={service + view.LinkUrl}/>) |
| | | } else { |
| | | return (<NotFount key={view.MenuID} />) |
| | | } |
| | |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | if (nextProps.tabviews && !is(fromJS(this.state.tabviews), fromJS(nextProps.tabviews))) { |
| | | // tab窗口页增加或删除 |
| | | if (nextProps.tabviews.length > this.state.tabviews.length) { |
| | | // 查看新tab页需要组件是否加载 |
| | | let MenuIDs = this.state.tabviews.map(tab => {return tab.MenuID}) |
| | | let newtab = nextProps.tabviews.filter(tab => !MenuIDs.includes(tab.MenuID))[0] |
| | | if (!Comps.Home && newtab.type === 'Home') { |
| | | Comps.Home = asyncComponent(() => import('@/tabviews/home')) |
| | | } else if (!Comps.CommonTable && newtab.type === 'CommonTable') { |
| | | Comps.CommonTable = asyncComponent(() => import('@/tabviews/commontable')) |
| | | } else if (!Comps.CommonTable && newtab.type === 'ManageTable') { |
| | | Comps.CommonTable = asyncComponent(() => import('@/tabviews/managetable')) |
| | | } else if (!Comps.Iframe && newtab.type === 'iframe') { |
| | | Comps.Iframe = asyncComponent(() => import('@/tabviews/iframe')) |
| | | } else if (!Comps.DataManage && newtab.type === 'DataManage') { |
| | | Comps.DataManage = asyncComponent(() => import('@/tabviews/datamanage')) |
| | | } else if (!Comps.RoleManage && newtab.type === 'RolePermission') { |
| | | Comps.RoleManage = asyncComponent(() => import('@/tabviews/rolemanage')) |
| | | } else if (!Comps.TabForm && newtab.type === 'TabForm') { |
| | | Comps.TabForm = asyncComponent(() => import('@/tabviews/tabform')) |
| | | } else if (!Comps.FormTab && newtab.type === 'FormTab') { |
| | | Comps.FormTab = asyncComponent(() => import('@/tabviews/formtab')) |
| | | } |
| | | } |
| | | |
| | | // 保存修改标签集 |
| | | this.setState({ |
| | | tabviews: nextProps.tabviews |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | // shouldComponentUpdate(nextProps, nextState) { |
| | | // return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | // } |
| | | |
| | | render () { |
| | | const { tabviews } = this.state |
| | |
| | | } |
| | | .main-copy { |
| | | position: fixed; |
| | | z-index: 2; |
| | | z-index: 20; |
| | | bottom: 65px; |
| | | right: 30px; |
| | | width: 40px; |
| | |
| | | import asyncLoadComponent from '@/utils/asyncLoadComponent' |
| | | import {refreshTabView, modifyTabview} from '@/store/action' |
| | | |
| | | import MainTable from './mainTable' |
| | | import MainTable from '@/tabviews/tableshare/normalTable' |
| | | import MainAction from '@/tabviews/tableshare/actionList' |
| | | import VerifyCard from '@/tabviews/tableshare/verifycard' |
| | | import MainSearch from '@/tabviews/tableshare/topSearch' |
| | |
| | | |
| | | let istrigger = false |
| | | actions.forEach(item => { |
| | | if (!item.shortcut || typeof(item.shortcut) !== 'object' || istrigger) return |
| | | if (!item.shortcut || typeof(item.shortcut) !== 'object' || item.shortcut.length === 0 || istrigger) return |
| | | |
| | | if (preKey === item.shortcut[0] && keyCode === item.shortcut[1]) { |
| | | e.preventDefault() |
| | |
| | | } |
| | | <MainTable |
| | | ref="mainTable" |
| | | tableId="mainTable" |
| | | pickup={pickup} |
| | | setting={setting} |
| | | columns={columns} |
| | |
| | | import asyncLoadComponent from '@/utils/asyncLoadComponent' |
| | | import {refreshTabView, modifyTabview} from '@/store/action' |
| | | |
| | | import MainTable from '@/tabviews/commontable/mainTable' |
| | | import MainTable from '@/tabviews/tableshare/normalTable' |
| | | import MainAction from '@/tabviews/tableshare/actionList' |
| | | import MainSearch from '@/tabviews/tableshare/topSearch' |
| | | import NotFount from '@/components/404' |
| | | import './index.scss' |
| | | |
| | | const MainAction = asyncComponent(() => import('@/tabviews/tableshare/actionList')) |
| | | const SubTable = asyncLoadComponent(() => import('@/tabviews/subtable')) |
| | | const SubTabTable = asyncComponent(() => import('@/tabviews/subtabtable')) |
| | | const FormTab = asyncComponent(() => import('@/tabviews/formtab')) |
| | |
| | | orderBy: '', // 排序 |
| | | search: '', // 搜索条件数组,使用时需分场景处理 |
| | | BIDs: {}, // 上级表id |
| | | setsingle: false, // 主表单选多选切换 |
| | | pickup: false, // 主表数据隐藏显示切换 |
| | | isLinkMain: false, // 是否存在与主表关联的子表 |
| | | popAction: false, // 弹框页面,按钮信息 |
| | | popData: false, // 弹框页面,所选的表格数据 |
| | | visible: false, // 弹框显示隐藏控制 |
| | |
| | | }) |
| | | } |
| | | |
| | | |
| | | 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) // 搜索条件初始化(含有时间格式,需要转化) |
| | | }, () => { |
| | |
| | | orderBy: '', |
| | | search: '', |
| | | BIDs: {}, |
| | | setsingle: false, |
| | | pickup: false, |
| | | isLinkMain: false |
| | | pickup: false |
| | | }, () => { |
| | | this.loadconfig() |
| | | }) |
| | |
| | | [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 |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | 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 |
| | |
| | | } |
| | | {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} |
| | |
| | | import Utils from '@/utils/utils.js' |
| | | import options from '@/store/options.js' |
| | | |
| | | import SubTable from './subTable' |
| | | import SubTable from '@/tabviews/tableshare/normalTable' |
| | | import SubAction from '@/tabviews/tableshare/actionList' |
| | | import SubSearch from '@/tabviews/tableshare/topSearch' |
| | | import asyncLoadComponent from '@/utils/asyncLoadComponent' |
| | | // import asyncComponent from '@/utils/asyncComponent' |
| | | import NotFount from '@/components/404' |
| | | |
| | | import './index.scss' |
| | | |
| | | const SubTabTable = asyncLoadComponent(() => import('@/tabviews/subtabtable')) |
| | | // const SubAction = asyncComponent(() => import('@/tabviews/tableshare/actionList')) |
| | | |
| | | class SubTabViewTable extends Component { |
| | | static propTpyes = { |
| | |
| | | /** |
| | | * @description 表格Id变化 |
| | | */ |
| | | handleTableId = (id = '', data = '') => { |
| | | this.props.handleTableId(this.props.Tab.uuid, id, data) |
| | | handleTableId = (type = this.props.Tab.uuid, id = '', data = '') => { |
| | | this.props.handleTableId(type, id, data) |
| | | } |
| | | |
| | | /** |
| | |
| | | /> : null |
| | | } |
| | | {actions ? |
| | | <div style={{minHeight: '25px'}}> |
| | | <div className="sub-action"> |
| | | <SubAction |
| | | ref="subButton" |
| | | type="sub" |
| | |
| | | } |
| | | <SubTable |
| | | ref="subTable" |
| | | tableId={this.props.Tab.uuid} |
| | | pickup={pickup} |
| | | setting={setting} |
| | | columns={columns} |
| | |
| | | .subtable { |
| | | position: relative; |
| | | min-height: 200px; |
| | | padding-top: 16px; |
| | | |
| | | > .top-search { |
| | | padding: 0 0px 20px; |
| | | } |
| | | > .button-list { |
| | | padding: 10px 0px 5px; |
| | | >.sub-action { |
| | | min-height: 25px; |
| | | .button-list { |
| | | padding: 10px 0px 5px; |
| | | } |
| | | } |
| | | .normal-data-table { |
| | | padding: 0px; |
| | | } |
| | | .box404 { |
| | | padding-top: 30px; |
| | |
| | | import Utils from '@/utils/utils.js' |
| | | import options from '@/store/options.js' |
| | | |
| | | // import asyncComponent from '@/utils/asyncComponent' |
| | | import SubTable from '@/tabviews/subtable/subTable' |
| | | import SubTable from '@/tabviews/tableshare/normalTable' |
| | | import SubAction from '@/tabviews/tableshare/actionList' |
| | | import SubSearch from '@/tabviews/tableshare/topSearch' |
| | | import NotFount from '@/components/404' |
| | | |
| | | import './index.scss' |
| | | |
| | | // const SubAction = asyncComponent(() => import('@/tabviews/tableshare/actionList')) |
| | | |
| | | class SubTabModalTable extends Component { |
| | | static propTpyes = { |
| | |
| | | this.refs.subtabButton.actionTrigger(btn, record) |
| | | } |
| | | |
| | | /** |
| | | * @description 表格Id变化 |
| | | */ |
| | | handleTableId = () => {} |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | // 组件加载时,获取菜单数据 |
| | | this.loadconfig() |
| | |
| | | {columns && |
| | | <SubTable |
| | | ref="subTable" |
| | | tableId="" |
| | | dict={this.state.dict} |
| | | MenuID={this.props.MenuID} |
| | | setting={setting} |
| | |
| | | logcolumns={this.state.logcolumns} |
| | | refreshdata={this.refreshbytable} |
| | | buttonTrigger={this.buttonTrigger} |
| | | handleTableId={this.handleTableId} |
| | | handleTableId={() => {}} |
| | | /> |
| | | } |
| | | {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} |
| | |
| | | */ |
| | | printOuterLoopRequest = (params, btn, _list, _resolve) => { |
| | | let param = params.shift() |
| | | let _outParam = null |
| | | |
| | | new Promise(resolve => { |
| | | // 内部请求 |
| | |
| | | }).then(res => { |
| | | if (!res) return |
| | | // 外部请求 |
| | | _outParam = JSON.parse(JSON.stringify(res)) |
| | | |
| | | if (this.props.menuType === 'HS') { |
| | | if (btn.sysInterface === 'true' && options.cloudServiceApi) { |
| | |
| | | res.func = btn.outerFunc |
| | | } |
| | | |
| | | res.appkey = window.GLOB.appkey || '' // 外部请求时,统一添加appkey |
| | | |
| | | return Api.genericInterface(res) |
| | | }).then(response => { |
| | | if (!response) return |
| | | |
| | | if (btn.callbackFunc) { |
| | | // 存在回调函数时,调用 |
| | | delete response.message |
| | | delete response.status |
| | | |
| | | response.func = btn.callbackFunc |
| | | |
| | | let _callbackparam = {..._outParam, ...response} |
| | | |
| | | return Api.genericInterface(_callbackparam) |
| | | } else if (response.status) { |
| | | response.data.forEach(_item => { |
| | | _list.push({data: _item, count: response.printCount}) |
| | | }) |
| | | |
| | | // 一次请求成功,进行下一项请求 |
| | | if (params.length === 0) { |
| | | _resolve({next: 'getTemp', list: _list}) |
| | | } else { |
| | | this.printOuterLoopRequest(params, btn, _list, _resolve) |
| | | } |
| | | } else { |
| | | this.execError(response, btn) |
| | | _resolve({next: false, list: _list}) |
| | | } |
| | | }).then(response => { |
| | | if (!response) return |
| | | |
| | | if (response.status) { |
| | | response.data.forEach(_item => { |
| | | _list.push({data: _item, count: response.printCount}) |
| | |
| | | let readin = {} |
| | | let fieldlen = {} |
| | | let formlist = [] |
| | | |
| | | if (action.groups.length > 0) { |
| | | action.groups.forEach(group => { |
| | | if (group.sublist.length === 0) return |
File was renamed from src/tabviews/commontable/mainTable/index.jsx |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | // import { is, fromJS } from 'immutable' |
| | | import { Table, message, Affix, Button, Typography } from 'antd' |
| | | import './index.scss' |
| | | |
| | |
| | | |
| | | export default class MainTable extends Component { |
| | | static propTpyes = { |
| | | tableId: PropTypes.string, // 列表Id |
| | | dict: PropTypes.object, // 字典项 |
| | | MenuID: PropTypes.string, // 菜单Id |
| | | setting: PropTypes.object, // 表格全局设置:tableType(表格是否可选、单选、多选)、columnfixed(列固定)、actionfixed(按钮固定) |
| | |
| | | |
| | | changedata = (index) => { |
| | | const { data, setting } = this.props |
| | | |
| | | if (!this.props.tableId) return |
| | | |
| | | let _id = '' |
| | | let _data = '' |
| | | |
| | |
| | | _data = data[index] || '' |
| | | } |
| | | |
| | | this.props.handleTableId('mainTable', _id, _data) |
| | | this.props.handleTableId(this.props.tableId, _id, _data) |
| | | } |
| | | |
| | | resetTable = () => { |
| | |
| | | const { setting, pickup } = this.props |
| | | let { selectedRowKeys } = this.state |
| | | |
| | | // 设置表格选择属性:单选、多选、不可选 |
| | | let rowSelection = null |
| | | if (setting.tableType) { |
| | | rowSelection = { |
| | |
| | | onChange: this.onSelectChange |
| | | } |
| | | } |
| | | |
| | | // 表格头部固定于顶部时,判断距顶部高度 |
| | | let offset = null |
| | | if (setting.columnfixed) { |
| | | // 表格头部固定于顶部时,判断距顶部高度 |
| | | if (this.props.tableId === 'mainTable' && setting.columnfixed) { |
| | | if (!setting.actionfixed) { |
| | | offset = 48 |
| | | } else { |
| | |
| | | } |
| | | } |
| | | |
| | | // 数据收起时,过滤已选数据 |
| | | let _data = this.props.data ? this.props.data : [] |
| | | |
| | | if (pickup) { |
| | |
| | | } |
| | | |
| | | return ( |
| | | <div className="main-table"> |
| | | {setting.columnfixed && <Affix offsetTop={offset} className="fix-header"> |
| | | <div className="normal-data-table"> |
| | | {offset && <Affix offsetTop={offset} className="fix-header"> |
| | | <Table |
| | | size="middle" |
| | | bordered={true} |
File was renamed from src/tabviews/commontable/mainTable/index.scss |
| | |
| | | .main-table { |
| | | .normal-data-table { |
| | | padding: 0 20px 30px; |
| | | table { |
| | | max-width: 100%; |
| | |
| | | min-width: 60px; |
| | | max-width: 60px; |
| | | } |
| | | // .ant-table-tbody > tr td:not(.ant-table-selection-column) { |
| | | // padding: 0!important; |
| | | // } |
| | | // .ant-table-tbody > tr td .content { |
| | | // padding: 12px 8px; |
| | | // height: 100%; |
| | | // background: lightblue; |
| | | // } |
| | | .ant-table-tbody > tr.ant-table-row-selected td { |
| | | background-color: #c4ebfd; |
| | | } |
| | |
| | | .ant-affix .ant-table-wrapper { |
| | | display: block; |
| | | } |
| | | // .ant-table-column-sorter, .anticon-filter { |
| | | // display: none; |
| | | // } |
| | | } |
| | | } |
| | |
| | | dataIndex: 'shortcut', |
| | | width: '25%', |
| | | render: (text, record) => { |
| | | if (!record.shortcut || typeof(record.shortcut) !== 'object') return '' |
| | | if (!record.shortcut || typeof(record.shortcut) !== 'object' || record.shortcut.length === 0) return '' |
| | | let _text = keycode[record.shortcut[1]] |
| | | |
| | | return record.shortcut[0] + ' + ' + _text |
| | |
| | | let node = document.getElementById('verify-card-box-tab').parentNode |
| | | |
| | | if (node && node.scrollTop) { |
| | | node.scrollTop = 0 |
| | | let inter = Math.ceil(node.scrollTop / 10) |
| | | |
| | | let timer = setInterval(() => { |
| | | if (node.scrollTop - inter > 0) { |
| | | node.scrollTop = node.scrollTop - inter |
| | | } else { |
| | | node.scrollTop = 0 |
| | | clearInterval(timer) |
| | | } |
| | | }, 10) |
| | | } |
| | | } |
| | | |
| | |
| | | padding-top: 0px; |
| | | } |
| | | .ant-input-disabled { |
| | | color: rgba(0, 0, 0, 0.75); |
| | | color: rgba(0, 0, 0, 0.65); |
| | | cursor: default; |
| | | } |
| | | } |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import moment from 'moment' |
| | | import { Button, Modal, notification, message } from 'antd' |
| | | import MutilForm from '@/tabviews/tableshare/mutilform' |
| | | import Utils from '@/utils/utils.js' |
| | | import options from '@/store/options.js' |
| | | import Api from '@/api' |
| | | import './index.scss' |
| | | |
| | | const { confirm } = Modal |
| | | |
| | | class MainAction extends Component { |
| | | static propTpyes = { |
| | | BID: PropTypes.string, // 主表ID |
| | | BData: PropTypes.any, // 主表数据 |
| | | Tab: PropTypes.any, // 如果当前元素为标签时,tab为标签信息 |
| | | type: PropTypes.string, // 判断当前为主表(main)、子表(sub)、子表标签(subtab) |
| | | MenuID: PropTypes.string, // 菜单ID |
| | | actions: PropTypes.array, // 按钮组 |
| | | logcolumns: PropTypes.array, // 显示列 |
| | | dict: PropTypes.object, // 字典项 |
| | | setting: PropTypes.any, // 页面通用设置 |
| | | ContainerId: PropTypes.any, // tab页面ID,用于弹窗控制 |
| | | refreshdata: PropTypes.func, // 执行完成后数据刷新 |
| | | gettableselected: PropTypes.func // 获取表格中数据 |
| | | } |
| | | |
| | | state = { |
| | | visible: false, |
| | | formdata: null, |
| | | tabledata: null, |
| | | confirmLoading: false, |
| | | execAction: null, |
| | | loadingUuid: '', |
| | | configMap: {} |
| | | } |
| | | |
| | | refreshdata = (item, type) => { |
| | | this.props.refreshdata(item, type) |
| | | } |
| | | |
| | | /** |
| | | * @description 触发按钮操作 |
| | | */ |
| | | actionTrigger = (item, record) => { |
| | | const { setting, type, Tab, BID } = this.props |
| | | |
| | | if (type === 'sub' && Tab && Tab.supMenu && !BID) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '需要上级主键值!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let _this = this |
| | | let data = this.props.gettableselected() || [] |
| | | |
| | | if (record) { // 表格中触发按钮 |
| | | data = [record] |
| | | } |
| | | |
| | | if (item.Ot !== 'notRequired' && data.length === 0) { |
| | | // 需要选择行时,校验数据 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.props.dict['main.action.confirm.selectline'], |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } else if (item.Ot === 'requiredSgl' && data.length !== 1) { |
| | | // 需要选择单行时,校验数据 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.props.dict['main.action.confirm.selectSingleLine'], |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } else if (item.Ot !== 'notRequired' && !setting.primaryKey) { |
| | | // 需要选择行时,校验是否设置主键 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未设置主键!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | if (item.OpenType === 'prompt') { |
| | | confirm({ |
| | | title: this.props.dict['main.action.confirm.tip'], |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.execSubmit(item, data, resolve) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else if (item.OpenType === 'exec') { |
| | | this.setState({loadingUuid: item.uuid}) |
| | | this.execSubmit(item, data, () => { |
| | | this.setState({loadingUuid: ''}) |
| | | }) |
| | | } else if (item.OpenType === 'pop') { |
| | | if (item.setting.display === 'prompt') { // 如果表单以是否框展示,不请求下拉菜单信息 |
| | | this.setState({ |
| | | execAction: item, |
| | | tabledata: data |
| | | }, () => { |
| | | this.modelconfirm() |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | visible: true, |
| | | execAction: item, |
| | | tabledata: data |
| | | }) |
| | | } |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '尚不支持此功能。。。', |
| | | duration: 10 |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮提交执行 |
| | | */ |
| | | execSubmit = (btn, data, _resolve, formdata) => { |
| | | const { setting, logcolumns } = this.props |
| | | |
| | | if (btn.intertype === 'inner') { |
| | | // 执行方式为多行拼接,且打开方式为表单时,会转为循环发送请求 |
| | | // 打开方式为模态框,使用内部函数添加(有批量添加场景,已去除) |
| | | if ( |
| | | btn.Ot === 'notRequired' || |
| | | btn.Ot === 'requiredSgl' || |
| | | (btn.Ot === 'requiredOnce' && btn.OpenType !== 'pop') |
| | | ) { |
| | | |
| | | let param = { // 系统存储过程 |
| | | func: 'sPC_TableData_InUpDe', |
| | | BID: this.props.BID |
| | | } |
| | | let primaryId = setting.primaryKey && data[0] ? (data[0][setting.primaryKey] || '') : '' |
| | | |
| | | if (btn.OpenType === 'prompt' || btn.OpenType === 'exec') { // 是否弹框或直接执行 |
| | | let ID = '' |
| | | if (btn.Ot === 'notRequired') { |
| | | |
| | | } else if (btn.Ot === 'requiredSgl') { |
| | | ID = data[0][setting.primaryKey] |
| | | } else if (btn.Ot === 'requiredOnce') { // id值拼接 |
| | | let ids = data.map(d => { return d[setting.primaryKey]}) |
| | | ID = ids.join(',') |
| | | } |
| | | |
| | | if (btn.innerFunc) { // 使用自定义函数 |
| | | param.func = btn.innerFunc |
| | | if (setting.primaryKey) { // 主键存在时,设置主键参数 |
| | | param[setting.primaryKey] = ID |
| | | } |
| | | } else if (btn.sql) { |
| | | param.ID = primaryId |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, '', param, data[0], logcolumns)) // 数据源 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | } |
| | | } else if (btn.OpenType === 'pop') { // 表单 |
| | | if (btn.innerFunc) { |
| | | param.func = btn.innerFunc |
| | | |
| | | if (setting.primaryKey) { // 主键存在时,设置主键参数 |
| | | param[setting.primaryKey] = primaryId |
| | | } |
| | | |
| | | formdata.forEach(_data => { |
| | | param[_data.key] = _data.value |
| | | }) |
| | | |
| | | } else if (btn.sql && btn.sqlType === 'insert') { // 系统函数添加时,生成uuid |
| | | primaryId = '' |
| | | if (formdata && setting.primaryKey) { // 表单中存在主键字段,主键值以表单中的值为准 |
| | | let _form = formdata.filter(_form => _form.key === setting.primaryKey)[0] |
| | | if (_form) { |
| | | primaryId = _form.value |
| | | } |
| | | } |
| | | param.ID = primaryId || Utils.getguid() |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, data[0], logcolumns)) // 数据源 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | } else if (btn.sql) { |
| | | param.ID = primaryId |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, data[0], logcolumns)) // 数据源 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | } |
| | | } |
| | | |
| | | Api.genericInterface(param).then((res) => { |
| | | if (res.status) { |
| | | this.execSuccess(btn, res) |
| | | } else { |
| | | this.execError(res, btn) |
| | | } |
| | | _resolve() |
| | | }) |
| | | } else if (btn.Ot === 'required' || (btn.Ot === 'requiredOnce' && btn.OpenType === 'pop')) { |
| | | let _formPrimaryId = '' |
| | | if (formdata && setting.primaryKey) { // 表单中存在主键字段,主键值以表单中的值为准 |
| | | let _form = formdata.filter(_form => _form.key === setting.primaryKey)[0] |
| | | if (_form) { |
| | | _formPrimaryId = _form.value |
| | | } |
| | | } |
| | | |
| | | let _params = data.map((cell, index) => { |
| | | let param = { |
| | | func: 'sPC_TableData_InUpDe', |
| | | BID: this.props.BID |
| | | } |
| | | let primaryId = setting.primaryKey ? cell[setting.primaryKey] : '' |
| | | |
| | | if (btn.OpenType === 'prompt' || btn.OpenType === 'exec') { // 是否弹框或直接执行 |
| | | |
| | | if (btn.innerFunc) { |
| | | param.func = btn.innerFunc |
| | | if (setting.primaryKey) { |
| | | param[setting.primaryKey] = primaryId |
| | | } |
| | | } else if (btn.sql) { |
| | | param.ID = primaryId |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, '', param, cell, logcolumns)) // 数据源 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | } |
| | | } else if (btn.OpenType === 'pop') { // 表单 |
| | | if (btn.innerFunc) { |
| | | param.func = btn.innerFunc |
| | | |
| | | formdata.forEach(_data => { |
| | | if (index !== 0 && _data.readin && cell.hasOwnProperty(_data.key)) { |
| | | param[_data.key] = cell[_data.key] |
| | | } else { |
| | | param[_data.key] = _data.value |
| | | } |
| | | }) |
| | | |
| | | if (setting.primaryKey) { |
| | | param[setting.primaryKey] = primaryId |
| | | } |
| | | } else if (btn.sql && btn.sqlType === 'insert') { // 系统函数添加时,生成uuid |
| | | param.ID = _formPrimaryId || Utils.getguid() |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, cell, logcolumns)) // 数据源 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | } else if (btn.sql) { |
| | | if (index !== 0) { |
| | | formdata = formdata.map(_data => { |
| | | if (_data.readin && cell.hasOwnProperty(_data.key)) { |
| | | _data.value = cell[_data.key] |
| | | } |
| | | return _data |
| | | }) |
| | | } |
| | | |
| | | param.ID = primaryId |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, cell, logcolumns)) // 数据源 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | } |
| | | } |
| | | |
| | | return param |
| | | }) |
| | | |
| | | if (_params.length <= 20) { |
| | | let deffers = _params.map(param => { |
| | | return new Promise(resolve => { |
| | | Api.genericInterface(param).then(res => { |
| | | resolve(res) |
| | | }) |
| | | }) |
| | | }) |
| | | Promise.all(deffers).then(result => { |
| | | let iserror = false |
| | | let errorMsg = '' |
| | | result.forEach(res => { |
| | | if (res.status) { |
| | | errorMsg = res |
| | | } else { |
| | | iserror = true |
| | | errorMsg = res |
| | | } |
| | | }) |
| | | if (!iserror) { |
| | | this.execSuccess(btn, errorMsg) |
| | | } else { |
| | | this.execError(errorMsg, btn) |
| | | } |
| | | _resolve() |
| | | }) |
| | | } else { // 超出20个请求时循环执行 |
| | | this.innerLoopRequest(_params, btn, _resolve) |
| | | } |
| | | } |
| | | } else if (btn.intertype === 'outer') { |
| | | /** *********************调用外部接口************************* */ |
| | | |
| | | let _params = [] // 请求参数数组 |
| | | |
| | | if (btn.Ot === 'notRequired' || btn.Ot === 'requiredSgl' || btn.Ot === 'requiredOnce') { |
| | | let param = { |
| | | BID: this.props.BID |
| | | } |
| | | |
| | | if (btn.OpenType === 'pop' && formdata) { // 表单 |
| | | formdata.forEach(_data => { |
| | | param[_data.key] = _data.value |
| | | }) |
| | | } |
| | | |
| | | // 获取id |
| | | if (btn.Ot === 'notRequired') { |
| | | |
| | | } else if (btn.Ot === 'requiredSgl' && setting.primaryKey) { |
| | | param[setting.primaryKey] = data[0][setting.primaryKey] |
| | | } else if (btn.Ot === 'requiredOnce' && setting.primaryKey) { |
| | | let ids = data.map(d => { return d[setting.primaryKey]}) |
| | | param[setting.primaryKey] = ids.join(',') |
| | | } |
| | | |
| | | _params.push(param) |
| | | } else if (btn.Ot === 'required') { |
| | | // 选择多行,循环调用 |
| | | _params = data.map((cell, index) => { |
| | | let _cell = { |
| | | BID: this.props.BID, |
| | | } |
| | | |
| | | let _formparam = {} |
| | | if (btn.OpenType === 'pop' && formdata) { // 表单 |
| | | formdata.forEach(_data => { |
| | | if (index !== 0 && _data.readin && cell.hasOwnProperty(_data.key)) { |
| | | _formparam[_data.key] = cell[_data.key] |
| | | } else { |
| | | _formparam[_data.key] = _data.value |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (setting.primaryKey) { |
| | | _cell[setting.primaryKey] = cell[setting.primaryKey] |
| | | } |
| | | |
| | | _cell = {..._formparam, ..._cell} |
| | | |
| | | return _cell |
| | | }) |
| | | } |
| | | |
| | | // 循环调用外部接口(包括内部及回调函数) |
| | | this.outerLoopRequest(_params, btn, _resolve) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 内部请求循环执行 |
| | | */ |
| | | innerLoopRequest = (params, btn, _resolve) => { |
| | | if (!params && params.length === 0) return |
| | | |
| | | let param = params.shift() |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | if (params.length === 0) { |
| | | this.execSuccess(btn, res) |
| | | _resolve() |
| | | } else { |
| | | this.innerLoopRequest(params, btn, _resolve) |
| | | } |
| | | } else { |
| | | this.execError(res, btn) |
| | | _resolve() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 外部请求循环执行 |
| | | */ |
| | | outerLoopRequest = (params, btn, _resolve) => { |
| | | if (!params && params.length === 0) return |
| | | |
| | | let param = params.shift() |
| | | let _outParam = null |
| | | let _localParam = null |
| | | |
| | | new Promise(resolve => { |
| | | // 内部请求 |
| | | if (btn.innerFunc) { |
| | | param.func = btn.innerFunc |
| | | // 存在内部函数时,数据预处理 |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | delete res.ErrCode |
| | | delete res.ErrMesg |
| | | delete res.message |
| | | delete res.status |
| | | |
| | | // 使用处理后的数据调用外部接口 |
| | | let keys = Object.keys(res) // 提交外部接口前,添加BID |
| | | if (keys.filter(key => key.toLowerCase() === 'bid').length === 0) { |
| | | res.BID = this.props.BID |
| | | } |
| | | |
| | | resolve(res) |
| | | } else { |
| | | this.execError(res, btn) |
| | | resolve(false) |
| | | _resolve() |
| | | } |
| | | }) |
| | | } else { |
| | | resolve(param) |
| | | } |
| | | }).then(res => { |
| | | if (!res) return |
| | | // 外部请求 |
| | | _outParam = JSON.parse(JSON.stringify(res)) |
| | | |
| | | if (btn.sysInterface === 'true' && options.cloudServiceApi) { |
| | | res.rduri = options.cloudServiceApi |
| | | } else if (btn.sysInterface !== 'true') { |
| | | res.rduri = btn.interface |
| | | } |
| | | |
| | | if (btn.outerFunc) { |
| | | res.func = btn.outerFunc |
| | | } |
| | | |
| | | res.appkey = window.GLOB.appkey || '' // 外部请求时,统一添加appkey |
| | | |
| | | return Api.genericInterface(res) |
| | | }).then(response => { |
| | | if (!response) return |
| | | // 回调请求 |
| | | if (btn.callbackFunc) { |
| | | // 存在回调函数时,调用 |
| | | delete response.message |
| | | delete response.status |
| | | |
| | | response.func = btn.callbackFunc |
| | | |
| | | if (response.UpType === 'SSO' && window.GLOB.mainSystemApi) { |
| | | _localParam = {..._outParam, ...response} |
| | | |
| | | response.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | delete response.UpType |
| | | |
| | | |
| | | let _callbackparam = {..._outParam, ...response} |
| | | return Api.genericInterface(_callbackparam) |
| | | } else { |
| | | if (response.status) { |
| | | // 一次请求成功,进行下一项请求 |
| | | |
| | | if (params.length === 0) { |
| | | this.execSuccess(btn, response) |
| | | _resolve() |
| | | } else { |
| | | this.outerLoopRequest(params, btn, _resolve) |
| | | } |
| | | } else { |
| | | this.execError(response, btn) |
| | | _resolve() |
| | | } |
| | | } |
| | | }).then(res => { |
| | | if (!res) return |
| | | |
| | | if (_localParam) { |
| | | |
| | | return Api.genericInterface(_localParam) |
| | | } else if (res.status) { |
| | | if (params.length === 0) { |
| | | this.execSuccess(btn, res) |
| | | _resolve() |
| | | } else { |
| | | this.outerLoopRequest(params, btn, _resolve) |
| | | } |
| | | } else { |
| | | this.execError(res, btn) |
| | | _resolve() |
| | | } |
| | | }).then(res => { |
| | | if (!res) return |
| | | |
| | | if (res.status) { |
| | | if (params.length === 0) { |
| | | this.execSuccess(btn, res) |
| | | _resolve() |
| | | } else { |
| | | this.outerLoopRequest(params, btn, _resolve) |
| | | } |
| | | } else { |
| | | this.execError(res, btn) |
| | | _resolve() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 操作成功后处理 |
| | | * 1、excel导出,成功后取消导出按钮加载中状态 |
| | | * 2、状态码为 S 时,显示成功信息后系统默认信息 |
| | | * 3、状态码为 -1 时,不显示任何信息 |
| | | * 4、模态框执行成功后是否关闭 |
| | | * 5、通知主列表刷新 |
| | | */ |
| | | execSuccess = (btn, res) => { |
| | | if (res && res.ErrCode === 'S') { // 执行成功 |
| | | notification.success({ |
| | | top: 92, |
| | | message: res.ErrMesg || this.props.dict['main.action.confirm.success'], |
| | | duration: btn.verify && btn.verify.stime ? btn.verify.stime : 2 |
| | | }) |
| | | } else if (res && res.ErrCode === 'Y') { // 执行成功 |
| | | Modal.success({ |
| | | title: res.ErrMesg || this.props.dict['main.action.confirm.success'] |
| | | }) |
| | | } else if (res && res.ErrCode === '-1') { // 完成后不提示 |
| | | |
| | | } |
| | | |
| | | if (btn.OpenType === 'pop' && btn.setting && btn.setting.finish !== 'unclose') { |
| | | this.setState({ |
| | | visible: false |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | loadingUuid: '' |
| | | }) |
| | | |
| | | this.refreshdata(btn, 'success') |
| | | } |
| | | |
| | | /** |
| | | * @description 操作失败后处理 |
| | | * 1、状态码为 E、N、F、NM 时,显示相应提示信息 |
| | | * 2、excel导出,失败后取消导出按钮加载中状态 |
| | | * 3、通知主列表刷新 |
| | | */ |
| | | execError = (res, btn) => { |
| | | if (res.ErrCode === 'E') { |
| | | Modal.error({ |
| | | title: res.message || res.ErrMesg, |
| | | }) |
| | | } else if (res.ErrCode === 'N') { |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message || res.ErrMesg, |
| | | duration: btn.verify && btn.verify.ntime ? btn.verify.ntime : 15 |
| | | }) |
| | | } else if (res.ErrCode === 'F') { |
| | | notification.error({ |
| | | className: 'notification-custom-error', |
| | | top: 92, |
| | | message: res.message || res.ErrMesg, |
| | | duration: btn.verify && btn.verify.ftime ? btn.verify.ftime : 15 |
| | | }) |
| | | } else if (res.ErrCode === 'NM') { |
| | | message.error(res.message || res.ErrMesg) |
| | | } |
| | | |
| | | this.setState({ |
| | | loadingUuid: '' |
| | | }) |
| | | |
| | | this.refreshdata(btn, 'error') |
| | | } |
| | | |
| | | modelconfirm = () => { |
| | | const { BData } = this.props |
| | | const { execAction, tabledata } = this.state |
| | | let _this = this |
| | | let _fields = [] |
| | | |
| | | if (execAction.groups.length > 0) { |
| | | execAction.groups.forEach(group => { |
| | | _fields = [..._fields, ...group.sublist] |
| | | }) |
| | | } else { |
| | | _fields = execAction.fields |
| | | } |
| | | |
| | | let result = _fields.map(item => { |
| | | let _readin = item.readin !== 'false' |
| | | let _initval = item.initval |
| | | |
| | | if (item.type === 'linkMain' || item.type === 'funcvar') { |
| | | _readin = false |
| | | } |
| | | |
| | | if (item.type === 'linkMain' && BData && BData.hasOwnProperty(item.field)) { |
| | | _initval = BData[item.field] |
| | | } else if (_readin && tabledata[0] && tabledata[0].hasOwnProperty(item.field)) { |
| | | _initval = tabledata[0][item.field] |
| | | } |
| | | |
| | | let _fieldlen = item.fieldlength || 50 |
| | | if (item.type === 'textarea' || item.type === 'fileupload') { |
| | | _fieldlen = item.fieldlength || 512 |
| | | } else if (item.type === 'number') { |
| | | _fieldlen = item.decimal ? item.decimal : 0 |
| | | } |
| | | |
| | | return { |
| | | key: item.field, |
| | | readonly: item.readonly === 'true', |
| | | readin: _readin, |
| | | fieldlen: _fieldlen, |
| | | type: item.type, |
| | | value: _initval |
| | | } |
| | | }) |
| | | |
| | | confirm({ |
| | | title: this.props.dict['main.action.confirm.tip'], |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.execSubmit(execAction, tabledata, resolve, result) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 模态框(表单),确认 |
| | | */ |
| | | handleOk = () => { |
| | | this.formRef.handleConfirm().then(res => { |
| | | this.setState({ |
| | | confirmLoading: true |
| | | }) |
| | | |
| | | this.execSubmit(this.state.execAction, this.state.tabledata, () => { |
| | | this.setState({ |
| | | confirmLoading: false |
| | | }) |
| | | }, res) |
| | | }, () => {}) |
| | | } |
| | | |
| | | /** |
| | | * @description 模态框(表单),取消 |
| | | */ |
| | | handleCancel = () => { |
| | | this.setState({ |
| | | visible: false |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 显示模态框 |
| | | */ |
| | | getModels = () => { |
| | | const { execAction } = this.state |
| | | |
| | | if (!execAction || !this.state.visible) return |
| | | |
| | | let title = '' |
| | | let width = '62vw' |
| | | let clickouter = false |
| | | let container = document.body |
| | | |
| | | if (execAction && execAction.setting) { |
| | | title = execAction.setting.title |
| | | width = execAction.setting.width + 'vw' |
| | | |
| | | if (execAction.setting.container === 'tab' && this.props.ContainerId) { |
| | | width = execAction.setting.width + '%' |
| | | container = () => document.getElementById(this.props.ContainerId) |
| | | } |
| | | |
| | | if (execAction.setting.clickouter === 'close') { |
| | | clickouter = true |
| | | } |
| | | } |
| | | |
| | | if (this.props.type === 'subtab') { |
| | | container = document.body |
| | | } |
| | | |
| | | return ( |
| | | <Modal |
| | | title={title} |
| | | maskClosable={clickouter} |
| | | getContainer={container} |
| | | wrapClassName='action-modal' |
| | | visible={this.state.visible} |
| | | width={width} |
| | | onOk={this.handleOk} |
| | | confirmLoading={this.state.confirmLoading} |
| | | onCancel={this.handleCancel} |
| | | destroyOnClose |
| | | > |
| | | <MutilForm |
| | | dict={this.props.dict} |
| | | action={execAction} |
| | | inputSubmit={this.handleOk} |
| | | configMap={this.state.configMap} |
| | | data={this.state.tabledata[0]} |
| | | BData={this.props.BData} |
| | | wrappedComponentRef={(inst) => this.formRef = inst} |
| | | /> |
| | | </Modal> |
| | | ) |
| | | } |
| | | |
| | | render() { |
| | | const { loadingUuid } = this.state |
| | | |
| | | return ( |
| | | <div className="button-list toolbar-button"> |
| | | {this.props.actions.map((item, index) => { |
| | | if (loadingUuid === item.uuid) { |
| | | return ( |
| | | <Button |
| | | className={'mk-btn mk-' + item.class} |
| | | icon={item.icon} |
| | | key={'action' + index} |
| | | onClick={() => {this.actionTrigger(item)}} |
| | | loading |
| | | >{item.label}</Button> |
| | | ) |
| | | } else { |
| | | return ( |
| | | <Button |
| | | className={'mk-btn mk-' + item.class} |
| | | icon={item.icon} |
| | | key={'action' + index} |
| | | onClick={() => {this.actionTrigger(item)}} |
| | | >{item.label}</Button> |
| | | ) |
| | | } |
| | | })} |
| | | {this.getModels()} |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default MainAction |
New file |
| | |
| | | .button-list.toolbar-button { |
| | | position: relative; |
| | | padding: 10px 20px 5px; |
| | | background: #ffffff; |
| | | button { |
| | | min-width: 65px; |
| | | margin-right: 15px; |
| | | margin-bottom: 10px; |
| | | overflow: hidden; |
| | | } |
| | | .ant-spin { |
| | | position: fixed; |
| | | z-index: 1010; |
| | | left: calc(50vw - 22px); |
| | | top: calc(50vh - 70px); |
| | | } |
| | | } |
| | | // 设置模态框样式,规定最大最小高度,重置滚动条 |
| | | .action-modal { |
| | | .ant-modal { |
| | | max-width: 95vw; |
| | | } |
| | | .ant-modal-body { |
| | | max-height: calc(100vh - 235px); |
| | | min-height: 150px; |
| | | overflow-y: auto; |
| | | padding-bottom: 35px; |
| | | } |
| | | .ant-modal-body::-webkit-scrollbar { |
| | | width: 10px; |
| | | height: 10px; |
| | | } |
| | | .ant-modal-body::-webkit-scrollbar-thumb { |
| | | border-radius: 5px; |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13); |
| | | background: rgba(0, 0, 0, 0.13); |
| | | } |
| | | .ant-modal-body::-webkit-scrollbar-track { |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); |
| | | border-radius: 3px; |
| | | border: 1px solid rgba(0, 0, 0, 0.07); |
| | | background: rgba(0, 0, 0, 0); |
| | | } |
| | | } |
New file |
| | |
| | | // 版本升级页面配置 |
| | | export const verupMainTable = { |
| | | setting: { |
| | | tableName: 'sVersion', |
| | | tableType: 'radio', |
| | | interType: 'inner', |
| | | actionfixed: false, |
| | | columnfixed: false, |
| | | primaryKey: 'ID', |
| | | order: 'ID desc', |
| | | innerFunc: '', |
| | | dataresource: 'select * from sVersion_Local where deleted=0 and status=10 and appkey=@Appkey@', |
| | | queryType: 'query', |
| | | }, |
| | | search:[ |
| | | {label: '传输号', field:'VersionName', type: 'text', initval:'',match: 'like', uuid: '1581736007223d84ddmht4gdfb1850nh'} |
| | | ], |
| | | action:[ |
| | | {label:'添加',OpenType:'pop',intertype:'outer',innerFunc:'',sysInterface:'true',outerFunc:'s_get_sVersiondetail_Up',interface:'http://cloud.mk9h.cn/webapi/dostars',callbackFunc:'s_sVersion_Local_add',position:'toolbar',Ot:'notRequired',execSuccess:'grid',execError:'never',icon:'',class:'green',uuid:'1583979660949vpssdb2p2lsqff9abkr'}, |
| | | {label:'关闭',OpenType:'prompt',intertype:'inner',innerFunc:'',position:'toolbar',Ot:'requiredSgl',execSuccess:'grid',execError:'never',icon:'',class:'border-danger',sql:'sVersion',sqlType:'LogicDelete',uuid:'1583979660949msql0p8bgiiedlu4r82', |
| | | verify: { |
| | | default: 'false', |
| | | invalid: 'true', |
| | | uniques: [], |
| | | contrasts: [], |
| | | accountdate: 'false', |
| | | customverifys: [], |
| | | billcodes: [], |
| | | voucher: {enabled: false}, |
| | | scripts:[ |
| | | { |
| | | sql: 'declare @Vid nvarchar(50)\nset @Vid=\'\'\nselect top 1 @Vid=id from sVersionDetail_Local where BID=@ID@ and Status =10\n\nif @Vid=\'\'\nbegin\n delete sVersion_Local where id =@ID@\n delete sVersionDetail_Local where bid =@ID@\nend\nelse\nbegin\n update sVersion_Local set deleted=1,Modifydate=getdate(),ModifyUserID=@UserID@ where id =@ID@\nend', |
| | | uuid: '15839986098557o6ri091qo9flrc5c0a' |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | ], |
| | | columns:[ |
| | | {label:'ID',field:'ID',type:'text',Align:'left',Hide:'true',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1581736658674f11dg01sqdneu8bbn2q'}, |
| | | {label:'传输号',field:'VersionName',type:'text',Align:'left',Hide:'false',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'158173670848068ku8o5a7csuiepd4v8'}, |
| | | {label:'说明',field:'ProgramName',type:'text',Align:'left',Hide:'false',IsSort:'false',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'15817367246420ubig4dkim4on7bv3kp'}, |
| | | {label:'状态',field:'StatusName',type:'text',Align:'left',Hide:'false',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1581736695990kvpkao3d14etkc88c12'}, |
| | | {label:'创建时间',field:'CreateDate',type:'text',Align:'left',Hide:'false',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1581736740656s2o0llughpc779l0qti'} |
| | | ], |
| | | gridBtn: {display: false}, |
| | | tabs:[ |
| | | {label:'脚本',type:'SubTable',linkTab:'15839835082267ac69e4gm0ig6ac00ob',icon:'',supMenu:'mainTable',equalTab:[],uuid:'1583979660949hguu6ildhut1ig5mco1'}, |
| | | {label:'已执行',type:'SubTable',linkTab:'1583984646423lo60vt7snppb55lslbt',icon:'',supMenu:'mainTable',equalTab:[],uuid:'1583984632864kedhlvu7l31us7pkmbq'} |
| | | ] |
| | | } |
| | | |
| | | export const buttonConfig = { |
| | | '1583979660949vpssdb2p2lsqff9abkr': { |
| | | type: 'Modal', |
| | | setting:{title: '添加',width:45,focus:'VersionName',cols:'1',finish:'close',clickouter:'unclose',container:'tab',display:'modal'}, |
| | | tables:[], |
| | | groups:[], |
| | | fields:[ |
| | | {label:'传输号',field:'VersionName',type:'text',initval:'',regular:'letter&number',readonly:'false',required:'true',hidden:'false',fieldlength:20,readin:'true',uuid:'1581738428097qgoe876i5u0866373uu'} |
| | | ] |
| | | }, |
| | | '1583983849299g1qfd28g3c9n9e0e57a': { |
| | | type:'Modal', |
| | | setting:{ |
| | | title:'执行', |
| | | width:60, |
| | | focus:'SrcID', |
| | | cols:'2', |
| | | finish:'close', |
| | | clickouter:'unclose', |
| | | container:'tab', |
| | | display:'prompt' |
| | | }, |
| | | groups: [], |
| | | fields: [ |
| | | {'label':'SrcID','field':'SrcID','type':'text','initval':'','regular':'','readonly':'false','required':'true','hidden':'false','fieldlength':50,'readin':'true','supField':'','uuid':'1584001255960ns626a3pkfkhk04hn7u'} |
| | | ] |
| | | } |
| | | } |
| | | |
| | | export const tabConfig = { |
| | | '15839835082267ac69e4gm0ig6ac00ob': { |
| | | tabName:'脚本', |
| | | tabNo:'sVersionDetail_LocalM', |
| | | Remark:'', |
| | | uuid:'15839835082267ac69e4gm0ig6ac00ob', |
| | | setting:{ |
| | | tableName:'sVersionDetail_Local', |
| | | tableType:'checkbox', |
| | | interType:'inner', |
| | | innerFunc:'', |
| | | dataresource:'select * from sVersionDetail_Local where BID=@BID@ and deleted=0 and status=0', |
| | | queryType:'query', |
| | | primaryKey:'ID', |
| | | order:'Sort', |
| | | onload:'true' |
| | | }, |
| | | search:[ |
| | | {label:'综合查询',field:'Remark,KeyWords,TypeName',type:'text',initval:'',match:'like','ratio':6,uuid:'1583983588787acl55md59fu9kpb52db'} |
| | | ], |
| | | action:[ |
| | | {label:'执行',OpenType:'pop',intertype:'outer',innerFunc:'',sysInterface:'true',outerFunc:'s_get_sVersionDetail_Ltext',interface:'http://cloud.mk9h.cn/webapi/dostars',callbackFunc:'s_sDataDictb_TBBack',position:'toolbar',execSuccess:'grid',execError:'never',icon:'',class:'primary',Ot:'required',uuid:'1583983849299g1qfd28g3c9n9e0e57a',verify:null}, |
| | | {label:'关闭',OpenType:'prompt',intertype:'inner',innerFunc:'',position:'toolbar',Ot:'required',execSuccess:'grid',execError:'never',icon:'',class:'border-danger',sql:'sVersionDetail_Local',sqlType:'LogicDelete',uuid:'1583984089282i4i140hacimbki9s5gh', |
| | | verify:{ |
| | | default: 'true', |
| | | invalid: 'true', |
| | | uniques: [], |
| | | contrasts: [], |
| | | accountdate: 'false', |
| | | customverifys: [], |
| | | billcodes: [], |
| | | voucher: {enabled: false}, |
| | | scripts: [] |
| | | } |
| | | } |
| | | ], |
| | | columns:[ |
| | | {label:'ID',field:'ID',type:'text',Align:'left',Hide:'true',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1583983669503v35f3e7f52iosklnomg'}, |
| | | {label:'关键字',field:'KeyWords',type:'text',Align:'left',Hide:'false',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'15839836784475gl5v26qgual768ab8u'}, |
| | | {label:'描述',field:'Remark',type:'text',Align:'left',Hide:'false',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'15839837044624m3k41m7omhs6q8f9fo'}, |
| | | {label:'类型',field:'TypeName',type:'text',Align:'left',Hide:'false',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1583983717421ts67iu14hmmeqivel5e'}, |
| | | {label:'排序',field:'Sort',type:'text',Align:'left',Hide:'false',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1583983728654ks05hor8mgiqbp61ivl'}, |
| | | {label:'SrcID',field:'SrcID',type:'text',Align:'left',Hide:'true',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1584001165784gu23d35b43i860n0a19'} |
| | | ], |
| | | gridBtn: {display: false} |
| | | }, |
| | | '1583984646423lo60vt7snppb55lslbt': { |
| | | tabName:'已执行', |
| | | tabNo:'sVersionDetail_Local_ReadyM', |
| | | Remark:'', |
| | | uuid:'1583984646423lo60vt7snppb55lslbt', |
| | | setting:{ |
| | | tableName:'sVersionDetail_Local', |
| | | tableType:'checkbox', |
| | | interType:'inner', |
| | | innerFunc:'', |
| | | dataresource:'select * from sVersionDetail_Local where BID=@BID@ and deleted=0 and status=10', |
| | | queryType:'query', |
| | | primaryKey:'ID', |
| | | order:'Sort', |
| | | onload:'true' |
| | | }, |
| | | search:[ |
| | | {label:'综合查询',field:'Remark,KeyWords,TypeName',type:'text',initval:'',match:'like',uuid:'15839847143720ggaaukqtfhp3mirsuc'} |
| | | ], |
| | | action:[], |
| | | columns:[ |
| | | {label:'ID',field:'ID',type:'text',Align:'left',Hide:'true',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1583984775854fkg1kriv6un6v6r21mu'}, |
| | | {label:'关键字',field:'KeyWords',type:'text',Align:'left',Hide:'false',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1583984782136vspicmogvs44o5c0u8n'}, |
| | | {label:'描述',field:'Remark',type:'text',Align:'left',Hide:'false',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1583984799089vi8v268uur6mhqmi71o'}, |
| | | {label:'类型',field:'TypeName',type:'text',Align:'left',Hide:'false',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1583984810593u53835abq83e7h63vce'}, |
| | | {label:'排序',field:'Sort',type:'number',Align:'left',Hide:'false',IsSort:'true',Width:120,'decimal':0,'format':'',prefix:'',postfix:'',match:'',matchVal:'',color:'',uuid:'1583984826744bttg6mt4oqskckpoasl'} |
| | | ], |
| | | gridBtn: {display: false} |
| | | } |
| | | } |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { notification, Tabs, Icon, Switch } 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 options from '@/store/options.js' |
| | | import asyncLoadComponent from '@/utils/asyncLoadComponent' |
| | | import { verupMainTable, buttonConfig } from './config.js' |
| | | |
| | | import MainTable from '@/tabviews/tableshare/normalTable' |
| | | import TopSearch from './topSearch' |
| | | import MainAction from './actionList' |
| | | import './index.scss' |
| | | |
| | | const SubTable = asyncLoadComponent(() => import('./subtabtable')) |
| | | |
| | | const { TabPane } = Tabs |
| | | |
| | | class VerupTable 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 |
| | | config: {}, // 页面配置信息,包括按钮、搜索、显示列、标签等 |
| | | searchlist: [], // 搜索条件 |
| | | actions: [], // 按钮集 |
| | | columns: [], // 显示列 |
| | | arr_field: '', // 使用 sPC_Get_TableData 时的查询字段集 |
| | | logcolumns: null, // 日志中显示的列信息 (增加至全部列,除去合并列) |
| | | setting: {}, // 页面全局设置:数据源、按钮及显示列固定、主键等 |
| | | data: [], // 列表数据集 |
| | | total: 0, // 总数 |
| | | loading: false, // 列表数据加载中 |
| | | pageIndex: 1, // 页码 |
| | | pageSize: 10, // 每页数据条数 |
| | | orderBy: '', // 排序 |
| | | search: '', // 搜索条件数组,使用时需分场景处理 |
| | | BIDs: {}, // 上级表id |
| | | pickup: false, // 主表数据隐藏显示切换 |
| | | visible: false, // 弹框显示隐藏控制 |
| | | refreshtabs: null // 需要刷新的标签集 |
| | | } |
| | | |
| | | /** |
| | | * @description 获取页面配置信息 |
| | | */ |
| | | async loadconfig () { |
| | | let config = verupMainTable |
| | | |
| | | let _arrField = [] // 字段集 |
| | | let _columns = [] // 显示列 |
| | | let _logcolumns = [] // 日志显示列 |
| | | let _hideCol = [] // 隐藏及合并列中字段的uuid集 |
| | | let colMap = new Map() // 用于字段过滤 |
| | | |
| | | // 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) |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | config: config, |
| | | setting: config.setting, |
| | | searchlist: config.search, |
| | | actions: config.action.map(item => { |
| | | if (buttonConfig[item.uuid]) { |
| | | item = {...buttonConfig[item.uuid], ...item} |
| | | } |
| | | return item |
| | | }), |
| | | columns: _columns, |
| | | logcolumns: _logcolumns, |
| | | arr_field: _arrField.join(','), |
| | | search: Utils.initMainSearch(config.search) |
| | | }, () => { |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | this.loadmaindata() |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @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, orderBy, search, setting } = this.state |
| | | |
| | | let _search = Utils.formatCustomMainSearch(search) |
| | | |
| | | let param = { |
| | | PageIndex: pageIndex, |
| | | PageSize: pageSize, |
| | | OrderCol: orderBy || setting.order, |
| | | ..._search |
| | | } |
| | | |
| | | if (setting.interType === 'inner') { |
| | | param.func = setting.innerFunc |
| | | } else { |
| | | if (setting.sysInterface === 'true' && options.cloudServiceApi) { |
| | | param.rduri = options.cloudServiceApi |
| | | } else if (setting.sysInterface !== 'true') { |
| | | 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, orderBy, 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 = orderBy || 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}` |
| | | |
| | | 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) => { |
| | | 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, |
| | | orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' |
| | | }, () => { |
| | | this.loadmaindata() |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 表格刷新 |
| | | */ |
| | | reloadtable = () => { |
| | | this.refs.mainTable.resetTable() |
| | | this.setState({ |
| | | loading: true, |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadmaindata() |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 页面刷新,重新获取配置 |
| | | */ |
| | | reloadview = () => { |
| | | this.setState({ |
| | | config: {}, |
| | | searchlist: [], |
| | | actions: [], |
| | | columns: [], |
| | | arr_field: '', |
| | | setting: {}, |
| | | data: [], |
| | | total: 0, |
| | | loading: false, |
| | | pageIndex: 1, |
| | | pageSize: 10, |
| | | orderBy: '', |
| | | search: '', |
| | | BIDs: {}, |
| | | pickup: false |
| | | }, () => { |
| | | this.loadconfig() |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮操作完成后(成功或失败),页面刷新,重置页码及选择项 |
| | | */ |
| | | refreshbyaction = (btn, type) => { |
| | | if (btn.execSuccess === 'grid' && type === 'success') { |
| | | this.reloadtable() |
| | | } else if (btn.execError === 'grid' && type === 'error') { |
| | | this.reloadtable() |
| | | } else if (btn.execSuccess === 'view' && type === 'success') { |
| | | this.reloadview() |
| | | } else if (btn.execError === 'view' && type === 'error') { |
| | | this.reloadview() |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 子表操作完成后刷新主表 |
| | | */ |
| | | handleMainTable = (type, tab) => { |
| | | if (type === 'maingrid' && tab.supMenu === 'mainTable') { |
| | | this.reloadtable() |
| | | } else if (type === 'maingrid' && tab.supMenu) { |
| | | this.setState({ |
| | | refreshtabs: [tab.supMenu] |
| | | }, () => { |
| | | this.setState({ |
| | | refreshtabs: null |
| | | }) |
| | | }) |
| | | } else if (type === 'equaltab' && tab.equalTab && tab.equalTab.length > 0) { |
| | | this.setState({ |
| | | refreshtabs: tab.equalTab |
| | | }, () => { |
| | | this.setState({ |
| | | refreshtabs: null |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 获取表格选择项 |
| | | */ |
| | | gettableselected = () => { |
| | | let data = [] |
| | | this.refs.mainTable.state.selectedRowKeys.forEach(item => { |
| | | data.push(this.refs.mainTable.props.data[item]) |
| | | }) |
| | | return data |
| | | } |
| | | |
| | | /** |
| | | * @description 表格Id变化 |
| | | */ |
| | | handleTableId = (type, id, data) => { |
| | | const { BIDs } = this.state |
| | | |
| | | this.setState({ |
| | | BIDs: { |
| | | ...BIDs, |
| | | [type]: id, |
| | | [type + 'data']: data |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 数据展开合并切换 |
| | | */ |
| | | pickupChange = () => { |
| | | const { pickup } = this.state |
| | | this.setState({ |
| | | pickup: !pickup |
| | | }) |
| | | } |
| | | |
| | | 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 { dict, searchlist, setting, actions, columns, pickup, config } = this.state |
| | | |
| | | return ( |
| | | <div className="veruptable pick-control" id={this.state.ContainerId}> |
| | | <TopSearch |
| | | dict={dict} |
| | | searchlist={searchlist} |
| | | refreshdata={this.refreshbysearch} |
| | | /> |
| | | <MainAction |
| | | 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} |
| | | gettableselected={this.gettableselected} |
| | | /> |
| | | <div className="main-table-box"> |
| | | {this.state.data && this.state.data.length > 0 ? |
| | | <div className="pickchange"> |
| | | <Switch title="收起" checkedChildren="开" unCheckedChildren="关" defaultChecked={pickup} onChange={this.pickupChange} /> |
| | | </div> : null |
| | | } |
| | | <MainTable |
| | | ref="mainTable" |
| | | tableId="mainTable" |
| | | pickup={pickup} |
| | | setting={setting} |
| | | columns={columns} |
| | | dict={this.state.dict} |
| | | data={this.state.data} |
| | | total={this.state.total} |
| | | MenuID={this.props.MenuID} |
| | | loading={this.state.loading} |
| | | refreshdata={this.refreshbytable} |
| | | buttonTrigger={() => {}} |
| | | handleTableId={this.handleTableId} |
| | | /> |
| | | </div> |
| | | <Tabs defaultActiveKey="0"> |
| | | {config.tabs && config.tabs.map((_tab, index) => { |
| | | return ( |
| | | <TabPane tab={ |
| | | <span> |
| | | {_tab.icon ? <Icon type={_tab.icon} /> : null} |
| | | {_tab.label} |
| | | </span> |
| | | } key={`${index}`}> |
| | | <SubTable |
| | | menuType="HS" |
| | | Tab={_tab} |
| | | MenuID={_tab.linkTab} |
| | | SupMenuID={this.props.MenuID} |
| | | refreshtabs={this.state.refreshtabs} |
| | | ContainerId={this.state.ContainerId} |
| | | BID={this.state.BIDs[_tab.supMenu] || ''} |
| | | BData={this.state.BIDs[_tab.supMenu + 'data'] || ''} |
| | | handleTableId={this.handleTableId} |
| | | handleMainTable={(type) => this.handleMainTable(type, _tab)} |
| | | /> |
| | | </TabPane> |
| | | ) |
| | | })} |
| | | </Tabs> |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default VerupTable |
New file |
| | |
| | | .veruptable { |
| | | position: relative; |
| | | min-height: calc(100vh - 94px); |
| | | padding-top: 16px; |
| | | padding-bottom: 80px; |
| | | |
| | | .search-line { |
| | | padding: 0px 24px 0px; |
| | | border-bottom: 1px solid #efefef; |
| | | } |
| | | |
| | | .box404 { |
| | | padding-top: 30px; |
| | | } |
| | | .ant-modal-mask { |
| | | position: absolute; |
| | | } |
| | | .ant-modal-wrap { |
| | | position: absolute; |
| | | } |
| | | .action-modal .ant-modal { |
| | | top: 40px; |
| | | max-width: 95%; |
| | | .ant-modal-body { |
| | | max-height: calc(100vh - 265px); |
| | | } |
| | | } |
| | | > .ant-spin { |
| | | position: fixed; |
| | | left: calc(50vw - 22px); |
| | | top: calc(50vh - 70px); |
| | | } |
| | | > .ant-card { |
| | | margin: 0 20px 20px; |
| | | > .ant-card-head { |
| | | border: 0; |
| | | padding: 0; |
| | | min-height: 30px; |
| | | .ant-card-head-title { |
| | | padding: 10px 0 0; |
| | | span { |
| | | color: #1890ff; |
| | | display: inline-block; |
| | | padding: 0 10px; |
| | | font-size: 15px; |
| | | border-bottom: 1px solid #1890ff; |
| | | i { |
| | | margin-right: 10px; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | > .ant-card-body { |
| | | padding: 0; |
| | | } |
| | | } |
| | | .main-table-box { |
| | | position: relative; |
| | | .pickchange { |
| | | position: absolute; |
| | | right: 0px; |
| | | top: -25px; |
| | | .ant-switch { |
| | | z-index: 1; |
| | | float: right; |
| | | margin-right: 20px; |
| | | margin-bottom: 5px; |
| | | } |
| | | } |
| | | } |
| | | > .ant-tabs { |
| | | padding: 0px 20px; |
| | | margin-bottom: 20px; |
| | | .ant-tabs-tab:not(.ant-tabs-tab-active) { |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | .common-table-copy { |
| | | position: fixed; |
| | | z-index: 2; |
| | | bottom: 65px; |
| | | right: 30px; |
| | | width: 40px; |
| | | height: 40px; |
| | | } |
| | | } |
| | | .commontable.pick-control { |
| | | >.button-list { |
| | | padding-right: 140px; |
| | | } |
| | | } |
| | | .popview-modal { |
| | | .ant-modal-body { |
| | | min-height: 300px; |
| | | } |
| | | } |
| | | .menu-tree-modal { |
| | | .ant-modal-body { |
| | | min-height: 300px; |
| | | .menu-header { |
| | | text-align: center; |
| | | span { |
| | | font-weight: 600; |
| | | margin-right: 20px; |
| | | } |
| | | .ant-typography { |
| | | font-weight: 600; |
| | | display: inline-block; |
| | | } |
| | | } |
| | | .ant-tree li .ant-tree-node-content-wrapper { |
| | | cursor: default; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { notification, Switch} 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 options from '@/store/options.js' |
| | | import { buttonConfig, tabConfig } from '../config.js' |
| | | |
| | | import SubTable from '@/tabviews/tableshare/normalTable' |
| | | import SubAction from '../actionList' |
| | | import SubSearch from '../topSearch' |
| | | |
| | | import './index.scss' |
| | | |
| | | class VerupSubTabViewTable extends Component { |
| | | static propTpyes = { |
| | | menuType: PropTypes.any, // 菜单类型,普通菜单或HS |
| | | Tab: PropTypes.object, // 标签信息 |
| | | BID: PropTypes.string, // 上级数据ID |
| | | BData: PropTypes.any, // 上级数据 |
| | | MenuID: PropTypes.string, // 菜单Id |
| | | SupMenuID: PropTypes.string, // 上级菜单Id |
| | | ContainerId: PropTypes.any, // 三级菜单Container(html) ID |
| | | handleTableId: PropTypes.func, // 控制表格数据切换时,更新在主表中的id |
| | | handleMainTable: PropTypes.func, // 刷新主表 |
| | | refreshtabs:PropTypes.any |
| | | } |
| | | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | config: null, // 页面配置信息,包括按钮、搜索、显示列、标签等 |
| | | 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, // 每页数据条数 |
| | | orderBy: '', // 排序 |
| | | search: '', // 搜索条件数组,使用时需分场景处理 |
| | | popAction: false, // 弹框页面,按钮信息 |
| | | popData: false, // 弹框页面,所选的表格数据 |
| | | visible: false, // 弹框显示隐藏控制 |
| | | pickup: false, // 子表数据隐藏显示切换 |
| | | } |
| | | |
| | | /** |
| | | * @description 上级菜单id变化时,刷新数据 |
| | | */ |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | if (this.state.config && this.props.Tab.supMenu && !is(fromJS(this.props.BID), fromJS(nextProps.BID))) { |
| | | this.refs.subTable.resetTable() |
| | | this.loadmaindata(nextProps.BID, 'refresh') |
| | | } else if (this.state.config && nextProps.refreshtabs && nextProps.refreshtabs.includes(this.props.Tab.uuid)) { |
| | | |
| | | this.reloadtable() |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 获取页面配置信息 |
| | | */ |
| | | async loadconfig () { |
| | | const { Tab, BID } = this.props |
| | | |
| | | let config = tabConfig[this.props.MenuID] |
| | | |
| | | let _arrField = [] // 字段集 |
| | | let _columns = [] // 显示列 |
| | | let _logcolumns = [] // 日志显示列 |
| | | let _hideCol = [] // 隐藏及合并列中字段的uuid集 |
| | | let colMap = new Map() |
| | | |
| | | // 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) |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | config: config, |
| | | setting: config.setting, |
| | | searchlist: config.search, |
| | | actions: config.action.map(item => { |
| | | if (buttonConfig[item.uuid]) { |
| | | item = {...buttonConfig[item.uuid], ...item} |
| | | } |
| | | return item |
| | | }), |
| | | columns: _columns, |
| | | logcolumns: _logcolumns, |
| | | arr_field: _arrField.join(','), |
| | | search: Utils.initMainSearch(config.search) // 搜索条件初始化(含有时间格式,需要转化) |
| | | }, () => { |
| | | if (config.setting.onload !== 'false' && (!Tab.supMenu || BID)) { // 初始化可加载 |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | this.loadmaindata() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 子表数据加载 |
| | | */ |
| | | async loadmaindata (bid, type) { |
| | | const { setting } = this.state |
| | | let param = '' |
| | | let _BID = this.props.BID |
| | | |
| | | if (type === 'refresh') { |
| | | _BID = bid |
| | | if (!bid) { // 主表ID不存在时,不查询子表 |
| | | this.setState({ |
| | | data: [], |
| | | total: 0, |
| | | loading: false |
| | | }) |
| | | |
| | | return |
| | | } |
| | | } |
| | | |
| | | if (setting.interType !== 'inner' || (setting.interType === 'inner' && setting.innerFunc)) { |
| | | param = this.getCustomParam(_BID) |
| | | } else { |
| | | param = this.getDefaultParam(_BID) |
| | | } |
| | | |
| | | this.handleTableId() |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | this.setState({ |
| | | data: result.data.map((item, index) => { |
| | | item.key = index |
| | | return item |
| | | }), |
| | | total: result.total, |
| | | pickup: false, |
| | | loading: false |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.error({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 15 |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 获取用户自定义存储过程传参 |
| | | */ |
| | | getCustomParam = (BID) => { |
| | | const { pageIndex, pageSize, orderBy, search, setting } = this.state |
| | | |
| | | let _search = Utils.formatCustomMainSearch(search) |
| | | |
| | | let param = { |
| | | PageIndex: pageIndex, |
| | | PageSize: pageSize, |
| | | OrderCol: orderBy || setting.order, |
| | | BID: BID, |
| | | ..._search |
| | | } |
| | | |
| | | if (setting.interType === 'inner') { |
| | | param.func = setting.innerFunc |
| | | } else { |
| | | if (setting.sysInterface === 'true' && options.cloudServiceApi) { |
| | | param.rduri = options.cloudServiceApi |
| | | } else if (setting.sysInterface !== 'true') { |
| | | param.rduri = setting.interface |
| | | } |
| | | |
| | | param.appkey = window.GLOB.appkey || '' // 调用外部接口增加appkey |
| | | |
| | | if (setting.outerFunc) { |
| | | param.func = setting.outerFunc |
| | | } |
| | | } |
| | | |
| | | return param |
| | | } |
| | | |
| | | /** |
| | | * @description 获取系统存储过程 sPC_Get_TableData 的参数 |
| | | */ |
| | | getDefaultParam = (BID) => { |
| | | const { arr_field, pageIndex, pageSize, orderBy, search, setting } = this.state |
| | | |
| | | let _search = Utils.joinMainSearchkey(search) |
| | | _search = _search ? 'where ' + _search : '' |
| | | |
| | | let param = { |
| | | func: 'sPC_Get_TableData', |
| | | obj_name: 'data', |
| | | arr_field: arr_field, |
| | | BID: BID, |
| | | appkey: window.GLOB.appkey || '' |
| | | } |
| | | |
| | | let _orderBy = orderBy || 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}` |
| | | |
| | | 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) => { |
| | | this.refs.subTable.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, |
| | | orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' |
| | | }, () => { |
| | | this.loadmaindata() |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 表格刷新 |
| | | */ |
| | | reloadtable = () => { |
| | | this.refs.subTable.resetTable() |
| | | this.setState({ |
| | | loading: true, |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadmaindata() |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 页面刷新,重新获取配置 |
| | | */ |
| | | reloadview = () => { |
| | | this.setState({ |
| | | config: null, |
| | | searchlist: null, |
| | | actions: null, |
| | | columns: null, |
| | | arr_field: '', |
| | | setting: null, |
| | | data: null, |
| | | total: 0, |
| | | loading: false, |
| | | pageIndex: 1, |
| | | pageSize: 10, |
| | | orderBy: '', |
| | | search: '' |
| | | }, () => { |
| | | this.loadconfig() |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮操作完成后(成功或失败),页面刷新,重置页码及选择项 |
| | | */ |
| | | refreshbyaction = (btn, type) => { |
| | | if (btn.execSuccess === 'grid' && type === 'success') { |
| | | this.reloadtable() |
| | | } else if (btn.execError === 'grid' && type === 'error') { |
| | | this.reloadtable() |
| | | } else if (btn.execSuccess === 'view' && type === 'success') { |
| | | this.reloadview() |
| | | } else if (btn.execError === 'view' && type === 'error') { |
| | | this.reloadview() |
| | | } else if (btn.popClose === 'grid' && type === 'pop') { |
| | | this.reloadtable() |
| | | } else if (btn.popClose === 'view' && type === 'pop') { |
| | | this.reloadview() |
| | | } else if (btn.popClose === 'maingrid' && type === 'pop') { |
| | | this.props.handleMainTable('maingrid') |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 获取表格选择项 |
| | | */ |
| | | gettableselected = () => { |
| | | let data = [] |
| | | this.refs.subTable.state.selectedRowKeys.forEach(item => { |
| | | data.push(this.refs.subTable.props.data[item]) |
| | | }) |
| | | return data |
| | | } |
| | | |
| | | /** |
| | | * @description 表格Id变化 |
| | | */ |
| | | handleTableId = (type = this.props.Tab.uuid, id = '', data = '') => { |
| | | this.props.handleTableId(type, id, data) |
| | | } |
| | | |
| | | /** |
| | | * @description 数据展开合并切换 |
| | | */ |
| | | pickupChange = () => { |
| | | const { pickup } = this.state |
| | | |
| | | this.setState({ |
| | | pickup: !pickup |
| | | }) |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | // 组件加载时,获取菜单数据 |
| | | this.loadconfig() |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { // handleMainTable 函数判断时不相等 |
| | | return !is(fromJS({...this.props, handleMainTable: '', handleTableId: ''}), fromJS({...nextProps, handleMainTable: '', handleTableId: ''})) || !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新 |
| | | */ |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | } |
| | | |
| | | render() { |
| | | const { setting, searchlist, actions, columns, pickup } = this.state |
| | | |
| | | return ( |
| | | <div className="subtable" id={'subtable' + this.props.MenuID}> |
| | | {searchlist && searchlist.length > 0 ? |
| | | <SubSearch |
| | | dict={this.state.dict} |
| | | searchlist={searchlist} |
| | | refreshdata={this.refreshbysearch} |
| | | /> : null |
| | | } |
| | | {actions ? |
| | | <div className="sub-action"> |
| | | <SubAction |
| | | ref="subButton" |
| | | type="sub" |
| | | setting={setting} |
| | | actions={actions} |
| | | Tab={this.props.Tab} |
| | | BID={this.props.BID} |
| | | BData={this.props.BData} |
| | | dict={this.state.dict} |
| | | MenuID={this.props.SupMenuID} |
| | | logcolumns={this.state.logcolumns} |
| | | refreshdata={this.refreshbyaction} |
| | | ContainerId={this.props.ContainerId} |
| | | getexceloutparam={this.getexceloutparam} |
| | | gettableselected={this.gettableselected} |
| | | /> |
| | | </div> : null |
| | | } |
| | | {columns ? |
| | | <div className="subtable-box"> |
| | | {this.state.data && this.state.data.length > 0 ? |
| | | <Switch title="收起" className="subtable-pickup" checkedChildren="开" unCheckedChildren="关" defaultChecked={pickup} onChange={this.pickupChange} /> : null |
| | | } |
| | | <SubTable |
| | | ref="subTable" |
| | | tableId={this.props.Tab.uuid} |
| | | pickup={pickup} |
| | | setting={setting} |
| | | columns={columns} |
| | | dict={this.state.dict} |
| | | data={this.state.data} |
| | | total={this.state.total} |
| | | MenuID={this.props.MenuID} |
| | | loading={this.state.loading} |
| | | refreshdata={this.refreshbytable} |
| | | buttonTrigger={() => {}} |
| | | handleTableId={this.handleTableId} |
| | | /> |
| | | </div> : null |
| | | } |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default VerupSubTabViewTable |
New file |
| | |
| | | .subtable { |
| | | position: relative; |
| | | min-height: 200px; |
| | | |
| | | > .top-search { |
| | | padding: 0 0px 20px; |
| | | } |
| | | >.sub-action { |
| | | min-height: 25px; |
| | | .button-list { |
| | | padding: 10px 0px 5px; |
| | | } |
| | | } |
| | | .normal-data-table { |
| | | padding: 0px; |
| | | } |
| | | .box404 { |
| | | padding-top: 30px; |
| | | } |
| | | .ant-modal-mask { |
| | | position: absolute; |
| | | } |
| | | .ant-modal-wrap { |
| | | position: absolute; |
| | | } |
| | | .action-modal .ant-modal { |
| | | top: 40px; |
| | | max-width: 95%; |
| | | .ant-modal-body { |
| | | max-height: calc(100vh - 265px); |
| | | } |
| | | } |
| | | > .ant-spin { |
| | | position: absolute; |
| | | left: calc(50% - 22px); |
| | | top: 100px; |
| | | } |
| | | .subtable-box { |
| | | position: relative; |
| | | .subtable-pickup { |
| | | position: absolute; |
| | | right: 5px; |
| | | top: -22px; |
| | | z-index: 10; |
| | | } |
| | | } |
| | | } |
| | | .popview-modal { |
| | | .ant-modal-body { |
| | | min-height: 300px; |
| | | } |
| | | } |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Button } from 'antd' |
| | | import './index.scss' |
| | | |
| | | class MainSearch extends Component { |
| | | static propTpyes = { |
| | | searchlist: PropTypes.array, // 搜索条件列表 |
| | | dict: PropTypes.object // 字典项 |
| | | } |
| | | |
| | | state = { |
| | | match: null, // 搜索条件匹配规则 |
| | | style: null, |
| | | searchlist: null |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | let searchlist = JSON.parse(JSON.stringify(this.props.searchlist)) |
| | | let match = {} |
| | | let style = {} |
| | | let _list = [] |
| | | |
| | | searchlist.forEach(item => { |
| | | match[item.field] = item.match |
| | | style[item.field] = item.type |
| | | |
| | | _list.push(item) |
| | | }) |
| | | |
| | | this.setState({ |
| | | match: match, |
| | | style: style, |
| | | searchlist: _list |
| | | }) |
| | | } |
| | | |
| | | getFields() { |
| | | const { getFieldDecorator } = this.props.form |
| | | const fields = [] |
| | | |
| | | this.state.searchlist.forEach((item, index) => { |
| | | fields.push( |
| | | <Col span={6} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.field, {initialValue: item.initval })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | }) |
| | | |
| | | fields.push( |
| | | <Col span={6} style={{ whiteSpace: 'nowrap' }} key="actions"> |
| | | <Form.Item label={' '} colon={false}> |
| | | <Button type="primary" htmlType="submit"> |
| | | {this.props.dict['main.search']} |
| | | </Button> |
| | | <Button style={{ marginLeft: 8 }} onClick={this.handleReset}> |
| | | {this.props.dict['main.reset']} |
| | | </Button> |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | |
| | | return fields |
| | | } |
| | | |
| | | handleSearch = (e) => { |
| | | // 回车或点击搜索 |
| | | e.preventDefault() |
| | | this.props.form.validateFields((err, values) => { |
| | | let searches = this.getFieldsValues(values) |
| | | this.props.refreshdata(searches) |
| | | }) |
| | | } |
| | | |
| | | handleReset = () => { |
| | | // 重置 |
| | | this.props.form.resetFields() |
| | | this.props.form.validateFields((err, values) => { |
| | | let searches = this.getFieldsValues(values) |
| | | this.props.refreshdata(searches) |
| | | }) |
| | | } |
| | | |
| | | getFieldsValues = (values) => { |
| | | // 获取搜索条件值 |
| | | let search = [] |
| | | Object.keys(values).forEach(key => { |
| | | search.push({ |
| | | type: this.state.style[key], |
| | | key: key, |
| | | value: values[key].replace(/(^\s*|\s*$)/ig, ''), |
| | | match: this.state.match[key] |
| | | }) |
| | | }) |
| | | return search |
| | | } |
| | | |
| | | render() { |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 8 } |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 16 } |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <Form {...formItemLayout} className="verup-search-line" onSubmit={this.handleSearch}> |
| | | <Row gutter={24}>{this.getFields()}</Row> |
| | | </Form> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default Form.create()(MainSearch) |
New file |
| | |
| | | .verup-search-line { |
| | | padding: 0px 24px 20px; |
| | | border-bottom: 1px solid #efefef; |
| | | .ant-form-item { |
| | | display: flex; |
| | | margin-bottom: 10px; |
| | | } |
| | | .ant-form-item-control-wrapper { |
| | | flex: 1; |
| | | width: calc(100% - 100px); |
| | | } |
| | | .ant-form-item-label { |
| | | // width: 100px; |
| | | text-overflow: ellipsis; |
| | | } |
| | | .daterange .ant-calendar-picker-input { |
| | | padding: 4px 20px 4px 5px; |
| | | font-size: 13px; |
| | | } |
| | | .ant-select-dropdown { |
| | | z-index: 10 !important; |
| | | } |
| | | .ant-calendar-picker-container { |
| | | z-index: 10 !important; |
| | | } |
| | | } |
| | |
| | | _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] |
| | | } else if (_funcType === 'print') { |
| | | if (_intertype === 'outer') { |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | |
| | | _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] |
| | | } else if (this.state.funcType === 'print') { |
| | | if (this.state.interType === 'outer') { |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | |
| | | _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] |
| | | } else if (value === 'print') { |
| | | if (this.state.interType === 'outer') { |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | |
| | | } |
| | | } else if (openType === 'funcbutton') { |
| | | if (value === 'outer') { |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | |
| | | |
| | | let newLText = Utils.formatOptions(Utils.getTableFunc(setting, menu, config)) // 创建存储过程sql |
| | | let DelText = Utils.formatOptions(Utils.dropfunc(setting.innerFunc)) // 删除存储过程sql |
| | | let isExit = false // 存储过程是否存在 |
| | | |
| | | new Promise(resolve => { |
| | | let sysDefer = new Promise(resolve => { |
| | |
| | | let cloudfunc = '' |
| | | let localfunc = '' |
| | | res.forEach((item, index) => { |
| | | if (index === 0 && item.TVPText) { |
| | | if (index === 0 && item && item.TVPText) { |
| | | cloudfunc = item.TVPText |
| | | } else if (index === 1 && item.Ltext) { |
| | | } else if (index === 1 && item && item.Ltext) { |
| | | isExit = true |
| | | localfunc = Utils.formatOptions(item.Ltext) |
| | | } |
| | | }) |
| | |
| | | duration: 10 |
| | | }) |
| | | return false |
| | | } else if (isExit) { |
| | | return 'drop' |
| | | } else { |
| | | return 'create' |
| | | } |
| | |
| | | |
| | | let newLText = Utils.formatOptions(Utils.getTableFunc(setting, menu, config)) // 创建存储过程sql |
| | | let DelText = Utils.formatOptions(Utils.dropfunc(setting.innerFunc)) // 删除存储过程sql |
| | | let isExit = false // 存储过程是否存在 |
| | | |
| | | new Promise(resolve => { |
| | | let sysDefer = new Promise(resolve => { |
| | |
| | | if (index === 0 && item.TVPText) { |
| | | cloudfunc = item.TVPText |
| | | } else if (index === 1 && item.Ltext) { |
| | | isExit = true |
| | | localfunc = Utils.formatOptions(item.Ltext) |
| | | } |
| | | }) |
| | |
| | | duration: 10 |
| | | }) |
| | | return false |
| | | } else if (isExit) { |
| | | return 'drop' |
| | | } else { |
| | | return 'create' |
| | | } |
| | |
| | | _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] |
| | | } else if (_funcType === 'print') { |
| | | if (_intertype === 'outer') { |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | |
| | | _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] |
| | | } else if (this.state.funcType === 'print') { |
| | | if (this.state.interType === 'outer') { |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | |
| | | _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] |
| | | } else if (value === 'print') { |
| | | if (this.state.interType === 'outer') { |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | |
| | | } |
| | | } else if (openType === 'funcbutton') { |
| | | if (value === 'outer') { |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | |
| | | |
| | | let newLText = Utils.formatOptions(Utils.getTableFunc(setting, {MenuID: config.uuid, MenuName: config.tabName, MenuNo: config.tabNo}, config)) // 创建存储过程sql |
| | | let DelText = Utils.formatOptions(Utils.dropfunc(setting.innerFunc)) // 删除存储过程sql |
| | | let isExit = false // 存储过程是否存在 |
| | | |
| | | new Promise(resolve => { |
| | | let sysDefer = new Promise(resolve => { |
| | |
| | | if (index === 0 && item.TVPText) { |
| | | cloudfunc = item.TVPText |
| | | } else if (index === 1 && item.Ltext) { |
| | | isExit = true |
| | | localfunc = Utils.formatOptions(item.Ltext) |
| | | } |
| | | }) |
| | |
| | | duration: 10 |
| | | }) |
| | | return false |
| | | } else if (isExit) { |
| | | return 'drop' |
| | | } else { |
| | | return 'create' |
| | | } |
| | |
| | | let node = document.getElementById('verify-card-box-tab').parentNode |
| | | |
| | | if (node && node.scrollTop) { |
| | | node.scrollTop = 0 |
| | | let inter = Math.ceil(node.scrollTop / 10) |
| | | |
| | | let timer = setInterval(() => { |
| | | if (node.scrollTop - inter > 0) { |
| | | node.scrollTop = node.scrollTop - inter |
| | | } else { |
| | | node.scrollTop = 0 |
| | | clearInterval(timer) |
| | | } |
| | | }, 10) |
| | | } |
| | | } |
| | | |
| | |
| | | let node = document.getElementById('verify-excel-box-tab').parentNode |
| | | |
| | | if (node && node.scrollTop) { |
| | | node.scrollTop = 0 |
| | | let inter = Math.ceil(node.scrollTop / 10) |
| | | |
| | | let timer = setInterval(() => { |
| | | if (node.scrollTop - inter > 0) { |
| | | node.scrollTop = node.scrollTop - inter |
| | | } else { |
| | | node.scrollTop = 0 |
| | | clearInterval(timer) |
| | | } |
| | | }, 10) |
| | | } |
| | | } |
| | | |
| | |
| | | let node = document.getElementById('verify-excelout-box-tab').parentNode |
| | | |
| | | if (node && node.scrollTop) { |
| | | node.scrollTop = 0 |
| | | let inter = Math.ceil(node.scrollTop / 10) |
| | | |
| | | let timer = setInterval(() => { |
| | | if (node.scrollTop - inter > 0) { |
| | | node.scrollTop = node.scrollTop - inter |
| | | } else { |
| | | node.scrollTop = 0 |
| | | clearInterval(timer) |
| | | } |
| | | }, 10) |
| | | } |
| | | } |
| | | |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Tabs, Row, Col, Button, notification, Modal, message, InputNumber, Input, Select } from 'antd' |
| | | import { Form, Tabs, Row, Col, Button, notification, Modal, message, InputNumber, Input, Select, Radio } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | |
| | | verify: { |
| | | ..._verify, |
| | | Template: _verify.Template || '' |
| | | } |
| | | }, |
| | | linkType: _verify.linkType || 'system' |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | changeLinkType = (e) => { |
| | | let value = e.target.value |
| | | |
| | | this.setState({ |
| | | linkType: value |
| | | }, () => { |
| | | if (value === 'system') { |
| | | this.props.form.setFieldsValue({ |
| | | linkUrl: '127.0.0.1:13529' |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { getFieldDecorator } = this.props.form |
| | | |
| | | const { verify } = this.state |
| | | const { verify, linkType } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | |
| | | |
| | | return ( |
| | | <div id="verify-card-box-tab"> |
| | | <Tabs defaultActiveKey="1" className="verify-card-box" onChange={this.tabchange}> |
| | | <Tabs defaultActiveKey="1" className="verify-card-print-box" onChange={this.tabchange}> |
| | | <TabPane tab="打印验证" key="1"> |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | | <Col span={8}> |
| | | <Form.Item label={'链接类型'}> |
| | | {getFieldDecorator('linkType', { |
| | | initialValue: linkType || 'system' |
| | | })( |
| | | <Radio.Group onChange={this.changeLinkType}> |
| | | <Radio value="system">系统</Radio> |
| | | <Radio value="custom">自定义</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'链接地址'}> |
| | | {getFieldDecorator('linkUrl', { |
| | |
| | | message: this.props.dict['form.required.input'] + '链接地址!' |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | })(<Input placeholder="" autoComplete="off" disabled={linkType === 'system'} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | |
| | | .verify-card-box { |
| | | .verify-card-print-box { |
| | | .ant-tabs-nav-scroll { |
| | | text-align: center; |
| | | } |
| | | .ant-tabs-content { |
| | | min-height: 40vh; |
| | | } |
| | | table tr td { |
| | | word-wrap: break-word; |
| | | word-break: break-word; |
| | | } |
| | | .verify-form { |
| | | .ant-input-number { |
| | | width: 100%; |
| | | } |
| | | .sql { |
| | | .ant-col-sm-8 { |
| | | width: 10.5%; |
| | | } |
| | | .ant-col-sm-16 { |
| | | width: 89.5%; |
| | | padding-top: 4px; |
| | | } |
| | | } |
| | | .sqlfield { |
| | | .ant-form-item { |
| | | margin-bottom: 5px; |
| | | } |
| | | .ant-col-sm-8 { |
| | | width: 10.5%; |
| | | } |
| | | .ant-col-sm-16 { |
| | | width: 89.5%; |
| | | } |
| | | } |
| | | .add { |
| | | padding-top: 4px; |
| | | } |
| | | } |
| | | .custom-table .ant-empty { |
| | | margin: 20px 8px!important; |
| | | .ant-input-disabled { |
| | | color: rgba(0, 0, 0, 0.65); |
| | | cursor: default; |
| | | } |
| | | .errorval { |
| | | display: inline-block; |
| | |
| | | @BID nvarchar(50)='', |
| | | @Ltext nvarchar(max)='', |
| | | @sEPTMenuNo nvarchar(50)='${param.menuNo}', |
| | | @secretkey nvarchar(50)='', |
| | | @timestamp nvarchar(50)='', |
| | | @lang nvarchar(50)='', |
| | | @LoginUID nvarchar(50)='', |
| | | @SessionUid nvarchar(50)='', |