buhuazhen
2026-05-29 5c30f301d6d4a5b8fc1183e06aaea8dc366d3540
src/views/collaborativeApproval/approvalProcess/index.vue
@@ -7,8 +7,10 @@
      <el-tab-pane label="出差管理" name="3"></el-tab-pane>
      <el-tab-pane label="报销管理" name="4"></el-tab-pane>
      <el-tab-pane label="采购审批" name="5"></el-tab-pane>
      <el-tab-pane label="报价审批" name="6"></el-tab-pane>
      <el-tab-pane label="发货审批" name="7"></el-tab-pane>
    </el-tabs>
    <div class="search_form">
      <div>
        <span class="search_title">流程编号:</span>
@@ -19,6 +21,15 @@
            @change="handleQuery"
            clearable
            :prefix-icon="Search"
        />
        <span class="search_title ml10" v-if="currentApproveType === 7">销售单号:</span>
        <el-input
            v-if="currentApproveType === 7"
            v-model="searchForm.salesContractNo"
            style="width: 240px"
            placeholder="请输入销售单号搜索"
            @change="handleQuery"
            clearable
        />
        <span class="search_title ml10">审批状态:</span>
            <el-select v-model="searchForm.approveStatus" clearable @change="handleQuery" style="width: 240px">
@@ -33,9 +44,18 @@
        >
      </div>
      <div>
        <el-button type="primary" @click="openForm('add')">新增</el-button>
        <el-button
          type="primary"
          @click="openForm('add')"
          v-if="currentApproveType !== 5 && currentApproveType !== 6 && currentApproveType !== 7"
        >新增</el-button>
        <el-button @click="handleOut">导出</el-button>
        <el-button type="danger" plain @click="handleDelete">删除</el-button>
        <el-button
          type="danger"
          plain
          @click="handleDelete"
          v-if="currentApproveType !== 5 && currentApproveType !== 6 && currentApproveType !== 7"
        >删除</el-button>
      </div>
    </div>
    <div class="table_list">
@@ -52,7 +72,7 @@
      ></PIMTable>
    </div>
    <info-form-dia ref="infoFormDia" @close="handleQuery" :approveType="currentApproveType"></info-form-dia>
    <approval-dia ref="approvalDia" @close="handleQuery"></approval-dia>
    <approval-dia ref="approvalDia" @close="handleQuery" :approveType="currentApproveType"></approval-dia>
    <FileList ref="fileListRef" />
  </div>
