report.js 8.83 KB
Newer Older
陈龙's avatar
陈龙 committed
1 2 3 4 5 6 7 8 9
/*
 ** 轻量化报表平台接口
 ** create by ChenLong on 2022/6/24
 ** 功能路径:src\api\service\report.js
 ** 菜单参数列表:*变量名*(变量说明,数据类型,是否必填,取值范围)
 **/
import { request } from '@wisdom-utils/utils';
import * as constants from '../constants';

10
const BASEURL = '/PandaWater/CityWater/ReportManager';
陈龙's avatar
陈龙 committed
11
export const API = {
陈龙's avatar
陈龙 committed
12 13
  // GET_REPORT_INFO: `${BASEURL}/GetReportInfo`, // 获取报表信息
  GET_REPORT_INFO: `${BASEURL}/GetReportData`, // 获取报表信息
陈龙's avatar
陈龙 committed
14 15 16 17 18 19 20 21 22 23 24
  GET_REPORT_FILTER_VALUE: `${BASEURL}/GetReportFilterValue`, // 获取过滤字段的值的枚举
  GET_REPORT_FILTER_VALUES: `${BASEURL}/GetReportFilterValues`, // 获取过滤字段的值的枚举
  GET_REPORT_CONFIG_LIST: `${BASEURL}/GetReportConfigList`, // 获取配置列表
  GET_REPORT_DETAILS_INFO: `${BASEURL}/GetReportDetailsInfo`, // 获取配置详情
  GET_TABLES: `${BASEURL}/GetTables`, // 查询表
  GET_TABLE_FIELDS: `${BASEURL}/GetTableFields`, // 查询表内的字段
  ADD_REPORT_INFO: `${BASEURL}/AddReportInfo`, // 创建报表主表、关联报表子表
  EDIT_REPORT_INFO: `${BASEURL}/AddReportInfo`,
  ADD_REPORT_DETAIL_INFO: `${BASEURL}/AddReportDetailInfo`, // 附加子表字段到主表
  DELETE_REPORT_INFO: `${BASEURL}/DeleteReportInfo`, // 删除报表
  DELETE_REPORT_DETAIL_INFO: `${BASEURL}/DeleteReportDetailInfo`, // 删除字段
陈龙's avatar
陈龙 committed
25 26 27 28 29 30
  // EXPORT_ACCOUNT_DATA: `${BASEURL}/ExportAccountData`, // 导出数据
  EXPORT_ACCOUNT_DATA: `${BASEURL}/ExportReportData`, // 导出数据
  // REPORT_FILES_DOWNLOAD: `${BASEURL}/ReportFilesDownload`, // 导出选中数据
  REPORT_FILES_DOWNLOAD: `${BASEURL}/DownloadReportFiles`, // 导出选中数据
  SAVE_REPORT_LIST_SORT_FIELDS: `${BASEURL}/SaveReportSortFields`, // 保存排序
  GET_REPORT_SORT_FIELDS:`${BASEURL}/GetReportSortFields`,
陈龙's avatar
陈龙 committed
31 32 33 34 35 36
  ADD_REPORT_DETAIL_INFO_INDEX: `${BASEURL}/AddReportDetailInfoIndex`, // 变更接口顺序
  UPDATE_REPORT_DATA: `${BASEURL}/UpdateReportData`, // 更新报表数据
  GET_REPORT_DETAILS: `${BASEURL}/GetReportDetails`, // 获取报表配置
  DEL_REPORT_DATA: `${BASEURL}/DelReportData`, // 删除报表数据
  SET_REPORT_ALLOW: `${BASEURL}/SetReportAllow`, // 设置关注
  ADD_REPORT_DATA: `${BASEURL}/AddReportData`, // 添加报表数据
陈龙's avatar
陈龙 committed
37 38
  // EXPORT_JPG: `${BASEURL}/ExportJPGAccountData`,
  EXPORT_JPG: `${BASEURL}/ExportReportDataWithJPG`,
陈龙's avatar
陈龙 committed
39 40 41 42 43 44 45 46 47
  EXPORT_REPORT_CONFIG: `${BASEURL}/ExportReportConfig`,
  IMPORT_REPORT_CONFIG: `${BASEURL}/ImportReportConfig`,
  // 多数据源
  GET_DATA_SOURCES: `${BASEURL}/GetDataSources`, // 获取数据源列表
  ADD_DB_CONNECTION: `${BASEURL}/AddDbConnection`, // 新增/编辑数据源
  DELETE_DB_CONNECTION: `${BASEURL}/DeleteDbConnection`, // 删除数据源
  GET_DB_SOURCES: `${BASEURL}/GetDBSources`, // 获取数据库
  TEST_CONNECTION: `${BASEURL}/TestConnection`, // 测试链接
  DEL_REPORT_CHILD: `${BASEURL}/DelReportChlid`, // 删除挂接关系
陈龙's avatar
陈龙 committed
48 49 50 51 52
  // 图表配置开发
  SAVE_CHART_CONFIG: `${BASEURL}/SaveChartConfig`, // 保存图表配置
  GET_CHART_CONFIG: `${BASEURL}/GetChartConfig`, // 获取图表配置
  // 图表部分接口
  GET_CHART_CONFIG_DATA_BY_COLUMN: `${BASEURL}/GetChartConfigDataByColumn`, //获取图表数据
陈龙's avatar
陈龙 committed
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
};
const reportService = {
  getReportInfo: {
    url: API.GET_REPORT_INFO,
    method: constants.REQUEST_METHOD_POST,
    type: constants.REQUEST_METHOD_POST,
  },
  getReportFilterValue: {
    url: API.GET_REPORT_FILTER_VALUE,
    method: constants.REQUEST_METHOD_GET,
    type: constants.REQUEST_METHOD_GET,
  },
  getReportFilterValues: {
    url: API.GET_REPORT_FILTER_VALUES,
    method: constants.REQUEST_METHOD_POST,
    type: constants.REQUEST_METHOD_POST,
  },
  getReportConfigList: {
    url: API.GET_REPORT_CONFIG_LIST,
    method: constants.REQUEST_METHOD_GET,
    type: constants.REQUEST_METHOD_GET,
  },
  getReportDetailsInfo: {
    url: API.GET_REPORT_DETAILS_INFO,
    method: constants.REQUEST_METHOD_GET,
    type: constants.REQUEST_METHOD_GET,
  },
  getTables: {
    url: API.GET_TABLES,
    method: constants.REQUEST_METHOD_GET,
    type: constants.REQUEST_METHOD_GET,
  },
  getTableFields: {
    url: API.GET_TABLE_FIELDS,
    method: constants.REQUEST_METHOD_POST,
    type: constants.REQUEST_METHOD_POST,
  },
  addReportInfo: {
    url: API.ADD_REPORT_INFO,
    method: constants.REQUEST_METHOD_POST,
93
    type: constants.REQUEST_METHOD_POST,
陈龙's avatar
陈龙 committed
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
  },
  editReportInfo: {
    url: API.EDIT_REPORT_INFO,
    method: constants.REQUEST_METHOD_POST,
    type: constants.REQUEST_METHOD_POST,
  },
  addReportDetailInfo: {
    url: API.ADD_REPORT_DETAIL_INFO,
    method: constants.REQUEST_METHOD_POST,
    type: constants.REQUEST_METHOD_POST,
  },
  deleteReportInfo: {
    url: API.DELETE_REPORT_INFO,
    method: constants.REQUEST_METHOD_GET,
    type: constants.REQUEST_METHOD_GET,
  },
  deleteReportDetailInfo: {
    url: API.DELETE_REPORT_DETAIL_INFO,
    method: constants.REQUEST_METHOD_GET,
    type: constants.REQUEST_METHOD_GET,
  },
陈龙's avatar
陈龙 committed
115 116 117 118 119
  getReportSortFields:{
    url: API.GET_REPORT_SORT_FIELDS,
    method: constants.REQUEST_METHOD_GET,
    type: constants.REQUEST_METHOD_GET,
  },
陈龙's avatar
陈龙 committed
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
  saveReportListSortFields: {
    url: API.SAVE_REPORT_LIST_SORT_FIELDS,
    method: constants.REQUEST_METHOD_POST,
    type: constants.REQUEST_METHOD_POST,
  },
  addReportDetailInfoIndex: {
    url: API.ADD_REPORT_DETAIL_INFO_INDEX,
    method: constants.REQUEST_METHOD_POST,
    type: constants.REQUEST_METHOD_POST,
  },
  updateReportData: {
    url: API.UPDATE_REPORT_DATA,
    method: constants.REQUEST_METHOD_POST,
    type: constants.REQUEST_METHOD_POST,
  },
  getReportDetails: {
    url: API.GET_REPORT_DETAILS,
    method: constants.REQUEST_METHOD_GET,
    type: constants.REQUEST_METHOD_GET,
  },
  delReportData: {
    url: API.DEL_REPORT_DATA,
    method: constants.REQUEST_METHOD_POST,
    type: constants.REQUEST_METHOD_POST,
  },
  setReportAllow: {
    url: API.SET_REPORT_ALLOW,
    method: constants.REQUEST_METHOD_POST,
    type: constants.REQUEST_METHOD_POST,
  },
  addReportData: {
    url: API.ADD_REPORT_DATA,
    method: constants.REQUEST_METHOD_POST,
    type: constants.REQUEST_METHOD_POST,
  },
  exportJPG: {
    url: API.EXPORT_JPG,
    method: constants.REQUEST_METHOD_POST,
    type: constants.REQUEST_METHOD_POST,
  },
  exportConfig: {
    url: API.EXPORT_REPORT_CONFIG,
    method: constants.REQUEST_METHOD_GET,
    type: constants.REQUEST_METHOD_GET,
  },
  importConfig: {
    url: API.IMPORT_REPORT_CONFIG,
    method: constants.REQUEST_METHOD_POST,
    type: constants.REQUEST_METHOD_POST,
  },
  getDataSources: {
    url: API.GET_DATA_SOURCES,
    method: constants.REQUEST_METHOD_GET,
    type: constants.REQUEST_METHOD_GET,
  },
  addDbConnection: {
    url: API.ADD_DB_CONNECTION,
    method: constants.REQUEST_METHOD_POST,
    type: constants.REQUEST_METHOD_POST,
  },
  deleteDbConnection: {
    url: API.DELETE_DB_CONNECTION,
    method: constants.REQUEST_METHOD_GET,
    type: constants.REQUEST_METHOD_GET,
  },
  getDbSources: {
    url: API.GET_DB_SOURCES,
    method: constants.REQUEST_METHOD_POST,
    type: constants.REQUEST_METHOD_POST,
  },
  testConnection: {
    url: API.TEST_CONNECTION,
    method: constants.REQUEST_METHOD_POST,
    type: constants.REQUEST_METHOD_POST,
  },
  delReportChild: {
    url: API.DEL_REPORT_CHILD,
    method: constants.REQUEST_METHOD_GET,
    type: constants.REQUEST_METHOD_GET,
  },
陈龙's avatar
陈龙 committed
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
  saveChartConfig: {
    url: API.SAVE_CHART_CONFIG,
    method: constants.REQUEST_METHOD_POST,
    type: constants.REQUEST_METHOD_POST,
  },
  getChartConfigDataByColumn: {
    url: API.GET_CHART_CONFIG_DATA_BY_COLUMN,
    method: constants.REQUEST_METHOD_POST,
    type: constants.REQUEST_METHOD_POST,
  },
  getChartConfig: {
    url: API.GET_CHART_CONFIG,
    method: constants.REQUEST_METHOD_GET,
    type: constants.REQUEST_METHOD_GET,
  },
陈龙's avatar
陈龙 committed
215
};
陈龙's avatar
陈龙 committed
216 217 218 219 220 221
export const submitReportData = (params, data) => request({
  url: API.UPDATE_REPORT_DATA,
  method: 'post',
  params,
  data,
});
陈龙's avatar
陈龙 committed
222
export const exportAccountData = (options, params, data) =>
陈龙's avatar
陈龙 committed
223 224 225 226 227 228 229
    request({
      url: API.EXPORT_ACCOUNT_DATA,
      method: 'post',
      ...options,
      params,
      data,
    });
