|
|
@ -128,8 +128,26 @@ export const queryLayersByPos = (position, layerList = [], cb) => { |
|
|
|
url: layer.url, |
|
|
|
k: layer.serviceToken, |
|
|
|
}); |
|
|
|
if ([200, 201].includes(result.status)) { |
|
|
|
console.log("处理业务数据 >>>>>> ", result); |
|
|
|
if ([200, 201].includes(result.status) && result?.data?.datasetInfos?.length > 0) { |
|
|
|
console.log("处理业务数据 >>>>>> ", result?.data); |
|
|
|
const fieldInfos = result.data.datasetInfos?.[0]?.fieldInfos; |
|
|
|
console.log('fieldInfos >>>>> ', fieldInfos) |
|
|
|
const currentFeature = result.data.features?.[0]; |
|
|
|
console.log('currentFeature >>>>> ', currentFeature) |
|
|
|
const nameIndex = fieldInfos.findIndex((f) => ['res_name', 'dike_name', 'waga_name'].includes(f.name)); |
|
|
|
const codeIndex = fieldInfos.findIndex((f) => ['res_code','dike_code', 'waga_code'].includes(f.name)); |
|
|
|
// if (layer?.fields?.length > 0) {
|
|
|
|
// const fieldIndex = fieldInfos.findIndex((f) => f.name === layer?.fields[0]?.field);
|
|
|
|
// code = currentFeature?.fieldValues[fieldIndex];
|
|
|
|
// }
|
|
|
|
let resData = { |
|
|
|
attributes: { |
|
|
|
res_code: currentFeature[codeIndex], |
|
|
|
res_name: currentFeature[nameIndex], |
|
|
|
} |
|
|
|
} |
|
|
|
console.log('resData >>>>> ', resData) |
|
|
|
if(cb) cb(resData) |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|