import {
	tools
  } from 'hq-tools'
   
  function fastqueryFormat(column, value, fastqueryParams) {
	  if (!column || value === null || value === undefined || value === NaN ) {
		  return;
	  }
	  if (!column.fastqueryType) {
		  return;
	  }
	  //范围查询
	  if (column.fastqueryType.indexOf('range') >= 0) {
		  let type = column.type;
		  //时间范围
		  if (column.type == 'date') {
		  type = column.format ? column.format : 'yyyy-MM-dd HH:mm:ss';
		  if (value[0] != '' && value[1] != '') {
			  fastqueryParams.push({
			  columnId: column.key,
			  title: column.title,
			  fastQueryType: 'ge',
			  value: tools.dateFormat(value[0], column.format),
			  dataType: type
			  });
			  fastqueryParams.push({
			  columnId: column.key,
			  title: column.title,
			  fastQueryType: 'le',
			  value: tools.dateFormat(value[1], column.format),
			  dataType: type
			  });
		  }
		  }
		  //数字范围
		  else if (column.type == 'number') {
			  if (value[0] !== '' && value[1] !== '') {
				  fastqueryParams.push({
					  columnId: column.key,
					  title: column.title,
					  fastQueryType: 'ge',
					  value: value[0],
					  dataType: 'number'
				  });
				  fastqueryParams.push({
					  columnId: column.key,
					  title: column.title,
					  fastQueryType: 'le',
					  value: value[1],
					  dataType: 'number'
				  });
			  }
		  }
		  return;
		  //布尔
	  } else if (column.type == 'boolean') {
		  fastqueryParams.push({
		  columnId: column.key,
		  title: column.title,
		  fastQueryType: column.fastqueryType,
		  value: value,
		  dataType: 'string'
		  });
		  return
		  //相似
	  } else if (column.fastqueryType == 'lk') {
		  value = '%' + value + '%';
	  }
	  fastqueryParams.push({
		  columnId: column.key,
		  title: column.title,
		  fastQueryType: column.fastqueryType,
		  value: value,
		  dataType: column.type
	  });
  }
  export default fastqueryFormat;