From 607b5dc4059be1843b6c0f670b93f107fc263375 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 19 三月 2020 16:08:29 +0800 Subject: [PATCH] 2020-03-19 --- src/components/transferform/index.jsx | 14 src/locales/en-US/header.js | 4 src/locales/zh-CN/main.js | 1 src/tabviews/tabmanage/mutilform/index.scss | 50 +++ src/tabviews/rolemanage/index.jsx | 6 src/components/sidemenu/editsecmenu/index.jsx | 2 src/locales/zh-CN/share.js | 6 src/tabviews/tabmanage/index.scss | 35 ++ src/templates/zshare/colspanform/index.jsx | 14 src/components/sidemenu/editthdmenu/index.jsx | 2 src/templates/comtableconfig/index.jsx | 4 src/components/header/editmenu/index.jsx | 2 src/templates/subtableconfig/index.jsx | 19 - src/locales/zh-CN/header.js | 4 src/tabviews/tabmanage/mutilform/index.jsx | 99 +++++++ src/tabviews/zshare/actionList/index.jsx | 37 +- src/tabviews/tabmanage/index.jsx | 509 +++++++++++++++++++++++++++++++++-- src/locales/en-US/main.js | 1 src/locales/zh-CN/comtable.js | 4 src/locales/en-US/comtable.js | 4 src/locales/en-US/share.js | 6 21 files changed, 711 insertions(+), 112 deletions(-) diff --git a/src/components/header/editmenu/index.jsx b/src/components/header/editmenu/index.jsx index 52528e2..e80ad88 100644 --- a/src/components/header/editmenu/index.jsx +++ b/src/components/header/editmenu/index.jsx @@ -366,7 +366,7 @@ destroyOnClose > {!this.state.thawmenulist && <Spin style={{marginLeft: 'calc(50% - 22px)', marginTop: '70px', marginBottom: '70px'}} size="large" />} - {this.state.thawmenulist && <TransferForm ref="trawmenu" dict={this.state.dict} menulist={this.state.thawmenulist}/>} + {this.state.thawmenulist && <TransferForm ref="trawmenu" menulist={this.state.thawmenulist}/>} </Modal> {/* 缂栬緫鑿滃崟妯℃�佹 */} <Modal diff --git a/src/components/sidemenu/editsecmenu/index.jsx b/src/components/sidemenu/editsecmenu/index.jsx index a16955f..b260152 100644 --- a/src/components/sidemenu/editsecmenu/index.jsx +++ b/src/components/sidemenu/editsecmenu/index.jsx @@ -439,7 +439,7 @@ onCancel={this.thawMemuCancel} > {!this.state.thawmenulist && <Spin style={{marginLeft: 'calc(50% - 22px)', marginTop: '70px', marginBottom: '70px'}} size="large" />} - {this.state.thawmenulist && <TransferForm ref="trawmenu" dict={this.state.dict} menulist={this.state.thawmenulist}/>} + {this.state.thawmenulist && <TransferForm ref="trawmenu" menulist={this.state.thawmenulist}/>} </Modal> </div> ) diff --git a/src/components/sidemenu/editthdmenu/index.jsx b/src/components/sidemenu/editthdmenu/index.jsx index 79c7c8e..6dfa7e9 100644 --- a/src/components/sidemenu/editthdmenu/index.jsx +++ b/src/components/sidemenu/editthdmenu/index.jsx @@ -879,7 +879,7 @@ destroyOnClose > {!this.state.thawmenulist && <Spin style={{marginLeft: 'calc(50% - 22px)', marginTop: '70px', marginBottom: '70px'}} size="large" />} - {this.state.thawmenulist && <TransferForm ref="trawmenu" dict={this.state.dict} menulist={this.state.thawmenulist}/>} + {this.state.thawmenulist && <TransferForm ref="trawmenu" menulist={this.state.thawmenulist}/>} </Modal> {/* 娣诲姞绯荤粺鑿滃崟 */} <Modal diff --git a/src/components/transferform/index.jsx b/src/components/transferform/index.jsx index c753a59..96907cd 100644 --- a/src/components/transferform/index.jsx +++ b/src/components/transferform/index.jsx @@ -1,15 +1,18 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { Transfer } from 'antd' + +import zhCN from '@/locales/zh-CN/share.js' +import enUS from '@/locales/en-US/share.js' import './index.scss' class TransferForm extends Component { static propTypes = { - menulist: PropTypes.array, - dict: PropTypes.object, // 瀛楀吀椤� + menulist: PropTypes.array } state = { + dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, targetKeys: [], selectedKeys: [] } @@ -23,14 +26,15 @@ } render() { - const { targetKeys, selectedKeys } = this.state + const { targetKeys, selectedKeys, dict } = this.state + return ( <div className="trawmenutransfer"> <Transfer dataSource={this.props.menulist} - titles={[this.props.dict['header.menu.thawmenu.source'], this.props.dict['header.menu.thawmenu.target']]} + titles={[dict['thawmenu.source'], dict['thawmenu.target']]} targetKeys={targetKeys} - locale={{itemUnit: this.props.dict['header.menu.thawmenu.itemUnit'], itemsUnit: this.props.dict['header.menu.thawmenu.itemsUnit']}} + locale={{itemUnit: dict['thawmenu.itemUnit'], itemsUnit: dict['thawmenu.itemsUnit']}} selectedKeys={selectedKeys} onChange={this.handleChange} onSelectChange={this.handleSelectChange} diff --git a/src/locales/en-US/comtable.js b/src/locales/en-US/comtable.js index 6673dd9..85d6061 100644 --- a/src/locales/en-US/comtable.js +++ b/src/locales/en-US/comtable.js @@ -52,10 +52,6 @@ 'header.menu.maintable': '涓昏〃', 'header.menu.query': '鏌ヨ', 'header.menu.printTemplate': '鎵撳嵃妯℃澘', - 'header.menu.thawmenu.source': '宸插喕缁�', - 'header.menu.thawmenu.target': '瑙i櫎鍐荤粨', - 'header.menu.thawmenu.itemUnit': '椤�', - 'header.menu.thawmenu.itemsUnit': '椤�', 'header.form.tabType': '鏍囩绫诲瀷', 'header.form.search.placeholder': 'Please add search criteria', 'header.form.modal.placeholder': 'Please add the form', diff --git a/src/locales/en-US/header.js b/src/locales/en-US/header.js index 69b6f15..d6415ee 100644 --- a/src/locales/en-US/header.js +++ b/src/locales/en-US/header.js @@ -41,10 +41,6 @@ 'header.menu.openType.newWindow': 'A new window', 'header.menu.newpage.service': 'Customer Service', 'header.menu.thawmenu.select': 'Please select the menu to unfreeze !', - 'header.menu.thawmenu.source': 'Frozen', - 'header.menu.thawmenu.target': 'Unfreeze', - 'header.menu.thawmenu.itemUnit': 'item', - 'header.menu.thawmenu.itemsUnit': 'items', 'form.required.input': 'Please enter the ', 'form.required.select': '璇烽�夋嫨' } \ No newline at end of file diff --git a/src/locales/en-US/main.js b/src/locales/en-US/main.js index 48bc318..f62bbf4 100644 --- a/src/locales/en-US/main.js +++ b/src/locales/en-US/main.js @@ -5,6 +5,7 @@ 'main.return': 'Cancel', 'main.close': '鍏抽棴', 'main.all': 'All', + 'main.cancel': '鍙栨秷', 'main.copy.success': 'Copy success', 'main.pagination.of': 'of', 'main.pagination.items': 'items', diff --git a/src/locales/en-US/share.js b/src/locales/en-US/share.js index ed2f705..06cce28 100644 --- a/src/locales/en-US/share.js +++ b/src/locales/en-US/share.js @@ -1,4 +1,8 @@ export default { 'view.notFound': '鎶辨瓑锛屼綘璁块棶鐨勯〉闈笉瀛樺湪锛岃鑱旂郴绠$悊鍛樸��', - 'date.empty': '绌�' + 'date.empty': '绌�', + 'thawmenu.source': 'Frozen', + 'thawmenu.target': 'Unfreeze', + 'thawmenu.itemUnit': 'item', + 'thawmenu.itemsUnit': 'items', } \ No newline at end of file diff --git a/src/locales/zh-CN/comtable.js b/src/locales/zh-CN/comtable.js index 306e6d2..e83547b 100644 --- a/src/locales/zh-CN/comtable.js +++ b/src/locales/zh-CN/comtable.js @@ -52,10 +52,6 @@ 'header.menu.maintable': '涓昏〃', 'header.menu.query': '鏌ヨ', 'header.menu.printTemplate': '鎵撳嵃妯℃澘', - 'header.menu.thawmenu.source': '宸插喕缁�', - 'header.menu.thawmenu.target': '瑙i櫎鍐荤粨', - 'header.menu.thawmenu.itemUnit': '椤�', - 'header.menu.thawmenu.itemsUnit': '椤�', 'header.form.tabType': '鏍囩绫诲瀷', 'header.form.search.placeholder': '璇锋坊鍔犳悳绱㈡潯浠�', 'header.form.modal.placeholder': '璇锋坊鍔犺〃鍗�', diff --git a/src/locales/zh-CN/header.js b/src/locales/zh-CN/header.js index 53711d3..4fc9962 100644 --- a/src/locales/zh-CN/header.js +++ b/src/locales/zh-CN/header.js @@ -41,10 +41,6 @@ 'header.menu.openType.newWindow': '鏂扮獥鍙�', 'header.menu.newpage.service': '瀹㈡湇', 'header.menu.thawmenu.select': '璇烽�夋嫨瑕佽В闄ゅ喕缁撶殑鑿滃崟锛�', - 'header.menu.thawmenu.source': '宸插喕缁�', - 'header.menu.thawmenu.target': '瑙i櫎鍐荤粨', - 'header.menu.thawmenu.itemUnit': '椤�', - 'header.menu.thawmenu.itemsUnit': '椤�', 'form.required.input': '璇疯緭鍏�', 'form.required.select': '璇烽�夋嫨' } \ No newline at end of file diff --git a/src/locales/zh-CN/main.js b/src/locales/zh-CN/main.js index cc39596..ac96002 100644 --- a/src/locales/zh-CN/main.js +++ b/src/locales/zh-CN/main.js @@ -5,6 +5,7 @@ 'main.return': '杩斿洖', 'main.close': '鍏抽棴', 'main.all': '鍏ㄩ儴', + 'main.cancel': '鍙栨秷', 'main.copy.success': '澶嶅埗鎴愬姛', 'main.pagination.of': '鍏�', 'main.pagination.items': '鏉�', diff --git a/src/locales/zh-CN/share.js b/src/locales/zh-CN/share.js index ed2f705..229d0c1 100644 --- a/src/locales/zh-CN/share.js +++ b/src/locales/zh-CN/share.js @@ -1,4 +1,8 @@ export default { 'view.notFound': '鎶辨瓑锛屼綘璁块棶鐨勯〉闈笉瀛樺湪锛岃鑱旂郴绠$悊鍛樸��', - 'date.empty': '绌�' + 'date.empty': '绌�', + 'thawmenu.source': '鍏ㄩ儴', + 'thawmenu.target': '宸查�夋嫨', + 'thawmenu.itemUnit': '椤�', + 'thawmenu.itemsUnit': '椤�', } \ No newline at end of file diff --git a/src/tabviews/rolemanage/index.jsx b/src/tabviews/rolemanage/index.jsx index a123a32..63e5a9f 100644 --- a/src/tabviews/rolemanage/index.jsx +++ b/src/tabviews/rolemanage/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Card, Col, Row, Icon, Menu, notification, Spin, Input, Tabs, Button, Tree } from 'antd' +import { Card, Col, Row, Icon, Menu, notification, Spin, Input, Tabs, Button, Tree, Empty } from 'antd' import Api from '@/api' import Utils from '@/utils/utils.js' @@ -440,14 +440,14 @@ > {this.renderTreeNodes(menuTrees)} </Tree> : null} - {menuTrees && menuTrees.length === 0 ? <p className="nodata">鏈煡璇㈠埌鑿滃崟鍒楄〃</p> : null} + {menuTrees && menuTrees.length === 0 ? <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} /> : 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} + {selectMenuTrees && selectMenuTrees.length === 0 ? <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} /> : null} {!loading && !selectMenuTrees ? <Spin className="load-tree" /> : null} </TabPane> </Tabs> diff --git a/src/tabviews/tabmanage/index.jsx b/src/tabviews/tabmanage/index.jsx index 9bc06b9..9dd64ec 100644 --- a/src/tabviews/tabmanage/index.jsx +++ b/src/tabviews/tabmanage/index.jsx @@ -1,20 +1,21 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Row, Col, Input, Button, Card, notification } from 'antd' -// import moment from 'moment' +import { Row, Col, Input, Button, Card, notification, Modal, Empty, Spin } 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 { verupMainTable } from './config.js' +import TransferForm from '@/components/transferform' import subtableurl from '@/assets/img/subtable.jpg' +import MutilForm from './mutilform' import './index.scss' const { Search } = Input +const { confirm } = Modal class TabManage extends Component { static propTpyes = { @@ -28,18 +29,51 @@ ContainerId: Utils.getuuid(), // 鑿滃崟澶栧眰html Id searchKey: '', tabviews: null, - cols: 8 + loading: true, + modaltype: '', + editTab: null, + submitloading: false, + cols: 8, + thawVisible: false, + thawmenulist: null + } + getTabs = () => { + Api.getSystemConfig({func: 'sPC_Get_UserTemp', TypeCharTwo: 'tab'}).then(res => { + if (res.status) { + this.setState({ + loading: false, + tabviews: res.UserTemp.map(temp => { + return { + uuid: temp.MenuID, + value: temp.MenuID, + MenuName: temp.MenuName, + type: temp.Template, + MenuNo: temp.MenuNo, + Remark: temp.Remark + } + }) + }) + } else { + this.setState({ + loading: false + }) + notification.warning({ + top: 92, + message: res.message, + duration: 10 + }) + } + }) + } UNSAFE_componentWillMount () { let docwidth = document.body.offsetWidth let cols = 8 - if (docwidth > 1500) { + if (docwidth > 1800) { cols = 6 - } else if (docwidth > 1900) { - cols = 4 } this.setState({ @@ -48,27 +82,7 @@ } componentDidMount () { - Api.getSystemConfig({func: 'sPC_Get_UserTemp', TypeCharTwo: 'tab'}).then(res => { - if (res.status) { - this.setState({ - tabviews: res.UserTemp.map(temp => { - return { - uuid: temp.MenuID, - value: temp.MenuID, - text: temp.MenuName, - type: temp.Template, - MenuNo: temp.MenuNo - } - }) - }) - } else { - notification.warning({ - top: 92, - message: res.message, - duration: 10 - }) - } - }) + this.getTabs() } shouldComponentUpdate (nextProps, nextState) { @@ -84,36 +98,457 @@ } } + handleTab = (tab, type) => { + let _this = this + + if (type === 'delete') { + confirm({ + title: "纭畾鍒犻櫎璇ユ爣绛惧悧锛�", + onOk() { + return new Promise(resolve => { + let _param = { + func: 'sPC_MainMenu_Del', + MenuID: tab.uuid + } + + Api.getSystemConfig(_param).then(res => { + if (!res.status) { + notification.warning({ + top: 92, + message: res.message, + duration: 10 + }) + } else { + notification.success({ + top: 92, + message: '鎵ц鎴愬姛', + duration: 2 + }) + _this.setState({ + loading: true, + tabviews: null + }, () => { + _this.getTabs() + }) + } + resolve() + }) + }) + }, + onCancel() {} + }) + } else { + this.setState({ + editTab: tab, + modaltype: type + }) + } + } + + handleSubmit = () => { + const { editTab, modaltype } = this.state + + this.tabFormRef.handleConfirm().then(res => { + + let _tab = {...editTab, ...res} + + this.setState({submitloading: true}) + + Api.getSystemConfig({ + func: 'sPC_Get_LongParam', + MenuID: _tab.uuid + }).then(res => { + + if (!res.status) { + this.setState({ + submitloading: false + }) + notification.warning({ + top: 92, + message: res.message, + duration: 10 + }) + return + } + + let param = { + func: 'sPC_Tab_AddUpt', + MenuID: _tab.uuid, + MenuNo: _tab.MenuNo, + Template: _tab.type, + MenuName: _tab.MenuName, + Remark: _tab.Remark, + PageParam: JSON.stringify({Template: _tab.type}), + Sort: 0 + } + + let _oriActions = [] + + let btnParam = { + func: 'sPC_Button_AddUpt', + Type: 40, + ParentID: _tab.uuid, + MenuNo: _tab.MenuNo, + Template: _tab.type, + PageParam: '', + LongParam: '', + LText: '' + } + + if (modaltype === 'edit') { + param.LongParam = res.LongParam + } else { + let _LongParam = '' + let _menuId = Utils.getuuid() + + // 瑙f瀽閰嶇疆 + if (res.LongParam) { + try { + _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) + } catch (e) { + console.warn('Parse Failure') + _LongParam = '' + } + } + + if (_LongParam) { + try { + _LongParam.uuid = _menuId + _LongParam.tabName = _tab.MenuName + _LongParam.tabNo = _tab.MenuNo + _LongParam.Remark = _tab.Remark + + let _linkchange = {} + btnParam.LText = [] + + _LongParam.action = _LongParam.action.map((item, index) => { + let uuid = Utils.getuuid() + + if (item.OpenType === 'pop') { + _oriActions.push({ + prebtn: JSON.parse(JSON.stringify(item)), + curuuid: uuid, + Template: 'Modal' + }) + } else if (item.OpenType === 'popview') { + _linkchange[item.linkTab] = Utils.getuuid() + + item.linkTab = _linkchange[item.linkTab] + } + + item.uuid = uuid + + btnParam.LText.push(`select '${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort`) + + return item + }) + + if (_LongParam.funcs && _LongParam.funcs.length > 0) { + _LongParam.funcs = _LongParam.funcs.map(item => { + if (item.type === 'tab') { + item.linkTab = _linkchange[item.linkTab] + item.menuNo = '' + item.subfuncs = [] + } + + return item + }) + } + + btnParam.LText = btnParam.LText.join(' union all ') + btnParam.LText = Utils.formatOptions(btnParam.LText) + btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) + + _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_LongParam))) + } catch { + console.warn('Stringify Failure') + _LongParam = '' + } + } + + param.MenuID = _menuId + param.LongParam = _LongParam + + btnParam.ParentID = _menuId + } + + new Promise(resolve => { + Api.getSystemConfig(param).then(response => { + if (response.status) { + resolve(true) + } else { + notification.warning({ + top: 92, + message: response.message, + duration: 10 + }) + resolve(false) + } + }) + }).then(result => { + if (!result) return result + if (modaltype === 'edit') return true + if (!btnParam.LText) return true + + return Api.getSystemConfig(btnParam) + }).then(result => { + if (!result) return result + if (modaltype === 'edit') return true + if (!btnParam.LText) return true + + if (result.status) { + return true + } else { + notification.warning({ + top: 92, + message: result.message, + duration: 10 + }) + return false + } + }).then(result => { + if (!result) return result + if (modaltype === 'edit') return true + if (_oriActions.length === 0) return true + + let deffers = _oriActions.map(item => { + return new Promise(resolve => { + Api.getSystemConfig({ + func: 'sPC_Get_LongParam', + MenuID: item.prebtn.uuid + }).then(response => { + if (!response.status) { + notification.warning({ + top: 92, + message: response.message, + duration: 10 + }) + resolve(false) + } else if (response.status && response.LongParam) { + let _param = { + func: 'sPC_ButtonParam_AddUpt', + ParentID: _tab.uuid, + MenuID: item.curuuid, + MenuNo: _tab.MenuNo, + Template: item.Template, + MenuName: item.prebtn.label, + PageParam: JSON.stringify({Template: item.Template}), + LongParam: response.LongParam + } + Api.getSystemConfig(_param).then(resp => { + if (!resp.status) { + notification.warning({ + top: 92, + message: resp.message, + duration: 10 + }) + resolve(false) + } else { + resolve(true) + } + }) + } else { + resolve(true) + } + }) + }) + }) + + return Promise.all(deffers) + }).then(result => { + if (!result) { + this.setState({ + submitloading: false + }) + return + } + + let isSuccess = true + + if (typeof(result) === 'object') { + result.forEach(resul => { + if (!resul) { + isSuccess = false + } + }) + } + + if (isSuccess) { + notification.success({ + top: 92, + message: '鎵ц鎴愬姛', + duration: 2 + }) + } + + this.setState({ + loading: true, + submitloading: false, + modaltype: '', + tabviews: null + }, () => { + this.getTabs() + }) + }) + }) + }) + } + + triggerDraw = () => { + this.setState({ + thawVisible: true + }) + + Api.getSystemConfig({ + func: 'sPC_Get_FrozenMenu', + TYPE: 50 + }).then(res => { + if (res.status) { + this.setState({ + thawmenulist: res.data.map(menu => { + return { + key: menu.MenuID, + title: menu.MenuName + } + }) + }) + } else { + notification.warning({ + top: 92, + message: res.message, + duration: 10 + }) + } + }) + } + + thawMenuSubmit = () => { + if (this.refs.trawmenu.state.targetKeys.length === 0) { + notification.warning({ + top: 92, + message: '璇烽�夋嫨瑕佽В闄ゅ喕缁撶殑鏍囩锛�', + duration: 10 + }) + } else { + this.setState({ + submitloading: true + }) + let defers = this.refs.trawmenu.state.targetKeys.map(item => { + return new Promise((resolve) => { + Api.getSystemConfig({ + func: 'sPC_MainMenu_ReDel', + MenuID: item + }).then(res => { + if (res.status) { + resolve('') + } else { + resolve(res.message) + } + }) + }) + }) + Promise.all(defers).then(res => { + let msg = res.filter(Boolean)[0] + if (msg) { + notification.error({ + top: 92, + message: msg, + duration: 15 + }) + this.setState({ + submitloading: false + }) + } else { + notification.success({ + top: 92, + message: '鎵ц鎴愬姛', + duration: 2 + }) + this.setState({ + submitloading: false, + thawVisible: false, + thawmenulist: null, + tabviews: null + }, () => { + this.getTabs() + }) + } + }) + } + } + render() { - const { cols, tabviews } = this.state + const { cols, tabviews, modaltype, editTab, searchKey, loading } = this.state + + let _tabviews = [] + if (tabviews) { + _tabviews = tabviews.filter(tab => tab.MenuName.toLowerCase().indexOf(searchKey.toLowerCase()) >= 0) + } return ( <div className="tab-manage" id={this.state.ContainerId}> + {loading && <Spin size="large" />} <Row> <Col className="tab-search" span={6}> <Search placeholder="璇疯緭鍏ユ爣绛惧悕绉�" onSearch={value => {this.setState({searchKey: value})}} enterButton /> </Col> <Col className="tab-thaw" span={6} offset={12}> - <Button type="primary">鏍囩瑙e喕</Button> + <Button type="primary" onClick={this.triggerDraw}>鏍囩瑙e喕</Button> </Col> </Row> - <Row className="tab-list"> - {tabviews && tabviews.map((tab, index) => { + {_tabviews.length > 0 ? <Row className="tab-list"> + {_tabviews.map((tab, index) => { return ( <Col span={cols} key={index}> <Card className="tab-card" - title={tab.text} + title={tab.MenuName} > <img onClick={() => {this.previewPicture()}} src={subtableurl} alt=""/> - <div className="card-operation"> - <Button type="primary">浣跨敤妯℃澘</Button> + <div className="tab-operation"> + <Button type="primary" onClick={() => this.handleTab(tab, 'edit')}>缂栬緫</Button> + <Button className="mk-green" onClick={() => this.handleTab(tab, 'copy')}>澶嶅埗</Button> + <Button type="danger" onClick={() => this.handleTab(tab, 'delete')}>鍒犻櫎</Button> </div> </Card> </Col> ) })} - </Row> + </Row> : null} + {tabviews && _tabviews.length === 0 ? <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} /> : null} + {/* 鏍囩淇敼鎴栧鍒� */} + <Modal + title={modaltype === 'edit' ? '鏍囩缂栬緫' : '鏍囩澶嶅埗'} + visible={!!modaltype} + width={600} + maskClosable={false} + onOk={this.handleSubmit} + confirmLoading={this.state.submitloading} + onCancel={() => {this.setState({modaltype: '', editTab: null})}} + destroyOnClose + > + <MutilForm + dict={this.state.dict} + tab={editTab} + inputSubmit={this.handleSubmit} + wrappedComponentRef={(inst) => this.tabFormRef = inst} + /> + </Modal> + {/* 瑙e喕鏍囩妯℃�佹 */} + <Modal + title="鏍囩瑙i櫎鍐荤粨" + okText={this.state.dict['main.confirm']} + cancelText={this.state.dict['main.cancel']} + visible={this.state.thawVisible} + onOk={this.thawMenuSubmit} + confirmLoading={this.state.submitloading} + onCancel={() => {this.setState({thawVisible: false, thawmenulist: null})}} + destroyOnClose + > + {!this.state.thawmenulist && <Spin style={{marginLeft: 'calc(50% - 22px)', marginTop: '70px', marginBottom: '70px'}} size="large" />} + {this.state.thawmenulist && <TransferForm ref="trawmenu" menulist={this.state.thawmenulist}/>} + </Modal> </div> ) } diff --git a/src/tabviews/tabmanage/index.scss b/src/tabviews/tabmanage/index.scss index e1ae50a..d9a7441 100644 --- a/src/tabviews/tabmanage/index.scss +++ b/src/tabviews/tabmanage/index.scss @@ -12,16 +12,47 @@ } .tab-list { padding-top: 20px; + margin-left: -10px; + margin-right: -10px; .ant-col { - padding: 0 10px 20px; + padding: 0 10px 30px; } .tab-card { .ant-card-body { - padding: 0; + position: relative; + padding: 20px 0; img { max-width: 100%; } + .tab-operation { + position: absolute; + top: -10px; + right: 10px; + opacity: 0; + transition: all 0.1s linear; + + button { + margin-left: 10px; + } + } } } + .tab-card:hover { + .ant-card-body { + .tab-operation { + top: 10px; + opacity: 1; + } + } + } + } + .ant-empty { + margin: 25vh 0; + } + > .ant-spin { + position: fixed; + z-index: 10; + left: calc(50vw - 22px); + top: calc(50vh - 70px); } } diff --git a/src/tabviews/tabmanage/mutilform/index.jsx b/src/tabviews/tabmanage/mutilform/index.jsx new file mode 100644 index 0000000..5b4f25d --- /dev/null +++ b/src/tabviews/tabmanage/mutilform/index.jsx @@ -0,0 +1,99 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { Form, Row, Col, Input } from 'antd' +import './index.scss' + +const { TextArea } = Input + +class TabHandleForm extends Component { + static propTpyes = { + tab: PropTypes.object, // 鏍囩淇℃伅 + dict: PropTypes.object, // 瀛楀吀椤� + inputSubmit: PropTypes.func // input鍥炶溅鎻愪氦 + } + + componentDidMount () { + try { + let _form = document.getElementById('MenuName') + + if (_form && _form.select) { + _form.select() + } + } catch { + console.warn('focus error锛�') + } + } + + handleConfirm = () => { + // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� + return new Promise((resolve, reject) => { + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + resolve(values) + } else { + reject(err) + } + }) + }) + } + + handleSubmit = (e) => { + e.preventDefault() + this.props.inputSubmit() + } + + render() { + const { getFieldDecorator } = this.props.form + const formItemLayout = { + labelCol: { + xs: { span: 24 }, + sm: { span: 8 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 } + } + } + return ( + <Form {...formItemLayout} className="ant-advanced-search-form main-form-field" id="tab-handle-form-box"> + <Row gutter={24}> + <Col span={24}> + <Form.Item label="鏍囩鍚嶇О"> + {getFieldDecorator('MenuName', { + initialValue: this.props.tab.MenuName || '', + rules: [ + { + required: true, + message: this.props.dict['form.required.input'] + '鏍囩鍚嶇О!' + } + ] + })(<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />)} + </Form.Item> + </Col> + <Col span={24}> + <Form.Item label="鏍囩鍙傛暟"> + {getFieldDecorator('MenuNo', { + initialValue: this.props.tab.MenuNo || '', + rules: [ + { + required: true, + message: this.props.dict['form.required.input'] + '鏍囩鍙傛暟!' + } + ] + })(<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />)} + </Form.Item> + </Col> + <Col span={24}> + <Form.Item label="澶囨敞"> + {getFieldDecorator('Remark', { + initialValue: this.props.tab.Remark || '' + })(<TextArea autosize={{ minRows: 2, maxRows: 6 }} />)} + </Form.Item> + </Col> + </Row> + </Form> + ) + } +} + +export default Form.create()(TabHandleForm) \ No newline at end of file diff --git a/src/tabviews/tabmanage/mutilform/index.scss b/src/tabviews/tabmanage/mutilform/index.scss new file mode 100644 index 0000000..919cf39 --- /dev/null +++ b/src/tabviews/tabmanage/mutilform/index.scss @@ -0,0 +1,50 @@ +.ant-advanced-search-form.main-form-field { + position: relative; + padding: 0px 24px 20px; + .ant-form-item { + display: flex; + } + .ant-form-item-control-wrapper { + flex: 1; + } + .ant-form-item-label { + overflow: hidden; + display: inline-block; + text-overflow: ellipsis; + white-space: nowrap; + } + .textarea-row { + .ant-col-sm-3 { + width: 10.5%; + } + .ant-col-sm-21 { + width: 89.5%; + } + } + .ant-input-number { + width: 100%; + } + .ant-form-explain { + overflow:hidden; + text-overflow:ellipsis; + white-space:nowrap; + } + p { + color: #1890ff; + border-bottom: 1px solid #d9d9d9; + } + .ant-input-disabled { + color: rgba(0, 0, 0, 0.65)!important; + cursor: default!important; + } + .ant-input-number-input { + color: rgba(0, 0, 0, 0.65)!important; + cursor: default!important; + } + .ant-select-disabled { + color: rgba(0, 0, 0, 0.65)!important; + .ant-select-selection--multiple .ant-select-selection__choice { + color: rgba(0, 0, 0, 0.65)!important; + } + } +} \ No newline at end of file diff --git a/src/tabviews/zshare/actionList/index.jsx b/src/tabviews/zshare/actionList/index.jsx index d8f3716..4832c00 100644 --- a/src/tabviews/zshare/actionList/index.jsx +++ b/src/tabviews/zshare/actionList/index.jsx @@ -236,6 +236,13 @@ let printlist = [] let templates = [btn.verify.Template] + let printCount = 1 + + if (formdata.printCount && typeof(formdata.printCount) === 'number' && formdata.printCount >= 1) { + printCount = formdata.printCount + + delete formdata.printCount + } this.setState({loadingUuid: btn.uuid}) @@ -244,23 +251,15 @@ formdata.TemplateID = btn.verify.Template if (btn.Ot === 'notRequired') { - if (formdata.printCount && typeof(formdata.printCount) === 'number' && formdata.printCount > 1) { - for (let i = 0; i < formdata.printCount; i++) { - printlist.push(JSON.parse(JSON.stringify(formdata))) - } - } else { - printlist.push(formdata) + for (let i = 0; i < printCount; i++) { + printlist.push(JSON.parse(JSON.stringify(formdata))) } } else { data.forEach(cell => { let _cell = {...cell, ...formdata} - if (formdata.printCount && typeof(formdata.printCount) === 'number' && formdata.printCount > 1) { - for (let i = 0; i < formdata.printCount; i++) { - printlist.push(JSON.parse(JSON.stringify(_cell))) - } - } else { - printlist.push(_cell) + for (let i = 0; i < printCount; i++) { + printlist.push(JSON.parse(JSON.stringify(_cell))) } }) } @@ -276,12 +275,14 @@ _cell.TemplateID = btn.verify.Template } - if (item.count && typeof(item.count) === 'number' && item.count > 1) { - for (let i = 0; i < item.count; i++) { - printlist.push(JSON.parse(JSON.stringify(_cell))) - } - } else { - printlist.push(_cell) + let _count = printCount + + if (item.count && typeof(item.count) === 'number' && item.count >= 1) { + _count = item.count + } + + for (let i = 0; i < _count; i++) { + printlist.push({...formdata, ..._cell}) } }) diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index 00f4fe6..ae52c66 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -1515,7 +1515,7 @@ _ParentParam = null } - if (_ParentParam) { + if (_ParentParam) { // 鍒犻櫎鎸夐挳鏃讹紝淇濆瓨鎸夐挳閰嶇疆淇℃伅锛岀敤浜庢仮澶嶆寜閽� _param.ParentParam = _ParentParam } } @@ -3038,7 +3038,7 @@ destroyOnClose > {!this.state.thawbtnlist && <Spin style={{marginLeft: 'calc(50% - 22px)', marginTop: '70px', marginBottom: '70px'}} size="large" />} - {this.state.thawbtnlist && <TransferForm ref="trawmenu" dict={this.state.dict} menulist={this.state.thawbtnlist}/>} + {this.state.thawbtnlist && <TransferForm ref="trawmenu" menulist={this.state.thawbtnlist}/>} </Modal> {/* 鎸夐挳閰嶇疆淇℃伅绮樿创澶嶅埗 */} <Modal diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index 01b4f4b..591fc75 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -138,21 +138,6 @@ }) } - // _config.uuid = Utils.getuuid() - // _config.action = _config.action.map(item => { - // let uuid = Utils.getuuid() - // if (item.OpenType === 'pop') { // 鍚湁瀛愰厤缃」鐨勬寜閽� - // _oriActions.push({ - // prebtn: JSON.parse(JSON.stringify(item)), - // curuuid: uuid, - // Template: 'Modal' - // }) - // } - - // item.uuid = uuid - // return item - // }) - this.setState({ originActions: _oriActions, optionLibs: optionLibs, @@ -1161,7 +1146,7 @@ _ParentParam = null } - if (_ParentParam) { + if (_ParentParam) { // 鍒犻櫎鎸夐挳鏃讹紝淇濆瓨鎸夐挳閰嶇疆淇℃伅锛岀敤浜庢仮澶嶆寜閽� _param.ParentParam = _ParentParam } @@ -2381,7 +2366,7 @@ destroyOnClose > {!this.state.thawbtnlist && <Spin style={{marginLeft: 'calc(50% - 22px)', marginTop: '70px', marginBottom: '70px'}} size="large" />} - {this.state.thawbtnlist && <TransferForm ref="trawmenu" dict={this.state.dict} menulist={this.state.thawbtnlist}/>} + {this.state.thawbtnlist && <TransferForm ref="trawmenu" menulist={this.state.thawbtnlist}/>} </Modal> {/* 鎸夐挳閰嶇疆淇℃伅绮樿创澶嶅埗 */} <Modal diff --git a/src/templates/zshare/colspanform/index.jsx b/src/templates/zshare/colspanform/index.jsx index 2a5ee0d..6065119 100644 --- a/src/templates/zshare/colspanform/index.jsx +++ b/src/templates/zshare/colspanform/index.jsx @@ -14,15 +14,13 @@ } componentDidMount () { - const { card } = this.props - - if (card.focus) { - try { - let _form = document.getElementById('label') + try { + let _form = document.getElementById('label') + if (_form && _form.select) { _form.select() - } catch { - console.warn('琛ㄥ崟focus澶辫触锛�') } + } catch { + console.warn('琛ㄥ崟focus澶辫触锛�') } } @@ -45,6 +43,8 @@ let _card = {...this.props.card, ...values, sublist: targetKeys, subfield: subfield} + delete _card.focus + resolve(_card) } else { reject(err) -- Gitblit v1.8.0