From 25e07725481488e7b6bfb186b3dddb1fef62f415 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=90=B4=E7=BA=A2=E5=85=B5?= <374362909@qq.com>
Date: Wed, 25 Feb 2026 13:11:31 +0800
Subject: [PATCH] =?UTF-8?q?=E5=B1=A5=E7=BA=A6=E9=AA=8C=E6=94=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/finance/purchasingrequisition.ts | 14 ++
.../finance/purchasingrequisition/add.vue | 15 ++
.../finance/purchasingrequisition/index.vue | 136 +++++++++++++++++-
3 files changed, 164 insertions(+), 1 deletion(-)
diff --git a/src/api/finance/purchasingrequisition.ts b/src/api/finance/purchasingrequisition.ts
index 7fec5da..64c1ea1 100644
--- a/src/api/finance/purchasingrequisition.ts
+++ b/src/api/finance/purchasingrequisition.ts
@@ -76,6 +76,20 @@ export function submitObj(obj: any) {
});
}
+/**
+ * 分配招标代理(指定或随机),仅学校统一采购或部门自行采购且委托采购中心采购时可用
+ * @param applyId 采购申请ID
+ * @param mode random | designated
+ * @param agentId 指定模式时的代理ID
+ */
+export function assignAgent(applyId: number | string, mode: 'random' | 'designated', agentId?: string) {
+ return request({
+ url: '/purchase/purchasingapply/assign-agent',
+ method: 'post',
+ data: { id: Number(applyId), mode, agentId: agentId || undefined }
+ });
+}
+
/**
* 修改采购申请
* @param obj 对象数据
diff --git a/src/views/finance/purchasingrequisition/add.vue b/src/views/finance/purchasingrequisition/add.vue
index 7160b5b..cac4e86 100644
--- a/src/views/finance/purchasingrequisition/add.vue
+++ b/src/views/finance/purchasingrequisition/add.vue
@@ -403,6 +403,17 @@
+
+
+
招标代理
+
+
+ 代理名称
+ {{ dataForm.agentName }}
+
+
+
+
实施采购信息
@@ -616,6 +627,8 @@ const dataForm = reactive({
implementType: '',
fileFlowInstId: '',
fileFlowStatus: '',
+ agentId: '',
+ agentName: '',
});
/** 查看时展示的采购文件列表(实施采购上传的 type=130) */
const viewImplementPurchaseFiles = ref<{ id: string; fileTitle?: string; createTime?: string; remark?: string }[]>([]);
@@ -1147,6 +1160,8 @@ async function loadDetail(applyId: string | number) {
implementType: detail.implementType ?? '',
fileFlowInstId: detail.fileFlowInstId ?? '',
fileFlowStatus: detail.fileFlowStatus ?? '',
+ agentId: detail.agentId ?? '',
+ agentName: detail.agentName ?? '',
});
setCategoryCodePath();
currentStep.value = 0;
diff --git a/src/views/finance/purchasingrequisition/index.vue b/src/views/finance/purchasingrequisition/index.vue
index d5dfbc9..3295698 100644
--- a/src/views/finance/purchasingrequisition/index.vue
+++ b/src/views/finance/purchasingrequisition/index.vue
@@ -336,6 +336,61 @@
+
+
+
+
+
+
+ 指定
+ 随机
+
+
+
+
+
+
+
+
+ {{ assignAgentCurrentRow.agentName }}
+
+
+
+
+ 取消
+
+ 随机分配
+
+
+ 确定
+
+
+
+
@@ -343,7 +398,8 @@
import { ref, reactive, defineAsyncComponent, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import { BasicTableProps, useTable } from "/@/hooks/table";
-import { getPage, delObj, submitObj, getArchiveDownloadUrl, getApplyTemplateDownloadUrl, getFileApplyTemplateDownloadUrl } from "/@/api/finance/purchasingrequisition";
+import { getPage, delObj, submitObj, getArchiveDownloadUrl, getApplyTemplateDownloadUrl, getFileApplyTemplateDownloadUrl, assignAgent } from "/@/api/finance/purchasingrequisition";
+import { getPage as getAgentPage } from '/@/api/finance/purchaseagent';
import { useMessage, useMessageBox } from "/@/hooks/message";
import { getDicts } from '/@/api/admin/dict';
import { getTree } from '/@/api/finance/purchasingcategory';
@@ -382,6 +438,75 @@ const currFlowCommentType = ref<'apply' | 'file'>('apply')
const implementFormRef = ref()
+/** 分配代理弹窗 */
+const assignAgentDialogVisible = ref(false)
+const assignAgentCurrentRow = ref(null)
+const assignAgentForm = reactive({ mode: 'designated' as 'designated' | 'random', agentId: '' })
+const agentList = ref([])
+const agentListLoading = ref(false)
+const assignAgentSubmitting = ref(false)
+
+const openAssignAgentDialog = async (row: any) => {
+ assignAgentCurrentRow.value = row
+ assignAgentForm.mode = 'designated'
+ assignAgentForm.agentId = ''
+ assignAgentDialogVisible.value = true
+ agentListLoading.value = true
+ try {
+ const res = await getAgentPage({ size: 500, current: 1 })
+ const records = res?.data?.records ?? res?.records ?? []
+ agentList.value = Array.isArray(records) ? records : []
+ } catch (_) {
+ agentList.value = []
+ } finally {
+ agentListLoading.value = false
+ }
+}
+
+const handleAssignAgentRandom = async () => {
+ const row = assignAgentCurrentRow.value
+ const id = row?.id ?? row?.purchaseId
+ if (id == null || id === '') {
+ useMessage().warning('无法获取申请单ID')
+ return
+ }
+ assignAgentSubmitting.value = true
+ try {
+ await assignAgent(Number(id), 'random')
+ useMessage().success('随机分配代理成功')
+ assignAgentDialogVisible.value = false
+ getDataList()
+ } catch (e: any) {
+ useMessage().error(e?.msg || '随机分配代理失败')
+ } finally {
+ assignAgentSubmitting.value = false
+ }
+}
+
+const handleAssignAgentDesignated = async () => {
+ const row = assignAgentCurrentRow.value
+ const id = row?.id ?? row?.purchaseId
+ if (id == null || id === '') {
+ useMessage().warning('无法获取申请单ID')
+ return
+ }
+ if (!assignAgentForm.agentId) {
+ useMessage().warning('请选择招标代理')
+ return
+ }
+ assignAgentSubmitting.value = true
+ try {
+ await assignAgent(Number(id), 'designated', assignAgentForm.agentId)
+ useMessage().success('指定代理成功')
+ assignAgentDialogVisible.value = false
+ getDataList()
+ } catch (e: any) {
+ useMessage().error(e?.msg || '指定代理失败')
+ } finally {
+ assignAgentSubmitting.value = false
+ }
+}
+
/**
* 定义响应式表格数据
*/
@@ -561,6 +686,12 @@ const getActionMenuItems = (row: any) => {
icon: Download,
visible: () => true,
},
+ {
+ command: 'assignAgent',
+ label: '分配代理',
+ icon: Collection,
+ visible: () => row?.purchaseMode === '2' || (row?.purchaseMode === '0' && row?.purchaseType === '4'),
+ },
];
};
@@ -591,6 +722,9 @@ const handleMoreCommand = (command: string, row: any) => {
case 'downloadFileApply':
handleDownloadFileApply(row);
break;
+ case 'assignAgent':
+ openAssignAgentDialog(row);
+ break;
}
};