Files
qctool/titer.html
hbk01 907ea36049 + 修改标水界面提示
+ 新增进样序列计算(开发中)
2022-02-23 22:44:50 +08:00

121 lines
3.4 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="zh_CN">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<title>标水(Titer)</title>
<link rel="stylesheet" href="./github.css">
<link rel="stylesheet" href="./theme.css">
<script src="./decimal.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script>
var debug = false;
var tip = "<br>" +
"请输入三次 F 值" +
"<br>" +
"公式:" +
"<br>" +
"F' = AVERAGE(F1, F2, F3)" + "<br>" +
"RDx = [ Fx - F' ] / F' * 100";
var decimal = Decimal.set(
{
rounding: Decimal.ROUND_HALF_EVEN,
precision: 12
}
);
$(document).ready(function () {
var input_m0 = document.getElementById("m0");
var input_m1 = document.getElementById("m1");
var input_m2 = document.getElementById("m2");
$(".msgbox").append(tip)
$("#ok").click(function () {
var m0 = input_m0.value;
var m1 = input_m1.value;
var m2 = input_m2.value;
f = average(m0, m1, m2);
console.log("f=" + f);
var msg = "<br>" +
"F' = " + f + "<br>" +
"RD1 = " + titer(f, m0) + "<br>" +
"RD2 = " + titer(f, m1) + "<br>" +
"RD3 = " + titer(f, m2) + "<br>"
;
message(msg);
});
$("#clear").click(function () {
input_m0.value = "";
input_m1.value = "";
input_m2.value = "";
message(tip);
});
$("#new_page").click(function () {
window.open(window.location.href, "_blank");
});
if (debug) {
document.getElementById("m0").value = 2;
document.getElementById("m1").value = 3;
document.getElementById("m2").value = 4;
}
});
function message(msg) {
$(".msgbox").empty();
$(".msgbox").append(msg);
}
/**
* 计算标水
* @param f F值为三次mg/mL值的平均值
* @param m 该次mg/mL的值
*/
function titer(f, m) {
temp = decimal.sub(m, f)
return temp.div(f).mul(100);
}
function average(a, b, c) {
var sum = Decimal(a).add(Decimal(b)).add(Decimal(c));
return decimal.div(sum, 3);
}
function checkNull(m0, m1, m2) {
return m0 == '' || m1 == '' || m2 == '';
}
</script>
</head>
<body>
<div class="team">
<input type="number" id="m0" class="m0" placeholder="F1" inputmode="decimal"><br>
<input type="number" id="m1" class="m1" placeholder="F2" inputmode="decimal"><br>
<input type="number" id="m2" class="m2" placeholder="F3" inputmode="decimal"><br>
<br>
</div>
<div class="buttons">
<button id="new_page">新开标签页</button>
<button id="clear">清除内容</button>
<button id="ok">计算</button>
</div>
<div class="msgbox"></div>
</body>
</html>