YYC
2023-07-04 585e878b169bdeb2bc8cc452b9d2e640d00caa6d
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("后台异常,请重试或者联系管理员!!");
        }
    });
}
// 查询
@@ -255,6 +288,7 @@
        }
    });
};
// 扦样机解除急停
function checkResetStop() {
    var param = JSON.stringify(checkDto);
@@ -279,6 +313,7 @@
        }
    });
};
//隐藏信息--替换为*
function replaceStr(str) {
    if (!str) {
@@ -299,14 +334,10 @@
    curCheckData = obj.data;
    curSampleData = obj.data;
    if(!curCheckData.checkTime){
    if (!curCheckData.checkTime) {
        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 +367,7 @@
    // 获取化验项信息
    flushCheckItem(curCheckData.foodVariety);
    getPriceByFoodLevel(curCheckData.foodLevel);
}
/**
@@ -344,7 +376,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 +415,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 +495,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: '备注说明',
@@ -502,7 +544,7 @@
    var index = layer.load();
    $.ajax({
        type: "POST",
        url: "../../basic/inout/update-check",
        url: "../../basic/inout/submit-check",
        dataType: "json",
        contentType: "application/json;charset=UTF-8",
        data: JSON.stringify(curCheckData),
@@ -645,48 +687,13 @@
        "border-bottom": "2px solid #53adce",
        "background": "#eff4f6"
    });
};
}
// 表单清空
function resetForm() {
    $("#form-param")[0].reset();
    form.render();
};
/**
 * 弹出提醒框
 * @param msg 提醒信息
 * @param data 数据信息,可能为空
 */
function notify(msg, data) {
    if (data) {
        //赋值
        $("#resultMsg").text(msg);
        $("#resultUserName").text(data.userName);
        $("#resultPlateNum").text(data.plateNum);
        if ("IN" == data.type) {
            $("#resultType").text("入库-" + INOUT_PROGRESS_MSG(data.progress));
        } else {
            $("#resultType").text("出库-" + INOUT_PROGRESS_MSG(data.progress));
        }
        $("#resultIntelCard").text(data.intelCard);
        layer.open({
            type: 1,
            offset: ['150px', '200px'],
            area: '450px;',
            shade: 0.8,
            id: 'dialog_notify_info',
            btn: ['确定'],
            content: $('#dialog-from-notify'),
            yes: function (index) {
                layer.closeAll();
            }
        });
    } else {
        layer.alert(msg, {offset: ['300px', '300px']});
    }
};
}
// ---------------------------粮食产地 -开始 -------------------//
// 弹出粮食产地下拉框
@@ -781,4 +788,39 @@
    });
};
/**
 * 弹出提醒框
 * @param msg 提醒信息
 * @param data 数据信息,可能为空
 */
function notify(msg, data) {
    if (data) {
        //赋值
        $("#resultMsg").text(msg);
        $("#resultUserName").text(data.userName);
        $("#resultPlateNum").text(data.plateNum);
        if ("IN" == data.type) {
            $("#resultType").text("入库-" + INOUT_PROGRESS_MSG(data.progress));
        } else {
            $("#resultType").text("出库-" + INOUT_PROGRESS_MSG(data.progress));
        }
        $("#resultIntelCard").text(data.intelCard);
        layer.open({
            type: 1,
            offset: ['150px', '200px'],
            area: '450px;',
            shade: 0.8,
            id: 'dialog_notify_info',
            btn: ['确定'],
            content: $('#dialog-from-notify'),
            yes: function (index) {
                layer.closeAll();
            }
        });
    } else {
        layer.alert(msg, {offset: ['300px', '300px']});
    }
}
// ---------------------------粮食产地 -结束 -------------------//