@model cy_scdz.ViewModel.Setting.SettingVm
|
@inject IStringLocalizer<Program> Localizer;
|
|
|
|
@for (int i = 0; i < Model.allNodesWithChildren.Count; i++)
|
{
|
<div class="setfix set_allitem">
|
<div class="content">
|
<div class="text-justified bold-text tabsetsys"> @Model.allNodesWithChildren[i].Name:</div>
|
</div>
|
<div class="setfix">
|
@for (int ix = 0; ix < Model.allNodesWithChildren[i].Children.Count; ix++)
|
{
|
|
|
<div class="content">
|
<div class="text-justified itemsetsys"> @Model.allNodesWithChildren[i].Children.ToArray()[ix].Name</div>
|
</div>
|
|
}
|
@if (Model.allNodesWithChildren[i].Key == "zbgys" || Model.allNodesWithChildren[i].Key == "fmzz" || Model.allNodesWithChildren[i].Key == "nyzz")
|
{
|
<button class="itemsetbutsys layui-btn-submit" id="@Model.allNodesWithChildren[i].Key">自定义增加</button>
|
}
|
</div>
|
</div>
|
|
}
|
|
|
<style>
|
.set_allitem {
|
margin: 5px 0px;
|
}
|
|
.set_content {
|
width: 100%;
|
text-align: justify;
|
}
|
|
.text-justified {
|
text-align: justify;
|
}
|
|
/* 对于现代浏览器(包括IE10+)的完整支持,可以添加以下样式以处理最后一行 */
|
.text-justified:last-child::after {
|
content: "";
|
display: inline-block;
|
width: 100%;
|
}
|
|
.font-black {
|
color: #000000;
|
/* 或者简写为 */
|
color: black;
|
}
|
|
.bold-text {
|
font-weight: bold;
|
}
|
|
.setfix {
|
display: flex;
|
height: 20px;
|
}
|
|
.tabsetsys {
|
/* 标题偏移*/
|
padding-left: 10px;
|
width: 80px;
|
}
|
|
.itemsetbutsys {
|
margin: 0px 10px;
|
}
|
|
.itemsetsys {
|
/* 标题偏移*/
|
padding: 0px 10px;
|
}
|
</style>
|
|
|
<script>
|
layui.use(['layer', 'jquery'], function () {
|
var layer = layui.layer;
|
var $ = layui.jquery;
|
|
// 为所有具有特定类名(如:layui-btn-submit)的按钮绑定点击事件
|
$('.layui-btn-submit').on('click', function (event) {
|
event.preventDefault(); // 阻止默认行为
|
|
// 获取当前点击按钮的id属性值
|
var buttonId = "";
|
switch (this.id) {
|
case 'zbgys':
|
buttonId = "请输入新增中标供应商名称";
|
break;
|
case 'fmzz':
|
buttonId = "请输入新增封面纸张规格";
|
break;
|
case 'nyzz':
|
buttonId = "请输入新增内页纸张规格";
|
break;
|
default:
|
buttonId = "";
|
break;
|
|
}
|
|
var btid = this.id;
|
|
// 弹出一个对话框让用户输入内容
|
layer.prompt({
|
title: buttonId,
|
formType: 0 // 0 表示文本输入框
|
}, function (value, index, elem) {
|
// 在这里执行提交逻辑,例如向服务器发送数据等
|
submitData(btid, value, index);
|
|
});
|
});
|
|
function submitData(id, value, index) {
|
|
$.ajax({
|
url: "/Setting/Setting/Edit",
|
type: "POST"
|
, contentType: "application/json; charset=utf-8"
|
, dataType: "json"
|
, data: JSON.stringify({ key: id, name: value })
|
|
|
, success: function (result) {
|
debugger
|
if (result.code == 1) {
|
window.location.reload();
|
layer.alert(`写入成功`, {
|
icon: 0, // 设置图标为警告图标
|
title: '提示'
|
});
|
|
|
// 关闭对话框
|
layer.close(index);
|
return;
|
}
|
else {
|
layer.alert(`写入失败:${result.msg}`, {
|
icon: 2, // 设置图标为警告图标
|
title: '提示'
|
});
|
|
return;
|
}
|
},
|
error: function (xhr, status, error) {
|
layer.alert(`系统错误:${error}`, {
|
icon: 2, // 设置图标为警告图标
|
title: '提示'
|
});
|
return;
|
}
|
});
|
|
}
|
});
|
</script>
|