import { SubmitCustomerRateModel } from "@/api/customerrate/CustomerRateModel";
import { reactive } from "vue";

export default function useBaseModel() {

    //表单验证
    const rules = reactive({
        currencyCode: [{
            required: true,
            message: '请填写三字简码',
            trigger: 'change'
        },
        { pattern: /^[A-Z]{3}$/, message: '请输入三位大写字母' }
        ],
        currencyRate: [
            { required: true, message: '请填写汇率', trigger: 'change' },
            { pattern: /^\d+(\.{0,1}\d+){0,1}$/, message: '请输入正数' }
        ],

        startDate: [
            { required: true, message: '请选择日期', trigger: 'change' }
        ]

    });
    //表单数据
    const dialogModel = reactive<SubmitCustomerRateModel>({
        id: "",
        currencyCode: "",
        currencyRate: 1.0,
        startDate: '',
        endDate: '',
        type: "0"
    })

    return {
        rules,
        dialogModel
    }
}