fix(map): 修复添加分公司点时数据处理逻辑错误
- 优化请求数据赋值,避免重复请求 - 在无pointInfo时使用请求到的数据赋值 - 保证filterNull函数处理正确的数组数据 - 改进代码可读性与逻辑流畅性master
parent
da80837605
commit
588dfcfbcf
|
|
@ -130,11 +130,15 @@ export default function useMapMethods(viewerRef, request) {
|
||||||
|
|
||||||
// 添加分公司点
|
// 添加分公司点
|
||||||
const addBranchOfficePoint = async (portArea = "", pointInfo = null) => {
|
const addBranchOfficePoint = async (portArea = "", pointInfo = null) => {
|
||||||
const { data = [] } = await request.getCorpInfoListAll({ eqPortArea: portArea, inType: [0, 1, 2, 6] });
|
let requestData = [];
|
||||||
|
if (!pointInfo) {
|
||||||
|
const { data = [] } = await request.getCorpInfoListAll({ eqPortArea: portArea, inType: [0, 1, 2, 6] });
|
||||||
|
requestData = data;
|
||||||
|
}
|
||||||
mitt.emit(changeCoverMaskVisibleMittKey, true);
|
mitt.emit(changeCoverMaskVisibleMittKey, true);
|
||||||
let branchOfficePoint = [];
|
let branchOfficePoint = [];
|
||||||
if (!pointInfo) {
|
if (!pointInfo) {
|
||||||
branchOfficePoint = filterNull(data);
|
branchOfficePoint = filterNull(requestData);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
branchOfficePoint = filterNull([pointInfo]);
|
branchOfficePoint = filterNull([pointInfo]);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue