import creditApi from "@/api/order/credit"; import { returnOptions } from "./config"; import type { IModalConfig } from "@/components/CURD/types"; const modalConfig: IModalConfig = { pageName: "sys:user", dialog: { title: "创建挂账人", width: 800, draggable: true, }, form: { labelWidth: 140, }, formAction: function (data) { return creditApi.add({ ...data }); }, beforeSubmit(data) { console.log("提交之前处理", data); }, formItems: [ { label: "状态", prop: "status", type: 'switch', attrs: { activeText: '开启', inactiveText: '关闭', activeValue: 1, inactiveValue: 0 }, initialValue: 1 }, { label: "挂账人", prop: "debtor", rules: [{ required: true, message: "请输入挂账人", trigger: "blur" }], attrs: { placeholder: "请输入挂账人", }, }, { label: "手机号", prop: "mobile", rules: [{ required: true, message: "请输入挂账人手机号", trigger: "blur" }], attrs: { placeholder: "请输入挂账人手机号", }, }, { label: "职务", prop: "position", rules: [{ required: false, message: "请输入挂账人职务", trigger: "blur" }], attrs: { placeholder: "请输入挂账人职务", }, }, { label: "挂账额度", prop: "creditAmount", type: "input-number", rules: [{ required: true, message: "请输入挂账额度", trigger: "blur" }], attrs: { placeholder: "请输入挂账额度", }, initialValue: 0 }, { label: "还款方式", prop: "repaymentMethod", type: "radio-button", options: returnOptions('repaymentMethod'), initialValue: returnOptions('repaymentMethod')[0].value }, ], }; // 如果有异步数据会修改配置的,推荐用reactive包裹,而纯静态配置的可以直接导出 export default reactive(modalConfig);