import { useMsg } from "@/hooks/useMsg";
import { getSubscribeResetListApi, getSubscribeResetListExportApi } from "@/api/modules/warehousing";
// 导出
export const handleExport = async (params: any) => {
    const { initParam } = params;
    const result = await getSubscribeResetListExportApi(initParam);
    if (result?.code === 0) {
        useMsg("success", "导出成功 ！");
    }
};
// proTable: any
export const handleReSet = async (item: any, selectionList: any[], proTable: any) => {
    console.log("刷新操作", item);
    let length = selectionList.length;
    if (length && length > 100) {
        useMsg("warning", "选中刷新数据最大100条！");
        return;
    }
    let ids: any = [];
    selectionList.forEach((item: any) => {
        ids.push(item.id);
    });

    let id = ids.join(",");
    const result = await getSubscribeResetListApi({ id });
    if (result?.code === 0) {
        useMsg("success", "数据刷新成功 ！");
        proTable.value!.getTableList();
    }
};

export const btnClick: any = {
    export: handleExport,
    reset: handleReSet
};
