From c105b70fcf9819b5f597c254b395932f215ab98f Mon Sep 17 00:00:00 2001
From: gaoluyang <gaoluyang@rengu.cc>
Date: 星期三, 17 七月 2024 16:33:39 +0800
Subject: [PATCH] 批注工时批量审核批准修改

---
 src/components/tool/value-table.vue |   47 ++++++++++++++---------------------------------
 1 files changed, 14 insertions(+), 33 deletions(-)

diff --git a/src/components/tool/value-table.vue b/src/components/tool/value-table.vue
index 6416a82..8d20d12 100644
--- a/src/components/tool/value-table.vue
+++ b/src/components/tool/value-table.vue
@@ -1110,41 +1110,22 @@
       batchCheck(e) {
         if (this.multipleSelection && this.multipleSelection.length > 0) {
           const list = JSON.parse(JSON.stringify(this.multipleSelection))
+          const url = e === 0 ? this.$api.auxiliaryWorkingHoursDay.check : this.$api.auxiliaryWorkingHoursDay.approve
+          const state = e === 0 ? '宸插鏍�' : '宸叉壒鍑�'
           list.forEach(item => {
-            if (e == 0) {
-              item.state = '宸插鏍�'
-              this.$axios.post(this.$api.auxiliaryWorkingHoursDay.check, {
-                  ...item
-                },{
-                  headers: {
-                    'Content-Type': 'application/json'
-                  }
+            this.$axios.post(url, {id: item.id, state: state
+              },{
+                headers: {
+                  'Content-Type': 'application/json'
                 }
-              ).then(res => {
-                if (res.code === 201) {
-                  return
-                }
-                this.$parent.submitBatchCheckDialog()
-                this.$message.success('鎿嶄綔鎴愬姛')
-              })
-            } else {
-              item.state = '宸叉壒鍑�'
-              this.$axios.post(this.$api.auxiliaryWorkingHoursDay.approve, {
-                id: item.id,
-                state: item.state
-                },{
-                  headers: {
-                    'Content-Type': 'application/json'
-                  }
-                }
-              ).then(res => {
-                if (res.code === 201) {
-                  return
-                }
-                this.$parent.submitBatchCheckDialog()
-                this.$message.success('鎿嶄綔鎴愬姛')
-              })
-            }
+              }
+            ).then(res => {
+              if (res.code === 201) {
+                return
+              }
+              this.$parent.submitBatchCheckDialog()
+              this.$message.success('鎿嶄綔鎴愬姛')
+            })
           })
         } else {
           this.$message.error('璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�')

--
Gitblit v1.9.3