From fc6920985f8177f153e376fe7669c272d6b3d184 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 21 二月 2020 22:02:56 +0800 Subject: [PATCH] 2020-02-21 --- src/tabviews/commontable/index.scss | 19 +++ src/templates/modalconfig/index.jsx | 2 src/templates/modalconfig/source.jsx | 32 +++++- src/tabviews/commontable/index.jsx | 86 ++++++++++++++++ src/templates/formtabconfig/index.jsx | 2 src/tabviews/formtab/actionList/index.scss | 8 + src/templates/comtableconfig/index.jsx | 100 +++++++++++++++++-- src/templates/formtabconfig/index.scss | 12 ++ src/templates/subtableconfig/index.jsx | 2 9 files changed, 235 insertions(+), 28 deletions(-) diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 44b4dc8..47c50fa 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -2,7 +2,7 @@ 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' @@ -22,6 +22,8 @@ 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 = { @@ -58,6 +60,7 @@ popAction: false, // 寮规椤甸潰锛屾寜閽俊鎭� popData: false, // 寮规椤甸潰锛屾墍閫夌殑琛ㄦ牸鏁版嵁 visible: false, // 寮规鏄剧ず闅愯棌鎺у埗 + treevisible: false, // 鑿滃崟缁撴瀯鏍戝脊妗嗘樉绀洪殣钘忔帶鍒� tabBtn: null, // 琛ㄥ崟鏍囩鎸夐挳 tabParam: null, // 琛ㄥ崟鏍囩鍙傛暟 refreshtabs: null // 闇�瑕佸埛鏂扮殑鏍囩闆� @@ -756,6 +759,65 @@ 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() @@ -878,7 +940,7 @@ icon="copy" shape="circle" className="common-table-copy" - onClick={this.copyMenuNo} + onClick={this.handleviewconfig} /> <Modal className="popview-modal" @@ -902,6 +964,26 @@ 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} diff --git a/src/tabviews/commontable/index.scss b/src/tabviews/commontable/index.scss index 2321484..847136c 100644 --- a/src/tabviews/commontable/index.scss +++ b/src/tabviews/commontable/index.scss @@ -87,4 +87,23 @@ .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; + } + } } \ No newline at end of file diff --git a/src/tabviews/formtab/actionList/index.scss b/src/tabviews/formtab/actionList/index.scss index 7e84e37..3a6a441 100644 --- a/src/tabviews/formtab/actionList/index.scss +++ b/src/tabviews/formtab/actionList/index.scss @@ -1,10 +1,14 @@ .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; diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index c150227..5f01667 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -105,11 +105,17 @@ _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 }) } @@ -1444,6 +1450,32 @@ 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 涓夌骇鑿滃崟淇濆瓨 */ @@ -1529,7 +1561,7 @@ subtype: 'btn', uuid: item.uuid, label: item.label, - tablename: tablename, + tableName: tablename, intertype: item.intertype, interface: item.interface || '', innerFunc: item.innerFunc || '', @@ -1632,7 +1664,7 @@ 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` }) } @@ -1645,15 +1677,20 @@ 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, @@ -1663,9 +1700,18 @@ 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 => { @@ -1811,6 +1857,8 @@ }).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] // 鏌ョ湅鍒濆鍖栨寜閽槸鍚﹀瓨鍦� @@ -1834,14 +1882,39 @@ }).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) { @@ -1850,10 +1923,10 @@ 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(() => {}) } @@ -1872,6 +1945,7 @@ this.props.handleView() } else { this.setState({ + originActions: [], menuloading: false, menucloseloading: false }) diff --git a/src/templates/formtabconfig/index.jsx b/src/templates/formtabconfig/index.jsx index ec9ca6c..1d89f85 100644 --- a/src/templates/formtabconfig/index.jsx +++ b/src/templates/formtabconfig/index.jsx @@ -1232,7 +1232,7 @@ subtype: 'btn', uuid: item.uuid, label: item.label, - tablename: item.sql || '', + tableName: item.sql || '', intertype: item.intertype, interface: item.interface || '', innerFunc: item.innerFunc || '', diff --git a/src/templates/formtabconfig/index.scss b/src/templates/formtabconfig/index.scss index 32dd704..124604a 100644 --- a/src/templates/formtabconfig/index.scss +++ b/src/templates/formtabconfig/index.scss @@ -279,8 +279,10 @@ } .action-list { + position: relative; padding: 0px 20px 15px; min-height: 82px; + text-align: center; > .ant-row { min-height: 67px; } @@ -313,7 +315,11 @@ } 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; @@ -327,6 +333,10 @@ display: inline-block; } } + .anticon-question-circle { + position: absolute; + left: 5px; + } } .tab-list { position: relative; diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index df9065f..9982fb4 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -8,8 +8,8 @@ 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' diff --git a/src/templates/modalconfig/source.jsx b/src/templates/modalconfig/source.jsx index ea95e00..0cb243c 100644 --- a/src/templates/modalconfig/source.jsx +++ b/src/templates/modalconfig/source.jsx @@ -75,48 +75,66 @@ 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: '' diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index d1d9d49..d649cfb 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -1261,7 +1261,7 @@ subtype: 'btn', uuid: item.uuid, label: item.label, - tablename: tablename, + tableName: tablename, intertype: item.intertype, interface: item.interface || '', innerFunc: item.innerFunc || '', -- Gitblit v1.8.0