|
@@ -31,8 +31,12 @@
|
|
|
<div style="padding: 10px;width: 600px;margin: 0 auto;" class="">
|
|
|
<div class="my-title">产品信息</div>
|
|
|
<input type="hidden" name="produceId" value="${produce.produceId!}">
|
|
|
- <div class="input-box"><span class="input-dic">产品名称</span><input class="my-input" name="produceName" type="text" value="${produce.produceName!}" placeholder="请输入产品名称"/> </div>
|
|
|
- <div class="input-box"><span class="input-dic">产品描述</span><input class="my-input" type="text" name="produceRemake" value="${produce.produceRemake!}" placeholder="请输入产品描述"/> </div>
|
|
|
+ <div class="input-box"><span class="input-dic">产品名称</span><input class="my-input" name="produceName" type="text" value="${produce.produceName!}" placeholder="请输入产品名称" maxlength="20" required /> </div>
|
|
|
+ <div class="input-box"><span class="input-dic">产品描述</span><input class="my-input" type="text" name="produceRemake" value="${produce.produceRemake!}" placeholder="请输入产品描述" maxlength="100" required /> </div>
|
|
|
+ <div class="input-box"><span class="input-dic">产品类型</span>
|
|
|
+ <label><input type="radio" name="produceType" value="1" <#if produce.produceType == 1>checked</#if>>净水机</label>
|
|
|
+ <label><input type="radio" name="produceType" value="2" <#if produce.produceType == 2>checked</#if>>冲奶机</label>
|
|
|
+ </div>
|
|
|
<div style="background-color:rgba(0,0,0,.1);height: 1px;margin: 15px 0;"></div>
|
|
|
<div class="my-title">节点信息</div>
|
|
|
|
|
@@ -47,7 +51,7 @@
|
|
|
<label><input type="radio" name="processType_p${process_index + 1}" value="2" <#if process.processType == 2>checked</#if>>修理工序</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="${process.processName!}" placeholder="请输入节点名称"/> </div>
|
|
|
+ <div class="input-box"><span class="input-dic">节点名称</span><input class="my-input" name="processName" type="text" value="${process.processName!}" placeholder="请输入节点名称" maxlength="20" required/> </div>
|
|
|
<div class="input-box"><span class="input-dic">节点操作</span>
|
|
|
<ul class="add-list oneTheNode" >
|
|
|
<#list process.nodes as nodes>
|
|
@@ -56,7 +60,7 @@
|
|
|
<#--<select class="my-select"><option>1</option></select>-->
|
|
|
<label><input type="radio" name="nodeStatus_p${process_index + 1}_n${nodes_index + 1}" value="1" <#if nodes.nodeStatus == 1>checked</#if>>正常</label>
|
|
|
<label><input type="radio" name="nodeStatus_p${process_index + 1}_n${nodes_index + 1}" value="0" <#if nodes.nodeStatus == 0>checked</#if>>异常</label>
|
|
|
- <input class="my-input" name="nodeDes" type="text" value="${nodes.nodeDes!}" placeholder="请输入节点操作描述,2-10位中文" maxlength="10"/>
|
|
|
+ <input class="my-input" name="nodeDes" type="text" value="${nodes.nodeDes!}" placeholder="请输入节点操作描述,2-20位中文" maxlength="20" minlength="2" required/>
|
|
|
<i class="Hui-iconfont" onclick="delNode(this)"></i>
|
|
|
</li>
|
|
|
</#list>
|
|
@@ -87,11 +91,11 @@
|
|
|
var delProcessIds="",delNodeIds="";
|
|
|
|
|
|
//动态显示隐藏所属菜单
|
|
|
- $(document).on('click', '.menuSubid input[type=radio]', function() {
|
|
|
- isSelectShow($(this).val())
|
|
|
- })
|
|
|
+// $(document).on('click', '.menuSubid input[type=radio]', function() {
|
|
|
+// isSelectShow($(this).val())
|
|
|
+// })
|
|
|
|
|
|
- $(function(){
|
|
|
+ /* $(function(){
|
|
|
$("#form-admin-addProduce").validate({
|
|
|
rules:{
|
|
|
subName:{
|
|
@@ -110,13 +114,45 @@
|
|
|
} 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 = $("#signupForm").validate();
|
|
|
+ $("#form-admin-addProduce").submit(function(){
|
|
|
+ ajaxReq();
|
|
|
+ })
|
|
|
+// jQuery.validator.addMethod("processName", function(value, element) {
|
|
|
+// var mobile = /[^\w\u4e00-\u9fa5]/;
|
|
|
+// return this.optional(element) || (mobile.test(value));
|
|
|
+// }, "请正确填写您的手机号码");
|
|
|
+ })
|
|
|
+
|
|
|
+ function ajaxReq(){
|
|
|
+ var data = formatJSON();
|
|
|
+ $.ajax({
|
|
|
+ cache: true,
|
|
|
+ type: "POST",
|
|
|
+ data: data,
|
|
|
+ url: "${path}/admin/produce/update_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() {
|
|
@@ -152,6 +188,7 @@
|
|
|
produce.produceId = $("[name='produceId']").val();//获取产品id
|
|
|
produce.produceName = $("[name='produceName']").val();//获取产品名称
|
|
|
produce.produceRemake = $("[name='produceRemake']").val();//获取产品描述
|
|
|
+ produce.produceType = $("[name='produceType']").val();//获取产品描述
|
|
|
|
|
|
produce.delProcessIds = delProcessIds; //需要删除的工序id
|
|
|
produce.delNodeIds = delNodeIds; //需要删除的节点操作id
|
|
@@ -180,7 +217,7 @@
|
|
|
//+'<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="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位中文" maxlength="20" minlength="2" required/> '
|
|
|
+'<i class="Hui-iconfont" onclick="delNode(this)"></i>'
|
|
|
+'</li>';
|
|
|
$(node).parent().before(nodeHtml);
|
|
@@ -198,14 +235,14 @@
|
|
|
+ '<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="请输入节点名称" maxlength="20" required/> </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="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位中文" maxlength="20" minlength="2" required/> '
|
|
|
+ '<i class="Hui-iconfont" onclick="delNode(this)"></i>'
|
|
|
+ '</li>'
|
|
|
+ '<li><button type="button" class="my-btn-edit" onclick="addProNode(this)">增加节点操作</button></li>'
|
|
@@ -225,8 +262,13 @@
|
|
|
if(parseInt(processNumber) < 2){
|
|
|
layer.msg('至少要有一个节点!',{icon: 5,time:3000});
|
|
|
}else{
|
|
|
+ var processId = $(node).parents(".processList").find("[name='processId']").val();
|
|
|
+ delProcessIds += processId+",";
|
|
|
+ $(node).parents(".processList").find("[name='nodeId']").each(function(){
|
|
|
+ delNodeIds += $(this).val()+",";
|
|
|
+ });
|
|
|
+
|
|
|
$(node).parents(".processList").remove();
|
|
|
- //delProcessIds += delProcessIds+",";
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -239,6 +281,8 @@
|
|
|
if(parseInt(nodesNumber) < 2){
|
|
|
layer.msg('至少要有一个节点操作!',{icon: 5,time:3000});
|
|
|
}else{
|
|
|
+ var nodeId = $(node).parents(".nodeList").find("[name='nodeId']").val();
|
|
|
+ delNodeIds += nodeId + ",";
|
|
|
$(node).parents(".nodeList").remove();
|
|
|
}
|
|
|
}
|
|
@@ -255,11 +299,11 @@
|
|
|
|
|
|
});
|
|
|
|
|
|
- //确认提交事件,获取每个li的id
|
|
|
- $(document).on('click', '.my-btn-submit', function() {
|
|
|
- $("#sortable>li").each(function(){
|
|
|
- console.log($(this).attr("id"));
|
|
|
- });
|
|
|
+// //确认提交事件,获取每个li的id
|
|
|
+// $(document).on('click', '.my-btn-submit', function() {
|
|
|
+// $("#sortable>li").each(function(){
|
|
|
+// console.log($(this).attr("id"));
|
|
|
+// });
|
|
|
});
|
|
|
</script>
|
|
|
</body>
|