浏览代码

Merge remote-tracking branch 'remotes/liujiankang/master'

# Conflicts:
#	watero-rst-interface/src/main/java/com/iamberry/rst/faces/pts/MachinePartsService.java
#	watero-rst-service/src/main/java/com/iamberry/rst/service/pts/MachinePartsServiceImpl.java
#	watero-rst-service/src/main/java/com/iamberry/rst/service/pts/mapper/MachinePartsMapper.java
#	watero-rst-service/src/main/java/com/iamberry/rst/service/pts/mapper/machinePartsMapper.xml
liujiankang 7 年之前
父节点
当前提交
d6832cc904

+ 10 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/pts/PtsComponents.java

@@ -41,6 +41,8 @@ public class PtsComponents implements Serializable {
 
     private Date componentsUpdateTime;//修改时间
 
+    private String supplierName;//供应商名
+
     public Integer getComponentsId() {
         return componentsId;
     }
@@ -168,4 +170,12 @@ public class PtsComponents implements Serializable {
     public void setComponentsUpdateTime(Date componentsUpdateTime) {
         this.componentsUpdateTime = componentsUpdateTime;
     }
+
+    public String getSupplierName() {
+        return supplierName;
+    }
+
+    public void setSupplierName(String supplierName) {
+        this.supplierName = supplierName;
+    }
 }

+ 15 - 1
watero-rst-interface/src/main/java/com/iamberry/rst/faces/pts/MachinePartsService.java

@@ -1,6 +1,8 @@
 package com.iamberry.rst.faces.pts;
 
 
+import com.iamberry.rst.core.page.PagedResult;
+import com.iamberry.rst.core.pts.PtsBom;
 import com.iamberry.rst.core.pts.PtsComponents;
 
 import java.util.List;
@@ -19,6 +21,18 @@ public interface MachinePartsService {
      * 查询单个机器零件信息
      * **/
     PtsComponents getmachineParts(PtsComponents ptsComponents);
-    //获取所有的零件
+    /**
+     * 获取所有的零件
+     * **/
     List<PtsComponents> listPtsComponents(PtsComponents ptsComponents);
+
+    /**
+     * 查询零件列表
+     * **/
+    PagedResult<PtsComponents> listPtsComponents(int pageNO, int pageSize, PtsComponents ptsComponents, boolean isTotalNum);
+
+    /**
+     * 修改机器零件
+     * **/
+    Integer updateParts(PtsComponents ptsComponents);
 }

+ 16 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/pts/MachinePartsServiceImpl.java

@@ -1,9 +1,13 @@
 package com.iamberry.rst.service.pts;
 
+import com.github.pagehelper.PageHelper;
+import com.iamberry.rst.core.page.PagedResult;
+import com.iamberry.rst.core.pts.PtsBom;
 import com.iamberry.rst.core.pts.PtsComponents;
 import com.iamberry.rst.faces.pts.MachinePartsService;
 import com.iamberry.rst.service.pts.mapper.MachineLogsMapper;
 import com.iamberry.rst.service.pts.mapper.MachinePartsMapper;
+import com.iamberry.rst.util.PageUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -31,4 +35,16 @@ public class MachinePartsServiceImpl implements MachinePartsService {
     public List<PtsComponents> listPtsComponents(PtsComponents ptsComponents){
         return machinePartsMapper.listPtsComponents(ptsComponents);
     }
+
+    @Override
+    public PagedResult<PtsComponents> listPtsComponents(int pageNO, int pageSize, PtsComponents ptsComponents, boolean isTotalNum) {
+        PageHelper.startPage(pageNO, pageSize, isTotalNum);
+        List<PtsComponents> list = machinePartsMapper.listPtsComponents(ptsComponents);
+        return PageUtil.getPage(list);
+    }
+
+    @Override
+    public Integer updateParts(PtsComponents ptsComponents) {
+        return machinePartsMapper.updateParts(ptsComponents);
+    }
 }

+ 7 - 1
watero-rst-service/src/main/java/com/iamberry/rst/service/pts/mapper/MachinePartsMapper.java

@@ -21,7 +21,13 @@ public interface MachinePartsMapper {
      * **/
     PtsComponents getmachineParts(PtsComponents ptsComponents);
 
-    //获取所有的零件
+    /**
+     * 获取所有的零件
+     * **/
     List<PtsComponents> listPtsComponents(PtsComponents ptsComponents);
 
+    /**
+     * 修改机器零件
+     * **/
+    Integer updateParts(PtsComponents ptsComponents);
 }

+ 68 - 5
watero-rst-service/src/main/java/com/iamberry/rst/service/pts/mapper/machinePartsMapper.xml

@@ -43,7 +43,10 @@
             </if>
             <if test="componentsNo != null and componentsNo != ''">
                 AND components_no = #{componentsNo}
-        </if>
+            </if>
+            <if test="componentsId != null and componentsId != ''">
+                AND components_id = #{componentsId}
+            </if>
         </where>
     </select>
     <select id="listPtsComponents" parameterType="PtsComponents" resultType="PtsComponents" >
@@ -63,16 +66,76 @@
             t.components_status AS componentsStatus,
             t.components_desc AS componentsDesc,
             t.components_create_time AS componentsCreateTime,
-            t.components_update_time AS componentsUpdateTime
+            t.components_update_time AS componentsUpdateTime,
+            s.supplier_name AS supplierName
         FROM
-            tb_rst_pts_components t
+            tb_rst_pts_components t LEFT JOIN tb_rst_pts_supplier s on t.supplier_id = s.supplier_id
         <where>
-            <if test="produceId !=null">
+            <if test="componentsType !=null and componentsType !='' ">
+                AND t.components_type = #{componentsType}
+            </if>
+            <if test="componentsNo !=null and componentsNo !='' ">
+                AND t.components_no = #{componentsNo}
+            </if>
+            <if test="produceId !=null and produceId !='' ">
                 AND t.produce_id = #{produceId}
             </if>
-            <if test="componentsStatus !=null">
+            <if test="componentsStatus !=null and componentsStatus !='' ">
                 AND t.components_status = #{componentsStatus}
             </if>
+            <if test="componentsName !=null and componentsName !='' ">
+                AND t.components_name = #{componentsName}
+            </if>
         </where>
     </select>
+
+    <update id="updateParts" parameterType="PtsComponents" >
+        UPDATE tb_rst_pts_components
+        <set>
+            <if test="supplierId != null and supplierId != ''" >
+                supplier_id = #{supplierId},
+            </if>
+            <if test="produceId != null and produceId != ''" >
+                produce_id = #{produceId},
+            </if>
+            <if test="componentsNo != null and componentsNo != ''" >
+                components_no = #{componentsNo},
+            </if>
+            <if test="componentsName != null and componentsName != ''" >
+                components_name = #{componentsName},
+            </if>
+            <if test="componentsType != null and componentsType != ''" >
+                components_type = #{componentsType},
+            </if>
+            <if test="componentsCost != null and componentsCost != ''" >
+                components_cost = #{componentsCost},
+            </if>
+            <if test="componentsWeight != null and componentsWeight != ''" >
+                components_weight = #{componentsWeight},
+            </if>
+            <if test="componentsMbsc != null and componentsMbsc != ''" >
+                components_mbsc = #{componentsMbsc},
+            </if>
+            <if test="componentsSpecification != null and componentsSpecification != ''" >
+                components_specification = #{componentsSpecification},
+            </if>
+            <if test="componentsImg != null and componentsImg != ''" >
+                components_img = #{componentsImg},
+            </if>
+            <if test="componentsStatus != null and componentsStatus != ''" >
+                components_status = #{componentsStatus},
+            </if>
+            <if test="componentsDesc != null and componentsDesc != ''" >
+                components_desc = #{componentsDesc},
+            </if>
+            <if test="componentsUpdateTime != null and componentsUpdateTime != ''" >
+                components_update_time = #{componentsUpdateTime}
+            </if>
+        </set>
+        <where>
+            <if test="componentsId != null and componentsId != ''">
+                components_id = #{componentsId}
+            </if>
+        </where>
+    </update>
 </mapper>

+ 88 - 1
watero-rst-web/src/main/java/com/iamberry/rst/controllers/pts/AdminMachinePartsController.java

@@ -1,16 +1,20 @@
 package com.iamberry.rst.controllers.pts;
 
+import com.iamberry.rst.core.page.PagedResult;
 import com.iamberry.rst.core.pts.Produce;
+import com.iamberry.rst.core.pts.PtsBom;
 import com.iamberry.rst.core.pts.PtsComponents;
 import com.iamberry.rst.core.pts.PtsSupplier;
 import com.iamberry.rst.faces.pts.MachinePartsService;
 import com.iamberry.rst.faces.pts.MachineSupplierService;
 import com.iamberry.rst.faces.pts.ProduceService;
+import com.iamberry.rst.utils.StitchAttrUtil;
 import com.iamberry.wechat.tools.ResponseJson;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 
@@ -60,7 +64,7 @@ public class AdminMachinePartsController {
         }
         PtsComponents components =  machinePartsService.getmachineParts(ptsComponents);
         if(components != null){
-            responseJson.setReturnCode(500);
+            responseJson.setReturnCode(501);
             return responseJson;
         }
         ptsComponents.setComponentsCost(ptsComponents.getComponentsCost() * 100);//元转换为分
@@ -73,4 +77,87 @@ public class AdminMachinePartsController {
         }
         return responseJson;
     }
