import { QueryAreaStockApply } from "@/services/go/ermcp/search-inventory";
import { Ermcp3AreaStockApply } from "@/services/go/ermcp/search-inventory/interface";
import { message } from "ant-design-vue";
import { ref } from "vue";

/**
 * 获取表格列表数据
 * @param type 
 * @returns 
 */
export function queryTableList() {
    // 加载状态
    const loading = ref<boolean>(false);
    // 表格数据
    const tableList = ref<Ermcp3AreaStockApply[]>([]);
    function queryTable() {
        QueryAreaStockApply({})
            .then((res) => {
                tableList.value = res.map((e, i) => {
                    return { ...e, key: String(i) };
                });
                console.log('查询列表', tableList);
            })
            .catch((err) => {
                message.error(err);
            }).finally(() => loading.value = false)
    }
    return { loading, tableList, queryTable }
}
export type { Ermcp3AreaStockApply };

