import http from "@/utils/http";
import { AppDispatch } from "..";

/**
 * 新建或编辑 库区  库房  货架
 */
export const stores1AddAPI = (data: any) => {
  return http.post("cms/storage/save", data);
};

/**
 * 获取库房列表
 */
export const getStores1ListAPI = () => {
  return async (dispatch: AppDispatch) => {
    // 获取列表数据
    const res: any = await http.get("cms/storage/getTree");
    dispatch({ type: "stores1/getInfoList", payload: res.data });
  };
};

/**
 * 删除
 */
export const stores1DelAPI = (id: number) => {
  return http.get(`cms/storage/remove/${id}`);
};

/**
 * 通过id获取详情
 */
export const getStores1DetailAPI = (id: number) => {
  return http.get(`cms/storage/detail/${id}`);
};

/**
 * 获取统计报表1
 */
export const getStores2API1 = () => {
  return http.get("cms/report/groupByGoodType");
};
/**
 * 获取统计报表2
 */
export const getStores2API2 = () => {
  return http.get("cms/report/goodsLevel");
};
/**
 * 获取统计报表3
 */
export const getStores2API3 = () => {
  return http.get("cms/report/goodsSource");
};
/**
 * 获取统计报表4
 */
export const getStores2API4 = () => {
  return http.get("cms/report/goodsComplete");
};
