From 1dfd49b103e721f9bb63fd4d472b6fcc225d94a1 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 12 三月 2020 18:42:20 +0800 Subject: [PATCH] 2020-03-12 --- src/components/tabview/index.scss | 85 ++++---- src/tabviews/formtab/index.jsx | 9 src/views/login/loginform.jsx | 17 + src/tabviews/rolemanage/index.jsx | 288 +++++++++++++++++++++++++++- src/templates/formtabconfig/index.jsx | 10 src/tabviews/managetable/index.jsx | 6 src/templates/comtableconfig/index.jsx | 33 ++ src/tabviews/rolemanage/index.scss | 66 +++++- src/tabviews/commontable/index.scss | 3 src/templates/tableshare/tabdragelement/index.jsx | 2 src/api/index.js | 2 src/components/sidemenu/index.jsx | 63 +++++ src/tabviews/commontable/index.jsx | 9 src/views/login/index.jsx | 4 14 files changed, 485 insertions(+), 112 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index ed5c5de..55c446a 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -300,6 +300,7 @@ param.lang = localStorage.getItem('lang') || '' param.SessionUid = sessionStorage.getItem('SessionUid') || '' param.LoginUID = sessionStorage.getItem('LoginUID') || '' + param.appkey = window.GLOB.appkey || '' if (sessionStorage.getItem('isEditState') === 'true' && param.rduri === options.cloudServiceApi) { // HS涓嬭彍鍗� param.userid = sessionStorage.getItem('CloudUserID') @@ -336,6 +337,7 @@ param.lang = localStorage.getItem('lang') || '' param.SessionUid = sessionStorage.getItem('SessionUid') || '' param.LoginUID = sessionStorage.getItem('LoginUID') || '' + param.appkey = window.GLOB.appkey || '' return new Promise(resolve => { axios({ diff --git a/src/components/sidemenu/index.jsx b/src/components/sidemenu/index.jsx index 23196c0..6328403 100644 --- a/src/components/sidemenu/index.jsx +++ b/src/components/sidemenu/index.jsx @@ -185,18 +185,63 @@ src: '', PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, type: 'ManageTable', - MenuID: '1578900109100np8aqd0a77q3na46oas', - MenuNo: 'sPrintTemplateM', - 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: '楂橀樁鏌ヨ' }] }] this.setState({ @@ -233,7 +278,7 @@ } UNSAFE_componentWillReceiveProps (nextProps) { - if (nextProps.mainMenu && nextProps.mainMenu.MenuID === 'systemManageView') { + if (!is(fromJS(this.props.mainMenu), fromJS(nextProps.mainMenu)) && nextProps.mainMenu && nextProps.mainMenu.MenuID === 'systemManageView') { this.enterManageView() } else if (!is(fromJS(this.props.mainMenu), fromJS(nextProps.mainMenu))) { // 涓昏彍鍗曞垏鎹紝璇锋眰2銆�3绾ц彍鍗曟暟鎹� diff --git a/src/components/tabview/index.scss b/src/components/tabview/index.scss index 1705069..55a07e0 100644 --- a/src/components/tabview/index.scss +++ b/src/components/tabview/index.scss @@ -2,51 +2,54 @@ padding-top: 48px; max-width: calc(100% - 235px); transition: max-width 0.2s; - .content-header { + >.content-header { width: 100%; height: 100%; + > .ant-tabs { + > .ant-tabs-bar { // 鍘婚櫎鏍囩椤礹eader涓巆ontent涔嬮棿鐨勯棿闅� + margin-bottom: 0; + .ant-tabs-tab { + padding: 18px 16px 6px 6px; + margin-right: 20px; + cursor: default; + span.tab-control i.anticon-close { + position: absolute; + right: -7px; + top: 10px; + font-size: 10px; + margin: 0px; + padding: 5px; + cursor: pointer; + } + span.tab-control i.anticon-redo { + position: absolute; + left: -5px; + top: 18px; + font-size: 14px; + margin: 0px; + padding: 3px; + cursor: pointer; + display: none; + } + span.tab-name { + cursor: pointer; + padding: 6px 0px 6px 10px; + } + } + .ant-tabs-tab-active.ant-tabs-tab { + span.tab-name { + cursor: default; + } + } + .ant-tabs-tab-active.ant-tabs-tab:hover { + span.tab-control i.anticon-redo { + display: inline-block; + } + } + } + } .ant-tabs .ant-tabs-top-content.ant-tabs-content-animated { transition: margin-left 0s cubic-bezier(0.645, 0.045, 0.355, 1); - } - .ant-tabs-bar { // 鍘婚櫎鏍囩椤礹eader涓巆ontent涔嬮棿鐨勯棿闅� - margin-bottom: 0; - } - .ant-tabs-tab { - padding: 18px 16px 6px 6px; - cursor: default; - span.tab-control i.anticon-close { - position: absolute; - right: -7px; - top: 10px; - font-size: 10px; - margin: 0px; - padding: 5px; - cursor: pointer; - } - span.tab-control i.anticon-redo { - position: absolute; - left: -5px; - top: 18px; - font-size: 14px; - margin: 0px; - padding: 3px; - cursor: pointer; - display: none; - } - span.tab-name { - cursor: pointer; - padding: 6px 0px 6px 10px; - } - } - .ant-tabs-tab-active.ant-tabs-tab { - span.tab-name { - cursor: default; - } - } - .ant-tabs-tab-active.ant-tabs-tab:hover { - span.tab-control i.anticon-redo { - display: inline-block; - } } iframe { width: 100%; diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index d7eb0af..b60f2b6 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -119,10 +119,11 @@ // 鏉冮檺杩囨护 config.action = config.action.filter(item => permAction[item.uuid]) - // config.tabgroups.forEach(group => { - // if (!config[group]) return - // config[group] = config[group].filter(tab => permAction[tab.uuid]) - // }) + config.tabgroups.forEach(group => { + if (!config[group]) return + + config[group] = config[group].filter(tab => permAction[tab.linkTab]) + }) if (userConfig) { config.setting = {...config.setting, ...userConfig.setting} diff --git a/src/tabviews/commontable/index.scss b/src/tabviews/commontable/index.scss index 21369a9..89fdea4 100644 --- a/src/tabviews/commontable/index.scss +++ b/src/tabviews/commontable/index.scss @@ -72,6 +72,9 @@ .ant-tabs-tab:not(.ant-tabs-tab-active) { cursor: pointer; } + .ant-tabs-tab.ant-tabs-tab-active { + cursor: default; + } } .common-table-copy { position: fixed; diff --git a/src/tabviews/formtab/index.jsx b/src/tabviews/formtab/index.jsx index 2175cb1..ad702d5 100644 --- a/src/tabviews/formtab/index.jsx +++ b/src/tabviews/formtab/index.jsx @@ -104,11 +104,12 @@ // 鏉冮檺杩囨护 if (this.props.param.menuType !== 'HS') { config.action = config.action.filter(item => permAction[item.uuid]) + config.tabgroups.forEach(group => { + if (!config[group]) return + + config[group] = config[group].filter(tab => permAction[tab.linkTab]) + }) } - // config.tabgroups.forEach(group => { - // if (!config[group]) return - // config[group] = config[group].filter(tab => permAction[tab.uuid]) - // }) this.setState({ config: config, diff --git a/src/tabviews/managetable/index.jsx b/src/tabviews/managetable/index.jsx index 35d258b..4b5087f 100644 --- a/src/tabviews/managetable/index.jsx +++ b/src/tabviews/managetable/index.jsx @@ -116,12 +116,6 @@ let colMap = new Map() // 鐢ㄤ簬瀛楁杩囨护 // 鏉冮檺杩囨护 - // config.action = config.action.filter(item => permAction[item.uuid]) - // config.tabgroups.forEach(group => { - // if (!config[group]) return - // config[group] = config[group].filter(tab => permAction[tab.uuid]) - // }) - // 1銆佺瓫閫夊瓧娈甸泦锛�2銆佽繃婊ら殣钘忓垪鍙婂悎骞跺垪涓殑瀛楁uuid config.columns.forEach(col => { diff --git a/src/tabviews/rolemanage/index.jsx b/src/tabviews/rolemanage/index.jsx index 91b720c..d34b705 100644 --- a/src/tabviews/rolemanage/index.jsx +++ b/src/tabviews/rolemanage/index.jsx @@ -1,14 +1,18 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Card, Col, Row, Icon, Menu, notification, Spin, Input } from 'antd' +import { Card, Col, Row, Icon, Menu, notification, Spin, Input, Tabs, Button, Tree } from 'antd' import Api from '@/api' +import Utils from '@/utils/utils.js' import zhCN from '@/locales/zh-CN/role.js' import enUS from '@/locales/en-US/role.js' import './index.scss' const { Search } = Input +const { TabPane } = Tabs +const { TreeNode, DirectoryTree } = Tree +let _checkedKeys = null export default class RoleManage extends Component { static propTpyes = { @@ -18,9 +22,19 @@ state = { dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, - loadingview: true, + loading: true, roleList: null, - primarykey: '' + selectRoleId: '', + mainMenus: null, + menuTrees: null, + checkedKeys: [], + menuOpenKeys: [], + selectMenuTrees: null, + selectMenuOpenKeys: [], + primarykey: '', + tabKey: '', + submitloading: false, + initCheckKeys: null } getRoleList = async () => { @@ -31,11 +45,12 @@ if (result.status) { this.setState({ - roleList: result.data + roleList: result.data, + loading: false }) } else { this.setState({ - loadingview: false + loading: false }) notification.warning({ top: 92, @@ -45,17 +60,103 @@ } } - getMenuList = async () => { + getMainMenuList = async () => { let param = { func: 's_rolemenu_get_FstMenu' } let result = await Api.getSystemConfig(param) if (result.status) { - + this.setState({ + mainMenus: result.data.map(item => { + return { + title: item.MenuName, + key: item.MenuID, + children: [] + } + }) + }, () => { + this.getAllMenuList() + }) + } else { + notification.warning({ + top: 92, + message: result.message, + duration: 10 + }) + } + } + + getAllMenuList = async () => { + const { selectRoleId, mainMenus, tabKey } = this.state + + let param = { + func: 's_rolemenu_get_FunMenu', + RoleID: selectRoleId, + SelectedType: tabKey + } + + let result = await Api.getSystemConfig(param) + + if (result.status) { + let _tree = null + let _openKeys = [] + + let _state = { + loading: false + } + + if (tabKey === '') { + let _mainMenuKeys = mainMenus.map(menu => menu.key) + + _checkedKeys = [] + let _checkMainKeys = [] // 閫変腑鐨勪竴绾ц彍鍗曪紝闇�鍒ゆ柇鏄惁鍚湁瀛愯彍鍗� + let _initCheckKeys = [] // 鍒濆閫変腑鐨勮彍鍗昳d + result.data.forEach(item => { + if (item.Selected !== 'true') return + + if (!_mainMenuKeys.includes(item.MenuID)) { + _checkedKeys.push(item.MenuID) + } else { + _checkMainKeys.push(item.MenuID) + } + _initCheckKeys.push(item.MenuID) + }) + + _initCheckKeys = Array.from(new Set(_initCheckKeys)) + + _tree = this.getTree(JSON.parse(JSON.stringify(mainMenus)), result.data) + + if (_tree[0]) { + this.getOpenNode(_tree[0], _openKeys) + } + + _tree.forEach(item => { + if (_checkMainKeys.includes(item.key) && !item.children) { + _checkedKeys.push(item.key) + } + }) + + _state.menuTrees = _tree + _state.initCheckKeys = _initCheckKeys + _state.checkedKeys = _checkedKeys + _state.menuOpenKeys = _openKeys + } else { + _tree = this.getTree(JSON.parse(JSON.stringify(mainMenus)), result.data) + _tree = _tree.filter(node => node.children) + + if (_tree[0]) { + this.getOpenNode(_tree[0], _openKeys) + } + + _state.selectMenuTrees = _tree + _state.selectMenuOpenKeys = _openKeys + } + + this.setState(_state) } else { this.setState({ - loadingview: false + loading: false }) notification.warning({ top: 92, @@ -65,13 +166,146 @@ } } - changeRole = () => { + getOpenNode = (parentNode, keys) => { + if (parentNode.children) { + keys.push(parentNode.key) + parentNode.children.forEach(node => { + this.getOpenNode(node, keys) + }) + } + } + getTree = (parents, options) => { + parents.forEach(parent => { + parent.children = [] + + options.forEach((option, index) => { + if (option.ParentID === parent.key) { + parent.children.push({ + title: option.MenuName, + key: option.MenuID, + selected: option.Selected === 'true' + }) + } + }) + + + if (parent.children.length === 0) { + parent.children = null + } else { + if (_checkedKeys && parent.selected) { + _checkedKeys = _checkedKeys.filter(key => key !== parent.key) + } + parent.children = this.getTree(parent.children, options) + } + }) + + return parents + } + + changeRole = (role) => { + const { selectRoleId } = this.state + + if (selectRoleId === role.RoleID) return + + this.setState({ + selectRoleId: role.RoleID, + menuTrees: null, + checkedKeys: [], + menuOpenKeys: [], + selectMenuTrees: null, + selectMenuOpenKeys: [] + }, () => { + this.getAllMenuList() + }) + } + + renderTreeNodes = (data) => { + return data.map(item => { + if (item.children) { + return ( + <TreeNode title={item.title} key={item.key} dataRef={item}> + {this.renderTreeNodes(item.children)} + </TreeNode> + ) + } + return <TreeNode key={item.key} showIcon={true} {...item} isLeaf /> + }) + } + + onCheck = (checkedKeys, info) => { + console.log(checkedKeys) + this.setState({ + checkedKeys: checkedKeys, + halfCheckedKeys: info.halfCheckedKeys, + initCheckKeys: null + }) + } + + changeTab = (key) => { + const { menuTrees, selectMenuTrees } = this.state + + this.setState({ + tabKey: key === 'selected' ? key : '' + }, () => { + if ((key === 'selected' && !selectMenuTrees) || (key === 'all' && !menuTrees)) { + this.getAllMenuList() + } + }) + } + + roleSubmit = async () => { + const { checkedKeys, halfCheckedKeys, selectRoleId, initCheckKeys } = this.state + + let _keys = [] + + if (initCheckKeys) { + _keys = initCheckKeys + } else { + _keys = checkedKeys.concat(halfCheckedKeys) + } + + let _LText = _keys.map(key => `select '${key}' as MenuID`) + _LText = _LText.join(' union all ') + + let param = { + func: 's_rolemenu_sub', + RoleID: selectRoleId, + LText: Utils.formatOptions(_LText) + } + + this.setState({ + submitloading: true + }) + + let result = await Api.getSystemConfig(param) + + if (result.status) { + notification.success({ + top: 92, + message: '淇濆瓨鎴愬姛', + duration: 2 + }) + this.setState({ + submitloading: false, + selectMenuTrees: null, + selectMenuOpenKeys: [] + }) + } else { + notification.warning({ + top: 92, + message: result.message, + duration: 10 + }) + this.setState({ + submitloading: false + }) + } } UNSAFE_componentWillMount () { this.getRoleList() - this.getMenuList() + this.getMainMenuList() } shouldComponentUpdate (nextProps, nextState) { @@ -79,7 +313,7 @@ } render() { - const { roleList, loadingview, primarykey } = this.state + const { roleList, loading, primarykey, menuTrees, checkedKeys, menuOpenKeys, selectMenuTrees, tabKey, selectRoleId, selectMenuOpenKeys, submitloading } = this.state let _roleList = [] @@ -89,9 +323,9 @@ return ( <div className="rolemanage"> - {loadingview && <Spin size="large" />} + {loading && <Spin size="large" />} <Row gutter={16}> - <Col span={6}> + <Col span={5}> <Card className="role-list" title={ @@ -113,10 +347,30 @@ </Menu> </Card> </Col> - <Col span={18}> - <Card title="Card title" bordered={false}> - Card content - </Card> + <Col span={19}> + <Tabs defaultActiveKey="all" tabBarExtraContent={!tabKey && selectRoleId ? <Button type="primary" loading={submitloading} onClick={this.roleSubmit}>鎻愪氦</Button> : null} onChange={this.changeTab}> + <TabPane tab="鑿滃崟鍒楄〃" key="all"> + {menuTrees && menuTrees.length > 0 ? <Tree + checkable + selectable={false} + defaultExpandedKeys={menuOpenKeys} + autoExpandParent={true} + onCheck={this.onCheck} + checkedKeys={checkedKeys} + > + {this.renderTreeNodes(menuTrees)} + </Tree> : null} + {menuTrees && menuTrees.length === 0 ? <p className="nodata">鏈煡璇㈠埌鑿滃崟鍒楄〃</p> : null} + {!loading && !menuTrees ? <Spin className="load-tree" /> : null} + </TabPane> + <TabPane tab="宸叉巿鏉冭彍鍗�" key="selected"> + {selectMenuTrees && selectMenuTrees.length > 0 ? <DirectoryTree multiple defaultExpandedKeys={selectMenuOpenKeys}> + {this.renderTreeNodes(selectMenuTrees)} + </DirectoryTree> : null} + {selectMenuTrees && selectMenuTrees.length === 0 ? <p className="nodata">鏈煡璇㈠埌宸叉巿鏉冭彍鍗�</p> : null} + {!loading && !selectMenuTrees ? <Spin className="load-tree" /> : null} + </TabPane> + </Tabs> </Col> </Row> </div> diff --git a/src/tabviews/rolemanage/index.scss b/src/tabviews/rolemanage/index.scss index cdd317e..0010344 100644 --- a/src/tabviews/rolemanage/index.scss +++ b/src/tabviews/rolemanage/index.scss @@ -2,28 +2,32 @@ min-height: calc(100vh - 94px); height: 100%; position: relative; - background: #fafafa; padding: 15px; .role-list { min-height: calc(100vh - 125px); + box-shadow: 0px 0px 2px #eeeeee; .ant-card-head { padding: 0 10px; - .role-title { - display: inline-block; - width: 100%; - color: #36c6d3; - .anticon-bank { - margin-right: 5px; - } - .ant-input-affix-wrapper { - width: calc(100% - 140px); - max-width: 130px; - margin-top: -2px; - float: right; - input { - border-radius: 20px; - height: 30px; + .ant-card-head-title { + padding: 15px 0 10px; + .role-title { + display: inline-block; + width: 100%; + // color: #36c6d3; + color: #1890ff; + .anticon-bank { + margin-right: 5px; + } + .ant-input-affix-wrapper { + width: calc(100% - 140px); + max-width: 130px; + margin-top: -2px; + float: right; + input { + border-radius: 20px; + height: 30px; + } } } } @@ -41,5 +45,35 @@ left: calc(50vw - 22px); top: calc(50vh - 70px); z-index: 1; + } + .ant-tabs { + background: #fff; + min-height: calc(100vh - 125px); + box-shadow: 0px 0px 2px #eeeeee; + .ant-tabs-tab { + padding: 19px 16px 14px; + } + .ant-tabs-tab-active.ant-tabs-tab { + cursor: default; + } + .ant-tabs-extra-content { + padding: 5px 20px 0px 0px; + } + .ant-tabs-content { + .ant-tree li { + padding: 4px 0px 0px; + } + .ant-tree-child-tree > li:first-child { + padding-top: 6px; + } + .load-tree { + margin-left: 15px; + } + .nodata { + line-height: 50px; + text-align: center; + color: #bcbcbc; + } + } } } \ No newline at end of file diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index c65fdc2..db2e165 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -1586,6 +1586,25 @@ } } + if (config.type === 'user') { // 浣跨敤宸叉湁鑿滃崟鏃讹紝榛樿娣诲姞鍏宠仈鏍囩id + config.action = config.action.map(item => { + if (item.OpenType === 'popview' && !item.linkTab) { + item.linkTab = Utils.getuuid() + } + return item + }) + + config.tabgroups.forEach(group => { + config[group] = config[group].map(tab => { + if (!tab.linkTab) { + tab.linkTab = Utils.getuuid() + } + + return tab + }) + }) + } + let _LongParam = '' let _config = {...config, tables: this.state.selectedTables} let _pageParam = {...menu.PageParam, OpenType: res.opentype} @@ -1740,6 +1759,8 @@ return } + let _sort = 0 + let btnParam = { // 娣诲姞鑿滃崟鎸夐挳 func: 'sPC_Button_AddUpt', Type: 40, // 娣诲姞鑿滃崟涓嬬殑鎸夐挳type涓�40锛屾寜閽笅鐨勬寜閽畉ype涓�60 @@ -1748,8 +1769,9 @@ Template: menu.PageParam.Template || '', PageParam: '', LongParam: '', - LText: _config.action.map((item, index) => { - return `select '${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort` + LText: _config.action.map(item => { + _sort++ + return `select '${item.uuid}' as menuid, '${item.label}' as menuname, '${_sort * 10}' as Sort` }) } @@ -1764,12 +1786,11 @@ } let _LText = [] - let _index = 1 _config.tabgroups.forEach(groupId => { _config[groupId].forEach(item => { - _LText.push(`select '${menu.MenuID}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${_index * 10}' as Sort`) - _index++ + _sort++ + _LText.push(`select '${menu.MenuID}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${_sort * 10}' as Sort`) }) }) @@ -1780,7 +1801,6 @@ 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 = { @@ -1792,7 +1812,6 @@ MenuNo: res.menuNo, Template: menu.PageParam.Template || '', MenuName: res.menuName, - // Sort: (this.props.supMenuList.length + 1) * 10, PageParam: JSON.stringify(_pageParam), LongParam: _LongParam, LText: _vals.func.map(item => `select '${menu.MenuID}' as MenuID,'${item.func}' as ProcName,'${item.label}' as MenuName`), diff --git a/src/templates/formtabconfig/index.jsx b/src/templates/formtabconfig/index.jsx index ee46115..7b93ee2 100644 --- a/src/templates/formtabconfig/index.jsx +++ b/src/templates/formtabconfig/index.jsx @@ -1472,6 +1472,8 @@ return } + let _sort = 0 // 鎸夐挳鍙婃爣绛炬帓搴� + let btnParam = { // 娣诲姞鑿滃崟鎸夐挳 func: 'sPC_Button_AddUpt', Type: 60, // 娣诲姞鎸夐挳琛ㄥ崟椤典笅鐨勬寜閽� @@ -1481,7 +1483,8 @@ PageParam: '', LongParam: '', LText: config.action.map((item, index) => { - return `select '${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort` + _sort++ + return `select '${item.uuid}' as menuid, '${item.label}' as menuname, '${_sort * 10}' as Sort` }) } @@ -1496,12 +1499,11 @@ } let _LText = [] - let _index = 1 config.tabgroups.forEach(groupId => { config[groupId].forEach(item => { - _LText.push(`select '${btnTab.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${_index * 10}' as Sort`) - _index++ + _sort++ + _LText.push(`select '${btnTab.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${_sort * 10}' as Sort`) }) }) diff --git a/src/templates/tableshare/tabdragelement/index.jsx b/src/templates/tableshare/tabdragelement/index.jsx index 8c29d38..c814fc3 100644 --- a/src/templates/tableshare/tabdragelement/index.jsx +++ b/src/templates/tableshare/tabdragelement/index.jsx @@ -54,7 +54,7 @@ newcard.supMenu = 'mainTable' newcard.groupId = groupId newcard.focus = true - + let targetId = cards.length > 0 ? cards[cards.length - 1].uuid : 0 if (target) { targetId = target.uuid diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index 83a2061..e226e96 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -118,8 +118,7 @@ localStorage.setItem('AuthCode', box) this.setState({ - auth: true, - loaded: true + auth: true }) } else { localStorage.removeItem('AuthCode') @@ -154,6 +153,7 @@ isDisabled={this.state.isDisabled} changelang={(value) => this.changelang(value)} handleSubmit={() => this.handleSubmit()} + loaded={() => this.setState({ loaded: true })} wrappedComponentRef={(inst) => this.loginformRef = inst} /> </div> diff --git a/src/views/login/loginform.jsx b/src/views/login/loginform.jsx index 7540a4a..15d7e31 100644 --- a/src/views/login/loginform.jsx +++ b/src/views/login/loginform.jsx @@ -10,6 +10,7 @@ isDisabled: PropTypes.bool, changelang: PropTypes.func, handleSubmit: PropTypes.func, + loaded: PropTypes.func, dict: PropTypes.object, auth: PropTypes.bool, lang: PropTypes.string, @@ -51,7 +52,20 @@ }) return } - this.props.handleSubmit() + + if (!this.props.form.getFieldValue('username')) { + const input = document.getElementById('username') + if (input) { + input.focus() + } + } else if (!this.props.form.getFieldValue('password')) { + const input = document.getElementById('password') + if (input) { + input.focus() + } + } else { + this.props.handleSubmit() + } } componentDidMount () { @@ -83,6 +97,7 @@ input.focus() } } + this.props.loaded() } render() { -- Gitblit v1.8.0