Commit 56a9d9c6 authored by lxd's avatar lxd

去重

parent 7fbd131f
......@@ -10686,16 +10686,6 @@
"integrity": "sha512-yz/iVTjWQ2ewtnYf3k56Ya0OUch0hdIMPdanXl2Za3gmRLaQGlzit7ZTs+/3S6T0iBud7nQrrldFihf4XVrvlw==",
"dev": true
},
"node_modules/bindings": {
"version": "1.5.0",
"resolved": "http://npmprivate.quantgroups.com/bindings/-/bindings-1.5.0.tgz",
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
"dev": true,
"optional": true,
"dependencies": {
"file-uri-to-path": "1.0.0"
}
},
"node_modules/blink-diff": {
"version": "1.0.13",
"resolved": "http://npmprivate.quantgroups.com/blink-diff/-/blink-diff-1.0.13.tgz",
......@@ -15379,13 +15369,6 @@
"resolved": "http://npmprivate.quantgroups.com/file-saver/-/file-saver-2.0.5.tgz",
"integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA=="
},
"node_modules/file-uri-to-path": {
"version": "1.0.0",
"resolved": "http://npmprivate.quantgroups.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
"dev": true,
"optional": true
},
"node_modules/filename-reserved-regex": {
"version": "1.0.0",
"resolved": "http://npmprivate.quantgroups.com/filename-reserved-regex/-/filename-reserved-regex-1.0.0.tgz",
......@@ -24592,13 +24575,6 @@
"resolved": "http://npmprivate.quantgroups.com/mute-stream/-/mute-stream-0.0.7.tgz",
"integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s="
},
"node_modules/nan": {
"version": "2.14.2",
"resolved": "http://npmprivate.quantgroups.com/nan/-/nan-2.14.2.tgz",
"integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==",
"dev": true,
"optional": true
},
"node_modules/nanoid": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz",
......@@ -44501,15 +44477,6 @@
"integrity": "sha512-yz/iVTjWQ2ewtnYf3k56Ya0OUch0hdIMPdanXl2Za3gmRLaQGlzit7ZTs+/3S6T0iBud7nQrrldFihf4XVrvlw==",
"dev": true
},
"bindings": {
"version": "http://npmprivate.quantgroups.com/bindings/-/bindings-1.5.0.tgz",
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
"dev": true,
"optional": true,
"requires": {
"file-uri-to-path": "1.0.0"
}
},
"blink-diff": {
"version": "1.0.13",
"resolved": "http://npmprivate.quantgroups.com/blink-diff/-/blink-diff-1.0.13.tgz",
......@@ -48293,13 +48260,6 @@
"resolved": "http://npmprivate.quantgroups.com/file-saver/-/file-saver-2.0.5.tgz",
"integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA=="
},
"file-uri-to-path": {
"version": "1.0.0",
"resolved": "http://npmprivate.quantgroups.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
"dev": true,
"optional": true
},
"filename-reserved-regex": {
"version": "1.0.0",
"resolved": "http://npmprivate.quantgroups.com/filename-reserved-regex/-/filename-reserved-regex-1.0.0.tgz",
......@@ -55551,12 +55511,6 @@
"resolved": "http://npmprivate.quantgroups.com/mute-stream/-/mute-stream-0.0.7.tgz",
"integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s="
},
"nan": {
"version": "http://npmprivate.quantgroups.com/nan/-/nan-2.14.2.tgz",
"integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==",
"dev": true,
"optional": true
},
"nanoid": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz",
......@@ -14,7 +14,6 @@ const AddAreaModal = props => {
templateData,
} = props;
const [addList, setAddList] = useState([]);
const [initList, setInitList] = useState([]);
const [selectedList, setSelectedList] = useState([]);
const [selected, setSelect] = useState([]);
const a = [];
......@@ -40,7 +39,6 @@ const AddAreaModal = props => {
}),
);
setAddList(newData);
setInitList(newData);
}
};
......@@ -66,12 +64,6 @@ const AddAreaModal = props => {
}),
);
targetOption.children = newData;
let checkedData = [];
if (targetOption.addressLevel > 1) {
checkedData = initList.concat(targetOption).concat(newData);
} else {
checkedData = initList.concat(newData);
}
targetOption.loading = false;
setAddList([...addList]);
}
......@@ -127,34 +119,24 @@ const AddAreaModal = props => {
});
};
// 判断是否重复
const getChilds = (data, address) => {
const arr = [];
const reslutData = [];
for (let i = 0; i < data.length; i += 1) {
const item = data[i];
if (!item.addressName.includes(address.addressName)) {
arr.push(item);
}
}
for (let i = 0; i < arr.length; i += 1) {
const item = arr[i];
if (!address.addressName.includes(item.addressName)) {
reslutData.push(item);
}
}
const getChilds = select => {
const reslutData = selectedList.filter(
item =>
!select.addressName.includes(item.addressName) &&
!item.addressName.includes(select.addressName),
);
reslutData.push(select);
return reslutData;
};
const onPopupVisibleChange = labels => {
if (!labels && selected?.length) {
let data = selectedList;
const select = selected.slice(-1)[0];
const arr = selected.map(x => x.label);
select.addressName = arr.join('/');
const staust = getChilds(data, select);
staust.push(select);
data = staust;
const reslutData = getChilds(select);
// 用中文字符排序
const resultArray = data.sort((param1, param2) =>
const resultArray = reslutData.sort((param1, param2) =>
param1.addressName.localeCompare(param2.addressName, 'zh'),
);
setSelectedList([...resultArray]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment