|
|
<!DOCTYPE html>
|
|
|
<html lang="en">
|
|
|
|
|
|
<head>
|
|
|
<meta charset="UTF-8">
|
|
|
<title></title>
|
|
|
<link rel="stylesheet" href="../../../component/pear/css/pear.css" />
|
|
|
<style>
|
|
|
.require-star {
|
|
|
position: absolute;
|
|
|
width: 3px;
|
|
|
height: 14px;
|
|
|
background-color: #ea4335;
|
|
|
top: 12px;
|
|
|
right: 8px;
|
|
|
border-radius: 1.5px;
|
|
|
}
|
|
|
|
|
|
.input-width {
|
|
|
max-width: 455px
|
|
|
}
|
|
|
|
|
|
.layui-form-select {
|
|
|
width: 455px;
|
|
|
}
|
|
|
|
|
|
.layui-btn-container .layui-btn {
|
|
|
margin-right: 10px;
|
|
|
margin-top: 4px;
|
|
|
word-spacing: normal;
|
|
|
}
|
|
|
|
|
|
.layui-table-view .layui-table th {
|
|
|
padding: 0;
|
|
|
border-top: 1px solid #EEEEEE !important;
|
|
|
/* border-left: 1px solid #EEEEEE !important; */
|
|
|
}
|
|
|
</style>
|
|
|
</head>
|
|
|
|
|
|
<body>
|
|
|
<form class="layui-form" action="">
|
|
|
<div class="mainBox">
|
|
|
<div class="main-container">
|
|
|
<div class="layui-form-item">
|
|
|
<label class="layui-form-label" style="width: 100px !important;"><span
|
|
|
class="require-star"></span>系统名称</label>
|
|
|
<div class="layui-input-block">
|
|
|
<input type="text" name="system_name" lay-verify="required|sn" autocomplete="off"
|
|
|
placeholder="请输入系统名称" class="layui-input input-width">
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="layui-form-item">
|
|
|
<label class="layui-form-label" style="width: 100px !important;"><span
|
|
|
class="require-star"></span>前缀标识</label>
|
|
|
<div class="layui-input-block">
|
|
|
<input type="text" name="prefix" lay-verify="required|prefix" autocomplete="off"
|
|
|
placeholder="请输入前缀标识" class="layui-input input-width">
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="layui-form-item">
|
|
|
<label class="layui-form-label" style="width: 100px !important;"><span
|
|
|
class="require-star"></span>隶属单位</label>
|
|
|
<div class="layui-input-block">
|
|
|
<input type="text" name="" placeholder="请选择隶属单位" lay-verify="required" autocomplete="off"
|
|
|
class="layui-input input-width" id="org">
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="layui-form-item">
|
|
|
<label class="layui-form-label" style="width: 100px !important;">IP</label>
|
|
|
<div class="layui-input-block">
|
|
|
<div class="layui-btn-container tag" lay-filter="ipTag" lay-allowclose="true" lay-newTag="true"
|
|
|
id="tag">
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<div class="bottom">
|
|
|
<div class="button-container">
|
|
|
<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="save">
|
|
|
<i class="layui-icon layui-icon-ok"></i>
|
|
|
提交
|
|
|
</button>
|
|
|
<button type="reset" class="pear-btn pear-btn-sm">
|
|
|
<i class="layui-icon layui-icon-refresh"></i>
|
|
|
重置
|
|
|
</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</form>
|
|
|
<script src="../../../component/layui/layui.js"></script>
|
|
|
<script src="../../../component/pear/pear.js"></script>
|
|
|
<script src="./js/tableSelect.js"></script>
|
|
|
<script>
|
|
|
layui.use(['form', 'jquery', 'tag'], function () {
|
|
|
var form = layui.form;
|
|
|
var $ = layui.jquery;
|
|
|
var tag = layui.tag;
|
|
|
var tableSelect = layui.tableSelect;
|
|
|
|
|
|
var bureauId = "";
|
|
|
|
|
|
// 自定义验证
|
|
|
form.verify({
|
|
|
prefix: [/^[a-z]{2,8}$/, '内容长度限制2-8位'],
|
|
|
sn: [/^[\u4e00-\u9fa5a-zA-Z0-9]{2,16}$/, '内容长度限制2-16位']
|
|
|
});
|
|
|
|
|
|
tag.render("ipTag", {
|
|
|
skin: 'layui-btn layui-btn-primary layui-btn-sm layui-btn-radius', //标签样式
|
|
|
tagText: '<i class="layui-icon layui-icon-add-1" id="addTag"></i>添加IP' //标签添加按钮提示文本
|
|
|
});
|
|
|
|
|
|
|
|
|
form.on('submit(save)', function (data) {
|
|
|
//获取标签信息
|
|
|
var buttons = $('#tag button:not(.button-new-tag)');
|
|
|
var ipArray = [];
|
|
|
buttons.each(function () {
|
|
|
var _ip = $(this).html().replace(/<i[^>]*>.*<\/i>/g, '');
|
|
|
if (!isIPorDomain(_ip)) {
|
|
|
layer.msg("IP或域名格式不正确!", {
|
|
|
icon: 2,
|
|
|
time: 2000
|
|
|
});
|
|
|
return false;
|
|
|
}
|
|
|
ipArray.push(_ip);
|
|
|
});
|
|
|
var ip = ipArray.join(',');
|
|
|
data.field['ip'] = ip;
|
|
|
data.field['bureau_id'] = bureauId;
|
|
|
|
|
|
$.ajax({
|
|
|
url: '/dsBase/dataShare/addSystem',
|
|
|
data: data.field,
|
|
|
type: 'post',
|
|
|
success: function (result) {
|
|
|
if (result.success) {
|
|
|
layer.msg("新增成功!", {
|
|
|
icon: 1,
|
|
|
time: 1300
|
|
|
}, function () {
|
|
|
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
|
|
parent.layui.table.reload("data-table");
|
|
|
});
|
|
|
} else {
|
|
|
layer.msg(result.message, {
|
|
|
icon: 2,
|
|
|
time: 2000
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
tableSelect.render({
|
|
|
elem: '#org',
|
|
|
searchKey: 'keyword',
|
|
|
checkedKey: 'id',
|
|
|
searchPlaceholder: '请输入单位名称',
|
|
|
table: {
|
|
|
url: '/dsBase/dataShare/getBureauInfoByKeyword',
|
|
|
cols: [[
|
|
|
{ type: 'radio', width: '3%' },
|
|
|
{ field: 'org_name', title: '单位名称'},
|
|
|
{ field: 'province_name', title: '省', width: '20%' },
|
|
|
{ field: 'city_name', title: '市', width: '20%' },
|
|
|
{ field: 'area_name', title: '区', width: '20%' }
|
|
|
]]
|
|
|
},
|
|
|
done: function (elem, data) {
|
|
|
bureauId = data.data[0].org_id;
|
|
|
elem.val(data.data[0].org_name);
|
|
|
}
|
|
|
})
|
|
|
|
|
|
function GetQueryString(name, istop) {
|
|
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
|
|
var r = window.location.search.substr(1).match(reg);
|
|
|
if (typeof (istop) != "undefined") r = top.location.search.substr(1).match(reg);
|
|
|
|
|
|
if (r != null) return unescape(r[2]);
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
//判断字符串是否为IP或域名
|
|
|
function isIPorDomain(str) {
|
|
|
var reg = /^((\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$|^([a-zA-Z0-9]+(-[a-zA-Z0-9]+)*\.)+[a-zA-Z]{2,}$/;
|
|
|
return reg.test(str);
|
|
|
}
|
|
|
|
|
|
});
|
|
|
</script>
|
|
|
|
|
|
</body>
|
|
|
|
|
|
</html> |