113 lines
4.4 KiB
Plaintext
113 lines
4.4 KiB
Plaintext
@model YLErp.Modules.TradeRiskCalcModule.UnderlyingPriceChangeLimition
|
|
|
|
@{
|
|
ViewBag.Title = "价格阈值";
|
|
Layout = "~/Views/Shared/_InfoLayout.cshtml";
|
|
}
|
|
|
|
@section JS{
|
|
<script src="@HtmlUtil.BasicDataJs("标的Live")"></script>
|
|
<script>
|
|
function savePriceLimition(setDefault) {
|
|
var code = $("#UnderlyingCode").val();
|
|
if (!code) {
|
|
return;
|
|
}
|
|
var priceIncreaseRate = $("#priceIncreaseRate").val() / 100;
|
|
var priceDecreaseRate = $("#priceDecreaseRate").val() / 100;
|
|
if (setDefault) {
|
|
priceIncreaseRate = 0;
|
|
priceDecreaseRate = 0;
|
|
}
|
|
var underlyingCode = $("UnderlyingCode").val();
|
|
var limition = { UnderlyingCode: code, priceIncreaseRate: priceIncreaseRate, priceDecreaseRate: priceDecreaseRate };
|
|
main.post("/RiskHedging/savePriceAlert", { limition: limition }).done(function () {
|
|
window.parent.location.reload()
|
|
});
|
|
}
|
|
|
|
$(function () {
|
|
var suggestions = [];
|
|
_.each(ylotc.underlyings, function (item) {
|
|
suggestions.push({ value: item.Code, data: item.Code });
|
|
});
|
|
$('#UnderlyingCode').autocomplete({
|
|
lookup: suggestions,
|
|
onSelect: function (suggestion) {
|
|
var code = suggestion.value;
|
|
if ($('#UnderlyingCode').data('suggestion') === code) {
|
|
return;
|
|
}
|
|
$('#UnderlyingCode').data('suggestion', code);
|
|
$.post("/RiskHedging/AjaxGetPriceAlert", { code: code }).done(function (resp) {
|
|
$('#priceIncreaseRate').val(resp.priceIncreaseRate * 100);
|
|
$('#priceDecreaseRate').val(resp.priceDecreaseRate * 100);
|
|
$('#basePrice').val(resp.basePrice);
|
|
});
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
}
|
|
|
|
@section CSS{
|
|
<style>
|
|
.container { max-width: 100%; }
|
|
|
|
.table-autorule > tbody > tr > td { text-align: left; }
|
|
|
|
.form-autorule { max-width: 200px; display: inline; margin-right: 4px; }
|
|
|
|
.form-check { width: 19px; height: 19px; vertical-align: bottom; margin-right: 2px !important; }
|
|
|
|
.autocomplete-suggestions { overflow: auto; border: 1px solid #CBD3DD; background: #FFF; }
|
|
|
|
.autocomplete-suggestion { overflow: hidden; padding: 5px 15px; white-space: nowrap; }
|
|
|
|
.autocomplete-selected { background: #F0F0F0; }
|
|
|
|
.autocomplete-suggestions strong { color: #029cca; font-weight: normal; }
|
|
</style>
|
|
}
|
|
|
|
<form id="formAutoRule" method="post" onsubmit="return false;" autocomplete="off">
|
|
|
|
<table class="table table-noborder table-autorule" style="width:100%;">
|
|
<colgroup>
|
|
<col span="1" width="120" />
|
|
<col span="1" />
|
|
</colgroup>
|
|
<tbody>
|
|
<tr>
|
|
<th>标的代码:</th>
|
|
<td>
|
|
<input type="text" name="UnderlyingCode" id="UnderlyingCode" value="@(Model.UnderlyingCode)" class="form-control form-autorule" />
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>基准价格</td>
|
|
<td><input type="text" name="basePrice" id="basePrice" value="@(Model.basePrice)" readonly class="form-control form-autorule" /></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>价格跌幅阈值:</td>
|
|
<td><input type="text" name="priceDecreaseRate" id="priceDecreaseRate" value="@(Model.priceDecreaseRate * 100)" class="form-control form-autorule" />%</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>价格涨幅阈值:</td>
|
|
<td><input type="text" name="priceIncreaseRate" id="priceIncreaseRate" value="@(Model.priceIncreaseRate * 100)" class="form-control form-autorule" />%</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td colspan="2" style="padding:20px 0 0 120px;">
|
|
<button type="button" class="btn btn-primary" onclick="savePriceLimition(false)">保存</button>
|
|
<button type="button" class="btn btn-primary" onclick="savePriceLimition(true)">删除</button>
|
|
<button type="button" class="btn btn-primary" onclick="layer.closeMe()">关闭</button>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</form>
|