Kaynağa Gözat

增加质控规则管理

chendi 8 yıl önce
ebeveyn
işleme
f4fac2454f
1 değiştirilmiş dosya ile 126 ekleme ve 0 silme
  1. 126 0
      src/main/webapp/WEB-INF/ehr/jsp/qc/editorRuleJs.jsp

+ 126 - 0
src/main/webapp/WEB-INF/ehr/jsp/qc/editorRuleJs.jsp

@ -0,0 +1,126 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
<%@include file="/WEB-INF/ehr/commons/jsp/commonInclude.jsp" %>
<script type="text/javascript">
    /* *************************** 模块初始化 ***************************** */
    var editorParam = {
        //form
        actionUrl:"${contextRoot}/rule/addRule",
        init: function () {
            this.toDisable();
            this.bindEvents();
            this.initForm();
        },
        toDisable: function () {
            if ($("#flag").val() == 'disabled') {
                $("#btnEditor").show();
                $("#btnSave").hide();
                $("input[name='type']").attr("disabled", "disabled");
                $("input[name='name']").attr("disabled", "disabled");
                $("input[name='describe']").attr("disabled", "disabled");
                $("input[name='rule']").attr("disabled", "disabled");
                $("input[name='error_code']").attr("disabled", "disabled");
            }
        },
        initForm: function () {
            var me = this;
            var data;
            var modelString = "${model.id}";
            if (modelString != undefined && modelString != null && modelString.length > 0) {
                var type = "${model.type}";
              liger.get("type").selectValue(type);
                data = {
                    id: "${model.id}",
                    type: type,
                    name: "${model.name}",
                    describe: "${model.describe}",
                    rule: "${model.rule}",
                    error_code: "${model.error_code}",
                };
                me.actionUrl = "${contextRoot}/rule/updateRule";
            } else {
                liger.get("type").selectValue("1");//默认有效
            }
            $("#div_info_form").ligerAutoForm({
                data: data,
                validate: {
                    name:"required",
                    describe:"required",
                    rule:"required",
                    error_code:"required",
                    type: {
                        required:true
                    }
                },
            });
        },
        bindEvents: function () {
            var me = this;
            $(".m-form-bottom").on("click", "#btnSave", function () {
                $("#btnSave").css("pointer-events", "none");
                $("#name_icon").removeClass("required");
                if ($("#name_icon").val() == "") {
                    $("#name_icon").addClass("required");
                    if (!$("#div_info_form").ligerAutoForm("validate")) {
                        return;
                    }
                    return;
                }
                if (!$("#div_info_form").ligerAutoForm("validate")) {
                    return;
                }
                var data = $("#div_info_form").ligerAutoForm("getData");
                $.ajax({ //ajax处理
                    type: "POST",
                    url: me.actionUrl,
                    dataType: "json",
                    data: data,
                    cache: false,
                    success: function (data) {
                        if (data.successFlg) {
                            parent.rule.dialogSuccess(data.message);
                        }
                        else {
                            $.ligerDialog.error(data.message);
                        }
                        $("#btnSave").css("pointer-events", "");
                    },
                    error: function (data) {
                        $.ligerDialog.error("Status:" + data.status + "(" + data.statusText + ")");
                        $("#btnSave").css("pointer-events", "");
                    }
                });
            });
            $(".m-form-bottom").on("click", "#btnEditor", function () {
                $("#btnEditor").hide();
                $("#btnSave").show();
                $("input[name='type']").removeAttr("disabled");
                $("input[name='name']").removeAttr("disabled");
                $("input[name='describe']").removeAttr("disabled");
                $("input[name='rule']").removeAttr("disabled");
                $("input[name='error_code']").removeAttr("disabled");
                $("#flag").val("");
            });
            $(".m-form-bottom").on("click", "#btnCancel", function () {
                parent.rule.dialog.close();
            });
            $("#type").ligerComboBox({
                data: [{"value": "完整性", "code": "1"}, {"value": "及时性", "code": "2"}, {"value": "准确性", "code": "3"}],
                cancelable: false,
                onSuccess: function (data) {
                }
            });
        }
    };
    $(function () {
        editorParam.init();
    });
</script>
<script type="text/javascript" src="${staticRoot}/lib/jquery/jqueryform.js"></script>