• datalist


    <!DOCTYPE html>
    <html xmlns:th="http://www.thymeleaf.org">
    <head
    th:replace="common/common_header :: common_header(~{::title},~{},~{::style},~{::script})">
    <title>DFMEA库</title>
    <style type="text/css">
    body {
    background-color: rgb(255, 255, 255);
    }
    </style>
    </head>
    <body style="background-color: #FFFFFF;">
    <div class="container-fluid">
    <div class="panel panel-default">
    <div class="panel-body">
    <ul class='nav nav-tabs' style="height: 100%">
    <li class='active'><a href='#div-tempitem' data-toggle='tab'>[[#{dfmeadata.tempitem}]]</a></li>
    <li><a href='#div-standarditem' data-toggle='tab'>[[#{dfmeadata.standarditem}]]</a></li>
    </ul>
    <div class='tab-content'>
    <div class='tab-pane active' id='div-tempitem'>
    <div class="box-body pad table-responsive" style="float: right; padding: 5px">
    <a href="javascript:void(0);" id="addtofmeastandarddata" onclick="addtostandarditem()" class="btn btn-circle btn-default btn-sm" style="margin-right: 10px; float: right; height: 22px; padding-top: 2px;"><i class="fa fa-cog" id="btn_add"></i>
    [[#{rvm.btn.setAsStandard}]]</a>
    <a href="#" id="btn_reset1" onclick="resetSBZDTFilter('npFmeadataTable');" class="btn btn-circle btn-default btn-sm" style="margin-right: 7px; float: right; height: 22px; padding-top: 2px;"> <i class="fa fa-refresh"></i> [[#{common.reset}]]</a>
    <a href="javascript:void(0);" id="btn_search" onclick="getSBZDTData('npFmeadataTable');" class="btn btn-circle btn-default btn-sm" style="margin-right: 7px; float: right; height: 22px; padding-top: 2px;"><i class="fa fa-search"></i> [[#{common.search}]]</a>
    <a href="javascript:void(0);" id="column_custom" onclick="defineSBZDTColumns('npFmeadataTable', 'newproduct.npfmeadata', npFmeadataConf);" class="btn btn-circle btn-default btn-sm" style="margin-right: 7px; float: right; height: 22px; padding-top: 2px;" data-toggle="modal" data-target="#div_doublebox_select"> <i class="fa fa-pencil"></i> [[#{common.cloumnOption}]]</a>
    </div>
    <div>
    <table id="npFmeadataTable"
    class="table table-striped table-bordered table-hover table-checkable order-column display nowrap"
    style=" 100%;" role="grid">
    </table>
    </div>
    </div>
    <div class='tab-pane' id='div-standarditem'>
    <div class="box-body pad table-responsive" style="float: right; padding: 5px">
    <a id="export_fmeatemplate" class="btn btn-circle btn-default btn-sm" style="margin-right: 10px; float: right; height: 22px; padding-top: 2px;"><i class="glyphicon glyphicon-export"></i> [[#{dfmeadata.templatedownload}]]</a>
    <a id="btn_export_system" href="javascript:void(0);" onclick="exportFile('npFmeadataStandardTable', '/dfmeadata/exportStandardList', 'Standard D-FMEA List');"class="btn btn-circle btn-default btn-sm" style="margin-right: 10px; float: right; height: 22px; padding-top: 2px;"><i class="glyphicon glyphicon-export"></i> [[#{common.export}]]</a>
    <a href="javascript:void(0);"
    class="btn btn-circle btn-default btn-sm"
    onclick="javascript:$('#fmea-standard-data').trigger('click')"
    style="margin-right: 10px; float: right; height: 22px; padding-top: 2px;">
    <i class="glyphicon glyphicon-import"></i> [[#{common.import}]]
    </a>
    <a href="javascript:void(0);" id="fmeadatastandard-delete" onclick="deleteFmeaStandard()" class="btn btn-circle btn-default btn-sm" style="margin-right: 10px; float: right; height: 22px; padding-top: 2px;"><i class="fa fa-trash"></i> [[#{common.delete}]]</a>
    <a href="javascript:void(0);" id="column_customedit" onclick="editFmeaStandard()" class="btn btn-circle btn-default btn-sm" style="margin-right: 7px; float: right; height: 22px; padding-top: 2px;"> <i class="fa fa-pencil"></i> [[#{common.edit}]]</a>
    <a href="javascript:void(0);" id="fmeadatastandard-add" onclick="addFmeaStandard()" class="btn btn-circle btn-default btn-sm" style="margin-right: 10px; float: right; height: 22px; padding-top: 2px;"> <i class="fa fa-plus"></i> [[#{common.add}]] </a>
    <a href="#" id="btn_reset" onclick="resetSBZDTFilter('npFmeadataStandardTable');" class="btn btn-circle btn-default btn-sm" style="margin-right: 7px; float: right; height: 22px; padding-top: 2px;"><i class="fa fa-refresh"></i> [[#{common.reset}]]</a>
    <a href="javascript:void(0);" id="btn_search" onclick="getSBZDTData('npFmeadataStandardTable');" class="btn btn-circle btn-default btn-sm" style="margin-right: 7px; float: right; height: 22px; padding-top: 2px;"><i class="fa fa-search"></i> [[#{common.search}]]</a>
    <a href="javascript:void(0);" id="column_custom" onclick="defineSBZDTColumns('npFmeadataStandardTable', 'newproduct.npfmeadata', npFmeadataStandardConf);" class="btn btn-circle btn-default btn-sm" style="margin-right: 7px; float: right; height: 22px; padding-top: 2px;" data-toggle="modal" data-target="#div_doublebox_select"> <i class="fa fa-pencil"></i> [[#{common.cloumnOption}]]</a>
    </div>
    <div>
    <table id="npFmeadataStandardTable"
    class="table table-striped table-bordered table-hover table-checkable order-column display nowrap"
    style=" 100%;" role="grid">
    </table>
    <div style="display: none">
    <input type="file" id="fmea-standard-data"
    name="fmea-standard-data" class="file fileloading"
    data-upload-url="/dfmeadata/importStandardList"
    style="display: none" accept=".xls,.xlsx"
    onchange="importFile(this, 'npFmeadataStandardTable')" />
    </div>
    </div>
    </div>
    <div th:replace="common/wysiwyg_textarea :: wysiwyg_textarea"></div>
    <div th:replace="common/doublebox_select :: doublebox_select"></div>
    </div>
    </div>
    </div>
    </div>
    <div class="modal fade" id="fmeastandard-modal" tabindex="-1" role="dialog" aria-hidden="true" style=" 100%;">
    <div class="modal-dialog" style=" 800px;">
    <div class="modal-content" style=" 100%; margin: auto">
    <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal"
    aria-hidden="true">&times;</button>
    <h4 class="modal-title" >[[#{dfmeadata.standarditem}]]</h4>
    </div>
    <div class="modal-body">
    <form role="form" id="dfmeadata-form">
    <input type="hidden" id="curFmeaDataGuid" name="curFmeaDataGuid">
    <input type="hidden" id="curFmeaUniqueGuid" name="curFmeaUniqueGuid"/>
    <div class="row row-bottom">
    <div class="col-md-3 col-top">
    <select id="project-modal-elevatortype" name="elevatorType" onchange="getElevatorCategoryAndModel(this,null)"></select>
    </div>
    <div class="col-md-3 col-top">
    <input type="text" id="projectNo" name="projectNo" readonly="readonly" th:data-label="#{newproduct.npfmeadata.projectNo}" data-type="sbz_input" sbz-validator="stringLength[0,200]" />
    </div>
    <div class="col-md-3 col-top">
    <select id="fmeatask-modal-elevatoryCategory" name="elevatorCategory"></select>
    </div>
    <div class="col-md-3 col-top">
    <select id="project-modal-model" name="productModel" data-size='10'></select>
    </div>
    </div>
    <div class="row row-bottom">

    <div class="col-md-3 col-top">
    <div class="form-group">
    <select id="fmeatask-subSystem" name="subSystem" onchange='getFourLevelSelect("subSystem", this)'></select>
    </div>
    </div>

    <div class="col-md-3 col-top">
    <select id="fmeatask-assembly" name="assembly" onchange='getFourLevelSelect("assembly", this)'></select>
    </div>

    <div class="col-md-3 col-top">
    <select id="fmeatask-component" name="component" onchange='getFourLevelSelect("component", this)' ></select>
    </div>
    <div class="col-md-3 col-top">
    <select id="fmeatask-part" name="part"></select>
    </div>
    <div class="col-md-3 col-top">
    </div>
    </div>
    <div class="row row-bottom">
    <div class="col-md-12 col-top">
    <textarea id="fmeatask-functionalRequirment" name="functionalRequirment" th:data-label="#{newproduct.dfmea.functionalRequirment}" data-type="sbz_textarea" required="required" rows="3" cols="12" sbz-validator="stringLength[0,2000]"></textarea>
    </div>
    </div>
    <div class="row row-bottom">
    <div class="col-md-12 col-top">
    <textarea id="fmeatask-potentialFailureMode" name="potentialFailureMode" th:data-label="#{newproduct.dfmea.potentialFailureMode}" data-type="sbz_textarea" required="required" rows="3" cols="12" sbz-validator="stringLength[0,200]"></textarea>
    </div>
    </div>
    <div class="row row-bottom">
    <div class="col-md-12 col-top">
    <textarea id="fmeatask-potentialEffect" name="potentialEffect" th:data-label="#{newproduct.dfmea.potentialEffect}" data-type="sbz_textarea" required="required" rows="3" cols="12" sbz-validator="stringLength[0,200]"></textarea>
    </div>
    </div>
    <div class="row row-bottom">
    <div class="col-md-12 col-top">
    <textarea id="fmeatask-potentialCause" name="potentialCause" th:data-label="#{newproduct.dfmea.potentialCause}" data-type="sbz_textarea" required="required" rows="3" cols="12" sbz-validator="stringLength[0,200]"></textarea>
    </div>
    </div>

    <div class="row row-bottom">
    <div class="col-md-12 col-top">
    <textarea id="fmeatask-currentPrevention" name="currentPrevention" th:data-label="#{newproduct.dfmea.currentPrevention}" data-type="sbz_textarea" required="required" rows="3" cols="12" sbz-validator="stringLength[0,200]"></textarea>
    </div>
    </div>
    <div class="row row-bottom">
    <div class="col-md-12 col-top">
    <textarea id="fmeatask-currentDetection" name="currentDetection" th:data-label="#{newproduct.dfmea.currentDetection}" data-type="sbz_textarea" required="required" rows="3" cols="12" sbz-validator="stringLength[0,200]"></textarea>
    </div>
    </div>
    <div class="row row-bottom">
    <div class="col-md-12 col-top">
    <textarea id="fmeatask-recommendedAction" name="recommendedAction" th:data-label="#{newproduct.dfmea.recommendedAction}" data-type="sbz_textarea" rows="3" cols="12" sbz-validator="stringLength[0,200]"></textarea>
    </div>
    </div>
    <div class="row row-bottom">

    <div class="col-md-3 col-top">
    <select id="fmeatask-severity" name="severity" onChange="calcriskPriorityNumber()"></select>
    </div>
    <div class="col-md-3 col-top">
    <select id="fmeatask-occurrence" name="occurrence" onChange="calcriskPriorityNumber()"></select>
    </div>
    <div class="col-md-3 col-top">
    <select id="fmeatask-detection" name="detection" onChange="calcriskPriorityNumber()"></select>
    </div>
    <div class="col-md-3 col-top">
    <div class="form-group">
    <label class="control-label">[[#{newproduct.dfmea.riskPriorityNumber}]]</label>
    <input type="text" name="riskPriorityNumber" id="fmeatask-riskPriorityNumber" class="form-control"
    readonly="readonly" required="required"/>
    </div>
    </div>
    </div>
    <div class="row row-bottom">
    <div class="col-md-3 col-top">
    <div class="form-group">
    <input type="text" id="fmeatask-itemClass" required="required" name="itemClass" th:data-label="#{newproduct.dfmea.itemClass}" data-type="sbz_input" sbz-validator="stringLength[0,50]" />
    </div>
    </div>
    <div class="col-md-3 col-top">
    <div class="form-group">
    <input id="fmeatask-responsibility" type="text" th:data-label="#{newproduct.dfmea.responsibility}"
    name="responsibility" data-icon-class="fa fa-calendar"
    data-type="sbz_date" value="" data-date-format="yyyy-mm-dd" class="input-readonly"/>
    </div>
    </div>
    <div class="col-md-3 col-top">
    <div class="form-group">
    <input id="fmeatask-actionTaken" type="text" th:data-label="#{newproduct.dfmea.actionTaken}"
    name="actionTaken" data-icon-class="fa fa-calendar"
    data-type="sbz_date" value="" data-date-format="yyyy-mm-dd" class="input-readonly"/>
    </div>
    </div>
    <div class="col-md-3 col-top">
    <div class="form-group">
    <input type="text" id="fmeatask-resultSeverity" name="resultSeverity" th:data-label="#{newproduct.dfmea.resultSeverity}" data-type="sbz_input" sbz-validator="stringLength[0,200]" />
    </div>
    </div>
    </div>
    <div class="row row-bottom">


    <div class="col-md-3 col-top">
    <div class="form-group">
    <input type="text" id="fmeatask-resultOccurrence" name="resultOccurrence" th:data-label="#{newproduct.dfmea.resultOccurrence}" data-type="sbz_input" sbz-validator="stringLength[0,200]" />
    </div>
    </div>
    <div class="col-md-3 col-top">
    <div class="form-group">
    <input type="text" id="fmeatask-resultDetection" name="resultDetection" th:data-label="#{newproduct.dfmea.resultDetection}" data-type="sbz_input" sbz-validator="stringLength[0,200]" />
    </div>
    </div>
    <div class="col-md-3 col-top">
    <div class="form-group">
    <input type="text" id="fmeatask-resultRPN" name="resultRPN" th:data-label="#{newproduct.dfmea.resultRPN}" data-type="sbz_input" sbz-validator="stringLength[0,200]" />
    </div>
    </div>
    <div class="col-md-3 col-top">
    <select id="fmeatask-resultState" name="resultState"></select>
    </div>
    </div>
    </form>
    </div>
    <div class="modal-footer">
    <button type="button" class="btn btn-primary" onclick="submitDFMEAData(this)" action="add" id="fmeatask-modal-submit">[[#{common.ok}]]</button>
    <button type="button" class="btn btn-default" data-dismiss="modal" id="fmeatask-modal-cancel">[[#{common.cancel}]]</button>
    </div>
    </div>
    </div>
    </div>

    <form id="templateForm" method="post"></form>
    </body>

    <script th:inline="javascript">
    var selectElevatorType = null;
    var selectElevatorCategory = null;
    var selectSubSystem = null;
    var selectAssembly = null;
    var selectComponent = null;
    var selectPart = null;
    var selectProductModel = null;
    var dfmeaDataState = null;
    var dfmeaDataSererity = null;
    var dfmeaDataOccurence = null;
    var dfmeaDataDetection = null;

    var severityValGlobal=1;
    var occurenceValGlobal=1;
    var detectionValGlobal=1;

    $(function () {
    //初始化梯型下拉列表
    selectElevatorType = SbzSelect.init("project-modal-elevatortype",{
    name : "elevatorType",
    required : "required",
    data_type : "sbz_select",
    data_label : [[#{np.project.elevatorType}]],
    data_data : DROPDOWN_OPTIONS_MAP.elevatorType,
    data_field : "value:text",
    data_search : "true"
    });

    selectElevatorCategory = SbzSelect.init("fmeatask-modal-elevatoryCategory", {
    name: "elevatorCategory",
    data_type: "sbz_select",
    data_label: [[#{np.project.elevatorCategory}]],
    data_field: "value:text",
    multiple: "multiple",
    required : "required",
    data_search: "true"
    });
    //初始化型号下拉列表
    selectProductModel = SbzSelect.init("project-modal-model",{
    name : "productModel",
    data_type : "sbz_select",
    data_label : [[#{np.project.model}]],
    data_data : DROPDOWN_OPTIONS_MAP.effectedModels,
    data_field : "value:text",
    multiple : "multiple",
    required : "required",
    data_search : "true"
    });
    //配置下拉选项(子系统)
    selectSubSystem = SbzSelect.init("fmeatask-subSystem", {
    name : "subSystem",
    data_label : [[#{temp.rvm.subSystem}]],
    data_type : "sbz_select",
    //data_data : DROPDOWN_OPTIONS_MAP.subSystem,
    data_field : "value:text",
    required : "required",
    data_search : "true"
    });

    //配置下拉选项(组件)
    selectAssembly = SbzSelect.init("fmeatask-assembly", {
    name : "assembly",
    data_label : [[#{temp.rvm.assembly}]],
    data_type : "sbz_select",
    data_field : "value:text",
    //data_data : DROPDOWN_OPTIONS_MAP.assembly,
    data_search : "true"
    });

    //配置下拉选项(部件)
    selectComponent = SbzSelect.init("fmeatask-component", {
    name : "component",
    data_label : [[#{temp.rvm.component}]],
    data_type : "sbz_select",
    data_field : "value:text",
    //data_data : DROPDOWN_OPTIONS_MAP.component,
    data_search : "true"
    });

    //配置下拉选项(零件)
    selectPart = SbzSelect.init("fmeatask-part", {
    name : "part",
    data_label : [[#{temp.rvm.part}]],
    data_type : "sbz_select",
    //data_data : DROPDOWN_OPTIONS_MAP.part,
    data_field : "value:text",
    data_search : "true"
    });

    //配置下拉状态
    dfmeaDataState = SbzSelect.init("fmeatask-resultState", {
    name : "resultState",
    data_label : [[#{newproduct.dfmea.resultState}]],
    data_type : "sbz_select",
    data_data : DROPDOWN_OPTIONS_MAP.resultState,
    data_field : "value:text",
    data_search : "true"
    });
    //初始化严重程度下拉列表
    dfmeaDataSererity = SbzSelect.init("fmeatask-severity",{
    name : "severity",
    data_type : "sbz_select",
    data_label : [[#{newproduct.dfmea.severity}]],
    data_data : DROPDOWN_OPTIONS_MAP.severity,
    data_field : "value:text",
    required : "required",
    data_search : "true"
    });
    //初始化发生频率下拉列表
    dfmeaDataOccurence= SbzSelect.init("fmeatask-occurrence",{
    name : "occurrence",
    data_type : "sbz_select",
    data_label : [[#{newproduct.dfmea.occurrence}]],
    data_data : DROPDOWN_OPTIONS_MAP.severity,
    data_field : "value:text",
    required : "required",
    data_search : "true"
    });
    //初始化检测下拉列表
    dfmeaDataDetection= SbzSelect.init("fmeatask-detection",{
    name : "detection",
    data_type : "sbz_select",
    data_label : [[#{newproduct.dfmea.detection}]],
    data_data : DROPDOWN_OPTIONS_MAP.severity,
    data_field : "value:text",
    required : "required",
    data_search : "true"
    });
    });
    //获取四级联动
    var getFourLevelSelect = function (selectType, selectObj) {
    if($(selectObj).val() == null) {
    switch (selectType) {
    case 'subSystem' :
    selectAssembly.Data_data([]);
    selectComponent.Data_data([]);
    selectPart.Data_data([]);
    break;
    case 'assembly' :
    selectComponent.Data_data([]);
    selectPart.Data_data([]);
    break;
    case 'component' :
    selectPart.Data_data([]);
    break;
    default :
    break;
    }

    return false;
    }


    var selectData = getLinkedSelectList(selectType, $(selectObj).val(), $("#project-modal-elevatortype").val());
    switch (selectType) {
    case 'subSystem' :
    selectAssembly.Data_data(selectData);
    selectComponent.Data_data([]);
    selectPart.Data_data([]);
    break;
    case 'assembly' :
    selectComponent.Data_data(selectData);
    selectPart.Data_data([]);
    break;
    case 'component' :
    selectPart.Data_data(selectData);
    break;
    default :
    break;
    }
    }
    var npFmeadataConf = function(columns) {
    return {
    "ajax" : "/dfmeadata/findNpFmeadataByPage",
    "fetch" : "eager",
    "multiple" : true,
    "rangeSelector" : true,
    "serverSide" : true,
    "drag" : {
    'dragable' : false,
    'handle' : '.drag',
    'sortProperty' : "sort"
    },
    "rowCallback" : function(row, data, index) {

    },
    columns : columns,
    scrollY : null,
    processing : true,
    autoWidth: false,
    filter : [],
    scrollX : true,
    scrollCollapse : true,
    sScrollX : '100%',
    sScrollXInner : '130%',
    paging : true,
    showFilter : {
    visible : true,
    enabled : false
    },
    columnSearchDic : { // 一次性加载表头所有下拉类型备选项
    data : DROPDOWN_OPTIONS_MAP
    },
    headerCallback : function(thead, data, start, end, display) {
    }
    };
    }

    var npFmeadataStandardConf = function(columns) {
    return {
    "ajax" : "/dfmeadata/findNpFmeadataStandardByPage",
    "fetch" : "eager",
    "multiple" : true,
    "rangeSelector" : true,
    "serverSide" : true,
    "drag" : {
    'dragable' : false,
    'handle' : '.drag',
    'sortProperty' : "sort"
    },
    "rowCallback" : function(row, data, index) {

    },
    columns : columns,
    scrollY : null,
    processing : true,
    autoWidth : false,
    filter : [],
    scrollX : true,
    scrollCollapse : true,
    sScrollX : '100%',
    sScrollXInner : '130%',
    paging : true,
    showFilter : {
    visible : true,
    enabled : false
    },
    columnSearchDic : { // 一次性加载表头所有下拉类型备选项
    data : DROPDOWN_OPTIONS_MAP
    },
    headerCallback : function(thead, data, start, end, display) {
    }
    };
    }
    //初始化临时项表格
    initSBZDT("npFmeadataTable", "newproduct.npfmeadata", npFmeadataConf);
    //初始化标准项表格
    initSBZDT("npFmeadataStandardTable", "newproduct.npfmeadata", npFmeadataStandardConf);
    // 清理模态窗口内部数据(仅文本框)
    var clearModalData = function(modalId) {
    selectElevatorType.Data_default_value("");
    selectElevatorCategory.Data_default_value("");
    selectSubSystem.Data_default_value("");
    selectAssembly.Data_data([]);
    selectComponent.Data_data([]);
    selectPart.Data_data([]);
    selectProductModel.Data_data([]);
    dfmeaDataState.Data_default_value("");
    dfmeaDataSererity.Data_default_value("");
    dfmeaDataOccurence.Data_default_value("");
    dfmeaDataDetection.Data_default_value("");
    $("#fmeatask-modal-submit").removeAttr("disabled", "disabled");
    $(modalId + " :input").each(function () {
    if (this.type == "text") {
    $(this).val("");
    }
    });
    $("#fmeatask-functionalRequirment").val("");
    $("#fmeatask-potentialFailureMode").val("");
    $("#fmeatask-potentialEffect").val("");
    $("#fmeatask-potentialCause").val("");
    $("#fmeatask-currentPrevention").val("");
    $("#fmeatask-currentDetection").val("");
    $("#fmeatask-recommendedAction").val("");
    }
    //删除标准项
    var deleteFmeaStandard = function() {
    var obj = new Array();
    var selectData = $("#npFmeadataStandardTable").SbzDatatable().getSelectData();
    if (selectData == undefined || selectData == null || selectData.length == 0) {
    toastr.warning(getI18nValue("common.msg.warn.noSelected"));
    return;
    }

    bootbox.confirm(getI18nValue('common.msg.confirm.deleteData'),
    function(result) {
    if (result) {
    $.each(selectData,function(index, item){
    obj.push(item.autoGuid);
    });
    $.ajax({
    url : "/dfmeadata/deleteDFmeaStandardByIds", //请求的url地址
    dataType : "json",
    async : true,
    data: JSON.stringify(obj),
    type : "POST",
    contentType: "application/json; charset=utf-8",
    success : function(data) {
    if (data.status == 400)
    toastr.error(data.msg);
    else {
    toastr.success(data.result);
    //初始化标准项表格
    initSBZDT("npFmeadataStandardTable", "newproduct.npfmeadata", npFmeadataStandardConf);
    }
    },
    error : function(err) {
    }
    });
    }
    });
    }
    //新增DFMEA标准项
    var addFmeaStandard = function ()
    {
    //初始化校验并清空校验信息
    $("#dfmeadata-form").SbzInitValidator();
    $("#dfmeadata-form").SbzResetValidator();
    //清空模态框中的值
    clearModalData(('#fmeastandard-modal'))
    $('#fmeastandard-modal').modal('show');
    $('#fmeatask-modal-submit').attr('action','add');
    }
    //编辑DFMEA标准信息
    var editFmeaStandard = function ()
    {
    var obj = $("#npFmeadataStandardTable").SbzDatatable().getSelectData();
    if (obj == undefined || obj == null || obj.length == 0) {
    toastr.warning(getI18nValue("common.msg.warn.noSelected"));
    return;
    }
    if (obj.length > 1) {
    toastr.warning(getI18nValue("common.msg.warn.selectOneOnly"));
    return;
    }
    obj = obj[0];
    //初始化校验并清空校验信息
    $("#dfmeadata-form").SbzInitValidator();
    $("#dfmeadata-form").SbzResetValidator();
    //清空模态框中的值
    clearModalData(('#fmeastandard-modal'));
    //将表格中选中行数据赋值给模态框中的对应input
    getDfmeaDiagramInfoById(obj);
    $('#fmeatask-modal-submit').attr('action','edit');
    $('#fmeastandard-modal').modal('toggle');
    $("#fmeatask-modal-submit").removeAttr("disabled", "disabled");

    }
    // 新增为标准项
    var addtostandarditem = function () {
    var selected = $("#npFmeadataTable").SbzDatatable().getSelect();
    if (selected.length > 0) {
    bootbox.confirm(getI18nValue("dfmeadata.msg.addtostandarditem"), function(result) {
    if (result) {
    var ajaxData = [];
    $.each(selected.data(), function(index, data) {
    ajaxData.push(data.autoGuid);
    });

    $.ajax({
    type : "POST",
    url : '/dfmeadata/updateToStandard',
    data : JSON.stringify({autoGuid: ajaxData.join(',')}),
    dataType : "json",
    async : false,
    contentType : "application/json; charset=utf-8",
    success : function(resp, message) {
    getSBZDTData('npFmeadataTable');
    getSBZDTData('npFmeadataStandardTable');
    toastr.success(getI18nValue("common.msg.info.success"));
    }
    });
    }
    });
    } else {
    toastr.error(getI18nValue("common.msg.warn.noSelected"));
    }
    };

    var isEmpty = function (obj) {
    if (obj == null || obj == "" || obj == undefined)
    return true;
    return false;
    }

    //DFMEA提交
    var submitDFMEAData = function ($btn) {
    debugger
    //初始化校验并清空校验信息
    // $("#dfmeadata-form").SbzValidate();
    // $("#dfmeadata-form").SbzResetValidator();
    $($btn).attr("disabled", "disabled");
    var form = $("#dfmeadata-form");
    var isCorrect =verificationData(form);
    if(isCorrect){
    var obj = $(form).serializeObject();
    //影响的型号和子系统为必填,不需要校验他的非空
    if(!$.isArray(obj.elevatorCategory))
    obj.elevatorCategory = [obj.elevatorCategory];

    if(!$.isArray(obj.effectedModels))
    obj.effectedModels = [obj.effectedModels];

    if(!$.isArray(obj.productModel))
    obj.productModel = [obj.productModel];

    if(isEmpty(obj.assembly))
    obj.assembly = 0;
    if(isEmpty(obj.component))
    obj.component = 0;
    if(isEmpty(obj.part))
    obj.part = 0;
    if(isEmpty(obj.part))
    obj.part = 0;

    obj.riskPriorityNumber=$("#fmeatask-riskPriorityNumber").val();

    var action = $("#fmeatask-modal-submit").attr("action");
    var url = '';
    if(action == "add")
    {url = "/dfmeadata/addDfmeaDataInfo"}
    else
    {url = "/dfmeadata/editDfmeaDataInfo"}
    $.ajax({
    url:url,
    dataType:"json",
    async:true,
    data:JSON.stringify(obj),
    type:"POST",
    contentType : "application/json; charset=utf-8",
    success:function(data){
    $('#fmeastandard-modal').modal('toggle');
    if (data.status == 400)
    toastr.error(data.result);
    else {
    toastr.success(data.result);
    getSBZDTData('npFmeadataStandardTable');
    }
    },
    error:function(err){
    }
    });
    } else
    $($btn).removeAttr("disabled", "disabled");
    }
    $("#export_fmeatemplate").on("click", function() {
    $("#templateForm").attr("action", "/dfmeadata/downloadDFMEADataImportTemplate?token=" + encodeURIComponent(TOKEN));
    $("#templateForm").submit();
    })
    //校验数据
    var verificationData = function (form) {
    return $(form).SbzValidate();
    }
    //根据梯型获取梯种和型号
    var getElevatorCategoryAndModel = function (obj, defaultSubSystemCode) {
    if ($(obj).val() == null || $(obj).val() == "" || $(obj).val() == undefined) {
    selectElevatorCategory.Data_data([]);
    selectProductModel.Data_data([]);
    selectSubSystem.Data_data([]);
    selectAssembly.Data_data([]);
    selectComponent.Data_data([]);
    selectPart.Data_data([]);
    return;
    }
    var selectData = getSelectList("subSystem",$(obj).val(), 1);
    selectSubSystem.Data_data(selectData);

    if (defaultSubSystemCode == null)
    selectSubSystem.Data_default_value('');
    else
    selectSubSystem.Data_default_value(defaultSubSystemCode);

    selectAssembly.Data_data([]);
    selectComponent.Data_data([]);
    selectPart.Data_data([]);

    $.ajax({
    url:"/newproduct/project/getElevatorCategoryAndModel", //请求的url地址
    dataType:"json",
    async:false,
    data:{elevatorTypeId: $(obj).val()},
    type:"POST",
    success:function(data){
    selectElevatorCategory.Data_data(data.elevatorCategoryList);
    //梯型为电梯时,梯种默认中高速,如果是扶梯时,梯种默认公交扶梯
    /*if ($(obj).val() == "Elevator")
    selectElevatorCategory.Data_default_value(2);
    else
    selectElevatorCategory.Data_default_value(3);*/
    selectProductModel.Data_data(data.ModelList);
    },
    error:function(err){
    }
    });
    }
    //将表格中选中行数据赋值给模态框中的对应input
    var getDfmeaDiagramInfoById = function (obj) {
    $("#curFmeaDataGuid").val(obj.autoGuid);
    $("#fmeatask-functionalRequirment").val(obj.functionalRequirment);
    $("#fmeatask-itemClass").val(obj.itemClass);
    $("#fmeatask-potentialFailureMode").val(obj.potentialFailureMode);
    $("#fmeatask-potentialEffect").val(obj.potentialEffect);
    // $("#fmeatask-severity").val(obj.severity);
    $("#fmeatask-potentialCause").val(obj.potentialCause);
    $("#fmeatask-currentPrevention").val(obj.currentPrevention);
    // $("#fmeatask-occurrence").val(obj.occurrence);
    $("#fmeatask-currentDetection").val(obj.currentDetection);
    // $("#fmeatask-detection").val(obj.detection);
    $("#fmeatask-riskPriorityNumber").val(obj.riskPriorityNumber);
    $("#fmeatask-recommendedAction").val(obj.recommendedAction);
    $("#fmeatask-responsibility").val(obj.responsibility);
    $("#fmeatask-actionTaken").val(obj.actionTaken);
    $("#fmeatask-resultSeverity").val(obj.resultSeverity);
    $("#fmeatask-resultOccurrence").val(obj.resultOccurrence);
    $("#fmeatask-resultDetection").val(obj.resultDetection);
    $("#fmeatask-resultRPN").val(obj.resultRPN);
    if (obj.elevatorTypeCode.indexOf(',') == -1)
    {selectElevatorType.Data_default_value([obj.elevatorTypeCode]);}
    else
    { selectElevatorType.Data_default_value(obj.elevatorTypeCode.split(','));}

    if (obj.resultStateCode!=null)
    {dfmeaDataState.Data_default_value([obj.resultStateCode]);}

    getElevatorCategoryAndModel($("#project-modal-elevatortype"), obj.subSystemCode)

    //var selectData = getSelectList("subSystem",$("#project-modal-elevatortype").val(), 1);
    //selectSubSystem.Data_data(selectData);

    if (obj.subSystemCode!=null)
    {selectSubSystem.Data_default_value([obj.subSystemCode]);}

    getFourLevelSelect("subSystem", $("#fmeatask-subSystem"))

    if (obj.assemblyCode!=null)
    {selectAssembly.Data_default_value([obj.assemblyCode]);}

    getFourLevelSelect("assembly", $("#fmeatask-assembly"))

    if (obj.componentCode!=null)
    {selectComponent.Data_default_value([obj.componentCode]);}

    getFourLevelSelect("component", $("#fmeatask-component"))

    if (obj.partCode!=null)
    {selectPart.Data_default_value([obj.partCode]);}

    if (obj.severity!=null)
    {dfmeaDataSererity.Data_default_value([obj.severity]);}
    if (obj.occurrence!=null)
    {dfmeaDataOccurence.Data_default_value([obj.occurrence]);}
    if (obj.detection!=null)
    {dfmeaDataDetection.Data_default_value([obj.detection]);}


    $.ajax({
    url: '/dfmeadata/getDFmeaDataById', //请求的url地址
    dataType: "json",
    async: false,
    data: {fmeaUniqueGuid: obj.fmeaUniqueGuid},
    type: "POST",
    success: function (data) {
    if (data.elevatorCategoryList.indexOf(',') == -1)
    {selectElevatorCategory.Data_default_value([data.elevatorCategoryList]);}
    else
    { selectElevatorCategory.Data_default_value(data.elevatorCategoryList.split(','));}

    if (data.productModelList.indexOf(',') == -1)
    {selectProductModel.Data_default_value([data.productModelList]);}
    else
    { selectProductModel.Data_default_value(data.productModelList.split(','));}
    },
    error: function (err) {
    }
    });
    }
    function calcriskPriorityNumber(){
    var severityVal=$("#fmeatask-severity").val();
    var occurenceVal=$("#fmeatask-occurrence").val();
    var detectionVal=$("#fmeatask-detection").val();
    if(null!=severityVal&&""!=severityVal){
    severityValGlobal=severityVal;
    }
    if(null!=occurenceVal&&""!=occurenceVal){
    occurenceValGlobal=occurenceVal;
    }
    if(null!=detectionVal&&""!=detectionVal){
    detectionValGlobal=detectionVal;
    }
    $("#fmeatask-riskPriorityNumber").val(severityValGlobal*occurenceValGlobal*detectionValGlobal);
    }
    </script>
    </html>
  • 相关阅读:
    Flash/Flex学习笔记(30):不用startDrag和stopDrag的对象拖动
    Flash/Flex学习笔记(33):如何用As3协同Flash CS IDE控制MovieClip实例
    Flash/Flex学习笔记(26):AS3自定义右键菜单
    Flash/Flex学习笔记(32):播放音乐并同步显示lyc歌词(适用于Silverlight)
    Flash/Flex学习笔记(35):如何正确监听Stage对象的事件
    jQuery autoComplete 自动完成 支持中文
    黑马程序员视频学习下载地址记录一下
    汉语分词系统 网址
    【转】Lucene.Net 详解
    MongoDB开发学习 开天辟地,经典入门 解决关系型数据库大数据量处理的瓶颈问题
  • 原文地址:https://www.cnblogs.com/DylanZ/p/12843960.html
Copyright © 2020-2023  润新知