diff --git a/src/pages/exchangecode/list/list.js b/src/pages/exchangecode/list/list.js index df3f7b0c..2b668bc7 100644 --- a/src/pages/exchangecode/list/list.js +++ b/src/pages/exchangecode/list/list.js @@ -1,21 +1,11 @@ -import ReactDOM from 'react-dom' -import React, { Component } from 'react' -import { Link } from 'react-router-dom' -import { - Button, - Sweetalert, - CombinedDateRangePicker, - Notify, - Switch -} from 'zent' +import React from 'react' +import { Sweetalert, CombinedDateRangePicker, Notify, Switch } from 'zent' import './list.less' import _ from 'lodash' import '../../../assets/comm.css' import Ipt from '../../../components/input/main' import Grid from '../../../components/gird/main.js' import TabPage from '../../../components/tabPage/main.js' -import Filterbar from '../../../components/filterbar/main.js' -import { nowMonth, nowDay } from '../../../assets/comm.js' import menu from '../../../assets/enum.js' import { getCodesList, @@ -25,8 +15,6 @@ import { terminateApprovals } from '../../../assets/api.js' var moment = require('moment') -let day = moment(nowDay()).format('YYYY-MM-DD') -let tomonth = moment(nowMonth()).format('YYYY-MM-DD') const Column = [ { title: '兑换码-批次ID', @@ -197,6 +185,34 @@ export default class acclist extends React.Component { window.open('#/home/exchange-addcommodity') } + /* 处理可复制数据逻辑 */ + copyElementFunction({ key_batch_id, status, end_time, discard }) { + const today = moment().format('yyyy-MM-DD HH:mm:ss') + let element = '' + if (![-1, 6, 7].includes(status) && end_time > today && discard === 0) { + element = ( + this.copyFunction(key_batch_id)}> + 复制 + + ) + } else { + element = ( + + 复制 + + ) + } + return element + } + /* 编辑 */ editinfo(e, rowData) { sessionStorage.setItem('pathname2', '/home/exchangecode-edit') @@ -225,9 +241,9 @@ export default class acclist extends React.Component { } /* 复制 */ - copyFunction(rowData) { + copyFunction(id) { sessionStorage.setItem('copyOpearo', 2) - sessionStorage.setItem('keybatch_id', rowData.key_batch_id) + sessionStorage.setItem('keybatch_id', id) let breakchangenav = [ { pagetitle: '复制key', @@ -585,23 +601,7 @@ export default class acclist extends React.Component { ) : ( 撤销审批 )} - {rowData.status == 4 || rowData.status == 5 ? ( - this.copyFunction(rowData)}> - 复制 - - ) : ( - - 复制 - - )} + {this.copyElementFunction(rowData)} ) }