import request from '@/utils/request'
import moment from "moment";
import {SERVICE_DATA_API_BASE} from "@/config/serviceSettings";

// export function getHost(parameter) {
//     return request({
//         method: 'get',
//         url: upcloud_base_inventory+'/stock/v1/qty/avl',
//         contentType: 'application/x-www-form-urlencoded',
//         params: parameter
//     });
// }
export function getHost(parameter) {
    return request({
        method: 'post',
        url:  SERVICE_DATA_API_BASE + '/search/page',
        data:parameter,
    });
}

export const cols = [
    { dataIndex: 'id', title: 'id', hidden: true, },
    { type:'txt',dataIndex: 'itemId', title: 'itemId', hidden: true, },
    { type:'txt',dataIndex: 'batchId', title: '批次ID', hidden: true, },
    { type:'txt',dataIndex: 'locatorId', title: '货位编码', hidden: true, },
    { type:'txt',dataIndex: 'itemCode', title: '商品编码', ellipsis: true },
    { type:'txt',dataIndex: 'itemName', title: '商品名称', ellipsis: true },
    { type:'txt',dataIndex: 'locatorCode', title: '货位编号', ellipsis: true },
    { type:'txt',dataIndex: 'locatorName', title: '货位名称', ellipsis: true },
    { type:'txt',dataIndex: 'availableQuantity', title: '数量', ellipsis: true },
    { type:'txt',dataIndex: 'manufacturerLotNum', title: '批号', ellipsis: true },
    // { dataIndex: 'showProductionDate', title: '显示生产日期' },
    // { dataIndex: 'showExpiredDate', title: '显示有效期至' },
    {
        type:'txt',dataIndex: 'batchProductionDate', title: '生产日期', ellipsis: true, customRender(text) {
            return moment(text).format('YYYY-MM-DD');
        }
    },
    {
        type:'txt',dataIndex: 'batchExpiredDate', title: '有效期至', ellipsis: true, customRender(text) {
            return moment(text).format('YYYY-MM-DD');
        }
    },
    { type:'txt',title: '质检报告单号', dataIndex: 'rqcReportNo', key: 'rqcReportNo', ellipsis: true },
]