#EQD-7187 客户预付金配置-点击编辑按钮,右侧数据显示有问题
This commit is contained in:
@@ -33,6 +33,11 @@ namespace YLErp.Web.Controllers
|
||||
else
|
||||
{
|
||||
var marginTemplate = yldb.margin_template_v2.Find(template.MarginTemplateId);
|
||||
//绑定模板不在上方下拉筛选范围内(如已失效)时,Find 得到的是未挂 Details 的新实例,右栏只读回显会空白
|
||||
if (marginTemplate.Details.Count == 0)
|
||||
{
|
||||
marginTemplate.Details = yldb.margin_template_detail.Where(y => y.MarginTemplateId == marginTemplate.id).ToList();
|
||||
}
|
||||
ViewBag.MarginTemplate = marginTemplate;
|
||||
}
|
||||
return View(template);
|
||||
|
||||
@@ -105,8 +105,69 @@
|
||||
</div>
|
||||
|
||||
<div class="col form-layout" style="height: 520px; overflow-y:auto;">
|
||||
@*区间追保结构(规则15)只读回显:参数组区块与 margin_template_v2Edit 同款样式(本页为绑定信息页,参数本身在预付金模板V2维护,故全部只读)*@
|
||||
<template v-if="marginTemplate.RuleType == @((int)MarginRuleTypeEnum.区间追保结构)">
|
||||
<div v-for="blk in ruleRangeBlocks" v-bind:key="'spanblk'+blk.key" class="border spanBlk" style="padding:6px 10px; margin-top:10px;">
|
||||
<p style="margin:4px 0; font-weight:bold;">
|
||||
参数组{{blk.no}}:<span v-if="marginTemplate.UnderlyingSeperateType == @((int)UnderlyingSeperateTypeEnum.CustomInstrumentType)">资产类型:{{underlyingTypeNames(blk.ut)}}</span>
|
||||
<span v-if="blk.etfKind"> ETF 子类:{{blk.etfKind}}</span>
|
||||
<span v-if="blk.isTBond">(按期限分档:≤5y、(5y-10y]、(10y-30y]、>30y,每个档位独立设置)</span>
|
||||
</p>
|
||||
<div v-for="sec in blk.sections" v-bind:key="sec.key">
|
||||
<p v-if="blk.isTBond" style="margin:8px 0 2px; font-weight:bold;">期限档位:{{sec.termLabel}}</p>
|
||||
<template v-if="sec.detail && sec.detail.SpanConfig">
|
||||
<p style="margin:4px 0;">
|
||||
预警线:<vue-number-input v-model="sec.detail.SpanConfig.WarnLine" v-bind:format="inputFormatPercent" disabled></vue-number-input>
|
||||
平仓线:<vue-number-input v-model="sec.detail.SpanConfig.CloseLine" v-bind:format="inputFormatPercent" disabled></vue-number-input>
|
||||
</p>
|
||||
<p style="margin:4px 0;">多头方向(客户看多)</p>
|
||||
<table class="table table-bordered" style="margin-bottom:6px;">
|
||||
<thead>
|
||||
<tr><th>追保价格区间</th><th>追保金额</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(tier, ti) in sec.detail.SpanConfig.LongSpans" v-bind:key="'long'+ti">
|
||||
<td>
|
||||
<template v-if="ti === 0">
|
||||
<vue-number-input v-model="tier.Lower" v-bind:format="inputFormatPercent" disabled></vue-number-input> × {{spanText(sec.detail).priceInit}} ≤ {{spanText(sec.detail).priceCur}}
|
||||
</template>
|
||||
<template v-else>
|
||||
<vue-number-input v-model="tier.Lower" v-bind:format="inputFormatPercent" disabled></vue-number-input> × {{spanText(sec.detail).priceInit}} ≤ {{spanText(sec.detail).priceCur}} < <vue-number-input v-model="tier.Upper" v-bind:format="inputFormatPercent" disabled></vue-number-input> × {{spanText(sec.detail).priceInit}}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<vue-number-input v-model="tier.AmountRate" v-bind:format="inputFormatPercent" disabled></vue-number-input> × {{spanText(sec.detail).amountBase}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p style="margin:4px 0;">空头方向(客户看空)</p>
|
||||
<table class="table table-bordered" style="margin-bottom:0;">
|
||||
<thead>
|
||||
<tr><th>追保价格区间</th><th>追保金额</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(tier, ti) in sec.detail.SpanConfig.ShortSpans" v-bind:key="'short'+ti">
|
||||
<td>
|
||||
<template v-if="ti === 0">
|
||||
{{spanText(sec.detail).priceCurShort1}} ≤ <vue-number-input v-model="tier.Upper" v-bind:format="inputFormatPercent" disabled></vue-number-input> × {{spanText(sec.detail).priceInit}}
|
||||
</template>
|
||||
<template v-else>
|
||||
<vue-number-input v-model="tier.Lower" v-bind:format="inputFormatPercent" disabled></vue-number-input> × {{spanText(sec.detail).priceInit}} < {{spanText(sec.detail).priceCurShort}} ≤ <vue-number-input v-model="tier.Upper" v-bind:format="inputFormatPercent" disabled></vue-number-input> × {{spanText(sec.detail).priceInit}}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<vue-number-input v-model="tier.AmountRate" v-bind:format="inputFormatPercent" disabled></vue-number-input> × {{spanText(sec.detail).amountBase}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-for="(detail,index) in marginTemplate.Details">
|
||||
<div class="border detail">
|
||||
<div class="border detail" v-show="marginTemplate.RuleType != @((int)MarginRuleTypeEnum.区间追保结构)">
|
||||
<div class="row no-gutters">
|
||||
<div class="col">
|
||||
@if (PS.Config.Company == CompanyEnum.广发商贸)
|
||||
|
||||
@@ -5,6 +5,21 @@ const inputFormatPercent = Object.freeze({ precision: 2, append: '%' });
|
||||
const inputFormatPercentNegative = Object.freeze({ precision: 2, append: '%', negative: true });
|
||||
const inputFormatNegative = Object.freeze({ precision: 2, negative: true });
|
||||
|
||||
//区间追保结构(RuleType=15)只读回显用常量,与 marginTemplateV2Edit.js 保持一致
|
||||
const RangeMarginRuleType = 15;
|
||||
//允许配期限档(SpanConfig.BondTerm)的资产类型掩码,本期仅利率债
|
||||
const TermTierEnabledUnderlyingMask = 16;
|
||||
//利率债区块固定展开的4个期限档([BondTerm值, 展示文案])
|
||||
const SpanBondTerms = [['<5y', '≤5y'], ['5y-10y', '(5y-10y]'], ['10y-30y', '(10y-30y]'], ['>30y', '>30y']];
|
||||
//标的资产类型标志位 -> 名称(与 marginTemplateV2Edit 的录入区块标题一致)
|
||||
const UnderlyingTypeNames = [
|
||||
[16, "利率债"], [32, "信用债"], [64, "其它债券"], [128, "股票"], [256, "股指"], [512, "股指期货"],
|
||||
[1024, "商品期货"], [2048, "商品现货"], [4096, "新三板挂牌股票"], [8192, "香港股票"], [16384, "香港股指"],
|
||||
[32768, "基金及基金专户"], [65536, "黄金期货"], [131072, "国债期货"], [262144, "其他期货"], [524288, "黄金现货"],
|
||||
[1048576, "其他现货"], [2097152, "境外期货"], [4194304, "境外现货"], [8388608, "境外股票"], [16777216, "境外股指"],
|
||||
[33554432, "汇率"], [67108864, "Shibor"], [134217728, "银行间回购定盘"], [268435456, "利率收益率"], [536870912, "债券指数"]
|
||||
];
|
||||
|
||||
const vue = new Vue({
|
||||
el: '#marginTemplateV2Form',
|
||||
data: {
|
||||
@@ -20,7 +35,87 @@ const vue = new Vue({
|
||||
created: function () {
|
||||
this.clientMarginTemplate.ValueDate = new moment(this.clientMarginTemplate.ValueDate).format("YYYY-MM-DD");
|
||||
},
|
||||
computed: {
|
||||
//区间追保结构只读参数组:连续利率债行归一个区块、按固定4档对位(缺档不补造、同档重复/异常档独立成段保留展示);
|
||||
//其余行(含ETF子类行)每行独立成块——分组口径与 marginTemplateV2Edit.rebuildSpanBlocks 一致,但只回显不新增行
|
||||
ruleRangeBlocks() {
|
||||
if (this.marginTemplate.RuleType != RangeMarginRuleType) return [];
|
||||
var details = this.marginTemplate.Details || [];
|
||||
var that = this;
|
||||
var blocks = [];
|
||||
var i = 0;
|
||||
while (i < details.length) {
|
||||
if ((details[i].UnderlyingType || 0) === TermTierEnabledUnderlyingMask) {
|
||||
var j = i;
|
||||
while (j < details.length && (details[j].UnderlyingType || 0) === TermTierEnabledUnderlyingMask) j++;
|
||||
var byTerm = {};
|
||||
var extras = [];
|
||||
for (var k = i; k < j; k++) {
|
||||
var bt = (details[k].SpanConfig && details[k].SpanConfig.BondTerm) || '';
|
||||
var canonical = SpanBondTerms.some(function (t) { return t[0] === bt; });
|
||||
if (canonical && !byTerm[bt]) byTerm[bt] = details[k]; else extras.push(details[k]);
|
||||
}
|
||||
var sections = SpanBondTerms.map(function (t) {
|
||||
return { key: 't' + t[0], termLabel: t[1], detail: byTerm[t[0]] || null };
|
||||
});
|
||||
extras.forEach(function (r, xi) {
|
||||
sections.push({ key: 'x' + xi, termLabel: that.bondTermLabel(r), detail: r });
|
||||
});
|
||||
blocks.push({ key: 'i' + i, no: blocks.length + 1, ut: TermTierEnabledUnderlyingMask, isTBond: true, etfKind: '', sections: sections });
|
||||
i = j;
|
||||
} else {
|
||||
var d = details[i];
|
||||
blocks.push({
|
||||
key: 'i' + i, no: blocks.length + 1, ut: d.UnderlyingType || 0, isTBond: false,
|
||||
etfKind: (d.SpanConfig && d.SpanConfig.EtfKind) || '',
|
||||
sections: [{ key: 'single', termLabel: '', detail: d }]
|
||||
});
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return blocks;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
//资产类型标志位掩码 -> 名称(0=全部),与 marginTemplateV2Edit.underlyingTypeNames 一致
|
||||
underlyingTypeNames(mask) {
|
||||
mask = parseInt(mask) || 0;
|
||||
if (mask === 0) return "全部";
|
||||
var names = [];
|
||||
for (var i = 0; i < UnderlyingTypeNames.length; i++) {
|
||||
if ((mask & UnderlyingTypeNames[i][0]) > 0) names.push(UnderlyingTypeNames[i][1]);
|
||||
}
|
||||
return names.length > 0 ? names.join("、") : "全部";
|
||||
},
|
||||
//期限档 BondTerm -> 展示文案(空=全部)
|
||||
bondTermLabel(detail) {
|
||||
var v = (detail.SpanConfig && detail.SpanConfig.BondTerm) || '';
|
||||
var map = { '': '全部', '<5y': '≤5y', '5y-10y': '(5y-10y]', '10y-30y': '(10y-30y]', '>30y': '>30y' };
|
||||
return map[v] !== undefined ? map[v] : v;
|
||||
},
|
||||
//区间计价口径文案:按 detail 资产类型切换,与取数侧对齐(债券类=中债估值净价/期初全价×券面总额,其余=收盘价口径),
|
||||
//直接沿用 marginTemplateV2Edit.spanText 的判定
|
||||
spanText(detail) {
|
||||
var ut = (detail && detail.UnderlyingType) || 0;
|
||||
var bondMask = 16 | 32 | 64;
|
||||
var isBond = ut !== 0 && (ut & ~bondMask) === 0;
|
||||
if (!isBond) {
|
||||
return {
|
||||
priceInit: '参考标的期初净价',
|
||||
priceCur: '参考标的当前收盘价',
|
||||
priceCurShort1: '参考标的当前收盘价',
|
||||
priceCurShort: '参考标的当前收盘价',
|
||||
amountBase: '参考标的期初价格 × 参考标的名义份额'
|
||||
};
|
||||
}
|
||||
return {
|
||||
priceInit: '期初净价',
|
||||
priceCur: '当前净价',
|
||||
priceCurShort1: '当前净价',
|
||||
priceCurShort: '当前净价',
|
||||
amountBase: '期初全价 × 券面总额'
|
||||
};
|
||||
},
|
||||
//changeClient(yldata) {
|
||||
// let client = yldata || { id: 0 };
|
||||
// this.clientMarginTemplate.ClientId = client.id;
|
||||
|
||||
Reference in New Issue
Block a user