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.

113 lines
3.8 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>设置规则</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">
<link rel="stylesheet" href="../../lib/layui/css/layui.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>
.layui-form-label {
width: 100px !important;
}
</style>
</head>
<body>
<div class="weadmin-body">
<form class="layui-form">
<div class="layui-form-item inline " id="div3">
<label class="layui-form-label" style="padding-left:0;padding-right:0;text-align:left">
规则类型
</label>
<div class="layui-input-inline" id="select_1" style="width:200px"></div>
<script type="text/html" id="test1">
<select name="service_type" id="sel1">
<% for (var i = 0; i < data.length; i ++) { %>
<option value="<%=data[i].rule_type_id%>"><%=data[i].rule_type_name%></option>
<% } %>
</select>
</script>
</div>
<div class="layui-form-item inline " id="div4">
<label for="" class="layui-form-label">
</label>
<button class="layui-btn" lay-filter="enableRule" lay-submit="">确定</button>
</div>
</div>
</form>
</div>
<script src="../../lib/layui/layui.js" charset="utf-8"></script>
<script src="../../lib/template.js"></script>
<script>
layui.extend({
admin: '{/}../../static/js/admin'
});
layui.use(['form', 'jquery', 'admin', 'layer'], function () {
var form = layui.form,
$ = layui.jquery,
admin = layui.admin,
layer = layui.layer;
var id;
//绑定规则类型
window.bindRuleType = function () {
$.ajax({
type: "GET",
dataType: "json",
async: false,
url: "/baseService/app/bindRuleType",
success: function (data) {
var html = template.render('test1', data);
document.getElementById('select_1').innerHTML = html;
}
});
form.render()
};
bindRuleType();
//监听提交
form.on('submit(enableRule)', function (d) {
$.ajax({
type: 'post',
dataType: 'json',
url: '/baseService/app/enableRule',
data: {
'rule_type_id': $("#sel1").val()
},
success: function (data) {
if (data.success) {
layer.msg('设置成功', {
icon: 1,
time: 2000 //2秒关闭如果不配置默认是3秒
}, function () {
//关闭弹出框
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
window.parent.location.reload();
});
} else {
layer.alert(data.message, {icon: 0});
return false;
}
}
});
return false;
});
});
</script>
</body>
</html>