From 12c4dd8bb0bb4c523dcf2fbb81191a7f3556a430 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 15 一月 2020 12:50:22 +0800 Subject: [PATCH] 2020-01-15 --- src/templates/tableshare/dragelement/index.jsx | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/templates/tableshare/dragelement/index.jsx b/src/templates/tableshare/dragelement/index.jsx index 17f483d..31ed8ae 100644 --- a/src/templates/tableshare/dragelement/index.jsx +++ b/src/templates/tableshare/dragelement/index.jsx @@ -1,5 +1,6 @@ import React, { useState } from 'react' import { useDrop } from 'react-dnd' +import { is, fromJS } from 'immutable' import update from 'immutability-helper' import { Col, Icon } from 'antd' import Utils from '@/utils/utils.js' @@ -14,10 +15,12 @@ const moveCard = (id, atIndex) => { const { card, index } = findCard(id) const _cards = update(cards, { $splice: [[index, 1], [atIndex, 0, card]] }) - setCards(_cards) handleList(type, _cards) } + if (!is(fromJS(cards), fromJS(list))) { + setCards(list) + } const findCard = id => { const card = cards.filter(c => `${c.uuid}` === id)[0] return { @@ -47,6 +50,7 @@ copycard.uuid = Utils.getuuid() copycard.origin = false copycard.label = copycard.label + '(copy)' + copycard.focus = true copycard.originCard = card @@ -135,7 +139,7 @@ targetIndex++ const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] }) - setCards(_cards) + handleList(type, _cards, newcard) target = null } -- Gitblit v1.8.0