import { SubmitCurrencyModel } from "@/api/currency/CurrencyModle";
import { reactive } from "vue";

export default function useBaseModel() {

    //表单验证
    const rules = reactive({       
        code:[{
            required: true,
            message: '请填写三字简码',
            trigger:'change'
        },
        { pattern: /^[A-Z]{3}$/, message: '请输入三位大写字母' }
        ],
        description:[
            {required: true, message: '请填写名称',trigger:'change'},
            { pattern: /^[\u4e00-\u9fa5]{0,}$/, message: '请输入中文名称' }  
        ]        
    });
    //表单数据
    const dialogModel = reactive<SubmitCurrencyModel>({
        id: "",       
        code: "",
        description:"",
        symbol:"",        
        type:""
    })

    return {
        rules,
        dialogModel
    }
}