import {config} from '../../config'; import CachePromise from '../../utils/cachepromise'; import {httpget, httppost1, httppost2, httppost3, httpget2} from '../../utils/request'; import apiurl from "../../service/apiurl"; import appconsts from '../../service/appconsts'; import {message} from "antd"; //外协-区域降雨 export const DrpRealPromiseWX = new CachePromise( // () => httppost2(apiurl.queryDetails, { countycode:localStorage.getItem('ADCD6') + '000000',source: ["SH","SW","SK","QX"] }) // .then(({ data }) => data || []) // .then((data) => { // if (config.notShowPOI?.drp) { // const hidemap = { // ...config.notShowPOI.drp, // ...(config.notShowPOI?.hd || {}), // ...(config.notShowPOI?.sk || {}), // } // return data.filter(o => !hidemap[o.stcd]); // } // return data; // }) // .catch(() => null), // 5000 // 全部雨量站点信息,没有雨量值 () => httpget2(apiurl.station.rainfallStation.list)//agnp.geojson adcd.geojson .then(({ data }) => data || []) .then((data) => { return data; }) .catch(() => null), 5000 ); export const drpWX = async () => { const { data } = await httppost2(apiurl.queryDetails, { countycode:localStorage.getItem('ADCD6') + '000000',source: ["SH","SW","SK","QX"] }) || {}; return data || [] }; //外协 河道水位 export const HDRealPromiseWX = new CachePromise( // () => httppost2(apiurl.watershedLevel.queryDetails, { countycode:localStorage.getItem('ADCD6') + '000000', "source": ["SH","SW"] }) // .then(({ data }) => data || []) // .then((data) => { // if (config.notShowPOI?.hd) { // return data.filter(o => !config.notShowPOI.hd[o.stcd]); // } // return data; // }) // .catch(() => null), // 5000 () => httppost2(apiurl.station.gaugingStation.list, {"sources": ["SW","SH"],"args": ""}) .then(({ data }) => data || []) .then((data) => { // if (config.notShowPOI?.hd) { // return data.filter(o => !config.notShowPOI.hd[o.stcd]); // } return data; }) .catch(() => null), 5000 ); //监测站网-水情(SH、SW) export const HDRealPromiseWX2 = new CachePromise( // () => httppost2(apiurl.watershedLevel.queryDetails, { countycode:localStorage.getItem('ADCD6') + '000000', "source": ["SH","SW"] }) // .then(({ data }) => data || []) // .then((data) => { // if (config.notShowPOI?.hd) { // return data.filter(o => !config.notShowPOI.hd[o.stcd]); // } // return data; // }) // .catch(() => null), // 5000 () => httppost2(apiurl.station.gaugingStation.list, {"sources": ["SW","SH"],"args": ""}) .then(({ data }) => data || []) .then((data) => { // if (config.notShowPOI?.hd) { // return data.filter(o => !config.notShowPOI.hd[o.stcd]); // } return data || []; }) .catch(() => null), 5000 ); //监测站网-水情(SK) export const HDRealPromiseWX3 = new CachePromise( () => httppost2(apiurl.sssq.reservoirlist, {"sources": ["SK","SW"],"args": ""}) .then(({ data }) => data || []) .then((data) => { return data || []; }) .catch(() => null), 5000 ); //查询简易河道水位站信息 export const HDJyPromise = new CachePromise( () => httppost2(apiurl.queryHdDetial, { countycode:localStorage.getItem('ADCD6') + '000000', "source": ["SH","SW"] }) .then(({ data }) => data || []) .then((data) => { if (config.notShowPOI?.hd) { return data.filter(o => !config.notShowPOI.hd[o.stcd]); } return data; }) .catch(() => null), 5000 ); export const SkRealPromiseWX = new CachePromise( // () => httppost2(apiurl.queryStRsvrRSk, { countycode: localStorage.getItem('ADCD6') }) // .then(({ data }) => data || []) // .then(data => data.map(o => ({ // ...o, // aRz: parseFloat((o.rz - o.fsltdz).toFixed(2)), // rzWarning: o.fsltdz ? o.rzWarning : 0 // }))) // .then((data) => { // if (config.notShowPOI?.sk) { // return data.filter(o => !config.notShowPOI.sk[o.stcd]); // } // return data; // }) // .catch(() => null), // 5000 () => httppost2(apiurl.home.sk) .then(({ data }) => data || []) .then((data) => { // if (config.notShowPOI?.hd) { // return data.filter(o => !config.notShowPOI.hd[o.stcd]); // } return data; }) .catch(() => null), 5000 ); //水电站 export const SdzRealPromiseWX = new CachePromise( () => httpget2(apiurl.station.hydropowerStation.list) .then(({ data }) => data || []) .then((data) => { // if (config.notShowPOI?.hd) { // return data.filter(o => !config.notShowPOI.hd[o.stcd]); // } return data; }) .catch(() => null), 5000 ); //供水 export const GongShuiPromiseWX = new CachePromise( () => httppost2(apiurl.home.gs) .then(({ data }) => data || []) .then((data) => { // if (config.notShowPOI?.hd) { // return data.filter(o => !config.notShowPOI.hd[o.stcd]); // } return data; }) .catch(() => null), 5000 ); //塘(堰)坝 export const TybRealPromiseWX = new CachePromise( () => httpget2(apiurl.station.TangYanBa.list) .then(({ data }) => data || []) .then((data) => { // if (config.notShowPOI?.hd) { // return data.filter(o => !config.notShowPOI.hd[o.stcd]); // } return data; }) .catch(() => null), 5000 ); //沿河居民户 export const YfzhdPromise = new CachePromise( () => httppost2(apiurl.home.yhjmh) .then(({ data }) => data || []) .then((data) => { // if (config.notShowPOI?.hd) { // return data.filter(o => !config.notShowPOI.hd[o.stcd]); // } return data; }) .catch(() => null), 5000 ); //企事业单位 export const DzzhdPromise = new CachePromise( () => httppost2(apiurl.home.qsydw) .then(({ data }) => data || []) .then((data) => { // if (config.notShowPOI?.hd) { // return data.filter(o => !config.notShowPOI.hd[o.stcd]); // } return data; }) .catch(() => null), 5000 ); //典型灾害事件 export const DxzhsjPromise = new CachePromise( () => httpget2(apiurl.station.DianXingZaiHaiShiJian.list) .then(({ data }) => data || []) .then((data) => { // if (config.notShowPOI?.hd) { // return data.filter(o => !config.notShowPOI.hd[o.stcd]); // } return data; }) .catch(() => null), 5000 ); //安置点 export const AzdPromise = new CachePromise( () => httppost2(apiurl.home.anzhidian) .then(({ data }) => data || []) .then((data) => { // if (config.notShowPOI?.hd) { // return data.filter(o => !config.notShowPOI.hd[o.stcd]); // } return data; }) .catch(() => null), 5000 ); /*export const PicStPromise = new CachePromise( () => httpget(apiurl.picst.list) .then(({ data }) => data) .catch(() => null) );*/ export const PicStPromise = async () => { const url = `${process.env.PUBLIC_URL}/data/geojson/${localStorage.getItem('address')}/picList.json`; if (!url) { return null; } const a1 = await fetch(url) .then(resp => resp.json()) .then(data => data) .catch(() => []); return [...a1]; } export const PicStMapDataPromise = async (params) => { // const myParams = { // countycode:localStorage.getItem('ADCD6') + '000000', // ...params // } const res = await httppost2(apiurl.home.video); // if (res.code !== 200) { // message.error(res.msg || '请求失败'); // return []; // } console.log("90+++",res); return res.data || []; } export const getRealPic = async ({ adcd, stcd }) => { const { obj } = await httpget(`${apiurl.pubapi_old}/shquery/tx/last`, { adcd: adcd ? adcd.substr(0, 6) + '000000' : localStorage.getItem('ADCD6') + '000000', stcd, debug: 0 }) || {}; if (!obj || !obj[0]) { return null; } return obj[0]; } export async function getRealPic1({ adcd, stcd }) { const { obj } = await httpget(`${apiurl.pubapi_old}/shquery/tx/last`, { adcd: adcd ? adcd.substr(0, 6) + '000000' : localStorage.getItem('ADCD6') + '000000', stcd, debug: 0 }) || {}; return obj; } //渗流 export const SLPromise = new CachePromise( () => httpget2(apiurl.home.sl) .then(({ data }) => data || []) .then((data) => { // if (config.notShowPOI?.hd) { // return data.filter(o => !config.notShowPOI.hd[o.stcd]); // } return data; }) .catch(() => null), 5000 ); //渗压 export const SYPromise = new CachePromise( () => httpget2(apiurl.home.sy) .then(({ data }) => data || []) .then((data) => { // if (config.notShowPOI?.hd) { // return data.filter(o => !config.notShowPOI.hd[o.stcd]); // } return data; }) .catch(() => null), 5000 ); //位移 export const WYPromise = new CachePromise( () => httpget2(apiurl.home.wy) .then(({ data }) => data || []) .then((data) => { // if (config.notShowPOI?.hd) { // return data.filter(o => !config.notShowPOI.hd[o.stcd]); // } return data; }) .catch(() => null), 5000 );