Kaynağa Gözat

fix:报工管号区间选择问题修改

luoxiao 3 ay önce
ebeveyn
işleme
f01b111346
1 değiştirilmiş dosya ile 22 ekleme ve 4 silme
  1. 22 4
      src/views/pro-operation/report-work/index.vue

+ 22 - 4
src/views/pro-operation/report-work/index.vue

@@ -185,7 +185,6 @@ const getUserName = (index) => {
   currentUser.value = index;
 };
 const handleCheckAll = (person) => {
-  console.log("handleCheckAll", person);
   person.selectedProcess = [];
   if (person.checkAll) {
     person.selectedProcess = process.value;
@@ -200,7 +199,7 @@ const persons = ref<
   {
     userName: string | null;
     workingHoursRate: number | null;
-    selectedProcess: any;
+    selectedProcess: [];
     checkAll: boolean;
     startSelect: number | null;
     endSelect: number | null;
@@ -331,9 +330,28 @@ const queryUserList = () => {
 const minusCount = ref(0);
 
 const toSelectCount = ref(null);
+
 const startToSelectAheads = (per) => {
-  if (per.startSelect < 1 || per.endSelect < 1 || per.startSelect > per.endSelect || per.endSelect > per.total) {
-    ElMessage.error("请输入正确范围数字");
+  per.startSelect = Number(per.startSelect);
+  per.endSelect = Number(per.endSelect);
+  if (isNaN(per.startSelect) || isNaN(per.endSelect)) {
+    ElMessage.error("请输入有效的数字");
+    return;
+  }
+  if (per.startSelect === null || per.endSelect === null) {
+    ElMessage.error("请输入选中前面和后面的数量");
+    return;
+  }
+  if (per.startSelect > per.endSelect) {
+    ElMessage.error("前面数量不能大于后面数量");
+    return;
+  }
+  if (per.startSelect < 1 || per.endSelect < 1) {
+    ElMessage.error("前面和后面数量不能小于1");
+    return;
+  }
+  if (per.startSelect > per.total || per.endSelect > per.total) {
+    ElMessage.error("前面和后面数量不能大于管号总数");
     return;
   }
   per.selectedProcess = process.value.slice(per.startSelect - 1, per.endSelect);