/**
 * @invoice_addr 公司注册地址
 * @invoice_people  法人
 * @invoice_mobile 联系方式
 * @invoice_code 纳税识别号
 * @invoice_bank 开户行
 * @invoice_bankNo 开户账户
 */
export const convertInvoiceTitle = (title: Record<string, string>) => {
    const {
        company_address,
        mobile,
        company_license,
        bank_name,
        bankNo,
        company_name
    } = title;

    return {
        invoice_addr: company_address,
        invoice_mobile: mobile,
        invoice_code: company_license,
        invoice_bank: bank_name,
        invoice_bankNo: bankNo,
        invoice_title: company_name
    };
};

export const convertInvoiceTitleData = (title: Record<string, string>) => {
    const {
        invoice_addr,
        invoice_mobile,
        invoice_code,
        invoice_bank,
        invoice_bankNo,
        invoice_title
    } = title;

    return {
        invoice_code,
        invoice_title,
        addrAndmobile: invoice_addr + " " + invoice_mobile,
        bankAndBankNo: invoice_bank + " " + invoice_bankNo
    };
};

export const invoice_columns = [
    { label: "抬头", span: 24, field: "invoice_title" },
    { label: "纳税人识别号", span: 24, field: "invoice_code" }
];


export const createInitalData = () => ({
    product_id: '',
    check_type: '1',
    check_num: '0',
    fz_date: ''
})

export const rules = {
    product_id: [{ 
        required: true, 
        message:'请选择商品', 
        trigger: 'change' 
    }],

    check_type: [{
        required: true,
        message: '请选择结果类型',
        trigger: 'change'
    }],

    check_num: [{ 
        required: true, 
        message: '请输入盘点数量', 
        trigger: 'change' 
    }],



    fz_date: [{ 
        required: true, 
        message: '请选择入账月份', 
        trigger: 'change' 
    }]
}