|
@@ -30,10 +30,10 @@
|
|
|
<form class="form form-horizontal" id="form-admin-addProduce">
|
|
|
<div style="padding: 10px;width: 600px;margin: 0 auto;" class="">
|
|
|
<div class="my-title">产品信息</div>
|
|
|
- <div class="input-box"><span class="input-dic">产品名称</span><input class="my-input" name="produceName" type="text" value="" placeholder="请输入产品名称"/> </div>
|
|
|
- <div class="input-box"><span class="input-dic">产品描述</span><input class="my-input" type="text" name="produceRemake" value="" placeholder="请输入产品描述"/> </div>
|
|
|
+ <div class="input-box"><span class="input-dic">产品名称</span><input class="my-input" name="produceName" type="text" value="" placeholder="请输入产品名称" required maxlength="20" /> </div>
|
|
|
+ <div class="input-box"><span class="input-dic">产品描述</span><input class="my-input" type="text" name="produceRemake" value="" placeholder="请输入产品描述" required maxlength="100"/> </div>
|
|
|
<div class="input-box"><span class="input-dic">产品类型</span>
|
|
|
- <label><input type="radio" name="produceType" value="1">净水机</label>
|
|
|
+ <label><input type="radio" name="produceType" value="1" checked>净水机</label>
|
|
|
<label><input type="radio" name="produceType" value="2">冲奶机</label>
|
|
|
</div>
|
|
|
<div style="background-color:rgba(0,0,0,.1);height: 1px;margin: 15px 0;"></div>
|
|
@@ -43,18 +43,18 @@
|
|
|
<li id="1" class="processList">
|
|
|
<input type="hidden" class="processNumber" value="1">
|
|
|
<div class="input-box"><span class="input-dic process-type">节点类型</span>
|
|
|
- <label class=""><input type="radio" name="processType_p1" value="1">生产工序</label>
|
|
|
+ <label><input type="radio" name="processType_p1" value="1" checked>生产工序</label>
|
|
|
<label><input type="radio" name="processType_p1" value="2">修理工序</label>
|
|
|
<button type="button" class="my-btn-edit" onclick="delProcess(this)">删除节点</button>
|
|
|
</div>
|
|
|
- <div class="input-box"><span class="input-dic">节点名称</span><input class="my-input" name="processName" type="text" value="" placeholder="请输入节点名称"/> </div>
|
|
|
+ <div class="input-box"><span class="input-dic">节点名称</span><input class="my-input" name="processName" type="text" value="" placeholder="请输入节点名称" required maxlength="20"/> </div>
|
|
|
<div class="input-box"><span class="input-dic">节点操作</span>
|
|
|
<ul class="add-list oneTheNode" >
|
|
|
<li class="nodeList">
|
|
|
<#--<select class="my-select"><option>1</option></select>-->
|
|
|
- <label><input type="radio" name="nodeStatus_p1_n1" value="1">正常</label>
|
|
|
+ <label><input type="radio" name="nodeStatus_p1_n1" value="1" checked>正常</label>
|
|
|
<label><input type="radio" name="nodeStatus_p1_n1" value="0">异常</label>
|
|
|
- <input class="my-input" name="nodeDes" type="text" value="" placeholder="请输入节点操作描述,2-10位中文" maxlength="10"/>
|
|
|
+ <input class="my-input" name="nodeDes" type="text" value="" placeholder="请输入节点操作描述,2-20位中文" required minlength="2" maxlength="20" />
|
|
|
<i class="Hui-iconfont" onclick="delNode(this)"></i>
|
|
|
</li>
|
|
|
<li>
|
|
@@ -79,23 +79,34 @@
|
|
|
<script type="text/javascript" src="${path}/common/lib/jquery.ui/jquery-ui.js"></script>
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
- //动态显示隐藏所属菜单
|
|
|
- $(document).on('click', '.menuSubid input[type=radio]', function() {
|
|
|
- isSelectShow($(this).val())
|
|
|
- })
|
|
|
-
|
|
|
- $(function(){
|
|
|
+/*
|
|
|
+ $(function(){
|
|
|
$("#form-admin-addProduce").validate({
|
|
|
rules:{
|
|
|
- subName:{
|
|
|
+ produceName1:{
|
|
|
required:true,
|
|
|
- minlength:4,
|
|
|
- maxlength:30
|
|
|
+ minlength:2,
|
|
|
+ maxlength:20
|
|
|
}
|
|
|
},
|
|
|
- onkeyup:false,
|
|
|
+ messages: {
|
|
|
+ produceName1: {
|
|
|
+ required: "*必填!",
|
|
|
+ rangelength: "*长度为2到20位!",
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //是否在获取焦点时验证
|
|
|
+ //onfocusout:false,
|
|
|
+ //是否在敲击键盘时验证
|
|
|
+ //onkeyup:false,
|
|
|
+ //提交表单后,(第一个)未通过验证的表单获得焦点
|
|
|
+ focusInvalid:true,
|
|
|
+ //当未通过验证的元素获得焦点时,移除错误提示
|
|
|
focusCleanup:true,
|
|
|
- success:"valid",
|
|
|
+
|
|
|
+// onkeyup:false,
|
|
|
+// focusCleanup:true,
|
|
|
+// success:"valid",
|
|
|
submitHandler:function(form){
|
|
|
$.post(root_path + "/admin/produce/save_produce", formatJSON(),function(result){
|
|
|
if (result.returnCode != 200 || result.returnCode != 200) {
|
|
@@ -103,13 +114,40 @@
|
|
|
} else {
|
|
|
layer.msg('录入成功!!',{icon: 1,time:2000}, function () {
|
|
|
// 关闭当前页面,并刷新父级页面
|
|
|
- window.location.href= '${path}/admin/produce/list_produce?detaId='+result.resultMsg;
|
|
|
+ window.location.href= '${path}/admin/produce/_produce_list';
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
- });
|
|
|
+ });*/
|
|
|
+
|
|
|
+
|
|
|
+ $(function(){
|
|
|
+ //var validator = $("#form-admin-addProduce").validate();
|
|
|
+ $("#form-admin-addProduce").submit(function(){
|
|
|
+ ajaxReq();
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ function ajaxReq(){
|
|
|
+ var data = formatJSON();
|
|
|
+ $.ajax({
|
|
|
+ cache: true,
|
|
|
+ type: "POST",
|
|
|
+ data: data,
|
|
|
+ url: "${path}/admin/produce/save_produce",
|
|
|
+ async: false,
|
|
|
+ success: function(data){
|
|
|
+ if (data.returnCode == 200) {
|
|
|
+ window.location.href = '${path}/admin/produce/_produce_list'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function(XmlHttpRequest, textStatus, errorThrown){
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
/*将表单format为JSON*/
|
|
|
function formatJSON() {
|
|
@@ -153,9 +191,9 @@
|
|
|
var nodeNumber = $(node).parents(".oneTheNode").find(".nodeList").length + 1; //因为是新加的节点操作所以 +1
|
|
|
var nodeHtml = '<li class="nodeList">'
|
|
|
//+'<select class="my-select"><option>1</option></select> '
|
|
|
- +'<label><input type="radio" name="nodeStatus_p'+ processNumber +'_n'+ nodeNumber +'" value="1">正常</label> '
|
|
|
+ +'<label><input type="radio" name="nodeStatus_p'+ processNumber +'_n'+ nodeNumber +'" value="1" checked>正常</label> '
|
|
|
+'<label><input type="radio" name="nodeStatus_p'+ processNumber +'_n'+ nodeNumber +'" value="0">异常</label> '
|
|
|
- +'<input class="my-input" name="nodeDes" type="text" value="" placeholder="请输入节点操作描述,2-10位中文" maxlength="10"/> '
|
|
|
+ +'<input class="my-input" name="nodeDes" type="text" value="" placeholder="请输入节点操作描述,2-20位中文" required minlength="2" maxlength="20"/> '
|
|
|
+'<i class="Hui-iconfont" onclick="delNode(this)"></i>'
|
|
|
+'</li>';
|
|
|
$(node).parent().before(nodeHtml);
|
|
@@ -169,18 +207,18 @@
|
|
|
var processNumber = $(".onrTheProcess").find(".processList").length + 1; //因为是新加的工序节点所以 +1
|
|
|
var processHtml = '<li id="'+ processNumber +'" class="processList"><input type="hidden" class="processNumber" value="'+ processNumber +'">'
|
|
|
+ '<div class="input-box"><span class="input-dic">节点类型</span>'
|
|
|
- + '<label><input type="radio" name="processType_p'+ processNumber +'" value="1">生产工序</label>'
|
|
|
+ + '<label><input type="radio" name="processType_p'+ processNumber +'" value="1" checked>生产工序</label>'
|
|
|
+ '<label><input type="radio" name="processType_p'+ processNumber +'" value="2">修理工序</label>'
|
|
|
+ '<button type="button" class="my-btn-edit" onclick="delProcess(this)">删除节点</button>'
|
|
|
+ '</div>'
|
|
|
- + '<div class="input-box"><span class="input-dic">节点名称</span><input class="my-input" name="processName" type="text" value="" placeholder="请输入节点名称"/> </div>'
|
|
|
+ + '<div class="input-box"><span class="input-dic">节点名称</span><input class="my-input" name="processName" type="text" value="" placeholder="请输入节点名称" required maxlength="20"/> </div>'
|
|
|
+ '<div class="input-box"><span class="input-dic">节点操作</span>'
|
|
|
+ '<ul class="add-list oneTheNode">'
|
|
|
+ '<li class="nodeList">'
|
|
|
// + '<select class="my-select"><option>1</option></select> '
|
|
|
- + '<label><input type="radio" name="nodeStatus_p'+ processNumber +'_n1" value="1">正常</label> '
|
|
|
+ + '<label><input type="radio" name="nodeStatus_p'+ processNumber +'_n1" value="1" checked>正常</label> '
|
|
|
+ '<label><input type="radio" name="nodeStatus_p'+ processNumber +'_n1" value="0">异常</label> '
|
|
|
- + '<input class="my-input" name="nodeDes" type="text" value="" placeholder="请输入节点操作描述,2-10位中文" maxlength="10"/> '
|
|
|
+ + '<input class="my-input" name="nodeDes" type="text" value="" placeholder="请输入节点操作描述,2-20位中文" required minlength="2" maxlength="20"/> '
|
|
|
+ '<i class="Hui-iconfont" onclick="delNode(this)"></i>'
|
|
|
+ '</li>'
|
|
|
+ '<li><button type="button" class="my-btn-edit" onclick="addProNode(this)">增加节点操作</button></li>'
|
|
@@ -230,11 +268,11 @@
|
|
|
});
|
|
|
|
|
|
//确认提交事件,获取每个li的id
|
|
|
- $(document).on('click', '.my-btn-submit', function() {
|
|
|
- $("#sortable>li").each(function(){
|
|
|
- console.log($(this).attr("id"));
|
|
|
- });
|
|
|
- });
|
|
|
+// $(document).on('click', '.my-btn-submit', function() {
|
|
|
+// $("#sortable>li").each(function(){
|
|
|
+// console.log($(this).attr("id"));
|
|
|
+// });
|
|
|
+// });
|
|
|
</script>
|
|
|
</body>
|
|
|
</html>
|