104 lines
3.9 KiB
Plaintext
104 lines
3.9 KiB
Plaintext
@model CorrelationTable
|
|
@{
|
|
ViewBag.Title = "相关性数据表 | 编辑";
|
|
Layout = "~/Views/Shared/_InfoLayout.cshtml";
|
|
var pageObj = new
|
|
{
|
|
isNew = Model.id == 0
|
|
};
|
|
}
|
|
@section CSS{
|
|
<style>
|
|
.form-layout input, .form-layout select { width: 220px; }
|
|
</style>
|
|
}
|
|
@section JS{
|
|
<script src="~/Scripts/app/tradeHelper.js?v=@HtmlUtil.JsVersion"></script>
|
|
<script type="text/javascript">
|
|
var page = @Json.Serialize(pageObj);
|
|
$(function () {
|
|
|
|
if (page.isNew) {
|
|
let flag = tradeHelper.UnderlyingSelectFlag;
|
|
flag = flag.UsePinYinFilter | flag.IncludeMatured;;
|
|
let underlyingCtrl1 = new tradeHelper.UnderlyingAutoComplete('#UnderlyingCode1').setFlag(flag);
|
|
let underlyingCtrl2 = new tradeHelper.UnderlyingAutoComplete('#UnderlyingCode2').setFlag(flag);
|
|
|
|
underlyingCtrl1.onSelect(function (data) {
|
|
$('#UnderlyingId1').val(data.id);
|
|
});
|
|
underlyingCtrl2.onSelect(function (data) {
|
|
$('#UnderlyingId2').val(data.id);
|
|
});
|
|
}
|
|
});
|
|
|
|
function checkSubmitData() {
|
|
var pass = $('#correlationEditForm').valid();
|
|
var codata = $("#Correlation").val();
|
|
if (codata > 1 || codata < -1) {
|
|
main.message("请输入-1到1的相关性");
|
|
return false;
|
|
}
|
|
var code1 = $('#UnderlyingCode1').val();
|
|
var code2 = $('#UnderlyingCode2').val();
|
|
if (code1 == code2) {
|
|
main.message("请选择不同的标的资产");
|
|
return false;
|
|
}
|
|
return pass;
|
|
}
|
|
|
|
function savecorrelation() {
|
|
if (!checkSubmitData()) return false;
|
|
|
|
var data = $("#correlationEditForm").serialize();
|
|
main.post("/correlation/correlationEditJson", data).done(function (res) { window.location.href = "/correlation/correlationview?enid=" + res.obj.EncryptId; try { window.parent.reloadcorrelation(); } catch (e) { } });
|
|
}
|
|
|
|
function checkcor(obj) {
|
|
var codata = $(obj).val();
|
|
if (codata > 1 || codata < -1) {
|
|
main.message("请输入-1到1的相关性");
|
|
$(obj).focus();
|
|
return false;
|
|
}
|
|
}
|
|
</script>
|
|
}
|
|
|
|
@using (Html.BeginForm("correlationEdit", "correlation", FormMethod.Post, new { id = "correlationEditForm" }))
|
|
{
|
|
<input type="hidden" name="UnderlyingId1" id="UnderlyingId1" value="@(Model.UnderlyingId1)" />
|
|
<input type="hidden" name="UnderlyingId2" id="UnderlyingId2" value="@(Model.UnderlyingId2)" />
|
|
|
|
<div class="form-layout">
|
|
@if (!pageObj.isNew)
|
|
{
|
|
<input type="hidden" value="@Model.id" name="id" id="id" />
|
|
@Html.MyTextFor(model => model.UnderlyingCode1, new { @readonly = "readonly" })
|
|
@Html.MyTextFor(model => model.UnderlyingCode2, new { @readonly = "readonly" })
|
|
}
|
|
else
|
|
{
|
|
<div class='form-group col-md-6'>
|
|
<label class='formlabel'>标的资产信息1</label>
|
|
<input type="text" class="text-box" id="UnderlyingCode1" name="UnderlyingCode1" value="@(Model.UnderlyingCode1)" />
|
|
<span style='color:red'>*</span>
|
|
</div>
|
|
|
|
<div class='form-group col-md-6'>
|
|
<label class='formlabel'>标的资产信息2</label>
|
|
<input type="text" class="text-box" id="UnderlyingCode2" name="UnderlyingCode2" value="@(Model.UnderlyingCode2)" />
|
|
<span style='color:red'>*</span>
|
|
</div>
|
|
}
|
|
|
|
@Html.HiddenFor(model => model.EncryptId)
|
|
@Html.MyDecimalFor(model => model.Correlation, new { onblur = "checkcor(this)" })
|
|
</div>
|
|
<div class="form-buttons">
|
|
@MyControls.Btn("保存", "savecorrelation()")
|
|
@MyControls.Btn("关闭", "layer.closeMe()")
|
|
</div>
|
|
} |