+
+    /**
+     * 获取机器零件列表
+     *
+     * @param request
+     * @return
+     */
+    @RequiresPermissions("parts:select:list")
+    @RequestMapping("/_parts_list")
+    public ModelAndView getPtsBom(HttpServletRequest request,PtsComponents ptsComponents,
+                                  @RequestParam(value = "pageSize", defaultValue = "10", required = false) Integer pageSize,
+                                  @RequestParam(value = "pageNO", defaultValue = "1", required = false) Integer pageNO,
+                                  @RequestParam(value = "totalNum", defaultValue = "0", required = false) Integer totalNum) {
+        ModelAndView mv = new ModelAndView("pts/machinePtras/parts_list");
+        PagedResult<PtsComponents> pagedResult = machinePartsService.listPtsComponents(pageNO, pageSize, ptsComponents, totalNum == 0);
+        if (totalNum != 0){
+            pagedResult.setTotal(totalNum);
+        }
+
+        //获取产品集合,用于页面选择产品
+        List<Produce> list = produceService.getProduceList();
+        mv.addObject("produceList",list);
+
+        StitchAttrUtil.setModelAndView(ptsComponents, mv, "/admin/machineParts/_parts_list", pagedResult);
+        return mv;
+    }
+
+    /**
+     * 进入修改机器零件页面
+     * **/
+    @RequiresPermissions("machineParts:update:machineParts")
+    @RequestMapping("/_to_update_machineParts")
+    public ModelAndView toupdateMachineParts(HttpServletRequest request){
+        ModelAndView mv = new ModelAndView("pts/machinePtras/ptras_update");
+        String componentsId = request.getParameter("componentsId");
+        PtsComponents ptsComponents = new PtsComponents();
+        ptsComponents.setComponentsId(Integer.valueOf(componentsId));
+        ptsComponents = machinePartsService.getmachineParts(ptsComponents);
+        mv.addObject("ptsComponents", ptsComponents);
+        List<Produce> list = produceService.getProduceList();
+        mv.addObject("produceList", list);
+        List<PtsSupplier> listSupplier = machineSupplierService.listMachineSupplier();
+        mv.addObject("listSupplier", listSupplier);
+        return mv;
+    }
+
+    /**
+     * 修改机器零件
+     * **/
+    @ResponseBody
+    @RequiresPermissions("machineParts:update:machineParts")
+    @RequestMapping("/update_machineParts")
+    public ResponseJson updateMachineParts(HttpServletRequest request,PtsComponents ptsComponents){
+        ResponseJson responseJson = new ResponseJson();
+        if(ptsComponents == null){
+            responseJson.setReturnCode(500);
+            return responseJson;
+        }
+        Integer componentsId = ptsComponents.getComponentsId();
+        PtsComponents componentsByid = new PtsComponents();
+        componentsByid.setComponentsId(componentsId);
+        PtsComponents components =  machinePartsService.getmachineParts(componentsByid);
+        if(!components.getComponentsNo().equals(ptsComponents.getComponentsNo())  ||
+                components.getComponentsStatus() != ptsComponents.getComponentsStatus() ||
+                components.getProduceId() != components.getProduceId()){
+            ptsComponents.setComponentsId(null);
+            components =  machinePartsService.getmachineParts(ptsComponents);
+            if(components != null){
+                responseJson.setReturnCode(501);
+                return responseJson;
+            }
+        }
+        ptsComponents.setComponentsId(componentsId);
+        ptsComponents.setComponentsCost(ptsComponents.getComponentsCost() * 100);//元转换为分
+        ptsComponents.setComponentsCreateTime(new Date());
+        Integer msg =  machinePartsService.updateParts(ptsComponents);
+        if(msg > 0){
+            responseJson.setReturnCode(200);
+        }else{
+            responseJson.setReturnCode(500);
+        }
+        return responseJson;
+    }
 }

