123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394 |
- <!--_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>
- <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"
- href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont"></i></a>
- </nav>
- <article class="page-container" style="padding: 10px;width: 600px;margin: 0 auto;">
- <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"><span class="c-red">*</span>所属机器:</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>-->
- <input type="hidden" value="${ptsComponents.produceId!''}" name="produceId" id="produceId">
- <input type="hidden" value="${ptsComponents.produceId!''}" name="oldProduceId" id="oldProduceId">
- <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 ="4"<#if ptsComponents.componentsType == 4>selected</#if>>电子类</option>
- <option value ="5"<#if ptsComponents.componentsType == 5>selected</#if>>线材</option>
- <option value ="6"<#if ptsComponents.componentsType == 6>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>零件编号:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <span style="height: 30px; width: 10%;float: left;line-height: 30px;">
- <span id="comType"><#if ptsComponents.componentsType == 1>110</#if><#if ptsComponents.componentsType == 2>220</#if><#if ptsComponents.componentsType == 4>330</#if><#if ptsComponents.componentsType == 5>440</#if><#if ptsComponents.componentsType == 6>550</#if><#if ptsComponents.componentsType == 3>660</#if></span>
- <span> - </span>
- </span>
- <input type="text" class="input-text" style="float: left;width: 90%;" value="${ptsComponents.componentsNo!''}" id="comPontNo" name="comPontNo" placeholder="请输入零件编号,支持数字、字母组合" onkeyup="this.value=this.value.replace(/[^u4e00-u9fa5w]/g,'')">
- <input type="hidden" class="input-text" style="" value="" id="componentsNo" name="componentsNo" >
- <input type="hidden" class="input-text" style="" value="${ptsComponents.serialNumber!''}" id="serialNumber" name="serialNumber" >
- <span style="display: block;padding-top: 35px;color: #e00;">零件编号后四位流水号,系统自动生成</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.componentsName!''}" id="componentsName" name="componentsName" 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"> <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" id="fileDiv">
- <input type="file" name="file" id="fileid" style="opacity: 0; position: absolute; width: 90px;height: 80px;">
- <img alt="介绍图" src="${path}${ptsComponents.componentsImg!''}" id="partsImg" width="90" height="80">
- <input type="hidden" id="componentsImg" name="componentsImg" value=""/>
- </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 type="radio" id="sex-2" value="1" name="componentsStatus" <#if ptsComponents.componentsStatus == 1>checked</#if>>
- <label for="sex-2">正常使用</label>
- </div>
- <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>
- <input type="hidden" value="${ptsComponents.componentsStatus!''}" name="oldComponentsStatus" id="oldComponentsStatus">
- </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/100!''}" id="componentsCost" name="componentsCost" placeholder="请输入零件成本,单位为元" onkeyup="value=value.replace(/[^\d.]/g,'')">
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>零件重量(g):</label>
- <div class="formControls col-xs-8 col-sm-9">
- <input type="text" class="input-text" value="${ptsComponents.componentsWeight!''}" id="componentsWeight" name="componentsWeight" placeholder="请输入零件重量,单位为克" onkeyup="value=value.replace(/[^\d.]/g,'')">
- </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>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">规格:</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"><#if ptsComponents.componentsDesc??>${ptsComponents.componentsDesc?length} <#else>0</#if></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=" 提交 ">
- </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" src="${path}/common/lib/webuploader/0.1.5/webuploader.min.js"></script>
- <script type="text/javascript" src="${path}/common/lib/jquery/1.9.1/ajaxfileupload.js"></script>
- <script type="text/javascript">
- $(function(){
- $("#componentsType").change(function () {
- var val = parseInt($(this).val());
- var typeHtml = '';
- switch (val){
- case 1:
- typeHtml = 110;
- break;
- case 2:
- typeHtml = 220;
- break;
- case 4:
- typeHtml = 330;
- break;
- case 5:
- typeHtml = 440;
- break;
- case 6:
- typeHtml = 550;
- break;
- case 3:
- typeHtml = 660;
- break;
- default:
- break;
- }
- $("#comType").html(typeHtml);
- })
- })
- /*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:{
- 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){
- if($("#componentsCost").val() < 0.1){
- layer.msg('零件成本不能小于0.1元!', {icon: 2, time: 2000});
- return;
- }
- var comPontNoOld = $("#comPontNo").val();
- if(comPontNoOld.length > 5){
- layer.msg('零件编号不能超过五位!', {icon: 2, time: 2000});
- return;
- }
- var types = $("#comType").html();
- var serialNumber = $("#serialNumber").val();
- var comPontNo = types + '-' + $("#comPontNo").val();
- if(serialNumber != null && serialNumber != "" && typeof(serialNumber) != "undefined"){
- comPontNo += "-" + serialNumber;
- }
- $("#componentsNo").val(comPontNo);
- var produceId = $("#produceId").val();
- var oldProduceId = $("#oldProduceId").val();
- var componentsStatus=$('input:radio[name="componentsStatus"]:checked').val();
- var oldComponentsStatus = $("#oldComponentsStatus").val();
- if(produceId != oldProduceId || componentsStatus != oldComponentsStatus){
- layer.confirm('修改的零件,会影响已经生产好的机器。如果修改零件的供应商、材料等信息,建议添加一次Bom,并做对应软硬件版本升级。,是否修改?',function(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});
- }
- });
- });
- }else {
- $.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});
- }
- });
- }
- }
- });
- });
- $('#fileid').change(function() {
- fileUpload();
- });
- function fileUpload() {
- $.ajaxFileUpload({
- url:"${path}/admin/machineParts/fileUpload",
- secureuri:false,
- fileElementId:"fileid",//文件选择框的id属性
- dataType: 'json', //json
- success: function (data) {
- if(data.returnCode == 200){
- $('#componentsImg').val(data.returnMsg.imgUrl);
- $('#partsImg').attr("src",root_path+data.returnMsg.imgUrl);
- $("#fileid").remove();
- /*<input type="file" name="file" id="fileid" style="opacity: 0; position: absolute; width: 90px;height: 80px;">*/
- $("#fileDiv").prepend('<input type="file" name="file" id="fileid" style="opacity: 0; position: absolute; width: 90px;height: 80px;" onchange="fileUpload()">');
- }else{
- layer.msg('上传失败,请重试!',{icon: 5,time:2000});
- }
- }
- });
- }
- </script>
- <!--/请在上方写此页面业务相关的脚本-->
- </body>
- </html>
|