Files
zszq-trs/YLErpWeb/App_Data/Config/swappriceprecision.js
T
张名锐 5b7f17727d refactor(swaptrade): 优化互换交易中的数量和金额格式化功能
- 引入UnderlyingInstrumentType字段用于精确控制格式化规则
- 添加quantityPrecision配置支持不同产品类型的数量精度设置
- 实现formatAmount和formatQuantity方法提供统一格式化接口
- 更新视图模板使用新的格式化方法替代直接数据绑定
- 重构swapPricePrecisionHelper.js支持按产品类型定制格式化规则
- 移除废弃的inputFormatTradeAmount等旧格式化配置
- 添加千分位分组显示功能提升数字可读性
2026-08-06 12:41:30 +08:00

56 lines
2.8 KiB
JavaScript

// 通过 /front/swappriceprecision 加载。可按 UnderlyingInstrumentType 修改;缺项或非法值由页面精度组件回退内置默认规则。
window.main = window.main || {};
window.main.swapPricePrecision = {
common: {
amount: { precision: 2, grouping: true },
quantity: { precision: 2, grouping: true },
rate: { precision: 4 }
},
Stock: { integerDigits: 7, precision: 2, quantityPrecision: 2 },
StockIndex: { integerDigits: 7, precision: 2, quantityPrecision: 2 },
StockIF: { integerDigits: 7, precision: 4, quantityPrecision: 2 },
CommodityFutures: { integerDigits: 7, precision: 4, quantityPrecision: 2 },
CommoditySpot: { integerDigits: 7, precision: 4, quantityPrecision: 2 },
NewOtcStock: { integerDigits: 7, precision: 4, quantityPrecision: 2 },
HKStock: { integerDigits: 7, precision: 4, quantityPrecision: 2 },
HKStockIndex: { integerDigits: 7, precision: 4, quantityPrecision: 2 },
Fund: { integerDigits: 7, precision: 4, quantityPrecision: 4 },
Bond: {
quantityPrecision: 0,
grossPrice: { integerDigits: 6, precision: 9 },
netPrice: { integerDigits: 6, precision: 9 },
yield: { integerDigits: 2, precision: 4 }
},
TBonds: {
quantityPrecision: 0,
grossPrice: { integerDigits: 6, precision: 9 },
netPrice: { integerDigits: 6, precision: 9 },
yield: { integerDigits: 2, precision: 4 }
},
CreditBonds: {
quantityPrecision: 0,
grossPrice: { integerDigits: 6, precision: 9 },
netPrice: { integerDigits: 6, precision: 9 },
yield: { integerDigits: 2, precision: 4 }
},
OtherBonds: {
quantityPrecision: 0,
grossPrice: { integerDigits: 6, precision: 9 },
netPrice: { integerDigits: 6, precision: 9 },
yield: { integerDigits: 2, precision: 4 }
},
TBFutures: { integerDigits: 8, precision: 4, quantityPrecision: 2 },
OtherFutures: { integerDigits: 8, precision: 4, quantityPrecision: 2 },
GoldSpot: { integerDigits: 8, precision: 4, quantityPrecision: 2 },
OtherSpot: { integerDigits: 8, precision: 4, quantityPrecision: 2 },
AbroadFutures: { integerDigits: 8, precision: 4, quantityPrecision: 2 },
AbroadSpot: { integerDigits: 8, precision: 4, quantityPrecision: 2 },
AbroadStock: { integerDigits: 8, precision: 2, quantityPrecision: 2 },
AbroadStockIndex: { integerDigits: 8, precision: 4, quantityPrecision: 2 },
ExRate: { integerDigits: 2, precision: 8, quantityPrecision: 8 },
Shibor: { integerDigits: 2, precision: 4, quantityPrecision: 2 },
FixingRepoRate: { integerDigits: 2, precision: 4, quantityPrecision: 2 },
RateYield: {integerDigits: 6, precision: 8, quantityPrecision: 2},
BondIndex: {integerDigits: 6, precision: 4, quantityPrecision: 2},
};