export const column = [
    { label: "采购申请编号", prop: "purchaseNo", width: "200", align: "center" },
    { label: "采购申请名称", prop: "name", width: "200", align: "center", showOverflowTooltip: true },
    { label: "合同信息", prop: "contract", width: "100", align: "center" },
    { label: "发起人所属公司", prop: "deptName", width: "200", align: "center", showOverflowTooltip: true },
    { label: "业务所属公司", prop: "belongDeptName", width: "200", align: "center", showOverflowTooltip: true },
    { label: "项目名称", prop: "projectName", width: "200", align: "center", showOverflowTooltip: true },
    { label: "招采类型", prop: "purchaseType", width: "140", align: "center" },
    { label: "采购经办人", prop: "purchasingAgent", width: "140", align: "center" },
    { label: "预算金额 (元)", prop: "budgetAmount", width: "140", align: "center" },
    { label: "中标金额 (元)", prop: "bidNotice_bidAmount", width: "140", align: "center" },
    { label: "控制价 (元)", prop: "bidNotice_controlAmount", width: "140", align: "center" },
    { label: "招标代理", prop: "bidNotice_bidAgency", width: "200", align: "center", showOverflowTooltip: true },
    { label: "招标平台", prop: "bidNotice_bidPlatform", width: "200", align: "center", showOverflowTooltip: true }
]

export const contractColumn = [
    { label: "合同编码", prop: "contractNo" },
    { label: "合同名称", prop: "contractName" },
    { label: "中标单位", prop: "supplierName" },
    { label: "合同金额 (元)", prop: "signAmount" },
    { label: "合同会签发起日期", prop: "createTime" },
    { label: "合同会签完成日期", prop: "endTime" }
]

export const queryDatePicker = {
    createTime: {
        label: "采购申请发起日期",
        modelValue: null
    },
    endTime: {
        label: "收到申请日期",
        modelValue: null
    },
    bidSign_createTime: {
        label: "招标会签发起日期",
        modelValue: null
    },
    bidSign_endTime: {
        label: "招标会签完成日期",
        modelValue: null
    },
    matter_createTime: {
        label: "事项审批单发起日期", // 开标/
        modelValue: null
    },
    bidNotice_endTime: {
        label: "公告发布日期",
        modelValue: null
    },
    contract_createTime: {
        label: "合同会签发起日期",
        modelValue: null,
        tableHide: true
    },
    contract_endTime: {
        label: "合同会签完成日期",
        modelValue: null,
        tableHide: true
    }
}

export function formatExcel(type = "label") {
    // 合同信息换为合同colunm
    const front = column.map(c => ({ ...c, prop: "purchase_" + c.prop })).toSpliced(2, 1, ...contractColumn);

    // 去掉queryDatePicker合同会签时间
    if (type == "label") return front.concat(Object.values(queryDatePicker).slice(0, -2)).map(c => c[type]);
    return front.map(c => c[type]).concat(Object.keys(queryDatePicker).slice(0, -2).map(k => "purchase_" + k));
}