import { getBuildingList, getRecommendArea } from '../api'

export let extendInfoModule = {

    methods: {
        handleQueryItems(list, ref) {
            if (!list || list.lenght == 0) {
                return list
            }
            // let ref = this.$refs.detailModel;
            let rcvType = ref.getSelectedMainItem().rcvType
            ref.subLoading = true
            getRecommendArea(list.map((t) => ({ ...t, rcvType: rcvType }))).then((res) => {
                ref.subLoading = false
                if (!res.success) {
                    this.$exception(res)
                    return
                }
                ref.GoodsColumnsdata = list.map((t, i) => ({
                    ...t,
                    warehouseAreaCodes: res.data[i].warehouseAreaCodes,
                    warehouseAreaCategorys: res.data[i].warehouseAreaCategorys,
                    warehouseRoomCodes: res.data[i].warehouseRoomCodes,
                    categoryId: res.data[i].categoryId,
                }))
            })
            return list
        },

    }

};