Files
qctool/titer.html
2022-11-20 00:19:56 +08:00

110 lines
3.0 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-cmn-Hans">
<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, maximum-scale=1.0, user-scalable=no">
<title>标水</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>
let debug = false
let tip = `<br>
请输入三次 F 值<br>
公式:<br>
F' = AVERAGE(F1, F2, F3)<br>
RDx = [ Fx - F' ] / F' * 100`
let decimal = Decimal.set({
rounding: Decimal.ROUND_HALF_EVEN,
precision: 12
})
$(document).ready(() => {
$(".msgbox").append(tip)
$("#ok").click(() => {
let m0 = $("#m0").val()
let m1 = $("#m1").val()
let m2 = $("#m2").val()
f = average(m0, m1, m2)
let msg = `
<br>
F值平均值 = ${f}<br>
RD1 = ${titer(f, m0)}<br>
RD2 = ${titer(f, m1)}<br>
RD3 = ${titer(f, m2)}<br>
`
message(msg)
})
$("#clear").click(() => {
$("#m0").val("")
$("#m1").val("")
$("#m2").val("")
message(tip)
})
$("#new_page").click(() => {
window.open(window.location.href, "_blank")
})
if (debug) {
$("#m0").val(2)
$("#m1").val(3)
$("#m2").val(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) {
let 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>
<h3>标水</h3>
<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>