diff --git a/src/views/account/market-maker/index.vue b/src/views/account/market-maker/index.vue index 7b4af44..2ed6ad5 100644 --- a/src/views/account/market-maker/index.vue +++ b/src/views/account/market-maker/index.vue @@ -375,7 +375,7 @@ const handleAddMarket = async () => { // 编辑做市商 const handleEditMarket = async () => { const row = selectedRow.value; - console.log('rowrowrowrowrow', row.role_id); + console.log('rowrowrowrowrow', row); // 解析上级ID const getParentIdFromPath = (path: string, level: number) => { @@ -397,8 +397,11 @@ const handleEditMarket = async () => { riskControlTemplate: row.wallet_capital.risk_control_id || '', positionRatio: row.positionRatio || '', commissionRatio: row.commissionRatio || '', + maxPositionRatio: row.wallet_capital.toucun_percent || '', + maxCommissionRatio: row.wallet_capital.fee_handling_percent || '', }; - + console.log(marketForm.value); + try { // 先加载上级选项 await handleMarketFormLinkage('level', marketForm.value.level); diff --git a/src/views/account/market-maker/rules.ts b/src/views/account/market-maker/rules.ts index 8ac3122..1bfbe7e 100644 --- a/src/views/account/market-maker/rules.ts +++ b/src/views/account/market-maker/rules.ts @@ -39,7 +39,7 @@ export const rules = (marketForm: any, row?: any): FormRules => { riskControlTemplate: [ { required: true, message: '请选择风控模板', trigger: 'change' } ], - position: [ + positionRatio: [ { required: true, message: '请输入头寸', trigger: 'blur' }, { validator: (rule, value, callback) => { @@ -50,15 +50,13 @@ export const rules = (marketForm: any, row?: any): FormRules => { // 尝试转换为数字 const numValue = Number(value); - // 转换失败 → 不是有效数字 if (isNaN(numValue)) { return callback(new Error('头寸必须为数字')); } - - // 非负数校验 - if (numValue < 0) { - return callback(new Error('头寸不能为负数')); + // 范围校验(0-100) + if (numValue < 0 || numValue > 100) { + return callback(new Error('头寸需在0-100之间')); } // 精度校验(最多2位小数) @@ -90,10 +88,10 @@ export const rules = (marketForm: any, row?: any): FormRules => { return callback(new Error('手续费比例必须为数字')); } - // // 范围校验(0-100) - // if (numValue < 0 || numValue > 100) { - // return callback(new Error('手续费比例需在0-100之间')); - // } + // 范围校验(0-100) + if (numValue < 0 || numValue > 100) { + return callback(new Error('手续费比例需在0-100之间')); + } // 精度校验(最多2位小数) if (!/^\d+(\.\d{1,2})?$/.test(value.toString())) {