From 9e8fde7bdfbc1e5bffddce14fb052d0e05a076d0 Mon Sep 17 00:00:00 2001 From: hbk01 <3243430237@qq.com> Date: Wed, 16 Apr 2025 22:04:32 +0800 Subject: [PATCH] =?UTF-8?q?+=20=E8=BF=9B=E6=A0=B7=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E4=BB=AA=E5=99=A8=E5=86=B3=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E8=A1=A5=E5=81=BF=E7=9A=84=E5=8A=9B=E5=BA=A6=20+=20?= =?UTF-8?q?=E8=BF=9B=E6=A0=B7=E6=97=B6=E9=97=B4=E9=BB=98=E8=AE=A4=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=B3=BB=E7=BB=9F=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- views/injection-sequence.html | 139 ++++++++++++++++++++++++++++++---- 1 file changed, 126 insertions(+), 13 deletions(-) diff --git a/views/injection-sequence.html b/views/injection-sequence.html index 7cfe539..25fd7b5 100644 --- a/views/injection-sequence.html +++ b/views/injection-sequence.html @@ -21,21 +21,53 @@ $(document).ready(() => { let tip = `
此功能用于计算批处理中每一针样品运行的时间。
-仪器进样需要一定的时间,该部分时间虽然短,积累起来却不可忽视。
-此功能以当前运行样品的时间为起点,再向前或向后计算其他针的时间。所以,越远离当前运行的样品,则误差越大。
+此功能以当前运行样品的时间为起点,再向前或向后计算其他针的时间。
+仪器进样需要时间,而仪器不同,进样所需时间也不同,因此该部分时间无法准确计算。 + 且该部分时间会随样品总数增多而积累,按此功能的算法,越远离当前运行的样品,则误差越大。
误差不可避免,但勾选时间补偿可尽量校正该误差。
` $("#output").append(tip) - // 初始化当前日期和时间 - $("#nowDate").val(new Date().format("yyyy-MM-dd")) - $("#nowTime").val(new Date().format("hh:mm")) - // 默认选中时间补偿 let offset = true + // 默认岛津的时间补偿为 24 秒 + let offsetSecond = 24 + // 默认使用系统时间 + let useSystemClock = true + + // 默认使用系统时间,隐藏当前时间和日期的输入框 + $(".nowDate").hide() + $(".nowTime").hide() + + // 注册使用系统时间的事件监听器 + $("#useSystemClock").on("change", function () { + useSystemClock = $(this).is(":checked") + if (useSystemClock) { + $(".nowDate").hide() + $(".nowTime").hide() + } else { + $(".nowDate").show() + $(".nowTime").show() + $("#nowDate").val(new Date().format("yyyy-MM-dd")) + $("#nowTime").val(new Date().format("hh:mm:ss")) + } + }) + // 注册时间补偿的事件监听器 $("#offset").on("change", function () { offset = $(this).is(":checked") + if (offset) { + $(".offset_type").show() + offsetSecond = $("input[name='offset_type']:checked").val() + } else { + $(".offset_type").hide() + offsetSecond = 0 + } + }) + + // 注册仪器类型的事件监听器,选择不同的仪器,时间补偿也会不同 + $(".offset_type").on("change", function () { + offsetSecond = $("input[name='offset_type']:checked").val() }) $("#ok").click(() => { @@ -48,8 +80,13 @@ let data = [] + if ($("#useSystemClock").is(":checked")) { + nowDate = new Date().format("yyyy-MM-dd") + nowTime = new Date().format("hh:mm:ss") + } + // 生成数据 - let array = genData(nowDate, nowTime, allId, nowId, time, nowRunTime, offset ? 30 : 1) + let array = genData(nowDate, nowTime, allId, nowId, time, nowRunTime, offsetSecond) let formatString = 'YYYY-MM-DD HH:mm' array.forEach((value, index) => { data.push({ @@ -91,10 +128,10 @@ * @param {Number} nowId 当前针数(当前仪器运行到第几针) * @param {Number} time 一针有多少分钟(包括后运行) * @param {Number} nowRunTime 当前这针已经运行了多少分钟 - * @param {Number} offset 每一针需偏移多少秒(默认 30 秒) + * @param {Number} offsetSecond 每一针需偏移多少秒,不同的仪器会有不同偏移量,默认为岛津的 24 秒, * @return {Array} 保存了 dayjs 对象的数组,每一个元素代表一针的开始时间 */ - function genData(nowDate, nowTime, allId, nowId, time, nowRunTime, offset) { + function genData(nowDate, nowTime, allId, nowId, time, nowRunTime, offsetSecond) { let array = new Array(allId) let now = new dayjs(`${nowDate} ${nowTime}`) @@ -102,11 +139,11 @@ array[nowId - 1] = now.subtract(nowRunTime, 'minute') // 计算当前这针前面的时间 for (let index = nowId - 2; index >= 0; index--) { - array[index] = array[index + 1].subtract(time, 'minute').subtract(offset, 'second') + array[index] = array[index + 1].subtract(time, 'minute').subtract(offsetSecond, 'second') } // 计算当前这针后面的时间 for (let index = nowId; index < allId; index++) { - array[index] = array[index - 1].add(time, 'minute').add(offset, 'second') + array[index] = array[index - 1].add(time, 'minute').add(offsetSecond, 'second') } return array } @@ -216,6 +253,7 @@ .offset { display: flex; display: -webkit-flex; + margin-bottom: 5px; align-items: center; line-height: 32px; } @@ -229,6 +267,57 @@ #offset { width: 20px; } + + fieldset { + display: flex; + display: -webkit-flex; + flex-direction: column; + align-items: center; + line-height: 32px; + } + + legend { + font-size: small; + color: #777; + margin-left: 10px; + margin-right: 10px; + } + + fieldset div { + width: 100%; + display: flex; + display: -webkit-flex; + align-items: center; + line-height: 32px; + } + + input[type="radio"] { + width: 20px; + margin-left: 20%; + } + + fieldset label { + line-height: 32px; + padding-left: 5px; + } + + .useSystemClock { + display: flex; + display: -webkit-flex; + margin-bottom: 5px; + align-items: center; + line-height: 32px; + } + + .useSystemClock label { + width: 100%; + line-height: 32px; + padding-left: 5px; + } + + #useSystemClock { + width: 20px; + } @@ -236,14 +325,20 @@