+ 进样时间改进输入框,使提示文字始终可见
+ 操作规程新增 L389-101 + 删除标水页面和设置页面
This commit is contained in:
@@ -44,7 +44,6 @@
|
||||
color: red;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
</style>
|
||||
<script src="../statics/modules/jquery.min.js"></script>
|
||||
<script>
|
||||
@@ -60,8 +59,8 @@
|
||||
}
|
||||
]
|
||||
|
||||
let info = {}
|
||||
$(() => {
|
||||
let info = {}
|
||||
let count = databases.length
|
||||
let interval = setInterval(() => {
|
||||
if (count == 0) {
|
||||
@@ -94,92 +93,92 @@
|
||||
searchDevice(keyword)
|
||||
searchStandard(keyword)
|
||||
})
|
||||
})
|
||||
|
||||
function searchDevice(keyword) {
|
||||
let device = info.device.filter((value) => {
|
||||
return value.id.toLowerCase().includes(keyword)
|
||||
})
|
||||
if (device.length > 0) {
|
||||
let table_device = createDeviceTable(device)
|
||||
$("#content").append(table_device)
|
||||
}
|
||||
function searchDevice(keyword) {
|
||||
let device = info.device.filter((value) => {
|
||||
return value.id.toLowerCase().includes(keyword)
|
||||
})
|
||||
if (device.length > 0) {
|
||||
let table_device = createDeviceTable(device)
|
||||
$("#content").append(table_device)
|
||||
}
|
||||
}
|
||||
|
||||
function searchStandard(keyword) {
|
||||
let standard = info.standard.filter((value) => {
|
||||
return value.batch.toLowerCase().includes(keyword)
|
||||
})
|
||||
if (standard.length > 0) {
|
||||
let table_standard = createStandardTable(standard)
|
||||
$("#content").append(table_standard)
|
||||
}
|
||||
function searchStandard(keyword) {
|
||||
let standard = info.standard.filter((value) => {
|
||||
return value.batch.toLowerCase().includes(keyword)
|
||||
})
|
||||
if (standard.length > 0) {
|
||||
let table_standard = createStandardTable(standard)
|
||||
$("#content").append(table_standard)
|
||||
}
|
||||
}
|
||||
|
||||
function createDeviceTable(data) {
|
||||
return createTable(data, `设备信息(${data.length}条)`, ["名称", "编号", "有效期至"], hidden = ["where"])
|
||||
function createDeviceTable(data) {
|
||||
return createTable(data, `设备信息(${data.length}条)`, ["名称", "编号", "有效期至"], ["where"])
|
||||
}
|
||||
|
||||
function createStandardTable(data) {
|
||||
return createTable(data, `对照品信息(${data.length}条)`, ["批号", "有效期至", "含量丨纯度"], ["kind"])
|
||||
}
|
||||
|
||||
function createTable(data, captionText, header, hidden = []) {
|
||||
let table = document.createElement("table")
|
||||
table.setAttribute("class", "pure-table")
|
||||
|
||||
let caption = document.createElement("caption")
|
||||
caption.innerText = captionText
|
||||
table.appendChild(caption)
|
||||
|
||||
let tr = document.createElement("tr")
|
||||
for (const headerText of header) {
|
||||
let th = document.createElement("th")
|
||||
th.innerText = headerText
|
||||
tr.appendChild(th)
|
||||
}
|
||||
table.appendChild(tr)
|
||||
|
||||
function createStandardTable(data) {
|
||||
return createTable(data, `对照品信息(${data.length}条)`, ["批号", "有效期至", "含量丨纯度"], hidden = ["kind"])
|
||||
}
|
||||
|
||||
function createTable(data, captionText, header, hidden = []) {
|
||||
let table = document.createElement("table")
|
||||
table.setAttribute("class", "pure-table")
|
||||
|
||||
let caption = document.createElement("caption")
|
||||
caption.innerText = captionText
|
||||
table.appendChild(caption)
|
||||
|
||||
data.forEach(element => {
|
||||
let tr = document.createElement("tr")
|
||||
for (const headerText of header) {
|
||||
let th = document.createElement("th")
|
||||
th.innerText = headerText
|
||||
tr.appendChild(th)
|
||||
for (const key in element) {
|
||||
if (Object.hasOwnProperty.call(element, key)) {
|
||||
if (hidden.includes(key)) {
|
||||
continue
|
||||
}
|
||||
const value = element[key]
|
||||
let td = document.createElement("td")
|
||||
td.innerHTML = (key == "expir") ? checkExpir(value) : value
|
||||
tr.appendChild(td)
|
||||
}
|
||||
}
|
||||
table.appendChild(tr)
|
||||
})
|
||||
|
||||
data.forEach(element => {
|
||||
let tr = document.createElement("tr")
|
||||
for (const key in element) {
|
||||
if (Object.hasOwnProperty.call(element, key)) {
|
||||
if (hidden.includes(key)) {
|
||||
continue
|
||||
}
|
||||
const value = element[key]
|
||||
let td = document.createElement("td")
|
||||
td.innerHTML = (key == "expir") ? checkExpir(value) : value
|
||||
tr.appendChild(td)
|
||||
}
|
||||
}
|
||||
table.appendChild(tr)
|
||||
})
|
||||
return table
|
||||
}
|
||||
|
||||
return table
|
||||
function checkExpir(value) {
|
||||
let date = new Date()
|
||||
let array = value.split(".")
|
||||
date.setFullYear(array[0], array[1] - 1, array[2])
|
||||
|
||||
let day = (date - Date.now()) / 86400000
|
||||
|
||||
if (day <= 0) {
|
||||
return `<span class='expired'>${value}</span>`
|
||||
}
|
||||
|
||||
function checkExpir(value) {
|
||||
let date = new Date()
|
||||
let array = value.split(".")
|
||||
date.setFullYear(array[0], array[1] - 1, array[2])
|
||||
|
||||
let day = (date - Date.now()) / 86400000
|
||||
|
||||
if (day <= 0) {
|
||||
return `<span class='expired'>${value}</span>`
|
||||
}
|
||||
|
||||
if (day <= 7) {
|
||||
return `<span class='expir7'>${value}</span>`
|
||||
}
|
||||
|
||||
if (day <= 30) {
|
||||
return `<span class='expir30'>${value}</span>`
|
||||
}
|
||||
|
||||
return value
|
||||
if (day <= 7) {
|
||||
return `<span class='expir7'>${value}</span>`
|
||||
}
|
||||
})
|
||||
|
||||
if (day <= 30) {
|
||||
return `<span class='expir30'>${value}</span>`
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
|
||||
@@ -167,17 +167,77 @@
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.inputbox {
|
||||
display: flex;
|
||||
display: -webkit-flex;
|
||||
line-height: 32px;
|
||||
border: 1px solid black;
|
||||
border-radius: 5px;
|
||||
justify-content: center;
|
||||
align-items: baseline;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.inputbox label {
|
||||
line-height: 32px;
|
||||
font-size: small;
|
||||
color: #777;
|
||||
margin-left: 10px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.inputbox div {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.inputbox input {
|
||||
/* 需设置宽度,否则 iOS 端的 Safari 无法正确显示 div.inputbox 的右边框 */
|
||||
width: calc(100% - 20px);
|
||||
/* 取消边框 */
|
||||
border: none;
|
||||
/* 取消选中时的边框高亮 */
|
||||
outline: none;
|
||||
margin: 0;
|
||||
font-size: medium;
|
||||
line-height: 32px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h3>进样时间</h3>
|
||||
<div class="input">
|
||||
<div class="inputbox">
|
||||
<input type="number" id="allId" placeholder="批处理中样品的总数" inputmode="decimal" autocomplete="off">
|
||||
<input type="number" id="time" placeholder="每一针的运行时间" inputmode="decimal" autocomplete="off">
|
||||
<input type="number" id="nowId" placeholder="当前运行到第几针" inputmode="decimal" autocomplete="off">
|
||||
<input type="number" id="nowTime" placeholder="现在这针运行多少分钟" inputmode="decimal" autocomplete="off">
|
||||
<input type="number" id="offset" placeholder="时间偏移量" inputmode="decimal" autocomplete="off">
|
||||
<div>
|
||||
<div class="inputbox allId">
|
||||
<label for="allId">样品总数</label>
|
||||
<!-- 此处的 div 为解决 Safari 浏览器 align-items: baseline; 不对齐的问题 -->
|
||||
<div>
|
||||
<input type="number" id="allId" inputmode="decimal" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="inputbox time">
|
||||
<label for="time">运行时间</label>
|
||||
<div><input type="number" id="time" inputmode="decimal" autocomplete="off"></div>
|
||||
</div>
|
||||
|
||||
<div class="inputbox nowId">
|
||||
<label for="nowId">运行到第几针</label>
|
||||
<div><input type="number" id="nowId" inputmode="decimal" autocomplete="off"></div>
|
||||
</div>
|
||||
|
||||
<div class="inputbox nowTime">
|
||||
<label for="nowTime">当前运行时间</label>
|
||||
<div><input type="number" id="nowTime" inputmode="decimal" autocomplete="off"></div>
|
||||
</div>
|
||||
|
||||
<div class="inputbox offset">
|
||||
<label for="offset">时间偏移量</label>
|
||||
<div><input type="number" id="offset" inputmode="decimal" autocomplete="off"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<br>
|
||||
<div class="buttons">
|
||||
|
||||
@@ -1,194 +0,0 @@
|
||||
<!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">
|
||||
<title>Settings</title>
|
||||
<script src="../statics/modules/jquery.min.js"></script>
|
||||
<link rel="stylesheet" href="../statics/github.css">
|
||||
<link rel="stylesheet" href="../statics/theme.css">
|
||||
<style>
|
||||
* {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 85vw;
|
||||
height: 70vh;
|
||||
padding: 2vw;
|
||||
margin: 3vw;
|
||||
font-size: medium;
|
||||
line-height: 1.2;
|
||||
border: 1px solid #cbcbcb;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
</style>
|
||||
<script type="module">
|
||||
import { IO } from "../statics/modules/tools.js"
|
||||
const io = new IO("settings")
|
||||
|
||||
$(() => {
|
||||
const textarea = $("#textarea")
|
||||
|
||||
// 写入默认设置
|
||||
if (readSettings().length == 0) {
|
||||
writeDefaultSettings(() => {
|
||||
$("#refresh").click()
|
||||
})
|
||||
}
|
||||
|
||||
$("#reset").click(() => {
|
||||
if (confirm("确定要恢复默认设置吗?\n该选项将会覆盖当前已保存的设置")) {
|
||||
writeDefaultSettings(() => {
|
||||
$("#refresh").click()
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
$("#go_index").click(() => {
|
||||
window.location.href = "../index.html"
|
||||
})
|
||||
|
||||
$("#refresh").click(() => {
|
||||
let settings = readSettingsWithComments()
|
||||
let string = ""
|
||||
settings.forEach(item => {
|
||||
string = string.concat(item).concat("\n")
|
||||
})
|
||||
textarea.val(string)
|
||||
})
|
||||
$("#refresh").click()
|
||||
|
||||
$("#save").click(() => {
|
||||
let text = $("#textarea").val()
|
||||
let settings = text.split("\n")
|
||||
writeSettings(settings)
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
function readSettingsWithComments() {
|
||||
let texts = []
|
||||
texts.push("# 以井号开头的行是注释,注释将被忽略。")
|
||||
texts.push("# 一行仅可填写一个设置,以键值对 (key=value) 的形式出现。")
|
||||
texts.push("# 等号左边为设置的唯一标识,右边为该设置的值")
|
||||
texts.push("# 若值有多个,使用英文逗号分隔 (e.g. key=value1,value2)")
|
||||
texts.push("# 等号和用于分隔多个值的英文逗号左右两边不得有空格")
|
||||
texts.push("")
|
||||
for (const setting of readSettings()) {
|
||||
let comment = io.read(`${setting.key}.desc`)
|
||||
texts.push(`# ${comment}`)
|
||||
texts.push(`${setting.key}=${setting.value}`)
|
||||
texts.push("")
|
||||
}
|
||||
return texts
|
||||
}
|
||||
|
||||
function readSettings() {
|
||||
let settings = []
|
||||
for (const iterator of io.listKeys().sort()) {
|
||||
if (!iterator.endsWith(".desc")) {
|
||||
settings.push({
|
||||
key: iterator,
|
||||
value: io.read(iterator)
|
||||
})
|
||||
}
|
||||
}
|
||||
return settings
|
||||
}
|
||||
|
||||
function writeSettings(settings) {
|
||||
if (settings.length == 0) {
|
||||
return
|
||||
}
|
||||
|
||||
io.listKeys().forEach(key => {
|
||||
if (!key.endsWith(".desc")) {
|
||||
io.remove(key)
|
||||
}
|
||||
})
|
||||
|
||||
settings.forEach(item => {
|
||||
if (item.startsWith("#")) {
|
||||
return
|
||||
}
|
||||
let key = item.split('=')[0]
|
||||
let value = item.split('=')[1]
|
||||
if (key != item && key != '') {
|
||||
io.write(key, value)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function writeDefaultSettings(action) {
|
||||
io.listKeys().forEach(key => {
|
||||
io.remove(key)
|
||||
})
|
||||
|
||||
$.getJSON("../statics/settings.json", (settings) => {
|
||||
for (const iterator of settings) {
|
||||
io.write(iterator.id, iterator.default)
|
||||
io.write(`${iterator.id}.desc`, iterator.description)
|
||||
}
|
||||
|
||||
action()
|
||||
})
|
||||
}
|
||||
|
||||
function createItem(data) {
|
||||
let div = document.createElement("div")
|
||||
div.setAttribute("class", "setting_item")
|
||||
|
||||
let span = document.createElement("span")
|
||||
let span_title = document.createElement("span")
|
||||
let span_description = document.createElement("span")
|
||||
span_title.setAttribute("class", "title")
|
||||
span_description.setAttribute("class", "description")
|
||||
span_description.innerHTML = data.description
|
||||
span.appendChild(span_title)
|
||||
span.appendChild(document.createElement("br"))
|
||||
span.appendChild(span_description)
|
||||
div.appendChild(span)
|
||||
switch (data.type) {
|
||||
case 'boolean':
|
||||
span_title.innerHTML = `${data.title} (${data.default ? "ON" : "OFF"})`
|
||||
let button = document.createElement("button")
|
||||
button.innerText = data.default ? "OFF" : "ON"
|
||||
button.setAttribute("id", data.id)
|
||||
div.appendChild(button)
|
||||
break
|
||||
case 'number':
|
||||
span_title.innerHTML = `${data.title} (${data.default})`
|
||||
let input = document.createElement("input")
|
||||
input.setAttribute("type", "number")
|
||||
input.setAttribute("value", data.default)
|
||||
input.setAttribute("id", data.id)
|
||||
div.appendChild(input)
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
return div
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<textarea id="textarea" wrap="off" autocomplete="off"></textarea>
|
||||
|
||||
<br>
|
||||
<div id="buttons" style="text-align: center;">
|
||||
<button id="reset">恢复默认设置</button>
|
||||
<button id="go_index">回到首页</button>
|
||||
<button id="refresh">刷新</button>
|
||||
<button id="save">保存</button>
|
||||
</div>
|
||||
<div id="msg"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -38,6 +38,7 @@
|
||||
"L018-4W",
|
||||
"L018-5",
|
||||
"L018-6",
|
||||
"L389-101",
|
||||
"L414-1",
|
||||
"L414-5KR",
|
||||
"L414-7",
|
||||
|
||||
108
views/titer.html
108
views/titer.html
@@ -1,108 +0,0 @@
|
||||
<!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="../statics/github.css">
|
||||
<link rel="stylesheet" href="../statics/theme.css">
|
||||
<script src="../statics/modules/jquery.min.js"></script>
|
||||
<script type="module">
|
||||
import { Decimal } from "../statics/modules/decimal.mjs"
|
||||
import { Formula } from "../statics/modules/tools.js"
|
||||
|
||||
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(() => {
|
||||
message(tip)
|
||||
|
||||
$("#ok").click(() => {
|
||||
let m0 = $("#m0").val()
|
||||
let m1 = $("#m1").val()
|
||||
let m2 = $("#m2").val()
|
||||
let f = Formula.AVERAGE(m0, m1, m2).toFixed(4, Decimal.ROUND_HALF_EVEN)
|
||||
|
||||
let msg = `
|
||||
<br>
|
||||
F值平均值 = ${f}<br>
|
||||
RD1 = ${format(titer(f, m0))}<br>
|
||||
RD2 = ${format(titer(f, m1))}<br>
|
||||
RD3 = ${format(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(5.1183)
|
||||
$("#m1").val(5.1823)
|
||||
$("#m2").val(5.0926)
|
||||
}
|
||||
})
|
||||
|
||||
function message(msg) {
|
||||
$(".msgbox").empty()
|
||||
$(".msgbox").html(msg)
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算标水
|
||||
* @param f F值,为三次mg/mL值的平均值
|
||||
* @param m 该次mg/mL的值
|
||||
*/
|
||||
function titer(f, m) {
|
||||
let temp = decimal.sub(m, f)
|
||||
return temp.div(f).mul(100).toFixed(2, Decimal.ROUND_HALF_EVEN)
|
||||
}
|
||||
|
||||
function format(value, min = -1, max = 1) {
|
||||
if (value <= min || value >= max) {
|
||||
return `<span style='font-family: none; color: red;'>${value}</span>`
|
||||
}
|
||||
return `<span style='font-family: none;'>${value}</span>`
|
||||
}
|
||||
|
||||
</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>
|
||||
</div>
|
||||
<br>
|
||||
<div class="buttons">
|
||||
<button id="new_page">新开标签页</button>
|
||||
<button id="clear">清除内容</button>
|
||||
<button id="ok">计算</button>
|
||||
</div>
|
||||
|
||||
<div class="msgbox"></div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user