You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

207 lines
7.6 KiB

2 years ago
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>会员资料编辑-WeAdmin Frame型后台管理系统-WeAdmin 1.0</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="../../static/css/font.css">
<link rel="stylesheet" href="../../static/css/weadmin.css">
<!-- 让IE8/9支持媒体查询从而兼容栅格 -->
<!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<style>
#check_identity {
margin-top: 8px;
}
.identity {
margin-right: 25px;
}
.identity div {
margin-top: 0 !important;
}
#editForm .layui-form-label {
width: 100px !important;
}
</style>
</head>
<body>
<div class="weadmin-body">
<form class="layui-form" lay-filter="editForm" id="editForm">
<div class="layui-form-item">
<label for="global_name" class="layui-form-label">
<span class="we-red">*</span>全局变量名称
</label>
<div class="layui-input-inline textinput">
<input type="text" id="global_name" name="global_name" lay-verify="required|contentLength" max="32"
autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label for="global_value" class="layui-form-label">
<span class="we-red">*</span>全局变量值
</label>
<div class="layui-input-inline textinput">
<input type="text" id="global_value" name="global_value" lay-verify="required|string|contentLength"
max="255" autocomplete="" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label for="global_code" class="layui-form-label">
<span class="we-red">*</span>全局变量代码
</label>
<div class="layui-input-inline textinput">
<input type="text" id="global_code" name="global_code" lay-verify="required|string|contentLength"
max="32" autocomplete="" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label for="" class="layui-form-label">
<span class="we-red">*</span>全局变量类型
</label>
<div class="layui-input-inline textinput" id="global_type"></div>
<script type="text/html" id="global_type_script">
<select name="global_type" lay-filter="global_type" lay-verify="selectVerify">
<option value="0">请选择</option>
{{#layui.each(d,function(index,item){ }}
<option value={{item.global_type_id}}>{{item.global_type_name}}</option>
{{# }) }}
</select>
</script>
</div>
<div class="layui-form-item">
<label for="" class="layui-form-label">
</label>
<button class="layui-btn" lay-filter="save" lay-submit="" id="save">确定</button>
<input type="hidden" name="dataId" id="dataId" value="">
</div>
</form>
</div>
<script src="../../lib/layui/layui.js" charset="utf-8"></script>
2 years ago
<script src="../../../js/jquery-3.6.0.min.js"></script>
<script src="../../../js/jquery_Extend.js"></script>
2 years ago
<script type="text/javascript">
layui.extend({
admin: '{/}../../static/js/admin'
});
layui.use(['form', 'jquery', 'laytpl', 'admin', 'layer'], function () {
var form = layui.form,
$ = layui.jquery,
admin = layui.admin,
layer = layui.layer,
laytpl = layui.laytpl;
$(function () {
//定位焦点
$("#global_name").focus();
// 获取分类
$.ajax({
type: "GET",
async: false,
dataType: "json",
url: "/FengHuang/global/getGlobalType",
success: function (data) {
var getTpl = global_type_script.innerHTML
, global_type = document.getElementById('global_type');
laytpl(getTpl).render(data.data, function (html) {
global_type.innerHTML = html;
});
getInfoById();
}
})
form.render();
});
// 根据id获取系统信息
function getInfoById() {
$.ajax({
type: "GET",
dataType: "json",
url: "/FengHuang/global/getGlobalById",
data: {
global_id: $("#dataId").val()
},
success: function (data) {
if (data.code == 0) {
var list = data.data[0];
var global_type_id = list.global_type_id;
$("#global_type option[value='" + global_type_id + "']").attr("selected", true);
form.val('editForm', {
global_code: list.global_code,
global_name: list.global_name,
global_value: list.global_value
})
} else {
}
},
error: function () {
}
})
}
//验证分类下拉框
form.verify({
selectVerify: function (value) {
if (value == "0") {
return "请选择类型!";
}
}
});
verifyLength();
// //监听提交
form.on('submit(save)', function (data) {
var f = data.field;
$.ajax({
type: "POST",
async: false,
dataType: "json",
url: "/FengHuang/global/updateGlobalById",
data: {
"global_name": f.global_name,
"global_value": f.global_value,
"global_type_id": f.global_type,
"global_code": f.global_code,
"global_id": $("#dataId").val()
},
success: function (data) {
if (data.success) {
layer.msg("编辑成功", {icon: 1, time: 1000, shade: [0.5, '#000', true]}, function () {
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
parent.layui.table.reload('idTest', {
page: {
curr: 1
}
});
});
} else {
layer.alert(data.message, {icon: 0});
return false;
}
}
})
return false;
});
});
</script>
</body>
</html>