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

const requestList = {
	// 查核项明细
	checkTaskDetail: {
		method: 'GET',
		url: 'checkTask/checkTaskDetail'
	},
	//保存查核项
	saveCheckTaskDetail: {
	  method: 'POST',
	  url: 'checkTask/saveCheckTaskDetail'
	},
	//获取查核配置选项
	getCheckItemAttr:{
		method: 'GET',
		url: 'resultConfig/getCheckItemAttr'
	},
	//获取查核结果说明下拉菜单
	getCheckItemResultList:{
		method: 'GET',
		url: 'resultConfig/getCheckItemResult'
	}
};

export const commServer = ({ key, data }) => {
  if(key=='getCheckItemAttr'){
	  let obj = {
		  method: 'GET',
		  url: `resultConfig/getCheckItemAttr/${data}`
	  };
	  return creatRequest(obj);
  }
  if(key=='getCheckItemResultList'){
  	  let obj = {
  		  method: 'GET',
  		  url: `resultConfig/getCheckItemResult/${data}`
  	  };
  	  return creatRequest(obj);
  }
  
  let obj = requestList[key];
  return creatRequest(obj, data);
}