From cb04b8ed8a616c5b9fae9d432c093985b56f044c Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期四, 16 十月 2025 16:55:04 +0800
Subject: [PATCH] 任务导入+翻页修复

---
 src/views/flowmgr/programexport.vue     |  103 +++++++++++++++++++++----
 src/views/flowmgr/taskimp.vue           |  128 ++++++++++++++++++++++++++++++++
 src/views/statreport/newprogramming.vue |    4 
 3 files changed, 216 insertions(+), 19 deletions(-)

diff --git a/src/views/flowmgr/programexport.vue b/src/views/flowmgr/programexport.vue
index 5ea9bbf..50b4c6f 100644
--- a/src/views/flowmgr/programexport.vue
+++ b/src/views/flowmgr/programexport.vue
@@ -9,9 +9,8 @@
         <el-tabs v-model="activeName" type="card" class="demo-tabs" @tab-click="tabsClick">
             <el-tab-pane label="寰呭姙" name="todo">
                 <avue-crud :option="option" :search="searchData" :table-loading="loading" :data="data" v-model:page="page" v-model="form" ref="crud" @current-change="currentChange"
-                    @size-change="sizeChange" @refresh-change="refreshChange" @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange">
+                    @size-change="sizeChange" @refresh-change="refreshChange" @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange" @on-load="onLoad">
                     <template #menu-left>
-                      <!-- @on-load="onLoad"-->
                         <el-button type="primary" :disabled="this.selection.length==0" plain @click="exportExcel">瀵煎嚭</el-button>
                     </template>
                     <template #menu="scope">
@@ -19,11 +18,9 @@
                 </avue-crud>
             </el-tab-pane>
             <el-tab-pane label="宸插姙" name="completed">
-                <avue-crud :option="optionCompleted" :search="searchData" :table-loading="loading" :data="data" v-model:page="page" v-model="form" ref="crud1" @current-change="currentChange"
-                    @size-change="sizeChange" @refresh-change="refreshChange" @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange">
+                <avue-crud :option="optionCompleted" :search="searchData2" :table-loading="loading" :data="data2" v-model:page="page2" v-model="form" ref="crud1" @current-change="currentChange2"
+                    @size-change="sizeChange2" @refresh-change="refreshChange2" @search-change="searchChange2" @search-reset="searchReset2" @selection-change="selectionChange" @on-load="onLoad2">
                     <template #menu-left>
-                        <!-- <el-button type="primary" plain @click="exportWebSite">瀵煎嚭鍥炰紶娑夊瘑缃�</el-button> @on-load="onLoad" -->
-                        <!-- <el-button type="primary" plain @click="reassign">鎸傝浇杞﹀簥绋嬪簭搴�</el-button> -->
                         <el-button type="primary" :disabled="this.selection.length==0" plain @click="exportExcel">瀵煎嚭</el-button>
                     </template>
                     <template #menu="scope">
