This commit is contained in:
李远 2026-03-17 16:14:28 +08:00
parent 4b712be3be
commit a53b0d4010
2 changed files with 13 additions and 12 deletions

View File

@ -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);

View File

@ -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())) {