import {WrOrderQuoteDetail, WrTradeOrderDetailReq, WrTradeOrderDetailRsp} from "@/services/go/wrtrade/interface";
import { reactive, ref, UnwrapRef } from "vue";
import { ListingForm } from "./interface";

export function handleForm(data: WrTradeOrderDetailRsp) {
    const formRef = ref();
    const formState: UnwrapRef<ListingForm> = reactive({
        accountid: undefined,
        num: 0,
        LadingBillId: '',
    })
    const rules = {
        accountid: [{ required: true, message: '请选择交易账户' }],
        LadingBillId: [{ required: true, message: '请选择现货仓单' }],
        num: [{ required: true, message: '请输入摘牌数量', trigger: 'blur', type: 'number', min: 1, ma: data.orderqty }],

    }
    return { rules, formState, formRef }
}
