|
|
|
|
@ -306,7 +306,6 @@ export default {
|
|
|
|
|
coldWaterSetObj: {}, //本地出水温度设定值 |
|
|
|
|
coldWaterControlObj: {}, //远程出水温度设定值 |
|
|
|
|
offsetValuerControlObj: {}, //偏移值设定 |
|
|
|
|
finalColdWaterTemp: "",//最终出水温度设定值 |
|
|
|
|
compressorData1: [], //压缩机1参数 |
|
|
|
|
compressorData2: [], |
|
|
|
|
compressorData3: [], |
|
|
|
|
@ -342,6 +341,11 @@ export default {
|
|
|
|
|
const weekDay = weekDays[this.currentDate.getDay()]; |
|
|
|
|
return `${year}年${month}月${day}日 ${hours}:${minutes}:${seconds} ${weekDay}`; |
|
|
|
|
}, |
|
|
|
|
finalColdWaterTemp() { |
|
|
|
|
const coldWaterValue = this.coldWaterControlObj.curValue === '' ? 0 : parseFloat(this.coldWaterControlObj.curValue); |
|
|
|
|
const offsetValue = this.offsetValuerControlObj.curValue === '' ? 0 : parseFloat(this.offsetValuerControlObj.curValue); |
|
|
|
|
return coldWaterValue + offsetValue; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
created() { }, |
|
|
|
|
mounted() { |
|
|
|
|
@ -530,10 +534,6 @@ export default {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
//最终出水温度设定值 |
|
|
|
|
this.finalColdWaterTemp = |
|
|
|
|
parseFloat(this.coldWaterControlObj.curValue) + parseFloat(this.offsetValuerControlObj.curValue); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
// 使用 filter 方法过滤掉 item 为 '0' 的对象 |
|
|
|
|
@ -708,24 +708,61 @@ export default {
|
|
|
|
|
const specialValues = ["运行", "启动", "正常"]; |
|
|
|
|
return specialValues.includes(value); |
|
|
|
|
}, |
|
|
|
|
// 处理输入事件,过滤非数字字符并确保输入值大于 0 小于 10 |
|
|
|
|
// 处理输入事件,过滤非法字符并确保输入值在0-10之间(支持一位小数) |
|
|
|
|
handleInput(item) { |
|
|
|
|
console.log("校验"); |
|
|
|
|
// 实时校验并过滤非数字字符 |
|
|
|
|
let input = String(item).replace(/[^\d]/g, ""); |
|
|
|
|
// 检查输入是否以 0 开头且长度大于 1,如果是则去掉开头的 0 |
|
|
|
|
if (input.startsWith("0") && input.length > 1) { |
|
|
|
|
input = input.replace(/^0+/, ""); |
|
|
|
|
// 获取当前输入值 |
|
|
|
|
let input = String(item); |
|
|
|
|
// 如果输入为空,直接设置并返回 |
|
|
|
|
if (input === "") { |
|
|
|
|
this.offsetValuerControlObj.curValue = ""; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// 将输入转换为数字 |
|
|
|
|
let numInput = parseInt(input, 10); |
|
|
|
|
// 检查输入是否在 0 到 10 之间 |
|
|
|
|
if (!isNaN(numInput) && numInput > 0 && numInput < 10) { |
|
|
|
|
this.offsetValuerControlObj.curValue = String(numInput); |
|
|
|
|
} else { |
|
|
|
|
this.$modal.msgWarning("只能输入0-10区间") |
|
|
|
|
// 如果输入不在有效范围内,清空输入 |
|
|
|
|
|
|
|
|
|
// 过滤非数字和小数点的字符,但允许一个小数点 |
|
|
|
|
let filteredInput = input.replace(/[^\d.]/g, ""); |
|
|
|
|
|
|
|
|
|
// 处理多个小数点的情况,只保留第一个小数点 |
|
|
|
|
let dotCount = (filteredInput.match(/\./g) || []).length; |
|
|
|
|
if (dotCount > 1) { |
|
|
|
|
let firstDotIndex = filteredInput.indexOf('.'); |
|
|
|
|
filteredInput = filteredInput.substring(0, firstDotIndex + 1) + filteredInput.substring(firstDotIndex + 1).replace(/\./g, ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 检查输入是否以 0 开头且后面不是小数点,如果是则去掉开头的 0 |
|
|
|
|
if (filteredInput.startsWith("0") && filteredInput.length > 1 && filteredInput[1] !== '.') { |
|
|
|
|
filteredInput = filteredInput.replace(/^0+/, ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 如果以小数点开头,在前面添加0 |
|
|
|
|
if (filteredInput.startsWith('.')) { |
|
|
|
|
filteredInput = '0' + filteredInput; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 限制小数点后只能有一位数字 |
|
|
|
|
let dotIndex = filteredInput.indexOf('.'); |
|
|
|
|
if (dotIndex !== -1) { |
|
|
|
|
filteredInput = filteredInput.slice(0, dotIndex + 2); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 如果过滤后为空,设置空值并返回 |
|
|
|
|
if (filteredInput === "") { |
|
|
|
|
this.offsetValuerControlObj.curValue = ""; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 将输入转换为数字进行范围验证 |
|
|
|
|
let numInput = parseFloat(filteredInput); |
|
|
|
|
|
|
|
|
|
// 检查输入是否在 0 到 10 之间(包含小数) |
|
|
|
|
if (!isNaN(numInput) && numInput >= 0 && numInput <= 10) { |
|
|
|
|
// 在范围内,设置过滤后的值 |
|
|
|
|
this.offsetValuerControlObj.curValue = filteredInput; |
|
|
|
|
} else { |
|
|
|
|
// 如果输入不在有效范围内,给出警告并恢复上一次的有效值 |
|
|
|
|
this.$modal.msgWarning("只能输入0-10之间且最多一位小数的数值"); |
|
|
|
|
// 恢复为上一次的有效值或清空 |
|
|
|
|
this.offsetValuerControlObj.curValue = ""; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 失去焦点 |
|
|
|
|
@ -734,7 +771,7 @@ export default {
|
|
|
|
|
}, |
|
|
|
|
handleEnter(item, event) { |
|
|
|
|
console.log("请求后端", item); |
|
|
|
|
if (!item) { |
|
|
|
|
if (!item.curValue) { |
|
|
|
|
this.$modal.msgError("请输入偏移值"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|