From 6ff8faad4a183eaa35fac526e4e29a1c6176ff15 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期四, 08 十月 2026 17:43:18 +0800
Subject: [PATCH] 采购管理系统模块优化
---
src/views/collaborativeApproval/approvalProcess/index.vue | 301 ++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 231 insertions(+), 70 deletions(-)
diff --git a/src/views/collaborativeApproval/approvalProcess/index.vue b/src/views/collaborativeApproval/approvalProcess/index.vue
index 7e51ea4..3815b70 100644
--- a/src/views/collaborativeApproval/approvalProcess/index.vue
+++ b/src/views/collaborativeApproval/approvalProcess/index.vue
@@ -1,5 +1,16 @@
<template>
<div class="app-container">
+ <!-- 鏍囩椤靛垏鎹笉鍚岀殑瀹℃壒绫诲瀷 -->
+ <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>
+ <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>
@@ -11,20 +22,29 @@
clearable
:prefix-icon="Search"
/>
+ <span class="search_title ml10">瀹℃壒鐘舵�侊細</span>
+ <el-select v-model="searchForm.approveStatus" clearable @change="handleQuery" style="width: 240px">
+ <el-option label="寰呭鏍�" :value="0" />
+ <el-option label="瀹℃牳涓�" :value="1" />
+ <el-option label="瀹℃牳瀹屾垚" :value="2" />
+ <el-option label="瀹℃牳鏈�氳繃" :value="3" />
+ <el-option label="宸查噸鏂版彁浜�" :value="4" />
+ </el-select>
<el-button type="primary" @click="handleQuery" style="margin-left: 10px"
>鎼滅储</el-button
>
</div>
<div>
- <el-button type="primary" @click="openForm('add')">鏂板</el-button>
-<!-- <el-button @click="handleOut">瀵煎嚭</el-button>-->
+ <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>
</div>
</div>
<div class="table_list">
<PIMTable
rowKey="id"
- :column="tableColumn"
+ :column="tableColumnCopy"
:tableData="tableData"
:page="page"
:isSelection="true"
@@ -34,91 +54,161 @@
:total="page.total"
></PIMTable>
</div>
- <info-form-dia ref="infoFormDia" @close="handleQuery"></info-form-dia>
- <approval-dia ref="approvalDia" @close="handleQuery"></approval-dia>
+ <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} 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 {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(String(props.approveType || '1'));
+
+// 褰撳墠瀹℃壒绫诲瀷锛屾牴鎹�変腑鐨勬爣绛鹃〉璁$畻
+const currentApproveType = computed(() => {
+ return Number(activeTab.value);
+});
+
+// 鏍囩椤靛垏鎹㈠鐞�
+const handleTabChange = (tabName) => {
+ // 鍒囨崲鏍囩椤垫椂閲嶇疆鎼滅储鏉′欢鍜屽垎椤碉紝骞堕噸鏂板姞杞芥暟鎹�
+ searchForm.value.approveId = '';
+ searchForm.value.approveStatus = '';
+ page.current = 1;
+ getList();
+};
+
const data = reactive({
searchForm: {
approveId: "",
+ approveStatus: "",
},
});
const { searchForm } = toRefs(data);
-const tableColumn = ref([
- {
- label: "瀹℃壒鐘舵��",
- prop: "approveStatus",
- dataType: "tag",
- formatData: (params) => {
- if (params == 0) {
- return "寰呭鏍�";
- } else if (params == 1) {
- return "瀹℃牳涓�";
- } else if (params == 2) {
- return "瀹℃牳瀹屾垚";
- } else {
- return '涓嶉�氳繃';
- }
+
+// 鍔ㄦ�佽〃鏍煎垪閰嶇疆锛屾牴鎹鎵圭被鍨嬬敓鎴愬垪
+const tableColumnCopy = computed(() => {
+ 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 = [
+ {
+ label: "瀹℃壒鐘舵��",
+ prop: "approveStatus",
+ dataType: "tag",
+ width: 100,
+ formatData: (params) => {
+ if (params == 0) {
+ return "寰呭鏍�";
+ } else if (params == 1) {
+ return "瀹℃牳涓�";
+ } else if (params == 2) {
+ return "瀹℃牳瀹屾垚";
+ } else if (params == 4) {
+ return "宸查噸鏂版彁浜�";
+ } else {
+ return '涓嶉�氳繃';
+ }
+ },
+ formatType: (params) => {
+ if (params == 0) {
+ return "warning";
+ } else if (params == 1) {
+ return "primary";
+ } else if (params == 2) {
+ return "success";
+ } else if (params == 4) {
+ return "info";
+ } else {
+ return 'danger';
+ }
+ },
},
- formatType: (params) => {
- if (params == 0) {
- return "warning";
- } else if (params == 1) {
- return "primary";
- } else if (params == 2) {
- return "success";
- } else {
- return 'danger';
- }
+ {
+ label: "娴佺▼缂栧彿",
+ prop: "approveId",
+ width: 170
},
- },
- {
- label: "娴佺▼缂栧彿",
- prop: "approveId",
- width: 170
- },
- {
- label: "鐢宠閮ㄩ棬",
- prop: "approveDeptName",
- },
- {
- label: "瀹℃壒浜嬬敱",
- prop: "approveReason",
- width: 200
- },
- {
- label: "鐢宠浜�",
- prop: "approveUser",
- },
- {
- label: "鐢宠鏃ユ湡",
- prop: "approveTime",
- },
- {
- label: "缁撴潫鏃ユ湡",
- prop: "approveOverTime",
- width: 120
- },
- {
+ {
+ label: "鐢宠閮ㄩ棬",
+ prop: "approveDeptName",
+ width: 220
+ },
+ {
+ label: isBusinessApproval ? "涓氬姟缂栧彿" : (isQuotationType ? "鎶ヤ环鍗曞彿" : "瀹℃壒浜嬬敱"),
+ prop: isBusinessApproval ? "businessNo" : "approveReason",
+ width: 200
+ },
+ ...(isBusinessApproval ? [{ label: "瀹℃壒鏍囬", prop: "businessTitle", width: 220 }] : []),
+ {
+ label: "鐢宠浜�",
+ prop: "approveUserName",
+ width: 120
+ }
+ ];
+
+ // 閲戦鍒楋紙浠呮姤閿�绠$悊鏄剧ず锛�
+ if (isReimburseType) {
+ baseColumns.push({
+ label: "閲戦锛堝厓锛�",
+ prop: "price",
+ width: 120
+ });
+ }
+ if ([1, 3, 5].includes(currentApproveType.value)) {
+ baseColumns.push({ label: currentApproveType.value === 3 ? "鍚堝悓閲戦锛堝厓锛�" : "閲戦锛堝厓锛�", prop: "amount", width: 140 })
+ }
+
+ // 鏃ユ湡鍒楋紙鏍规嵁绫诲瀷鍔ㄦ�侀厤缃級
+ baseColumns.push(
+ {
+ label: isLeaveType ? "寮�濮嬫棩鏈�" : "鐢宠鏃ユ湡",
+ prop: isLeaveType ? "startDate" : "approveTime",
+ width: 200
+ },
+ {
+ label: "缁撴潫鏃ユ湡",
+ prop: isLeaveType ? "endDate" : "approveOverTime",
+ width: 120
+ }
+ );
+
+ // 褰撳墠瀹℃壒浜哄垪
+ baseColumns.push({
label: "褰撳墠瀹℃壒浜�",
- prop: "checkCompany",
+ prop: "approveUserCurrentName",
width: 120
- },
- {
+ });
+
+ // 鎿嶄綔鍒�
+ baseColumns.push({
dataType: "action",
label: "鎿嶄綔",
align: "center",
fixed: "right",
- width: 150,
+ width: 230,
operation: [
{
name: "缂栬緫",
@@ -126,6 +216,7 @@
clickFun: (row) => {
openForm("edit", row);
},
+ disabled: (row) => currentApproveType.value === 6 || ![0, 3].includes(row.approveStatus) || row.approveUser !== userStore.id
},
{
name: "瀹℃牳",
@@ -133,6 +224,7 @@
clickFun: (row) => {
openApprovalDia("approval", row);
},
+ disabled: (row) => row.approveUserCurrentId == null || row.approveStatus == 2 || row.approveStatus == 3 || row.approveStatus == 4 || row.approveUserCurrentId !== userStore.id
},
{
name: "璇︽儏",
@@ -141,9 +233,18 @@
openApprovalDia('view', row);
},
},
+ {
+ name: "闄勪欢",
+ type: "text",
+ clickFun: (row) => {
+ downLoadFile(row);
+ },
+ },
],
- },
-]);
+ });
+
+ return baseColumns;
+});
const tableData = ref([]);
const selectedRows = ref([]);
const tableLoading = ref(false);
@@ -154,6 +255,7 @@
});
const infoFormDia = ref()
const approvalDia = ref()
+const flowDefinitionRef = ref()
const { proxy } = getCurrentInstance()
// 鏌ヨ鍒楄〃
@@ -162,6 +264,11 @@
page.current = 1;
getList();
};
+const fileListRef = ref(null)
+const downLoadFile = (row) => {
+ fileListRef.value.open(row.commonFileList)
+
+}
const pagination = (obj) => {
page.current = obj.page;
page.size = obj.limit;
@@ -169,7 +276,7 @@
};
const getList = () => {
tableLoading.value = true;
- approveProcessListPage({...page, ...searchForm.value,}).then(res => {
+ approveProcessListPage({...page, ...searchForm.value, approveType: currentApproveType.value}).then(res => {
tableLoading.value = false;
tableData.value = res.data.records
page.total = res.data.total;
@@ -177,6 +284,33 @@
tableLoading.value = false;
})
};
+// 瀵煎嚭
+const handleOut = () => {
+ const type = currentApproveType.value
+ const urlMap = {
+ 0: "/approveProcess/exportZero",
+ 1: "/approveProcess/exportOne",
+ 2: "/approveProcess/exportTwo",
+ 3: "/approveProcess/exportThree",
+ 4: "/approveProcess/exportFour",
+ 5: "/approveProcess/exportFive",
+ 6: "/approveProcess/exportSix",
+ 7: "/approveProcess/exportSeven",
+ }
+ const url = urlMap[type] || urlMap[0]
+ const nameMap = {
+ 0: "鑷敱鍗忓悓瀹℃壒琛�",
+ 1: "鑷敱鍗忓悓瀹℃壒琛�",
+ 2: "璇峰亣绠$悊瀹℃壒琛�",
+ 3: "閿�鍞悎鍚屽鎵硅〃",
+ 4: "鎶ラ攢绠$悊瀹℃壒琛�",
+ 5: "閲囪喘璁″垝瀹℃壒琛�",
+ 6: "鎶ヤ环瀹℃壒琛�",
+ 7: "鍑哄簱瀹℃壒琛�",
+ }
+ const fileName = nameMap[type] || nameMap[0]
+ proxy.download(url, {}, `${fileName}.xlsx`)
+}
// 琛ㄦ牸閫夋嫨鏁版嵁
const handleSelectionChange = (selection) => {
selectedRows.value = selection;
@@ -194,6 +328,7 @@
approvalDia.value?.openDialog(type, row)
})
};
+const openFlowDefinition = () => flowDefinitionRef.value?.open(currentApproveType.value)
// 鍒犻櫎
const handleDelete = () => {
@@ -204,7 +339,7 @@
proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
return;
}
- ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", {
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎", {
confirmButtonText: "纭",
cancelButtonText: "鍙栨秷",
type: "warning",
@@ -220,8 +355,34 @@
});
};
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();
});
+
+watch(() => props.approveType, value => {
+ if (value !== null && value !== undefined) {
+ activeTab.value = String(value)
+ handleQuery()
+ }
+})
</script>
-<style scoped></style>
+<style scoped>
+.approval-tabs {
+ margin-bottom: 10px;
+}
+</style>
--
Gitblit v1.9.3