import request from '@/config/axios'

// 创建
export const createField = (data) => {
  return request.post({
    url: '/admin-api/crm/param/create',
    data: { ...data, module: 3 },
    isSubmitForm: true
  })
}

// 更新
export const updateField = (data) => {
  return request.put({ url: '/admin-api/crm/param/update', data })
}

// 删除
export const deleteField = (id) => {
  return request.delete({ url: `/admin-api/crm/param/delete?id=${id}` })
}

// 获得
export const getField = (id) => {
  return request.get({ url: `/admin-api/crm/param/get?id=${id}` })
}

// 获得精简信息列表
export const getSimpleFieldList = () => {
  return request.get({ url: '/admin-api/crm/param/simple-list', params: { module: 3 } })
}

// 获取自定义字段
export const getDiyFieldList = () => {
  return request.get({ url: '/admin-api/crm/param/get-diy-param', params: { module: 3 } })
}

// 状态修改
export const updateFieldStatus = (signParamId, status) => {
  const data = {
    signParamId,
    status
  }
  return request.put({ url: '/admin-api/crm/param/status/update', data: data })
}
