yangys
2025-09-10 057ce688e9fe904c1a74b2505531d5afc7acf43e
src/views/flowmgr/backImport2.vue
@@ -1,20 +1,19 @@
<template>
  <basic-container>
    <avue-crud :addBtn="false" :option="option" :table-loading="loading" :data="data" ref="crud"
      @current-change="currentChange" @search-change="searchChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
      @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-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>
@@ -26,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 {
@@ -35,6 +35,7 @@
      tableData: [],
      fileViewModel: false,
      selection: [],
      selectedId:0,//查看文件用,当前选定行的id
      excelBox: false,
      loading: false,
      query:{},
@@ -45,8 +46,9 @@
        labelWidth: 120,
        emptyBtn: false,
        searchShow: true,
        searchEnter:true,
        searchSpan: 8,
        menu: false,
        menu: true,
        // selection: true,
        column: [
          {
@@ -141,17 +143,6 @@
    /** * 页面加载时获取数据
     */
    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?.[0] || '';
      params.createTimeEnd = params?.createTime?.[1] || '';
      const data = {
        ...this.query,
        createTimeBegin: params.createTimeBegin,
@@ -161,11 +152,13 @@
      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,
            //id: v.processInstanceId,
          }
        });
        this.loading = false;
@@ -178,12 +171,12 @@
        this.loading = false;
      });
    },
    showContent(row, column, event) {
      console.log(row, 111)
    showHisContent(row) {
      //console.log(row)
      axios({
        url: '/blade-mdm/program/dncsendback/back-file-content',
        url: '/blade-mdm/program/dncsendback/history-file-content',
        method: 'get',
        params: { entryName: row.entryName }
        params: {id: this.selectedId, entryName: row.entryName }
      }).then(
        res => {
          console.log(res)
@@ -194,9 +187,46 @@
          }
        });
    },
    fileView(row) {
      this.tableData = row.files;
      this.fileViewModel = true;
    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;
@@ -248,6 +278,7 @@
    }
  },
};
</script>
<style lang="scss">