From 057ce688e9fe904c1a74b2505531d5afc7acf43e Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期三, 10 九月 2025 23:03:56 +0800
Subject: [PATCH] 修复bug

---
 src/views/flowmgr/backImport2.vue |  242 +++++++++++++++++++++++++++++-------------------
 1 files changed, 145 insertions(+), 97 deletions(-)

diff --git a/src/views/flowmgr/backImport2.vue b/src/views/flowmgr/backImport2.vue
index 478f726..7270c63 100644
--- a/src/views/flowmgr/backImport2.vue
+++ b/src/views/flowmgr/backImport2.vue
@@ -1,22 +1,20 @@
 <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>
-          <el-button type="primary" size="default" icon="el-icon-circle-plus" plain @click="handleWarehouse"
-            style="margin-left: 12px;">鍏ュ簱</el-button>
         </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" :disabled="scope.row.processExecuted==true" text size="default" @click.stop="cancelProcess(scope.row, scope.index)">鎾ら攢</el-button>
+        <el-button type="primary" text size="default" @click.stop="hisFileView(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-dialog title="鏌ョ湅鏂囦欢" append-to-body v-model="fileViewModel">
+      <el-table ref="hisFilesTable" :data="tableData" border @row-click="showHisContent" max-height="200" highlight-current-row>
+        <el-table-column type="index" label="#" width="40" align="center" />
         <el-table-column prop="name" label="绋嬪簭鍚嶇О"></el-table-column>
       </el-table>
       <h4>绋嬪簭鍐呭</h4>
@@ -27,8 +25,9 @@
 
 <script>
 import {
-  getList,
+  getList,hisFileList
 } from '@/api/flowmgr/backImport';
+import { getRowIdentity } from 'element-plus/es/components/table/src/util';
 export default {
   data() {
     return {
@@ -36,8 +35,10 @@
       tableData: [],
       fileViewModel: false,
       selection: [],
+      selectedId:0,//鏌ョ湅鏂囦欢鐢紝褰撳墠閫夊畾琛岀殑id
       excelBox: false,
       loading: false,
+      query:{},
       option: {
         addBtn: false,
         editBtn: false,
@@ -45,33 +46,34 @@
         labelWidth: 120,
         emptyBtn: false,
         searchShow: true,
+        searchEnter:true,
         searchSpan: 8,
-        menu: false,
+        menu: true,
         // selection: true,
         column: [
           {
-              label: '鍏抽敭瀛�',
-              prop: 'keyword',
-              search: true,
-              searchType: 'input',
-              hide: true,
-              viewDisplay: false,
+            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: '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',
@@ -83,12 +85,12 @@
         ],
       },
       page: {
-                pageSize: 10,
-                currentPage: 1,
-                total: 0,
-            },
-            form: {},
-            query: {},
+        pageSize: 10,
+        currentPage: 1,
+        total: 0,
+      },
+      form: {},
+      query: {},
       data: [],
       excelForm: {},
       excelOption: {
@@ -113,73 +115,118 @@
     };
   },
   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 || ''
-            };*/
-            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)
-      axios({
-        url: '/blade-mdm/program/dncsendback/back-file-content',
-        method: 'get',
-        params: {entryName: row.entryName}
-      }).then(
-      res => {
-        console.log(res)
-        if(res.data.code === 200) {
-            this.appContent = res.data.data;
-        } else {
-            this.appContent = '绋嬪簭鍐呭鍔犺浇澶辫触'
-        }
+      this.page.currentPage = currentPage;
+      // this.onLoad();
+    },
+    sizeChange(pageSize) {
+      this.page.pageSize = pageSize;
+    },
+    refreshChange() {
+      this.onLoad(this.page, this.query);
+    },
+    /** * 椤甸潰鍔犺浇鏃惰幏鍙栨暟鎹�
+     */
+    onLoad(page, params = {}) {
+      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;
       });
     },
-    fileView(row) {
-      this.tableData = row.files;
-      this.fileViewModel = true;
+    showHisContent(row) {
+      //console.log(row)
+      axios({
+        url: '/blade-mdm/program/dncsendback/history-file-content',
+        method: 'get',
+        params: {id: this.selectedId, entryName: row.entryName }
+      }).then(
+        res => {
+          console.log(res)
+          if (res.data.code === 200) {
+            this.appContent = res.data.data;
+          } else {
+            this.appContent = '绋嬪簭鍐呭鍔犺浇澶辫触'
+          }
+        });
+    },
+    hisFileView(row) {
+      this.appContent='';//娓呯┖鍐呭
+      this.selectedId = row.id;
+      //this.tableData = [{name:'ttt','entryName':'entry1'}];
+      hisFileList({id: row.id}).then(res => {
+          this.tableData = res.data.data
+          this.loading = false;
+          if(this.tableData.length > 0){
+            this.showHisContent(this.tableData[0])
+            this.$refs.hisFilesTable.setCurrentRow(this.tableData[0]); // 璁剧疆绗竴琛岄珮浜�
+          }
+        }, () => {
+          this.tableData = [];
+          this.loading = false;
+        }).catch(err => {
+          console.log(err)
+          this.tableData = [];
+          this.loading = false;
+        });
+
+        this.fileViewModel = true;
+    },
+    cancelProcess(row) {
+      //鍙栨秷娴佺▼
+      this.$confirm('鏄惁鍙栨秷娴佺▼锛�', '', {
+                    confirmButtonText: this.$t('submitText'),
+                    cancelButtonText: this.$t('cancelText'),
+                    type: 'warning',
+      }).then(() => {
+          axios({
+            url: '/blade-mdm/program/dncsendback/cancel-process',
+            method: 'post',
+            params: { id: row.id }
+          }).then(
+            res => {
+              this.onLoad(this.page, this.query);
+            });
+      }).catch(()=>{
+        console.log('cancel')
+      })
     },
     selectionChange(selection) {
       this.selection = selection;
@@ -198,7 +245,7 @@
     },
     handleWarehouse() {
       if (this.selection.length == 0) {
-         return this.$message.error("璇烽�夋嫨鏁版嵁")
+        return this.$message.error("璇烽�夋嫨鏁版嵁")
       }
       let selection = [];
       this.selection.forEach(item => {
@@ -231,6 +278,7 @@
     }
   },
 };
+
 </script>
 
 <style lang="scss">

--
Gitblit v1.9.3