|
@@ -28,24 +28,26 @@
|
|
class="custom-time-input"
|
|
class="custom-time-input"
|
|
v-model="scope.row.deviation_value[0]"
|
|
v-model="scope.row.deviation_value[0]"
|
|
:disabled="scope.$index == 0"
|
|
:disabled="scope.$index == 0"
|
|
- @blur="() => saveEdit(scope.row, `deviation_value-${0}`)"
|
|
|
|
|
|
+ @focus="recordTap(scope.row.deviation_value[0])"
|
|
|
|
+ @blur="() => saveEdit(scope.row, `deviation_value-${0}`, scope.$index)"
|
|
@keyup.enter="
|
|
@keyup.enter="
|
|
- () => saveEdit(scope.row, `deviation_value-${0}`)
|
|
|
|
|
|
+ () => saveEdit(scope.row, `deviation_value-${0}`, scope.$index)
|
|
"
|
|
"
|
|
- @input="validateInput(scope.row,0)"
|
|
|
|
|
|
+ @input="validateInput(scope.row,0, scope.$index)"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div class="warnLine"></div>
|
|
<div class="warnLine"></div>
|
|
<div>
|
|
<div>
|
|
<el-input
|
|
<el-input
|
|
v-model="scope.row.deviation_value[1]"
|
|
v-model="scope.row.deviation_value[1]"
|
|
|
|
+ @focus="recordTap(scope.row.deviation_value[1])"
|
|
:disabled="scope.$index == tableData.length - 1"
|
|
:disabled="scope.$index == tableData.length - 1"
|
|
- @blur="() => saveEdit(scope.row, `deviation_value-${1}`)"
|
|
|
|
|
|
+ @blur="() => saveEdit(scope.row, `deviation_value-${1}`, scope.$index)"
|
|
@keyup.enter="
|
|
@keyup.enter="
|
|
- () => saveEdit(scope.row, `deviation_value-${1}`)
|
|
|
|
|
|
+ () => saveEdit(scope.row, `deviation_value-${1}`, scope.$index)
|
|
"
|
|
"
|
|
class="custom-time-input"
|
|
class="custom-time-input"
|
|
- @input="validateInput(scope.row,1)"
|
|
|
|
|
|
+ @input="validateInput(scope.row,1, scope.$index)"
|
|
|
|
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
@@ -218,9 +220,31 @@ const editingCell = ref({ row: null, column: null });
|
|
const editCell = (rowIndex: number, column: string) => {
|
|
const editCell = (rowIndex: number, column: string) => {
|
|
editingCell.value = { row: rowIndex, column: column };
|
|
editingCell.value = { row: rowIndex, column: column };
|
|
};
|
|
};
|
|
-
|
|
|
|
-const saveEdit = (row, column) => {
|
|
|
|
|
|
+let recordValue=ref(null)
|
|
|
|
+let recordTap=(val:string)=>{
|
|
|
|
+recordValue.value=val
|
|
|
|
+}
|
|
|
|
+const saveEdit = (row, column,rowIndex) => {
|
|
console.log("Saving data:", row, column);
|
|
console.log("Saving data:", row, column);
|
|
|
|
+ // 确保值不超过后面所有输入框的值
|
|
|
|
+ // for (let i = rowIndex + 1; i < tableData.value.length; i++) {
|
|
|
|
+ // const nextValue = parseFloat(tableData.value[i].deviation_value[0]);
|
|
|
|
+ // if (!isNaN(nextValue) && parseFloat(row.deviation_value[0]) > nextValue) {
|
|
|
|
+ // tableData.value[rowIndex].deviation_value[0]=recordValue.value
|
|
|
|
+ // return false;
|
|
|
|
+
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // // 确保值不小于前面所有输入框的值
|
|
|
|
+ // for (let i = rowIndex - 1; i >= 0; i--) {
|
|
|
|
+ // const prevValue = parseFloat(tableData.value[i].deviation_value[1]);
|
|
|
|
+ // if (!isNaN(prevValue) && parseFloat(row.deviation_value[1]) < prevValue) {
|
|
|
|
+ // tableData.value[rowIndex].deviation_value[1]=recordValue.value
|
|
|
|
+
|
|
|
|
+ // return false;
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
// 在这里处理保存逻辑,例如发送请求到服务器
|
|
// 在这里处理保存逻辑,例如发送请求到服务器
|
|
editingCell.value = { row: null, column: null };
|
|
editingCell.value = { row: null, column: null };
|
|
healthySetUpdate({
|
|
healthySetUpdate({
|
|
@@ -230,7 +254,7 @@ const saveEdit = (row, column) => {
|
|
ElMessage.success("操作成功!");
|
|
ElMessage.success("操作成功!");
|
|
});
|
|
});
|
|
};
|
|
};
|
|
-const validateInput = (row, index) => {
|
|
|
|
|
|
+const validateInput = (row, index,rowIndex) => {
|
|
let value = row.deviation_value[index];
|
|
let value = row.deviation_value[index];
|
|
value = value.replace(/[^0-9.]/g, ""); // 只允许输入数字和小数点
|
|
value = value.replace(/[^0-9.]/g, ""); // 只允许输入数字和小数点
|
|
|
|
|