import {apiurl} from "./apiurl.js"

// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作，更多内容详见uView对拦截器的介绍部分：
// https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
const install = (Vue, vm) => {
	// 登录
	let getLogin = (params = {}) => vm.$u.post(apiurl.loginUrl, params);
	let getParkingRecord = (params = {}) => vm.$u.get(apiurl.getParkingRecordUrl,params);
	let getDeviceStatis = (params = {}) => vm.$u.get(apiurl.getDeviceStatisUrl,params);
	let getDeviceTypeList = (params = {}) => vm.$u.get(apiurl.getDeviceTypeListUrl,params);
	let updatePwd = (params = {}) => vm.$u.put(apiurl.updatePwdUrl,params);
	let getLoginOut = (params = {}) => vm.$u.get(apiurl.getLoginOutUrl,params);
	let getRoadAllList = (params = {}) => vm.$u.get(apiurl.getRoadAllListUrl,params);
	let report = (params = {}) => vm.$u.post(apiurl.reportUrl, params);
	let selectOtherExcptionList = (params = {}) => vm.$u.get(apiurl.selectOtherExcptionList,params);
	let reportDetail = (params = {}) => vm.$u.get(apiurl.reportDetail,params);
	let emergencyReportList = (params = {}) => vm.$u.get(apiurl.emergencyReportList,params);
	let reportEmergency = (params = {}) => vm.$u.post(apiurl.reportEmergency, params);
	let payeeReportList = (params = {}) => vm.$u.get(apiurl.payeeReportList,params);
	let payeeReportDetail = (params = {}) => vm.$u.get(apiurl.payeeReportDetail,params);
	let payeeReport = (params = {}) => vm.$u.post(apiurl.payeeReport, params);
	let payeeExceptionType = (params = {}) => vm.$u.get(apiurl.payeeExceptionType,params);
	let punchInfo = (params = {}) => vm.$u.get(apiurl.punchInfoUrl+params.roadNo);
	let punchIn = (params = {}) => vm.$u.post(apiurl.punchInUrl, params);
	let getDeviceList = (params = {}) => vm.$u.get(apiurl.getDeviceListUrl,params);
	let getRoadList = (params = {}) => vm.$u.get(apiurl.getRoadListUrl,params);
	let getSelectDeviceList = (params = {}) => vm.$u.get(apiurl.getSelectDeviceListUrl,params);
	let geoDeviceStatust = (params = {}) => vm.$u.get(apiurl.geoDeviceStatustUrl,params);
	let lockDeviceStatust = (params = {}) => vm.$u.get(apiurl.lockDeviceStatustUrl,params);
	let findRoadSpaceVoById = (params = {}) => vm.$u.get(apiurl.findRoadSpaceVoByIdUrl,params);
	let deviceLog = (params = {}) => vm.$u.get(apiurl.deviceLogUrl,params);
	let deviceexcptionprocess = (params = {}) => vm.$u.post(apiurl.deviceexcptionprocessUrl, params);
	let editDeviceexcptionprocess = (params = {}) => vm.$u.put(apiurl.deviceexcptionprocessUrl, params);
	let getReportList = (params = {}) => vm.$u.get(apiurl.deviceexcptionprocessUrl, params);
	let placeStatus = (params = {}) => vm.$u.get(apiurl.placeStatusUrl,params);
	let selectParkDeviceList = (params = {}) => vm.$u.get(apiurl.selectParkDeviceListUrl,params);
	let selectParkVehicleList = (params = {}) => vm.$u.get(apiurl.selectParkVehicleList,params);
	let selectParkNum = (params = {}) => vm.$u.get(apiurl.selectParkNumUrl,params);
	let findParkDeviceById = (params = {}) => vm.$u.get(apiurl.findParkDeviceByIdUrl,params);
	let controlDevice = (params = {}) => vm.$u.post(apiurl.controlDeviceUrl, params);
	let inspecmsg = (params = {}) => vm.$u.get(apiurl.inspecmsgUrl,params);
	let inspecmsgDetails = (params = {}) => vm.$u.get(apiurl.inspecmsgDetailsUrl,params);
	let updateInspecMsgStatus = (params = {}) => vm.$u.put(apiurl.updateInspecMsgStatusUrl,params);
	let getUnreadMsgTotal = (params = {}) => vm.$u.get(apiurl.getUnreadMsgTotalUrl,params);
	let deviceLockStatus = (params = {}) => vm.$u.get(apiurl.deviceLockStatusUrl,params);
	let payeeList = (params = {}) => vm.$u.get(apiurl.payeeList,params);
	let processDevice = (params = {}) => vm.$u.get(apiurl.processDevice,params);
	let processDeviceGeo = (params = {}) => vm.$u.get(apiurl.processDeviceGeo,params);
	let processDeviceLock = (params = {}) => vm.$u.get(apiurl.processDeviceLock,params);
	let processDeviceRoom = (params = {}) => vm.$u.get(apiurl.processDeviceRoom,params);
	let damageType = (params = {}) => vm.$u.get(apiurl.damageType,params);
	let processType = (params = {}) => vm.$u.get(apiurl.processType,params);
	let excptionById = (params = {}) => vm.$u.get(apiurl.excptionById,params);
	
	// 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
	vm.$u.api = {
		getLogin,
		getParkingRecord,
		getDeviceStatis,
		getDeviceTypeList,
		updatePwd,
		getLoginOut,
		getRoadAllList,
		report,
		selectOtherExcptionList,
		reportDetail,
		emergencyReportList,
		reportEmergency,
		payeeReport,
		payeeReportDetail,
		payeeReportList,
		payeeExceptionType,
		punchInfo,
		punchIn,
		getDeviceList,
		getRoadList,
		getSelectDeviceList,
		geoDeviceStatust,
		lockDeviceStatust,
		findRoadSpaceVoById,
		deviceLog,
		deviceexcptionprocess,
		editDeviceexcptionprocess,
		getReportList,
		placeStatus,
		selectParkDeviceList,
		selectParkVehicleList,
		selectParkNum,
		findParkDeviceById,
		controlDevice,
		inspecmsg,
		inspecmsgDetails,
		updateInspecMsgStatus,
		getUnreadMsgTotal,
		deviceLockStatus,
		payeeList,
		processDevice,
		processDeviceGeo,
		processDeviceLock,
		processDeviceRoom,
		damageType,
		processType,
		excptionById,
	};
}

export default {
	install
}