</template>
@@ -62,12 +82,14 @@
import { Search } from "@element-plus/icons-vue";
import {onMounted, ref, computed, reactive, toRefs, nextTick, getCurrentInstance} from "vue";
import {ElMessageBox} from "element-plus";
import { useRoute } from 'vue-router';
import InfoFormDia from "@/views/collaborativeApproval/approvalProcess/components/infoFormDia.vue";
import ApprovalDia from "@/views/collaborativeApproval/approvalProcess/components/approvalDia.vue";
import {approveProcessDelete, approveProcessListPage} from "@/api/collaborativeApproval/approvalProcess.js";
import useUserStore from "@/store/modules/user";
const userStore = useUserStore();
const route = useRoute();
// 当前选中的标签页,默认为公出管理
const activeTab = ref('1');
@@ -82,6 +104,7 @@
  // 切换标签页时重置搜索条件和分页,并重新加载数据
  searchForm.value.approveId = '';
  searchForm.value.approveStatus = '';
  searchForm.value.salesContractNo = '';
  page.current = 1;
  getList();
};
@@ -91,6 +114,7 @@
  searchForm: {
      approveId: "",
      approveStatus: "",
      salesContractNo: "",
  },
});
const { searchForm } = toRefs(data);
@@ -99,7 +123,9 @@
const tableColumnCopy = computed(() => {
  const isLeaveType = currentApproveType.value === 2; // 请假管理
  const isReimburseType = currentApproveType.value === 4; // 报销管理
  const isQuotationType = currentApproveType.value === 6; // 报价审批
  const isPurchaseType = currentApproveType.value === 5; // 采购审批
  // 基础列配置
  const baseColumns = [
    {
@@ -145,9 +171,8 @@
      width: 220
    },
    {
      label: "审批事由",
      label: isQuotationType ? "报价单号" : isPurchaseType ? "采购单号" : "审批事由",
      prop: "approveReason",
      width: 200
    },
    {
      label: "申请人",
@@ -155,7 +180,20 @@
      width: 120
    }
  ];
  // 发货审批显示销售单号列
  if (currentApproveType.value === 7) {
    // 在申请部门后面插入销售单号列
    const deptIndex = baseColumns.findIndex(col => col.prop === 'approveDeptName');
    if (deptIndex !== -1) {
      baseColumns.splice(deptIndex + 1, 0, {
        label: "销售单号",
        prop: "salesContractNo",
        width: 170
      });
    }
  }
  // 金额列(仅报销管理显示)
  if (isReimburseType) {
    baseColumns.push({
@@ -164,7 +202,7 @@
      width: 120
    });
  }
  // 日期列(根据类型动态配置)
  baseColumns.push(
    {
@@ -178,55 +216,72 @@
      width: 120
    }
  );
  // 当前审批人列
  baseColumns.push({
    label: "当前审批人",
    prop: "approveUserCurrentName",
    width: 120
  });
  // 操作列
  const actionOperations = [
    {
      name: "编辑",
      type: "text",
      clickFun: (row) => {
        openForm("edit", row);
      },
      disabled: (row) =>
        currentApproveType.value === 5 ||
        currentApproveType.value === 6 ||
        currentApproveType.value === 7 ||
        row.approveStatus == 2 ||
        row.approveStatus == 1 ||
        row.approveStatus == 4
    },
    {
      name: "审核",
      type: "text",
      clickFun: (row) => {
        openApprovalDia("approval", row);
      },
      disabled: (row) =>
        row.approveUserCurrentId == null ||
        row.approveStatus == 2 ||
        row.approveStatus == 3 ||
        row.approveStatus == 4 ||
        row.approveUserCurrentId !== userStore.id
    },
    {
      name: "详情",
      type: "text",
      clickFun: (row) => {
        openApprovalDia("view", row);
      },
    },
  ];
  // 报价审批(类型 6)不展示“附件”操作
  if (!isQuotationType) {
    actionOperations.push({
      name: "附件",
      type: "text",
      clickFun: (row) => {
        downLoadFile(row);
      },
    });
  }
  baseColumns.push({
    dataType: "action",
    label: "操作",
    align: "center",
    fixed: "right",
    width: 230,
    operation: [
      {
        name: "编辑",
        type: "text",
        clickFun: (row) => {
          openForm("edit", row);
        },
        disabled: (row) => row.approveStatus == 2 || row.approveStatus == 1 || row.approveStatus == 4
      },
      {
        name: "审核",
        type: "text",
        clickFun: (row) => {
          openApprovalDia("approval", row);
        },
        disabled: (row) => row.approveUserCurrentId == null || row.approveStatus == 2 || row.approveStatus == 3 || row.approveStatus == 4 || row.approveUserCurrentId !== userStore.id
      },
      {
        name: "详情",
        type: "text",
        clickFun: (row) => {
          openApprovalDia('view', row);
        },
      },
      {
        name: "附件",
        type: "text",
        clickFun: (row) => {
          downLoadFile(row);
        },
      },
    ],
    operation: actionOperations,
  });
  return baseColumns;
});
const tableData = ref([]);
@@ -277,6 +332,8 @@
    3: "/approveProcess/exportThree",
    4: "/approveProcess/exportFour",
    5: "/approveProcess/exportFive",
    6: "/approveProcess/exportSix",
    7: "/approveProcess/exportSeven",
  }
  const url = urlMap[type] || urlMap[0]
  const nameMap = {
@@ -286,6 +343,8 @@
    3: "出差管理审批表",
    4: "报销管理审批表",
    5: "采购申请审批表",
    6: "报价审批表",
    7: "发货审批表",
  }
  const fileName = nameMap[type] || nameMap[0]
  proxy.download(url, {}, `${fileName}.xlsx`)
@@ -333,6 +392,21 @@
      });
};
onMounted(() => {
  // 根据URL参数设置标签页和查询条件
  const approveType = route.query.approveType;
  const approveId = route.query.approveId;
  if (approveType) {
    // 设置标签页(approveType 对应 activeTab 的 name)
    activeTab.value = String(approveType);
  }
  if (approveId) {
    // 设置流程编号查询条件
    searchForm.value.approveId = String(approveId);
  }
  // 查询列表
  getList();
});
</script>