123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360 |
- <!DOCTYPE HTML>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="renderer" content="webkit|ie-comp|ie-stand">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
- <meta http-equiv="Cache-Control" content="no-siteapp" />
- <#include "/base/add_base.ftl">
- <link href="${path}/common/lib/jquery.ui/jquery-ui.css" rel="stylesheet" type="text/css" />
- <style>
- .my-title{font-weight: 500;padding-left: 15px;position: relative;}
- .my-title:after{content: '';position: absolute;left: 0;top:12%;width: 3px;height: 80%;background: #32a3d8;}
- .my-input{padding: 5px 10px;width: 80%;border:1px solid rgba(0,0,0,.1)}
- .input-box{margin: 18px 0;}
- .input-dic{float: left;margin:5px 10px 0 0;font-size: 12px;}
- .add-list{list-style-type: none;padding: 10px;background-color: #f5f5f5;width: 60%;float: left;margin: 0;}
- .my-btn-edit{padding: 6px 20px;background-color: #fff;color: #32a3d8;border: 1px solid #32a3d8;cursor:pointer;margin: 0 10px;}
- .my-btn-reset{padding: 6px 20px;width: 150px; background-color: #fff;color: #32a3d8;border: 1px solid #32a3d8;cursor:pointer;margin: 10px 10px 0 10px;}
- .my-btn-submit{padding: 6px 20px;width: 150px; background-color: #32a3d8;color: #fff;border: 1px solid #32a3d8;cursor:pointer;margin: 10px 10px 0 10px;}
- .add-list>li{margin: 10px 0;}
- .cp-list{list-style-type: none;margin: 0;padding: 0;}
- .cp-list>li{position: relative; cursor: pointer;clear: both;padding: 15px 0;}
- .my-select{border: 1px solid rgba(0,0,0,.1);padding:6px 50px 6px 15px;height: 34px;margin: 0 10px; -webkit-appearance:none;appearance:none;background: url(${path}/common/images/pts/select-1.png) right center no-repeat;background-size:auto 100%;}
- input[type=radio]{-webkit-appearance:none;appearance:none;background: url(${path}/common/images/pts/radio-1.png) center center no-repeat;background-size:auto 100%;width: 20px;height: 20px;margin-right: 10px;}
- input[type=radio]:checked{-webkit-appearance:none;appearance:none;background: url(${path}/common/images/pts/radio-2.png) center center no-repeat;background-size:auto 100%;width: 20px;height: 20px;margin-right: 10px;}
- select{border: 1px solid rgba(0,0,0,.1);border-radius: 5px;padding:6px 35px 6px 5px;height: 32px;-webkit-appearance:none;appearance:none;background: url(${path}/common/images/pts/select-1.png) right center no-repeat !important;background-size:auto 100% !important;margin-right: 10px;width: 85px;}
- </style>
- <title>修改生产产品- 生产产品管理 - RST</title>
- </head>
- <body>
- <nav class="breadcrumb"><i class="Hui-iconfont"></i> 首页
- <span class="c-gray en">></span> 产品管理
- <span class="c-gray en">></span> 修改产品
- <a class="btn radius r" style="line-height:1.6em;margin-top:3px;background: #58d2ea;color: #fff;" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont"></i></a>
- </nav>
- <form class="form form-horizontal" id="form-admin-addProduce">
- <article class="page-container" style="padding-bottom: 80px;">
- <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="请输入产品名称,2-20位字符" 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="请输入产品描述,2-100位字符" maxlength="100" required /> </div>
- <div class="input-box "><span class="input-dic">产品特性</span>
- <select class="" style="width: 290px;" id="produceFeature" name="produceFeature">
- <option value ="A" <#if produce.produceFeature??><#if produce.produceFeature == 'A'>selected="selected"</#if></#if>>国内(A)</option>
- <option value ="B" <#if produce.produceFeature??><#if produce.produceFeature == 'B'>selected="selected"</#if></#if>>美国(B)</option>
- <option value ="C" <#if produce.produceFeature??><#if produce.produceFeature == 'C'>selected="selected"</#if></#if>>欧洲(C)</option>
- <option value ="D" <#if produce.produceFeature??><#if produce.produceFeature == 'D'>selected="selected"</#if></#if>>其他(D)</option>
- </select>
- </div>
- <div class="input-box"><span class="input-dic">产品型号</span><input class="my-input" style="width: 120px;" type="text" name="producePattern" id="producePattern" placeholder="1-3位英文、数字组合" value="${produce.producePattern!}" placeholder="" required maxlength="3" minlength="1"/>-
- <input class="my-input" style="width: 120px;" type="text" name="produceModel" id="produceModel" value="${produce.produceModel!}" placeholder="1-3位英文、数字组合" required maxlength="3" minlength="1"/> </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 class="input-box"><span class="input-dic">产品状态</span>
- <label><input type="radio" name="produceStatus" value="1" <#if produce.produceStatus == 1>checked</#if>>正在使用</label>
- <label><input type="radio" name="produceStatus" value="0" <#if produce.produceStatus == 0>checked</#if>>停止使用</label>
- </div>
- <div style="background-color:rgba(0,0,0,.1);height: 1px;margin: 15px 0;width: 93%;"></div>
- <div class="my-title">节点信息</div>
- <ul class="cp-list onrTheProcess" id="sortable">
- <#list produce.process as process>
- <li id="${process_index + 1}" class="processList">
- <input type="hidden" name="processId" value="${process.processId!}">
- <input type="hidden" class="processNumber" value="${process_index + 1}">
- <div class="input-box"><span class="input-dic process-type">节点类型</span>
- <label><input type="radio" name="processType_p${process_index + 1}" value="1" <#if process.processType == 1>checked</#if>>生产工序</label>
- <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="请输入节点名称,2-20位字符" maxlength="20" required/> </div>
- <div class="input-box"><span class="input-dic">节点操作</span>
- <ul class="add-list oneTheNode" >
- <#list process.nodes as nodes>
- <li class="nodeList">
- <input type="hidden" name="nodeId" value="${nodes.nodeId!}">
- <#--<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-20位字符" maxlength="20" minlength="2" required/>
- <i class="Hui-iconfont" onclick="delNode(this)"></i>
- </li>
- </#list>
- <li>
- <button type="button" class="my-btn-edit" onclick="addProNode(this)">增加节点操作</button>
- </li>
- </ul>
- </div>
- </li>
- </#list>
- </ul>
- <div style="clear: both;"></div>
- <div style="padding-top: 15px;"><button type="button" class="my-btn-edit" onclick="addProcess(this)">增加节点</button></div>
- </div>
- </article>
- <div style="width: 100%;height: 80px;position: fixed;bottom: 0px;background: #f5f5f5;text-align: center;">
- <span style="color: red; margin: 10px;display: block;margin: 0 auto;width:700px;padding-top: 5px;">*说明:如果机器正在生产,请不要修改,待生成完成以后修改;如果信息有误,请联系深圳技术部协助处理。</span>
- <div><button type="submit" class="my-btn-submit">确认提交</button></div>
- </div>
- </form>
- <#--<script type="text/javascript" src="${path}/common/lib/ueditor/1.4.3/ueditor.config.js"></script>-->
- <#--<script type="text/javascript" src="${path}/common/lib/ueditor/1.4.3/ueditor.all.js"></script>-->
- <script type="text/javascript" src="${path}/common/lib/jquery.ui/jquery-ui.js"></script>
- <script type="text/javascript">
- var check_name = /^[a-zA-Z0-9\u4e00-\u9fa5,.!;,。!;:“”\\"\\ ]+$/;
- var cnen_name = /^[a-zA-Z0-9\u4e00-\u9fa5]+$/;
- var en_name = /^[a-zA-Z0-9]+$/;
- var delProcessIds="",delNodeIds="";
- $(function(){
- //var validator = $("#signupForm").validate();
- $("#form-admin-addProduce").submit(function(){
- var produceName = $("#produceName").val();
- // if(!(cnen_name.test(produceName))){
- // layer.msg('产品名称输入格式不正确', {icon: 5, time: 1000});
- // return false;
- // }
- var produceRemake = $("#produceRemake").val();
- // if(!(cnen_name.test(produceRemake))){
- // layer.msg('产品描述输入格式不正确', {icon: 5, time: 1000});
- // return false;
- // }
- var producePattern = $("#producePattern").val();
- if(!(en_name.test(producePattern))){
- layer.msg('产品型号输入格式不正确', {icon: 5, time: 1000});
- return false;
- }
- var produceModel = $("#produceModel").val();
- if(!(en_name.test(produceModel))){
- layer.msg('产品型号输入格式不正确', {icon: 5, time: 1000});
- return false;
- }
- var flag = true;
- // $("input[name='processName']").each(function () {
- // if( !(cnen_name.test($(this).val())) ){
- // layer.msg('节点名称输入格式不正确', {icon: 5, time: 1000});
- // flag = false;
- // }
- // })
- // if(!flag)
- // return false;
- // $("input[name='nodeDes']").each(function () {
- // if( !(check_name.test($(this).val())) ){
- // layer.msg('节点操作描述输入格式不正确', {icon: 5, time: 1000});
- // flag = false;
- // }
- // })
- // if(!flag)
- // return false;
- layer.confirm('您确定要修改产品信息吗?', {
- btn: ['确定','取消'] //按钮
- }, function(){
- ajaxReq();
- }, function(){
- layer.closeAll('dialog');
- return false;
- });
- return false;
- })
- })
- 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() {
- var produce = {};
- var oneTheProcess = $(".onrTheProcess").find(".processList");
- var proessList = new Array();
- oneTheProcess.each(function(){
- var produceProcess = {};
- produceProcess.processName = $(this).find("[name='processName']").val(); //获取工序名称
- var processNumber = $(this).find(".processNumber").val();
- var processTypeName = "processType_p"+processNumber; //获取工序类型名称
- produceProcess.processType = $("input[name="+ processTypeName +"]:checked").val(); //获取工序类型
- produceProcess.processId = getDelId($(this),"processId"); //获取工序id
- var nodeList = new Array();
- var j=1;
- $(this).find(".oneTheNode").find(".nodeList").each(function(){
- var processNode = {};
- processNode.nodeDes = $(this).find("[name='nodeDes']").val(); //获取节点描述
- processNode.nodeId = getDelId($(this),"nodeId"); //获取节点操作id
- var nodeStatusName = "nodeStatus_p"+processNumber+"_n" +j;
- processNode.nodeStatus = $("input[name="+ nodeStatusName +"]:checked").val(); //获取节点状态
- nodeList.push(processNode);
- j++;
- })
- produceProcess.json = JSON.stringify(nodeList); //将node变成json存入到工序对象中
- //produceProcess.nodes = nodeList;
- proessList.push(produceProcess);
- })
- produce.json = JSON.stringify(proessList); //将工序变成json存入到产品对象中
- produce.produceId = $("[name='produceId']").val();//获取产品id
- produce.produceName = $("[name='produceName']").val();//获取产品名称
- produce.produceRemake = $("[name='produceRemake']").val();//获取产品描述
- produce.produceType = $("[name='produceType']:checked").val();//获取产品类型
- produce.produceStatus = $("[name='produceStatus']:checked").val();//获取产品状态
- produce.produceFeature = $("[name='produceFeature']").val();//获取产品特性
- produce.producePattern = $("[name='producePattern']").val();//产品型号
- produce.produceModel = $("[name='produceModel']").val();//产品型号
- produce.delProcessIds = delProcessIds; //需要删除的工序id
- produce.delNodeIds = delNodeIds; //需要删除的节点操作id
- return produce;
- }
- /**
- * 获取id
- */
- function getDelId(node,delIdName){
- var delId = $(node).find("[name='"+ delIdName +"']").val();
- if(delId == null || delId == "" || typeof(delId)=="undefined" || delId == undefined ){
- delId = 0;
- }
- return delId;
- }
- /**
- * 增加节点操作方法
- */
- function addProNode(node){
- var processNumber = $(node).parents(".processList").find(".processNumber").val(); //获取当前的节点标识
- 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" 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-20位字符" maxlength="20" minlength="2" required/> '
- +'<i class="Hui-iconfont" onclick="delNode(this)"></i>'
- +'</li>';
- $(node).parent().before(nodeHtml);
- }
- /**
- * 增加工序节点
- * @param node
- */
- function addProcess(node) {
- 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" 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="请输入节点名称,2-20位字符" 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" 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-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>'
- + '</ul>'
- + '</div>'
- + '</li>';
- $(".onrTheProcess").append(processHtml);
- }
- /**
- * 删除工序节点
- * @param node
- */
- function delProcess(node) {
- var processNumber = $(node).parents(".onrTheProcess").find(".processList").length;
- if(parseInt(processNumber) < 2){
- layer.msg('至少要有一个节点!',{icon: 5,time:3000});
- }else{
- var processId = $(node).parents(".processList").find("[name='processId']").val();
- if(processId != null && processId != "" && typeof(processId)!="undefined"){
- delProcessIds += processId+",";
- }
- $(node).parents(".processList").find("[name='nodeId']").each(function(){
- var nodeId = $(this).val();
- if(nodeId != null && nodeId != "" && typeof(nodeId)!="undefined"){
- delNodeIds += nodeId +",";
- }
- });
- $(node).parents(".processList").remove();
- }
- }
- /**
- * 删除节点操作
- * @param node
- */
- function delNode(node){
- var nodesNumber = $(node).parents(".oneTheNode").find(".nodeList").length;
- if(parseInt(nodesNumber) < 2){
- layer.msg('至少要有一个节点操作!',{icon: 5,time:3000});
- }else{
- var nodeId = $(node).parents(".nodeList").find("[name='nodeId']").val();
- if(nodeId != null && nodeId != "" && typeof(nodeId)!="undefined"){
- delNodeIds += nodeId +",";
- }
- $(node).parents(".nodeList").remove();
- }
- }
- </script>
- <script>
- $(function() {
- //在ajax拉取数据append()之后再初始化拖拽排序
- $( "#sortable" ).sortable({
- revert: true,
- containment: "parent"
- });
- $( "ul, li" ).disableSelection();
- });
- // //确认提交事件,获取每个li的id
- // $(document).on('click', '.my-btn-submit', function() {
- // $("#sortable>li").each(function(){
- // console.log($(this).attr("id"));
- // });
- // });
- </script>
- </body>
- </html>
|