CRUD 的 quickSave 发送原始值
This commit is contained in:
parent
65ea41b96f
commit
488b5aa1f6
|
@ -84,7 +84,7 @@
|
|||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: inline-block;
|
||||
line-height: 1;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
&-clear {
|
||||
|
|
|
@ -639,7 +639,8 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
|||
rows: Array<object> | object,
|
||||
diff: Array<object> | object,
|
||||
indexes: Array<number>,
|
||||
unModifiedItems?: Array<any>
|
||||
unModifiedItems?: Array<any>,
|
||||
rowsOrigin?: Array<object> | object
|
||||
) {
|
||||
const {store, quickSaveApi, quickSaveItemApi, primaryField, env, messages, reload} = this.props;
|
||||
|
||||
|
@ -652,7 +653,8 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
|||
const data: any = createObject(store.data, {
|
||||
rows,
|
||||
rowsDiff: diff,
|
||||
indexes: indexes
|
||||
indexes: indexes,
|
||||
rowsOrigin
|
||||
});
|
||||
|
||||
if (rows.length && rows[0].hasOwnProperty(primaryField || 'id')) {
|
||||
|
@ -681,7 +683,8 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
|||
|
||||
const data = createObject(store.data, {
|
||||
item: rows,
|
||||
modified: diff
|
||||
modified: diff,
|
||||
origin: rowsOrigin
|
||||
});
|
||||
|
||||
const sendData = createObject(data, rows);
|
||||
|
|
|
@ -40,7 +40,8 @@ export interface GridProps extends RendererProps {
|
|||
items: Array<object> | object,
|
||||
diff: Array<object> | object,
|
||||
rowIndexes: Array<number> | number,
|
||||
unModifiedItems?: Array<object>
|
||||
unModifiedItems?: Array<object>,
|
||||
rowOrigins?: Array<object> | object
|
||||
) => void;
|
||||
onSaveOrder?: (moved: Array<object>, items: Array<object>) => void;
|
||||
onQuery: (values: object) => void;
|
||||
|
@ -324,7 +325,7 @@ export default class Cards extends React.Component<GridProps, object> {
|
|||
return;
|
||||
}
|
||||
|
||||
onSave(item.data, difference(item.data, item.pristine), item.index);
|
||||
onSave(item.data, difference(item.data, item.pristine), item.index, undefined, item.pristine);
|
||||
}
|
||||
|
||||
handleSave() {
|
||||
|
@ -338,7 +339,7 @@ export default class Cards extends React.Component<GridProps, object> {
|
|||
const itemIndexes = store.modifiedItems.map(item => item.index);
|
||||
const diff = store.modifiedItems.map(item => difference(item.data, item.pristine));
|
||||
const unModifiedItems = store.items.filter(item => !item.modified).map(item => item.data);
|
||||
onSave(items, diff, itemIndexes, unModifiedItems);
|
||||
onSave(items, diff, itemIndexes, unModifiedItems, store.modifiedItems.map(item => item.pristine));
|
||||
}
|
||||
|
||||
handleSaveOrder() {
|
||||
|
|
|
@ -908,7 +908,7 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
|||
level="default"
|
||||
disabled={!hasPending}
|
||||
className={cx('FileControl-uploadBtn')}
|
||||
onClick={this.handleSelect}
|
||||
onClick={this.toggleUpload}
|
||||
>
|
||||
{uploading ? '暂停上传' : '开始上传'}
|
||||
</Button>
|
||||
|
|
|
@ -41,7 +41,8 @@ export interface ListProps extends RendererProps {
|
|||
items: Array<object> | object,
|
||||
diff: Array<object> | object,
|
||||
rowIndexes: Array<number> | number,
|
||||
unModifiedItems?: Array<object>
|
||||
unModifiedItems?: Array<object>,
|
||||
rowOrigins?: Array<object> | object
|
||||
) => void;
|
||||
onSaveOrder?: (moved: Array<object>, items: Array<object>) => void;
|
||||
onQuery: (values: object) => void;
|
||||
|
@ -295,7 +296,7 @@ export default class List extends React.Component<ListProps, object> {
|
|||
return;
|
||||
}
|
||||
|
||||
onSave(item.data, difference(item.data, item.pristine), item.index);
|
||||
onSave(item.data, difference(item.data, item.pristine), item.index, undefined, item.pristine);
|
||||
}
|
||||
|
||||
handleSave() {
|
||||
|
@ -309,7 +310,7 @@ export default class List extends React.Component<ListProps, object> {
|
|||
const itemIndexes = store.modifiedItems.map(item => item.index);
|
||||
const diff = store.modifiedItems.map(item => difference(item.data, item.pristine));
|
||||
const unModifiedItems = store.items.filter(item => !item.modified).map(item => item.data);
|
||||
onSave(items, diff, itemIndexes, unModifiedItems);
|
||||
onSave(items, diff, itemIndexes, unModifiedItems, store.modifiedItems.map(item => item.pristine));
|
||||
}
|
||||
|
||||
handleSaveOrder() {
|
||||
|
|
|
@ -69,7 +69,8 @@ export interface TableProps extends RendererProps {
|
|||
items: Array<object> | object,
|
||||
diff: Array<object> | object,
|
||||
rowIndexes: Array<number> | number,
|
||||
unModifiedItems?: Array<object>
|
||||
unModifiedItems?: Array<object>,
|
||||
rowOrigins?: Array<object> | object
|
||||
) => void;
|
||||
onSaveOrder?: (moved: Array<object>, items: Array<object>) => void;
|
||||
onQuery: (values: object) => void;
|
||||
|
@ -384,7 +385,7 @@ export default class Table extends React.Component<TableProps, object> {
|
|||
return;
|
||||
}
|
||||
|
||||
onSave(item.data, difference(item.data, item.pristine), item.index);
|
||||
onSave(item.data, difference(item.data, item.pristine), item.index, undefined, item.pristine);
|
||||
}
|
||||
|
||||
async handleSave() {
|
||||
|
@ -408,7 +409,7 @@ export default class Table extends React.Component<TableProps, object> {
|
|||
const rowIndexes = store.modifiedRows.map(item => item.index);
|
||||
const diff = store.modifiedRows.map(item => difference(item.data, item.pristine));
|
||||
const unModifiedRows = store.rows.filter(item => !item.modified).map(item => item.data);
|
||||
onSave(rows, diff, rowIndexes, unModifiedRows);
|
||||
onSave(rows, diff, rowIndexes, unModifiedRows, store.modifiedRows.map(item => item.pristine));
|
||||
}
|
||||
|
||||
handleSaveOrder() {
|
||||
|
|
Loading…
Reference in New Issue