From 876a5e6657d67df66bb525d02dd6d147ba81cae5 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 05 一月 2023 09:53:37 +0800 Subject: [PATCH] 2023-01-05 --- src/templates/sharecomponent/actioncomponent/verifyprint/editable/index.jsx | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/templates/sharecomponent/actioncomponent/verifyprint/editable/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyprint/editable/index.jsx index bf99d3c..9c93a48 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyprint/editable/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyprint/editable/index.jsx @@ -1,4 +1,5 @@ import React, {Component} from 'react' +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' @@ -160,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 = () => { @@ -174,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 => { @@ -190,10 +196,7 @@ ...row }) this.setState({ dataSource: newData }) - } - - UNSAFE_componentWillReceiveProps () { - + this.props.onChange(fromJS(newData).toJS()) } render() { -- Gitblit v1.8.0