Przeglądaj źródła

报工全选。

jiaxiaoqiang 5 miesięcy temu
rodzic
commit
355bb66b9b
2 zmienionych plików z 38 dodań i 29 usunięć
  1. 1 0
      .gitignore
  2. 37 29
      src/views/pro-operation/report-work/index.vue

+ 1 - 0
.gitignore

@@ -1,6 +1,7 @@
 node_modules
 .DS_Store
 dist
+dist.zip
 dist-ssr
 *.local
 .history

+ 37 - 29
src/views/pro-operation/report-work/index.vue

@@ -49,7 +49,6 @@
               </el-col>
             </el-row>
 
-
             <el-row
               v-for="(per, index) in persons"
               :key="per.userName"
@@ -101,13 +100,16 @@
                     @visible-change="visibleSeq"
                   >
                     <template #prefix
-                    ><img src="@/assets/icons/shaoma.svg"
+                      ><img src="@/assets/icons/shaoma.svg"
                     /></template>
-<!--                    <template #header>
-                      <el-checkbox v-model="checkAll" @change="handleCheckAll">
+                    <template #header>
+                      <el-checkbox
+                        v-model="per.checkAll"
+                        @change="handleCheckAll(per)"
+                      >
                         全选
                       </el-checkbox>
-                    </template>-->
+                    </template>
                     <el-option
                       v-for="item in process"
                       :key="item"
@@ -126,6 +128,7 @@
                         userName: null,
                         workingHoursRate: 100,
                         selectedProcess: [],
+                        checkAll: false,
                       })
                     "
                   />
@@ -182,31 +185,29 @@ const selectedSign = ref<any[]>([]);
 const operateCondition = ref("");
 
 const checkAll = ref(false);
-const x = () => {
-
-}
+const x = () => {};
 const process = ref([]);
-const visibleSeq = (val) =>{
-
-  if(val){
+const visibleSeq = (val) => {
+  if (val) {
     process.value = processList.value;
-    if(persons.value&&persons.value.length>0){
-       for(let element of persons.value){
-          if(element.selectedProcess&&element.selectedProcess.length>0){
-            for(let e of element.selectedProcess){
-              process.value=process.value.filter(item=>item!==e);
-            }
+    if (persons.value && persons.value.length > 0) {
+      for (let element of persons.value) {
+        if (element.selectedProcess && element.selectedProcess.length > 0) {
+          for (let e of element.selectedProcess) {
+            process.value = process.value.filter((item) => item !== e);
           }
-       }
+        }
+      }
     }
   }
-}
-const handleCheckAll = (val) => {
-  console.log(val);
-  if (val) {
-    selectedProcess.value = processList.value;
+};
+const handleCheckAll = (person) => {
+  console.log("handleCheckAll", person);
+  person.selectedProcess = [];
+  if (person.checkAll) {
+    person.selectedProcess = process.value;
   } else {
-    selectedProcess.value = [];
+    person.selectedProcess = [];
   }
 };
 
@@ -217,14 +218,21 @@ const persons = ref<
     userName: string | null;
     workingHoursRate: number | null;
     selectedProcess: any;
+    checkAll: boolean;
   }[]
->([{ userName: userStore.user.username ?? "", workingHoursRate: 100,selectedProcess:[] }]);
+>([
+  {
+    userName: userStore.user.username ?? "",
+    workingHoursRate: 100,
+    selectedProcess: [],
+    checkAll: false,
+  },
+]);
 
 const removeSeq = (item) => {
   console.log();
-  selectedProcess.value = selectedProcess.value.filter(e=>e !== item);
-
-}
+  selectedProcess.value = selectedProcess.value.filter((e) => e !== item);
+};
 const openReportWorkDrawer = () => {
   checkAll.value = false;
   selectedProcess.value = []; //需要清空已经选择的流转卡号
@@ -262,7 +270,7 @@ const confirmClick = () => {
   persons.value.forEach((item) => {
     total += item.workingHoursRate ?? 0;
   });
- /* if (total > 100) {
+  /* if (total > 100) {
     ElMessage.error("总占比不能超过100%");
     return;
   }*/