import { reactive, ref, UnwrapRef } from "vue";
/**
 * 表单
 * @returns 
 */
export function handleForm() {
    interface FormState {
        SpotGoodsBrandID: number | null // 品牌
        WarehouseInfo: number | null // 入库仓库
        Qty: number | null // 入库数量
    }
    const formRef = ref();
    const formState: UnwrapRef<FormState> = reactive({
        SpotGoodsBrandID: null, // 品牌
        WarehouseInfo:  null, // 入库仓库
        Qty: null, // 入库数量
    })
    const rules = {
        SpotGoodsBrandID: [{ required: true, message: '请选择品牌', trigger: 'blur', type: 'number' }],
        WarehouseInfo: [{ required: true, message: '请选择入库仓库', trigger: 'blur', type: 'number' }],
        Qty: [{ required: true, message: '请输入入库数量', trigger: 'blur', type: 'number' }],
    }
    return { rules, formState, formRef }
}