From 154e92c793cecfce55ff013b5e6717e417d0f3b4 Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期五, 06 九月 2024 12:45:03 +0800
Subject: [PATCH] 1.日计时页面优化

---
 src/views/attendanceModule/attendanceDay.vue |   97 ++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 88 insertions(+), 9 deletions(-)

diff --git a/src/views/attendanceModule/attendanceDay.vue b/src/views/attendanceModule/attendanceDay.vue
index c4f94ea..54ae5eb 100644
--- a/src/views/attendanceModule/attendanceDay.vue
+++ b/src/views/attendanceModule/attendanceDay.vue
@@ -132,7 +132,7 @@
             sortable="custom"
           >
             <template slot-scope="{row}">
-              {{ row.checkindate?row.checkindate.substring(0,11):'/' }}
+              {{ row.checkindate ? row.checkindate.substring(0, 11) : '/' }}
             </template>
           </el-table-column>
 
@@ -161,23 +161,52 @@
             prop="deductcount"
             label="鎵i櫎鏃堕暱(灏忔椂)"
             sortable="custom"
-          />
+          >
+            <template slot-scope="{row}">
+              <div v-if="row.isEdit">
+                <el-input
+                  v-model="dialogForm.deductcount"
+                  oninput="value=value.replace(/[^0-9.]/g,'')"
+                  style="width: 100%"
+                />
+              </div>
+              <div v-else>{{ row.deductcount }}</div>
+            </template>
+          </el-table-column>
+
           <el-table-column
             prop="deductmoney"
             label="鎵i櫎钖祫(鍏�)"
             sortable="custom"
-          />
+          >
+            <template slot-scope="{row}">
+              <div v-if="row.isEdit">
+                <el-input
+                  v-model="dialogForm.deductmoney"
+                  oninput="value=value.replace(/[^0-9.]/g,'')"
+                  style="width: 100%"
+                />
+              </div>
+              <div v-else>{{ row.deductmoney }}</div>
+            </template>
+          </el-table-column>
+          <!--          <el-input-->
+          <!--            v-model="dialogForm.deductcount"-->
+          <!--            oninput="value=value.replace(/[^0-9.]/g,'')"-->
+          <!--            style="width: 200px"-->
+          <!--          />-->
           <el-table-column
             prop="timimoney"
             label="璁℃椂宸ヨ祫(鍏�)"
             sortable="custom"
           />
+
           <el-table-column
             label="缁撶畻宸ヨ祫(鍏�)"
             sortable="custom"
           >
             <template slot-scope="{row}">
-              {{ parseFloat((parseFloat(row.timimoney)-parseFloat(row.deductmoney)).toFixed(2)) }}
+              {{ parseFloat((parseFloat(row.timimoney) - parseFloat(row.deductmoney)).toFixed(2)) }}
             </template>
           </el-table-column>
           <el-table-column
@@ -189,12 +218,33 @@
               <div class="operationClass">
                 <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top">
                   <i
-                    v-if="row.leve!==0"
+                    v-if="!row.isEdit"
                     class="el-icon-edit-outline"
                     :style="{color:$store.state.settings.theme}"
                     @click="edit('edit',row)"
                   />
                 </el-tooltip>
+
+                <el-tooltip class="item" effect="dark" content="淇濆瓨" placement="top">
+                  <i
+                    v-if="row.isEdit"
+                    class="el-icon-circle-check"
+                    style="cursor: pointer;"
+                    :style="{color:$store.state.settings.theme}"
+                    @click="save(row)"
+                  />
+                </el-tooltip>
+
+                <el-tooltip class="item" effect="dark" content="鍙栨秷" placement="top">
+                  <i
+                    v-if="row.isEdit"
+                    class="el-icon-circle-close"
+                    style="cursor: pointer;margin-left: 15px;"
+                    :style="{color:$store.state.settings.theme}"
+                    @click="cancel(row)"
+                  />
+                </el-tooltip>
+
                 <!--                <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">-->
                 <!--                  <i-->
                 <!--                    v-if="row.leve!==0"-->
@@ -205,6 +255,7 @@
                 <!--                </el-tooltip>-->
               </div>
             </template>
+
           </el-table-column>
         </el-table>
       </div>
@@ -441,6 +492,9 @@
         rows: this.form.rows
       }
       const res = await DailyWageReportSearch(data)
+      res.data.forEach(i => {
+        i.isEdit = false
+      })
       this.tableData = res.data
       this.total = res.count
     },
@@ -472,11 +526,36 @@
     },
     // 淇敼鎸夐挳
     async edit(operation, row) {
+      this.dialogForm = { ...row }
+      row.isEdit = true
       this.operation = operation
-      this.dialogVisible = true
-      this.$nextTick(() => {
-        this.dialogForm = { ...row }
+      // this.operation = operation
+      // this.dialogVisible = true
+      // this.$nextTick(() => {
+      //   this.dialogForm = { ...row }
+      // })
+    },
+    save(row) {
+      if (this.dialogForm.deductcount.toString().trim().length === 0) {
+        return this.$message.info('鎵i櫎鏃堕暱鐨勬渶灏忓�间负闆讹紒')
+      }
+      if (this.dialogForm.deductmoney.toString().trim().length === 0) {
+        return this.$message.info('鎵i櫎钖祫鐨勬渶灏忓�间负闆讹紒')
+      }
+
+      DailyWageReportUpdate(this.dialogForm, 'Update').then(res => {
+        if (res.code === '200') {
+          this.$notify.success('淇敼鎴愬姛锛�')
+          row.isEdit = false
+          this.getDailyWageReportSearch()
+        } else {
+          this.$notify.error('淇敼澶辫触锛�')
+        }
       })
+    },
+    cancel(row) {
+      row.isEdit = false
+      this.getDailyWageReportSearch()
     },
     // 鍒犻櫎鎸夐挳
     // async del(row) {
@@ -535,7 +614,7 @@
         }
       })
     },
-    async  download() {
+    async download() {
       let tempDate = this.form.creatdate
       if (tempDate.length > 0) {
         tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1])

--
Gitblit v1.9.3