Commit 56a9d9c6 authored by lxd's avatar lxd

去重

parent 7fbd131f
...@@ -10686,16 +10686,6 @@ ...@@ -10686,16 +10686,6 @@
"integrity": "sha512-yz/iVTjWQ2ewtnYf3k56Ya0OUch0hdIMPdanXl2Za3gmRLaQGlzit7ZTs+/3S6T0iBud7nQrrldFihf4XVrvlw==", "integrity": "sha512-yz/iVTjWQ2ewtnYf3k56Ya0OUch0hdIMPdanXl2Za3gmRLaQGlzit7ZTs+/3S6T0iBud7nQrrldFihf4XVrvlw==",
"dev": true "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": { "node_modules/blink-diff": {
"version": "1.0.13", "version": "1.0.13",
"resolved": "http://npmprivate.quantgroups.com/blink-diff/-/blink-diff-1.0.13.tgz", "resolved": "http://npmprivate.quantgroups.com/blink-diff/-/blink-diff-1.0.13.tgz",
...@@ -15379,13 +15369,6 @@ ...@@ -15379,13 +15369,6 @@
"resolved": "http://npmprivate.quantgroups.com/file-saver/-/file-saver-2.0.5.tgz", "resolved": "http://npmprivate.quantgroups.com/file-saver/-/file-saver-2.0.5.tgz",
"integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA==" "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": { "node_modules/filename-reserved-regex": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "http://npmprivate.quantgroups.com/filename-reserved-regex/-/filename-reserved-regex-1.0.0.tgz", "resolved": "http://npmprivate.quantgroups.com/filename-reserved-regex/-/filename-reserved-regex-1.0.0.tgz",
...@@ -24592,13 +24575,6 @@ ...@@ -24592,13 +24575,6 @@
"resolved": "http://npmprivate.quantgroups.com/mute-stream/-/mute-stream-0.0.7.tgz", "resolved": "http://npmprivate.quantgroups.com/mute-stream/-/mute-stream-0.0.7.tgz",
"integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=" "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": { "node_modules/nanoid": {
"version": "3.3.1", "version": "3.3.1",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz",
...@@ -44501,15 +44477,6 @@ ...@@ -44501,15 +44477,6 @@
"integrity": "sha512-yz/iVTjWQ2ewtnYf3k56Ya0OUch0hdIMPdanXl2Za3gmRLaQGlzit7ZTs+/3S6T0iBud7nQrrldFihf4XVrvlw==", "integrity": "sha512-yz/iVTjWQ2ewtnYf3k56Ya0OUch0hdIMPdanXl2Za3gmRLaQGlzit7ZTs+/3S6T0iBud7nQrrldFihf4XVrvlw==",
"dev": true "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": { "blink-diff": {
"version": "1.0.13", "version": "1.0.13",
"resolved": "http://npmprivate.quantgroups.com/blink-diff/-/blink-diff-1.0.13.tgz", "resolved": "http://npmprivate.quantgroups.com/blink-diff/-/blink-diff-1.0.13.tgz",
...@@ -48293,13 +48260,6 @@ ...@@ -48293,13 +48260,6 @@
"resolved": "http://npmprivate.quantgroups.com/file-saver/-/file-saver-2.0.5.tgz", "resolved": "http://npmprivate.quantgroups.com/file-saver/-/file-saver-2.0.5.tgz",
"integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA==" "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": { "filename-reserved-regex": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "http://npmprivate.quantgroups.com/filename-reserved-regex/-/filename-reserved-regex-1.0.0.tgz", "resolved": "http://npmprivate.quantgroups.com/filename-reserved-regex/-/filename-reserved-regex-1.0.0.tgz",
...@@ -55551,12 +55511,6 @@ ...@@ -55551,12 +55511,6 @@
"resolved": "http://npmprivate.quantgroups.com/mute-stream/-/mute-stream-0.0.7.tgz", "resolved": "http://npmprivate.quantgroups.com/mute-stream/-/mute-stream-0.0.7.tgz",
"integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=" "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": { "nanoid": {
"version": "3.3.1", "version": "3.3.1",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz",
...@@ -14,7 +14,6 @@ const AddAreaModal = props => { ...@@ -14,7 +14,6 @@ const AddAreaModal = props => {
templateData, templateData,
} = props; } = props;
const [addList, setAddList] = useState([]); const [addList, setAddList] = useState([]);
const [initList, setInitList] = useState([]);
const [selectedList, setSelectedList] = useState([]); const [selectedList, setSelectedList] = useState([]);
const [selected, setSelect] = useState([]); const [selected, setSelect] = useState([]);
const a = []; const a = [];
...@@ -40,7 +39,6 @@ const AddAreaModal = props => { ...@@ -40,7 +39,6 @@ const AddAreaModal = props => {
}), }),
); );
setAddList(newData); setAddList(newData);
setInitList(newData);
} }
}; };
...@@ -66,12 +64,6 @@ const AddAreaModal = props => { ...@@ -66,12 +64,6 @@ const AddAreaModal = props => {
}), }),
); );
targetOption.children = newData; targetOption.children = newData;
let checkedData = [];
if (targetOption.addressLevel > 1) {
checkedData = initList.concat(targetOption).concat(newData);
} else {
checkedData = initList.concat(newData);
}
targetOption.loading = false; targetOption.loading = false;
setAddList([...addList]); setAddList([...addList]);
} }
...@@ -127,34 +119,24 @@ const AddAreaModal = props => { ...@@ -127,34 +119,24 @@ const AddAreaModal = props => {
}); });
}; };
// 判断是否重复 // 判断是否重复
const getChilds = (data, address) => { const getChilds = select => {
const arr = []; const reslutData = selectedList.filter(
const reslutData = []; item =>
for (let i = 0; i < data.length; i += 1) { !select.addressName.includes(item.addressName) &&
const item = data[i]; !item.addressName.includes(select.addressName),
if (!item.addressName.includes(address.addressName)) { );
arr.push(item); reslutData.push(select);
}
}
for (let i = 0; i < arr.length; i += 1) {
const item = arr[i];
if (!address.addressName.includes(item.addressName)) {
reslutData.push(item);
}
}
return reslutData; return reslutData;
}; };
const onPopupVisibleChange = labels => { const onPopupVisibleChange = labels => {
if (!labels && selected?.length) { if (!labels && selected?.length) {
let data = selectedList;
const select = selected.slice(-1)[0]; const select = selected.slice(-1)[0];
const arr = selected.map(x => x.label); const arr = selected.map(x => x.label);
select.addressName = arr.join('/'); select.addressName = arr.join('/');
const staust = getChilds(data, select); const reslutData = getChilds(select);
staust.push(select);
data = staust;
// 用中文字符排序 // 用中文字符排序
const resultArray = data.sort((param1, param2) => const resultArray = reslutData.sort((param1, param2) =>
param1.addressName.localeCompare(param2.addressName, 'zh'), param1.addressName.localeCompare(param2.addressName, 'zh'),
); );
setSelectedList([...resultArray]); 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