import request, { postBlob, getBlob, handleImport } from "@/utils/request";

export function getDataDictionary(data) {
  return request({
    url: `/dictCompany/page?moduleId=${data.moduleId}`,
    method: "post",
    data,
  });
}

export function getType(data) {
  return request({
    url: `/dictCompany/type/list`,
    method: "post",
    data,
  });
}

export function getDataDictionaryExport(data, name) {
  return postBlob({
    url: "/dictCompany/pageExport",
    data,
    name,
  });
}

export function add(data) {
  return request({
    url: `/dictCompany/add`,
    method: "post",
    data,
  });
}

export function edit(data) {
  return request({
    url: `/dictCompany/update`,
    method: "post",
    data,
  });
}

export function del(params) {
  return request({
    url: `/dictCompany/del`,
    method: "post",
    params,
  });
}

export function getDetail(data) {
  return request({
    url: `/dictCompany/detail`,
    method: "post",
    data,
  });
}

// -----------------

export function listImport(data) {
  return handleImport("/dictCompany/importExcel", data.formdata, data.id || "");
}

export function addDataDictionary(data) {
  return request({
    url: `/dict/add`,
    method: "post",
    data,
  });
}

export function updateDataDictionary(data) {
  return request({
    url: `/dict/update`,
    method: "post",
    data,
  });
}

export function delDataDictionary(params) {
  return request({
    url: `/dict/del`,
    method: "post",
    params,
  });
}

export function dictDetail(params) {
  return request({
    // url: `/dict/detail`,
    url: `/dictCompany/detailType`,
    method: "post",
    params,
  });
}

export function dictListDict(params) {
  return request({
    url: `/dictCompany/listDict`,
    // url: `/dict/listDict`,
    method: "post",
    params,
  });
}

export function dictTypeList(data) {
  return request({
    url: `/dict/type/list`,
    method: "post",
    data,
  });
}
