diff --git a/YLErpWeb/Views/SwapTrade2/TradeEdit.cshtml b/YLErpWeb/Views/SwapTrade2/TradeEdit.cshtml
index 52efc49e..9aaf6035 100644
--- a/YLErpWeb/Views/SwapTrade2/TradeEdit.cshtml
+++ b/YLErpWeb/Views/SwapTrade2/TradeEdit.cshtml
@@ -474,13 +474,13 @@
- 源AUTOREV
+ 源AUTOREV
|
- 源AUTOREV
+ 源AUTOREV
|
- 源AUTOREV重算
+ 源AUTOREV重算
|
diff --git a/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeEdit.js b/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeEdit.js
index de29be48..caf160f9 100644
--- a/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeEdit.js
+++ b/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeEdit.js
@@ -349,6 +349,23 @@ const vue = new Vue({
if (!item.isBond) return;
SwapCalc.applyBondManualEdit(item, type);
},
+ //交互约定3(按键实时触发):vue-number-input 的 input 事件只在失焦/回车时触发,
+ // 按键输入过程中不触发,导致用户输入时 源/AUTO 标识不会消失。
+ // 此方法绑在 v-on:keydown.native 上,按键即清 源/AUTO 标识、标本字段 REV。
+ // 回车键(13/108)除外——回车由 v-on:enter 驱动 calcBondForItem,会把标识修正为 源/AUTO。
+ // 修饰键(Shift/Ctrl/Alt/Tab/方向键/F键等)除外——这些不改变数值,不应清标识。
+ onBondPriceKeydown(item, type, event) {
+ if (!item.isBond) return;
+ var kc = event.which || event.keyCode;
+ // 回车由 v-on:enter 处理,不在此清标识
+ if (kc === 13 || kc === 108) return;
+ // 修饰键/导航键/功能键不改变数值,不清标识
+ if (event.ctrlKey || event.altKey || event.metaKey) return;
+ if (kc === 9 || kc === 35 || kc === 36 || kc === 37 || kc === 39 || kc === 116) return;
+ // Backspace/Delete 改变数值,需清标识
+ // 数字键/小键盘/小数点/减号 改变数值,需清标识
+ SwapCalc.applyBondManualEdit(item, type);
+ },
//全价列:普通标的重算名义本金;债券标的按交互约定3 标 REV(不联动)。
// 回车计算由独立的 v-on:enter="onBondPriceEnter(item,'DP')" 负责。
onDpPriceInput(item) {
@@ -381,7 +398,11 @@ const vue = new Vue({
var price = driver === 'CP' ? item.PosiNetNoFeePrice
: driver === 'DP' ? item.PosiGrossPrice
: item.InitYtm;
- if (price === null || price === '' || isNaN(price)) return; // 编辑中(空/非数)静默,不提示
+ if (price === null || price === '' || isNaN(price)) {
+ // 交互约定2补充:源字段为空/非数也算"算不出来",清另两字段+所有标识
+ SwapCalc.applyBondCalcFailure(item, driver);
+ return;
+ }
var priceType = driver === 'CP' ? 'CP' : driver === 'DP' ? 'DP' : 'YD';
var self = this;
// 估值日:债券互换的"期初"净价/全价/收益率应以【互换起始日 StartDate】估值。
@@ -392,6 +413,8 @@ const vue = new Vue({
if (sdMsg) {
// D3 同款去重:开始日缺失时用户在价格格逐键输入会连刷相同提示,故同一文案只弹一次
if (SwapCalc.shouldShowBondErr(item, sdMsg)) main.message(sdMsg);
+ // 交互约定2补充:开始日缺失也算"算不出来",清另两字段+所有标识
+ SwapCalc.applyBondCalcFailure(item, driver);
return; // 估值日缺失:不调用计算器、不覆盖任何手工输入
}
main.post('/Bond/CalcBond', {
@@ -766,9 +789,11 @@ const vue = new Vue({
if (!data || !data.Code) return;
var underlyingCode = item.UnderlyingCode;
if (underlyingCode != data.Code) {
- // 切换标的:清空上一债券残留的收益率,避免旧债券计算结果污染新债券。
- // 注:clearBondCalcFlags 只清手动/源标志,未清字段值;
- // 净价/全价会被末尾 getSpotPrice 无条件回填,收益率(InitYtm)无刷新逻辑,必须显式清空。
+ // 簿记基础逻辑1:新增互换交易选择标的后,不自动填充价格等数值。
+ // 切换标的时清空净价/全价/收益率三字段,由用户手填或回车调计算器反算。
+ // 历史上此处调 getSpotPrice 自动回填,会导致用户未确认的价格被静默填入。
+ item.PosiNetNoFeePrice = null;
+ item.PosiGrossPrice = null;
item.InitYtm = null;
}
item.CountRatio = data.CountRatio;
@@ -789,8 +814,8 @@ const vue = new Vue({
this.$set(item, 'isBond', tradeHelper.IsBond(data.InstrumentType));
// 切换标的时清空债券三字段互算的手动/源标志(D1 修复:避免旧债券手填状态污染新债券)
SwapCalc.clearBondCalcFlags(item);
- // Refresh the initial price even when the user re-selects the same underlying.
- this.getSpotPrice(item.UnderlyingCode, this.trade.TradeDate, item);
+ // 簿记基础逻辑1:不再自动调 getSpotPrice 回填价格,由用户手填或回车调计算器
+ // 续发(renewal)场景的初始价恢复由 refreshInitialUnderlyingPrices 独立处理
//this.initMarginRate();
},
setFloatRateUnderlyingCode(data, item) {
@@ -1556,14 +1581,11 @@ const vue = new Vue({
},
// A renewal opens as a new trade, so the underlying autocomplete only restores
- // its code and does not emit change. Fetch the initial price explicitly.
+ // its code and does not emit change. Historically fetched the initial price explicitly.
+ // 簿记基础逻辑1:续发场景也不自动填充价格,由用户手填或回车调计算器反算。
refreshInitialUnderlyingPrices() {
if (!page.isAdd) return;
- this.paySwapList.forEach(item => {
- if (item.UnderlyingCode) {
- this.getSpotPrice(item.UnderlyingCode, this.trade.TradeDate, item);
- }
- });
+ // 不再自动调 getSpotPrice 回填价格;用户可手动回车调计算器或手填
},
//利息端添加行
addGetSwapRate() {
|