import request from '@/utils/request'
import constant from '@/constant'

function pageList(formData) {
  return request.post(constant.serverUrl + "/base/templateOption/pageList", formData);
}

function create() {
  return request.get(constant.serverUrl + "/base/templateOption/create");
}

function createFundIncome(templateId) {
  return request.get(constant.serverUrl + "/base/templateOption/createFundIncome/"+templateId);
}


function edit(id) {
  return request.get(constant.serverUrl + "/base/templateOption/edit/" + id);
}

function editItem(id) {
  return request.get(constant.serverUrl + "/base/templateOption/editItem/" + id);
}



function templateDepartmentEdit(id) {
  return request.get(constant.serverUrl + "/base/templateOption/templateDepartmentEdit/" + id);
}

function departmentDetailEdit(id) {
  return request.get(constant.serverUrl + "/base/templateOption/departmentDetailEdit/" + id);
}




function add(formModel) {
  return request.post(constant.serverUrl + "/base/templateOption/add", formModel, {
    headers: {
      "Content-Type": "application/json"
    }
  });
}

function update(formModel) {
  return request.post(constant.serverUrl + "/base/templateOption/update", formModel, {
    headers: {
      "Content-Type": "application/json"
    }
  });
}

function updateNameAndFundIncome(formModel) {
  return request.post(constant.serverUrl + "/base/templateOption/updateNameAndFundIncome", formModel, {
    headers: {
      "Content-Type": "application/json"
    }
  });
}


function addAndFundIncome(formModel) {
  return request.post(constant.serverUrl + "/base/templateOption/addAndFundIncome", formModel, {
    headers: {
      "Content-Type": "application/json"
    }
  });
}


function updateItem(formModel) {
  return request.post(constant.serverUrl + "/base/templateOption/updateItem", formModel, {
    headers: {
      "Content-Type": "application/json"
    }
  });
}



function remove(id) {
  return request.post(constant.serverUrl + "/base/templateOption/delete/" + id);
}

function batchRemove(idList) {
  return request.post(constant.serverUrl + "/base/templateOption/batchDelete", idList, {
    headers: {
      "Content-Type": "application/json"
    }
  });
}

export default {
  pageList, create, edit, add, update, remove, batchRemove,templateDepartmentEdit,departmentDetailEdit,
  updateItem,createFundIncome,addAndFundIncome,editItem,updateNameAndFundIncome
}