From cec9290f6cd8e3e7e881f4d38d43de307645a08a Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 23 九月 2019 09:29:48 +0800 Subject: [PATCH] 2019-09-23update --- src/tabviews/commontable/index.scss | 1 src/components/mainTable/index.jsx | 3 + src/locales/zh-CN/main.js | 3 + src/components/sidemenu/index.scss | 2 src/components/mainTable/index.scss | 14 +++++++ src/locales/en-US/main.js | 3 + src/tabviews/commontable/index.jsx | 10 +---- src/components/mainAction/index.jsx | 66 ++++++++++++++++++++++++-------- 8 files changed, 73 insertions(+), 29 deletions(-) diff --git a/src/components/mainAction/index.jsx b/src/components/mainAction/index.jsx index 12149a1..95df621 100644 --- a/src/components/mainAction/index.jsx +++ b/src/components/mainAction/index.jsx @@ -1,13 +1,16 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' // import { is, fromJS } from 'immutable' -import { Button, Affix } from 'antd' +import { Button, Affix, Modal } from 'antd' import './index.scss' + +const { confirm } = Modal class MainAction extends Component { static propTpyes = { actions: PropTypes.array, // 鎼滅储鏉′欢鍒楄〃 - dict: PropTypes.object // 瀛楀吀椤� + dict: PropTypes.object, // 瀛楀吀椤� + fixed: PropTypes.any } state = { @@ -15,7 +18,20 @@ } actionTrigger = (item) => { - console.log(item) + if (item.Action === 'Prompt' || item.Action === 'Delete') { + confirm({ + title: this.props.dict['main.action.confirm.tip'], + // content: 'Some descriptions', + onOk() { + return new Promise((resolve, reject) => { + setTimeout(Math.random() > 0.5 ? resolve : reject, 1000) + }).catch(() => console.log('Oops errors!')) + }, + onCancel() { + console.log('Cancel') + } + }) + } } UNSAFE_componentWillMount () { @@ -28,21 +44,37 @@ // } render() { + if (this.props.fixed) { // 鎸夐挳鏄惁鍥哄畾鍦ㄥご閮� + return ( + <Affix offsetTop={48}> + <div className="button-list"> + {this.props.actions.map((item, index) => { + return ( + <Button + className={'mk-btn ' + item.CssClass} + icon={item.Icon} + key={'action' + index} + onClick={() => {this.actionTrigger(item)}} + >{item.MenuName}</Button> + ) + })} + </div> + </Affix> + ) + } return ( - <Affix offsetTop={48}> - <div className="button-list"> - {this.props.actions.map((item, index) => { - return ( - <Button - className={'mk-btn ' + item.CssClass} - icon={item.Icon} - key={'action' + index} - onClick={() => {this.actionTrigger(item)}} - >{item.MenuName}</Button> - ) - })} - </div> - </Affix> + <div className="button-list"> + {this.props.actions.map((item, index) => { + return ( + <Button + className={'mk-btn ' + item.CssClass} + icon={item.Icon} + key={'action' + index} + onClick={() => {this.actionTrigger(item)}} + >{item.MenuName}</Button> + ) + })} + </div> ) } } diff --git a/src/components/mainTable/index.jsx b/src/components/mainTable/index.jsx index 32d95e8..b742eda 100644 --- a/src/components/mainTable/index.jsx +++ b/src/components/mainTable/index.jsx @@ -73,7 +73,8 @@ changeTable = (pagination, filters, sorter) => { this.setState({ pageIndex: pagination.current, - pageSize: pagination.pageSize + pageSize: pagination.pageSize, + selectedRowKeys: [] }) this.props.refreshdata(pagination, filters, sorter) } diff --git a/src/components/mainTable/index.scss b/src/components/mainTable/index.scss index d56f18f..5b42d38 100644 --- a/src/components/mainTable/index.scss +++ b/src/components/mainTable/index.scss @@ -17,6 +17,20 @@ } .ant-table-body { overflow-x: auto!important; + min-height: 90px; + border: 1px solid #e8e8e8; + border-radius: 4px; + border-top: none; + border-bottom: none; + table { + border-left: 0; + .ant-table-thead > tr > th:last-child { + border-right: 0; + } + .ant-table-tbody > tr > td:last-child { + border-right: 0; + } + } } .ant-table-body::-webkit-scrollbar { width: 8px; diff --git a/src/components/sidemenu/index.scss b/src/components/sidemenu/index.scss index 34031dd..7dc3e0e 100644 --- a/src/components/sidemenu/index.scss +++ b/src/components/sidemenu/index.scss @@ -16,7 +16,7 @@ } } .side-menu.iframe { - height: 100%; + // height: 100%; max-height: 100vh; overflow-y: scroll; &::-webkit-scrollbar { diff --git a/src/locales/en-US/main.js b/src/locales/en-US/main.js index cc8e0c9..6e94caf 100644 --- a/src/locales/en-US/main.js +++ b/src/locales/en-US/main.js @@ -3,5 +3,6 @@ 'main.reset': 'Reset', 'main.copy.success': 'Copy success', 'main.pagination.of': 'of', - 'main.pagination.items': 'items' + 'main.pagination.items': 'items', + 'main.action.confirm.tip': 'Do you want to execute?' } \ No newline at end of file diff --git a/src/locales/zh-CN/main.js b/src/locales/zh-CN/main.js index 2018b82..e50cc85 100644 --- a/src/locales/zh-CN/main.js +++ b/src/locales/zh-CN/main.js @@ -3,5 +3,6 @@ 'main.reset': '閲嶇疆', 'main.copy.success': '澶嶅埗鎴愬姛', 'main.pagination.of': '鍏�', - 'main.pagination.items': '鏉�' + 'main.pagination.items': '鏉�', + 'main.action.confirm.tip': '纭畾瑕佹墽琛屽悧?' } \ No newline at end of file diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index fc17a2b..6e4aa5d 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -54,7 +54,7 @@ newconfig.columns = result.columns.map(column => { return column }) - // newconfig.columns.length = 4 + newconfig.columns.length = 4 } newconfig.select = result.select this.setState(newconfig) @@ -78,7 +78,6 @@ } refreshbysearch = (searches) => { - console.log(searches) this.loadmaindata(this.state.param.pageIndex, this.state.param.pageSize, this.state.param.orderColumn, this.state.param.orderType, searches) let param = Object.assign({}, this.state.param, { search: searches @@ -87,7 +86,6 @@ loading: true, param: param }) - // window.print() } refreshbytable = (pagination, filters, sorter) => { @@ -134,16 +132,12 @@ return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) } - componentDidMount () { - // console.log(this.props.MenuNo) - } - render() { return ( <div className="commontable"> {!this.state.searchlist && <Loading />} {this.state.searchlist && <MainSearch refreshdata={this.refreshbysearch} searchlist={this.state.searchlist} dict={this.state.dict} />} - {this.state.actions && <MainAction actions={this.state.actions} dict={this.state.dict} />} + {this.state.actions && <MainAction fixed={true} actions={this.state.actions} dict={this.state.dict} />} {this.state.columns && <MainTable refreshdata={this.refreshbytable} columns={this.state.columns} data={this.state.data} select={this.state.select} total={this.state.total} loading={this.state.loading} dict={this.state.dict} />} <Button className="main-copy" icon="copy" onClick={this.copyMenuNo} shape="circle" /> <BackTop> diff --git a/src/tabviews/commontable/index.scss b/src/tabviews/commontable/index.scss index 2c3edaa..14b928d 100644 --- a/src/tabviews/commontable/index.scss +++ b/src/tabviews/commontable/index.scss @@ -2,6 +2,7 @@ min-height: calc(100vh - 110px); .main-copy { position: fixed; + z-index: 2; bottom: 75px; right: 30px; width: 40px; -- Gitblit v1.8.0