- 三编辑页重复的 eodSuggest/eodRenderSuggest/eodHideSuggest/checkSubmitData/初始化 抽成 eodUnderlyingSuggest.js 一处引用,禁止逐页复制内联脚本 - 修复静默 bug:cshtml 缺 #eodSuggestBox 容器且 class 无 CSS 导致下拉从未渲染;改为 JS 动态创建盒子+样式内联 - 修复点选 ReferenceError:回调由对象字面量求值改为 window['lookup'+kind] 安全解析+typeof 校验
96 lines
4.3 KiB
Plaintext
96 lines
4.3 KiB
Plaintext
@model eod_commodity_future_price
|
|
@{
|
|
ViewBag.Title = "日终商品期货价格 | 编辑";
|
|
Layout = "~/Views/Shared/_InfoLayout.cshtml";
|
|
bool isNew = ViewBag.IsNew != null && (bool)ViewBag.IsNew;
|
|
}
|
|
@section JS
|
|
{
|
|
<script src="~/Scripts/app/eod/eodUnderlyingSuggest.js?v=@(HtmlUtil.JsVersion)"></script>
|
|
<script type="text/javascript">
|
|
// 手工输入期货合约代码后失焦:校验标的存在且已上市,带出市场并回填 UnderlyingId(列表查询按此 join)
|
|
function lookupFuture() {
|
|
var el = document.getElementById('UnderlyingCode');
|
|
if (!el) return;
|
|
var code = (el.value || '').trim();
|
|
var mk = document.getElementById('MarketBox');
|
|
var idEl = document.getElementById('UnderlyingId');
|
|
if (!code) { if (mk) mk.value = ''; if (idEl) idEl.value = ''; return; }
|
|
main.post("/eodPrice/LookupUnderlyingForEod", { code: code, kind: 'future' }).done(function (res) {
|
|
el.value = res.obj.Code;
|
|
if (idEl) idEl.value = res.obj.Id;
|
|
if (mk) mk.value = res.obj.Market || '';
|
|
});
|
|
}
|
|
|
|
function saveeod_commodity_future_price() {
|
|
var el = document.getElementById('UnderlyingCode');
|
|
var idEl = document.getElementById('UnderlyingId');
|
|
if (el && !(el.value || '').trim()) {
|
|
main.message('请输入期货标的代码'); return false;
|
|
}
|
|
if (el && idEl && !idEl.value) {
|
|
main.message('标的未校验通过,请重新输入代码后失焦'); return false;
|
|
}
|
|
if (!checkSubmitData()) return false;
|
|
var data = $("#form1").serialize();
|
|
main.post("/eodPrice/EodFuturePriceEditJson", data).done(function (res) {
|
|
window.location.href = "/eodPrice/eodPriceview?enid=" + res.obj.EncryptId + "&UnderlyingInstrumentType=CommodityFutures";
|
|
main.parentReloadData();
|
|
});
|
|
}
|
|
</script>
|
|
}
|
|
<form class="yc-panel" id="form1" method="post" onsubmit="return false;">
|
|
|
|
<input type="hidden" value="@Model.id" name="id" id="id" />
|
|
<input type="hidden" value="@Model.EncryptId" name="EncryptId" id="EncryptId" />
|
|
@if (isNew)
|
|
{
|
|
<input type="hidden" name="UnderlyingId" id="UnderlyingId" value="" />
|
|
}
|
|
else
|
|
{
|
|
<input type="hidden" name="UnderlyingId" value="@(Model.UnderlyingId)" />
|
|
<input type="hidden" name="UnderlyingCode" value="@(Model.UnderlyingCode)" />
|
|
}
|
|
<input type="hidden" name="HighPrice" value="@(Model.HighPrice)" />
|
|
<input type="hidden" name="LowPrice" value="@(Model.LowPrice)" />
|
|
|
|
<h4>日终商品期货价格修改</h4>
|
|
|
|
<div style="margin-top:20px;">
|
|
@if (isNew)
|
|
{
|
|
<div class='form-group col-md-6'>
|
|
<label class='formlabel'>标的代码</label>
|
|
<input class='text-box' type='text' id="UnderlyingCode" name="UnderlyingCode" value="" onblur="lookupFuture()" oninput="eodSuggest(this, 'future')" placeholder="输入期货合约代码(边打边联想),失焦自动带出市场" />
|
|
</div>
|
|
<div class='form-group col-md-6'>
|
|
<label class='formlabel'>市场</label>
|
|
<input class='text-box' type='text' id="MarketBox" readonly=readonly />
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
<div class='form-group col-md-6'>
|
|
<label class='formlabel'>市场</label>
|
|
<input class='text-box' type='text' value='@(ViewData["市场"])' readonly=readonly />
|
|
</div>
|
|
<div class='form-group col-md-6'>
|
|
<label class='formlabel'>标的代码</label>
|
|
<input class='text-box' type='text' value='@(Model.UnderlyingCode)' readonly=readonly />
|
|
</div>
|
|
}
|
|
@Html.MyDateFor(model => model.ValueDate)
|
|
@Html.MyTextFor(model => model.ClosePrice)
|
|
@Html.MyTextFor(model => model.SettlePrice)
|
|
@Html.MyTextFor(model => model.ReferencePrice)
|
|
</div>
|
|
<div style="padding:10px;padding-left:130px;">
|
|
<button class="btn btn-primary" type="button" onclick="saveeod_commodity_future_price();">保存</button>
|
|
<button class="btn btn-primary" type="button" onclick="layer.closeMe();">关闭</button>
|
|
|
|
</div>
|
|
</form>
|