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.

136 lines
5.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 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: 470px
}
</style>
</head>
<body>
<form class="layui-form" action="">
<div class="mainBox">
<div class="main-container" style="margin-top: 25px;">
<div class="layui-form-item">
<label class="layui-form-label" style="width: 85px !important;"><span
class="require-star"></span>任务名称</label>
<div class="layui-input-block" style="margin-left: 118px !important;">
<input type="text" id="task_name" lay-verify="taskName" autocomplete="off" placeholder="请输入任务名称"
class="layui-input input-width">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label" style="width: 85px !important;"><span
class="require-star"></span>数据库表名称</label>
<div class="layui-input-block layui-input-group" style="margin-left: 118px !important;">
<div class="layui-input-split layui-input-prefix">
ds_
</div>
<input type="text" id="table_name" lay-verify="tableName" autocomplete="off"
placeholder="请输入数据库表名称" class="layui-input input-width" style="width: 255px;">
</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>
layui.use(function () {
var form = layui.form;
var $ = layui.jquery;
// 自定义验证
form.verify({
taskName: [/^.{2,32}$/, '任务名称长度只允许2到32位'],
tableName: [/^[a-z0-9_]{2,32}$/, '表名只允许小写字母、数字和下划线并且长度必须为2到32位']
});
form.on('submit(save)', function (data) {
var selfOrNext = window.localStorage.getItem('self_or_next');
if (window.localStorage.getItem('form_json') !== undefined) {
$.ajax({
url: '/QingLong/collect/addFormJob',
type: 'post',
data: {
"job_name": $("#task_name").val(),
"table_name": "ds_" + $("#table_name").val(),
"json": window.localStorage.getItem('form_json'),
"target_type_id": window.localStorage.getItem('target_type_id'),
"self_or_next": selfOrNext
},
success: function (result) {
if (result.success) {
layer.msg("保存成功!", {
icon: 1,
time: 1000
}, function () {
localStorage.removeItem('self_or_next');
parent.layer.close(parent.layer.getFrameIndex(window.name));
if (selfOrNext == 1) {
parent.window.location = "/QingLong/view/tb/org/task_list_bdw.html";
} else {
parent.window.location = "/QingLong/view/tb/org/task_list.html";
}
});
} else {
layer.msg(result.message, {
icon: 2,
time: 2000
});
}
}
});
} else {
layer.msg("出现异常,请重新维护表单内容!", {
icon: 2,
time: 2000
});
}
return false;
});
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;
}
});
</script>
<script>
</script>
</body>
</html>