|
@@ -38,12 +38,6 @@ const filterTagListByMerchantId = (merchantId, tagList) => {
|
|
|
const arraySort = (subArray = [], parentArray = []) => {
|
|
|
let cursor = 0;
|
|
|
const newArray = [...parentArray];
|
|
|
- subArray.forEach((sub) => {
|
|
|
- const sInP = parentArray.findIndex(data => data.id === sub.id);
|
|
|
- if (sInP !== -1) {
|
|
|
- newArray.splice(sInP, 1);
|
|
|
- }
|
|
|
- });
|
|
|
while (cursor < subArray.length - 1) {
|
|
|
const prevId = subArray[cursor].id;
|
|
|
const nextId = subArray[cursor + 1].id;
|
|
@@ -136,12 +130,16 @@ export default class TagTypeCreatePage extends Component {
|
|
|
merchantSelectorDestroy: true,
|
|
|
});
|
|
|
};
|
|
|
- handleDragSortTableChange = (rows) => {
|
|
|
+ handleDragSortTableChange = (rows, delId) => {
|
|
|
const { currentItem } = this.props.tagType;
|
|
|
const { tagList } = currentItem;
|
|
|
+ let newTagList = tagList || [];
|
|
|
+ if (delId) {
|
|
|
+ newTagList = newTagList.filter(tag => tag.id !== delId);
|
|
|
+ }
|
|
|
this.props.dispatch({
|
|
|
type: 'tagType/fixCurrentItem',
|
|
|
- payload: { tagList: arraySort(rows || [], tagList || []) },
|
|
|
+ payload: { tagList: arraySort(rows || [], newTagList) },
|
|
|
});
|
|
|
};
|
|
|
handlePageBack = () => {
|