129 lines
4.9 KiB
Plaintext
129 lines
4.9 KiB
Plaintext
@model UnderlyingDividendDto
|
|
|
|
@{
|
|
Layout = "~/Views/Shared/_InfoLayout.cshtml";
|
|
var autocomplete = string.IsNullOrEmpty(Model.UnderlyingCode);
|
|
}
|
|
|
|
@section JS{
|
|
<script src="~/Statics/libs/input/cleave.min.js?v=@(HtmlUtil.JsVersion)"></script>
|
|
<script>
|
|
const fmtDividendRate = otcformat.fixed2;
|
|
</script>
|
|
@if (autocomplete)
|
|
{
|
|
<script src="~/front/BasicData?types=权益标的&t=@(DateTime.Now.Ticks)"></script>
|
|
<script>
|
|
$(function () {
|
|
var suggestions = [];
|
|
_.each(ylotc.underlyings, function (item) {
|
|
suggestions.push({ value: item.Code, data: item.Code, name: item.Name });
|
|
});
|
|
$('#UnderlyingCode').autocomplete({
|
|
lookup: suggestions,
|
|
onSelect: function (suggestion) {
|
|
var code = suggestion.value;
|
|
if ($('#UnderlyingCode').data('suggestion') === code) {
|
|
return;
|
|
}
|
|
$('#UnderlyingCode').data('suggestion', code);
|
|
|
|
$('#UnderlyingName').text(suggestion.name);
|
|
|
|
$.post("/UnderlyingDividend/AjaxGetDetail", { underlyingCode: code }).done(function (resp) {
|
|
resp = resp.obj || { "DividendRate": 0 };
|
|
$('#DividendRate').val(fmtDividendRate(resp.DividendRate * 100));
|
|
});
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
}
|
|
<script>
|
|
$(function () {
|
|
new Cleave('#DividendRate', {
|
|
numeral: true,
|
|
numeralDecimalScale: 2,
|
|
numeralIntegerScale: 6
|
|
});
|
|
});
|
|
function saveData() {
|
|
var data = {
|
|
UnderlyingCode: $.trim($('#UnderlyingCode').val()),
|
|
DividendRate: parseFloat($('#DividendRate').val()) / 100 || 0
|
|
};
|
|
|
|
if (!data.UnderlyingCode) {
|
|
return main.alert("请填写股票代码");
|
|
}
|
|
|
|
if (isNaN(data.DividendRate)) {
|
|
return main.alert("请填写正确的分红率");
|
|
}
|
|
|
|
main.post("/UnderlyingDividend/AjaxSaveData", data).done(function (res) {
|
|
if (typeof window.parent.SearchClick === 'function')
|
|
window.parent.SearchClick();
|
|
});
|
|
}
|
|
</script>
|
|
}
|
|
|
|
@section CSS{
|
|
<style>
|
|
.container { max-width: 100%; }
|
|
.table > 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; }
|
|
.table > tbody > tr > td, .table > tbody > tr > th { border: 0; }
|
|
</style>
|
|
}
|
|
|
|
<form id="form1" method="post" onsubmit="return false;" autocomplete="off">
|
|
<div class="yc-panel">
|
|
<table class="table table-noborder" style="width:100%;">
|
|
<colgroup>
|
|
<col span="1" width="120" />
|
|
<col span="1" />
|
|
</colgroup>
|
|
<tbody>
|
|
<tr>
|
|
<th>股票代码:</th>
|
|
<td>
|
|
@if (autocomplete)
|
|
{
|
|
<input type="text" name="UnderlyingCode" id="UnderlyingCode" value="@(Model.UnderlyingCode)" class="form-control form-autorule" />
|
|
}
|
|
else
|
|
{
|
|
<span>@(Model.UnderlyingCode)</span>
|
|
<input type="hidden" name="UnderlyingCode" id="UnderlyingCode" value="@(Model.UnderlyingCode)" />
|
|
}
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<th>股票名称:</th>
|
|
<td><span id="UnderlyingName">@(Model.UnderlyingName)</span></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<th>分红率(%):</th>
|
|
<td><input type="text" name="DividendRate" id="DividendRate" value="@((Model.DividendRate*100).ToString("F2"))" 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="saveData()">保存</button>
|
|
<button type="button" class="btn btn-primary" onclick="layer.closeMe()">关闭</button>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
</form> |