| | |
| | | import {connect} from 'react-redux' |
| | | import { is, fromJS } from 'immutable' |
| | | import moment from 'moment' |
| | | import {Dropdown, Menu, Icon, Modal, Form, notification, Switch, Button } from 'antd' |
| | | import {Dropdown, Menu, Icon, Modal, Form, notification, Switch, Button, Input } from 'antd' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import { |
| | | toggleCollapse, |
| | | modifyMainMenu, |
| | | modifyTabview, |
| | | resetState, |
| | | resetDebug, |
| | | resetEditState, |
| | |
| | | |
| | | const EditMenu = asyncComponent(() => import('./editmenu')) |
| | | const { confirm } = Modal |
| | | const { Search } = Input |
| | | |
| | | class Header extends Component { |
| | | static propTpyes = { |
| | |
| | | loginVisible: false, |
| | | loginLoading: false, |
| | | avatar: avatar, |
| | | systems: [] |
| | | systems: [], |
| | | searchkey: '', |
| | | thdMenuList: [] |
| | | } |
| | | |
| | | handleCollapse = () => { |
| | |
| | | let _param = window.btoa('ud=' + sessionStorage.getItem('UserID') + '&sd=' + sessionStorage.getItem('SessionUid') + '&ld=' + sessionStorage.getItem('LoginUID') + '&un=' + sessionStorage.getItem('User_Name')) |
| | | window.location.href = system.LinkUrl1 + '#/ssologin/' + _param |
| | | } |
| | | |
| | | dropdownMenuChange = (visible) => { |
| | | this.setState({searchkey: ''}, () => { |
| | | if (visible) { |
| | | setTimeout(() => { |
| | | let input = document.getElementById('thdMenu-search') |
| | | |
| | | if (input) { |
| | | input.focus() |
| | | } |
| | | }, 500) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | selectMenu = (item) => { |
| | | const { tabviews } = this.props |
| | | |
| | | let menu = JSON.parse(JSON.stringify(item)) |
| | | menu.selected = true |
| | | |
| | | let index = 0 |
| | | let isexit = false |
| | | let tabs = tabviews.map((tab, i) => { |
| | | tab.selected = false |
| | | |
| | | if (tab.MenuID === menu.MenuID) { |
| | | tab.selected = true |
| | | isexit = true |
| | | } |
| | | |
| | | return tab |
| | | }) |
| | | |
| | | if (!isexit) { |
| | | tabs.splice(index + 1, 0, menu) |
| | | } |
| | | |
| | | this.props.modifyTabview(tabs) |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | // 组件加载时,获取菜单数据 |
| | |
| | | if (!result) return |
| | | if (result.status) { |
| | | let _permMenus = {} |
| | | let menulist = [] |
| | | |
| | | if (result.UserRoles) { |
| | | let iframes = ['Main/Index', 'bda/rdt', 'Home/rdt'] |
| | | |
| | | result.UserRoles.forEach(role => { |
| | | role.RoleMenu.forEach(menu => { |
| | | if (!menu.MenuID) return |
| | | _permMenus[menu.MenuID] = true |
| | | |
| | | let _type = '' |
| | | if (menu.LinkUrl) { |
| | | if (menu.LinkUrl === 'CommonTable') { |
| | | _type = 'CommonTable' |
| | | } else if (menu.LinkUrl === 'DataManage') { |
| | | _type = 'DataManage' |
| | | } else if (iframes.includes(menu.LinkUrl.split('?')[0])) { |
| | | _type = 'iframe' |
| | | } |
| | | } |
| | | |
| | | if (_type !== 'iframe') { |
| | | let pageParam = {} |
| | | try { |
| | | pageParam = JSON.parse(menu.PageParam) |
| | | } catch (e) { |
| | | pageParam = {} |
| | | } |
| | | _type = pageParam.Template || _type |
| | | } |
| | | |
| | | menulist.push({ |
| | | MenuID: menu.MenuID, |
| | | MenuName: menu.MenuName, |
| | | MenuNo: menu.MenuNo || '', |
| | | EasyCode: menu.EasyCode || '', |
| | | LinkUrl: menu.LinkUrl, |
| | | type: _type |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | thdMenuList: menulist |
| | | }) |
| | | |
| | | this.props.initMenuPermission(_permMenus) |
| | | } else { |
| | | notification.error({ |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { thdMenuList, searchkey } = this.state |
| | | |
| | | const menu = ( |
| | | <Menu overlayclassname="header-dropdown"> |
| | | {this.props.debug && <Menu.Item key="0"> |
| | |
| | | ) |
| | | |
| | | return ( |
| | | <header className="header-container ant-menu-dark"> |
| | | <header className="header-container ant-menu-dark" id="main-header-container"> |
| | | <div className={this.props.collapse ? "collapse header-logo" : "header-logo"}><img src={this.state.logourl} alt=""/></div> |
| | | <div className={this.props.collapse ? "collapse header-collapse" : "header-collapse"} onClick={this.handleCollapse}> |
| | | <Icon type={this.props.collapse ? 'menu-unfold' : 'menu-fold'} /> |
| | |
| | | </span> |
| | | </div> |
| | | </Dropdown> |
| | | {/* 菜单搜索 */} |
| | | {!this.props.editState && thdMenuList.length > 0 ? |
| | | <Dropdown overlayClassName="menu-select-dropdown" getPopupContainer={() => document.getElementById('main-header-container')} overlay={ |
| | | <div> |
| | | <Search |
| | | placeholder="" |
| | | id="thdMenu-search" |
| | | value={searchkey} |
| | | onChange={e => this.setState({searchkey: e.target.value})} |
| | | style={{ minWidth: '200px' }} |
| | | onSearch={(val, e) => {e.stopPropagation()}} |
| | | onClick={(e) => {e.stopPropagation()}} |
| | | /> |
| | | <div className="menu-select-box"> |
| | | <Menu> |
| | | {thdMenuList.map(option => { |
| | | if (searchkey) { |
| | | if ( |
| | | option.MenuName.toLowerCase().indexOf(searchkey.toLowerCase()) >= 0 || |
| | | option.MenuNo.toLowerCase().indexOf(searchkey.toLowerCase()) >= 0 || |
| | | option.EasyCode.toLowerCase().indexOf(searchkey.toLowerCase()) >= 0 |
| | | ) { |
| | | return <Menu.Item key={option.MenuID} onClick={() => this.selectMenu(option)}>{option.MenuName}</Menu.Item> |
| | | } else { |
| | | return null |
| | | } |
| | | } |
| | | return <Menu.Item key={option.MenuID} onClick={() => this.selectMenu(option)}>{option.MenuName}</Menu.Item> |
| | | })} |
| | | </Menu> |
| | | </div> |
| | | </div> |
| | | } trigger={['click']} className="search-menu" placement="bottomRight" onVisibleChange={this.dropdownMenuChange}> |
| | | <Icon className="search-menu" type="search" /> |
| | | </Dropdown> : null |
| | | } |
| | | {/* 修改密码 */} |
| | | <Modal |
| | | title={this.state.dict['header.password']} |
| | |
| | | |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | tabviews: state.tabviews, |
| | | collapse: state.collapse, |
| | | selectmenu: state.selectedMainMenu, |
| | | debug: state.debug, |
| | |
| | | const mapDispatchToProps = (dispatch) => { |
| | | return { |
| | | toggleCollapse: (collapse) => dispatch(toggleCollapse(collapse)), |
| | | modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)), |
| | | modifyMainMenu: (selectmenu) => dispatch(modifyMainMenu(selectmenu)), |
| | | resetEditState: (state) => dispatch(resetEditState(state)), |
| | | resetEditLevel: (level) => dispatch(resetEditLevel(level)), |
| | |
| | | margin-left: 10px; |
| | | cursor: pointer; |
| | | } |
| | | .search-menu { |
| | | float: right; |
| | | font-size: 18px; |
| | | margin-top: 17px; |
| | | margin-right: 20px; |
| | | cursor: pointer; |
| | | } |
| | | .level4-close { |
| | | position: relative; |
| | | top: 13px; |
| | |
| | | height: 26px; |
| | | padding: 0 10px; |
| | | } |
| | | .menu-select-dropdown { |
| | | top: 48px!important; |
| | | box-shadow: 0px 0px 2px #cdcdcd; |
| | | border-radius: 0 0 4px 4px; |
| | | background: #ffffff; |
| | | .ant-input-affix-wrapper { |
| | | margin-top: 2px; |
| | | } |
| | | .menu-select-box { |
| | | max-height: 200px; |
| | | min-height: 50px; |
| | | overflow-y: auto; |
| | | background: #ffffff; |
| | | margin-bottom: 3px; |
| | | .ant-menu { |
| | | border-radius: 0 0 4px 4px; |
| | | } |
| | | .ant-menu-item { |
| | | padding: 0px 25px; |
| | | height: 26px; |
| | | line-height: 26px; |
| | | color: #000000; |
| | | cursor: pointer; |
| | | } |
| | | .ant-menu-item:hover { |
| | | background-color: #e6f7ff; |
| | | } |
| | | } |
| | | .menu-select-box::-webkit-scrollbar { |
| | | width: 7px; |
| | | } |
| | | .menu-select-box::-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); |
| | | } |
| | | .menu-select-box::-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); |
| | | } |
| | | } |
| | | } |
| | | .header-dropdown { |
| | | li { |
| | |
| | | 'header.form.blacklist': '黑名单', |
| | | 'header.form.linkmenu': '关联菜单', |
| | | 'header.form.clickscale': '点击缩放', |
| | | 'header.form.easyCode': '助记码', |
| | | 'header.modal.form.edit': '表单-编辑', |
| | | 'header.modal.search.edit': '搜索条件-编辑', |
| | | 'header.modal.action.edit': '按钮-编辑', |
| | |
| | | 'header.form.blacklist': '黑名单', |
| | | 'header.form.linkmenu': '关联菜单', |
| | | 'header.form.clickscale': '点击缩放', |
| | | 'header.form.easyCode': '助记码', |
| | | 'header.modal.form.edit': '表单-编辑', |
| | | 'header.modal.search.edit': '搜索条件-编辑', |
| | | 'header.modal.action.edit': '按钮-编辑', |
| | |
| | | |
| | | if (_curUserConfig) { |
| | | config.setting = {...config.setting, ..._curUserConfig.setting} |
| | | config.easyCode = _curUserConfig.easyCode || config.easyCode || '' |
| | | |
| | | config.action = config.action.map(item => { |
| | | if (item.execMode) { |
| | |
| | | return |
| | | } |
| | | |
| | | let easyCode = userParam[this.props.MenuID] ? userParam[this.props.MenuID].easyCode : '' |
| | | |
| | | let param = { |
| | | func: 'sPC_TrdMenu_UserParam', |
| | | MenuID: this.props.MenuID, |
| | | EasyCode: easyCode || '', |
| | | LongParam: _LongParam |
| | | } |
| | | |
| | |
| | | this.improveSelectOption(config.groups) |
| | | |
| | | if (config.setting.datatype === 'query' && config.setting.onload !== 'false') { |
| | | if (!this.props.param.primaryId) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未获取到主键ID!', |
| | | duration: 10 |
| | | }) |
| | | } else { |
| | | this.loadmaindata() |
| | | } |
| | | this.loadmaindata() |
| | | } else if (config.setting.datatype !== 'query' && (!this.props.param.primaryId || !this.props.param.data)) { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | duration: 10 |
| | | }) |
| | | return null |
| | | } else if (!primaryId) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未获取到主键值!', |
| | | duration: 10 |
| | | }) |
| | | return null |
| | | } |
| | | |
| | | |
| | | let param = { |
| | | func: 'sPC_Get_TableData', |
| | |
| | | this.setState({ |
| | | loadingview: true |
| | | }) |
| | | |
| | | |
| | | menuParam.push({ |
| | | uuid: MenuID, |
| | | type: 'main', |
| | | label: MenuName + '(主表)', |
| | | easyCode: config.easyCode || '', |
| | | setting: { |
| | | actionfixed: config.setting.actionfixed, |
| | | columnfixed: config.setting.columnfixed, |
| | |
| | | sort: index |
| | | } |
| | | }) |
| | | |
| | | if (tab.type === 'main') { |
| | | _tab.easyCode = tab.easyCode |
| | | } |
| | | |
| | | _config[tab.uuid] = _tab |
| | | }) |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Tabs, Row, Col, Radio, Table, Icon, Select, notification } from 'antd' |
| | | import { Form, Tabs, Row, Col, Radio, Table, Icon, Select, notification, Input } from 'antd' |
| | | |
| | | import ActionForm from './actionform' |
| | | import ColumnForm from './columnform' |
| | |
| | | this.props.handleconfig(config.uuid, subconfig) |
| | | } |
| | | |
| | | changeEasyCode = ({ target: { value } }) => { |
| | | const { config } = this.props |
| | | let subconfig = JSON.parse(JSON.stringify(this.state.subconfig)) |
| | | |
| | | subconfig.easyCode = value |
| | | |
| | | this.setState({ |
| | | subconfig: subconfig |
| | | }) |
| | | this.props.handleconfig(config.uuid, subconfig) |
| | | } |
| | | |
| | | render() { |
| | | const { config } = this.props |
| | |
| | | <TabPane tab="基础设置" key="1"> |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | | {config.type === 'main' ? <Col span={8}> |
| | | <Form.Item label="固定按钮"> |
| | | <Radio.Group defaultValue={config.setting.actionfixed ? 'true' : 'false'} onChange={this.changebtnfix}> |
| | | <Radio value="true">是</Radio> |
| | | <Radio value="false">否</Radio> |
| | | </Radio.Group> |
| | | {config.type === 'main' ? <Col span={9}> |
| | | <Form.Item label="助记码"> |
| | | <Input defaultValue={config.easyCode} placeholder="" autoComplete="off" onChange={this.changeEasyCode}/> |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {config.type === 'main' ? <Col span={8}> |
| | | <Form.Item label="固定表头"> |
| | | <Radio.Group defaultValue={config.setting.columnfixed ? 'true' : 'false'} onChange={this.changecolfix}> |
| | | <Radio value="true">是</Radio> |
| | | <Radio value="false">否</Radio> |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={8}> |
| | | <Col span={9}> |
| | | <Form.Item label="表格属性"> |
| | | <Select defaultValue={config.setting.tableType} onChange={this.changecheckbox}> |
| | | <Select.Option value="">不可选</Select.Option> |
| | |
| | | </Select> |
| | | </Form.Item> |
| | | </Col> |
| | | {config.type === 'main' ? <Col span={9}> |
| | | <Form.Item label="固定按钮"> |
| | | <Radio.Group defaultValue={config.setting.actionfixed ? 'true' : 'false'} onChange={this.changebtnfix}> |
| | | <Radio value="true">是</Radio> |
| | | <Radio value="false">否</Radio> |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {config.type === 'main' ? <Col span={9}> |
| | | <Form.Item label="固定表头"> |
| | | <Radio.Group defaultValue={config.setting.columnfixed ? 'true' : 'false'} onChange={this.changecolfix}> |
| | | <Radio value="true">是</Radio> |
| | | <Radio value="false">否</Radio> |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> : null} |
| | | </Row> |
| | | </Form> |
| | | </TabPane> |
| | |
| | | thawBtnVisible: false, // 解冻按钮弹窗 |
| | | thawbtnlist: null, // 解冻按钮列表 |
| | | thawButtons: [], // 已选择要解冻的按钮 |
| | | activeKey: '0' // 默认展开基本信息 |
| | | activeKey: '0', // 默认展开基本信息 |
| | | sqlVerifing: false // sql验证 |
| | | } |
| | | |
| | | /** |
| | |
| | | _config.tabgroups = _config.tabgroups || ['tabs'] |
| | | _config.setting.subtabs = _config.setting.subtabs || [] |
| | | _config.Template = 'CommonTable' |
| | | _config.easyCode = _config.easyCode || '' |
| | | |
| | | let _oriActions = [] |
| | | if (_config.type === 'user') { |
| | |
| | | MenuID: 'currenttab', |
| | | text: this.state.dict['header.form.currenttab'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'easyCode', |
| | | label: this.state.dict['header.form.easyCode'], |
| | | initVal: _config.easyCode, |
| | | required: false, |
| | | readonly: false |
| | | } |
| | | ] |
| | | }) |
| | |
| | | |
| | | _search = _search.filter(item => !item.origin) |
| | | |
| | | this.setState({ |
| | | config: {...config, search: _search}, |
| | | optionLibs: optionLibs, |
| | | modaltype: '' |
| | | }) |
| | | if ((res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && res.resourceType === '1' && /\s/.test(res.dataSource)) { |
| | | this.setState({ |
| | | sqlVerifing: true |
| | | }) |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | LText: res.dataSource |
| | | } |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | if (window.GLOB.mainSystemApi && res.database === 'sso') { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | | config: {...config, search: _search}, |
| | | optionLibs: optionLibs, |
| | | modaltype: '' |
| | | }) |
| | | } else { |
| | | this.setState({sqlVerifing: false}) |
| | | |
| | | Modal.error({ |
| | | title: result.message |
| | | }) |
| | | } |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | config: {...config, search: _search}, |
| | | optionLibs: optionLibs, |
| | | modaltype: '' |
| | | }) |
| | | } |
| | | }) |
| | | } else if (modaltype === 'actionEdit' || modaltype === 'actionCopy') { |
| | | this.actionFormRef.handleConfirm().then(res => { |
| | |
| | | } |
| | | |
| | | let _LongParam = '' |
| | | let _config = {...config, tables: this.state.selectedTables} |
| | | let _config = {...config, tables: this.state.selectedTables, easyCode: res.easyCode} |
| | | let _pageParam = {...menu.PageParam, OpenType: res.opentype} |
| | | |
| | | // 未设置数据源或标签不合法时,启用状态为false |
| | |
| | | ParentID: res.parentId, |
| | | MenuID: menu.MenuID, |
| | | MenuNo: res.menuNo, |
| | | EasyCode: res.easyCode, |
| | | Template: menu.PageParam.Template || '', |
| | | MenuName: res.menuName, |
| | | PageParam: JSON.stringify(_pageParam), |
| | |
| | | }) |
| | | } else { |
| | | this.menuformRef.handleConfirm().then(res => { |
| | | let _config = {...config, tables: this.state.selectedTables} |
| | | let _config = {...config, tables: this.state.selectedTables, easyCode: res.easyCode} |
| | | let _pageParam = {...menu.PageParam, OpenType: res.opentype} |
| | | let _originMenu = { |
| | | ...originMenu, |
| | |
| | | Api.getLocalConfig(param) |
| | | } |
| | | |
| | | this.setState({ |
| | | config: {...config, setting: res}, |
| | | settingVisible: false, |
| | | }) |
| | | |
| | | |
| | | if (res.interType === 'inner' && !res.innerFunc && /\s/.test(res.dataresource)) { |
| | | this.setState({ |
| | | sqlVerifing: true |
| | | }) |
| | | |
| | | let _dataresource = res.dataresource |
| | | |
| | | if (res.queryType === 'statistics') { |
| | | let fieldmap = new Map() |
| | | let options = config.search.map(item => { |
| | | let _field = item.key |
| | | let _val = '' |
| | | |
| | | if (fieldmap.has(_field)) { |
| | | _field = _field + '1' |
| | | } |
| | | |
| | | fieldmap.set(item.key, true) |
| | | |
| | | if (/date/.test(item.type)) { |
| | | _val = '1900-01-01' |
| | | } |
| | | |
| | | return { |
| | | reg: new RegExp('@' + _field + '@', 'ig'), |
| | | value: _val |
| | | } |
| | | }) |
| | | |
| | | options.forEach(item => { |
| | | _dataresource = _dataresource.replace(item.reg, `'${item.value}'`) |
| | | }) |
| | | } |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | LText: _dataresource |
| | | } |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | | config: {...config, setting: res}, |
| | | settingVisible: false |
| | | }) |
| | | } else { |
| | | this.setState({sqlVerifing: false}) |
| | | |
| | | Modal.error({ |
| | | title: result.message |
| | | }) |
| | | } |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | config: {...config, setting: res}, |
| | | settingVisible: false |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | } else { |
| | | this.menuformRef.handleConfirm().then(res => { |
| | | let _config = {...config, tables: this.state.selectedTables} |
| | | let _config = {...config, tables: this.state.selectedTables, easyCode: res.easyCode} |
| | | let _pageParam = {...menu.PageParam, OpenType: res.opentype} |
| | | let _originMenu = { |
| | | ...originMenu, |
| | |
| | | width={700} |
| | | maskClosable={false} |
| | | onOk={this.handleSubmit} |
| | | confirmLoading={this.state.sqlVerifing} |
| | | onCancel={this.editModalCancel} |
| | | destroyOnClose |
| | | > |
| | |
| | | <CreateInterface key="interface" dict={this.state.dict} ref="tableCreatInterface" trigger={this.tableCreatInterface}/>, |
| | | <CreateFunc key="create" dict={this.state.dict} ref="tableCreatFunc" trigger={this.tableCreatFunc}/>, |
| | | <Button key="cancel" onClick={() => { this.setState({ settingVisible: false }) }}>{this.state.dict['header.cancel']}</Button>, |
| | | <Button key="confirm" type="primary" onClick={this.settingSave}>{this.state.dict['header.confirm']}</Button> |
| | | <Button key="confirm" type="primary" loading={this.state.sqlVerifing} onClick={this.settingSave}>{this.state.dict['header.confirm']}</Button> |
| | | ]} |
| | | destroyOnClose |
| | | > |
| | |
| | | groupVisible: false, // 编辑组模态框 |
| | | optionLibs: null, // 自定义下拉选项库 |
| | | activeKey: '0', // 默认展开基本信息 |
| | | pasteVisible: false // 粘贴模态框 |
| | | pasteVisible: false, // 粘贴模态框 |
| | | sqlVerifing: false // sql验证 |
| | | } |
| | | |
| | | /** |
| | |
| | | return |
| | | } |
| | | |
| | | this.setState({ |
| | | config: {..._config, groups: _groups}, |
| | | optionLibs: optionLibs, |
| | | modaltype: '' |
| | | }) |
| | | if ((res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && res.resourceType === '1' && /\s/.test(res.dataSource)) { |
| | | this.setState({ |
| | | sqlVerifing: true |
| | | }) |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | LText: res.dataSource |
| | | } |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | if (window.GLOB.mainSystemApi && res.database === 'sso') { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | | config: {..._config, groups: _groups}, |
| | | optionLibs: optionLibs, |
| | | modaltype: '' |
| | | }) |
| | | } else { |
| | | this.setState({sqlVerifing: false}) |
| | | |
| | | Modal.error({ |
| | | title: result.message |
| | | }) |
| | | } |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | config: {..._config, groups: _groups}, |
| | | optionLibs: optionLibs, |
| | | modaltype: '' |
| | | }) |
| | | } |
| | | }) |
| | | } else if (modaltype === 'actionEdit') { |
| | | this.actionFormRef.handleConfirm().then(res => { |
| | |
| | | Api.getLocalConfig(param) |
| | | } |
| | | |
| | | this.setState({ |
| | | config: {...config, setting: res}, |
| | | settingVisible: false, |
| | | }) |
| | | if (res.interType === 'inner' && !res.innerFunc && res.dataresource && /\s/.test(res.dataresource)) { |
| | | this.setState({ |
| | | sqlVerifing: true |
| | | }) |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | LText: res.dataresource |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | | config: {...config, setting: res}, |
| | | settingVisible: false |
| | | }) |
| | | } else { |
| | | this.setState({sqlVerifing: false}) |
| | | |
| | | Modal.error({ |
| | | title: result.message |
| | | }) |
| | | } |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | config: {...config, setting: res}, |
| | | settingVisible: false |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | width={700} |
| | | maskClosable={false} |
| | | onOk={this.handleSubmit} |
| | | confirmLoading={this.state.sqlVerifing} |
| | | onCancel={this.editModalCancel} |
| | | destroyOnClose |
| | | > |
| | |
| | | footer={[ |
| | | <CreateFunc key="create" dict={this.state.dict} ref="tableCreatFunc" trigger={this.tableCreatFunc}/>, |
| | | <Button key="cancel" onClick={() => { this.setState({ settingVisible: false }) }}>{this.state.dict['header.cancel']}</Button>, |
| | | <Button key="confirm" type="primary" onClick={this.settingSave}>{this.state.dict['header.confirm']}</Button> |
| | | <Button key="confirm" type="primary" loading={this.state.sqlVerifing} onClick={this.settingSave}>{this.state.dict['header.confirm']}</Button> |
| | | ]} |
| | | destroyOnClose |
| | | > |
| | |
| | | curgroup: null, // 当前组,新建或编辑 |
| | | optionLibs: null, // 自定义下拉选项库 |
| | | sources: null, // 表单类型 |
| | | pasteVisible: null // 表单粘贴 |
| | | pasteVisible: null, // 表单粘贴 |
| | | sqlVerifing: false // sql验证 |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | _config.fields = _config.fields.filter(item => !item.origin) |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | modalType: null, |
| | | card: null, |
| | | optionLibs: optionLibs, |
| | | visible: false |
| | | }) |
| | | if ((res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && res.resourceType === '1' && /\s/.test(res.dataSource)) { |
| | | this.setState({ |
| | | sqlVerifing: true |
| | | }) |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | LText: res.dataSource |
| | | } |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | if (window.GLOB.mainSystemApi && res.database === 'sso') { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | | config: _config, |
| | | modalType: null, |
| | | card: null, |
| | | optionLibs: optionLibs, |
| | | visible: false |
| | | }) |
| | | } else { |
| | | this.setState({sqlVerifing: false}) |
| | | |
| | | Modal.error({ |
| | | title: result.message |
| | | }) |
| | | } |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | config: _config, |
| | | modalType: null, |
| | | card: null, |
| | | optionLibs: optionLibs, |
| | | visible: false |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | width={700} |
| | | onCancel={this.editModalCancel} |
| | | onOk={this.handleSubmit} |
| | | confirmLoading={this.state.sqlVerifing} |
| | | destroyOnClose |
| | | > |
| | | {<ModalForm |
| | |
| | | thawBtnVisible: false, // 解冻按钮弹窗 |
| | | thawbtnlist: null, // 解冻按钮列表 |
| | | thawButtons: [], // 已选择要解冻的按钮 |
| | | activeKey: '0' // 默认展开基本信息 |
| | | activeKey: '0', // 默认展开基本信息 |
| | | sqlVerifing: false // sql验证 |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | _search = _search.filter(item => !item.origin) |
| | | |
| | | this.setState({ |
| | | config: {...config, search: _search}, |
| | | optionLibs: optionLibs, |
| | | modaltype: '' |
| | | }) |
| | | if ((res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && res.resourceType === '1' && /\s/.test(res.dataSource)) { |
| | | this.setState({ |
| | | sqlVerifing: true |
| | | }) |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | LText: res.dataSource |
| | | } |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | if (window.GLOB.mainSystemApi && res.database === 'sso') { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | | config: {...config, search: _search}, |
| | | optionLibs: optionLibs, |
| | | modaltype: '' |
| | | }) |
| | | } else { |
| | | this.setState({sqlVerifing: false}) |
| | | |
| | | Modal.error({ |
| | | title: result.message |
| | | }) |
| | | } |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | config: {...config, search: _search}, |
| | | optionLibs: optionLibs, |
| | | modaltype: '' |
| | | }) |
| | | } |
| | | }) |
| | | } else if (modaltype === 'actionEdit' || modaltype === 'actionCopy') { |
| | | this.actionFormRef.handleConfirm().then(res => { |
| | |
| | | Api.getLocalConfig(param) |
| | | } |
| | | |
| | | this.setState({ |
| | | config: {...config, setting: res}, |
| | | settingVisible: false, |
| | | }) |
| | | if (res.interType === 'inner' && !res.innerFunc && res.dataresource && /\s/.test(res.dataresource)) { |
| | | this.setState({ |
| | | sqlVerifing: true |
| | | }) |
| | | |
| | | let _dataresource = res.dataresource |
| | | |
| | | if (res.queryType === 'statistics') { |
| | | let fieldmap = new Map() |
| | | let options = config.search.map(item => { |
| | | let _field = item.key |
| | | let _val = '' |
| | | |
| | | if (fieldmap.has(_field)) { |
| | | _field = _field + '1' |
| | | } |
| | | |
| | | fieldmap.set(item.key, true) |
| | | |
| | | if (/date/.test(item.type)) { |
| | | _val = '1900-01-01' |
| | | } |
| | | |
| | | return { |
| | | reg: new RegExp('@' + _field + '@', 'ig'), |
| | | value: _val |
| | | } |
| | | }) |
| | | |
| | | options.forEach(item => { |
| | | _dataresource = _dataresource.replace(item.reg, `'${item.value}'`) |
| | | }) |
| | | } |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | LText: _dataresource |
| | | } |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | | config: {...config, setting: res}, |
| | | settingVisible: false |
| | | }) |
| | | } else { |
| | | this.setState({sqlVerifing: false}) |
| | | |
| | | Modal.error({ |
| | | title: result.message |
| | | }) |
| | | } |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | config: {...config, setting: res}, |
| | | settingVisible: false |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | width={700} |
| | | maskClosable={false} |
| | | onOk={this.handleSubmit} |
| | | confirmLoading={this.state.sqlVerifing} |
| | | onCancel={this.editModalCancel} |
| | | destroyOnClose |
| | | > |
| | |
| | | <CreateInterface key="interface" dict={this.state.dict} ref="tableCreatInterface" trigger={this.tableCreatInterface}/>, |
| | | <CreateFunc key="create" dict={this.state.dict} ref="tableCreatFunc" trigger={this.tableCreatFunc}/>, |
| | | <Button key="cancel" onClick={() => { this.setState({ settingVisible: false }) }}>{this.state.dict['header.cancel']}</Button>, |
| | | <Button key="confirm" type="primary" onClick={this.settingSave}>{this.state.dict['header.confirm']}</Button> |
| | | <Button key="confirm" type="primary" loading={this.state.sqlVerifing} onClick={this.settingSave}>{this.state.dict['header.confirm']}</Button> |
| | | ]} |
| | | destroyOnClose |
| | | > |
| | |
| | | let _type = this.props.formlist.filter(form => form.key === 'type')[0].initVal |
| | | let _menulist = this.props.formlist.filter(form => form.key === 'linkmenu')[0] || '' |
| | | |
| | | let _options = columnTypeOptions[_type] |
| | | let _options = JSON.parse(JSON.stringify(columnTypeOptions[_type])) |
| | | |
| | | this.setState({ |
| | | menulist: _menulist.options || [], |
| | |
| | | |
| | | typeChange = (key, value) => { |
| | | if (key === 'type') { |
| | | let _options = columnTypeOptions[value] |
| | | let _options = JSON.parse(JSON.stringify(columnTypeOptions[value])) |
| | | |
| | | this.setState({ |
| | | formlist: this.props.formlist.map(item => { |
| | |
| | | } |
| | | }) |
| | | |
| | | let _options = modalTypeOptions[type] |
| | | let _options = JSON.parse(JSON.stringify(modalTypeOptions[type])) |
| | | |
| | | if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '0') { // 选择类型、自定义资源 |
| | | _options = [..._options, 'options', 'quick'] |
| | |
| | | |
| | | openTypeChange = (key, value) => { |
| | | if (key === 'type') { |
| | | let _options = modalTypeOptions[value] |
| | | let _options = JSON.parse(JSON.stringify(modalTypeOptions[value])) |
| | | |
| | | if ((value === 'multiselect' || value === 'select' || value === 'link') && this.state.resourceType === '0') { // 选择类型、自定义资源 |
| | | _options = [..._options, 'options', 'quick'] |
| | |
| | | const { openType } = this.state |
| | | let value = e.target.value |
| | | if (key === 'resourceType') { |
| | | let _options = modalTypeOptions[openType] |
| | | let _options = JSON.parse(JSON.stringify(modalTypeOptions[openType])) |
| | | |
| | | if (value === '0') { |
| | | _options = [..._options, 'options', 'quick'] |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, Button, notification } from 'antd' |
| | | import { Form, Row, Col, Input, Select, Button, notification, Modal } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | }) |
| | | } else { |
| | | this.setState({loading: false}) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | |
| | | Modal.error({ |
| | | title: res.message |
| | | }) |
| | | } |
| | | }) |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Button, notification } from 'antd' |
| | | import { Form, Row, Col, Input, Button, notification, Modal } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | }) |
| | | } else { |
| | | this.setState({loading: false}) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | |
| | | Modal.error({ |
| | | title: res.message |
| | | }) |
| | | } |
| | | }) |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Button, notification } from 'antd' |
| | | import { Form, Row, Col, Input, Button, notification, Modal } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import Api from '@/api' |
| | | import './index.scss' |
| | | |
| | | const { TextArea } = Input |
| | |
| | | btn: PropTypes.object, // 按钮信息 |
| | | scripts: PropTypes.array, // 自定义脚本列表 |
| | | isdefault: PropTypes.any, // 是否使用默认sql |
| | | usefulfields: PropTypes.string, // 可用字段 |
| | | usefulfields: PropTypes.any, // 可用字段 |
| | | scriptsChange: PropTypes.func // 表单 |
| | | } |
| | | |
| | | state = { |
| | | editItem: null, |
| | | usefulfields: null |
| | | usefulfields: null, |
| | | loading: false, |
| | | verifySql: '' |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const {usefulfields} = this.props |
| | | const {usefulfields, btn} = this.props |
| | | |
| | | let fields = usefulfields.map(item => item.Column) |
| | | fields = ['BID', 'ID', ...fields] |
| | | fields = Array.from(new Set(fields)) |
| | | if (!fields.includes('ID')) { |
| | | fields.unshift('ID') |
| | | } |
| | | if (!fields.includes('BID')) { |
| | | fields.unshift('BID') |
| | | } |
| | | |
| | | let _sql = `Declare @${btn.sheet} table (${usefulfields.map(item => item.Column + ' ' + item.type).join(',')},jskey nvarchar(50) ) |
| | | Declare @UserName nvarchar(50),@FullName nvarchar(50) |
| | | ` |
| | | |
| | | this.setState({ |
| | | verifySql: _sql, |
| | | usefulfields: fields.join(', ') |
| | | }) |
| | | } |
| | |
| | | |
| | | this.props.form.setFieldsValue({ |
| | | sql: `Insert into ${btn.sheet} (${fields},createuserid,createuser,createstaff,bid) |
| | | Select ${fields},@userid,@username,@fullname,@BID From @${btn.sheet}` |
| | | Select ${fields},@userid@,@username,@fullname,@BID@ From @${btn.sheet}` |
| | | }) |
| | | } |
| | | } |
| | |
| | | return |
| | | } |
| | | |
| | | this.props.scriptsChange(values) |
| | | this.setState({ |
| | | editItem: null |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | sql: '' |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | LText: this.state.verifySql + values.sql |
| | | } |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | this.setState({loading: true}) |
| | | Api.getLocalConfig(param).then(res => { |
| | | if (res.status) { |
| | | this.props.scriptsChange(values) |
| | | this.setState({ |
| | | loading: false, |
| | | editItem: null |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | sql: '' |
| | | }) |
| | | } else { |
| | | this.setState({loading: false}) |
| | | |
| | | Modal.error({ |
| | | title: res.message |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={3} className="add"> |
| | | <Button onClick={this.handleConfirm} type="primary" className="add-row"> |
| | | <Button onClick={this.handleConfirm} loading={this.state.loading} type="primary" className="add-row"> |
| | | 确定 |
| | | </Button> |
| | | </Col> |
| | |
| | | import './index.scss' |
| | | |
| | | const { TabPane } = Tabs |
| | | const { confirm } = Modal |
| | | |
| | | class VerifyCard extends Component { |
| | | static propTpyes = { |
| | |
| | | } |
| | | |
| | | state = { |
| | | updateloading: false, // 修改中 |
| | | verify: {}, |
| | | excelColumns: [ |
| | | { |
| | |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }, () => { |
| | | this.updateChange() |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }, () => { |
| | | this.updateChange() |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }, () => { |
| | | this.updateChange() |
| | | }) |
| | | } |
| | | |
| | | updateChange = () => { |
| | | let _loading = false |
| | | if (this.columnForm && this.columnForm.state.editItem) { |
| | | _loading = true |
| | | } else if (this.scriptsForm && this.scriptsForm.state.editItem) { |
| | | _loading = true |
| | | } else if (this.uniqueForm && this.uniqueForm.state.editItem) { |
| | | _loading = true |
| | | } |
| | | |
| | | this.setState({ |
| | | updateloading: _loading |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | }, 10) |
| | | } |
| | | |
| | | this.setState({ |
| | | updateloading: true |
| | | }) |
| | | } |
| | | |
| | | handleStatus = (record, type) => { |
| | |
| | | } |
| | | } |
| | | |
| | | resolve(_verify) |
| | | if (this.state.updateloading) { |
| | | confirm({ |
| | | content: `存在未保存项,确定提交吗?`, |
| | | okText: this.props.dict['header.confirm'], |
| | | cancelText: this.props.dict['header.cancel'], |
| | | onOk() { |
| | | resolve(_verify) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | resolve(_verify) |
| | | } |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |