// 系统专项设置api文件
import request from '@/utils/request'
import request2 from '@/utils/request2'
import qs from 'qs'
let api = '/api-web'
// 分页查询分部列表
export function branchQueryPage (data) {
  return request({
    url: api + '/organization/queryPage',
    method: 'get',
    params: data
  })
}

// 分页查询分部列表
export function branchAdd (data) {
  return request({
    url: api + '/organization/add',
    method: 'post',
    data: qs.stringify(data)
  })
}

// 分页查询分部列表
export function branchUpdate (data) {
  return request({
    url: api + '/organization/update',
    method: 'post',
    data: qs.stringify(data)
  })
}

// 根据父节点查询下一级子节点列表（不递归）
export function areaQueryChild (data) {
  return request({
    url: api + '/area/queryChild',
    method: 'get',
    params: data
  })
}


// 根据子级区域获取父级节点
export function getParentArea (data) {
  return request({
    url: api + `/area/getParentArea/${data.id}`,
    method: 'get'
  })
}

// 分页查询科目列表
export function subjectListTree (data) {
  return request({
    url: api + `/subject/queryPageTree`,
    method: 'get',
    params: data
  })
}

// 修改、新增科目
export function subjectUpset (data) {
  return request({
    url: api + `/subject/upset`,
    method: 'post',
    data: data
  })
}

// 分页查询收费类型列表
export function chargeTypeList (data) {
  return request({
    url: api + '/chargeType/queryPage',
    method: 'get',
    params: data
  })
}

// 新增、修改收费类型
export function chargeTypeUpSet (data) {
  return request({
    url: api + '/chargeType/upSet',
    method: 'post',
    data: data
  })
}

// 删除收费类型
export function chargeTypeDel (data) {
  return request({
    url: api + `/chargeType/del/${data}`,
    method: 'post'
  })
}

// 分页查询作业模板列表
export function courseHomeworkTemplateList (data) {
  return request({
    url: api + '/courseHomeworkTemplate/queryPage',
    method: 'post',
    data: data
  })
}

// 修改作业模板
export function homeWorkUpdate (data) {
  return request({
    url: api + '/courseHomeworkTemplate/update',
    method: 'post',
    data: qs.stringify(data)
  })
}

// 修改作业模板
export function homeWorkAdd (data) {
  return request({
    url: api + '/courseHomeworkTemplate/add',
    method: 'post',
    data: qs.stringify(data)
  })
}


// 修改作业模板
export function homeWorkDel (id) {
  return request({
    url: api + `/courseHomeworkTemplate/del/${id}`,
    method: 'post'
  })
}

// 查询已设置的分部列表
export function queryOrganIdList (data) {
  return request({
    url: api + `/courseScheduleRewards/queryOrganIdList`,
    method: 'get',
    params: data
  })
}

// 获取收费类型分部关联的默认课程费用添加
export function chargeTypeOrganizationFeeAdd (data) {
  return request({
    url: api + `/chargeTypeOrganizationFee/add`,
    method: 'post',
    data: qs.stringify(data)
  })
}

// 获取收费类型分部关联的默认课程费用删除
export function chargeTypeOrganizationFeeDelete (data) {
  return request({
    url: api + `/chargeTypeOrganizationFee/delete`,
    method: 'post',
    data: qs.stringify(data)
  })
}

// 获取收费类型分部关联的默认课程费用修改
export function chargeTypeOrganizationFeeUpdate (data) {
  return request({
    url: api + `/chargeTypeOrganizationFee/update`,
    method: 'post',
    data: qs.stringify(data)
  })
}

// 获取收费类型分部关联的默认课程费用列表
export function chargeTypeOrganizationFee (data) {
  return request({
    url: api + `/chargeTypeOrganizationFee/queryPage`,
    method: 'get',
    params: data
  })
}

// 获取收费类型分部关联的默认课程费用列表
export function findEducationTeacher (data) {
  return request({
    url: api + `/employee/findEducationTeacher`,
    method: 'get',
    params: data
  })
}

// 获取收费类型与科目的关联服务
export function chargeTypeSubjectMapper (data) {
  return request2({
    url: api + '/chargeTypeSubjectMapper/queryPage',
    method: 'get',
    data: {},
    params: data,
    requestType: 'form',
  })
}

// 新增收费类型与科目的关联服务
export function insertChargeTypeSubjectMapper (data) {
  return request2({
    url: api + '/chargeTypeSubjectMapper/insert',
    method: 'post',
    data,
  })
}

// 修改收费类型与科目的关联服务
export function updateChargeTypeSubjectMapper (data) {
  return request2({
    url: api + '/chargeTypeSubjectMapper/update',
    method: 'post',
    data,
  })
}

// 删除收费类型与科目的关联服务
export function delChargeTypeSubjectMapper (data) {
  const { id, ...rest } = data
  return request2({
    url: api + '/chargeTypeSubjectMapper/del/' + id,
    method: 'post',
    params: rest,
  })
}

// 收费方式添加
export function musicGroupOrganizationCourseSettingsAdd (data) {
  return request2({
    url: api + '/musicGroupOrganizationCourseSettings/add',
    method: 'post',
    data
  })
}

// 收费方式修改
export function musicGroupOrganizationCourseSettingsUpdate (data) {
  return request2({
    url: api + '/musicGroupOrganizationCourseSettings/update',
    method: 'post',
    data
  })
}

// 收费方式删除
export function musicGroupOrganizationCourseSettingsDel (data) {
  return request2({
    url: api + '/musicGroupOrganizationCourseSettings/delSetting',
    method: 'post',
    data: {},
    params: data,
    requestType: 'form',
  })
}

// 收费方式列表
export function musicGroupOrganizationCourseSettingsQueryPage (data) {
  return request2({
    url: api + '/musicGroupOrganizationCourseSettings/queryPage',
    method: 'get',
    data: {},
    params: data,
    requestType: 'form',
  })
}

// 课程费用查询
export function getOrganizationCourseUnitPriceSettings (data) {
  return request2({
    url: api + `/organizationCourseUnitPriceSettings/queryPage`,
    method: 'get',
    params: data,
    data: {},
    requestType: 'form',
  })
}

// 新增课程费用
export function addOrganizationCourseUnitPrice (data) {
  return request2({
    url: api + `/organizationCourseUnitPriceSettings/insert`,
    method: 'post',
    data
  })
}

// 修改课程费用
export function resetOrganizationCourseUnitPrice (data) {
  return request2({
    url: api + `/organizationCourseUnitPriceSettings/update`,
    method: 'post',
    data
  })
}

// 删除课程费用
export function deleteOrganizationCourseUnitPrice (data) {
  return request2({
    url: api + `/organizationCourseUnitPriceSettings/del`,
    method: 'post',
    data
  })
}

// 查询课程时长
export function getOrganizationCourseDurationSettings(data) {
  return request2({
    url: api + `/organizationCourseDurationSettings/queryPage`,
    method: 'get',
    data:{},
    params: data,
  })
}

// 修改课程时长
export function resetOrganizationCourseDurationSettings(data) {
  return request2({
    url: api + `/organizationCourseDurationSettings/update`,
    method: 'post',
    params:data,
  })
}

// 新增课程时长
export function addOrganizationCourseDurationSettings(data) {
  return request2({
    url: api + `/organizationCourseDurationSettings/insert`,
    method: 'post',
    params:data,
  })
}

//删除课程时长
export function delOrganizationCourseDurationSettings(data) {
  return request2({
    url: api + `/organizationCourseDurationSettings/del`,
    method: 'post',
    data:data,
  })
} 