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.
139 lines
5.8 KiB
139 lines
5.8 KiB
<!DOCTYPE html>
|
|
<html class="x-admin-sm">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>设备ID入库</title>
|
|
<meta name="renderer" content="webkit">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
<meta name="viewport"
|
|
content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
|
|
<link rel="stylesheet" href="/css/font.css">
|
|
<link rel="stylesheet" href="/css/xadmin.css">
|
|
<script type="text/javascript" src="/lib/layui/layui.js" charset="utf-8"></script>
|
|
<script type="text/javascript" src="/js/xadmin.js"></script>
|
|
<!-- 让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>
|
|
dl.layui-anim.layui-anim-upbit {
|
|
height: 185px;
|
|
}
|
|
|
|
body {
|
|
background-image: url("/images/wallhaven.jpg");
|
|
background-repeat: no-repeat;
|
|
background-attachment: fixed;
|
|
background-color: #e4eaf1;
|
|
background-position: center;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="layui-fluid" style="background-color:rgba(255,255,255,0.3);min-height: 317px">
|
|
<div class="layui-row">
|
|
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
|
|
<legend class="layui-icon">增加新的设备ID </legend>
|
|
</fieldset>
|
|
<form class="layui-form" style="margin-top: 30px">
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">设备类型</label>
|
|
<div class="layui-input-block">
|
|
<select name="devType" lay-verify="required" lay-reqText="请选择设备类型">
|
|
<option value="">选择要添加的设备类型</option>
|
|
{foreach $data as $dev}
|
|
<option value="{$dev.function}">{$dev.chinese}({$dev.function})</option>
|
|
{/foreach}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item">
|
|
|
|
<label class="layui-form-label">设备ID</label>
|
|
<div class="layui-input-block">
|
|
<input id="serialNum" name="serialNum" lay-verify="serialNum" autocomplete="off"
|
|
placeholder="输入新增设备ID" class="layui-input">
|
|
</div>
|
|
</div>
|
|
<!-- 提交按钮-->
|
|
<div class="layui-form-item" style="margin-top: 90px">
|
|
<button lay-filter="edit" lay-submit="" class="layui-btn layui-btn-fluid"
|
|
style="font-family:黑体;font-size:20px;height: 50px;border-radius: 15px">增加设备ID
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
layui.use(['form', 'layer', 'jquery'], function () {
|
|
var form = layui.form,
|
|
layer = layui.layer,
|
|
$ = layui.jquery;
|
|
|
|
//自定义验证规则
|
|
form.verify({
|
|
serialNum: function (value) {
|
|
if (value.length === 0) {
|
|
return '请输入设备ID!';
|
|
}
|
|
}
|
|
|
|
});
|
|
|
|
//监听提交
|
|
form.on('submit(edit)',
|
|
function (data) {
|
|
// console.log(data.field);
|
|
// console.log(aream);
|
|
//使用ajax传递数据
|
|
layer.msg('绑定中……', {time: 600});
|
|
var load = layer.load();
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "/index/Tools/device_id_add",
|
|
data: {
|
|
type: data.field.devType,
|
|
serial_num: data.field.serialNum,
|
|
|
|
},
|
|
success: function (msg) {
|
|
parent.parent.layui.notice.remove();
|
|
layer.close(load);
|
|
if (msg === 'ok') {
|
|
parent.parent.layui.notice.success('设备ID' + data.field.serialNum + '成功入库!设备类型为:' + data.field.devType, '操作完成', parent.parent.noticeOpt4);
|
|
parent.layer.msg('设备ID' + data.field.serialNum + '成功入库!设备类型为:' + data.field.devType, {
|
|
icon: 6,
|
|
time: 1700
|
|
});
|
|
// 获得frame索引
|
|
var index = parent.layer.getFrameIndex(window.name);
|
|
|
|
//刷新父页面
|
|
setTimeout(function () {
|
|
parent.layer.close(index);
|
|
// parent.location.reload();
|
|
parent.$("#refresh").click();
|
|
}, 1200);
|
|
// parent.location.reload();
|
|
|
|
} else {
|
|
parent.parent.layui.notice.error(msg, '操作异常', parent.parent.noticeOpt5);
|
|
layer.alert(msg, {icon: 7});
|
|
}
|
|
},
|
|
error: function () {
|
|
layer.close(load);
|
|
parent.parent.layui.notice.remove();
|
|
parent.parent.layui.notice.error('数据提交失败,请联系后台管理员', '操作异常', parent.parent.noticeOpt5);
|
|
layer.alert('数据提交失败,请联系后台管理员!', {icon: 2})
|
|
}
|
|
});
|
|
|
|
return false;
|
|
});
|
|
});</script>
|
|
</body>
|
|
</html>
|