北京经济技术开发区经开区虚拟城市项目-【前端】--政府服务中心-1号屏Web
lixuliang
2023-10-07 bc9913b5abd7166fbb38f575060e9f3be4596835
src/assets/js/rpc.js
@@ -83,15 +83,57 @@
            liushisijiayuanqudizhibianmafuwu(res),//园区
            findAddressCandidates(res),//地块
        ]).then(result => {
            var valdata = result[0];
            var valdata1 = result[1];
            if (valdata.length > 0) {
            }
            if (valdata1.length > 0) {
            }
            let objArr = []
            //企业
            var EntArr = result[0].result.filter((item) => {
                return item.entName.includes(res);
            })
            EntArr.forEach((val) => {
                let itemObj = {
                    type: "企业",
                    name: val.entName,
                    address: val.address,
                    lon: val.x,
                    lat: val.y,
                };
                objArr.push(itemObj);
            });
            //园区
            var YQArr = result[1].candidates.filter((item) => {
                return item.attributes.YQmingchen.includes(res);
            });
            YQArr.forEach((val) => {
                let itemObj = {
                    type: "园区",
                    name: val.attributes.YQmingchen,
                    address: val.attributes.YQdizhi,
                    lon: val.location.x,
                    lat: val.location.y,
                };
                objArr.push(itemObj);
            });
            //地块
            var LandArr = result[2].candidates.filter((item) => {
                return item.attributes.QYMC.includes(res);
            })
            // 结果根据QYMC从短到长排序
            LandArr.sort((a, b) => (b.attributes.QYMC.length === a.attributes.QYMC.length ? 0 : a.attributes.QYMC.length > b.attributes.QYMC.length ? 1 : -1))
            LandArr.forEach((val) => {
                let itemObj = {
                    type: "地块",
                    name: val.attributes.QYMC,
                    area: val.attributes.area,
                    code: val.attributes["地块编"],
                    lon: val.location.x,
                    lat: val.location.y,
                };
                objArr.push(itemObj);
            });
            console.log(EntArr);
            console.log(YQArr);
            console.log(LandArr);
            console.log(objArr);
            debugger
        })