From 8f599ec77e7be9aa461a208333843cb6148f8561 Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期四, 21 八月 2025 09:45:34 +0800
Subject: [PATCH] 增加回车分页功能

---
 src/views/flowmgr/backImport2.vue |  174 ++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 110 insertions(+), 64 deletions(-)

diff --git a/src/views/flowmgr/backImport2.vue b/src/views/flowmgr/backImport2.vue
index a5c91fc..ba82556 100644
--- a/src/views/flowmgr/backImport2.vue
+++ b/src/views/flowmgr/backImport2.vue
@@ -1,8 +1,7 @@
 <template>
   <basic-container>
-    <avue-crud :addBtn="false" :option="option" :table-loading="loading" :data="data" ref="crud" @current-change="currentChange"
-            @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad"
-      >
+    <avue-crud :addBtn="false" :option="option" :table-loading="loading" :data="data" ref="crud"
+      @current-change="currentChange" v-model:page="page" @search-change="searchChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
       <template #menu-left>
         <!-- <div style="display: flex;">
           <el-button type="primary" size="default" icon="el-icon-circle-plus" @click="importData">瀵煎叆</el-button>
@@ -11,12 +10,12 @@
         </div> -->
       </template>
       <template #menu="scope">
-          <!-- <el-button type="primary" text size="default" @click.stop="fileView(scope.row, scope.index)">鏌ョ湅鏂囦欢</el-button> -->
+        <!-- <el-button type="primary" text size="default" @click.stop="fileView(scope.row, scope.index)">鏌ョ湅鏂囦欢</el-button> -->
       </template>
     </avue-crud>
     <el-dialog title="鏂囦欢鍚嶇О" append-to-body v-model="fileViewModel">
       <el-table :data="tableData" border @row-click="showContent" max-height="200" highlight-current-row>
-        <el-table-column type="index" label="#" width="40" align="center"/>
+        <el-table-column type="index" label="#" width="40" align="center" />
         <el-table-column prop="name" label="绋嬪簭鍚嶇О"></el-table-column>
       </el-table>
       <h4>绋嬪簭鍐呭</h4>
@@ -38,37 +37,59 @@
       selection: [],
       excelBox: false,
       loading: false,
