From 5db03b87b61a4c607ba126bd640dbf90d0f4baf3 Mon Sep 17 00:00:00 2001 From: catchonme Date: Fri, 18 Oct 2019 14:47:56 +0800 Subject: [PATCH] =?UTF-8?q?crud=E5=B5=8C=E5=A5=97=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AD=90=E6=95=B0=E6=8D=AE=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E5=AD=90=E6=95=B0=E6=8D=AE=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scss/components/_tabs.scss | 6 ++++++ src/store/table.ts | 17 ++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/scss/components/_tabs.scss b/scss/components/_tabs.scss index 8c41c1410..eefbcc42d 100644 --- a/scss/components/_tabs.scss +++ b/scss/components/_tabs.scss @@ -105,6 +105,12 @@ } } + &:last-child { + > a { + margin: 0; + } + } + &.is-active { > a:first-child, > a:first-child:hover, diff --git a/src/store/table.ts b/src/store/table.ts index ee6eba86e..d80ca5e80 100644 --- a/src/store/table.ts +++ b/src/store/table.ts @@ -3,7 +3,7 @@ import {iRendererStore} from './iRenderer'; import {resolveVariable} from '../utils/tpl-builtin'; import isEqual = require('lodash/isEqual'); import find = require('lodash/find'); -import {isBreakpoint, createObject, isObject, isVisible, guid, findTree, flattenTree, eachTree} from '../utils/helper'; +import {isBreakpoint, createObject, isObject, isVisible, guid, findTree, flattenTree, eachTree, difference} from '../utils/helper'; import {evalExpression} from '../utils/tpl'; export const Column = types @@ -235,8 +235,19 @@ export const TableStore = iRendererStore return getToggableColumns().filter(item => item.toggled); } - function getModifiedRows() { - return self.rows.filter(item => item.modified); + function getModifiedRows(rows:IRow[] = [], modifiedRows:IRow[] = []) { + rows = rows && rows.length ? rows : self.rows; + rows.forEach((item:IRow) => { + if (item.children && item.children.length) { + getModifiedRows(item.children, modifiedRows); + } + let diff = difference(item.data, item.pristine); + let hasDifference = Object.keys(diff).length; + if (hasDifference) { + modifiedRows.push(item); + } + }); + return modifiedRows; } function getModified() {