| | |
| | | import PropTypes from 'prop-types' |
| | | import {connect} from 'react-redux' |
| | | import { is, fromJS } from 'immutable' |
| | | import { notification, Spin, Tabs, Icon, Switch, Modal, Button} from 'antd' |
| | | import { notification, Spin, Tabs, Icon, Switch, Modal, Button, message, Tree, Typography } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | |
| | | const SubTabTable = asyncComponent(() => import('@/tabviews/subtabtable')) |
| | | const FormTab = asyncComponent(() => import('@/tabviews/formtab')) |
| | | const { TabPane } = Tabs |
| | | const { TreeNode } = Tree |
| | | const { Paragraph } = Typography |
| | | |
| | | class NormalTable extends Component { |
| | | static propTpyes = { |
| | |
| | | popAction: false, // 弹框页面,按钮信息 |
| | | popData: false, // 弹框页面,所选的表格数据 |
| | | visible: false, // 弹框显示隐藏控制 |
| | | treevisible: false, // 菜单结构树弹框显示隐藏控制 |
| | | tabBtn: null, // 表单标签按钮 |
| | | tabParam: null, // 表单标签参数 |
| | | refreshtabs: null // 需要刷新的标签集 |
| | |
| | | this.refreshbyaction(this.state.popAction, 'pop') |
| | | } |
| | | |
| | | handleviewconfig = (e) => { |
| | | e.stopPropagation() |
| | | |
| | | const { MenuNo } = this.props |
| | | const { config } = this.state |
| | | |
| | | if (config && config.funcs && config.funcs.length > 0) { |
| | | this.setState({ |
| | | treevisible: true |
| | | }) |
| | | } else { |
| | | let oInput = document.createElement('input') |
| | | oInput.value = MenuNo || '' |
| | | document.body.appendChild(oInput) |
| | | oInput.select() |
| | | document.execCommand('Copy') |
| | | document.body.removeChild(oInput) |
| | | message.success(this.state.dict['main.copy.success']) |
| | | } |
| | | } |
| | | |
| | | getTreeNode = (data) => { |
| | | let _type = { |
| | | view: '页面', |
| | | btn: '按钮', |
| | | tab: '标签' |
| | | } |
| | | |
| | | return data.map(item => { |
| | | let _title = _type[item.subtype] |
| | | let _others = [] |
| | | |
| | | _others.push( |
| | | (item.menuNo ? item.menuNo + '(菜单参数)' : ''), |
| | | (item.tableName ? item.tableName + '(表名) ' : ''), |
| | | (item.innerFunc ? item.innerFunc + '(内部函数) ' : ''), |
| | | (item.outerFunc ? item.outerFunc + '(外部函数)' : '') |
| | | ) |
| | | _others = _others.filter(Boolean) |
| | | _others = _others.join('、') |
| | | |
| | | if (item.label) { |
| | | _title = _title + '(' + item.label + ')' |
| | | } |
| | | if (_others) { |
| | | _title = _title + ': ' + _others |
| | | } |
| | | |
| | | if (item.subfuncs && item.subfuncs.length > 0) { |
| | | return ( |
| | | <TreeNode title={_title} key={item.uuid} dataRef={item} selectable={false}> |
| | | {this.getTreeNode(item.subfuncs)} |
| | | </TreeNode> |
| | | ) |
| | | } |
| | | return <TreeNode key={item.uuid} title={_title} isLeaf selectable={false} /> |
| | | }) |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | // 组件加载时,获取菜单数据 |
| | | this.loadconfig() |
| | |
| | | icon="copy" |
| | | shape="circle" |
| | | className="common-table-copy" |
| | | onClick={this.copyMenuNo} |
| | | onClick={this.handleviewconfig} |
| | | /> |
| | | <Modal |
| | | className="popview-modal" |
| | |
| | | refreshSupView={this.reloadtable} |
| | | />} |
| | | </Modal> |
| | | <Modal |
| | | className="menu-tree-modal" |
| | | title={'菜单结构树'} |
| | | width={'650px'} |
| | | maskClosable={false} |
| | | visible={this.state.treevisible} |
| | | onCancel={() => this.setState({treevisible: false})} |
| | | footer={[ |
| | | <Button key="close" onClick={() => this.setState({treevisible: false})}>{this.state.dict['main.close']}</Button> |
| | | ]} |
| | | destroyOnClose |
| | | > |
| | | <div className="menu-header"> |
| | | <span>菜单名称:{this.props.MenuName}</span> |
| | | <span>菜单参数:{<Paragraph copyable>{this.props.MenuNo}</Paragraph>}</span> |
| | | </div> |
| | | {this.state.treevisible ? <Tree defaultExpandAll showLine={true}> |
| | | {this.getTreeNode(config.funcs)} |
| | | </Tree> : null} |
| | | </Modal> |
| | | {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} |
| | | </div> : null} |
| | | {view === 'formtab' ? <FormTab MenuID={this.state.tabBtn.uuid} param={this.state.tabParam} refresh={this.refreshbyformtab}/> : null} |
| | |
| | | .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; |
| | | } |
| | | } |
| | | } |
| | |
| | | .button-list.formtab-button { |
| | | padding: 20px 20px 10px; |
| | | background: #ffffff; |
| | | text-align: center; |
| | | button { |
| | | min-width: 65px; |
| | | margin-right: 15px; |
| | | min-width: 70px; |
| | | margin-right: 20px; |
| | | margin-bottom: 10px; |
| | | height: 35px; |
| | | font-size: 15px; |
| | | padding: 5px 20px; |
| | | } |
| | | .ant-spin { |
| | | position: fixed; |
| | |
| | | _config.action = _config.action.map(item => { |
| | | let uuid = Utils.getuuid() |
| | | |
| | | if (item.OpenType === 'pop') { // 含有子配置项的按钮。。。 |
| | | if (item.OpenType === 'pop') { // 含有子配置项的按钮(表单) |
| | | _oriActions.push({ |
| | | prebtn: JSON.parse(JSON.stringify(item)), |
| | | curuuid: uuid, |
| | | Template: 'Modal' |
| | | }) |
| | | } else if (item.OpenType === 'tab' || item.OpenType === 'blank') { // 含有子配置项的按钮(标签后当前页打开) |
| | | _oriActions.push({ |
| | | prebtn: JSON.parse(JSON.stringify(item)), |
| | | curuuid: uuid, |
| | | Template: item.tabTemplate |
| | | }) |
| | | } |
| | | |
| | |
| | | this.props.handleView({tabview: 'template'}) |
| | | } |
| | | |
| | | getFuncNames = (data, funcNames, tableNames) => { |
| | | data.forEach(item => { |
| | | if (item.subfuncs) { |
| | | this.getFuncNames(item.subfuncs, funcNames, tableNames) |
| | | } else { |
| | | if (item.tableName) { |
| | | tableNames.push(item.tableName) |
| | | } |
| | | if (item.innerFunc) { |
| | | funcNames.push(item.innerFunc) |
| | | } |
| | | // if (item.outerFunc) { |
| | | // funcNames.push(item.outerFunc) |
| | | // } |
| | | if (item.callbackFunc) { |
| | | funcNames.push(item.callbackFunc) |
| | | } |
| | | } |
| | | }) |
| | | |
| | | return { |
| | | func: funcNames, |
| | | table: tableNames |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 三级菜单保存 |
| | | */ |
| | |
| | | subtype: 'btn', |
| | | uuid: item.uuid, |
| | | label: item.label, |
| | | tablename: tablename, |
| | | tableName: tablename, |
| | | intertype: item.intertype, |
| | | interface: item.interface || '', |
| | | innerFunc: item.innerFunc || '', |
| | |
| | | Template: menu.PageParam.Template || '', |
| | | PageParam: '', |
| | | LongParam: '', |
| | | LText: config.action.map((item, index) => { |
| | | LText: _config.action.map((item, index) => { |
| | | return `select '${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort` |
| | | }) |
| | | } |
| | |
| | | let tabParam = { // 添加菜单tab页 |
| | | func: 'sPC_sMenusTab_AddUpt', |
| | | MenuID: menu.MenuID, |
| | | LText: config.tabs.map((item, index) => { |
| | | LText: _config.tabs.map((item, index) => { |
| | | return `select '${menu.MenuID}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${(index + 1) * 10}' as Sort` |
| | | }) |
| | | } |
| | | |
| | | tabParam.LText = tabParam.LText.join(' union all ') |
| | | tabParam.LText = Utils.formatOptions(tabParam.LText) |
| | | tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) |
| | | |
| | | let _vals = this.getFuncNames(_config.funcs, [], []) |
| | | let _funcs = Array.from(new Set(_vals.func)) |
| | | let _tables = Array.from(new Set(_vals.table)) |
| | | |
| | | let param = { |
| | | func: 'sPC_TrdMenu_AddUpt', |
| | | ParentID: res.parentId, |
| | |
| | | MenuName: res.menuName, |
| | | Sort: (this.props.supMenuList.length + 1) * 10, |
| | | PageParam: JSON.stringify(_pageParam), |
| | | LongParam: _LongParam |
| | | LongParam: _LongParam, |
| | | LText: _funcs.map(item => `select '${menu.MenuID}' as MenuID,'${item}' as ProcName`), |
| | | LTexttb: _tables.map(item => `select '${menu.MenuID}' as MenuID,'${item}' as tbName`) |
| | | } |
| | | |
| | | |
| | | param.LText = param.LText.join(' union all ') |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.LTexttb = param.LTexttb.join(' union all ') |
| | | param.LTexttb = Utils.formatOptions(param.LTexttb) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | // 有按钮或标签删除时,先进行删除操作 |
| | | // 删除成功后,保存页面配置 |
| | | new Promise(resolve => { |
| | |
| | | }).then(response => { |
| | | if (response === false) return response |
| | | |
| | | if (!this.state.originActions || this.state.originActions.length === 0) return 'true' |
| | | |
| | | let oriActions = [] |
| | | this.state.originActions.forEach(item => { |
| | | let curBtn = config.action.filter(cell => item.curuuid === cell.uuid)[0] // 查看初始化按钮是否存在 |
| | |
| | | }).then(result => { |
| | | if (result.status && result.LongParam) { |
| | | let _LongParam = '' |
| | | |
| | | let _temp = '' |
| | | |
| | | if (result.LongParam) { |
| | | let _subconfig = '' |
| | | try { |
| | | _LongParam = window.decodeURIComponent(window.atob(result.LongParam)) |
| | | _LongParam = JSON.parse(_LongParam) |
| | | _subconfig = window.decodeURIComponent(window.atob(result.LongParam)) |
| | | _subconfig = JSON.parse(_subconfig) |
| | | _temp = _subconfig.type |
| | | } catch (e) { |
| | | _LongParam = '' |
| | | _subconfig = '' |
| | | } |
| | | |
| | | if (_temp === 'FormTab') { |
| | | try { |
| | | _subconfig.action = _subconfig.action.map(_btn => { |
| | | _btn.uuid = Utils.getuuid() |
| | | |
| | | return _btn |
| | | }) |
| | | _subconfig.tabgroups.forEach(_groupId => { |
| | | _subconfig[_groupId] = _subconfig[_groupId].map(_tab => { |
| | | _tab.uuid = Utils.getuuid() |
| | | |
| | | return _tab |
| | | }) |
| | | }) |
| | | _subconfig = window.btoa(window.encodeURIComponent(JSON.stringify(_subconfig))) |
| | | } catch { |
| | | _subconfig = '' |
| | | } |
| | | } |
| | | |
| | | _LongParam = _subconfig |
| | | } |
| | | |
| | | if (_LongParam) { |
| | |
| | | ParentID: this.props.menu.MenuID, |
| | | MenuID: action.curBtn.uuid, |
| | | MenuNo: this.props.menu.MenuNo, |
| | | Template: _LongParam.type, |
| | | Template: _temp, |
| | | MenuName: action.curBtn.label, |
| | | PageParam: JSON.stringify({Template: _LongParam.type}), |
| | | LongParam: result.LongParam |
| | | PageParam: JSON.stringify({Template: _temp}), |
| | | LongParam: _LongParam |
| | | } |
| | | Api.getSystemConfig(param).then(() => {}) |
| | | } |
| | |
| | | this.props.handleView() |
| | | } else { |
| | | this.setState({ |
| | | originActions: [], |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | |
| | | subtype: 'btn', |
| | | uuid: item.uuid, |
| | | label: item.label, |
| | | tablename: item.sql || '', |
| | | tableName: item.sql || '', |
| | | intertype: item.intertype, |
| | | interface: item.interface || '', |
| | | innerFunc: item.innerFunc || '', |
| | |
| | | } |
| | | |
| | | .action-list { |
| | | position: relative; |
| | | padding: 0px 20px 15px; |
| | | min-height: 82px; |
| | | text-align: center; |
| | | > .ant-row { |
| | | min-height: 67px; |
| | | } |
| | |
| | | } |
| | | button { |
| | | cursor: move; |
| | | min-width: 65px; |
| | | min-width: 70px; |
| | | margin-right: 10px; |
| | | height: 35px; |
| | | font-size: 15px; |
| | | padding: 5px 20px; |
| | | .anticon-table { |
| | | font-size: 10px; |
| | | position: absolute; |
| | |
| | | display: inline-block; |
| | | } |
| | | } |
| | | .anticon-question-circle { |
| | | position: absolute; |
| | | left: 5px; |
| | | } |
| | | } |
| | | .tab-list { |
| | | position: relative; |
| | |
| | | |
| | | import Api from '@/api' |
| | | import zhCN from '@/locales/zh-CN/comtable.js' |
| | | import enUS from '@/locales/en-US/comtable.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import enUS from '@/locales/en-US/comtable.js' |
| | | import { getModalForm } from '@/templates/tableshare/formconfig' |
| | | import { queryTableSql } from '@/utils/option.js' |
| | | |
| | |
| | | searchItems = [ |
| | | { |
| | | type: 'form', |
| | | label: '文本框', |
| | | label: CommonDict['header.form.text'], |
| | | subType: 'text', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: '数值框', |
| | | label: CommonDict['header.form.number'], |
| | | subType: 'number', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: '下拉框', |
| | | label: CommonDict['header.form.select'], |
| | | subType: 'select', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: '文件上传', |
| | | label: CommonDict['header.form.multiselect'], |
| | | subType: 'multiselect', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: CommonDict['header.form.link'], |
| | | subType: 'link', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: CommonDict['header.form.fileupload'], |
| | | subType: 'fileupload', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: '时间框(天)', |
| | | label: CommonDict['header.form.dateday'], |
| | | subType: 'date', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: '时间框(月)', |
| | | label: CommonDict['header.form.datemonth'], |
| | | subType: 'datemonth', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: '时间框(秒)', |
| | | label: CommonDict['header.form.datetime'], |
| | | subType: 'datetime', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: CommonDict['header.form.textarea'], |
| | | subType: 'textarea', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: CommonDict['header.form.funcvar'], |
| | | subType: 'funcvar', |
| | | url: '' |
| | |
| | | subtype: 'btn', |
| | | uuid: item.uuid, |
| | | label: item.label, |
| | | tablename: tablename, |
| | | tableName: tablename, |
| | | intertype: item.intertype, |
| | | interface: item.interface || '', |
| | | innerFunc: item.innerFunc || '', |