liding
5 天以前 ace1b66fe094e791216f6c46f4bd628e1c23b2dd
src/views/collaborativeApproval/approvalProcess/index.vue
@@ -1,8 +1,8 @@
<template>
  <div class="app-container">
    <!-- 标签页切换不同的审批类型 -->
    <el-tabs v-model="activeTab" @tab-change="handleTabChange" class="approval-tabs">
      <el-tab-pane label="协同审批" name="1"></el-tab-pane>
    <el-tabs v-if="!fixedApproveType" v-model="activeTab" @tab-change="handleTabChange" class="approval-tabs">
      <el-tab-pane label="自由协同审批" name="1"></el-tab-pane>
      <el-tab-pane label="请假管理" name="2"></el-tab-pane>
      <el-tab-pane label="销售审批" name="3"></el-tab-pane>
      <el-tab-pane label="报销审批" name="4"></el-tab-pane>
@@ -35,6 +35,7 @@
        >
      </div>
      <div>
        <el-button v-if="[3, 5].includes(currentApproveType)" @click="openFlowDefinition">流程配置</el-button>
        <el-button type="primary" @click="openForm('add')" v-if="currentApproveType !== 6">新增</el-button>
        <el-button @click="handleOut">导出</el-button>
        <el-button type="danger" plain @click="handleDelete">删除</el-button>
@@ -56,25 +57,30 @@
    <info-form-dia ref="infoFormDia" @close="handleQuery" :approveType="currentApproveType"></info-form-dia>
    <approval-dia ref="approvalDia" @close="handleQuery" :approveType="currentApproveType"></approval-dia>
    <FileList ref="fileListRef" />
    <FlowDefinitionDia ref="flowDefinitionRef" />
  </div>
</template>
<script setup>
import FileList from "./fileList.vue";
import { Search } from "@element-plus/icons-vue";
import {onMounted, ref, computed, reactive, toRefs, nextTick, getCurrentInstance} from "vue";
import {onMounted, ref, computed, reactive, toRefs, nextTick, getCurrentInstance, watch} 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";
import FlowDefinitionDia from "./components/flowDefinitionDia.vue";
const userStore = useUserStore();
const route = useRoute();
const props = defineProps({
  approveType: { type: [Number, String], default: null }
})
const fixedApproveType = computed(() => props.approveType !== null && props.approveType !== undefined)
// 当前选中的标签页,默认为公出管理
const activeTab = ref('1');
const activeTab = ref(String(props.approveType || '1'));
// 当前审批类型,根据选中的标签页计算
const currentApproveType = computed(() => {
@@ -104,6 +110,7 @@
  const isLeaveType = currentApproveType.value === 2; // 请假管理
  const isReimburseType = currentApproveType.value === 4; // 报销管理
  const isQuotationType = currentApproveType.value === 6; // 报价审批
  const isBusinessApproval = [1, 3, 5].includes(currentApproveType.value)
  
  // 基础列配置
  const baseColumns = [
@@ -150,10 +157,11 @@
      width: 220
    },
    {
      label: isQuotationType ? "报价单号" : "审批事由",
      prop: "approveReason",
      label: isBusinessApproval ? "业务编号" : (isQuotationType ? "报价单号" : "审批事由"),
      prop: isBusinessApproval ? "businessNo" : "approveReason",
      width: 200
    },
    ...(isBusinessApproval ? [{ label: "审批标题", prop: "businessTitle", width: 220 }] : []),
    {
      label: "申请人",
      prop: "approveUserName",
@@ -168,6 +176,9 @@
      prop: "price",
      width: 120
    });
  }
  if ([1, 3, 5].includes(currentApproveType.value)) {
    baseColumns.push({ label: currentApproveType.value === 3 ? "合同金额(元)" : "金额(元)", prop: "amount", width: 140 })
  }
  
  // 日期列(根据类型动态配置)
@@ -205,7 +216,7 @@
        clickFun: (row) => {
          openForm("edit", row);
        },
        disabled: (row) => currentApproveType.value === 6 || row.approveStatus == 2 || row.approveStatus == 1 || row.approveStatus == 4
        disabled: (row) => currentApproveType.value === 6 || ![0, 3].includes(row.approveStatus) || row.approveUser !== userStore.id
      },
      {
        name: "审核",
@@ -244,6 +255,7 @@
});
const infoFormDia = ref()
const approvalDia = ref()
const flowDefinitionRef = ref()
const { proxy } = getCurrentInstance()
// 查询列表
@@ -287,12 +299,12 @@
  }
  const url = urlMap[type] || urlMap[0]
  const nameMap = {
    0: "协同审批管理表",
    1: "公出管理审批表",
    0: "自由协同审批表",
    1: "自由协同审批表",
    2: "请假管理审批表",
    3: "出差管理审批表",
    3: "销售合同审批表",
    4: "报销管理审批表",
    5: "采购申请审批表",
    5: "采购计划审批表",
    6: "报价审批表",
    7: "出库审批表",
  }
@@ -316,6 +328,7 @@
    approvalDia.value?.openDialog(type, row)
  })
};
const openFlowDefinition = () => flowDefinitionRef.value?.open(currentApproveType.value)
// 删除
const handleDelete = () => {
@@ -326,7 +339,7 @@
    proxy.$modal.msgWarning("请选择数据");
    return;
  }
  ElMessageBox.confirm("选中的内容将被删除,是否确认删除?", "导出", {
  ElMessageBox.confirm("选中的内容将被删除,是否确认删除?", "删除", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
@@ -359,6 +372,13 @@
  // 查询列表
  getList();
});
watch(() => props.approveType, value => {
  if (value !== null && value !== undefined) {
    activeTab.value = String(value)
    handleQuery()
  }
})
</script>
<style scoped>