import request from '@/utils/request'

// 获取表格分页数据
export function getTableData(forData) {
	let data = ''
	data += '?page=' + forData.page + '&rows=' + forData.rows

	if (typeof forData.status !== 'undefined') {
		data += '&status=' + forData.status
	}
	if (forData.search_datatime !== undefined && forData.search_datatime !== null) {
		data += '&complainStartTime=' + forData.search_datatime[0]
		data += '&complainEndTime=' + forData.search_datatime[1]
	}
	if (typeof forData.keyword !== 'undefined') {
		data += '&keywords=' + forData.keyword
	}

	return request({
		url: '/ComplainqueryPage.action' + data,
		method: 'get',
		data
	})
}

// 获取投诉详情
export function getXiang(row) {
	let query = '?id=' + row.id

	return request({
		url: '/ComplaingetById.action' + query,
		method: 'get'
	});
};

// 下载
export function downloadExcel(forData) {
	let data = ''
	data += '?page=' + forData.page + '&rows=' + forData.rows

	if (typeof forData.status !== 'undefined') {
		data += '&status=' + forData.status
	}
	if (forData.search_datatime !== undefined && forData.search_datatime !== null) {
		data += '&complainStartTime=' + forData.search_datatime[0]
		data += '&complainEndTime=' + forData.search_datatime[1]
	}
	if (typeof forData.keyword !== 'undefined') {
		data += '&keywords=' + forData.keyword
	}

	return request({
		url: '/ComplaintoComplainExcel.action',
		method: 'get',
		data
	})
}