230
export const reportFilesDownload = (options, params, data) =>
陈龙's avatar
陈龙 committed
231 232 233 234 235 236 237
    request({
      url: API.REPORT_FILES_DOWNLOAD,
      method: 'post',
      ...options,
      params,
      data,
    });
陈龙's avatar
陈龙 committed
238 239 240 241 242 243 244 245
export const exportJPG = (options, data) => {
  return request({
    url: API.EXPORT_JPG,
    method: 'post',
    ...options,
    data,
  });
};
陈龙's avatar
陈龙 committed
246 247 248 249 250
export const addReportDetailInfoIndex = (data) => request({
  url: API.ADD_REPORT_DETAIL_INFO_INDEX,
  method: 'post',
  data,
});
陈龙's avatar
陈龙 committed
251
export const importReportConfig = (options, params, data) =>
陈龙's avatar
陈龙 committed
252 253 254 255 256 257 258
    request({
      url: API.IMPORT_REPORT_CONFIG,
      method: 'post',
      ...options,
      params,
      data,
    });
陈龙's avatar
陈龙 committed
259
export const exportReportConfig = (options, params) =>
陈龙's avatar
陈龙 committed
260 261 262 263 264 265
    request({
      url: API.EXPORT_REPORT_CONFIG,
      method: 'get',
      ...options,
      params,
    });
陈龙's avatar
陈龙 committed
266
export default reportService;