czt
2023-06-12 d9e1a4fe6e51958c4571efe2ced4d4172ed385db
igds-web/src/main/resources/static/admin/inout/in-check.js
@@ -47,9 +47,14 @@
            }
        });
        //监听粮食品种
        //监听粮食品种,获取化验项
        layui.form.on('select(select_foodVariety)', function (data) {
            updateFoodVariety(data.value);
        });
        //监听粮食等级,获取粮食定价
        layui.form.on('select(select_foodLevel)', function (data) {
            getPriceByFoodLevel(data.value);
        });
        //监听化验结果单填写数据,并给出提示结果
@@ -110,23 +115,23 @@
    if (symbol && limit) {
        if (">=" == symbol) {
            if (newValue < limit) {
                data.result = "不合格";
                data.result = "0";
            } else {
                data.result = "合格";
                data.result = "1";
            }
        }
        if ("<=" == symbol) {
            if (newValue > limit) {
                data.result = "不合格";
                data.result = "0";
            } else {
                data.result = "合格";
                data.result = "1";
            }
        }
        if ("==" == symbol) {
            if (newValue != limit) {
                data.result = "不合格";
                data.result = "0";
            } else {
                data.result = "合格";
                data.result = "1";
            }
        }
    }
@@ -146,7 +151,7 @@
    form.render('select');
}
//根据选择仓库显示粮食品种
//根据品种获取化验项
function updateFoodVariety(foodVariety) {
    if (null == foodVariety || "" == foodVariety) return;
    form.val("form-detail", {
@@ -155,6 +160,34 @@
    form.render();
    flushCheckItem(foodVariety);
}
//根据选择仓库显示粮食品种
function getPriceByFoodLevel(foodLevel) {
    if (null == foodLevel || "" == foodLevel) return;
    form.val("form-detail", {
        foodLevel: foodLevel
    });
    form.render();
    var data = form.val("form-detail");
    $.ajax({
        type: "POST",
        url: "../../basic/inout/get-price",
        dataType: "json",
        contentType: "application/json;charset=UTF-8",
        data: JSON.stringify(data),
        success: function (result) {
            if (result.code != "0000") {
                layer.msg(result.msg);
            } else {
                $("#check-result-tip2").text("粮食定价:" + result.data.price + "元/公斤");
            }
        },
        error: function () {
            layer.msg("后台异常,请重试或者联系管理员!!");
        }
    });
}
// 查询
@@ -303,10 +336,6 @@
        curCheckData.checkTime = dateFtt("yyyy-MM-dd hh:mm:ss", new Date());
    }
    curCheckData.checkUser = checkUser;
    if (curCheckData.checkStatus == "NONE") {
        //隐藏车牌部分信息
        curCheckData.plateNum = replaceStr(curCheckData.plateNum);
    }
    // 赋值
    form.val("form-detail", curCheckData);
@@ -336,6 +365,7 @@
    // 获取化验项信息
    flushCheckItem(curCheckData.foodVariety);
    getPriceByFoodLevel(curCheckData.foodLevel);
}
/**
@@ -344,7 +374,7 @@
function flushCheckItem(foodVariety) {
    curCheckItems = null;
    $("#check-result-tip").text("检验结果:#");
    $("#price-result-tip").text("粮食单价:#元/公斤");
    $("#price-result-tip2").text("粮食定价:#元/公斤");
    curCheckData.foodVariety = foodVariety;
    var index = layer.load();
@@ -383,23 +413,23 @@
    }
    var msg;
    $.each(curCheckItems, function (index, data) {
        if (!data.remarks) {
        if (!data.result) {
            return true;
        }
        if (data.remarks == "不合格") {
        if (data.result == "0") {
            msg = "不合格";
            return false;
        }
        if (data.remarks == "合格") {
        if (data.result == "1") {
            msg = "合格";
        }
    });
    if (msg) {
        $("#check-result-tip").text("检验结果:" + msg + ";粮食单价:#元/公斤");
        $("#check-result-tip").text("质检结果:" + msg);
    } else {
        $("#check-result-tip").text("检验结果:合格" + ";粮食单价:#元/公斤");
        $("#check-result-tip").text("质检结果:#");
    }
};
}
/**
 * 渲染表格
@@ -463,7 +493,17 @@
            title: '检验结果',
            align: 'center',
            width: '10%',
            edit: 'text'
            templet: function (item) {
                if (item.result == null) {
                    return "";
                }
                if (item.result == '0') {
                    return "不合格";
                }
                if (item.result == '1') {
                    return "合格";
                }
            }
        }, {
            field: 'remarks',
            title: '备注说明',
@@ -645,13 +685,13 @@
        "border-bottom": "2px solid #53adce",
        "background": "#eff4f6"
    });
};
}
// 表单清空
function resetForm() {
    $("#form-param")[0].reset();
    form.render();
};
}
/**
 * 弹出提醒框