Files
zszq-trs/YLErpWeb/Views/SwapTrade/tradeFlowMoreEdit.cshtml
T
2024-05-09 14:06:26 +08:00

125 lines
4.7 KiB
Plaintext

@model trade_swap_flow_more
@{
ViewBag.Title = "互换交易流水 | 编辑";
Layout = "~/Views/Shared/_InfoLayout.cshtml";
}
@section CSS{
<style>
#info .left-wrap, #info .right-wrap {
float: left;
width: 50%;
}
.field-validation-error{
color:red;
}
</style>
}
@section JS
{
<script type="text/javascript">
$(function () {
SetAceDropDown(false);
$(".datepicker").datepicker({
changeMonth: true,
changeYear: true,
showButtonPanel: true,
showOtherMonths: true,
selectOtherMonths: true
});
$("div").removeClass("col-md-6");
changeBuySell();
});
function checkSubmitData() {
var pass = $('#tradeFlowEditForm').valid();
if ($("#BuySell").find("option:selected").val() === "平仓") {
if (!$('#UnwindDate').val().trim()) {
main.alert("平仓日期 必须填写");
return false;
}
if (!$('#UnwindNotional').val().trim()) {
main.alert("平仓数量 必须填写");
return false;
}
}
return pass;
}
function changeBuySell() {
if ($("#BuySell").find("option:selected").val() === "平仓") {
$('#UnwindDate').attr("readonly", false);
$('#UnwindPrice').attr("readonly", false);
$('#UnwindNotional').attr("readonly", false);
$('#Amount').attr("readonly", false);
} else {
$('#UnwindDate').attr("readonly", true);
$('#UnwindPrice').attr("readonly", true);
$('#UnwindNotional').attr("readonly", true);
$('#Amount').attr("readonly", true);
$('#UnwindDate').val("");
$('#UnwindPrice').val("");
$('#UnwindNotional').val("");
$('#Amount').val("");
}
}
function saveTradeFlow() {
if (!checkSubmitData()) {
return false;
}
var data = $("#tradeFlowEditForm").serialize();
main.post("/swapTrade/tradeFlowMoreEditJson", data).done(function (res) {
window.parent.showmiddlemessage("成功更新本条数据");
try {
window.parent.reloadData();
closeTradeFlowEditWindow();
} catch (e) {
}
});
}
function closeTradeFlowEditWindow() {
try {
window.parent.layer.closeAll();
} catch (e) {
}
}
</script>
}
<form id="tradeFlowEditForm">
<div class="form-layout" id="info" style="width: 960px;">
<div class="left-wrap">
<input type="hidden" value="@Model.id" name="id" id="id" />
@Html.HiddenFor(model => model.EncryptId)
@Html.MyTextFor(model => model.ClientNumber, true)
@Html.MyDropdownFor1(model => model.BuySell, new List<SelectListItem>() {
new SelectListItem() { Text = "开仓", Value = "开仓"},
new SelectListItem() { Text = "平仓", Value = "平仓"},
}, new { @onchange = "changeBuySell()" }, "", false)
@Html.MyTextFor(model => model.TradeNumber, true)
@Html.MyDateFor(model => model.TradeDate, true)
@Html.MyDecimalFor(model => model.Price, true)
@Html.MyDecimalFor(model => model.AnnualRate, false)
@Html.MyDecimalFor(model => model.MargeRate, true)
@Html.MyDateFor(model => model.UnwindDate)
@Html.MyDecimalFor(model => model.UnwindPrice)
</div>
<div class="right-wrap">
@Html.MyDropdownFor1(model => model.TraderId, GlobalData.GetAllTrader(), appendBlank: false)
@Html.MyDropdownFor1(model => model.AssetBookName, AssetunitController.GetAllassetunitname(), appendBlank: false)
@Html.MyTextFor(model => model.UnderlyingCode, true)
@Html.MyDateFor(model => model.ExerciseDate, true)
@Html.MyDecimalFor(model => model.Notional, true)
@Html.MyDecimalFor(model => model.CurrencyRate, false)
@Html.MyDecimalFor(model => model.TotalFee)
@Html.MyDecimalFor(model => model.UnwindNotional)
@Html.MyDecimalFor(model => model.Amount)
</div>
</div>
<div class="form-buttons">
@MyControls.Btn("保存", "saveTradeFlow()")
@MyControls.Btn("关闭", "closeTradeFlowEditWindow()")
</div>
</form>