<template>
  <!--  <div class="app-container">-->
  <div>
    <el-card shadow="hover">
      <!-- 查询表单区域 -->
      <el-form :model="queryParams" ref="queryForm" size="small" inline label-position="top">
        <el-row :gutter="20">
          <el-col :span="6">
            <el-form-item label="项目名称" prop="projectName">
              <el-input v-model.trim="queryParams.projectName" placeholder="请输入项目名称" clearable
                @keyup.enter.native="handleQuery" />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="项目概况" prop="projectOverview">
              <el-input v-model.trim="queryParams.projectOverview" placeholder="请输入项目概况" clearable
                @keyup.enter.native="handleQuery" />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="项目亮点" prop="projectSparkle">
              <el-input v-model.trim="queryParams.projectSparkle" placeholder="请输入项目亮点" clearable
                @keyup.enter.native="handleQuery" />
            </el-form-item>
          </el-col>
          <el-col :span="6">

          </el-col>
        </el-row>

        <el-row :gutter="20">
          <el-col :span="6">

          </el-col>
          <el-col :span="6">

          </el-col>
          <el-col :span="6"></el-col>
          <el-col :span="6"></el-col>
        </el-row>
        <!-- 可继续扩展其他查询表单项目，比如项目编号、负责人等 -->
        <el-row :gutter="20">
          <el-col :span="6">
            <el-form-item label="搜索">
              <el-button style="width: 100%;" type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="重置">
              <el-button style="width: 100%;" icon="el-icon-refresh" type="primary" @click="resetQuery">重置</el-button>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="导出">
              <el-button style="width: 100%;" type="primary" icon="el-icon-download"
                @click="exportQuery">导出</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <!-- Tab 切换区域 -->
      <el-tabs v-model="activeTab" type="border-card" @tab-click="handleTabClick">
        <el-tab-pane label="待办任务" name="list1">
          <!-- 列表一内容 -->
          <el-table height="450" ref="dataTable" @row-click="clickRow" class="tableWrapper" v-loading="loading" border
            :data="myTaskList">
            <!--            <el-table-column type="selection" width="40" align="center" />-->
            <el-table-column type="index" label="序号" width="50" align="center"></el-table-column>

            <el-table-column label="项目名称" align="center" prop="projectName">
              <template slot-scope="scope">
                <div :title="scope.row.projectName" class="public-text-blue public-cursor"
                  @click.stop="handleInvestOppDetail(scope.row)">
                  {{ scope.row.projectName }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="所属行业" align="center" prop="industry" width="60"><template slot-scope="scope">
                <dict-tag :options="dict.type.CUSTOMER_TRADE" :value="scope.row.industry" />
              </template>
            </el-table-column>
            <el-table-column label="项目阶段" align="center" prop="projectStage" width="60">
              <template slot-scope="scope">
                <dict-tag :options="dict.type.project_stage" :value="scope.row.projectStage" />
              </template>
            </el-table-column>
            <!--            <el-table-column
              label="项目状态"
              align="center"
              prop="projectState"
              width="120"
            >
              <template slot-scope="scope">
                <dict-tag
                  :options="dict.type.project_state"
                  :value="scope.row.projectState"
                />
              </template>
            </el-table-column>-->
            <el-table-column label="项目机会状态" align="center" prop="projectStatus" width="90">
              <template slot-scope="scope">
                <!-- 定义状态文本映射对象 -->
                <el-tag :type="{
                  0: 'success',
                  1: 'danger',
                  2: 'warning'
                }[scope.row.projectStatus] || 'info'">
                  {{ {
                    0: '正常',
                    1: '终止',
                    2: '观望'
                  }[scope.row.projectStatus] || '未知状态' }}
                </el-tag>
              </template>
            </el-table-column>
            <el-table-column label="项目负责人" align="center" prop="investHead" width="80">
              <template slot-scope="scope">
                <div :title="scope.row.investHead">
                  {{ scope.row.investHead }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="项目概况" align="center" prop="projectOverview" width="70">
              <template slot-scope="scope">
                <div :title="scope.row.projectOverview">
                  {{ scope.row.projectOverview }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="项目亮点" align="center" prop="projectSparkle" width="70">
              <template slot-scope="scope">
                <div :title="scope.row.projectSparkle">
                  {{ scope.row.projectSparkle }}
                </div>
              </template>
            </el-table-column>
            <!-- delFlag -->
            <el-table-column label="状态" align="center" prop="delFlag" width="40">
              <template slot-scope="scope">
                <div :title="scope.row.delFlag === '1' ? '终止' : '正常'">
                  {{ scope.row.delFlag === "1" ? "终止" : "正常" }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="申请人" align="center" prop="startUserName" width="50">
              <template slot-scope="scope">
                <div :title="scope.row.startUserName">
                  {{ scope.row.startUserName }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="申请日期" align="center" prop="createTime" width="80">
              <template slot-scope="scope">
                <span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d}") }}</span>
              </template>
            </el-table-column>
            <el-table-column label="当前节点" align="center" prop="taskName" width="60">
              <template slot-scope="scope">
                <div :title="scope.row.taskName" class="public-text-blue public-cursor"
                  @click="handleReadImage(scope.row)">
                  {{ scope.row.taskName }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="当前处理人" align="center" prop="assigneeName" width="80">
              <template slot-scope="scope">
                <div :title="scope.row.assigneeName">
                  {{ scope.row.assigneeName }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="流程状态" align="center" prop="status" width="60">
              <template slot-scope="scope">
                <div :title="scope.row.status">
                  <span v-if="scope.row.status === 0">暂存</span>
                  <span v-else-if="scope.row.status === 1">已提交</span>
                  <span v-else-if="scope.row.status === 2">审批中</span>
                  <span v-else-if="scope.row.status === 3">审批完成</span>
                  <span v-else-if="scope.row.status === 4">关闭</span>
                </div>
              </template>
            </el-table-column>
            <!--  -->
            <el-table-column label="操作" align="center" width="90" class-name="small-padding fixed-width">
              <template slot-scope="scope">

                <el-button v-if="scope.row.taskDefKey == 'modifyApply'" type="text" size="small"
                  @click="handleEdit(scope.row)">处理</el-button>
                <template v-else>
                  <!-- 1. 签收按钮：无签收人时显示 -->
                  <el-button v-if="!scope.row.assignee" type="text" size="small"
                    @click="handleSign(scope.row)">签收</el-button>
                  <!-- 2. 处理按钮：有签收人时显示 -->
                  <el-button v-else type="text" size="small" @click="handleProcess(scope.row)">处理</el-button>
                  <!-- 3. 撤回按钮：需补充逻辑（比如仅未签收可撤回，可结合 signPerson 判断） -->
                  <!--                <el-button v-if="!scope.row.assignee" type="text" size="small" icon="el-icon-refresh-right" @click="handleWithdraw(scope.row)">撤回</el-button>-->
                  <!-- 4. 详情按钮：一直显示 -->

                </template>
                <el-button style="color:#1890ff" type="text" size="small" @click="handleDetail(scope.row)">详情</el-button>
              </template>
            </el-table-column>
          </el-table>

          <!-- 分页 -->
          <pagination v-show="myTaskTotal > 0" :total="myTaskTotal" :page.sync="queryParams.pageNum"
            :limit.sync="queryParams.pageSize" @pagination="getMyTaskList" />
        </el-tab-pane>

        <el-tab-pane label="已办任务" name="list2">
          <!-- 我的单据表格 -->
          <!-- 列表一内容 -->
          <el-table height="450" ref="dataTable" @row-click="clickRow" class="tableWrapper" v-loading="loading" border
            :data="myDoneTaskList">
           <el-table-column type="index" label="序号" width="50" align="center"></el-table-column>

            <el-table-column label="项目名称" align="center" prop="projectName">
              <template slot-scope="scope">
                <div :title="scope.row.projectName" class="public-text-blue public-cursor"
                  @click.stop="handleInvestOppDetail(scope.row)">
                  {{ scope.row.projectName }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="所属行业" align="center" prop="industry" width="60"><template slot-scope="scope">
                <dict-tag :options="dict.type.CUSTOMER_TRADE" :value="scope.row.industry" />
              </template>
            </el-table-column>
            <el-table-column label="项目阶段" align="center" prop="projectStage" width="60">
              <template slot-scope="scope">
                <dict-tag :options="dict.type.project_stage" :value="scope.row.projectStage" />
              </template>
            </el-table-column>
            <!--            <el-table-column
              label="项目状态"
              align="center"
              prop="projectState"
              width="120"
            >
              <template slot-scope="scope">
                <dict-tag
                  :options="dict.type.project_state"
                  :value="scope.row.projectState"
                />
              </template>
            </el-table-column>-->
            <el-table-column label="项目机会状态" align="center" prop="projectStatus" width="90">
              <template slot-scope="scope">
                <!-- 定义状态文本映射对象 -->
                <el-tag :type="{
                  0: 'success',
                  1: 'danger',
                  2: 'warning'
                }[scope.row.projectStatus] || 'info'">
                  {{ {
                    0: '正常',
                    1: '终止',
                    2: '观望'
                  }[scope.row.projectStatus] || '未知状态' }}
                </el-tag>
              </template>
            </el-table-column>
            <el-table-column label="项目负责人" align="center" prop="investHead" width="80">
              <template slot-scope="scope">
                <div :title="scope.row.investHead">
                  {{ scope.row.investHead }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="项目概况" align="center" prop="projectOverview" width="70">
              <template slot-scope="scope">
                <div :title="scope.row.projectOverview">
                  {{ scope.row.projectOverview }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="项目亮点" align="center" prop="projectSparkle" width="70">
              <template slot-scope="scope">
                <div :title="scope.row.projectSparkle">
                  {{ scope.row.projectSparkle }}
                </div>
              </template>
            </el-table-column>
            <!-- delFlag -->
            <el-table-column label="状态" align="center" prop="delFlag" width="40">
              <template slot-scope="scope">
                <div :title="scope.row.delFlag === '1' ? '终止' : '正常'">
                  {{ scope.row.delFlag === "1" ? "终止" : "正常" }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="申请人" align="center" prop="startUserName" width="50">
              <template slot-scope="scope">
                <div :title="scope.row.startUserName">
                  {{ scope.row.startUserName }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="申请日期" align="center" prop="createTime" width="80">
              <template slot-scope="scope">
                <span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d}") }}</span>
              </template>
            </el-table-column>
            <el-table-column label="当前节点" align="center" prop="taskName" width="60">
              <template slot-scope="scope">
                <div :title="scope.row.taskName" class="public-text-blue public-cursor"
                  @click="handleReadImage(scope.row)">
                  {{ scope.row.taskName }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="当前处理人" align="center" prop="assigneeName" width="80">
              <template slot-scope="scope">
                <div :title="scope.row.assigneeName">
                  {{ scope.row.assigneeName }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="流程状态" align="center" prop="status" width="60">
              <template slot-scope="scope">
                <div :title="scope.row.status">
                  <span v-if="scope.row.status === 0">暂存</span>
                  <span v-else-if="scope.row.status === 1">已提交</span>
                  <span v-else-if="scope.row.status === 2">审批中</span>
                  <span v-else-if="scope.row.status === 3">审批完成</span>
                  <span v-else-if="scope.row.status === 4">关闭</span>
                </div>
              </template>
            </el-table-column>
            <!--  -->
            <el-table-column label="操作" align="center" width="90" class-name="small-padding fixed-width">
              <template slot-scope="scope">
                <el-button style="color:#1890ff" type="text" size="small" @click="handleDetail(scope.row)">详情</el-button>
              </template>
            </el-table-column>
          </el-table>
          <!-- 分页 -->
          <pagination v-show="myDoneTaskTotal > 0" :total="myDoneTaskTotal" :page.sync="queryParams.pageNum"
            :limit.sync="queryParams.pageSize" @pagination="getMyDoneTaskList" />
        </el-tab-pane>
        <el-tab-pane  label="我的单据" name="list3">
          <!-- 我的单据表格 -->
          <!-- 列表一内容 -->
          <el-table height="450" ref="dataTable" @row-click="clickRow" class="tableWrapper" v-loading="loading" border
            :data="myList">
           <el-table-column type="index" label="序号" width="50" align="center"></el-table-column>

            <el-table-column label="项目名称" align="center" prop="projectName">
              <template slot-scope="scope">
                <div :title="scope.row.projectName" class="public-text-blue public-cursor"
                  @click.stop="handleInvestOppDetail(scope.row)">
                  {{ scope.row.projectName }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="所属行业" align="center" prop="industry" width="60"><template slot-scope="scope">
                <dict-tag :options="dict.type.CUSTOMER_TRADE" :value="scope.row.industry" />
              </template>
            </el-table-column>
            <el-table-column label="项目阶段" align="center" prop="projectStage" width="60">
              <template slot-scope="scope">
                <dict-tag :options="dict.type.project_stage" :value="scope.row.projectStage" />
              </template>
            </el-table-column>
            <!--            <el-table-column
              label="项目状态"
              align="center"
              prop="projectState"
              width="120"
            >
              <template slot-scope="scope">
                <dict-tag
                  :options="dict.type.project_state"
                  :value="scope.row.projectState"
                />
              </template>
            </el-table-column>-->
            <el-table-column label="项目机会状态" align="center" prop="projectStatus" width="90">
              <template slot-scope="scope">
                <!-- 定义状态文本映射对象 -->
                <el-tag :type="{
                  0: 'success',
                  1: 'danger',
                  2: 'warning'
                }[scope.row.projectStatus] || 'info'">
                  {{ {
                    0: '正常',
                    1: '终止',
                    2: '观望'
                  }[scope.row.projectStatus] || '未知状态' }}
                </el-tag>
              </template>
            </el-table-column>
            <el-table-column label="项目负责人" align="center" prop="investHead" width="80">
              <template slot-scope="scope">
                <div :title="scope.row.investHead">
                  {{ scope.row.investHead }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="项目概况" align="center" prop="projectOverview">
              <template slot-scope="scope">
                <div :title="scope.row.projectOverview">
                  {{ scope.row.projectOverview }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="项目亮点" align="center" prop="projectSparkle" width="70">
              <template slot-scope="scope">
                <div :title="scope.row.projectSparkle">
                  {{ scope.row.projectSparkle }}
                </div>
              </template>
            </el-table-column>
            <!-- delFlag -->
            <el-table-column label="状态" align="center" prop="delFlag" width="40">
              <template slot-scope="scope">
                <div :title="scope.row.delFlag === '1' ? '终止' : '正常'">
                  {{ scope.row.delFlag === "1" ? "终止" : "正常" }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="申请人" align="center" prop="startUserName" width="50">
              <template slot-scope="scope">
                <div :title="scope.row.startUserName">
                  {{ scope.row.startUserName }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="申请日期" align="center" prop="createTime" width="80">
              <template slot-scope="scope">
                <span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d}") }}</span>
              </template>
            </el-table-column>
            <el-table-column label="当前节点" align="center" prop="taskName" width="60">
              <template slot-scope="scope">
                <div :title="scope.row.taskName" class="public-text-blue public-cursor"
                  @click="handleReadImage(scope.row)">
                  {{ scope.row.taskName }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="当前处理人" align="center" prop="assigneeName" width="80">
              <template slot-scope="scope">
                <div :title="scope.row.assigneeName">
                  {{ scope.row.assigneeName }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="流程状态" align="center" prop="status" width="60">
              <template slot-scope="scope">
                <div :title="scope.row.status">
                  <span v-if="scope.row.status === 0">暂存</span>
                  <span v-else-if="scope.row.status === 1">已提交</span>
                  <span v-else-if="scope.row.status === 2">审批中</span>
                  <span v-else-if="scope.row.status === 3">审批完成</span>
                  <span v-else-if="scope.row.status === 4">关闭</span>
                </div>
              </template>
            </el-table-column>
            <!--  -->
            <el-table-column label="操作" align="center" width="90" class-name="small-padding fixed-width">
              <template slot-scope="scope">
                <el-button style="color:#1890ff" type="text" size="small" @click="handleDetail(scope.row)">详情</el-button>
              </template>
            </el-table-column>
          </el-table>
          <!-- 分页 -->
          <pagination v-show="myTotal > 0" :total="myTotal" :page.sync="queryParams.pageNum"
            :limit.sync="queryParams.pageSize" @pagination="getMyList" />
        </el-tab-pane>
      </el-tabs>
    </el-card>
    <!-- Flowable 流程图弹窗 -->
    <!-- 流程图 -->

    <el-dialog :title="readImage.title" :visible.sync="readImage.open" width="70%" append-to-body>
      <!-- <el-image :src="readImage.src"></el-image> -->
      <flow :flowData="flowData" />
    </el-dialog>

  </div>
</template>

<script>
import { getMyTaskList, getMyDoneTaskList, getMyList } from "@/api/project/approval/pool";
import { flowXmlAndNode } from "@/api/flowable/definition";
import { listChannel } from "@/api/invest/channel";
import dueDiligenceList from "../../invest/components/dueDiligenceList";
import followList from "../../invest/components/followList";
import meetingList from "../../invest/components/meetingList";
import businessUpdate from "../../invest/components/businessUpdate";
import flow from '@/views/flowable/task/todo/detail/flow';
import {
  getPool
} from "@/api/invest/pool";

import { mapGetters } from "vuex";
import pool from "../../invest/pool/index.vue";
export default {
  dicts: ["project_group", "project_stage", "project_state", "CUSTOMER_TRADE"],
  components: {
    dueDiligenceList,
    followList,
    meetingList,
    businessUpdate,
    flow
  },
  data() {
    return {
      // 当前激活的 Tab
      activeTab: "list1",
      // 遮罩层
      loading: false,
      // 查询参数
      queryParams: {
        id: null,
        pageNum: 1,
        pageSize: 10,
        projectName: null,
        projectGroup: "",
        projectCode: null,
        channel: null,
        contactDate: null,
        projectDate: null,
        decisionDate: null,
        industry: null,
        company: null,
        projectContacts: null,
        investHead: null,
        previousFinancing: null,
        financingStage: null,
        financingMoney: null,
        financingDate: null,
        investValuation: null,
        investMoney: null,
        investType: null,
        investPloy: null,
        investWorth: null,
        projectStage: null,
        projectState: null,
        orderByColumn: "createTime",
        isAsc: "desc",
        createTime: null,
      },
      // 数据列表（分开存储不同Tab的数据）
      myTaskList: [],       // 待办任务数据
      // 待办任务总条数，用于分页
      myTaskTotal: 0,
      myDoneTaskList: [],   // 已办任务数据
      // 已办任务总条数，用于分页
      myDoneTaskTotal: 0,
      myList: [],   // 我的单据数据
      // 我的单据总条数，用于分页
      myTotal: 0,
      channelList: [], //渠道
      //流程图信息
      readImage: {
        open: false,
        src: "",
      },
      // xml
      flowData: {},
    };
  },
  computed: {
    ...mapGetters(["user"]),
  },
  created() {
    // 页面初始化时，加载当前激活Tab的数据
    this.initTabData();
  },
  mounted() {
    // 渠道
    listChannel({
      pageNum: 1,
      pageSize: 100,
    }).then((response) => {
      this.channelList = response.rows;
    });
  },
  methods: {
    // Tab切换事件处理
    handleTabClick(tab) {
      // tab为当前点击的Tab对象，tab.name即标识（list1/list2）
      this.activeTab = tab.name;
      // 根据Tab标识加载对应数据
      this.initTabData();
    },
    // 初始化当前Tab数据（支持传入Tab名，默认用activeTab）
    initTabData() {
      switch (this.activeTab) {
        case "list1":
          // 待办任务：调用待办查询方法
          this.getMyTaskList();
          break;
        case "list2":
          // 已办任务：调用已办查询方法
          this.getMyDoneTaskList();
          break;
        case "list3":
          // 我的单据：调用单据查询方法
          this.getMyList();
          break;
        default:
          break;
      }
    },

    // 1. 查询“我的待办任务”数据
    getMyTaskList() {
      this.loading = true;
      // 调用待办任务接口（示例）
      getMyTaskList(this.queryParams).then((response) => {
        this.myTaskList = response.rows; // 表格数据
        this.myTaskTotal = response.total; // 分页总条数
        this.loading = false;
      }).catch(() => {
        this.loading = false;
      });
    },
    // 2. 查询“我的已办任务”数据
    getMyDoneTaskList() {
      this.loading = true;
      // 调用待办任务接口（示例）
      getMyDoneTaskList(this.queryParams).then((response) => {
        this.myDoneTaskList = response.rows; // 表格数据
        this.myDoneTaskTotal = response.total; // 分页总条数
        this.loading = false;
      }).catch(() => {
        this.loading = false;
      });
    },

    // 3. 查询“我的单据”数据
    getMyList() {
      this.loading = true;
      // 调用我的单据接口（示例）
      getMyList(this.queryParams).then((response) => {
        this.myList = response.rows;
        this.myTotal = response.total;
        this.loading = false;
      }).catch(() => {
        this.loading = false;
      });
    },

    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.initTabData();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.queryParams.orderByColumn = "createTime";
      this.queryParams.isAsc = "desc";
      this.queryParams.pageNum = 1;
      this.queryParams.pageSize = 10;
      this.handleQuery();
    },
    /*导出*/
    exportQuery() {
      switch (this.activeTab) {
        case "list1":
          // 待办任务：调用待办导出方法
          this.handleExportMyTask();
          break;
        case "list2":
          // 已办任务：调用已办导出方法
          this.handleExportMyDoneTask();
          break;
        case "list3":
          // 我的单据：调用单据导出方法
          this.handleExportMy();
          break;
        default:
          break;
      }
    },
    /** 导出按钮操作 */
    handleExportMyTask() {
      this.download(
        "project/approval/exportMyTask",
        {
          ...this.queryParams,
        },
        `MyTask_${new Date().getTime()}.xlsx`
      );
    },
    handleExportMyDoneTask() {
      this.download(
        "project/approval/exportMyDoneTask",
        {
          ...this.queryParams,
        },
        `MyDoneTask_${new Date().getTime()}.xlsx`
      );
    },
    handleExportMy() {
      this.download(
        "project/approval/exportMy",
        {
          ...this.queryParams,
        },
        `My_${new Date().getTime()}.xlsx`
      );
    },
    clickRow(row) {
      this.$refs.dataTable.toggleRowSelection(row);
    },
    /*项目机会详情*/
    handleInvestOppDetail(row) {
      const projectPoolId = row.projectPoolId;
      getPool(projectPoolId).then((response) => {
        const pInstId = response.data.procInstId;
        this.$router.push({
          path: "/myTask/project/investOpp/detail", query: {
            id:
              projectPoolId, pInstId: pInstId
          }
        });
      });
    },
    // 跳转到处理页面(暂存节点页面）
    handleEdit(row) {
      const id = row.id || this.ids;
      const poolId = row.projectPoolId;
      const pInstId = row.procInstId;
      const taskId = row.taskId;
      this.$router.push({ path: "/myTask/project/approval/edit", query: { id: poolId, pInstId: pInstId, taskId: taskId } });
    },
    // 签收操作
    handleSign(row) {
      // 标记签收人、更新状态等逻辑
      row.signPerson = '当前用户';
      this.$message.success('签收成功');
    },
    // 跳转到处理页面
    handleProcess(row) {
      const id = row.id || this.ids;
      const poolId = row.projectPoolId;
      const pInstId = row.procInstId;
      const taskId = row.taskId;
      this.$store.commit("SET_PROJECTITEMMESSAGE", row);
      this.$router.push({ path: "/myTask/project/approval/audit", query: { id: poolId, pInstId: pInstId, taskId: taskId } });

    },
    // 撤回操作
    handleWithdraw(row) {
      // 撤回逻辑（比如清空签收人）
      row.signPerson = '';
      this.$message.success('已撤回');
    },
    // 详情操作
    /*handleFlowRecord(row) {
      // 查看流程详情逻辑
      console.log('流程详情：', row);
    }*/
    /*详情*/
    handleDetail(row) {
      const id = row.id || this.ids;
      const poolId = row.projectPoolId;
      const pInstId = row.procInstId;
      this.$router.push({ path: "/myTask/project/approval/detail", query: { id: poolId, pInstId: pInstId } });
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      const id = row.id;
      this.$router.push({ path: "/invest/pool/add", query: { id: id } });
    },
    /**终止按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      const idsName = row.projectName ? row.projectName : this.idsName;
      this.$modal
        .confirm('是否终止"' + idsName + '"项目？')
        .then(function () {
          return delPool(ids);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("已终止");
        })
        .catch(() => { });
    },
    /** 流程图查看 */
    handleReadImage(row) {
      this.readImage.title = "流程图";
      this.readImage.open = true;
      // this.readImage.src = process.env.VUE_APP_BASE_API + "/flowable/definition/readImage/" + deploymentId;
      flowXmlAndNode({ procInsId: row.procInstId, deployId: row.deployId }).then(res => {
        this.flowData = res.data;
      })
    },

  },
};
</script>
<style lang="scss" scoped>
.tableWrapper {
  font-size: 12px;
  color: #000;

  ::v-deep .el-table__header-wrapper th {
    font-size: 12px;
    font-weight: bolder;
    color: #000;
  }

  ::v-deep td.el-table__cell:not(:last-child) div {
    text-overflow: -o-ellipsis-lastline;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
  }
}

/**找到表头那一行，然后把里面的复选框隐藏掉**/
.hideHeaderCheckBox::v-deep .el-table__header-wrapper .el-table__header .el-checkbox {
  display: none;
}
</style>
