From 46f79b491173d284a4900d19e7aecf7509481438 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 21 一月 2022 17:21:25 +0800 Subject: [PATCH] 2022-01-21 --- src/templates/zshare/modalform/fieldtable/index.jsx | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/templates/zshare/modalform/fieldtable/index.jsx b/src/templates/zshare/modalform/fieldtable/index.jsx index ca85936..0a64952 100644 --- a/src/templates/zshare/modalform/fieldtable/index.jsx +++ b/src/templates/zshare/modalform/fieldtable/index.jsx @@ -1,6 +1,7 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' -import { Icon, notification } from 'antd' +import { notification } from 'antd' +import { PlusOutlined } from '@ant-design/icons' import asyncComponent from '@/utils/asyncComponent' import Utils from '@/utils/utils.js' @@ -18,6 +19,7 @@ let data = this.props['data-__meta'].initialValue || [] this.setState({ + loading: false, data: data.map(item => { item.uuid = item.uuid || item.key return item @@ -103,21 +105,24 @@ message: '瀛楁鍚嶄笉鍙噸澶嶏紒', duration: 5 }) + this.setState({loading: true}, () => { + this.setState({loading: false}) + }) return } - Array.from(new Set(fields)) + this.setState({ data }, () => { this.props.onChange(data) }) } render() { - const { data, columns } = this.state + const { data, columns, loading } = this.state return ( <div className="modal-card-field-table"> - {data.length < 3 ? <Icon className="add-row" type="plus" onClick={this.handleAdd} /> : null} - <EditTable actions={['edit', 'move', 'del']} data={data} columns={columns} onChange={this.changeData}/> + {data.length < 3 ? <PlusOutlined className="add-row" onClick={this.handleAdd} /> : null} + {!loading ? <EditTable indexShow={false} actions={['edit', 'move', 'del']} data={data} columns={columns} onChange={this.changeData}/> : null} </div> ) } -- Gitblit v1.8.0