Newer
Older
HuangJiPC / src / apiData / api-map.js
@zengcong zengcong on 8 Jul 8 KB 1
/*
 * @Author: WangYu
 * @Date: 2022-04-09 16:14:03
 * @LastEditors: WangYu
 * @LastEditTime: 2022-06-22 23:05:02
 * @FilePath: /hbue-large-screen/src/api/api-map.ts
 * @Description:
 * @copyright: Copyright (c) ${now_year} by WangYu, All Rights Reserved.
 */
import axios from 'axios';
import { datasourceEmits } from 'vue-cesium';
import moment from 'moment';
var stompClient = null;

const request = axios.create({
  timeout: 10 * 60 * 1000,
});

const err = (error) => {
  const { response } = error;
  if (response && response.status) {
    const { status } = response;
    window.$notification.error({
      content: `请求错误 ${status}`,
      meta: '接口错误,请联系管理员',
      duration: 2500,
    });
  } else if (!response) {
    window.$notification.error({
      content: '网络异常',
      meta: '请检查您的网络',
      duration: 2500,
    });
  }
  return response;
};

//请求拦截器
request.interceptors.request.use((config) => {
  // 鸿数将token拼接在iframe的src里面
  const token = localStorage.getItem('tokenXF');
  // const token = new URL(window.location).searchParams.get('hsTn');
  // localStorage.setItem('tokenXF', token);

  if (token) {
    config.headers['token'] = token; // 让每个请求携带自定义 token 请根据实际情况自行修改
  }
  config.headers['Content-Type'] = 'application/json';
  return config;
}, err);

// 响应拦截器
request.interceptors.response.use((response) => {
  if (response.data.code === 401) {
    window.$notification.error({
      content: '登录已过期',
      meta: '请返回重新登录了再进行操作',
      duration: 2500,
    });
    // 重置vuex里的用户信息;
    store.commit('user/RESET_INFO');
    top.window.location.href = 'http://192.168.10.33:7000/login'; //鸿数登录页
  } else if (response.data.code == 500) {
    window.$message.warning(response.data.msg || '服务器发生错误');
  }
  return response;
}, err);

// 获取全部空间数据
export async function findByType (type) {
  const { data } = await request({
    url: `/space/${type}/list`,
    method: 'get',
  });
  return data;
}

// 积水
export async function zshisdatalist (
  param = {
    paramMap: {
      begindate: moment().format('YYYY-MM-DD 09:00:00'),
      enddate: moment().format('YYYY-MM-DD HH:mm:ss'),
    },
  }
) {
  const { data } = await request('/drainage-v3/dmps/api/v0/hjly/js-realtime/page?authMode=skip-auth', {
    method: 'POST',
    data: param || '',
    timeout: '10000',
  });
  return data;
}

// 雨量 武汉市
export async function rainlist (
  param = {
    paramMap: {
      begindate: moment().format('YYYY-MM-DD 09:00:00'),
      enddate: moment().format('YYYY-MM-DD HH:mm:ss'),
    },
  }
) {
  const { data } = await request('/drainage-v3/dmps/api/v1/hjly/rainlist/list', {
    method: 'POST',
    data: param || '',
    timeout: '10000',
  });
  return data;
}

// 雨量 武汉市外
export async function rainlistOutUrban (
  param = {
    paramMap: {
      begindate: '2024-05-20 00:00:00',
      enddate: '2024-05-24 00:00:00',
    },
  }
) {
  const { data } = await request('/drainage-v3/dmps/api/v1/hjly/drpLive/page', {
    method: 'POST',
    data: param || '',
    timeout: '10000',
  });
  return data;
}

// 水库
export async function sklist (param = {}) {
  const { data } = await request('/drainage-v3/dmps/api/v1/hjly/skList/page', {
    method: 'POST',
    data: param || '',
    timeout: '10000',
  });
  return data;
}

// 监控
export async function cameralist (param = {}) {
  const { data } = await request('/drainage-v3/dmps/api/1/hjly/ST_VIDEO_REL/list', {
    method: 'POST',
    data: param || '',
    timeout: '10000',
  });
  return data;
}

// 获取视频流
export async function getCameraUrl (code) {
  const { data } = await request(
    '/vision/previewURLs?cameraIndexCode=${code}&protocol=hls&expand=transcode=1%26videotype=h264&streamType=1',
    {
      method: 'POST',
      data: param || '',
      timeout: '10000',
    }
  );
  return data;
}

