king
2023-08-17 c7aece35a62b6e91fd98a625bf0e53f64bfbd18d
src/templates/sharecomponent/actioncomponent/verifyprint/editable/index.jsx
@@ -1,5 +1,7 @@
import React, {Component} from 'react'
import { Table, Input, Popconfirm, Form, Icon } from 'antd'
import { fromJS } from 'immutable'
import { Table, Input, Popconfirm, Form } from 'antd'
import { ArrowUpOutlined, ArrowDownOutlined, PlusOutlined, DeleteOutlined } from '@ant-design/icons'
import Utils from '@/utils/utils.js'
import './index.scss'
@@ -114,15 +116,13 @@
        render: (text, record) =>
          this.state.dataSource.length >= 1 ? (
            <div>
              <span className="operation-btn" title={props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span>
              <span className="operation-btn" title={props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span>
              <span className="operation-btn" onClick={() => this.handleUpDown(record, 'up')} style={{color: '#1890ff'}}><ArrowUpOutlined /></span>
              <span className="operation-btn" onClick={() => this.handleUpDown(record, 'down')} style={{color: '#ff4d4f'}}><ArrowDownOutlined /></span>
              <Popconfirm
                title={props.dict['header.form.query.delete']}
                okText={props.dict['model.confirm']}
                cancelText={props.dict['header.cancel']}
                overlayClassName="popover-confirm"
                onConfirm={() => this.handleDelete(record.key)
              }>
                <span style={{color: '#1890ff', cursor: 'pointer'}}><Icon type="delete" /></span>
                <span style={{color: '#1890ff', cursor: 'pointer'}}><DeleteOutlined /></span>
              </Popconfirm>
            </div>
          ) : null,
@@ -161,11 +161,14 @@
    this.setState({
      dataSource: _data
    })
    this.props.onChange(fromJS(_data).toJS())
  }
  handleDelete = key => {
    const dataSource = [...this.state.dataSource]
    this.setState({ dataSource: dataSource.filter(item => item.key !== key) })
    const dataSource = [...this.state.dataSource].filter(item => item.key !== key)
    this.setState({ dataSource: dataSource })
    this.props.onChange(fromJS(dataSource).toJS())
  }
  handleAdd = () => {
@@ -175,11 +178,13 @@
      Value: `${count}`,
      Text: `${count}`
    }
    let list = [...dataSource, newData]
    this.setState({
      dataSource: [...dataSource, newData],
      dataSource: list,
      count: count + 1
    })
    this.props.onChange(fromJS(list).toJS())
  }
  handleSave = row => {
@@ -191,10 +196,7 @@
      ...row
    })
    this.setState({ dataSource: newData })
  }
  UNSAFE_componentWillReceiveProps () {
    this.props.onChange(fromJS(newData).toJS())
  }
  render() {
@@ -222,7 +224,7 @@
    })
    return (
      <div className="print-verify-edit-table">
        <Icon className="add-row" type="plus" onClick={this.handleAdd} />
        <PlusOutlined className="add-row" onClick={this.handleAdd} />
        <Table
          components={components}
          rowClassName={() => 'editable-row'}