import { SkRealPromiseWX } from "../../../../models/_/real"; import BaseLayer from "../baselayer"; import ShuikuMarker from "./ShuikuMarker"; const sj = { "stcd": "61610701", "stnm": "檀树岗2", "rvnm": "檀树岗河", "hnnm": "长江中游下段北岸", "bsnm": "长江", "lgtd": "114.744317000", "lttd": "31.505000000", "stlc": "黄冈市红安县七里镇檀树岗村", "alt": null, "mdbz": null, "mdpr": null, "dtmnm": "吴淞", "dtmel": null, "dtpr": "0.000", "sttp": "RR", "dfrtms": null, "fritm": null, "frgrd": "3", "esstym": "197103", "bgfrym": "197103", "edfrym": null, "atcunit": "黄冈市水利和湖泊局", "admauth": "黄冈水文", "locality": "湖北水文", "stbk": null, "stazt": null, "dstrvm": null, "drna": "78", "phcd": "TSG", "usfl": "1", "comments": "中小河流改造", "moditime": "2022-02-23 00:00:00", "remGd": null, "ogid": null, "vlfl": null, "atid": null, "sdfl": null, "rma": null, "mdps": null, "mddt": null, "stindex": null, "starea": null, "stlevel": null, "code": null, "ispbj": null, "issxst": null, "stpq": null, "sthday": null, "source": "SW", "importancy": 0, "clgtd": "114.744317000", "clttd": "31.505000000", "elev": null, "crucial": 0, "buildYear": null, "adcd": null, "lyid": null, "resCode": "42120250085", "rvCode": null, "status": 1, "agreement": null, "simCard": null, "bdCard": null, "v": 104.1 } export default class ShuiKuLayer extends BaseLayer { static LayerName = 'ShuiKuLayer'; constructor(props) { super(props); this.highlights = {}; } getLayerName() { return ShuiKuLayer.LayerName; } onAdd() { SkRealPromiseWX.get().then((data) => { // if (Array.isArray(data)) { // data.forEach(o => { // const strarz = o.rz - o.fsltdz; // if (!isNaN(strarz)) { // o.strarz = strarz.toFixed(2); // } // }); // } const list = [...data,sj].map((i)=>{ return { id : i.stcd, name: i.stnm, ...i } }) this._dispatch.runtime.setMarkers({ [this.getLayerName()]: list || [] }); }); } setSetting(setting) { const highlights = setting?.highlight?.ShuiKuLayer; if (highlights !== this._setting?.highlight?.ShuiKuLayer) { const setting = {}; if (highlights) { for (const h of highlights) { setting[h] = true } } this._dispatch.map.setMarkerSetting({ [this.getLayerName()]: setting, }); } this._setting = setting; } getComponentCls() { return ShuikuMarker; } }