From 2ec3250c83921ba91836ef8af129a74fef9d3c6a Mon Sep 17 00:00:00 2001
From: lzhe <181968431@qq.com>
Date: 星期日, 01 十二月 2024 23:30:47 +0800
Subject: [PATCH] 1

---
 src/views/mdc/first-workpiece.vue |   51 +++++++++++++++++++++++++++++++++++----------------
 1 files changed, 35 insertions(+), 16 deletions(-)

diff --git a/src/views/mdc/first-workpiece.vue b/src/views/mdc/first-workpiece.vue
index 47776a2..fb76a12 100644
--- a/src/views/mdc/first-workpiece.vue
+++ b/src/views/mdc/first-workpiece.vue
@@ -2,7 +2,7 @@
  * @Author: lzhe lzhe@example.com
  * @Date: 2024-04-26 09:36:18
  * @LastEditors: lzhe lzhe@example.com
- * @LastEditTime: 2024-11-22 18:45:06
+ * @LastEditTime: 2024-11-27 15:44:14
  * @FilePath: /smart-web/src/views/mdc/status-record.vue
  * @Description: 杩欐槸榛樿璁剧疆,璇疯缃甡customMade`, 鎵撳紑koroFileHeader鏌ョ湅閰嶇疆 杩涜璁剧疆: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 -->
@@ -20,7 +20,7 @@
                             <el-input v-model="searchInfo.workstationName"></el-input>
                           </el-form-item>
                           <el-form-item label="寮�濮嬫椂闂�">
-                            <el-date-picker v-model="searchInfo.startDate" format="YYYY-MM-DD" value-format="YYYY-MM-DD" @change="changeStartDate" type="date" placeholder="閫夋嫨鏃ユ湡"></el-date-picker>
+                            <el-date-picker v-model="searchInfo.startDate" format="YYYY-MM-DD" value-format="YYYY-MM-DD" type="date" placeholder="閫夋嫨鏃ユ湡"></el-date-picker>
                           </el-form-item>
                           <el-form-item label="缁撴潫鏃堕棿">
                             <el-date-picker v-model="searchInfo.endDate" format="YYYY-MM-DD" value-format="YYYY-MM-DD" type="date" placeholder="閫夋嫨鏃ユ湡"></el-date-picker>
@@ -62,19 +62,14 @@
                                     {{ convertSeconds(scope.row.firstWorkingSecs || 0) }}
                                 </template>
                             </el-table-column>
-                            <el-table-column prop="firstWorkingSecs" label="棣栦欢鍒囧墛鏃堕棿" width="100">
+                            <el-table-column prop="firstMeasureSecs" label="棣栦欢璁¢噺鏃堕棿" width="100">
                                 <template #default="scope">
-                                    {{ convertSeconds(scope.row.firstWorkingSecs || 0) }}
+                                    {{ convertSeconds(scope.row.firstMeasureSecs || 0) }}
                                 </template>
                             </el-table-column>
                             <el-table-column prop="lastRemoveSecs" label="鏈欢鎷嗗嵏鏃堕棿" width="100">
                                 <template #default="scope">
                                     {{ convertSeconds(scope.row.lastRemoveSecs || 0) }}
-                                </template>
-                            </el-table-column>
-                            <el-table-column prop="firstMeasureSecs" label="棣栦欢璁¢噺鏃堕棿" width="100">
-                                <template #default="scope">
-                                    {{ convertSeconds(scope.row.firstMeasureSecs || 0) }}
                                 </template>
                             </el-table-column>
                             <el-table-column prop="processingSecs" label="鍔犲伐鏃堕棿" width="80">
@@ -94,6 +89,7 @@
                             </el-table-column>
                             <el-table-column prop="amount" label="鏁伴噺" width="60"></el-table-column>
                         </el-table>
+                        <el-pagination background layout="total, prev, pager, next" :total="total" style="margin-top: 12px;" @current-change="handleCurrentChange"></el-pagination>
                     </el-main>
                     <el-footer>
                         <el-button type="primary" @click="goFirstWorkDetail">璇︽儏</el-button>
@@ -127,7 +123,11 @@
             },
             tabPosition: "璁惧缁撴瀯鏍�",
             tableData: [],
-            treeChecked: []
+            treeChecked: [],
+            ids: [],
+            total: 0,
+            current: 1,
+            size: 20
         }
     },
     created() {
@@ -137,9 +137,18 @@
         // }
     },
     mounted() {
-        //this.getTableData();
+        var date = new Date();
+        var threeDaysInMilliseconds = 3 * 24 * 60 * 60 * 1000;
+        var threeDaysAgo = new Date(date.getTime() - threeDaysInMilliseconds);
+        this.searchInfo.startDate = threeDaysAgo.toLocaleDateString().replace(/\//g,"-");
+        this.searchInfo.endDate = date.toLocaleDateString().replace(/\//g,"-");
+        this.getTableData();
     },
     methods: {
+        handleCurrentChange(val) {
+            this.current = val;
+            this.getTableData();
+        },
         convertSeconds(seconds) {  //杞崲鏃堕棿
             // 瀹氫箟鏃堕棿鍗曚綅杞崲鍏崇郴
             const daysInSeconds = 24 * 60 * 60;
@@ -183,27 +192,37 @@
             return result.join(' ');
         },
         changeStartDate(val) {
-            console.log(val,111)
         },
         searchBtn() {
+            if(!this.searchInfo.startDate || !this.searchInfo.endDate) {
+                this.$message.error('閫夋嫨寮�濮嬨�佺粨鏉熸椂闂存煡璇�');
+                return;
+            }
             this.getTableData();
         },
         getTableData() {
-            console.log(this.searchInfo,111)
-            this.$HTTP.post('/workinghour/page?current=1&size=20', this.searchInfo).then(res => {
+            this.$HTTP.post(`/api/workinghour/page?current=${this.current}&size=${this.size}`, this.searchInfo).then(res => {
                 if (res.code === 200) {
                     res.data.records.forEach((item,index)=> {
                         item.index = index + 1;
                     })
                     this.tableData = res.data.records;
+                    this.total = res.data.total;
                 }
             })
         },
         goFirstWorkDetail() {
-            this.$router.push({path: `/mdc/first-workpiece-detail`,query: {id:1}})
+            if(this.ids.length == 0) {
+                this.$message.error("璇峰厛閫夋嫨鏁版嵁");
+                return;
+            }
+            this.$router.push({path: `/mdc/first-workpiece-detail`,query: {ids: this.ids.join(',')}})
         },
         handleSelectionChange(val) {
-            console.log(val);
+            this.ids = [];
+            val.forEach(item=> {
+                this.ids.push(item.id);
+            })
         },
         query() {
             

--
Gitblit v1.9.3