// 泵站
export async function pumplist (param = {}) {
  const { data } = await request('/drainage-v3/dmps/api/v1/hjly/pumplist/list', {
    method: 'POST',
    data: param || '',
    timeout: '10000',
  });
  return data;
}
// 港渠
export async function canllist (param = {}) {
  const { data } = await request('/drainage-v3/dmps/api/v1/hjly/canllist/list', {
    method: 'POST',
    data: param || '',
    timeout: '10000',
  });
  return data;
}
// 湖泊
export async function lakelist (param = {}) {
  const { data } = await request('/drainage-v3/dmps/api/v1/hjly/lakelist/list', {
    method: 'POST',
    data: param || '',
    timeout: '10000',
  });
  return data;
}
//查询各级在职河湖长
export async function hhzOnJob (param = {}) {
  const { data } = await request('/drainage-v3/dmps/api/v1/hjly/hhzPeople/list', {
    method: 'POST',
    data: param || '',
    timeout: '10000',
  });
  return data;
}

//查询hhz达标率
export async function hhzStaticCount (param = {}) {
  const { data } = await request('/drainage-v3/dmps/api/v1/hjly/hhzStaticCount/list', {
    method: 'POST',
    data: param || '',
    timeout: '10000',
  });
  return data;
}
//查询行政区域划分
export async function findAreaStats () {
  const { data } = await request('/drainage-v3/hhz/Areatreefhh', {
    method: 'POST',
    data: param || '',
    timeout: '10000',
  });
  return data;
}

export async function Areatreefhh (param = {}) {
  const { data } = await request({
    baseURL: '/drainage-v3/dmps',
    //url: `/api/v1/hjly/Areatreefhh/list`,
    method: 'post',
  });
  return data;
}
//hhzSurvey  河湖长查询概况
export async function hhzSurvey (param = {}) {
  const { data } = await request({
    baseURL: '/drainage-v3/dmps',
    url: `/api/v1/hjly/hhzSurvey/list`,
    method: 'get',
  });
  return data;
}
//hhzPeople 河湖长在职
export async function hhzCount (param = {}) {
  const { data } = await request({
    baseURL: '/drainage-v3/dmps',
    url: `/api/v1/hjly/hhzPeopleCount/one`,
    method: 'get',
  });
  return data;
}
export async function lakeView (param = {}) {
  const { data } = await request({
    baseURL: '/drainage-v3/dmps',
    url: `/api/v1/hjly/fhhLyjcData/one`,
    method: 'get',
  });
  return data;
}
// 河道
export async function riverlist (param = {}) {
  const { data } = await request('/drainage-v3/dmps/api/v1/hjly/riverlist/list', {
    method: 'POST',
    data: param || '',
    timeout: '10000',
  });
  return data;
}
// 涵闸
export async function waslist (param = {}) {
  const { data } = await request('/drainage-v3/dmps/api/v1/hjly/waslist/list', {
    method: 'POST',
    data: param || '',
    timeout: '10000',
  });
  return data;
}
//自来水
export async function zlslist (param = {}) {
  const { data } = await request('/drainage-v3/dmps/api/v1/hjly/waterWorks/list', {
    method: 'POST',
    data: param || '',
    timeout: '10000',
  });
  return data;
}
//污水
export async function wslist (param = {}) {
  const { data } = await request('/drainage-v3/dmps/api/v1/hjly/wscList/list', {
    method: 'POST',
    data: param || '',
    timeout: '10000',
  });
  return data;
}
// 积水
export async function zslist (param = {}) {
  const { data } = await request('/drainage-v3/dmps/api/v1/hjly/jslist/list', {
    method: 'POST',
    data: param || '',
    timeout: '10000',
  });
  return data;
}
// 积水详情
export async function getCheckData (param = {}) {
  const { data } = await request({
    baseURL: '/drainage-v3/dmps',
    url: `/api/v1/hjly/patrolCheck/list`,
    method: 'POST',
    data: param,
  });
  return data;
}

//河湖长巡查统计
export async function getHhzData (param = {}) {
  const { data } = await request({
    baseURL: '/drainage-v3/dmps',
    url: '/api/v1/hjly/hhzStaticCount/list',
    method: 'post',
    data: param,
  });
  return data;
}
//巡查履职考核情况
export async function getLvzhiData (param = {}) {
  const { data } = await request({
    baseURL: '/drainage-v3/dmps',
    url: '/api/v1/hjly/patrolCheck/list',
    method: 'post',
    data: param,
  });
  return data;
}
// 积水详情
export async function zsDetailPage (param = {}) {
  const { data } = await request({
    baseURL: '/drainage-v3/dmps',
    url: `/api/v1/hjly/jslist/list`,
    method: 'POST',
    data: param,
  });
  return data;
}
// 积水详情
export async function findplanTimeStats (param = {}) {
  const { data } = await request({
    baseURL: '/drainage-v3/hhz',
    url: `planTime`,
    method: 'post',
    data: param,
  });
  return data;
}

export async function getFindQuestion (param) {
  const { data } = await request({
    baseURL: '/drainage-v3/dmps',
    url: '/api/v1/hjly/find-question/list',
    method: 'get',
    data: param,
  });
  return data;
}