import { apiurl } from './apiurl.js';

// vm指向this
const install = (Vue, vm) => {
  // 登录
  let loginApi = (params = {}) => vm.$u.http.post(apiurl.loginUrl, params);
  // 退出登录
  let logoutApi = (params = {}) => vm.$u.http.get(apiurl.logoutUrl, params);
  // 获取字典数据
  let getDictApi = (params = {}) => vm.$u.http.get(apiurl.getDictUrl + params.type);
  // 获取参数设置接口
  let getParameterApi = (params = {}) => vm.$u.http.get(apiurl.getParameterUrl + params.key);
  // 今日概况
  let todayOverviewApi = {
    // 获取今日路段概况
    getTodayDataApi: (params = {}) =>
      vm.$u.http.get(apiurl.todayOverview.getTodayDataUrl, {
        params
      }),
    // 获取路段概况
    getRoadDataApi: (params = {}) =>
      vm.$u.http.get(apiurl.todayOverview.getRoadDataUrl, {
        params
      }),
    // 获取今日停车场概况
    getParkDataApi: (params = {}) =>
      vm.$u.http.get(apiurl.todayOverview.getParkDataUrl, {
        params
      })
  };
  // 运营分析
  let operationalAnalysisApi = {
    // 获取营收分析
    getRevenueDataApi: (params = {}) =>
      vm.$u.http.get(apiurl.operationalAnalysis.getRevenueDataUrl, {
        params
      }),
    // 获取营收分析(停车场)
    getParkingRevenueDataApi: (params = {}) =>
      vm.$u.http.get(apiurl.operationalAnalysis.getParkingRevenueDataUrl, {
        params
      }),
    // 获取路段/停车场营收排行
    getParkingLotRevenueDataApi: (params = {}) =>
      vm.$u.http.get(apiurl.operationalAnalysis.getParkingLotRevenueDataUrl, {
        params
      }),
    // 获取车流量分析
    getTrafficFlowDataApi: (params = {}) =>
      vm.$u.http.get(apiurl.operationalAnalysis.getTrafficFlowDataUrl, {
        params
      }),
    // 获取车流量分析(停车场)
    getParkingTrafficFlowDataApi: (params = {}) =>
      vm.$u.http.get(apiurl.operationalAnalysis.getParkingTrafficFlowDataUrl, {
        params
      }),
    // 获取收费员业绩排行
    getTollCollectorPerformanceApi: (params = {}) =>
      vm.$u.http.get(apiurl.operationalAnalysis.getTollCollectorPerformanceUrl, {
        params
      }),
    // 获取营收趋势统计
    getRevenueTrendsDataApi: (params = {}) =>
      vm.$u.http.get(apiurl.operationalAnalysis.getRevenueTrendsDataUrl, {
        params
      }),
    // 获取路段分析车流量分析
    getRoadTrafficFlowDataApi: (params = {}) =>
      vm.$u.http.get(apiurl.operationalAnalysis.getRoadTrafficFlowDataUrl, {
        params
      }),
    // 获取欠费分析
    getArrearsDataApi: (params = {}) =>
      vm.$u.http.get(apiurl.operationalAnalysis.getArrearsDataUrl, {
        params
      }),
    // 获取欠费分析(停车场)
    getParkingArrearsDataApi: (params = {}) =>
      vm.$u.http.get(apiurl.operationalAnalysis.getParkingArrearsDataUrl, {
        params
      }),
    // 获取收入分析
    getIncomeDataApi: (params = {}) =>
      vm.$u.http.get(apiurl.operationalAnalysis.getIncomeDataUrl, {
        params
      }),
    // 获取收入分析(停车场)
    getParkingIncomeDataApi: (params = {}) =>
      vm.$u.http.get(apiurl.operationalAnalysis.getParkingIncomeDataUrl, {
        params
      }),
    // 获取支付方式占比分析
    getPaymentWaysDataApi: (params = {}) =>
      vm.$u.http.get(apiurl.operationalAnalysis.getPaymentWaysDataUrl, {
        params
      }),
    // 获取支付方式占比分析
    getParkingPaymentWaysDataApi: (params = {}) =>
      vm.$u.http.get(apiurl.operationalAnalysis.getParkingPaymentWaysDataUrl, {
        params
      }),
    // 获取支付来源
    getPaySourceDataApi: (params = {}) =>
      vm.$u.http.get(apiurl.operationalAnalysis.getPaySourceDataUrl, {
        params
      }),
    // 获取支付来源(停车场)
    getParkingPaySourceDataApi: (params = {}) =>
      vm.$u.http.get(apiurl.operationalAnalysis.getParkingPaySourceDataUrl, {
        params
      }),
    // 获取停车场分析营收金额
    getParkingLotRevenueAmountApi: (params = {}) =>
      vm.$u.http.get(apiurl.operationalAnalysis.getParkingLotRevenueAmountUrl, {
        params
      }),
    // 获取停车场分车流量统计
    getParkingLotTrafficVolumeApi: (params = {}) =>
      vm.$u.http.get(apiurl.operationalAnalysis.getParkingLotTrafficVolumeUrl, {
        params
      })
  };
  // 统计报表模块
  let statisticalReportApi = {
    // 获取收费员业绩统计
    getTollCollectorAchieveTotalApi: (params = {}) =>
      vm.$u.http.get(apiurl.statisticalReport.getTollCollectorAchieveTotalUrl, {
        params
      }),
    // 获取收费员业绩统计列表
    getTollCollectorAchieveListApi: (params = {}) =>
      vm.$u.http.get(apiurl.statisticalReport.getTollCollectorAchieveListUrl, {
        params
      }),
    // 获取路段泊位统计
    getRoadSpaceTotalApi: (params = {}) =>
      vm.$u.http.get(apiurl.statisticalReport.getRoadSpaceTotalUrl, {
        params
      }),
    // 获取路段泊位列表
    getRoadSpaceListApi: (params = {}) =>
      vm.$u.http.get(apiurl.statisticalReport.getRoadSpaceListUrl, {
        params
      }),
    // 获取欠费统计
    getArrearsReportTotalApi: (params = {}) =>
      vm.$u.http.get(apiurl.statisticalReport.getArrearsReportTotalUrl, {
        params
      }),
    // 获取欠费统计(停车场)
    getParkingArrearsReportTotalApi: (params = {}) =>
      vm.$u.http.get(apiurl.statisticalReport.getParkingArrearsReportTotalUrl, {
        params
      }),
    // 获取欠费统计列表
    getArrearsReportListApi: (params = {}) =>
      vm.$u.http.get(apiurl.statisticalReport.getArrearsReportListUrl, {
        params
      }),
    // 获取欠费统计列表(停车场)
    getParkingArrearsReportListApi: (params = {}) =>
      vm.$u.http.get(apiurl.statisticalReport.getParkingArrearsReportListUrl, {
        params
      }),
    // 获取营收统计
    getIncomeTotalApi: (params = {}) =>
      vm.$u.http.get(apiurl.statisticalReport.getIncomeTotalUrl, {
        params
      }),
    // 获取路段营收统计
    getRoadIncomeTotalApi: (params = {}) =>
      vm.$u.http.get(apiurl.statisticalReport.getRoadIncomeTotalUrl, {
        params
      }),
    // 获取停车场营收统计
    getParkIncomeTotalApi: (params = {}) =>
      vm.$u.http.get(apiurl.statisticalReport.getParkIncomeTotalUrl, {
        params
      }),
    // 获取营收列表
    getIncomeListApi: (params = {}) =>
      vm.$u.http.get(apiurl.statisticalReport.getIncomeListUrl, {
        params
      }),
    // 获取路段营收列表
    getRoadIncomeListApi: (params = {}) =>
      vm.$u.http.get(apiurl.statisticalReport.getRoadIncomeListUrl, {
        params
      }),
    // 获取停车场列表
    getParkIncomeListApi: (params = {}) =>
      vm.$u.http.get(apiurl.statisticalReport.getParkIncomeListUrl, {
        params
      }),
    // 获取实收应收分析列表
    getReallyReceivableListApi: (params = {}) =>
      vm.$u.http.get(apiurl.statisticalReport.getReallyReceivableListUrl, {
        params
      }),
    // 获取实收应收分析列表(停车场)
    getParkingReallyReceivableListApi: (params = {}) =>
      vm.$u.http.get(apiurl.statisticalReport.getParkingReallyReceivableListUrl, {
        params
      }),
    // 获取考勤统计列表
    getPunchListApi: (params = {}) =>
      vm.$u.http.get(apiurl.statisticalReport.getPunchListUrl, {
        params
      }),
    // 获取停车场实收统计
    getParkingReallyIncomeApi: (params = {}) =>
      vm.$u.http.get(apiurl.statisticalReport.getParkingReallyIncomeUrl, {
        params
      }),
    // 获取停车场实收统计总数据
    getParkingReallyIncomeTotalApi: (params = {}) =>
      vm.$u.http.get(apiurl.statisticalReport.getParkingReallyIncomeTotalUrl, {
        params
      }),
    // 获取追缴统计
    getRecoveryReportApi: (params = {}) =>
      vm.$u.http.get(apiurl.statisticalReport.getRecoveryReportUrl, {
        params
      }),
    // 获取追缴统计总和
    getRecoverySumReportApi: (params = {}) =>
      vm.$u.http.get(apiurl.statisticalReport.getRecoverySumReportUrl, {
        params
      })
  };
  // 收费员业绩管理模块接口
  let tollCollectorPerformanceApi = {
    getAllTollCollectorApi: (params = {}) =>
      vm.$u.http.get(apiurl.tollCollectorPerformance.getAllTollCollectorUrl, {
        params
      })
  };
  // 设备异常记录模块
  let deviceAbnormalApi = {
    // 获取设备异常记录列表
    getDeviceAbnormalListApi: (params = {}) =>
      vm.$u.http.get(apiurl.deviceAbnormal.getDeviceAbnormalListUrl, {
        params
      }),
    // 获取设备异常记录详情
    getDeviceAbnormalDetailsApi: (params = {}) =>
      vm.$u.http.get(apiurl.deviceAbnormal.getDeviceAbnormalDetailsUrl, {
        params
      }),
    // 修改设备异常记录信息为已读
    updateDeviceAbnormalInfoApi: (params = {}) => vm.$u.http.put(apiurl.deviceAbnormal.updateDeviceAbnormalInfoUrl, params),
		addDeviceAbnormalRecordsEvaluateApi: (params = {}) => vm.$u.http.post(apiurl.deviceAbnormal.addDeviceAbnormalRecordsEvaluateUrl, params)
  };
	// 应急处置记录模块
	let emergencyDisposalApi = {
		// 获取应急处置列表
    getEmergencyDisposalRecordsListApi: (params = {}) => vm.$u.http.get(apiurl.emergencyDisposal.getEmergencyDisposalRecordsListUrl, { params }),
		// 获取应急处置详情
    getEmergencyDisposalRecordsDetailsApi: (params = {}) => vm.$u.http.get(apiurl.emergencyDisposal.getEmergencyDisposalRecordsDetailsUrl, { params })
	}
  // 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
  vm.$u.api = {
    loginApi,
    logoutApi,
    getDictApi,
    getParameterApi,
    todayOverviewApi,
    operationalAnalysisApi,
    statisticalReportApi,
    tollCollectorPerformanceApi,
    deviceAbnormalApi,
		emergencyDisposalApi
  };
};
export default {
  install
};
