From 4f2e4e84fd2cdca1407ac06c1b44319518be39b9 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 21 十二月 2020 19:11:05 +0800 Subject: [PATCH] 2020-12-21 --- src/templates/zshare/verifycard/index.jsx | 105 ++++------------------------------------------------ 1 files changed, 9 insertions(+), 96 deletions(-) diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index 40fcbbb..734692b 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { fromJS } from 'immutable' -import { Form, Tabs, Row, Col, Radio, Button, Table, Select, Popconfirm, Icon, notification, Modal, message, InputNumber, Tooltip, Typography } from 'antd' +import { Form, Tabs, Row, Col, Radio, Button, Select, Popconfirm, Icon, notification, Modal, message, InputNumber, Tooltip, Typography } from 'antd' import moment from 'moment' import Api from '@/api' @@ -273,10 +273,8 @@ width: '15%', dataIndex: 'operation', render: (text, record) => - (<div> + (<div style={{textAlign: 'center'}}> <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'customverify')} style={{color: '#1890ff'}}><Icon type="edit" /></span> - <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'customverify', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> - <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'customverify', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'customverify')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> <Popconfirm overlayClassName="popover-confirm" @@ -344,10 +342,8 @@ width: '20%', dataIndex: 'operation', render: (text, record) => - (<div> + (<div style={{textAlign: 'center'}}> <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'scripts')} style={{color: '#1890ff'}}><Icon type="edit" /></span> - <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'scripts', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> - <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'scripts', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'scripts')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> <Popconfirm overlayClassName="popover-confirm" @@ -447,10 +443,8 @@ width: '15%', dataIndex: 'operation', render: (text, record) => - (<div> + (<div style={{textAlign: 'center'}}> <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'ordercode')} style={{color: '#1890ff'}}><Icon type="edit" /></span> - <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'ordercode', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> - <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'ordercode', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'ordercode')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> <Popconfirm overlayClassName="popover-confirm" @@ -1119,66 +1113,6 @@ this.setState({ verify }) } - handleUpDown = (record, type, direction) => { - let verify = fromJS(this.state.verify).toJS() - let index = 0 - - if (type === 'customverify') { - verify.customverifys = verify.customverifys.filter((item, i) => { - if (item.uuid === record.uuid) { - index = i - } - - return item.uuid !== record.uuid - }) - if ((index === 0 && direction === 'up') || (index === verify.customverifys.length && direction === 'down')) { - return - } - - if (direction === 'up') { - verify.customverifys.splice(index - 1, 0, record) - } else { - verify.customverifys.splice(index + 1, 0, record) - } - } else if (type === 'ordercode') { - verify.billcodes = verify.billcodes.filter((item, i) => { - if (item.uuid === record.uuid) { - index = i - } - - return item.uuid !== record.uuid - }) - if ((index === 0 && direction === 'up') || (index === verify.billcodes.length && direction === 'down')) { - return - } - - if (direction === 'up') { - verify.billcodes.splice(index - 1, 0, record) - } else { - verify.billcodes.splice(index + 1, 0, record) - } - } else if (type === 'scripts') { - verify.scripts = verify.scripts.filter((item, i) => { - if (item.uuid === record.uuid) { - index = i - } - - return item.uuid !== record.uuid - }) - if ((index === 0 && direction === 'up') || (index === verify.scripts.length && direction === 'down')) { - return - } - - if (direction === 'up') { - verify.scripts.splice(index - 1, 0, record) - } else { - verify.scripts.splice(index + 1, 0, record) - } - } - - this.setState({ verify }) - } - voucherChange = (voucher) => { const { verify } = this.state @@ -1462,7 +1396,7 @@ </span> } key="2x"> <ContrastForm dict={this.props.dict} contrastChange={this.contrastChange}/> - <EditTable data={verify.contrasts} columns={contrastColumns} onChange={(contrasts) => this.setState({verify: {...verify, contrasts}})}/> + <EditTable actions={['edit', 'move', 'copy', 'del']} type="contrastverify" data={verify.contrasts} columns={contrastColumns} onChange={(contrasts) => this.setState({verify: {...verify, contrasts}})}/> </TabPane> <TabPane tab={ <span> @@ -1478,14 +1412,7 @@ customChange={this.customChange} wrappedComponentRef={(inst) => this.customForm = inst} /> - <Table - bordered - rowKey="uuid" - className="custom-table" - dataSource={verify.customverifys} - columns={customColumns} - pagination={false} - /> + <EditTable actions={['move']} data={verify.customverifys} columns={customColumns} onChange={(customverifys) => {this.setState({verify: {...verify, customverifys}})}}/> </TabPane> <TabPane tab={ <span> @@ -1504,14 +1431,7 @@ orderChange={this.orderChange} wrappedComponentRef={(inst) => this.orderForm = inst} /> - <Table - bordered - rowKey="uuid" - className="custom-table" - dataSource={verify.billcodes} - columns={orderColumns} - pagination={false} - /> + <EditTable actions={['move']} data={verify.billcodes} columns={orderColumns} onChange={(billcodes) => {this.setState({verify: {...verify, billcodes}})}}/> </TabPane> <TabPane tab={ <span> @@ -1525,7 +1445,7 @@ dict={this.props.dict} uniqueChange={this.uniqueChange} /> - <EditTable data={verify.uniques} columns={card.Ot !== 'requiredOnce' ? uniqueColumns : onceUniqueColumns} onChange={this.changeUniques}/> + <EditTable actions={['edit', 'move', 'del']} data={verify.uniques} columns={card.Ot !== 'requiredOnce' ? uniqueColumns : onceUniqueColumns} onChange={this.changeUniques}/> </TabPane> <TabPane tab={ <span> @@ -1560,14 +1480,7 @@ scriptsChange={this.scriptsChange} wrappedComponentRef={(inst) => this.scriptsForm = inst} /> - <Table - bordered - rowKey="uuid" - className="custom-table" - dataSource={verify.scripts} - columns={scriptsColumns} - pagination={false} - /> + <EditTable actions={['move']} data={verify.scripts} columns={scriptsColumns} onChange={(scripts) => {this.setState({verify: {...verify, scripts}})}}/> </TabPane> <TabPane tab="淇℃伅鎻愮ず" key="7"> <Form {...formItemLayout}> -- Gitblit v1.8.0