@@ -46,17 +43,24 @@
     data() {
         return {
             activeName: "todo",
-            // Define your data properties here
             page: {
+                pageSize: 10,
+                currentPage: 1,
+                total: 0,
+            },
+            page2: {
                 pageSize: 10,
                 currentPage: 1,
                 total: 0,
             },
             form: {},
             searchData:{},
+            searchData2:{},
             query: {},
+            query2: {},
             loading: true,
             data: [],
+            data2: [],
             selection: [],
             option: {
                 addBtn: false,
@@ -147,16 +151,13 @@
                 viewBtn: true,
                 columnBtn: false,
                 tip: false,
-                // simplePage: true,
                 searchShow: true,
                 searchEnter:true,
                 searchMenuSpan: 6,
                 dialogWidth: '60%',
-                // tree: true,
                 border: true,
                 index: true,
                 selection: true,
-                // viewBtn: true,
                 menuWidth: 200,
                 menu: false,
                 dialogClickModal: false,
@@ -197,6 +198,15 @@
                         search: true,
                     },
                     {
+                        label: '鏌ヨ鑼冨洿',
+                        prop: 'queryType',
+                        type: 'select',
+                        search: true,
+                        clearable:false,
+                        searchSpan:4,
+                        with: 100,
+                    },
+                    {
                         label: '閫氳繃鏃堕棿',
                         prop: 'createTime',
                         sortable: true,
@@ -211,6 +221,7 @@
                         prop: 'updateTime',
                         sortable: true,
                     },
+                    
                     {
                         label: '閫氳繃鏃堕棿',
                         prop: 'passTime',
@@ -230,21 +241,34 @@
     methods: {
         
         tabsClick(tab,event) {
-            this.onLoad(this.page, this.query);
+            if(tab.paneName == 'todo'){
+                this.onLoad(this.page, this.searchData);
+            }else{
+               // console.log(this.searchData2)
+                this.onLoad2(this.page2, this.searchData2);
+            }
         },
         selectionChange(list) {
             this.selection = list;
         },
-        // Define your methods here
+
         currentChange(currentPage) {
             this.page.currentPage = currentPage;
-            // this.onLoad();
+        },
+        currentChange2(currentPage) {
+            this.page2.currentPage = currentPage;
         },
         sizeChange(pageSize) {
             this.page.pageSize = pageSize;
         },
+        sizeChange2(pageSize) {
+            this.page2.pageSize = pageSize;
+        },
         refreshChange() {
             this.onLoad(this.page, this.query);
+        },
+        refreshChange2() {
+            this.onLoad2(this.page2, this.query2);
         },
         searchChange(params, done) {
             let data = {}
@@ -265,10 +289,34 @@
             this.onLoad(this.page, data);
             done();
         },
+        searchChange2(params, done) {
+            let data = {}
+            
+            this.query2 = params;
+            this.page2.currentPage = 1;
+            //console.log('searchChange', params);
+            params.passTimeBegin = params?.passTime?.[0] || '';
+            params.passTimeEnd = params?.passTime?.[1] || '';
+            //console.log(params);
+            data = {
+                createTimeBegin: params.passTimeBegin,
+                createTimeEnd: params.passTimeEnd,
+                name: params.name || '',
+                queryType:this.query2.queryType
+            }
+            this.query2 = data
+            this.onLoad2(this.page2, data);
+            done();
+        },
         searchReset() {
             this.query = {};
             this.query.queryType = this.searchData.queryType;
             this.onLoad(this.page);
+        },
+        searchReset2() {
+            this.query2 = {};
+            this.query2.queryType = this.searchData2.queryType;
+            this.onLoad2(this.page2);
         },
         /** * 椤甸潰鍔犺浇鏃惰幏鍙栨暟鎹�
          */
@@ -276,9 +324,7 @@
             const query = {
                 ...this.query,
             };
-            var status = this.activeName == 'todo'?null:2;
-            params.status = status;
-           
+          
             this.loading = true;
             getList(page.currentPage, page.pageSize, Object.assign(query, params)).then(res => {
                 const data = res.data.data;
@@ -290,6 +336,27 @@
                 this.loading = false;
             }).catch(err => {
                 this.data = [];
+                this.loading = false;
+            });
+        },
+        onLoad2(page, params = {}) {
+            const query = {
+                ...this.query2,
+            };
+
+            params.status = 2;
+            //params.queryType = this.searchData2.queryType;
+            this.loading = true;
+            getList(page.currentPage, page.pageSize, Object.assign(query, params)).then(res => {
+                const data = res.data.data;
+                this.page2.total = data.total;
+                this.data2 = data.records;
+                this.loading = false;
+            }, () => {
+                this.data2 = [];
+                this.loading = false;
+            }).catch(err => {
+                this.data2 = [];
                 this.loading = false;
             });
         },
@@ -371,11 +438,13 @@
         if(this.permission.program_allexport==true){
             queryTypeDicData.push({label:'鍏ㄩ儴鏁版嵁',value:'all'});
             this.searchData.queryType = 'all'
+            this.searchData2.queryType = 'all'
         }else{
             this.searchData.queryType = 'self';
+            this.searchData2.queryType = 'self';
         }
         this.option.column[7].dicData = queryTypeDicData;
-
+        this.optionCompleted.column[7].dicData = queryTypeDicData;
         this.onLoad(this.page, this.searchData);
     }
 }
diff --git a/src/views/flowmgr/taskimp.vue b/src/views/flowmgr/taskimp.vue
new file mode 100644
index 0000000..8358249
--- /dev/null
+++ b/src/views/flowmgr/taskimp.vue
@@ -0,0 +1,128 @@
+<template>
+  <basic-container>
+    
+    <el-text type="warning" style="margin-bottom:20px;">璇蜂笂浼犳淳宸xcel鏁版嵁鏂囦欢<br/></el-text>
+    <avue-form ref="form" style="margin-top: 50px;" :option="excelOption" v-model="excelForm" :upload-after="uploadAfter">
+      <template #excelTemplate>
+        <el-button type="plain" @click="handleDownloadTpl">
+          涓嬭浇<i class="el-icon-download"></i>
+        </el-button>
+      </template> 
+
+      <template #excelResult>
+        <el-button type="primary" :disabled="importResult.name == null" @click="handleDownload">
+          涓嬭浇<i class="el-icon-download el-icon--right"></i>
+        </el-button>
+      </template> 
+
+    </avue-form>
+  </basic-container>
+</template>
+
+<script>
+
+import { baseUrl } from '@/config/env';
+import { downloadFile,downloadXls } from '@/utils/util';
+import { exportBlob } from '@/api/common';
+import { getToken } from '@/utils/auth';
+import NProgress from 'nprogress';
+export default {
+  
+  watch: {
+    
+  },
+  data() {
+    return {
+    
+      loading: false,
+      fileId:0,
+      excelForm: {},
+      importResult:{},
+      excelOption: {
+        submitBtn: false,
+        emptyBtn: false,
+        column: [
+          {
+            label: '涓婁紶鏂囦欢',
+            prop: 'excelFile',
+            type: 'upload',
+            drag: true,
+            loadText: '浠诲姟鏂囦欢瀵煎叆锛岃绋嶇瓑',
+            //data:{authCode:this.excelForm.authCode},
+            span: 12,
+           /*propsHttp: {
+              res: 'data',
+            },*/
+            tip: '',
+            action: baseUrl+'/blade-mdm/flow/mgr/import-task',
+          },
+          {
+            label: '鏁版嵁妯℃澘',
+            prop: 'excelTemplate',
+            type: 'link',
+            span: 12,
+          },
+          {
+            label: '瀵煎叆缁撴灉',
+            prop: 'excelResult',
+            type: 'button',
+           span: 24,
+            tip: '',
+          },
+          
+        ],
+      },
+    };
+  },
+  methods: {
+   
+    uploadAfter(res, done, loading, column) {
+  
+      console.log('resdata',res.data);
+      if(res.code == 200){
+        this.importResult = res.data;
+        this.$message.success("瀵煎叆瀹屾垚锛岃鐐瑰嚮涓嬭浇鑾峰彇缁撴灉")
+      }else{
+        this.$message.error("瀵煎叆澶辫触锛�"+res.msg)
+      }
+      
+      done();
+    },
+    handleDownloadTpl(){
+      NProgress.start();
+      exportBlob(
+                    `/blade-mdm/flow/mgr/download-task-template`,
+                    { }
+                ).then(res => {
+                    let name = res.headers['content-disposition'].split('filename=')[1]
+                    //console.log(res.headers['content-disposition'].split('filename=')[1]);
+                    name = decodeURI(name)
+                    //console.log(name)
+                    downloadFile(res.data, `${name}`);
+                    NProgress.done();
+                });
+    },
+    handleDownload(){
+     //window.open(`${baseUrl}/blade-system/flowmgr/download-impreuslt?id=${this.fileId}&blade-auth=bearer ${getToken()}`);
+     // this.fileId =0;
+     exportBlob(
+                    `/blade-mdm/flow/mgr/download-import-result`,
+                    {name:this.importResult.name,originalName:this.importResult.originalName}
+       
+                ).then(res => {
+                    let name = res.headers['content-disposition'].split('filename=')[1]
+                    //console.log(res.headers['content-disposition'].split('filename=')[1]);
+                    name = decodeURI(name)
+                    //console.log(name)
+                    downloadFile(res.data, `${name}`);
+                    NProgress.done();
+                });
+
+    }
+  },
+};
+</script>
+
+<style lang="scss">
+
+</style>
\ No newline at end of file
diff --git a/src/views/statreport/newprogramming.vue b/src/views/statreport/newprogramming.vue
index dece841..3b6a6bf 100644
--- a/src/views/statreport/newprogramming.vue
+++ b/src/views/statreport/newprogramming.vue
@@ -32,7 +32,7 @@
             //tableData: [],
             viewRow: {},
             page: {
-                pageSize: 10,//
+                pageSize: 10,//10
                 currentPage: 1,
                 total: 0,
             },
@@ -193,7 +193,7 @@
         /** * 椤甸潰鍔犺浇鏃惰幏鍙栨暟鎹�
          */
         onLoad(page, params = {}) {
-            console.log('onLoad', page, params);
+            //console.log('onLoad', page, params);
             const data = {
                 ...this.query,
                 deptIds: params.deptIds,

--
Gitblit v1.9.3