+ 147 - 0
watero-rst-web/src/main/webapp/WEB-INF/views/pts/machinePtras/parts_list.ftl

@@ -0,0 +1,147 @@
+<!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" />
+    <link rel="Bookmark" href="/favicon.ico" >
+    <link rel="Shortcut Icon" href="/favicon.ico" />
+<#include "/base/list_base.ftl">
+    <title>零件列表</title>
+    <style>
+        *{padding: 0;margin: 0;}
+        .my-input{border: 1px solid rgba(0,0,0,.1);padding: 1px 5px;height: 32px;margin-right: 10px;}
+        .my-input::-webkit-input-placeholder,.my-select{color: #dcdcdc;}
+        .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(/rst/common/images/pts/select-1.png) right center no-repeat;background-size:auto 100%;}
+        .my-btn-search{border: 1px solid #32a3d8;padding: 1px 25px;height: 32px;background-color: #32a3d8;color: #fff;}
+        .barcodeImg{margin:10px 0px}
+        .table-bg thead th{background-color: #e2f6ff;}
+        input[type=radio]{-webkit-appearance:none;appearance:none;background: url(/rst/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(/rst/common/images/pts/radio-2.png) center center no-repeat;background-size:auto 100%;width: 20px;height: 20px;margin-right: 10px;}
+    </style>
+</head>
+<body>
+<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
+    <span class="c-gray en">&gt;</span> 机器零件管理
+    <span class="c-gray en">&gt;</span> 零件列表
+    <a class="btn radius r" style="line-height:1.6em;margin-top:3px;background: #32a3d8;color: #fff;border:1px solid #32a3d8;" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
+</nav>
+<div class="page-container">
+    <div class="text-c">
+        <form action="${path}/admin/machineParts/_parts_list" method="post">
+            <button type="button" style="cursor:pointer; float: left;" class="my-btn-search" onclick="toAddParts();">添加机器零件</button>
+            <select class="my-select" name="produceId" style="height: 36px;width: 150px">
+                <option value ="">所有产品</option>
+                <#if produceList?? &&  (produceList?size > 0) >
+                    <#list produceList as produce>
+                        <option value ="${produce.produceId!}" <#if produceId??><#if produceId ==produce.produceId >selected="selected"</#if></#if>>${produce.produceName!}</option>
+                    </#list>
+                </#if>
+            </select>
+            <input type="text" class="my-input"  style="width:150px" value="${componentsNo!}" placeholder="零件编号" id="componentsNo" name="componentsNo">
+            <input type="text" class="my-input"  style="width:150px" value="${componentsName!}" placeholder="零件名称" id="componentsName" name="componentsName">
+            <button type="submit" class="btn" style="background: #32a3d8;color: #fff;-webkit-transform:translateY(-5%);" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
+        </form>
+    </div>
+
+    <div class="mt-20">
+        <table class="table table-border table-bordered table-bg table-hover table-sort">
+        <thead>
+        <tr class="text-c">
+            <th width="50">零件编号</th>
+            <th width="60">供应商</th>
+            <th width="100">零件名称</th>
+            <th width="80">图片</th>
+            <th width="80">状态</th>
+            <th width="100">成本</th>
+            <th width="80">重量</th>
+            <th width="80">材料</th>
+            <th width="80">材料类型</th>
+            <th width="80">MBSC</th>
+            <th width="80">规格</th>
+            <th width="80">备注</th>
+            <th width="80">操作</th>
+        </tr>
+        </thead>
+        <tbody>
+            <#if page.dataList?? &&  (page.dataList?size > 0) >
+                    <#list page.dataList as parts>
+                        <tr class="text-c">
+                            <td>${parts.componentsNo!''}</td>
+                            <td>${parts.supplierName!''}</td>
+                            <td>${parts.componentsName!''}</td>
+                            <td><img style="width: 50px;height: 50px;" src="${parts.componentsImg!''}"></td>
+                            <td>${parts.componentsStatus!''}</td>
+                            <td>${parts.componentsCost!''}</td>
+                            <td>${parts.componentsWeight/100!''}</td>
+                            <td>${parts.componentsMaterial!''}</td>
+                            <td><#if parts.componentsType == 1>塑胶件</#if>
+                                <#if parts.componentsType == 2>五金件</#if>
+                                <#if parts.componentsType == 3>其他</#if></td>
+                            <td>${parts.componentsMbsc!''}</td>
+                            <td>${parts.componentsSpecification!''}</td>
+                            <td>${parts.componentsDesc!''}</td>
+                            <td>
+                                <a style="text-decoration:none" href="javascript:void(0);" title="编辑" onclick="admin_update_parts(${parts.componentsId!''});">
+                                    <i class="Hui-iconfont">&#xe6df;</i>
+                                </a>
+                            </td>
+                        </tr>
+                    </#list>
+            <#else>
+                <tr><td colspan="9" class="td-manage text-c" >暂时没有零件,请添加!</td></tr>
+            </#if>
+        </tbody>
+    </table>
+    </div>
+</div>
+<tfoot>
+<#include "/base/page_util.ftl">
+</tfoot>
+<script type="text/javascript">
+
+
+    /*管理员-编辑*/
+    function parts_edit(title,url,id,w,h){
+        layer_show(title,url,w,h);
+    }
+
+    /* 修改二级菜单状态 */
+    function update_FAQState(detaId) {
+        layer.confirm('确认要停用吗?',function(index){
+            $.post(root_path + "/admin/faq/updat_FAQState",{detaId:detaId}, function(result){
+                if (result.returnCode != 200 || result.returnCode != 200) {
+                    layer.msg('修改失败,请重试!',{icon: 5,time:3000});
+                }else if(data.returnCode == 501){
+                    layer.msg('该零件已保存,不能重复!', {icon: 2, time: 2000});
+                } else {
+                    layer.msg('修改成功!',{icon: 1,time:2000}, function () {
+                        // 关闭当前页面,并刷新父级页面
+                        window.location.reload();
+                    });
+                }
+            });
+        });
+    }
+
+</script>
+<script>
+    /**
+     * 跳转到添加员工页面
+     */
+    function toAddParts(){
+        window.location.href= "${path}/admin/machineParts/_to_add_machineParts";
+    }
+
+    /**
+     *跳转到编辑页面
+     * @param employee
+     */
+    function admin_update_parts(componentsId) {
+        window.location.href= "${path}/admin/machineParts/_to_update_machineParts?componentsId="+componentsId;
+    }
+</script>
+</body>
+</html>

+ 1 - 2
watero-rst-web/src/main/webapp/WEB-INF/views/pts/machinePtras/ptras_add.ftl

@@ -239,10 +239,9 @@
                 url: "${path}/admin/machineParts/add_machineParts",
                 async: false,
                 success: function(data){
-                    alert(data.returnCode);
                     if (data.returnCode == 200) {
                         layer.msg('添加成功!', {icon: 1, time: 2000});
-
+                        window.location.href = '${path}/admin/machineParts/_parts_list'
                     }else{
                         layer.msg('添加失败!', {icon: 2, time: 2000});
                     }

+ 263 - 0
watero-rst-web/src/main/webapp/WEB-INF/views/pts/machinePtras/ptras_update.ftl

@@ -0,0 +1,263 @@
+<!--_meta 作为公共模版分离出去-->
+<!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" />
+<link rel="Bookmark" href="/favicon.ico" >
+<link rel="Shortcut Icon" href="/favicon.ico" />
+<#include "/base/add_base.ftl">
+    <link href="${path }/common/kingedit/themes/default/default.css" rel="stylesheet" type="text/css" />
+<title>修改机器零件</title>
+</head>
+<body>
+<article class="page-container">
+	<form action="" method="post" class="form form-horizontal" id="form-parts-update">
+
+        <div class="row cl">
+            <label class="form-label col-xs-4 col-sm-3">所属机器:</label>
+            <div class="formControls col-xs-8 col-sm-9"> <span class="select-box">
+				<select class="select" size="1" name="produceId" id="produceId">
+                <#if (produceList ?size > 0)>
+                    <#list produceList as list>
+                        <option value ="${list.produceId}" <#if ptsComponents.produceId == list.produceId>selected</#if>>${list.produceName}</option>
+                    </#list>
+                <#else >
+                    <option value ="">暂无产品,请到生产产品列表添加产品</option>
+                </#if>
+				</select>
+				</span> </div>
+        </div>
+
+		<div class="row cl">
+			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>零件编号:</label>
+			<div class="formControls col-xs-8 col-sm-9">
+				<input type="text" class="input-text" value="${ptsComponents.componentsNo!''}"   id="componentsNo" name="componentsNo" placeholder="请输入零件编号,支持数字、字母组合">
+			</div>
+		</div>
+        <div class="row cl">
+            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>零件名称:</label>
+            <div class="formControls col-xs-8 col-sm-9">
+                <input type="text" class="input-text" value="${ptsComponents.componentsName!''}"  id="componentsName" name="componentsName" placeholder="请输入1-30位的名称,支持中文、字母、数字">
+            </div>
+        </div>
+
+        <div class="row cl">
+            <label class="form-label col-xs-4 col-sm-3">供应商:</label>
+            <div class="formControls col-xs-8 col-sm-9"> <span class="select-box">
+				<select class="select" size="1" name="supplierId" id="supplierId">
+                <#if (listSupplier ?size > 0)>
+                    <#list listSupplier as list>
+                        <option value ="${list.supplierId}"<#if ptsComponents.supplierId == list.supplierId>selected</#if>>${list.supplierName}</option>
+                    </#list>
+                <#else >
+                    <option value ="">暂无供应商,请到供应商列表添加供应商</option>
+                </#if>
+				</select>
+				</span> </div>
+        </div>
+        <div class="row cl">
+            <label class="form-label col-xs-4 col-sm-3">零件图片:</label>
+            <div class="formControls col-xs-8 col-sm-9">
+                <img alt="介绍图" src="${ptsComponents.componentsImg!''}" id="partsImg" width="90" height="80">
+                <input type="hidden" id="componentsImg" name="componentsImg" value="${ptsComponents.componentsImg!''}"/>
+			</div>
+        </div>
+
+		<div class="row cl">
+			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>零件状态:</label>
+			<div class="formControls col-xs-8 col-sm-9 skin-minimal">
+				<div class="radio-box">
+					<input name="componentsStatus" type="radio" value="0" id="sex-1" <#if ptsComponents.componentsStatus == 0>checked</#if>>
+					<label for="sex-1">停止使用</label>
+				</div>
+				<div class="radio-box">
+					<input type="radio" id="sex-2" value="1" name="componentsStatus" <#if ptsComponents.componentsStatus == 1>checked</#if>>
+					<label for="sex-2">正常使用</label>
+				</div>
+			</div>
+		</div>
+
+        <div class="row cl">
+            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>零件成本:</label>
+            <div class="formControls col-xs-8 col-sm-9">
+                <input type="text" class="input-text" value="${ptsComponents.componentsCost!''}"  id="componentsCost" name="componentsCost" placeholder="请输入零件成本,单位为元">
+            </div>
+        </div>
+        <div class="row cl">
+            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>零件重量:</label>
+            <div class="formControls col-xs-8 col-sm-9">
+                <input type="text" class="input-text" value="${ptsComponents.componentsWeight!''}"  id="componentsWeight" name="componentsWeight" placeholder="请输入零件重量,单位为克">
+            </div>
+        </div>
+        <div class="row cl">
+            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>零件材料:</label>
+            <div class="formControls col-xs-8 col-sm-9">
+                <input type="text" class="input-text" value="${ptsComponents.componentsMaterial!''}" id="componentsMaterial" name="componentsMaterial" placeholder="请输入1-30位的材料,支持中文、字母、数字">
+            </div>
+        </div>
+        <div class="row cl">
+            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>材料类型:</label>
+            <div class="formControls col-xs-8 col-sm-9">
+                <select class="select" size="1" name="componentsType" id="componentsType">
+                    <option value ="1"<#if ptsComponents.componentsType == 1>selected</#if>>塑胶件</option>
+                    <option value ="2"<#if ptsComponents.componentsType == 2>selected</#if>>五金件</option>
+                    <option value ="3"<#if ptsComponents.componentsType == 3>selected</#if>>其他</option>
+                </select>
+            </div>
+        </div>
+        <div class="row cl">
+            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>MBSC:</label>
+            <div class="formControls col-xs-8 col-sm-9">
+                <input type="text" class="input-text" value="${ptsComponents.componentsMbsc!''}"  id="componentsMbsc" name="componentsMbsc" placeholder="请输入MBSC">
+            </div>
+        </div>
+        <div class="row cl">
+            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>规格:</label>
+            <div class="formControls col-xs-8 col-sm-9">
+                <input type="text" class="input-text" value="${ptsComponents.componentsSpecification!''}" id="componentsSpecification" name="componentsSpecification" placeholder="请输入材料规格(允许为空)">
+            </div>
+        </div>
+        <div class="row cl">
+            <label class="form-label col-xs-4 col-sm-3">备注:</label>
+            <div class="formControls col-xs-8 col-sm-9">
+                <textarea name="componentsDesc" id="componentsDesc" cols="" rows="" class="textarea"  placeholder="请输入零件的备注(允许为空)" onKeyUp="$.Huitextarealength(this,100)">${ptsComponents.componentsDesc!''}</textarea>
+                <p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
+            </div>
+        </div>
+        <div class="row cl">
+            <label class="form-label col-xs-4 col-sm-3"></label>
+        	<span class="c-red">*提示</span><span>:新增的零件,如果在机器生产有使用,请更新Bom单。</span>
+        </div>
+		<div class="row cl">
+			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
+                <input type="hidden" value="${ptsComponents.componentsId!''}" name="componentsId">
+				<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
+			</div>
+		</div>
+	</form>
+</article>
+<script type="text/javascript" src="${path}/common/kingedit/kindeditor.js"></script>
+<script type="text/javascript" src="${path}/common/kingedit/lang/zh_CN.js"></script>
+<script type="text/javascript">
+
+    KindEditor.ready(function(K) {
+        var editor = K.editor({
+            fileManagerJson : '${path}/common/kingedit/jsp/file_manager_json.jsp',
+            uploadJson : '${path}/common/kingedit/jsp/upload_json.jsp',
+            allowFileManager : true
+        });
+        K('#partsImg').click(function() {
+            var imgid = $(this).attr("id");//获取当前ID
+            editor.loadPlugin('image', function() {
+                editor.plugin.imageDialog({
+                    showRemote : false,
+                    imageUrl : K('#componentsImg').val(),
+                    clickFn : function(url, title, width, height, border, align) {
+                        K('#partsImg').attr("src",url);
+                        K('#componentsImg').val(url);
+                        editor.hideDialog();
+                        return false;
+                    }
+                });
+            });
+        });
+    });
+
+        $(function(){
+	$('.skin-minimal input').iCheck({
+		checkboxClass: 'icheckbox-blue',
+		radioClass: 'iradio-blue',
+		increaseArea: '20%'
+	});
+	
+	$("#form-parts-update").validate({
+		rules:{
+            produceId:{
+                required:true
+            },
+            componentsNo:{
+				required:true,
+				minlength:2,
+				maxlength:11
+			},
+            componentsName:{
+				required:true,
+                minlength:2,
+                maxlength:30
+			},
+            componentsCost:{
+				required:true,
+                minlength:1,
+                maxlength:11
+			},
+            componentsWeight:{
+                required:true,
+                minlength:1,
+                maxlength:11
+            },
+            componentsMaterial:{
+                required:true,
+                minlength:1,
+                maxlength:30
+            },
+            componentsMbsc:{
+                required:true,
+                minlength:1,
+                maxlength:1
+            },
+            componentsSpecification:{
+                required:true,
+                minlength:1,
+                maxlength:50
+            },
+            componentsImg:{
+                required:true,
+                minlength:1,
+                maxlength:100
+            },
+            componentsDesc:{
+                minlength:1,
+                maxlength:100
+            }
+		},
+		onkeyup:false,
+		focusCleanup:true,
+		success:"valid",
+		submitHandler:function(form){
+
+			//$(form).ajaxSubmit();
+            //var index = parent.layer.getFrameIndex(window.name);
+			//parent.$('.btn-refresh').click();
+            //parent.layer.close(index);
+            $.ajax({
+                cache: true,
+                type: "POST",
+                data: $("#form-parts-update").serialize(),
+                url: "${path}/admin/machineParts/update_machineParts",
+                async: false,
+                success: function(data){
+                    if (data.returnCode == 200) {
+                        layer.msg('修改成功!', {icon: 1, time: 2000});
+                        window.location.href = '${path}/admin/machineParts/_parts_list'
+                    }else if(data.returnCode == 501){
+                        layer.msg('该零件已保存,不能重复!', {icon: 2, time: 2000});
+                    }else{
+                        layer.msg('修改失败!', {icon: 2, time: 2000});
+                    }
+                },
+                error: function(XmlHttpRequest, textStatus, errorThrown){
+                    layer.msg('修改失败!', {icon: 2, time: 2000});
+                }
+            });
+
+		}
+	});
+});
+</script> 
+<!--/请在上方写此页面业务相关的脚本-->
+</body>
+</html>