+      query:{},
       option: {
         addBtn: false,
         editBtn: false,
         delBtn: false,
         labelWidth: 120,
         emptyBtn: false,
+        searchShow: true,
+        searchEnter:true,
         searchSpan: 8,
-        menu: true,
+        menu: false,
         // selection: true,
         column: [
           {
-            label: '绋嬪簭缂栧彿',
-            prop: 'code'
+            label: '鍏抽敭瀛�',
+            prop: 'keyword',
+            search: true,
+            searchType: 'input',
+            hide: true,
+            viewDisplay: false,
           },
+          {
+            label: '瀵煎叆鏃堕棿',
+            prop: 'createTime',
+            type: 'datetime',
+            format: 'YYYY-MM-DD HH:mm:ss',
+            valueFormat: 'YYYY-MM-DD HH:mm:ss',
+            search: true,
+            searchRange: true,
+            hide: true,
+          },
+          {
+            label: '绋嬪簭鍖呭悕',
+            prop: 'name',
+          },
+
           {
             label: '鏈哄簥缂栧彿',
             prop: 'machineCode',
           },
           {
-            label: '鏂囦欢鍚嶇О',
-            prop: 'name',
+            label: '瀵煎叆鏃堕棿',
+            prop: 'createTime'
           },
         ],
       },
       page: {
-                pageSize: 10,
-                currentPage: 1,
-                total: 0,
-            },
-            form: {},
-            query: {},
+        pageSize: 10,
+        currentPage: 1,
+        total: 0,
+      },
+      form: {},
+      query: {},
       data: [],
       excelForm: {},
       excelOption: {
@@ -93,61 +114,86 @@
     };
   },
   methods: {
+    searchChange(params, done) {
+      let data = {}
+      this.query = params;
+      this.page.currentPage = 1;
+      params.createTimeBegin = params?.createTime?.[0] || '';
+      params.createTimeEnd = params?.createTime?.[1] || '';
+      data = {
+        createTimeBegin: params.createTimeBegin || undefined,
+        createTimeEnd: params.createTimeEnd || undefined,
+        keyword: params.keyword || undefined,
+      }
+      this.query = data
+      this.onLoad(this.page, data);
+      done();
+    },
     currentChange(currentPage) {
-            this.page.currentPage = currentPage;
-            // this.onLoad();
-        },
-        sizeChange(pageSize) {
-            this.page.pageSize = pageSize;
-        },
-        refreshChange() {
-            this.onLoad(this.page, this.query);
-        },
-        /** * 椤甸潰鍔犺浇鏃惰幏鍙栨暟鎹�
-         */
-        onLoad(page, params = {}) {
-            console.log('onLoad', page, params);
-            const data = {
-                ...this.query,
-                createTimeBegin: params.createTimeBegin,
-                createTimeEnd: params.createTimeEnd,
-                keyword: params.keyword || '',
-                myProcessName: params.myProcessName || ''
-            };
-            this.loading = true;
-            getList(page.currentPage, page.pageSize, Object.assign(data, params)).then(res => {
-                const data = res.data.data
-                this.page.total = data.total;
-                this.data = data.records.map(v=> {
-                    return {
-                        ...v,
-                        id: v.processInstanceId,
-                    }
-                });
-                this.loading = false;
-            }, () => {
-                this.data = [];
-                this.loading = false;
-            }).catch(err => {
-                this.data = [];
-                this.loading = false;
-            });
-        },
+      this.page.currentPage = currentPage;
+      // this.onLoad();
+    },
+    sizeChange(pageSize) {
+      this.page.pageSize = pageSize;
+    },
+    refreshChange() {
+      this.onLoad(this.page, this.query);
+    },
+    /** * 椤甸潰鍔犺浇鏃惰幏鍙栨暟鎹�
+     */
+    onLoad(page, params = {}) {
+      console.log('onLoad', page, params);
+      /*
+      const data = {
+          ...this.query,
+          createTimeBegin: params.createTimeBegin,
+          createTimeEnd: params.createTimeEnd,
+          keyword: params.keyword || '',
+          myProcessName: params.myProcessName || ''
+      };*/
+      //params.createTimeBegin = params?.createTime;
+      //params.createTimeEnd = params?.createTime?.[1] || '';
+      const data = {
+        ...this.query,
+        createTimeBegin: params.createTimeBegin,
+        createTimeEnd: params.createTimeEnd,
+        keyword: params.keyword || ''
+      };
+      this.loading = true;
+      getList(page.currentPage, page.pageSize, Object.assign(data, params)).then(res => {
+        const data = res.data.data
+        this.page.total = data.total;
+        this.data = data.records.map(v => {
+          return {
+            ...v,
+            id: v.processInstanceId,
+          }
+        });
+        this.loading = false;
+      }, () => {
+        this.data = [];
+        this.loading = false;
+      }).catch(err => {
+        console.log(err)
+        this.data = [];
+        this.loading = false;
+      });
+    },
     showContent(row, column, event) {
-      console.log(row,111)
+      console.log(row, 111)
       axios({
         url: '/blade-mdm/program/dncsendback/back-file-content',
         method: 'get',
-        params: {entryName: row.entryName}
+        params: { entryName: row.entryName }
       }).then(
-      res => {
-        console.log(res)
-        if(res.data.code === 200) {
+        res => {
+          console.log(res)
+          if (res.data.code === 200) {
             this.appContent = res.data.data;
-        } else {
+          } else {
             this.appContent = '绋嬪簭鍐呭鍔犺浇澶辫触'
-        }
-      });
+          }
+        });
     },
     fileView(row) {
       this.tableData = row.files;
@@ -170,7 +216,7 @@
     },
     handleWarehouse() {
       if (this.selection.length == 0) {
-         return this.$message.error("璇烽�夋嫨鏁版嵁")
+        return this.$message.error("璇烽�夋嫨鏁版嵁")
       }
       let selection = [];
       this.selection.forEach(item => {

--
Gitblit v1.9.3