import { creatRequest } from '../../utils/request.js';

const requestList = {
  // 一键查核
  oneKeyCheck: {
    method: 'POST',
    url: 'checkTask/saveBatchCheckTaskDetail'
  },
  // 列表一键不适用
  oneKeyNotApplicable: {
    method: 'POST',
    url: 'checkTask/notApplicable'
  },
  // 当situationType=2时，获取访查对象列表
  getInvestigationUsers: {
    method: 'GET',
    url: 'checkTask/getInvestigationUsers'
  },
  getPointConditions:{   //获取筛选条件
	method: 'GET',
	url: 'plan/getPointConditions'  
  },
  getZichaduchaCheckItems:{ //获取自查督查查核要点
	  method: 'GET',
	  url: 'inspector/checkItemList'  
  },
  oneKeyCheckZichaducha:{ //一键查核自查督查
  	  method: 'post',
  	  url: 'inspector/saveBatchItem'  
  }
};

export const commServer = (key, data) => {

  let obj = requestList[key];
  if(key=='oneKeyNotApplicable'){
	  return creatRequest({
		  ...obj,
		  url:`checkTask/notApplicable?checkDetailId=${data.id}&type=${data.type}`
	  });
  }
  if(key=='oneKeyCheckZichaducha'){
  	  return creatRequest({
  		  ...obj,
  		  url:`inspector/saveBatchItem?functionId=${data}`
  	  });
  }
  return creatRequest(obj, data);
}