157 lines
6.9 KiB
Plaintext
157 lines
6.9 KiB
Plaintext
@model IEnumerable<AppConfig>
|
|
|
|
@{
|
|
var id = 0;
|
|
ViewData["Title"] = "全局配置(AppConfig)";
|
|
}
|
|
|
|
@section heads{
|
|
<style>
|
|
input[type=checkbox] {
|
|
width: 17px;
|
|
height: 17px;
|
|
vertical-align: middle;
|
|
margin-top: -3px;
|
|
margin-right: 3px;
|
|
}
|
|
</style>
|
|
}
|
|
|
|
<div style="position:fixed;left:0;right:0;bottom:0px;z-index:10;max-height:65px;">
|
|
<div class="container">
|
|
<div class="alert alert-danger row" style="margin-bottom:0">
|
|
<div class="col">
|
|
<p class="m-0 p-3 text-break" id="respMsg">修改后自动保存</p>
|
|
</div>
|
|
<div class="col-auto text-right" style="width:100px;">
|
|
<button class="btn btn-primary" onclick="ResetConfig()">刷新配置</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h4 class="card-title">全局配置(AppConfig)</h4>
|
|
</div>
|
|
<div class="card-body" style="padding-bottom: 70px;">
|
|
@foreach (var item in Model)
|
|
{
|
|
id++;
|
|
var label = item.PName + "-" + item.Remark;
|
|
<div class="mb-5">
|
|
@if (item.PType == "bool")
|
|
{
|
|
var val = item.PValue?.ToLowerInvariant();
|
|
<label>
|
|
<input id="config@(id)" type="checkbox" name="@(item.PName)" onchange="SaveValue('@id')" @("true" == val ? "checked" : "") />
|
|
@(label)
|
|
</label>
|
|
}
|
|
else if (item.PType == "string" || item.PType == "int" || item.PType == "double")
|
|
{
|
|
<div class="font-weight-bold mb-2">@(label)</div>
|
|
<input id="config@(id)" type="text" name="@(item.PName)" value="@(item.PValue)" data-value="@(item.PValue)" onblur="SaveValue('@id')" onkeydown="OnInputKeyDown('@id')" class="form-control" style="width:700px" />
|
|
}
|
|
else if (item.PType == "text")
|
|
{
|
|
<div style="font-weight:700">@(label)</div>
|
|
<textarea id="config@(id)" rows="3" name="@(item.PName)" data-value="@(item.PValue)" onblur="SaveValue('@id')" onkeydown="OnInputKeyDown('@id')" class="form-control" style="width:700px">@(item.PValue)</textarea>
|
|
}
|
|
else if (item.PType == "html")
|
|
{
|
|
<div style="font-weight:700">@(label)</div>
|
|
<textarea id="config@(id)" rows="3" name="@(item.PName)" data-value="@(item.PValue)" onblur="SaveValue('@id',true)" onkeydown="OnInputKeyDown('@id',true)" class="form-control" style="width:700px">@(item.PValue)</textarea>
|
|
<div class="mt-2">
|
|
<button class="btn btn-primary" onclick="showUeditorConfig('@id','@(label)')">使用编辑器配置</button>
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
IEnumerable<string> names = null;
|
|
if (item.PType == "CompanyEnum")
|
|
{
|
|
names = Enum.GetNames(typeof(YLErp.Configuration.CompanyEnum));
|
|
}
|
|
else if (item.PType == "ComponentVersion")
|
|
{
|
|
names = Enum.GetNames(typeof(YLErp.Configuration.ComponentVersion));
|
|
}
|
|
else if (item.PType == "VolModeEnum")
|
|
{
|
|
names = Enum.GetNames(typeof(YLErp.Configuration.VolModeEnum));
|
|
}
|
|
else if (item.PType == "VolSurfaceKeyDateShiftEnum")
|
|
{
|
|
names = Enum.GetNames(typeof(YLErp.Configuration.VolSurfaceKeyDateShiftEnum));
|
|
}
|
|
else if (item.PType == "SmoothingDaycountMode")
|
|
{
|
|
names = Enum.GetNames(typeof(YLErp.Configuration.Enums.SmoothingDaycountMode));
|
|
}
|
|
else if (item.PType == "ForwardTradePriceModel")
|
|
{
|
|
names = Enum.GetNames(typeof(YLErp.Configuration.Enums.ForwardTradePriceModel));
|
|
}
|
|
else if (item.PType == "SaleMode")
|
|
{
|
|
names = Enum.GetNames(typeof(YLErp.Configuration.Enums.SaleMode));
|
|
}
|
|
else if (item.PType == "OptionTypeAndBuySell")
|
|
{
|
|
names = Enum.GetNames(typeof(YLErp.Configuration.Enums.OptionTypeAndBuySell));
|
|
}
|
|
else if (item.PType == "ForwardValueIsSupplyOrPay")
|
|
{
|
|
names = Enum.GetNames(typeof(YLErp.Configuration.Enums.ForwardValueIsSupplyOrPay));
|
|
}
|
|
else if (item.PType == "ExchangeOptionVolType")
|
|
{
|
|
names = Enum.GetNames(typeof(YLErp.Configuration.Enums.ExchangeOptionVolType));
|
|
}
|
|
<div style="font-weight:700">@(label)</div>
|
|
if (names != null)
|
|
{
|
|
<select id="config@(id)" class="form-control" name="@(item.PName)" style="width:500px;" onchange="SaveValue('@id')">
|
|
@foreach (var name in names)
|
|
{
|
|
<option value="@(name)" @(name == item.PValue ? "selected" : "")>@(name)</option>
|
|
}
|
|
</select>
|
|
}
|
|
}
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="modal" tabindex="-1" role="dialog" id="ueditorModal">
|
|
<div class="modal-dialog modal-lg" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">配置</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div id="editor"></div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-primary btn-min" onclick="saveUeditorConfig()">保存</button>
|
|
<button type="button" class="btn btn-secondary btn-min" data-dismiss="modal">关闭</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@section scripts{
|
|
<script src="~/Scripts/ueditor/ueditor.config.js?v=@(HtmlUtil.JsVersion)"></script>
|
|
<script src="~/Scripts/ueditor/ueditor.all.min.js?v=@(HtmlUtil.JsVersion)"></script>
|
|
<script>
|
|
var saveConfigValueUrl = '@Url.Action("AjaxSaveAppConfig")';
|
|
var resetConfigValueUrl = '@Url.Action("AjaxResetAppConfig")';
|
|
</script>
|
|
<script src="~/Scripts/admin/appconfig.js?v=@(HtmlUtil.JsVersion)"></script>
|
|
}
|