132 lines
3.5 KiB
TypeScript
132 lines
3.5 KiB
TypeScript
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: "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: "expireRemindDay",
|
||
type: "input",
|
||
rules: [
|
||
{
|
||
validator: (rule, value, callback) => {
|
||
if (!value) return callback();
|
||
const num = Number(value);
|
||
if (!Number.isInteger(num) || num < 1 || num > 28) {
|
||
callback(new Error("请输入 1~28 之间的整数"));
|
||
}
|
||
callback();
|
||
}
|
||
}
|
||
],
|
||
attrs: {
|
||
type: "number",
|
||
placeholder: "每月几号提醒(1-28)",
|
||
style: { width: "200px" },
|
||
oninput: "value=value.replace(/\\D|\\./g,'')" // 禁止输入小数点
|
||
},
|
||
initialValue: "",
|
||
},
|
||
{
|
||
label: "还款提醒",
|
||
prop: "expireRemind",
|
||
type: "input",
|
||
rules: [
|
||
{
|
||
validator: (rule, value, callback) => {
|
||
if (!value) return callback();
|
||
const num = Number(value);
|
||
if (!Number.isInteger(num) || num < 0) {
|
||
callback(new Error("请输入大于等于 0 的整数"));
|
||
}
|
||
callback();
|
||
}
|
||
}
|
||
],
|
||
attrs: {
|
||
type: "number",
|
||
placeholder: "提醒多久以前的数据单位(月)",
|
||
style: { width: "240px" },
|
||
oninput: "value=value.replace(/\\D|\\./g,'')" // 禁止输入小数点
|
||
},
|
||
initialValue: "",
|
||
},
|
||
// ================================================
|
||
{
|
||
label: "还款方式",
|
||
prop: "repaymentMethod",
|
||
type: "radio-button",
|
||
options: returnOptions('repaymentMethod'),
|
||
initialValue: returnOptions('repaymentMethod')[0].value
|
||
},
|
||
{
|
||
label: "状态",
|
||
prop: "status",
|
||
type: 'switch',
|
||
attrs: {
|
||
activeText: '开启',
|
||
inactiveText: '关闭',
|
||
activeValue: 1,
|
||
inactiveValue: 0
|
||
},
|
||
initialValue: 1
|
||
},
|
||
],
|
||
};
|
||
|
||
// 如果有异步数据会修改配置的,推荐用reactive包裹,而纯静态配置的可以直接导出
|
||
export default reactive(modalConfig);
|