From 55c89a667220d8dd5fb99e2d8219d3aee15cb594 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 04 十一月 2026 16:32:11 +0800
Subject: [PATCH] refactor(srm): 重构供应商采购界面,新增询价比价与保证金页面
---
src/views/erp/purchase/in/data.ts | 17
src/views/srm/bidBond/data.ts | 255 +++++
src/api/srm/bidBond/index.ts | 56 +
src/views/erp/purchase/statement/index.vue | 270 +++++
src/views/srm/supplier/data.ts | 32
src/api/srm/inquiry/index.ts | 191 +++
src/views/erp/purchase/order/data.ts | 19
src/views/srm/inquiry/detail.vue | 232 ++++
src/views/erp/purchase/request/detail/index.vue | 6
src/views/erp/purchase/order/modules/item-form.vue | 36
src/views/erp/purchase/request/data.ts | 6
src/api/erp/purchase/order/index.ts | 10
src/api/erp/purchase/statement/index.ts | 66 +
src/views/erp/purchase/in/modules/item-form.vue | 35
src/views/erp/purchase/order/index.vue | 27
src/views/srm/enums.ts | 239 ----
src/views/srm/inquiry/data.ts | 128 ++
src/views/erp/purchase/return/data.ts | 17
src/views/srm/bidBond/modules/form.vue | 116 ++
/dev/null | 123 --
src/api/srm/supplier/index.ts | 25
src/views/srm/inquiry/index.vue | 187 +++
src/views/srm/supplier/modules/form.vue | 251 ++++
src/views/erp/purchase/return/modules/item-form.vue | 35
src/views/srm/bidBond/index.vue | 127 ++
src/views/srm/inquiry/modules/form.vue | 457 +++++++++
26 files changed, 2,503 insertions(+), 460 deletions(-)
diff --git a/src/api/erp/purchase/order/index.ts b/src/api/erp/purchase/order/index.ts
index 4f0c6d6..301ba44 100644
--- a/src/api/erp/purchase/order/index.ts
+++ b/src/api/erp/purchase/order/index.ts
@@ -88,6 +88,16 @@
});
}
+/** 鎻愪氦閲囪喘璁㈠崟瀹℃壒锛堣崏绋�/鏈鏍� -> 瀹℃壒涓級 */
+export function submitPurchaseOrder(
+ id: number,
+ processDefinitionKey = 'purchase_order_approve',
+) {
+ return requestClient.post('/erp/purchase-order/submit', null, {
+ params: { id, processDefinitionKey },
+ });
+}
+
/** 鍒犻櫎閲囪喘璁㈠崟 */
export function deletePurchaseOrder(ids: number[]) {
return requestClient.delete('/erp/purchase-order/delete', {
diff --git a/src/api/erp/purchase/statement/index.ts b/src/api/erp/purchase/statement/index.ts
new file mode 100644
index 0000000..b9edfe1
--- /dev/null
+++ b/src/api/erp/purchase/statement/index.ts
@@ -0,0 +1,66 @@
+import { requestClient } from '#/api/request';
+
+export namespace ErpSupplierStatementApi {
+ export interface Summary {
+ totalPurchaseAmount?: number;
+ totalInvoiceAmount?: number;
+ totalPaymentAmount?: number;
+ unpaidAmount?: number;
+ }
+
+ export interface OrderRow {
+ id?: number;
+ no?: string;
+ orderTime?: string;
+ orderAmount?: number;
+ invoicedAmount?: number;
+ uninvoicedAmount?: number;
+ status?: number;
+ inStatus?: number;
+ }
+
+ export interface InvoiceRow {
+ id?: number;
+ no?: string;
+ invoiceNo?: string;
+ invoiceTime?: string;
+ invoiceAmount?: number;
+ paidAmount?: number;
+ remainingPayable?: number;
+ paymentStatus?: number;
+ purchaseOrderId?: number;
+ purchaseOrderNo?: string;
+ }
+
+ export interface PaymentRow {
+ id?: number;
+ no?: string;
+ paymentTime?: string;
+ paymentAmount?: number;
+ status?: number;
+ invoiceId?: number;
+ invoiceNo?: string;
+ }
+
+ export interface Statement {
+ supplierId?: number;
+ supplierName?: string;
+ summary?: Summary;
+ orders?: OrderRow[];
+ invoices?: InvoiceRow[];
+ payments?: PaymentRow[];
+ }
+}
+
+/** 鏌ヨ渚涘簲鍟嗗線鏉ュ璐� */
+export function getSupplierStatement(params: {
+ supplierId: number;
+ beginTime?: string;
+ endTime?: string;
+ includeUnapprovedOrder?: boolean;
+}) {
+ return requestClient.get<ErpSupplierStatementApi.Statement>(
+ '/erp/supplier-statement/get',
+ { params },
+ );
+}
diff --git a/src/api/srm/bidBond/index.ts b/src/api/srm/bidBond/index.ts
new file mode 100644
index 0000000..1f18660
--- /dev/null
+++ b/src/api/srm/bidBond/index.ts
@@ -0,0 +1,56 @@
+import type { PageParam, PageResult } from '@vben/request';
+
+import { requestClient } from '#/api/request';
+
+export namespace SrmBidBondApi {
+ /** 鎶曟爣淇濊瘉閲� */
+ export interface BidBond {
+ id?: number;
+ no?: string;
+ supplierId?: number;
+ supplierName?: string;
+ projectName?: string;
+ inquiryId?: number;
+ inquiryNo?: string;
+ purchaseOrderId?: number;
+ purchaseOrderNo?: string;
+ bondAmount?: number;
+ payDate?: string;
+ won?: boolean;
+ refundStatus?: number;
+ refundAmount?: number;
+ refundDate?: string;
+ remark?: string;
+ createTime?: string;
+ }
+}
+
+/** 鍒嗛〉鏌ヨ鎶曟爣淇濊瘉閲� */
+export function getBidBondPage(params: PageParam) {
+ return requestClient.get<PageResult<SrmBidBondApi.BidBond>>(
+ '/srm/bid-bond/page',
+ { params },
+ );
+}
+
+/** 鏌ヨ鎶曟爣淇濊瘉閲戣鎯� */
+export function getBidBond(id: number) {
+ return requestClient.get<SrmBidBondApi.BidBond>(
+ `/srm/bid-bond/get?id=${id}`,
+ );
+}
+
+/** 鍒涘缓鎶曟爣淇濊瘉閲� */
+export function createBidBond(data: SrmBidBondApi.BidBond) {
+ return requestClient.post<number>('/srm/bid-bond/create', data);
+}
+
+/** 鏇存柊鎶曟爣淇濊瘉閲� */
+export function updateBidBond(data: SrmBidBondApi.BidBond) {
+ return requestClient.put('/srm/bid-bond/update', data);
+}
+
+/** 鍒犻櫎鎶曟爣淇濊瘉閲� */
+export function deleteBidBond(id: number) {
+ return requestClient.delete('/srm/bid-bond/delete', { params: { id } });
+}
diff --git a/src/api/srm/inquiry/index.ts b/src/api/srm/inquiry/index.ts
new file mode 100644
index 0000000..a3ddd01
--- /dev/null
+++ b/src/api/srm/inquiry/index.ts
@@ -0,0 +1,191 @@
+import type { PageParam, PageResult } from '@vben/request';
+
+import { requestClient } from '#/api/request';
+
+export namespace SrmInquiryApi {
+ /** 璇环浜у搧琛� */
+ export interface Item {
+ id?: number;
+ inquiryId?: number;
+ productId?: number;
+ productUnitId?: number;
+ productCode?: string;
+ productName?: string;
+ productSpec?: string;
+ unitName?: string;
+ quantity?: number;
+ estimatedPrice?: number;
+ selectedSupplierId?: number;
+ selectedQuoteId?: number;
+ selectedPrice?: number;
+ /** 鏂板/缂栬緫璇环鍗曟椂闅忎骇鍝佽涓�骞舵彁浜ょ殑渚涘簲鍟嗘姤浠� */
+ quotes?: ItemQuote[];
+ remark?: string;
+ sort?: number;
+ }
+
+ /** 浜у搧琛屽唴鐨勪緵搴斿晢鎶ヤ环 */
+ export interface ItemQuote {
+ supplierId: number;
+ price?: number;
+ taxRate?: number;
+ deliveryCycle?: number;
+ paymentTerms?: string;
+ remark?: string;
+ }
+
+ /** 鍙備笌渚涘簲鍟� */
+ export interface Supplier {
+ id?: number;
+ supplierId: number;
+ supplierName?: string;
+ supplierCode?: string;
+ quoteStatus?: number;
+ quoteTime?: string;
+ remark?: string;
+ }
+
+ /** 浜у搧鎶ヤ环 */
+ export interface Quote {
+ id?: number;
+ inquiryId?: number;
+ inquiryItemId?: number;
+ supplierId?: number;
+ price?: number;
+ taxRate?: number;
+ deliveryCycle?: number;
+ paymentTerms?: string;
+ remark?: string;
+ isSelected?: boolean;
+ }
+
+ /** 璇环杞鍗曡褰� */
+ export interface Order {
+ id?: number;
+ supplierId?: number;
+ supplierName?: string;
+ purchaseOrderId?: number;
+ purchaseOrderNo?: string;
+ }
+
+ /** 璇环鍗� */
+ export interface Inquiry {
+ id?: number;
+ no?: string;
+ title: string;
+ status?: number;
+ inquiryDate?: string;
+ deadline?: string;
+ purchaserUserId?: number;
+ remark?: string;
+ createTime?: string;
+ items?: Item[];
+ suppliers?: Supplier[];
+ quotes?: Quote[];
+ orders?: Order[];
+ }
+
+ /** 淇濆瓨鎶ヤ环 */
+ export interface QuoteSaveItem {
+ inquiryItemId: number;
+ supplierId: number;
+ price?: number;
+ taxRate?: number;
+ deliveryCycle?: number;
+ paymentTerms?: string;
+ remark?: string;
+ }
+
+ /** 涓爣閫夋嫨 */
+ export interface Selection {
+ inquiryItemId: number;
+ quoteId: number;
+ }
+
+ /** 纭杞鍗曠粨鏋� */
+ export interface ConfirmResult {
+ inquiryId: number;
+ orders: {
+ purchaseOrderId: number;
+ purchaseOrderNo: string;
+ supplierId: number;
+ supplierName: string;
+ }[];
+ }
+}
+
+/** 鍒嗛〉鏌ヨ璇环鍗� */
+export function getInquiryPage(params: PageParam) {
+ return requestClient.get<PageResult<SrmInquiryApi.Inquiry>>(
+ '/srm/inquiry/page',
+ { params },
+ );
+}
+
+/** 鏌ヨ璇环鍗曡鎯� */
+export function getInquiry(id: number) {
+ return requestClient.get<SrmInquiryApi.Inquiry>(
+ `/srm/inquiry/get?id=${id}`,
+ );
+}
+
+/** 鏌ヨ璇环姣斾环瑙嗗浘 */
+export function getInquiryCompare(id: number) {
+ return requestClient.get<SrmInquiryApi.Inquiry>(
+ `/srm/inquiry/compare?id=${id}`,
+ );
+}
+
+/** 鏌ヨ璇环鍗曠簿绠�鍒楄〃 */
+export function getInquirySimpleList() {
+ return requestClient.get<SrmInquiryApi.Inquiry[]>(
+ '/srm/inquiry/simple-list',
+ );
+}
+
+/** 鍒涘缓璇环鍗� */
+export function createInquiry(data: SrmInquiryApi.Inquiry) {
+ return requestClient.post<number>('/srm/inquiry/create', data);
+}
+
+/** 鏇存柊璇环鍗� */
+export function updateInquiry(data: SrmInquiryApi.Inquiry) {
+ return requestClient.put('/srm/inquiry/update', data);
+}
+
+/** 鍒犻櫎璇环鍗� */
+export function deleteInquiry(id: number) {
+ return requestClient.delete('/srm/inquiry/delete', { params: { id } });
+}
+
+/** 鍙戝竷璇环鍗� */
+export function publishInquiry(id: number) {
+ return requestClient.put('/srm/inquiry/publish', null, { params: { id } });
+}
+
+/** 鍙栨秷璇环鍗� */
+export function cancelInquiry(id: number) {
+ return requestClient.put('/srm/inquiry/cancel', null, { params: { id } });
+}
+
+/** 鎵归噺淇濆瓨鎶ヤ环 */
+export function saveQuotes(
+ inquiryId: number,
+ quotes: SrmInquiryApi.QuoteSaveItem[],
+) {
+ return requestClient.post('/srm/inquiry/save-quotes', {
+ inquiryId,
+ quotes,
+ });
+}
+
+/** 纭涓爣骞剁敓鎴愰噰璐鍗曡崏绋� */
+export function confirmInquiry(
+ id: number,
+ selections: SrmInquiryApi.Selection[],
+) {
+ return requestClient.post<SrmInquiryApi.ConfirmResult>(
+ '/srm/inquiry/confirm',
+ { id, selections },
+ );
+}
diff --git a/src/api/srm/statistics/index.ts b/src/api/srm/statistics/index.ts
deleted file mode 100644
index 36525c0..0000000
--- a/src/api/srm/statistics/index.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { requestClient } from '#/api/request';
-
-export namespace SrmStatisticsApi {
- export interface TenderStatisticsVO {
- totalTenderCount?: number;
- totalTenderAmount?: number;
- totalAwardAmount?: number;
- savedAmount?: number;
- winRate?: number;
- supplierCount?: number;
- period?: string;
- }
-}
-
-/** 鑾峰彇鎷涙爣缁熻 */
-export function getTenderStatistics(year: string) {
- return requestClient.get<SrmStatisticsApi.TenderStatisticsVO>(`/srm/statistics/tender?year=${year}`);
-}
diff --git a/src/api/srm/supplier/index.ts b/src/api/srm/supplier/index.ts
index e4e7c97..be541c1 100644
--- a/src/api/srm/supplier/index.ts
+++ b/src/api/srm/supplier/index.ts
@@ -3,6 +3,29 @@
import { requestClient } from '#/api/request';
export namespace SrmSupplierApi {
+ /** 渚涘簲鍟嗚仈绯讳汉 */
+ export interface SupplierContact {
+ id?: number;
+ name: string;
+ position?: string;
+ mobile?: string;
+ telephone?: string;
+ email?: string;
+ wechat?: string;
+ isDefault?: boolean;
+ }
+
+ /** 渚涘簲鍟嗛摱琛岃处鎴� */
+ export interface SupplierBank {
+ id?: number;
+ bankName: string;
+ bankAccount: string;
+ bankNo?: string;
+ bankAddress?: string;
+ isDefault?: boolean;
+ remark?: string;
+ }
+
export interface SupplierVO {
id?: number;
code: string;
@@ -18,6 +41,8 @@
taxNo?: string;
remark?: string;
createTime?: string;
+ contacts?: SupplierContact[];
+ banks?: SupplierBank[];
}
}
diff --git a/src/api/srm/supplierApply/index.ts b/src/api/srm/supplierApply/index.ts
deleted file mode 100644
index ccfcf06..0000000
--- a/src/api/srm/supplierApply/index.ts
+++ /dev/null
@@ -1,77 +0,0 @@
-import type { PageParam, PageResult } from '@vben/request';
-
-import { requestClient } from '#/api/request';
-
-export namespace SrmSupplierApplyApi {
- export interface ApplyVO {
- id?: number;
- applyNo?: string;
- supplierId?: number;
- supplierName: string;
- supplierType?: string;
- companyNature?: string;
- registeredCapital?: number;
- businessLicenseNo?: string;
- taxNo?: string;
- address?: string;
- bankName?: string;
- bankAccount?: string;
- contactName?: string;
- contactMobile?: string;
- contactEmail?: string;
- applyUserName?: string;
- applyTime?: string;
- applyStatus?: number;
- applyStatusLabel?: string;
- auditComment?: string;
- processInstanceId?: string;
- remark?: string;
- createTime?: string;
- }
-
- /** 鍗忓悓鍔炲叕瀹℃壒娴佺▼瀹氫箟 */
- export interface ProcessDefinition {
- id: string;
- key: string;
- name: string;
- }
-}
-
-/** 鍒嗛〉鏌ヨ鍑嗗叆鐢宠 */
-export function getApplyPage(params: PageParam) {
- return requestClient.get<PageResult<SrmSupplierApplyApi.ApplyVO>>('/srm/supplier-apply/page', { params });
-}
-
-/** 鑾峰彇鍑嗗叆鐢宠璇︽儏 */
-export function getApply(id: number) {
- return requestClient.get<SrmSupplierApplyApi.ApplyVO>(`/srm/supplier-apply/get?id=${id}`);
-}
-
-/** 鍒涘缓鍑嗗叆鐢宠 */
-export function createApply(data: SrmSupplierApplyApi.ApplyVO) {
- return requestClient.post('/srm/supplier-apply/create', data);
-}
-
-/** 鏇存柊鍑嗗叆鐢宠 */
-export function updateApply(data: SrmSupplierApplyApi.ApplyVO) {
- return requestClient.put('/srm/supplier-apply/update', data);
-}
-
-/** 鍒犻櫎鍑嗗叆鐢宠 */
-export function deleteApply(id: number) {
- return requestClient.delete(`/srm/supplier-apply/delete?id=${id}`);
-}
-
-/** 鑾峰彇瀹℃壒娴佺▼鍒楄〃锛堝崗鍚屽姙鍏凡鍙戝竷娴佺▼锛� */
-export function getApproveProcessList() {
- return requestClient.get<SrmSupplierApplyApi.ProcessDefinition[]>(
- '/srm/supplier-apply/approve-process-list',
- );
-}
-
-/** 鎻愪氦鍑嗗叆鐢宠瀹℃壒锛堝惎鍔ㄥ崗鍚屽姙鍏祦绋嬶級 */
-export function submitApply(id: number, processDefinitionKey: string) {
- return requestClient.put('/srm/supplier-apply/submit', null, {
- params: { id, processDefinitionKey },
- });
-}
diff --git a/src/api/srm/supplierCertificate/index.ts b/src/api/srm/supplierCertificate/index.ts
deleted file mode 100644
index 2504662..0000000
--- a/src/api/srm/supplierCertificate/index.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-import type { PageParam, PageResult } from '@vben/request';
-
-import type { SystemStorageApi } from '#/api/system/storage';
-import { requestClient } from '#/api/request';
-
-export namespace SrmSupplierCertificateApi {
- export interface CertificateVO {
- id?: number;
- supplierId: number;
- supplierName?: string;
- certificateName: string;
- certificateNo?: string;
- certificateType: number;
- issuingAuthority?: string;
- validStartDate: string;
- validEndDate: string;
- status?: number;
- remark?: string;
- createTime?: string;
- blobIds?: number[];
- attachmentList?: SystemStorageApi.StorageBlob[];
- }
-}
-
-/** 鍒嗛〉鏌ヨ璧勮川 */
-export function getCertificatePage(params: PageParam) {
- return requestClient.get<PageResult<SrmSupplierCertificateApi.CertificateVO>>('/srm/supplier-certificate/page', { params });
-}
-
-/** 鑾峰彇璧勮川璇︽儏 */
-export function getCertificate(id: number) {
- return requestClient.get<SrmSupplierCertificateApi.CertificateVO>(`/srm/supplier-certificate/get?id=${id}`);
-}
-
-/** 鍒涘缓璧勮川 */
-export function createCertificate(data: SrmSupplierCertificateApi.CertificateVO) {
- return requestClient.post('/srm/supplier-certificate/create', data);
-}
-
-/** 鏇存柊璧勮川 */
-export function updateCertificate(data: SrmSupplierCertificateApi.CertificateVO) {
- return requestClient.put('/srm/supplier-certificate/update', data);
-}
-
-/** 鍒犻櫎璧勮川 */
-export function deleteCertificate(id: number) {
- return requestClient.delete(`/srm/supplier-certificate/delete?id=${id}`);
-}
-
-/** 鎸変緵搴斿晢鑾峰彇璧勮川鍒楄〃 */
-export function getCertificateListBySupplier(supplierId: number) {
- return requestClient.get<SrmSupplierCertificateApi.CertificateVO[]>(`/srm/supplier-certificate/list-by-supplier?supplierId=${supplierId}`);
-}
-
-/** 鑾峰彇鍗冲皢鍒版湡鐨勮祫璐ㄥ垪琛� */
-export function getExpiringCertificates() {
- return requestClient.get<SrmSupplierCertificateApi.CertificateVO[]>('/srm/supplier-certificate/expiring-list');
-}
diff --git a/src/api/srm/supplierEvaluation/index.ts b/src/api/srm/supplierEvaluation/index.ts
deleted file mode 100644
index c7ed017..0000000
--- a/src/api/srm/supplierEvaluation/index.ts
+++ /dev/null
@@ -1,47 +0,0 @@
-import type { PageParam, PageResult } from '@vben/request';
-
-import { requestClient } from '#/api/request';
-
-export namespace SrmSupplierEvaluationApi {
- export interface EvaluationVO {
- id?: number;
- supplierId: number;
- supplierName?: string;
- evaluationPeriod: string;
- qualityScore: number;
- deliveryScore: number;
- priceScore: number;
- serviceScore: number;
- compositeScore?: number;
- grade?: string;
- evaluatorId?: number;
- evaluatorName?: string;
- remark?: string;
- createTime?: string;
- }
-}
-
-/** 鍒嗛〉鏌ヨ缁╂晥璇勪环 */
-export function getEvaluationPage(params: PageParam) {
- return requestClient.get<PageResult<SrmSupplierEvaluationApi.EvaluationVO>>('/srm/supplier-evaluation/page', { params });
-}
-
-/** 鑾峰彇缁╂晥璇勪环璇︽儏 */
-export function getEvaluation(id: number) {
- return requestClient.get<SrmSupplierEvaluationApi.EvaluationVO>(`/srm/supplier-evaluation/get?id=${id}`);
-}
-
-/** 鍒涘缓缁╂晥璇勪环 */
-export function createEvaluation(data: SrmSupplierEvaluationApi.EvaluationVO) {
- return requestClient.post('/srm/supplier-evaluation/create', data);
-}
-
-/** 鏇存柊缁╂晥璇勪环 */
-export function updateEvaluation(data: SrmSupplierEvaluationApi.EvaluationVO) {
- return requestClient.put('/srm/supplier-evaluation/update', data);
-}
-
-/** 鍒犻櫎缁╂晥璇勪环 */
-export function deleteEvaluation(id: number) {
- return requestClient.delete(`/srm/supplier-evaluation/delete?id=${id}`);
-}
diff --git a/src/api/srm/tender-config/index.ts b/src/api/srm/tender-config/index.ts
deleted file mode 100644
index 976938d..0000000
--- a/src/api/srm/tender-config/index.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import { requestClient } from '#/api/request';
-
-export namespace SrmTenderConfigApi {
- export interface TenderConfigVO {
- id?: number;
- defaultBiddingMode?: string;
- }
-}
-
-export function getTenderConfig() {
- return requestClient.get<SrmTenderConfigApi.TenderConfigVO>('/srm/tender-config/get');
-}
-
-export function saveTenderConfig(data: SrmTenderConfigApi.TenderConfigVO) {
- return requestClient.put('/srm/tender-config/save', data);
-}
diff --git a/src/api/srm/tender/index.ts b/src/api/srm/tender/index.ts
deleted file mode 100644
index 8b6d54d..0000000
--- a/src/api/srm/tender/index.ts
+++ /dev/null
@@ -1,272 +0,0 @@
-import type { PageParam, PageResult } from '@vben/request';
-
-import type { SystemStorageApi } from '#/api/system/storage';
-import { requestClient } from '#/api/request';
-
-export namespace SrmTenderApi {
- export interface TenderProjectVO {
- id?: number;
- tenderNo?: string;
- tenderName: string;
- tenderType: number;
- purchaseOrg?: string;
- projectLeaderId?: number;
- projectLeaderName?: string;
- tenderStatus?: number;
- budgetAmount?: number;
- startTime?: string;
- endTime?: string;
- bidOpenTime?: string;
- tenderDesc?: string;
- qualificationRequirements?: string;
- purchaseRequestId?: number;
- awardId?: number;
- purchaseOrderNo?: string;
- biddingMode?: string;
- createTime?: string;
- blobIds?: number[];
- attachmentList?: SystemStorageApi.StorageBlob[];
- }
-
- export interface TenderMaterialVO {
- id?: number;
- tenderProjectId: number;
- productId?: number;
- productCode?: string;
- productName: string;
- productSpec?: string;
- unit?: string;
- quantity?: number;
- techRequirement?: string;
- estimatedPrice?: number;
- sort?: number;
- }
-
- export interface TenderBidVO {
- id?: number;
- tenderProjectId: number;
- supplierId: number;
- supplierName?: string;
- bidNo: string;
- bidStatus?: number;
- bidTime?: string;
- bidTotalAmount?: number;
- bidFileName?: string;
- bidFileUrl?: string;
- createTime?: string;
- }
-
- export interface QuoteVO {
- id?: number;
- tenderProjectId?: number;
- supplierId?: number;
- bidId: number;
- tenderMaterialId: number;
- materialName?: string;
- quotePrice?: number;
- taxRate?: number;
- deliveryCycle?: number;
- paymentTerms?: string;
- warrantyPeriod?: number;
- remark?: string;
- }
-
- export interface BidEvaluationVO {
- id?: number;
- tenderProjectId: number;
- supplierId: number;
- supplierName?: string;
- bidId: number;
- priceScore?: number;
- techScore?: number;
- deliveryScore?: number;
- serviceScore?: number;
- compositeScore?: number;
- rank?: number;
- evaluatorId?: number;
- evaluatorName?: string;
- evaluationOpinion?: string;
- }
-
- export interface BidAwardVO {
- id?: number;
- tenderProjectId: number;
- supplierId: number;
- supplierName?: string;
- bidId: number;
- awardNo: string;
- awardStatus?: number;
- awardAmount?: number;
- awardTime?: string;
- noticeFileName?: string;
- noticeFileUrl?: string;
- purchaseOrderId?: number;
- remark?: string;
- }
-
- export interface TenderProjectPartialUpdateVO {
- id: number;
- tenderDesc?: string;
- qualificationRequirements?: string;
- blobIds?: number[];
- }
-}
-
-// ========== 鎷涙爣椤圭洰 ==========
-
-export function getTenderProjectPage(params: PageParam) {
- return requestClient.get<PageResult<SrmTenderApi.TenderProjectVO>>('/srm/tender-project/page', { params });
-}
-
-export function getTenderProject(id: number) {
- return requestClient.get<SrmTenderApi.TenderProjectVO>(`/srm/tender-project/get?id=${id}`);
-}
-
-export function createTenderProject(data: SrmTenderApi.TenderProjectVO) {
- return requestClient.post('/srm/tender-project/create', data);
-}
-
-export function updateTenderProject(data: SrmTenderApi.TenderProjectVO) {
- return requestClient.put('/srm/tender-project/update', data);
-}
-
-export function updateTenderProjectPartial(data: SrmTenderApi.TenderProjectPartialUpdateVO) {
- return requestClient.put('/srm/tender-project/update-info', data);
-}
-
-export function deleteTenderProject(id: number) {
- return requestClient.delete(`/srm/tender-project/delete?id=${id}`);
-}
-
-export function publishTender(id: number) {
- return requestClient.put(`/srm/tender-project/publish?id=${id}`);
-}
-
-export function closeTender(id: number) {
- return requestClient.put(`/srm/tender-project/close?id=${id}`);
-}
-
-export function startBidding(id: number) {
- return requestClient.put(`/srm/tender-project/start-bidding?id=${id}`);
-}
-
-export function startEvaluation(id: number) {
- return requestClient.put(`/srm/tender-project/start-evaluation?id=${id}`);
-}
-
-export function startPriceComparing(id: number) {
- return requestClient.put(`/srm/tender-project/start-price-comparing?id=${id}`);
-}
-
-export function confirmTenderProject(data: { id: number; bidId: number }) {
- return requestClient.put('/srm/tender-project/confirm', data);
-}
-
-// ========== 鐗╂枡瀛愯〃 ==========
-
-export function getMaterialList(tenderProjectId: number) {
- return requestClient.get<SrmTenderApi.TenderMaterialVO[]>(`/srm/tender-project/material/list?tenderProjectId=${tenderProjectId}`);
-}
-
-export function createMaterial(data: SrmTenderApi.TenderMaterialVO) {
- return requestClient.post('/srm/tender-project/material/create', data);
-}
-
-export function updateMaterial(data: SrmTenderApi.TenderMaterialVO) {
- return requestClient.put('/srm/tender-project/material/update', data);
-}
-
-export function deleteMaterial(id: number) {
- return requestClient.delete(`/srm/tender-project/material/delete?id=${id}`);
-}
-
-// ========== 鎶曟爣绠$悊 ==========
-
-export function getBidListByProject(tenderProjectId: number) {
- return requestClient.get<SrmTenderApi.TenderBidVO[]>(`/srm/tender-bid/list-by-project?tenderProjectId=${tenderProjectId}`);
-}
-
-export function getBid(id: number) {
- return requestClient.get<SrmTenderApi.TenderBidVO>(`/srm/tender-bid/get?id=${id}`);
-}
-
-export function createBid(data: SrmTenderApi.TenderBidVO) {
- return requestClient.post('/srm/tender-bid/create', data);
-}
-
-export function withdrawBid(id: number) {
- return requestClient.put(`/srm/tender-bid/withdraw?id=${id}`);
-}
-
-export function updateBidTotal(id: number, bidTotalAmount?: number | null) {
- const params = bidTotalAmount == null ? '' : `&bidTotalAmount=${bidTotalAmount}`;
- return requestClient.put(`/srm/tender-bid/update-total?id=${id}${params}`);
-}
-
-// ========== 鎶ヤ环绠$悊 ==========
-
-export function getQuoteList(bidId: number) {
- return requestClient.get<SrmTenderApi.QuoteVO[]>(`/srm/tender-bid/quote/list-by-bid?bidId=${bidId}`);
-}
-
-export function createQuote(data: SrmTenderApi.QuoteVO) {
- return requestClient.post('/srm/tender-bid/quote/create', data);
-}
-
-export function updateQuote(data: SrmTenderApi.QuoteVO) {
- return requestClient.put('/srm/tender-bid/quote/update', data);
-}
-
-// ========== 璇勬爣绠$悊 ==========
-
-export function getEvaluationList(tenderProjectId: number) {
- return requestClient.get<SrmTenderApi.BidEvaluationVO[]>(`/srm/bid-evaluation/list-by-project?tenderProjectId=${tenderProjectId}`);
-}
-
-export function createBidEvaluation(data: SrmTenderApi.BidEvaluationVO) {
- return requestClient.post('/srm/bid-evaluation/create', data);
-}
-
-export function updateBidEvaluation(data: SrmTenderApi.BidEvaluationVO) {
- return requestClient.put('/srm/bid-evaluation/update', data);
-}
-
-export function calculateRanking(tenderProjectId: number) {
- return requestClient.put(`/srm/bid-evaluation/calculate-ranking?tenderProjectId=${tenderProjectId}`);
-}
-
-// ========== 寮�鏍� ==========
-
-export function createBidOpen(tenderProjectId: number) {
- return requestClient.post(`/srm/bid-evaluation/bid-open/create?tenderProjectId=${tenderProjectId}`);
-}
-
-export function getBidOpen(id: number) {
- return requestClient.get(`/srm/bid-evaluation/bid-open/get?id=${id}`);
-}
-
-// ========== 瀹氭爣绠$悊 ==========
-
-export function createAward(data: SrmTenderApi.BidAwardVO) {
- return requestClient.post('/srm/bid-award/create', data);
-}
-
-export function deleteAward(id: number) {
- return requestClient.delete(`/srm/bid-award/delete?id=${id}`);
-}
-
-export function getAward(id: number) {
- return requestClient.get<SrmTenderApi.BidAwardVO>(`/srm/bid-award/get?id=${id}`);
-}
-
-export function getAwardByProject(tenderProjectId: number) {
- return requestClient.get<SrmTenderApi.BidAwardVO>(`/srm/bid-award/get-by-project?tenderProjectId=${tenderProjectId}`);
-}
-
-export function approveAward(id: number) {
- return requestClient.put(`/srm/bid-award/approve?id=${id}`);
-}
-
-export function generatePurchaseOrder(id: number) {
- return requestClient.put(`/srm/bid-award/generate-purchase-order/${id}`);
-}
diff --git a/src/router/routes/modules/srm.ts b/src/router/routes/modules/srm.ts
deleted file mode 100644
index 113b30d..0000000
--- a/src/router/routes/modules/srm.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import type { RouteRecordRaw } from 'vue-router';
-
-const routes: RouteRecordRaw[] = [
- {
- path: '/srm',
- name: 'SrmCenter',
- meta: {
- title: 'SRM 渚涘簲鍟嗙鐞�',
- icon: 'lucide:package-search',
- keepAlive: true,
- hideInMenu: true,
- },
- children: [
- {
- path: 'tender/detail',
- name: 'SrmTenderDetail',
- meta: {
- title: '鎷涙爣璇︽儏',
- activePath: '/srm/tender',
- },
- component: () => import('#/views/srm/tender/detail.vue'),
- },
- ],
- },
-];
-
-export default routes;
diff --git a/src/views/erp/purchase/in/data.ts b/src/views/erp/purchase/in/data.ts
index 4b5122a..9988cb9 100644
--- a/src/views/erp/purchase/in/data.ts
+++ b/src/views/erp/purchase/in/data.ts
@@ -258,17 +258,10 @@
},
{
field: 'productPrice',
- title: '浜у搧鍗曚环',
+ title: '鍚◣鍗曚环',
fixed: 'right',
minWidth: 120,
slots: { default: 'productPrice' },
- },
- {
- field: 'totalProductPrice',
- fixed: 'right',
- title: '浜у搧閲戦',
- minWidth: 120,
- formatter: 'formatAmount2',
},
{
fixed: 'right',
@@ -280,14 +273,14 @@
{
fixed: 'right',
field: 'taxPrice',
- title: '绋庨',
+ title: '绋庨锛堜环鍐呭惈锛�',
minWidth: 120,
formatter: 'formatAmount2',
},
{
field: 'totalPrice',
fixed: 'right',
- title: '鍚堣閲戦',
+ title: '浠风◣鍚堣',
minWidth: 120,
formatter: 'formatAmount2',
},
@@ -595,13 +588,13 @@
},
{
field: 'totalProductPrice',
- title: '閲戦鍚堣',
+ title: '浼樻儬鍓嶉噾棰�',
formatter: 'formatAmount2',
minWidth: 120,
},
{
field: 'totalPrice',
- title: '鍚◣閲戦',
+ title: '浠风◣鍚堣',
formatter: 'formatAmount2',
minWidth: 120,
},
diff --git a/src/views/erp/purchase/in/modules/item-form.vue b/src/views/erp/purchase/in/modules/item-form.vue
index fd7a153..3fea9b9 100644
--- a/src/views/erp/purchase/in/modules/item-form.vue
+++ b/src/views/erp/purchase/in/modules/item-form.vue
@@ -149,7 +149,7 @@
/** 澶勭悊琛屾暟鎹彉鏇� */
function handleRowChange(row: any) {
- // TODO 鑺嬭壙
+ calcRow(row);
const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index === -1) {
tableData.value.push(row);
@@ -159,14 +159,30 @@
emit('update:items', [...tableData.value]);
}
+/**
+ * 璁$畻琛岄噾棰�
+ * 鍗曚环涓哄惈绋庡崟浠凤細閲戦锛堜环绋庡悎璁★級= 鍗曚环 * 鏁伴噺锛岀◣棰濅粠鍚◣閲戦涓弽绠楋紝涓嶅啀棰濆鍔犵◣
+ */
+function calcRow(row: ErpPurchaseInApi.PurchaseInItem) {
+ if (!row.productPrice || !row.count) {
+ return;
+ }
+ const totalProductPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
+ const taxPercent = Number(row.taxPercent) || 0;
+ row.totalProductPrice = totalProductPrice;
+ row.taxPrice =
+ taxPercent > 0
+ ? (erpPriceMultiply(
+ totalProductPrice,
+ taxPercent / (100 + taxPercent),
+ ) ?? 0)
+ : 0;
+ row.totalPrice = totalProductPrice;
+}
+
/** 鍒濆鍖栬鏁版嵁 */
function initRow(row: ErpPurchaseInApi.PurchaseInItem) {
- if (row.productPrice && row.count) {
- row.totalProductPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
- row.taxPrice =
- erpPriceMultiply(row.totalProductPrice, (row.taxPercent || 0) / 100) ?? 0;
- row.totalPrice = row.totalProductPrice + row.taxPrice;
- }
+ calcRow(row);
}
/** 琛ㄥ崟鏍¢獙 */
@@ -269,11 +285,10 @@
<div class="flex space-x-4">
<span>鏁伴噺锛歿{ erpCountInputFormatter(summaries.count) }}</span>
<span>
- 閲戦锛歿{ erpPriceInputFormatter(summaries.totalProductPrice) }}
+ 绋庨锛堜环鍐呭惈锛夛細{{ erpPriceInputFormatter(summaries.taxPrice) }}
</span>
- <span>绋庨锛歿{ erpPriceInputFormatter(summaries.taxPrice) }}</span>
<span>
- 绋庨鍚堣锛歿{ erpPriceInputFormatter(summaries.totalPrice) }}
+ 浠风◣鍚堣锛歿{ erpPriceInputFormatter(summaries.totalPrice) }}
</span>
</div>
</div>
diff --git a/src/views/erp/purchase/order/data.ts b/src/views/erp/purchase/order/data.ts
index 80c3008..de357d6 100644
--- a/src/views/erp/purchase/order/data.ts
+++ b/src/views/erp/purchase/order/data.ts
@@ -210,17 +210,10 @@
},
{
field: 'productPrice',
- title: '浜у搧鍗曚环',
+ title: '鍚◣鍗曚环',
minWidth: 120,
fixed: 'right',
slots: { default: 'productPrice' },
- },
- {
- field: 'totalProductPrice',
- title: '閲戦',
- minWidth: 120,
- fixed: 'right',
- formatter: 'formatAmount2',
},
{
field: 'taxPercent',
@@ -231,14 +224,14 @@
},
{
field: 'taxPrice',
- title: '绋庨',
+ title: '绋庨锛堜环鍐呭惈锛�',
minWidth: 120,
fixed: 'right',
formatter: 'formatAmount2',
},
{
field: 'totalPrice',
- title: '绋庨鍚堣',
+ title: '浠风◣鍚堣',
minWidth: 120,
fixed: 'right',
formatter: 'formatAmount2',
@@ -316,7 +309,7 @@
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.ERP_AUDIT_STATUS, 'number').filter(
- (opt) => opt.label !== '鑽夌' && opt.label !== '瀹℃壒涓嶉�氳繃',
+ (opt) => opt.label !== '瀹℃壒涓嶉�氳繃',
),
placeholder: '璇烽�夋嫨鐘舵��',
allowClear: true,
@@ -404,13 +397,13 @@
},
{
field: 'totalProductPrice',
- title: '閲戦鍚堣',
+ title: '浼樻儬鍓嶉噾棰�',
formatter: 'formatAmount2',
minWidth: 120,
},
{
field: 'totalPrice',
- title: '鍚◣閲戦',
+ title: '浠风◣鍚堣',
formatter: 'formatAmount2',
minWidth: 120,
},
diff --git a/src/views/erp/purchase/order/index.vue b/src/views/erp/purchase/order/index.vue
index 266decd..4e3e59f 100644
--- a/src/views/erp/purchase/order/index.vue
+++ b/src/views/erp/purchase/order/index.vue
@@ -16,6 +16,7 @@
deletePurchaseOrder,
exportPurchaseOrder,
getPurchaseOrderPage,
+ submitPurchaseOrder,
} from '#/api/erp/purchase/order';
import { $t } from '#/locales';
@@ -73,6 +74,21 @@
try {
await deletePurchaseOrder(ids);
message.success($t('ui.actionMessage.deleteSuccess'));
+ handleRefresh();
+ } finally {
+ hideLoading();
+ }
+}
+
+/** 鎻愪氦鑽夌璁㈠崟瀹℃壒 */
+async function handleSubmit(row: ErpPurchaseOrderApi.PurchaseOrder) {
+ const hideLoading = message.loading({
+ content: '鎻愪氦瀹℃壒涓�...',
+ duration: 0,
+ });
+ try {
+ await submitPurchaseOrder(row.id!);
+ message.success(`閲囪喘璁㈠崟 ${row.no} 宸叉彁浜ゅ鎵筦);
handleRefresh();
} finally {
hideLoading();
@@ -217,6 +233,17 @@
onClick: handleEdit.bind(null, row),
},
{
+ label: '鎻愪氦瀹℃壒',
+ type: 'link',
+ icon: ACTION_ICON.VIEW,
+ auth: ['erp:purchase-order:update-status'],
+ ifShow: () => row.status === 0,
+ popConfirm: {
+ title: `鎻愪氦閲囪喘璁㈠崟${row.no}瀹℃壒鍚楋紵`,
+ confirm: handleSubmit.bind(null, row),
+ },
+ },
+ {
label: '纭鏀惰揣',
type: 'link',
icon: ACTION_ICON.VIEW,
diff --git a/src/views/erp/purchase/order/modules/item-form.vue b/src/views/erp/purchase/order/modules/item-form.vue
index 7ba1dc1..61d915f 100644
--- a/src/views/erp/purchase/order/modules/item-form.vue
+++ b/src/views/erp/purchase/order/modules/item-form.vue
@@ -164,6 +164,7 @@
/** 澶勭悊琛屾暟鎹彉鏇� */
function handleRowChange(row: any) {
+ calcRow(row);
const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index === -1) {
tableData.value.push(row);
@@ -173,14 +174,30 @@
emit('update:items', [...tableData.value]);
}
+/**
+ * 璁$畻琛岄噾棰�
+ * 鍗曚环涓哄惈绋庡崟浠凤細閲戦锛堜环绋庡悎璁★級= 鍗曚环 * 鏁伴噺锛岀◣棰濅粠鍚◣閲戦涓弽绠楋紝涓嶅啀棰濆鍔犵◣
+ */
+function calcRow(row: ErpPurchaseOrderApi.PurchaseOrderItem) {
+ if (!row.productPrice || !row.count) {
+ return;
+ }
+ const totalProductPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
+ const taxPercent = Number(row.taxPercent) || 0;
+ row.totalProductPrice = totalProductPrice;
+ row.taxPrice =
+ taxPercent > 0
+ ? (erpPriceMultiply(
+ totalProductPrice,
+ taxPercent / (100 + taxPercent),
+ ) ?? 0)
+ : 0;
+ row.totalPrice = totalProductPrice;
+}
+
/** 鍒濆鍖栬鏁版嵁 */
function initRow(row: ErpPurchaseOrderApi.PurchaseOrderItem) {
- if (row.productPrice && row.count) {
- row.totalProductPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
- row.taxPrice =
- erpPriceMultiply(row.totalProductPrice, (row.taxPercent || 0) / 100) ?? 0;
- row.totalPrice = row.totalProductPrice + row.taxPrice;
- }
+ calcRow(row);
}
/** 琛ㄥ崟鏍¢獙 */
@@ -195,7 +212,7 @@
throw new Error(`绗� ${i + 1} 琛岋細浜у搧鏁伴噺涓嶈兘涓虹┖`);
}
if (!item.productPrice || item.productPrice <= 0) {
- throw new Error(`绗� ${i + 1} 琛岋細浜у搧鍗曚环涓嶈兘涓虹┖`);
+ throw new Error(`绗� ${i + 1} 琛岋細鍚◣鍗曚环涓嶈兘涓虹┖`);
}
}
}
@@ -294,11 +311,10 @@
<div class="flex space-x-4">
<span>鏁伴噺锛歿{ erpCountInputFormatter(summaries.count) }}</span>
<span>
- 閲戦锛歿{ erpPriceInputFormatter(summaries.totalProductPrice) }}
+ 绋庨锛堜环鍐呭惈锛夛細{{ erpPriceInputFormatter(summaries.taxPrice) }}
</span>
- <span>绋庨锛歿{ erpPriceInputFormatter(summaries.taxPrice) }}</span>
<span>
- 绋庨鍚堣锛歿{ erpPriceInputFormatter(summaries.totalPrice) }}
+ 浠风◣鍚堣锛歿{ erpPriceInputFormatter(summaries.totalPrice) }}
</span>
</div>
</div>
diff --git a/src/views/erp/purchase/request/data.ts b/src/views/erp/purchase/request/data.ts
index dd16834..b1f70ae 100644
--- a/src/views/erp/purchase/request/data.ts
+++ b/src/views/erp/purchase/request/data.ts
@@ -167,14 +167,14 @@
},
{
field: 'productPrice',
- title: '鍗曚环锛堝弬鑰冧环锛�',
+ title: '鍚◣鍗曚环',
minWidth: 120,
fixed: 'right',
slots: { default: 'productPrice' },
},
{
field: 'totalPrice',
- title: '棰勪及閲戦',
+ title: '浠风◣鍚堣',
minWidth: 120,
fixed: 'right',
formatter: 'formatAmount2',
@@ -339,7 +339,7 @@
},
{
field: 'totalPrice',
- title: '棰勪及閲戦',
+ title: '浠风◣鍚堣',
formatter: 'formatAmount2',
minWidth: 120,
},
diff --git a/src/views/erp/purchase/request/detail/index.vue b/src/views/erp/purchase/request/detail/index.vue
index 2f026c5..6d6f9d0 100644
--- a/src/views/erp/purchase/request/detail/index.vue
+++ b/src/views/erp/purchase/request/detail/index.vue
@@ -42,13 +42,13 @@
},
{
field: 'productPrice',
- title: '鍗曚环锛堝弬鑰冧环锛�',
+ title: '鍚◣鍗曚环',
minWidth: 120,
formatter: ({ cellValue }) => erpPriceInputFormatter(cellValue) || '-',
},
{
field: 'totalPrice',
- title: '棰勪及閲戦',
+ title: '浠风◣鍚堣',
minWidth: 120,
formatter: ({ cellValue }) => erpPriceInputFormatter(cellValue) || '-',
},
@@ -119,7 +119,7 @@
render: (val) => erpCountInputFormatter(val) || '-',
},
{
- label: '鍚堣閲戦',
+ label: '浠风◣鍚堣',
field: 'totalPrice',
render: (val) => erpPriceInputFormatter(val) || '-',
},
diff --git a/src/views/erp/purchase/return/data.ts b/src/views/erp/purchase/return/data.ts
index 8dd033c..80c13b3 100644
--- a/src/views/erp/purchase/return/data.ts
+++ b/src/views/erp/purchase/return/data.ts
@@ -258,17 +258,10 @@
},
{
field: 'productPrice',
- title: '浜у搧鍗曚环',
+ title: '鍚◣鍗曚环',
fixed: 'right',
minWidth: 120,
slots: { default: 'productPrice' },
- },
- {
- field: 'totalProductPrice',
- fixed: 'right',
- title: '浜у搧閲戦',
- minWidth: 120,
- formatter: 'formatAmount2',
},
{
fixed: 'right',
@@ -280,14 +273,14 @@
{
fixed: 'right',
field: 'taxPrice',
- title: '绋庨',
+ title: '绋庨锛堜环鍐呭惈锛�',
minWidth: 120,
formatter: 'formatAmount2',
},
{
field: 'totalPrice',
fixed: 'right',
- title: '鍚堣閲戦',
+ title: '浠风◣鍚堣',
minWidth: 120,
formatter: 'formatAmount2',
},
@@ -582,13 +575,13 @@
},
{
field: 'totalProductPrice',
- title: '閲戦鍚堣',
+ title: '浼樻儬鍓嶉噾棰�',
formatter: 'formatAmount2',
minWidth: 120,
},
{
field: 'totalPrice',
- title: '鍚◣閲戦',
+ title: '浠风◣鍚堣',
formatter: 'formatAmount2',
minWidth: 120,
},
diff --git a/src/views/erp/purchase/return/modules/item-form.vue b/src/views/erp/purchase/return/modules/item-form.vue
index a63e606..82de3b5 100644
--- a/src/views/erp/purchase/return/modules/item-form.vue
+++ b/src/views/erp/purchase/return/modules/item-form.vue
@@ -152,7 +152,7 @@
/** 澶勭悊琛屾暟鎹彉鏇� */
function handleRowChange(row: any) {
- // TODO 鑺嬭壙
+ calcRow(row);
const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index === -1) {
tableData.value.push(row);
@@ -162,14 +162,30 @@
emit('update:items', [...tableData.value]);
}
+/**
+ * 璁$畻琛岄噾棰�
+ * 鍗曚环涓哄惈绋庡崟浠凤細閲戦锛堜环绋庡悎璁★級= 鍗曚环 * 鏁伴噺锛岀◣棰濅粠鍚◣閲戦涓弽绠楋紝涓嶅啀棰濆鍔犵◣
+ */
+function calcRow(row: ErpPurchaseReturnApi.PurchaseReturnItem) {
+ if (!row.productPrice || !row.count) {
+ return;
+ }
+ const totalProductPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
+ const taxPercent = Number(row.taxPercent) || 0;
+ row.totalProductPrice = totalProductPrice;
+ row.taxPrice =
+ taxPercent > 0
+ ? (erpPriceMultiply(
+ totalProductPrice,
+ taxPercent / (100 + taxPercent),
+ ) ?? 0)
+ : 0;
+ row.totalPrice = totalProductPrice;
+}
+
/** 鍒濆鍖栬鏁版嵁 */
function initRow(row: ErpPurchaseReturnApi.PurchaseReturnItem) {
- if (row.productPrice && row.count) {
- row.totalProductPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
- row.taxPrice =
- erpPriceMultiply(row.totalProductPrice, (row.taxPercent || 0) / 100) ?? 0;
- row.totalPrice = row.totalProductPrice + row.taxPrice;
- }
+ calcRow(row);
}
/** 琛ㄥ崟鏍¢獙 */
@@ -272,11 +288,10 @@
<div class="flex space-x-4">
<span>鏁伴噺锛歿{ erpCountInputFormatter(summaries.count) }}</span>
<span>
- 閲戦锛歿{ erpPriceInputFormatter(summaries.totalProductPrice) }}
+ 绋庨锛堜环鍐呭惈锛夛細{{ erpPriceInputFormatter(summaries.taxPrice) }}
</span>
- <span>绋庨锛歿{ erpPriceInputFormatter(summaries.taxPrice) }}</span>
<span>
- 绋庨鍚堣锛歿{ erpPriceInputFormatter(summaries.totalPrice) }}
+ 浠风◣鍚堣锛歿{ erpPriceInputFormatter(summaries.totalPrice) }}
</span>
</div>
</div>
diff --git a/src/views/erp/purchase/statement/index.vue b/src/views/erp/purchase/statement/index.vue
new file mode 100644
index 0000000..fddb58b
--- /dev/null
+++ b/src/views/erp/purchase/statement/index.vue
@@ -0,0 +1,270 @@
+<script lang="ts" setup>
+import type { Dayjs } from 'dayjs';
+
+import type { ErpSupplierStatementApi } from '#/api/erp/purchase/statement';
+import type { SrmSupplierApi } from '#/api/srm/supplier';
+
+import { onMounted, ref } from 'vue';
+
+import { DICT_TYPE } from '@vben/constants';
+import { getDictLabel } from '@vben/hooks';
+
+import { message } from 'ant-design-vue';
+
+import { getSupplierStatement } from '#/api/erp/purchase/statement';
+import { getSupplierSimpleList } from '#/api/srm/supplier';
+
+defineOptions({ name: 'ErpSupplierStatement' });
+
+const supplierId = ref<number>();
+const dateRange = ref<[Dayjs, Dayjs]>();
+const supplierOptions = ref<SrmSupplierApi.SupplierVO[]>([]);
+const statement = ref<ErpSupplierStatementApi.Statement>();
+const loading = ref(false);
+
+const orderColumns = [
+ { title: '閲囪喘璁㈠崟鍙�', dataIndex: 'no', key: 'no', width: 170 },
+ { title: '璁㈠崟鏃堕棿', dataIndex: 'orderTime', key: 'orderTime', width: 150 },
+ { title: '璁㈠崟閲戦', dataIndex: 'orderAmount', key: 'orderAmount', width: 120 },
+ {
+ title: '宸插紑绁ㄩ噾棰�',
+ dataIndex: 'invoicedAmount',
+ key: 'invoicedAmount',
+ width: 120,
+ },
+ {
+ title: '鏈紑绁ㄩ噾棰�',
+ dataIndex: 'uninvoicedAmount',
+ key: 'uninvoicedAmount',
+ width: 120,
+ },
+ { title: '鐘舵��', dataIndex: 'status', key: 'status', width: 100 },
+];
+
+const invoiceColumns = [
+ { title: '鏉ョエ鍗曞彿', dataIndex: 'no', key: 'no', width: 160 },
+ { title: '鍙戠エ鍙�', dataIndex: 'invoiceNo', key: 'invoiceNo', width: 140 },
+ { title: '鏉ョエ鏃堕棿', dataIndex: 'invoiceTime', key: 'invoiceTime', width: 150 },
+ {
+ title: '寮�绁ㄩ噾棰�',
+ dataIndex: 'invoiceAmount',
+ key: 'invoiceAmount',
+ width: 120,
+ },
+ { title: '宸蹭粯閲戦', dataIndex: 'paidAmount', key: 'paidAmount', width: 120 },
+ {
+ title: '鍓╀綑搴斾粯',
+ dataIndex: 'remainingPayable',
+ key: 'remainingPayable',
+ width: 120,
+ },
+ { title: '閲囪喘璁㈠崟', dataIndex: 'purchaseOrderNo', key: 'purchaseOrderNo', width: 160 },
+];
+
+const paymentColumns = [
+ { title: '浠樻鍗曞彿', dataIndex: 'no', key: 'no', width: 160 },
+ { title: '浠樻鏃堕棿', dataIndex: 'paymentTime', key: 'paymentTime', width: 150 },
+ {
+ title: '浠樻閲戦',
+ dataIndex: 'paymentAmount',
+ key: 'paymentAmount',
+ width: 120,
+ },
+ { title: '鍏宠仈鍙戠エ', dataIndex: 'invoiceNo', key: 'invoiceNo', width: 150 },
+ { title: '鐘舵��', dataIndex: 'status', key: 'status', width: 100 },
+];
+
+function formatMoney(value?: number) {
+ return value === undefined || value === null ? '-' : Number(value).toFixed(2);
+}
+
+function getStatusLabel(status?: number) {
+ if (status === undefined || status === null) {
+ return '-';
+ }
+ return getDictLabel(DICT_TYPE.ERP_AUDIT_STATUS, status) || '-';
+}
+
+function getPaymentStatusLabel(status?: number) {
+ return (
+ ['鏈粯娆�', '閮ㄥ垎浠樻', '鍏ㄩ儴浠樻'][status ?? 0] ?? '-'
+ );
+}
+
+async function handleQuery() {
+ if (!supplierId.value) {
+ message.warning('璇烽�夋嫨渚涘簲鍟�');
+ return;
+ }
+ loading.value = true;
+ try {
+ const params: {
+ supplierId: number;
+ beginTime?: string;
+ endTime?: string;
+ } = { supplierId: supplierId.value };
+ if (dateRange.value?.length === 2) {
+ params.beginTime = dateRange.value[0]!.startOf('day').format('YYYY-MM-DD HH:mm:ss');
+ params.endTime = dateRange.value[1]!.endOf('day').format('YYYY-MM-DD HH:mm:ss');
+ }
+ statement.value = await getSupplierStatement(params);
+ } finally {
+ loading.value = false;
+ }
+}
+
+onMounted(async () => {
+ supplierOptions.value = (await getSupplierSimpleList()) ?? [];
+});
+</script>
+
+<template>
+ <Page auto-content-height>
+ <div class="p-4" :class="{ 'pointer-events-none opacity-60': loading }">
+ <div class="mb-4 flex flex-wrap items-center gap-3">
+ <span class="text-sm text-gray-500">渚涘簲鍟�</span>
+ <a-select
+ v-model:value="supplierId"
+ show-search
+ option-filter-prop="label"
+ placeholder="璇烽�夋嫨渚涘簲鍟�"
+ style="width: 260px"
+ :options="
+ supplierOptions.map((item) => ({
+ label: item.name,
+ value: item.id,
+ }))
+ "
+ />
+ <a-range-picker v-model:value="dateRange" />
+ <a-button type="primary" :loading="loading" @click="handleQuery">
+ 鏌ヨ
+ </a-button>
+ <span v-if="statement?.supplierName" class="text-sm text-gray-600">
+ 褰撳墠渚涘簲鍟嗭細{{ statement.supplierName }}
+ </span>
+ </div>
+
+ <a-row :gutter="16" class="mb-4">
+ <a-col :span="6">
+ <a-card size="small">
+ <div class="text-gray-500">绱閲囪喘棰�</div>
+ <div class="text-2xl font-semibold">
+ {{ formatMoney(statement?.summary?.totalPurchaseAmount) }}
+ </div>
+ </a-card>
+ </a-col>
+ <a-col :span="6">
+ <a-card size="small">
+ <div class="text-gray-500">绱寮�绁ㄩ</div>
+ <div class="text-2xl font-semibold text-blue-600">
+ {{ formatMoney(statement?.summary?.totalInvoiceAmount) }}
+ </div>
+ </a-card>
+ </a-col>
+ <a-col :span="6">
+ <a-card size="small">
+ <div class="text-gray-500">绱浠樻棰�</div>
+ <div class="text-2xl font-semibold text-green-600">
+ {{ formatMoney(statement?.summary?.totalPaymentAmount) }}
+ </div>
+ </a-card>
+ </a-col>
+ <a-col :span="6">
+ <a-card size="small">
+ <div class="text-gray-500">鏈粯浣欓锛堝紑绁� - 浠樻锛�</div>
+ <div class="text-2xl font-semibold text-red-600">
+ {{ formatMoney(statement?.summary?.unpaidAmount) }}
+ </div>
+ </a-card>
+ </a-col>
+ </a-row>
+
+ <a-row :gutter="16">
+ <a-col :span="12">
+ <a-card title="閲囪喘璁㈠崟娴佹按锛堝惈寮�绁ㄩ噾棰濓級" size="small">
+ <a-table
+ :columns="orderColumns"
+ :data-source="statement?.orders ?? []"
+ :pagination="false"
+ size="small"
+ bordered
+ :scroll="{ x: 800 }"
+ >
+ <template #bodyCell="{ column, record }">
+ <template v-if="column.key === 'orderAmount'">
+ {{ formatMoney(record.orderAmount) }}
+ </template>
+ <template v-else-if="column.key === 'invoicedAmount'">
+ <span class="text-blue-600">
+ {{ formatMoney(record.invoicedAmount) }}
+ </span>
+ </template>
+ <template v-else-if="column.key === 'uninvoicedAmount'">
+ <span class="text-red-600">
+ {{ formatMoney(record.uninvoicedAmount) }}
+ </span>
+ </template>
+ <template v-else-if="column.key === 'status'">
+ {{ getStatusLabel(record.status) }}
+ </template>
+ </template>
+ </a-table>
+ </a-card>
+ </a-col>
+ <a-col :span="12">
+ <a-card title="閲囪喘鏉ョエ娴佹按锛堝紑绁ㄩ噾棰� / 宸蹭粯 / 鍓╀綑搴斾粯锛�" size="small">
+ <a-table
+ :columns="invoiceColumns"
+ :data-source="statement?.invoices ?? []"
+ :pagination="false"
+ size="small"
+ bordered
+ :scroll="{ x: 900 }"
+ >
+ <template #bodyCell="{ column, record }">
+ <template v-if="column.key === 'invoiceAmount'">
+ <span class="text-blue-600">
+ {{ formatMoney(record.invoiceAmount) }}
+ </span>
+ </template>
+ <template v-else-if="column.key === 'paidAmount'">
+ {{ formatMoney(record.paidAmount) }}
+ </template>
+ <template v-else-if="column.key === 'remainingPayable'">
+ <span class="text-red-600">
+ {{ formatMoney(record.remainingPayable) }}
+ </span>
+ </template>
+ <template v-else-if="column.key === 'paymentStatus'">
+ {{ getPaymentStatusLabel(record.paymentStatus) }}
+ </template>
+ </template>
+ </a-table>
+ </a-card>
+ <a-card title="浠樻娴佹按" size="small" class="mt-4">
+ <a-table
+ :columns="paymentColumns"
+ :data-source="statement?.payments ?? []"
+ :pagination="false"
+ size="small"
+ bordered
+ :scroll="{ x: 700 }"
+ >
+ <template #bodyCell="{ column, record }">
+ <template v-if="column.key === 'paymentAmount'">
+ <span class="text-green-600">
+ {{ formatMoney(record.paymentAmount) }}
+ </span>
+ </template>
+ <template v-else-if="column.key === 'status'">
+ {{ getStatusLabel(record.status) }}
+ </template>
+ </template>
+ </a-table>
+ </a-card>
+ </a-col>
+ </a-row>
+ </div>
+ </Page>
+</template>
diff --git a/src/views/srm/bidBond/data.ts b/src/views/srm/bidBond/data.ts
new file mode 100644
index 0000000..bc47f5e
--- /dev/null
+++ b/src/views/srm/bidBond/data.ts
@@ -0,0 +1,255 @@
+import type { VbenFormSchema } from '#/adapter/form';
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+
+import { z } from '#/adapter/form';
+import { getPurchaseOrderPage } from '#/api/erp/purchase/order';
+import { getInquirySimpleList } from '#/api/srm/inquiry';
+import { getSupplierSimpleList } from '#/api/srm/supplier';
+
+export const REFUND_STATUS_OPTIONS = [
+ { label: '鏈��鍥�', value: 0, color: 'warning' },
+ { label: '閮ㄥ垎閫�鍥�', value: 1, color: 'processing' },
+ { label: '宸查��鍥�', value: 2, color: 'success' },
+ { label: '鏃犻渶閫�鍥�', value: 3, color: 'default' },
+];
+
+export function getRefundStatusLabel(status?: number) {
+ return REFUND_STATUS_OPTIONS.find((item) => item.value === status)?.label ?? '-';
+}
+
+export function getRefundStatusColor(status?: number) {
+ return REFUND_STATUS_OPTIONS.find((item) => item.value === status)?.color ?? 'default';
+}
+
+/** 閲囪喘璁㈠崟涓嬫媺鏁版嵁 */
+async function getPurchaseOrderOptions() {
+ const result = await getPurchaseOrderPage({ pageNo: 1, pageSize: 200 });
+ return result.list ?? [];
+}
+
+/** 鏂板/淇敼鎶曟爣淇濊瘉閲戠殑琛ㄥ崟 */
+export function useFormSchema(): VbenFormSchema[] {
+ return [
+ {
+ fieldName: 'supplierId',
+ label: '渚涘簲鍟�',
+ component: 'ApiSelect',
+ rules: 'required',
+ componentProps: {
+ placeholder: '璇烽�夋嫨渚涘簲鍟�',
+ allowClear: true,
+ showSearch: true,
+ api: getSupplierSimpleList,
+ labelField: 'name',
+ valueField: 'id',
+ },
+ },
+ {
+ fieldName: 'projectName',
+ label: '椤圭洰鍚嶇О',
+ component: 'Input',
+ componentProps: { placeholder: '閫夋嫨璇环鍗曞悗鑷姩甯﹀嚭锛屼篃鍙墜宸ュ~鍐�' },
+ },
+ {
+ fieldName: 'inquiryId',
+ label: '鍏宠仈璇环鍗�',
+ component: 'ApiSelect',
+ componentProps: {
+ placeholder: '璇烽�夋嫨璇环鍗�',
+ allowClear: true,
+ showSearch: true,
+ api: getInquirySimpleList,
+ labelField: 'title',
+ valueField: 'id',
+ },
+ },
+ {
+ fieldName: 'purchaseOrderId',
+ label: '鍏宠仈閲囪喘璁㈠崟',
+ component: 'ApiSelect',
+ componentProps: {
+ placeholder: '璇烽�夋嫨閲囪喘璁㈠崟',
+ allowClear: true,
+ showSearch: true,
+ api: getPurchaseOrderOptions,
+ labelField: 'no',
+ valueField: 'id',
+ },
+ },
+ {
+ fieldName: 'bondAmount',
+ label: '淇濊瘉閲戦噾棰�',
+ component: 'InputNumber',
+ rules: 'required',
+ componentProps: {
+ class: '!w-full',
+ placeholder: '璇疯緭鍏ヤ繚璇侀噾閲戦',
+ min: 0,
+ precision: 2,
+ },
+ },
+ {
+ fieldName: 'payDate',
+ label: '缂寸撼鏃ユ湡',
+ component: 'DatePicker',
+ componentProps: {
+ class: 'w-full',
+ placeholder: '璇烽�夋嫨缂寸撼鏃ユ湡',
+ format: 'YYYY-MM-DD',
+ valueFormat: 'YYYY-MM-DD',
+ },
+ },
+ {
+ fieldName: 'won',
+ label: '鏄惁涓爣',
+ component: 'Switch',
+ componentProps: {
+ checkedChildren: '涓爣',
+ unCheckedChildren: '鏈腑鏍�',
+ },
+ rules: z.boolean().default(false),
+ },
+ {
+ fieldName: 'refundStatus',
+ label: '閫�鍥炵姸鎬�',
+ component: 'Select',
+ componentProps: {
+ placeholder: '璇烽�夋嫨閫�鍥炵姸鎬�',
+ options: REFUND_STATUS_OPTIONS.map(({ label, value }) => ({
+ label,
+ value,
+ })),
+ },
+ },
+ {
+ fieldName: 'refundAmount',
+ label: '閫�鍥為噾棰�',
+ component: 'InputNumber',
+ componentProps: {
+ class: '!w-full',
+ placeholder: '璇疯緭鍏ラ��鍥為噾棰�',
+ min: 0,
+ precision: 2,
+ },
+ },
+ {
+ fieldName: 'refundDate',
+ label: '閫�鍥炴棩鏈�',
+ component: 'DatePicker',
+ componentProps: {
+ class: 'w-full',
+ placeholder: '璇烽�夋嫨閫�鍥炴棩鏈�',
+ format: 'YYYY-MM-DD',
+ valueFormat: 'YYYY-MM-DD',
+ },
+ },
+ {
+ fieldName: 'remark',
+ label: '澶囨敞',
+ component: 'Textarea',
+ componentProps: { placeholder: '璇疯緭鍏ュ娉�', rows: 2 },
+ formItemClass: 'col-span-2',
+ },
+ ];
+}
+
+/** 鎼滅储琛ㄥ崟 */
+export function useGridFormSchema(): VbenFormSchema[] {
+ return [
+ {
+ fieldName: 'no',
+ label: '淇濊瘉閲戝崟鍙�',
+ component: 'Input',
+ componentProps: { placeholder: '璇疯緭鍏ヤ繚璇侀噾鍗曞彿', allowClear: true },
+ },
+ {
+ fieldName: 'supplierId',
+ label: '渚涘簲鍟�',
+ component: 'ApiSelect',
+ componentProps: {
+ placeholder: '璇烽�夋嫨渚涘簲鍟�',
+ allowClear: true,
+ showSearch: true,
+ api: getSupplierSimpleList,
+ labelField: 'name',
+ valueField: 'id',
+ },
+ },
+ {
+ fieldName: 'projectName',
+ label: '椤圭洰鍚嶇О',
+ component: 'Input',
+ componentProps: { placeholder: '璇疯緭鍏ラ」鐩悕绉�', allowClear: true },
+ },
+ {
+ fieldName: 'won',
+ label: '鏄惁涓爣',
+ component: 'Select',
+ componentProps: {
+ placeholder: '璇烽�夋嫨',
+ allowClear: true,
+ options: [
+ { label: '涓爣', value: true },
+ { label: '鏈腑鏍�', value: false },
+ ],
+ },
+ },
+ {
+ fieldName: 'refundStatus',
+ label: '閫�鍥炵姸鎬�',
+ component: 'Select',
+ componentProps: {
+ placeholder: '璇烽�夋嫨閫�鍥炵姸鎬�',
+ allowClear: true,
+ options: REFUND_STATUS_OPTIONS.map(({ label, value }) => ({
+ label,
+ value,
+ })),
+ },
+ },
+ ];
+}
+
+/** 琛ㄦ牸鍒� */
+export function useGridColumns(): VxeTableGridOptions['columns'] {
+ return [
+ { field: 'no', title: '淇濊瘉閲戝崟鍙�', minWidth: 150 },
+ { field: 'supplierName', title: '渚涘簲鍟�', minWidth: 150 },
+ { field: 'projectName', title: '椤圭洰鍚嶇О', minWidth: 180 },
+ { field: 'inquiryNo', title: '鍏宠仈璇环鍗�', minWidth: 150 },
+ { field: 'purchaseOrderNo', title: '鍏宠仈閲囪喘璁㈠崟', minWidth: 160 },
+ {
+ field: 'bondAmount',
+ title: '淇濊瘉閲戦噾棰�',
+ minWidth: 120,
+ formatter: 'formatAmount2',
+ },
+ { field: 'payDate', title: '缂寸撼鏃ユ湡', minWidth: 110 },
+ {
+ field: 'won',
+ title: '鏄惁涓爣',
+ minWidth: 90,
+ slots: { default: 'won' },
+ },
+ {
+ field: 'refundStatus',
+ title: '閫�鍥炵姸鎬�',
+ minWidth: 110,
+ slots: { default: 'refundStatus' },
+ },
+ {
+ field: 'refundAmount',
+ title: '閫�鍥為噾棰�',
+ minWidth: 120,
+ formatter: 'formatAmount2',
+ },
+ { field: 'refundDate', title: '閫�鍥炴棩鏈�', minWidth: 110 },
+ { field: 'remark', title: '澶囨敞', minWidth: 150 },
+ {
+ title: '鎿嶄綔',
+ width: 130,
+ fixed: 'right',
+ slots: { default: 'actions' },
+ },
+ ];
+}
diff --git a/src/views/srm/bidBond/index.vue b/src/views/srm/bidBond/index.vue
new file mode 100644
index 0000000..49b9a04
--- /dev/null
+++ b/src/views/srm/bidBond/index.vue
@@ -0,0 +1,127 @@
+<script lang="ts" setup>
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+import type { SrmBidBondApi } from '#/api/srm/bidBond';
+
+import { Page, useVbenModal } from '@vben/common-ui';
+
+import { message, Tag } from 'ant-design-vue';
+
+import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
+import {
+ deleteBidBond,
+ getBidBondPage,
+} from '#/api/srm/bidBond';
+import { $t } from '#/locales';
+
+import {
+ getRefundStatusColor,
+ getRefundStatusLabel,
+ useGridColumns,
+ useGridFormSchema,
+} from './data';
+import BidBondForm from './modules/form.vue';
+
+defineOptions({ name: 'SrmBidBond' });
+
+const [FormModal, formModalApi] = useVbenModal({
+ connectedComponent: BidBondForm,
+ destroyOnClose: true,
+});
+
+function handleRefresh() {
+ gridApi.query();
+}
+
+function handleCreate() {
+ formModalApi.setData(null).open();
+}
+
+function handleEdit(row: SrmBidBondApi.BidBond) {
+ formModalApi.setData({ id: row.id }).open();
+}
+
+async function handleDelete(row: SrmBidBondApi.BidBond) {
+ await deleteBidBond(row.id!);
+ message.success($t('ui.actionMessage.deleteSuccess', [row.no]));
+ handleRefresh();
+}
+
+const [Grid, gridApi] = useVbenVxeGrid({
+ formOptions: {
+ schema: useGridFormSchema(),
+ },
+ gridOptions: {
+ columns: useGridColumns(),
+ height: 'auto',
+ keepSource: true,
+ proxyConfig: {
+ ajax: {
+ query: async ({ page }, formValues) => {
+ return await getBidBondPage({
+ pageNo: page.currentPage,
+ pageSize: page.pageSize,
+ ...formValues,
+ });
+ },
+ },
+ },
+ rowConfig: { keyField: 'id', isHover: true },
+ toolbarConfig: { refresh: true, search: true },
+ } as VxeTableGridOptions<SrmBidBondApi.BidBond>,
+});
+</script>
+
+<template>
+ <Page auto-content-height>
+ <FormModal @success="handleRefresh" />
+ <Grid table-title="鎶曟爣淇濊瘉閲戝彴璐�">
+ <template #toolbar-tools>
+ <TableAction
+ :actions="[
+ {
+ label: $t('ui.actionTitle.create', ['鎶曟爣淇濊瘉閲�']),
+ type: 'primary',
+ icon: ACTION_ICON.ADD,
+ auth: ['srm:bid-bond:create'],
+ onClick: handleCreate,
+ },
+ ]"
+ />
+ </template>
+ <template #won="{ row }">
+ <Tag :color="row.won ? 'success' : 'default'">
+ {{ row.won ? '涓爣' : '鏈腑鏍�' }}
+ </Tag>
+ </template>
+ <template #refundStatus="{ row }">
+ <Tag :color="getRefundStatusColor(row.refundStatus)">
+ {{ getRefundStatusLabel(row.refundStatus) }}
+ </Tag>
+ </template>
+ <template #actions="{ row }">
+ <TableAction
+ :actions="[
+ {
+ label: $t('common.edit'),
+ type: 'link',
+ icon: ACTION_ICON.EDIT,
+ auth: ['srm:bid-bond:update'],
+ onClick: handleEdit.bind(null, row),
+ },
+ {
+ label: $t('common.delete'),
+ type: 'link',
+ danger: true,
+ icon: ACTION_ICON.DELETE,
+ auth: ['srm:bid-bond:delete'],
+ popConfirm: {
+ title: $t('ui.actionMessage.deleteConfirm', [row.no]),
+ confirm: handleDelete.bind(null, row),
+ },
+ },
+ ]"
+ />
+ </template>
+ </Grid>
+ </Page>
+</template>
diff --git a/src/views/srm/bidBond/modules/form.vue b/src/views/srm/bidBond/modules/form.vue
new file mode 100644
index 0000000..a0c39ab
--- /dev/null
+++ b/src/views/srm/bidBond/modules/form.vue
@@ -0,0 +1,116 @@
+<script lang="ts" setup>
+import type { ErpPurchaseOrderApi } from '#/api/erp/purchase/order';
+import type { SrmBidBondApi } from '#/api/srm/bidBond';
+
+import { computed, ref } from 'vue';
+
+import { useVbenModal } from '@vben/common-ui';
+
+import { message } from 'ant-design-vue';
+
+import { useVbenForm } from '#/adapter/form';
+import { getPurchaseOrder } from '#/api/erp/purchase/order';
+import {
+ createBidBond,
+ getBidBond,
+ updateBidBond,
+} from '#/api/srm/bidBond';
+import { getInquiry } from '#/api/srm/inquiry';
+import { $t } from '#/locales';
+
+import { useFormSchema } from '../data';
+
+const emit = defineEmits(['success']);
+const formData = ref<SrmBidBondApi.BidBond>();
+const getTitle = computed(() => {
+ return formData.value?.id
+ ? $t('ui.actionTitle.edit', ['鎶曟爣淇濊瘉閲�'])
+ : $t('ui.actionTitle.create', ['鎶曟爣淇濊瘉閲�']);
+});
+
+const [Form, formApi] = useVbenForm({
+ commonConfig: {
+ componentProps: { class: 'w-full' },
+ labelWidth: 110,
+ },
+ wrapperClass: 'grid-cols-2',
+ layout: 'horizontal',
+ schema: useFormSchema(),
+ showDefaultActions: false,
+ handleValuesChange: async (values, changedFields) => {
+ if (changedFields.includes('inquiryId') && values.inquiryId) {
+ try {
+ const inquiry = await getInquiry(values.inquiryId);
+ await formApi.setValues({
+ projectName: inquiry.title,
+ });
+ } catch {
+ // 璇环鍗曡鍙栧け璐ユ椂涓嶉樆鏂墜宸ュ綍鍏�
+ }
+ }
+ if (changedFields.includes('purchaseOrderId') && values.purchaseOrderId) {
+ try {
+ const order: ErpPurchaseOrderApi.PurchaseOrder =
+ await getPurchaseOrder(values.purchaseOrderId);
+ await formApi.setValues({
+ supplierId: order.supplierId,
+ projectName: values.projectName || order.no,
+ won: true,
+ });
+ } catch {
+ // 閲囪喘璁㈠崟璇诲彇澶辫触鏃朵笉闃绘柇鎵嬪伐褰曞叆
+ }
+ }
+ },
+});
+
+const [Modal, modalApi] = useVbenModal({
+ async onConfirm() {
+ const { valid } = await formApi.validate();
+ if (!valid) {
+ return;
+ }
+ const data = (await formApi.getValues()) as SrmBidBondApi.BidBond;
+ if (data.won && data.refundStatus === undefined) {
+ data.refundStatus = 3;
+ }
+ modalApi.lock();
+ try {
+ await (formData.value?.id
+ ? updateBidBond({ ...data, id: formData.value.id })
+ : createBidBond(data));
+ await modalApi.close();
+ emit('success');
+ message.success($t('ui.actionMessage.operationSuccess'));
+ } finally {
+ modalApi.unlock();
+ }
+ },
+ async onOpenChange(isOpen: boolean) {
+ if (!isOpen) {
+ formData.value = undefined;
+ return;
+ }
+ const data = modalApi.getData<{ id?: number }>();
+ if (!data?.id) {
+ formData.value = undefined;
+ return;
+ }
+ modalApi.lock();
+ try {
+ formData.value = await getBidBond(data.id);
+ await formApi.setValues(formData.value);
+ } finally {
+ modalApi.unlock();
+ }
+ },
+});
+
+defineExpose({ modalApi });
+</script>
+
+<template>
+ <Modal :title="getTitle" class="w-3/4">
+ <Form class="mx-4" />
+ </Modal>
+</template>
diff --git a/src/views/srm/enums.ts b/src/views/srm/enums.ts
index 3c2cb0a..9930d77 100644
--- a/src/views/srm/enums.ts
+++ b/src/views/srm/enums.ts
@@ -1,6 +1,6 @@
// ============================================================
// SRM 缁熶竴鏋氫妇甯搁噺
-// 鎵�鏈夊�间弗鏍煎榻愬悗绔灇涓惧畾涔� (yudao-module-srm/enums/)
+// 浠呬繚鐣欎緵搴斿晢妗f鍦ㄧ敤甯搁噺锛涘噯鍏�/璧勮川/缁╂晥/鎷涙姇鏍囧凡绉婚櫎
// ============================================================
/** 閫夐」绫诲瀷 (Select/RadioGroup閫氱敤) */
@@ -28,7 +28,10 @@
{ label: '鍏抽棴', value: 1 },
];
-export const SUPPLIER_STATUS_CELLTAG: { data: CellTagItem[]; labels: Record<number, string> } = {
+export const SUPPLIER_STATUS_CELLTAG: {
+ data: CellTagItem[];
+ labels: Record<number, string>;
+} = {
data: [
{ value: 0, color: 'green' },
{ value: 1, color: 'red' },
@@ -52,237 +55,15 @@
{ label: '鍏朵粬', value: '4' },
];
-export const SUPPLIER_TYPE_CELLTAG: { data: CellTagItem[]; labels: Record<string, string> } = {
+export const SUPPLIER_TYPE_CELLTAG: {
+ data: CellTagItem[];
+ labels: Record<string, string>;
+} = {
data: [
{ value: '1', color: 'blue' },
{ value: '2', color: 'green' },
{ value: '3', color: 'orange' },
{ value: '4', color: 'default' },
],
- labels: { '1': '鐢熶骇鍨�', '2': '璐告槗鍨�', '3': '鏈嶅姟鍨�', '4': '鍏朵粬' },
+ labels: { 1: '鐢熶骇鍨�', 2: '璐告槗鍨�', 3: '鏈嶅姟鍨�', 4: '鍏朵粬' },
};
-
-// ========== 鍑嗗叆鐢宠 鈥� 瀵归綈 SupplierApplyStatusEnum (0/10/30/40/50)
-// 鎺ュ叆鍗忓悓鍔炲叕鍚庣畝鍖栦负 5 鎬侊細寰呮彁浜� / 瀹℃壒涓� / 宸插彇娑� / 宸查�氳繃 / 宸查┏鍥�
-// 鍘熷緟閲囪喘瀹℃牳(10)/寰呰川閲忓鏍�(20)/寰呰储鍔″鏍�(30)宸插簾寮� ==========
-
-export const APPLY_STATUS = {
- DRAFT: 0,
- PROCESS: 10,
- CANCEL: 30,
- APPROVED: 40,
- REJECTED: 50,
-} as const;
-
-export const APPLY_STATUS_OPTIONS: EnumOption[] = [
- { label: '寰呮彁浜�', value: 0 },
- { label: '瀹℃壒涓�', value: 10 },
- { label: '宸插彇娑�', value: 30 },
- { label: '宸查�氳繃', value: 40 },
- { label: '宸查┏鍥�', value: 50 },
-];
-
-export const APPLY_STATUS_CELLTAG: { data: CellTagItem[]; labels: Record<number, string> } = {
- data: [
- { value: 0, color: 'gray' },
- { value: 10, color: 'blue' },
- { value: 30, color: 'purple' },
- { value: 40, color: 'green' },
- { value: 50, color: 'red' },
- ],
- labels: { 0: '寰呮彁浜�', 10: '瀹℃壒涓�', 30: '宸插彇娑�', 40: '宸查�氳繃', 50: '宸查┏鍥�' },
-};
-
-// ========== 璧勮川璇佷功 鈥� 瀵归綈 CertificateTypeEnum (1=钀ヤ笟鎵х収 2=璁よ瘉璇佷功 3=妫�娴嬫姤鍛� 4=鍏朵粬) ==========
-
-export const CERTIFICATE_TYPE = {
- BUSINESS_LICENSE: 1,
- CERTIFICATION: 2,
- INSPECTION_REPORT: 3,
- OTHER: 4,
-} as const;
-
-export const CERTIFICATE_TYPE_OPTIONS: EnumOption[] = [
- { label: '钀ヤ笟鎵х収', value: 1 },
- { label: '璁よ瘉璇佷功', value: 2 },
- { label: '妫�娴嬫姤鍛�', value: 3 },
- { label: '鍏朵粬', value: 4 },
-];
-
-export const CERTIFICATE_TYPE_CELLTAG: { data: CellTagItem[]; labels: Record<number, string> } = {
- data: [
- { value: 1, color: 'blue' },
- { value: 2, color: 'green' },
- { value: 3, color: 'orange' },
- { value: 4, color: 'default' },
- ],
- labels: { 1: '钀ヤ笟鎵х収', 2: '璁よ瘉璇佷功', 3: '妫�娴嬫姤鍛�', 4: '鍏朵粬' },
-};
-
-// ========== 缁╂晥璇勪环 鈥� 鍚庣 evaluationLevel 涓� String 绫诲瀷 (A/B/C/D) ==========
-
-export const EVALUATION_GRADE = {
- A: 'A',
- B: 'B',
- C: 'C',
- D: 'D',
-} as const;
-
-export const EVALUATION_GRADE_CELLTAG: { data: CellTagItem[] } = {
- data: [
- { value: 'A', color: 'green' },
- { value: 'B', color: 'blue' },
- { value: 'C', color: 'orange' },
- { value: 'D', color: 'red' },
- ],
-};
-
-/** 缁煎悎璇勫垎鍖洪棿 鈥� 鍚庣璁$畻: >=90鈫扐, >=80鈫払, >=70鈫扖, <70鈫扗 */
-export const COMPOSITE_SCORE_CELLTAG: { data: CellTagItem[] } = {
- data: [
- { value: 90, color: 'green' },
- { value: 80, color: 'blue' },
- { value: 70, color: 'orange' },
- { value: 0, color: 'red' },
- ],
-};
-
-// ========== 鎷涙爣椤圭洰 鈥� 瀵归綈 TenderStatusEnum (0/1/2/3/4/5) + TenderTypeEnum (1/2/3) ==========
-
-/** 鎷涙爣绫诲瀷 鈥� 瀵归綈 TenderTypeEnum (1=鍏紑鎷涙爣 2=閭�璇锋嫑鏍� 3=绔炰簤鎬ц皥鍒�) */
-export const TENDER_TYPE = {
- PUBLIC: 1,
- INVITATION: 2,
- COMPETITIVE_NEGOTIATION: 3,
-} as const;
-
-export const TENDER_TYPE_OPTIONS: EnumOption[] = [
- { label: '鍏紑鎷涙爣', value: 1 },
- { label: '閭�璇锋嫑鏍�', value: 2 },
- { label: '绔炰簤鎬ц皥鍒�', value: 3 },
-];
-
-export const TENDER_TYPE_CELLTAG: { data: CellTagItem[]; labels: Record<number, string> } = {
- data: [
- { value: 1, color: 'blue' },
- { value: 2, color: 'blue' },
- { value: 3, color: 'green' },
- ],
- labels: { 1: '鍏紑鎷涙爣', 2: '閭�璇锋嫑鏍�', 3: '绔炰簤鎬ц皥鍒�' },
-};
-
-/** 鎷涙爣椤圭洰鐘舵�� 鈥� 瀵归綈 TenderStatusEnum (0=鑽夌 1=鍙戝竷涓� 2=鎶曟爣涓� 3=璇勬爣涓� 4=宸插畾鏍� 5=宸插叧闂� 10=姣斾环涓� 20=宸茬‘璁�) */
-export const TENDER_STATUS = {
- DRAFT: 0,
- PUBLISHED: 1,
- BIDDING: 2,
- EVALUATING: 3,
- AWARDED: 4,
- CLOSED: 5,
- PRICE_COMPARING: 10,
- CONFIRMED: 20,
-} as const;
-
-export const TENDER_STATUS_OPTIONS: EnumOption[] = [
- { label: '鑽夌', value: 0 },
- { label: '鍙戝竷涓�', value: 1 },
- { label: '鎶曟爣涓�', value: 2 },
- { label: '璇勬爣涓�', value: 3 },
- { label: '宸插畾鏍�', value: 4 },
- { label: '宸插叧闂�', value: 5 },
- { label: '姣斾环涓�', value: 10 },
- { label: '宸茬‘璁�', value: 20 },
-];
-
-export const TENDER_STATUS_CELLTAG: { data: CellTagItem[]; labels: Record<number, string> } = {
- data: [
- { value: 0, color: 'gray' },
- { value: 1, color: 'blue' },
- { value: 2, color: 'cyan' },
- { value: 3, color: 'orange' },
- { value: 4, color: 'green' },
- { value: 5, color: 'red' },
- { value: 10, color: 'purple' },
- { value: 20, color: 'green' },
- ],
- labels: { 0: '鑽夌', 1: '鍙戝竷涓�', 2: '鎶曟爣涓�', 3: '璇勬爣涓�', 4: '宸插畾鏍�', 5: '宸插叧闂�', 10: '姣斾环涓�', 20: '宸茬‘璁�' },
-};
-
-/** 鎷涙爣鐘舵�� Ant Design Tag 棰滆壊鏄犲皠 */
-export const TENDER_STATUS_COLORS: Record<number, string> = {
- [TENDER_STATUS.DRAFT]: 'default',
- [TENDER_STATUS.PUBLISHED]: 'blue',
- [TENDER_STATUS.BIDDING]: 'cyan',
- [TENDER_STATUS.EVALUATING]: 'orange',
- [TENDER_STATUS.AWARDED]: 'green',
- [TENDER_STATUS.CLOSED]: 'red',
- [TENDER_STATUS.PRICE_COMPARING]: 'purple',
- [TENDER_STATUS.CONFIRMED]: 'green',
-};
-
-// ========== 鎷涙姇鏍囨ā寮� 鈥� FULL=瀹屾暣鐗� SIMPLE=绠�鏄撶増 ==========
-
-export const BIDDING_MODE = {
- FULL: 'FULL',
- SIMPLE: 'SIMPLE',
-} as const;
-
-export const BIDDING_MODE_OPTIONS: EnumOption[] = [
- { label: '瀹屾暣鐗�', value: 'FULL' },
- { label: '绠�鏄撶増', value: 'SIMPLE' },
-];
-
-export const BIDDING_MODE_MAP: Record<string, string> = {
- FULL: '瀹屾暣鐗�',
- SIMPLE: '绠�鏄撶増',
-};
-
-// ========== 鎶曟爣 鈥� 瀵归綈 BidStatusEnum (0=鎶ュ悕 10=宸叉姇鏍� 20=鎾ゆ爣 30=涓爣 40=鏈腑鏍�) ==========
-
-export const BID_STATUS = {
- REGISTERED: 0,
- BID: 10,
- WITHDRAWN: 20,
- WIN: 30,
- LOSE: 40,
-} as const;
-
-export const BID_STATUS_MAP: Record<number, string> = {
- 0: '鎶ュ悕',
- 10: '宸叉姇鏍�',
- 20: '鎾ゆ爣',
- 30: '涓爣',
- 40: '鏈腑鏍�',
-};
-
-// ========== 瀹氭爣 鈥� 瀵归綈 AwardStatusEnum (0=寰呭鎵� 10=宸插畾鏍� 20=宸茬敓鎴愯鍗�) ==========
-
-export const AWARD_STATUS = {
- PENDING_APPROVAL: 0,
- AWARDED: 10,
- ORDER_GENERATED: 20,
-} as const;
-
-export const AWARD_STATUS_MAP: Record<number, string> = {
- 0: '寰呭鎵�',
- 10: '宸插畾鏍�',
- 20: '宸茬敓鎴愯鍗�',
-};
-
-// ========== 宸ュ叿鍑芥暟 ==========
-
-/** 鏍规嵁鍊艰幏鍙栨爣绛� */
-export function getLabel(map: Record<number, string>, value?: number): string {
- return value !== undefined ? map[value] || String(value) : '';
-}
-
-/** 灏� options 鏁扮粍杞负 labels 鏄犲皠 */
-export function optionsToLabels(options: EnumOption[]): Record<number, string> {
- const labels: Record<number, string> = {};
- for (const opt of options) {
- if (typeof opt.value === 'number') {
- labels[opt.value] = opt.label;
- }
- }
- return labels;
-}
diff --git a/src/views/srm/inquiry/data.ts b/src/views/srm/inquiry/data.ts
new file mode 100644
index 0000000..173da77
--- /dev/null
+++ b/src/views/srm/inquiry/data.ts
@@ -0,0 +1,128 @@
+import type { VbenFormSchema } from '#/adapter/form';
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+
+import { getSimpleUserList } from '#/api/system/user';
+
+/** 璇环鐘舵�� */
+export const INQUIRY_STATUS_OPTIONS = [
+ { label: '鑽夌', value: 0, color: 'default' },
+ { label: '璇环涓�', value: 10, color: 'processing' },
+ { label: '宸茶浆璁㈠崟', value: 20, color: 'success' },
+ { label: '宸插彇娑�', value: 30, color: 'error' },
+];
+
+export function getInquiryStatusLabel(status?: number) {
+ return INQUIRY_STATUS_OPTIONS.find((item) => item.value === status)?.label ?? '-';
+}
+
+/** 鏂板/淇敼璇环鍗曠殑琛ㄥ崟 */
+export function useFormSchema(): VbenFormSchema[] {
+ return [
+ {
+ fieldName: 'title',
+ label: '璇环鏍囬',
+ component: 'Input',
+ rules: 'required',
+ componentProps: { placeholder: '璇疯緭鍏ヨ浠锋爣棰�' },
+ formItemClass: 'col-span-2',
+ },
+ {
+ fieldName: 'inquiryDate',
+ label: '璇环鏃ユ湡',
+ component: 'DatePicker',
+ componentProps: {
+ class: 'w-full',
+ placeholder: '璇烽�夋嫨璇环鏃ユ湡',
+ format: 'YYYY-MM-DD',
+ valueFormat: 'YYYY-MM-DD',
+ },
+ rules: 'required',
+ },
+ {
+ fieldName: 'deadline',
+ label: '鎶ヤ环鎴鏃ユ湡',
+ component: 'DatePicker',
+ componentProps: {
+ class: 'w-full',
+ placeholder: '璇烽�夋嫨鎶ヤ环鎴鏃ユ湡',
+ format: 'YYYY-MM-DD',
+ valueFormat: 'YYYY-MM-DD',
+ },
+ },
+ {
+ fieldName: 'purchaserUserId',
+ label: '閲囪喘鍛�',
+ component: 'ApiSelect',
+ componentProps: {
+ class: 'w-full',
+ placeholder: '璇烽�夋嫨閲囪喘鍛�',
+ allowClear: true,
+ showSearch: true,
+ api: getSimpleUserList,
+ labelField: 'nickname',
+ valueField: 'id',
+ },
+ },
+ {
+ fieldName: 'remark',
+ label: '澶囨敞',
+ component: 'Textarea',
+ componentProps: { placeholder: '璇疯緭鍏ュ娉�', rows: 2 },
+ formItemClass: 'col-span-2',
+ },
+ ];
+}
+
+/** 鎼滅储琛ㄥ崟 */
+export function useGridFormSchema(): VbenFormSchema[] {
+ return [
+ {
+ fieldName: 'no',
+ label: '璇环鍗曞彿',
+ component: 'Input',
+ componentProps: { placeholder: '璇疯緭鍏ヨ浠峰崟鍙�', allowClear: true },
+ },
+ {
+ fieldName: 'title',
+ label: '璇环鏍囬',
+ component: 'Input',
+ componentProps: { placeholder: '璇疯緭鍏ヨ浠锋爣棰�', allowClear: true },
+ },
+ {
+ fieldName: 'status',
+ label: '鐘舵��',
+ component: 'Select',
+ componentProps: {
+ placeholder: '璇烽�夋嫨鐘舵��',
+ allowClear: true,
+ options: INQUIRY_STATUS_OPTIONS.map(({ label, value }) => ({
+ label,
+ value,
+ })),
+ },
+ },
+ ];
+}
+
+/** 琛ㄦ牸鍒� */
+export function useGridColumns(): VxeTableGridOptions['columns'] {
+ return [
+ { field: 'no', title: '璇环鍗曞彿', minWidth: 160 },
+ { field: 'title', title: '璇环鏍囬', minWidth: 200 },
+ {
+ field: 'status',
+ title: '鐘舵��',
+ minWidth: 110,
+ slots: { default: 'status' },
+ },
+ { field: 'inquiryDate', title: '璇环鏃ユ湡', minWidth: 120 },
+ { field: 'deadline', title: '鎶ヤ环鎴', minWidth: 120 },
+ { field: 'createTime', title: '鍒涘缓鏃堕棿', minWidth: 160 },
+ {
+ title: '鎿嶄綔',
+ width: 260,
+ fixed: 'right',
+ slots: { default: 'actions' },
+ },
+ ];
+}
diff --git a/src/views/srm/inquiry/detail.vue b/src/views/srm/inquiry/detail.vue
new file mode 100644
index 0000000..db44a02
--- /dev/null
+++ b/src/views/srm/inquiry/detail.vue
@@ -0,0 +1,232 @@
+<script lang="ts" setup>
+import type { SrmInquiryApi } from '#/api/srm/inquiry';
+
+import { computed, ref } from 'vue';
+
+import { useRouter } from 'vue-router';
+
+import { useVbenModal } from '@vben/common-ui';
+
+import { Button, Tag } from 'ant-design-vue';
+
+import { getInquiryCompare } from '#/api/srm/inquiry';
+
+import { getInquiryStatusLabel, INQUIRY_STATUS_OPTIONS } from './data';
+
+interface QuoteCell {
+ price?: number;
+ taxRate?: number;
+ deliveryCycle?: number;
+}
+
+const router = useRouter();
+const inquiry = ref<SrmInquiryApi.Inquiry>();
+const quoteCells = ref<Record<string, QuoteCell>>({});
+const orders = ref<SrmInquiryApi.ConfirmResult['orders']>([]);
+
+const statusOption = computed(() =>
+ INQUIRY_STATUS_OPTIONS.find((item) => item.value === inquiry.value?.status),
+);
+
+const supplierColumns = computed(() => {
+ return (inquiry.value?.suppliers ?? []).map((item) => ({
+ title: item.supplierName || `渚涘簲鍟� ${item.supplierId}`,
+ key: `s_${item.supplierId}`,
+ supplierId: item.supplierId,
+ width: 210,
+ }));
+});
+
+const columns = computed(() => [
+ {
+ title: '浜у搧',
+ key: 'product',
+ width: 240,
+ fixed: 'left',
+ supplierId: undefined as number | undefined,
+ },
+ ...supplierColumns.value,
+ {
+ title: '涓爣渚涘簲鍟�',
+ key: 'winner',
+ width: 140,
+ supplierId: undefined as number | undefined,
+ },
+]);
+
+function quoteKey(itemId?: number, supplierId?: number) {
+ return `${itemId}_${supplierId}`;
+}
+
+function initQuotes(data: SrmInquiryApi.Inquiry) {
+ const cells: Record<string, QuoteCell> = {};
+ for (const quote of data.quotes ?? []) {
+ cells[quoteKey(quote.inquiryItemId, quote.supplierId)] = {
+ price: quote.price,
+ taxRate: quote.taxRate,
+ deliveryCycle: quote.deliveryCycle,
+ };
+ }
+ quoteCells.value = cells;
+}
+
+async function loadData(id: number) {
+ inquiry.value = await getInquiryCompare(id);
+ orders.value = (inquiry.value.orders ?? []).map((item) => ({
+ supplierId: item.supplierId!,
+ supplierName: item.supplierName ?? '',
+ purchaseOrderId: item.purchaseOrderId!,
+ purchaseOrderNo: item.purchaseOrderNo ?? '',
+ }));
+ initQuotes(inquiry.value);
+}
+
+function getSupplierName(supplierId: number) {
+ return (
+ inquiry.value?.suppliers?.find((item) => item.supplierId === supplierId)
+ ?.supplierName ?? `渚涘簲鍟� ${supplierId}`
+ );
+}
+
+function getWinnerName(row: SrmInquiryApi.Item) {
+ return row.selectedSupplierId
+ ? getSupplierName(row.selectedSupplierId)
+ : '-';
+}
+
+function amountOf(row: SrmInquiryApi.Item, supplierId: number) {
+ const price = quoteCells.value[quoteKey(row.id, supplierId)]?.price;
+ if (!price) {
+ return '-';
+ }
+ return (price * (row.quantity ?? 0)).toFixed(2);
+}
+
+function goPurchaseOrder() {
+ router.push({ path: '/purchase/order' });
+}
+
+const [Modal, modalApi] = useVbenModal({
+ onOpenChange(isOpen: boolean) {
+ if (!isOpen) {
+ inquiry.value = undefined;
+ quoteCells.value = {};
+ orders.value = [];
+ return;
+ }
+ const data = modalApi.getData<{ id?: number }>();
+ if (!data?.id) {
+ return;
+ }
+ modalApi.lock();
+ loadData(data.id).finally(() => modalApi.unlock());
+ },
+});
+
+defineExpose({ modalApi });
+</script>
+
+<template>
+ <Modal title="璇环璇︽儏" class="w-11/12" :show-confirm-button="false">
+ <div v-if="inquiry" class="mx-3">
+ <div class="mb-3 flex flex-wrap items-center gap-6 text-sm">
+ <span>
+ <span class="text-gray-500">璇环鍗曞彿锛�</span>{{ inquiry.no }}
+ </span>
+ <span>
+ <span class="text-gray-500">鏍囬锛�</span>{{ inquiry.title }}
+ </span>
+ <Tag :color="statusOption?.color ?? 'default'">
+ {{ getInquiryStatusLabel(inquiry.status) }}
+ </Tag>
+ <span>
+ <span class="text-gray-500">璇环鏃ユ湡锛�</span>{{
+ inquiry.inquiryDate || '-'
+ }}
+ </span>
+ <span>
+ <span class="text-gray-500">鎶ヤ环鎴锛�</span>{{
+ inquiry.deadline || '-'
+ }}
+ </span>
+ </div>
+
+ <div class="mb-2 flex flex-wrap items-center gap-2">
+ <Button v-if="orders.length > 0" @click="goPurchaseOrder">
+ 鏌ョ湅閲囪喘璁㈠崟
+ </Button>
+ <span class="text-xs text-gray-400">
+ 鎶ヤ环涓庝腑鏍囩粨鏋滃湪鏂板/缂栬緫璇环鍗曟椂涓�骞跺綍鍏ワ紱姝ゅ浠呭睍绀烘姤浠蜂笌涓爣缁撴灉銆�
+ </span>
+ </div>
+
+ <a-table
+ :columns="columns"
+ :data-source="inquiry.items ?? []"
+ :pagination="false"
+ size="small"
+ bordered
+ row-key="id"
+ :scroll="{ x: 1000 }"
+ >
+ <template #bodyCell="{ column, record }">
+ <template v-if="column.key === 'product'">
+ <div class="font-medium">{{ record.productName }}</div>
+ <div class="text-xs text-gray-500">
+ {{ record.productCode || '-' }} / {{ record.productSpec || '-' }}
+ </div>
+ <div class="text-xs text-gray-500">
+ 鏁伴噺锛歿{ record.quantity }} {{ record.unitName || '' }}
+ </div>
+ <div class="text-xs text-gray-500">
+ 鐩爣鍗曚环锛歿{ record.estimatedPrice ?? '-' }}
+ </div>
+ </template>
+ <template
+ v-else-if="String(column.key).startsWith('s_')"
+ >
+ <template
+ v-if="quoteCells[quoteKey(record.id, column.supplierId)]?.price"
+ >
+ <div class="font-medium">
+ 鍚◣鍗曚环锛歿{ quoteCells[quoteKey(record.id, column.supplierId)]?.price }}
+ </div>
+ <div class="text-xs text-gray-500">
+ 绋庣巼锛歿{
+ quoteCells[quoteKey(record.id, column.supplierId)]?.taxRate ?? '-'
+ }}% / 浜ゆ湡锛歿{
+ quoteCells[quoteKey(record.id, column.supplierId)]?.deliveryCycle ?? '-'
+ }} 澶�
+ </div>
+ <div class="text-xs text-gray-500">
+ 浠风◣鍚堣锛歿{ amountOf(record, column.supplierId) }}
+ </div>
+ </template>
+ <div v-else class="text-xs text-gray-400">鏈姤浠�</div>
+ <Tag
+ v-if="record.selectedSupplierId === column.supplierId"
+ color="success"
+ class="mt-1"
+ >
+ 涓爣
+ </Tag>
+ </template>
+ <template v-else-if="column.key === 'winner'">
+ {{ getWinnerName(record) }}
+ </template>
+ </template>
+ </a-table>
+
+ <div v-if="orders.length > 0" class="mt-4 rounded bg-gray-50 p-3">
+ <div class="mb-1 font-medium">宸茬敓鎴愮殑閲囪喘璁㈠崟鑽夌</div>
+ <div
+ v-for="order in orders"
+ :key="order.purchaseOrderId"
+ class="text-sm"
+ >
+ {{ order.supplierName }}锛歿{ order.purchaseOrderNo }}锛堣崏绋匡紝闇�鍦ㄩ噰璐鍗曢〉鎻愪氦瀹℃壒锛�
+ </div>
+ </div>
+ </div>
+ </Modal>
+</template>
diff --git a/src/views/srm/inquiry/index.vue b/src/views/srm/inquiry/index.vue
new file mode 100644
index 0000000..0eeeb38
--- /dev/null
+++ b/src/views/srm/inquiry/index.vue
@@ -0,0 +1,187 @@
+<script lang="ts" setup>
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+import type { SrmInquiryApi } from '#/api/srm/inquiry';
+
+import { Page, useVbenModal } from '@vben/common-ui';
+
+import { message, Tag } from 'ant-design-vue';
+
+import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
+import {
+ cancelInquiry,
+ confirmInquiry,
+ deleteInquiry,
+ getInquiryPage,
+} from '#/api/srm/inquiry';
+import { $t } from '#/locales';
+
+import {
+ getInquiryStatusLabel,
+ INQUIRY_STATUS_OPTIONS,
+ useGridColumns,
+ useGridFormSchema,
+} from './data';
+import CompareModal from './detail.vue';
+import InquiryForm from './modules/form.vue';
+
+defineOptions({ name: 'SrmInquiry' });
+
+const [FormModal, formModalApi] = useVbenModal({
+ connectedComponent: InquiryForm,
+ destroyOnClose: true,
+});
+
+const [CompareView, compareModalApi] = useVbenModal({
+ connectedComponent: CompareModal,
+ destroyOnClose: true,
+});
+
+function handleRefresh() {
+ gridApi.query();
+}
+
+function handleCreate() {
+ formModalApi.setData(null).open();
+}
+
+function handleEdit(row: SrmInquiryApi.Inquiry) {
+ formModalApi.setData({ id: row.id }).open();
+}
+
+function handleCompare(row: SrmInquiryApi.Inquiry) {
+ compareModalApi.setData({ id: row.id }).open();
+}
+
+async function handleConfirm(row: SrmInquiryApi.Inquiry) {
+ const result = await confirmInquiry(row.id!, []);
+ const orders = result.orders ?? [];
+ message.success(
+ `璇环鍗� ${row.no} 宸茬‘璁や腑鏍囷紝鐢熸垚 ${orders.length} 寮犻噰璐鍗曡崏绋匡細${orders
+ .map((item) => item.purchaseOrderNo)
+ .join('銆�')}锛堥渶鍦ㄩ噰璐鍗曢〉鎻愪氦瀹℃壒锛塦,
+ );
+ handleRefresh();
+}
+
+async function handleCancel(row: SrmInquiryApi.Inquiry) {
+ await cancelInquiry(row.id!);
+ message.success(`璇环鍗� ${row.no} 宸插彇娑坄);
+ handleRefresh();
+}
+
+async function handleDelete(row: SrmInquiryApi.Inquiry) {
+ await deleteInquiry(row.id!);
+ message.success($t('ui.actionMessage.deleteSuccess', [row.no]));
+ handleRefresh();
+}
+
+const [Grid, gridApi] = useVbenVxeGrid({
+ formOptions: {
+ schema: useGridFormSchema(),
+ },
+ gridOptions: {
+ columns: useGridColumns(),
+ height: 'auto',
+ keepSource: true,
+ proxyConfig: {
+ ajax: {
+ query: async ({ page }, formValues) => {
+ return await getInquiryPage({
+ pageNo: page.currentPage,
+ pageSize: page.pageSize,
+ ...formValues,
+ });
+ },
+ },
+ },
+ rowConfig: { keyField: 'id', isHover: true },
+ toolbarConfig: { refresh: true, search: true },
+ } as VxeTableGridOptions<SrmInquiryApi.Inquiry>,
+});
+</script>
+
+<template>
+ <Page auto-content-height>
+ <FormModal @success="handleRefresh" />
+ <CompareView @success="handleRefresh" />
+ <Grid table-title="璇环姣斾环">
+ <template #toolbar-tools>
+ <TableAction
+ :actions="[
+ {
+ label: $t('ui.actionTitle.create', ['璇环鍗�']),
+ type: 'primary',
+ icon: ACTION_ICON.ADD,
+ auth: ['srm:inquiry:create'],
+ onClick: handleCreate,
+ },
+ ]"
+ />
+ </template>
+ <template #status="{ row }">
+ <Tag
+ :color="
+ INQUIRY_STATUS_OPTIONS.find((item) => item.value === row.status)
+ ?.color ?? 'default'
+ "
+ >
+ {{ getInquiryStatusLabel(row.status) }}
+ </Tag>
+ </template>
+ <template #actions="{ row }">
+ <TableAction
+ :actions="[
+ {
+ label: '璇︽儏',
+ type: 'link',
+ icon: ACTION_ICON.VIEW,
+ ifShow: () => row.status !== 30,
+ onClick: handleCompare.bind(null, row),
+ },
+ {
+ label: $t('common.edit'),
+ type: 'link',
+ icon: ACTION_ICON.EDIT,
+ auth: ['srm:inquiry:update'],
+ ifShow: () => row.status === 0,
+ onClick: handleEdit.bind(null, row),
+ },
+ {
+ label: '纭杞鍗�',
+ type: 'link',
+ auth: ['srm:inquiry:confirm'],
+ ifShow: () => row.status === 0 || row.status === 10,
+ popConfirm: {
+ title: `纭璇环鍗� ${row.no} 鐨勪腑鏍囩粨鏋滃苟鐢熸垚閲囪喘璁㈠崟鑽夌鍚楋紵鐢熸垚鍚庝笉鍙啀淇敼璇ヨ浠峰崟銆俙,
+ confirm: handleConfirm.bind(null, row),
+ },
+ },
+ {
+ label: '鍙栨秷',
+ type: 'link',
+ danger: true,
+ auth: ['srm:inquiry:update'],
+ ifShow: () => row.status === 0 || row.status === 10,
+ popConfirm: {
+ title: `鍙栨秷璇环鍗� ${row.no} 鍚楋紵`,
+ confirm: handleCancel.bind(null, row),
+ },
+ },
+ {
+ label: $t('common.delete'),
+ type: 'link',
+ danger: true,
+ icon: ACTION_ICON.DELETE,
+ auth: ['srm:inquiry:delete'],
+ ifShow: () => row.status === 0,
+ popConfirm: {
+ title: $t('ui.actionMessage.deleteConfirm', [row.no]),
+ confirm: handleDelete.bind(null, row),
+ },
+ },
+ ]"
+ />
+ </template>
+ </Grid>
+ </Page>
+</template>
diff --git a/src/views/srm/inquiry/modules/form.vue b/src/views/srm/inquiry/modules/form.vue
new file mode 100644
index 0000000..83460c6
--- /dev/null
+++ b/src/views/srm/inquiry/modules/form.vue
@@ -0,0 +1,457 @@
+<script lang="ts" setup>
+import type { MdmItemApi } from '#/api/mdm/item';
+import type { SrmInquiryApi } from '#/api/srm/inquiry';
+import type { SrmSupplierApi } from '#/api/srm/supplier';
+
+import { computed, onMounted, ref } from 'vue';
+
+import { useVbenModal } from '@vben/common-ui';
+
+import { Button, message } from 'ant-design-vue';
+
+import { useVbenForm } from '#/adapter/form';
+import { getItemSimpleList } from '#/api/mdm/item';
+import {
+ createInquiry,
+ getInquiry,
+ updateInquiry,
+} from '#/api/srm/inquiry';
+import { getSupplierSimpleList } from '#/api/srm/supplier';
+import { $t } from '#/locales';
+
+import { useFormSchema } from '../data';
+
+interface ItemQuoteRow extends SrmInquiryApi.ItemQuote {
+ price?: number;
+}
+
+interface ItemRow extends SrmInquiryApi.Item {
+ key: string;
+ quotes: ItemQuoteRow[];
+}
+
+const emit = defineEmits(['success']);
+const formData = ref<SrmInquiryApi.Inquiry>();
+const itemRows = ref<ItemRow[]>([]);
+const supplierIds = ref<number[]>([]);
+const itemOptions = ref<MdmItemApi.Item[]>([]);
+const supplierOptions = ref<SrmSupplierApi.SupplierVO[]>([]);
+
+const getTitle = computed(() => {
+ return formData.value?.id
+ ? $t('ui.actionTitle.edit', ['璇环鍗�'])
+ : $t('ui.actionTitle.create', ['璇环鍗�']);
+});
+
+const itemColumns = [
+ { title: '浜у搧', key: 'productId', width: 220 },
+ { title: '瑙勬牸鍨嬪彿', key: 'productSpec', width: 140 },
+ { title: '鍗曚綅', key: 'unitName', width: 70 },
+ { title: '鏁伴噺', key: 'quantity', width: 110 },
+ { title: '鐩爣鍗曚环', key: 'estimatedPrice', width: 110 },
+ { title: '澶囨敞', key: 'remark', width: 140 },
+ { title: '鎿嶄綔', key: 'action', width: 60, fixed: 'right' },
+];
+
+const quoteColumns = computed(() =>
+ supplierIds.value.map((supplierId) => ({
+ title: getSupplierName(supplierId),
+ key: `supplier_${supplierId}`,
+ width: 200,
+ })),
+);
+
+const tableColumns = computed(() => {
+ const columns = itemColumns.filter((column) => column.key !== 'action');
+ return [
+ ...columns,
+ ...quoteColumns.value,
+ { title: '涓爣渚涘簲鍟�', key: 'winner', width: 160, fixed: 'right' },
+ itemColumns.find((column) => column.key === 'action'),
+ ];
+});
+
+const [Form, formApi] = useVbenForm({
+ commonConfig: {
+ componentProps: { class: 'w-full' },
+ labelWidth: 110,
+ },
+ wrapperClass: 'grid-cols-2',
+ layout: 'horizontal',
+ schema: useFormSchema(),
+ showDefaultActions: false,
+});
+
+onMounted(async () => {
+ const [items, suppliers] = await Promise.all([
+ getItemSimpleList(),
+ getSupplierSimpleList(),
+ ]);
+ itemOptions.value = items ?? [];
+ supplierOptions.value = suppliers ?? [];
+});
+
+function getSupplierName(supplierId: number) {
+ return (
+ supplierOptions.value.find((item) => item.id === supplierId)?.name ??
+ `渚涘簲鍟� ${supplierId}`
+ );
+}
+
+/** 渚涘簲鍟嗘爣璇嗘潵鑷垪 key锛歴upplier_{id} */
+function supplierIdOfColumn(key: unknown) {
+ return Number(String(key).replace('supplier_', ''));
+}
+
+/** 淇濊瘉姣忎釜浜у搧琛屽姣忎釜鍙備笌渚涘簲鍟嗛兘鏈夋姤浠峰璞★紝渚� v-model 鐩存帴缁戝畾 */
+function syncQuotes() {
+ for (const row of itemRows.value) {
+ const existing = new Map<number, ItemQuoteRow>(
+ (row.quotes ?? []).map((quote) => [quote.supplierId, quote]),
+ );
+ row.quotes = supplierIds.value.map(
+ (supplierId) => existing.get(supplierId) ?? { supplierId },
+ );
+ if (
+ row.selectedSupplierId &&
+ !supplierIds.value.includes(row.selectedSupplierId)
+ ) {
+ row.selectedSupplierId = undefined;
+ }
+ }
+}
+
+function quoteOf(row: ItemRow, supplierId: number) {
+ let quote = row.quotes?.find((item) => item.supplierId === supplierId);
+ if (!quote) {
+ quote = { supplierId };
+ row.quotes = [...(row.quotes ?? []), quote];
+ }
+ return quote;
+}
+
+function quotePriceOf(row: ItemRow, supplierId: number) {
+ return (row.quotes ?? []).find((item) => item.supplierId === supplierId)?.price;
+}
+
+function hasQuote(row: ItemRow, supplierId: number) {
+ const price = quotePriceOf(row, supplierId);
+ return price !== undefined && price !== null && price > 0;
+}
+
+function handleSupplierChange() {
+ syncQuotes();
+}
+
+function handleAddItem() {
+ itemRows.value.push({
+ key: `${Date.now()}_${itemRows.value.length}`,
+ productId: undefined,
+ quantity: 1,
+ estimatedPrice: undefined,
+ quotes: [],
+ });
+ syncQuotes();
+}
+
+function handleRemoveItem(index: number) {
+ itemRows.value.splice(index, 1);
+}
+
+function handleProductChange(productId: number, record: ItemRow) {
+ const item = itemOptions.value.find((option) => option.id === productId);
+ if (!item) {
+ return;
+ }
+ record.productCode = item.code;
+ record.productName = item.name;
+ record.productSpec = item.specification;
+ record.productUnitId = item.unitMeasureId;
+ record.unitName = item.unitMeasureName;
+ if (!record.estimatedPrice) {
+ record.estimatedPrice = item.purchasePrice;
+ }
+}
+
+function productLabel(row: ItemRow, index: number) {
+ return row.productName || `绗� ${index + 1} 琛宍;
+}
+
+/** 鏍¢獙骞剁粍瑁呮彁浜ゆ暟鎹� */
+function buildPayload(values: SrmInquiryApi.Inquiry): SrmInquiryApi.Inquiry {
+ if (itemRows.value.length === 0) {
+ throw new Error('璇疯嚦灏戞坊鍔犱竴涓浠蜂骇鍝�');
+ }
+ const items: SrmInquiryApi.Item[] = itemRows.value.map((row, index) => {
+ const label = productLabel(row, index);
+ if (!row.productId) {
+ throw new Error(`绗� ${index + 1} 琛岋細璇烽�夋嫨浜у搧`);
+ }
+ if (!row.quantity || row.quantity <= 0) {
+ throw new Error(`浜у搧銆�${label}銆戯細閲囪喘鏁伴噺蹇呴』澶т簬 0`);
+ }
+ const quotes = (row.quotes ?? []).filter(
+ (quote) => quote.price !== undefined && quote.price !== null,
+ );
+ for (const quote of quotes) {
+ if (quote.price! <= 0) {
+ throw new Error(
+ `浜у搧銆�${label}銆戜緵搴斿晢銆�${getSupplierName(quote.supplierId)}銆戯細鎶ヤ环鍗曚环蹇呴』澶т簬 0`,
+ );
+ }
+ }
+ if (quotes.length === 0) {
+ throw new Error(
+ `浜у搧銆�${label}銆戯細杩樻病鏈夊綍鍏ヤ换浣曚緵搴斿晢鎶ヤ环锛岃鑷冲皯濉啓涓�涓緵搴斿晢鐨勬姤浠峰崟浠穈,
+ );
+ }
+ if (row.selectedSupplierId) {
+ const winnerQuote = quotes.find(
+ (quote) => quote.supplierId === row.selectedSupplierId,
+ );
+ if (!winnerQuote) {
+ throw new Error(
+ `浜у搧銆�${label}銆戯細涓爣渚涘簲鍟嗐��${getSupplierName(row.selectedSupplierId)}銆戞病鏈夊~鍐欐姤浠峰崟浠凤紝璇疯ˉ濉姤浠锋垨鏀归�夊叾浠栦緵搴斿晢`,
+ );
+ }
+ }
+ return {
+ id: row.id,
+ productId: row.productId,
+ productUnitId: row.productUnitId,
+ productCode: row.productCode,
+ productName: row.productName,
+ productSpec: row.productSpec,
+ unitName: row.unitName,
+ quantity: row.quantity,
+ estimatedPrice: row.estimatedPrice,
+ selectedSupplierId: row.selectedSupplierId,
+ remark: row.remark,
+ quotes: quotes.map((quote) => ({
+ supplierId: quote.supplierId,
+ price: quote.price,
+ taxRate: quote.taxRate,
+ deliveryCycle: quote.deliveryCycle,
+ paymentTerms: quote.paymentTerms,
+ remark: quote.remark,
+ })),
+ };
+ });
+ if (supplierIds.value.length === 0) {
+ throw new Error('璇疯嚦灏戦�夋嫨涓�涓弬涓庤浠风殑渚涘簲鍟�');
+ }
+ return {
+ ...values,
+ items,
+ suppliers: supplierIds.value.map((supplierId) => ({ supplierId })),
+ };
+}
+
+const [Modal, modalApi] = useVbenModal({
+ async onConfirm() {
+ const { valid } = await formApi.validate();
+ if (!valid) {
+ return;
+ }
+ const values = (await formApi.getValues()) as SrmInquiryApi.Inquiry;
+ let payload: SrmInquiryApi.Inquiry;
+ try {
+ payload = buildPayload(values);
+ } catch (error: unknown) {
+ message.error(error instanceof Error ? error.message : '璇锋鏌ヨ浠峰崟鏁版嵁');
+ return;
+ }
+ modalApi.lock();
+ try {
+ if (formData.value?.id) {
+ await updateInquiry({ ...payload, id: formData.value.id });
+ } else {
+ await createInquiry(payload);
+ }
+ await modalApi.close();
+ emit('success');
+ message.success($t('ui.actionMessage.operationSuccess'));
+ } finally {
+ modalApi.unlock();
+ }
+ },
+ async onOpenChange(isOpen: boolean) {
+ if (!isOpen) {
+ formData.value = undefined;
+ itemRows.value = [];
+ supplierIds.value = [];
+ return;
+ }
+ const data = modalApi.getData<{ id?: number }>();
+ if (!data?.id) {
+ formData.value = undefined;
+ itemRows.value = [];
+ supplierIds.value = [];
+ return;
+ }
+ modalApi.lock();
+ try {
+ formData.value = await getInquiry(data.id);
+ supplierIds.value = (formData.value.suppliers ?? []).map(
+ (item) => item.supplierId,
+ );
+ const quotes = formData.value.quotes ?? [];
+ itemRows.value = (formData.value.items ?? []).map((item, index) => ({
+ ...item,
+ key: String(item.id ?? index),
+ quotes: quotes
+ .filter((quote) => quote.inquiryItemId === item.id)
+ .map((quote) => ({
+ supplierId: quote.supplierId!,
+ price: quote.price,
+ taxRate: quote.taxRate,
+ deliveryCycle: quote.deliveryCycle,
+ paymentTerms: quote.paymentTerms,
+ remark: quote.remark,
+ })),
+ }));
+ syncQuotes();
+ await formApi.setValues(formData.value);
+ } finally {
+ modalApi.unlock();
+ }
+ },
+});
+
+defineExpose({ modalApi });
+</script>
+
+<template>
+ <Modal :title="getTitle" class="w-11/12">
+ <Form class="mx-4" />
+ <div class="mx-4 mt-2">
+ <div class="mb-2 font-medium">鍙備笌璇环鐨勪緵搴斿晢</div>
+ <a-select
+ v-model:value="supplierIds"
+ mode="multiple"
+ show-search
+ option-filter-prop="label"
+ placeholder="璇烽�夋嫨鍙備笌璇环鐨勪緵搴斿晢锛堝彲澶氶�夛級"
+ style="width: 100%"
+ :options="supplierOptions.map((item) => ({
+ label: item.name,
+ value: item.id,
+ }))"
+ @change="handleSupplierChange"
+ />
+ </div>
+ <div class="mx-4 mt-4">
+ <div class="mb-2 flex items-center justify-between">
+ <span class="font-medium">璇环浜у搧涓庝緵搴斿晢鎶ヤ环</span>
+ <Button type="primary" size="small" @click="handleAddItem">
+ 娣诲姞浜у搧
+ </Button>
+ </div>
+ <div class="mb-2 text-xs text-gray-400">
+ 閫夋嫨鍙備笌渚涘簲鍟嗗悗锛屾瘡涓緵搴斿晢浼氱敓鎴愪竴鍒楁姤浠凤紱鎶ヤ环鍗曚环涓哄惈绋庡崟浠凤紝浠风◣鍚堣 = 鍗曚环 脳 鏁伴噺锛涘苟鍦ㄣ�屼腑鏍囦緵搴斿晢銆嶅垪閫夋嫨璇ヤ骇鍝佺殑涓爣鏂广��
+ </div>
+ <a-table
+ :columns="tableColumns"
+ :data-source="itemRows"
+ :pagination="false"
+ size="small"
+ bordered
+ row-key="key"
+ :scroll="{ x: 1400 }"
+ >
+ <template #bodyCell="{ column, index, record }">
+ <template v-if="column.key === 'productId'">
+ <a-select
+ v-model:value="record.productId"
+ show-search
+ option-filter-prop="label"
+ placeholder="璇烽�夋嫨浜у搧"
+ style="width: 100%"
+ :options="itemOptions.map((item) => ({
+ label: item.name,
+ value: item.id,
+ code: item.code,
+ }))"
+ @change="(value: number) => handleProductChange(value, record)"
+ />
+ </template>
+ <template v-else-if="column.key === 'productSpec'">
+ {{ record.productSpec || '-' }}
+ </template>
+ <template v-else-if="column.key === 'unitName'">
+ {{ record.unitName || '-' }}
+ </template>
+ <template v-else-if="column.key === 'quantity'">
+ <a-input-number
+ v-model:value="record.quantity"
+ :min="0"
+ :precision="3"
+ style="width: 100%"
+ />
+ </template>
+ <template v-else-if="column.key === 'estimatedPrice'">
+ <a-input-number
+ v-model:value="record.estimatedPrice"
+ :min="0"
+ :precision="2"
+ style="width: 100%"
+ />
+ </template>
+ <template v-else-if="column.key === 'remark'">
+ <a-input v-model:value="record.remark" placeholder="澶囨敞" />
+ </template>
+ <template
+ v-else-if="String(column.key).startsWith('supplier_')"
+ >
+ <div class="space-y-1">
+ <a-input-number
+ v-model:value="quoteOf(record, supplierIdOfColumn(column.key)).price"
+ size="small"
+ :min="0"
+ :precision="2"
+ placeholder="鍚◣鍗曚环"
+ style="width: 100%"
+ />
+ <div class="flex gap-1">
+ <a-input-number
+ v-model:value="quoteOf(record, supplierIdOfColumn(column.key)).taxRate"
+ size="small"
+ :min="0"
+ :precision="2"
+ placeholder="绋庣巼%"
+ style="width: 50%"
+ />
+ <a-input-number
+ v-model:value="quoteOf(record, supplierIdOfColumn(column.key)).deliveryCycle"
+ size="small"
+ :min="0"
+ :precision="0"
+ placeholder="浜ゆ湡澶�"
+ style="width: 50%"
+ />
+ </div>
+ </div>
+ </template>
+ <template v-else-if="column.key === 'winner'">
+ <a-select
+ v-model:value="record.selectedSupplierId"
+ allow-clear
+ placeholder="璇烽�夋嫨涓爣渚涘簲鍟�"
+ style="width: 100%"
+ :options="supplierIds.map((supplierId) => ({
+ label: getSupplierName(supplierId),
+ value: supplierId,
+ disabled: !hasQuote(record, supplierId),
+ }))"
+ />
+ </template>
+ <template v-else-if="column.key === 'action'">
+ <a-button type="link" danger size="small" @click="handleRemoveItem(index)">
+ 鍒犻櫎
+ </a-button>
+ </template>
+ </template>
+ </a-table>
+ </div>
+ </Modal>
+</template>
diff --git a/src/views/srm/statistics/index.vue b/src/views/srm/statistics/index.vue
deleted file mode 100644
index 5f9652a..0000000
--- a/src/views/srm/statistics/index.vue
+++ /dev/null
@@ -1,135 +0,0 @@
-<script lang="ts" setup>
-import type { EchartsUIType } from '@vben/plugins/echarts';
-import type { SrmStatisticsApi } from '#/api/srm/statistics';
-
-import { onMounted, ref, watch } from 'vue';
-
-import { Page } from '@vben/common-ui';
-
-import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
-
-import { getTenderStatistics } from '#/api/srm/statistics';
-import { getSupplierSimpleList } from '#/api/srm/supplier';
-
-defineOptions({ name: 'SrmStatistics' });
-
-const year = ref(new Date().getFullYear().toString());
-const stats = ref<SrmStatisticsApi.TenderStatisticsVO>({});
-const supplierCount = ref(0);
-
-async function loadStats() {
- stats.value = await getTenderStatistics(year.value);
-}
-async function loadSupplierCount() {
- const list = await getSupplierSimpleList();
- supplierCount.value = list?.length ?? 0;
-}
-
-// 鍥捐〃
-const pieChartRef = ref<EchartsUIType>();
-const barChartRef = ref<EchartsUIType>();
-const { renderEcharts: renderPie } = useEcharts(pieChartRef);
-const { renderEcharts: renderBar } = useEcharts(barChartRef);
-
-async function renderCharts() {
- // 楗煎浘锛氫緵搴斿晢鐘舵�佸垎甯�
- await renderPie({
- title: { text: '渚涘簲鍟嗙姸鎬佸垎甯�', left: 'center' },
- tooltip: { trigger: 'item' },
- legend: { bottom: 0 },
- series: [{
- type: 'pie',
- radius: ['40%', '70%'],
- data: [
- { value: supplierCount.value, name: '宸插惎鐢�' },
- { value: 0, name: '宸茬鐢�' },
- ],
- }],
- });
-
- // 鏌辩姸鍥撅細鎷涙爣缁熻姒傝
- await renderBar({
- title: { text: `${year.value} 骞存嫑鏍囩粺璁℃瑙坄, left: 'center' },
- tooltip: { trigger: 'axis' },
- xAxis: { type: 'category', data: ['鎷涙爣鎬绘暟', '鍙備笌渚涘簲鍟�', '瀹氭爣閲戦(涓�)', '鑺傜害閲戦(涓�)'] },
- yAxis: { type: 'value' },
- series: [{
- type: 'bar',
- data: [
- stats.value.totalTenderCount ?? 0,
- stats.value.supplierCount ?? 0,
- +(((stats.value.totalAwardAmount ?? 0) / 10000).toFixed(2)),
- +(((stats.value.savedAmount ?? 0) / 10000).toFixed(2)),
- ],
- itemStyle: {
- color: (params: any) => ['#3b82f6', '#ec4899', '#f97316', '#8b5cf6'][params.dataIndex],
- },
- }],
- });
-}
-
-watch([stats, supplierCount], () => renderCharts());
-onMounted(() => { loadStats(); loadSupplierCount(); });
-</script>
-
-<template>
- <Page auto-content-height>
- <div class="p-4">
- <div class="mb-6 flex items-center gap-4">
- <span class="text-lg font-medium">SRM 缁熻鐪嬫澘</span>
- <a-input v-model:value="year" placeholder="骞翠唤" style="width: 120px" @change="loadStats" />
- </div>
-
- <!-- 6 涓粺璁″崱鐗� -->
- <div class="mb-6 grid grid-cols-3 gap-4">
- <div class="rounded-lg bg-blue-50 p-6 text-center shadow-sm">
- <div class="text-3xl font-bold text-blue-600">{{ stats.totalTenderCount ?? 0 }}</div>
- <div class="mt-2 text-gray-500">鎷涙爣鎬绘暟</div>
- </div>
- <div class="rounded-lg bg-green-50 p-6 text-center shadow-sm">
- <div class="text-3xl font-bold text-green-600">{{ stats.totalTenderAmount?.toLocaleString() ?? 0 }}</div>
- <div class="mt-2 text-gray-500">鎷涙爣鎬婚噾棰�(鍏�)</div>
- </div>
- <div class="rounded-lg bg-orange-50 p-6 text-center shadow-sm">
- <div class="text-3xl font-bold text-orange-600">{{ stats.totalAwardAmount?.toLocaleString() ?? 0 }}</div>
- <div class="mt-2 text-gray-500">瀹氭爣鎬婚噾棰�(鍏�)</div>
- </div>
- <div class="rounded-lg bg-purple-50 p-6 text-center shadow-sm">
- <div class="text-3xl font-bold text-purple-600">{{ stats.savedAmount?.toLocaleString() ?? 0 }}</div>
- <div class="mt-2 flex items-center justify-center gap-1 text-gray-500">
- 鑺傜害閲戦(鍏�)
- <a-tooltip title="鑺傜害閲戦 = 鎷涙爣鎬婚噾棰�(棰勭畻閲戦) 鈭� 瀹氭爣鎬婚噾棰�(涓爣閲戦)">
- <span
- class="inline-flex h-3.5 w-3.5 cursor-help items-center justify-center rounded-full bg-gray-400 text-[10px] leading-none text-white"
- >?</span>
- </a-tooltip>
- </div>
- </div>
- <div class="rounded-lg bg-teal-50 p-6 text-center shadow-sm">
- <div class="text-3xl font-bold text-teal-600">{{ stats.winRate ?? 0 }}%</div>
- <div class="mt-2 text-gray-500">涓爣鐜�</div>
- </div>
- <div class="rounded-lg bg-rose-50 p-6 text-center shadow-sm">
- <div class="text-3xl font-bold text-rose-600">{{ stats.supplierCount ?? 0 }}</div>
- <div class="mt-2 text-gray-500">鍙備笌鎷涙爣渚涘簲鍟�</div>
- </div>
- </div>
-
- <!-- 鍥捐〃鍖哄煙 -->
- <div class="mb-6 grid grid-cols-2 gap-4">
- <div class="rounded-lg bg-white p-4 shadow-sm">
- <EchartsUI ref="pieChartRef" class="h-[350px] w-full" />
- </div>
- <div class="rounded-lg bg-white p-4 shadow-sm">
- <EchartsUI ref="barChartRef" class="h-[350px] w-full" />
- </div>
- </div>
-
- <!-- 搴曢儴淇℃伅 -->
- <div class="rounded-lg bg-white p-4 shadow-sm">
- <h3 class="mb-3 text-base font-medium">渚涘簲鍟嗘�绘暟: {{ supplierCount }} 瀹�</h3>
- <a-empty v-if="supplierCount === 0" description="鏆傛棤渚涘簲鍟嗘暟鎹�" />
- </div>
- </div>
- </Page>
-</template>
diff --git a/src/views/srm/supplier/data.ts b/src/views/srm/supplier/data.ts
index f323861..fc9e573 100644
--- a/src/views/srm/supplier/data.ts
+++ b/src/views/srm/supplier/data.ts
@@ -54,25 +54,7 @@
buttonStyle: 'solid',
optionType: 'button',
},
- rules: z.number().default(1),
- },
- {
- fieldName: 'contactName',
- label: '鑱旂郴浜�',
- component: 'Input',
- componentProps: { placeholder: '璇疯緭鍏ヨ仈绯讳汉' },
- },
- {
- fieldName: 'contactMobile',
- label: '鑱旂郴鐢佃瘽',
- component: 'Input',
- componentProps: { placeholder: '璇疯緭鍏ヨ仈绯荤數璇�' },
- },
- {
- fieldName: 'contactEmail',
- label: '閭',
- component: 'Input',
- componentProps: { placeholder: '璇疯緭鍏ラ偖绠�' },
+ rules: z.number().default(0),
},
{
fieldName: 'address',
@@ -80,18 +62,6 @@
component: 'Input',
componentProps: { placeholder: '璇疯緭鍏ュ湴鍧�' },
formItemClass: 'col-span-2',
- },
- {
- fieldName: 'bankName',
- label: '寮�鎴烽摱琛�',
- component: 'Input',
- componentProps: { placeholder: '璇疯緭鍏ュ紑鎴烽摱琛�' },
- },
- {
- fieldName: 'bankAccount',
- label: '閾惰璐﹀彿',
- component: 'Input',
- componentProps: { placeholder: '璇疯緭鍏ラ摱琛岃处鍙�' },
},
{
fieldName: 'taxNo',
diff --git a/src/views/srm/supplier/modules/form.vue b/src/views/srm/supplier/modules/form.vue
index 4542a25..c9fcf28 100644
--- a/src/views/srm/supplier/modules/form.vue
+++ b/src/views/srm/supplier/modules/form.vue
@@ -5,7 +5,7 @@
import { useVbenModal } from '@vben/common-ui';
-import { message } from 'ant-design-vue';
+import { Button, message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import {
@@ -19,11 +19,43 @@
const emit = defineEmits(['success']);
const formData = ref<SrmSupplierApi.SupplierVO>();
+interface ContactRow extends SrmSupplierApi.SupplierContact { _key: string }
+interface BankRow extends SrmSupplierApi.SupplierBank { _key: string }
+
+let rowSeed = 0;
+function nextKey() {
+ rowSeed += 1;
+ return `row_${rowSeed}`;
+}
+
+const contacts = ref<ContactRow[]>([]);
+const banks = ref<BankRow[]>([]);
const getTitle = computed(() => {
return formData.value?.id
? $t('ui.actionTitle.edit', ['渚涘簲鍟�'])
: $t('ui.actionTitle.create', ['渚涘簲鍟�']);
});
+
+const contactColumns = [
+ { title: '濮撳悕', key: 'name', width: 110 },
+ { title: '鑱屼綅', key: 'position', width: 110 },
+ { title: '鎵嬫満', key: 'mobile', width: 140 },
+ { title: '鍥哄畾鐢佃瘽', key: 'telephone', width: 140 },
+ { title: '閭', key: 'email', width: 180 },
+ { title: '寰俊', key: 'wechat', width: 120 },
+ { title: '榛樿', key: 'isDefault', width: 60 },
+ { title: '鎿嶄綔', key: 'action', width: 60 },
+];
+
+const bankColumns = [
+ { title: '寮�鎴疯', key: 'bankName', width: 200 },
+ { title: '閾惰璐﹀彿', key: 'bankAccount', width: 200 },
+ { title: '閾惰琛屽彿', key: 'bankNo', width: 160 },
+ { title: '寮�鎴疯鍦板潃', key: 'bankAddress', width: 200 },
+ { title: '澶囨敞', key: 'remark', width: 150 },
+ { title: '榛樿', key: 'isDefault', width: 60 },
+ { title: '鎿嶄綔', key: 'action', width: 60 },
+];
const [Form, formApi] = useVbenForm({
commonConfig: {
@@ -36,16 +68,117 @@
showDefaultActions: false,
});
+function addContact() {
+ contacts.value.push({
+ _key: nextKey(),
+ name: '',
+ position: '',
+ mobile: '',
+ telephone: '',
+ email: '',
+ wechat: '',
+ isDefault: contacts.value.length === 0,
+ });
+}
+
+function removeContact(index: number) {
+ const wasDefault = contacts.value[index]?.isDefault;
+ contacts.value.splice(index, 1);
+ if (wasDefault && contacts.value.length > 0) {
+ contacts.value[0]!.isDefault = true;
+ }
+}
+
+function setDefaultContact(index: number) {
+ contacts.value.forEach((item, i) => {
+ item.isDefault = i === index;
+ });
+}
+
+function addBank() {
+ banks.value.push({
+ _key: nextKey(),
+ bankName: '',
+ bankAccount: '',
+ bankNo: '',
+ bankAddress: '',
+ remark: '',
+ isDefault: banks.value.length === 0,
+ });
+}
+
+function removeBank(index: number) {
+ const wasDefault = banks.value[index]?.isDefault;
+ banks.value.splice(index, 1);
+ if (wasDefault && banks.value.length > 0) {
+ banks.value[0]!.isDefault = true;
+ }
+}
+
+function setDefaultBank(index: number) {
+ banks.value.forEach((item, i) => {
+ item.isDefault = i === index;
+ });
+}
+
+/** 鎻愪氦鍓嶆牎楠屽琛屾槑缁嗭紝骞跺幓鎺夊畬鍏ㄧ┖鐧界殑琛� */
+function buildPayload(
+ values: SrmSupplierApi.SupplierVO,
+): SrmSupplierApi.SupplierVO {
+ const validContacts = contacts.value.filter(
+ (item) =>
+ item.name?.trim() ||
+ item.mobile?.trim() ||
+ item.telephone?.trim() ||
+ item.email?.trim(),
+ );
+ for (let i = 0; i < validContacts.length; i++) {
+ if (!validContacts[i]!.name?.trim()) {
+ throw new Error(`绗� ${i + 1} 涓仈绯讳汉鐨勫鍚嶄笉鑳戒负绌篳);
+ }
+ }
+ const validBanks = banks.value.filter(
+ (item) =>
+ item.bankName?.trim() ||
+ item.bankAccount?.trim() ||
+ item.bankNo?.trim(),
+ );
+ for (let i = 0; i < validBanks.length; i++) {
+ if (!validBanks[i]!.bankName?.trim()) {
+ throw new Error(`绗� ${i + 1} 涓摱琛岃处鎴风殑寮�鎴疯涓嶈兘涓虹┖`);
+ }
+ if (!validBanks[i]!.bankAccount?.trim()) {
+ throw new Error(`绗� ${i + 1} 涓摱琛岃处鎴风殑閾惰璐﹀彿涓嶈兘涓虹┖`);
+ }
+ }
+ if (validContacts.length > 0 && !validContacts.some((item) => item.isDefault)) {
+ validContacts[0]!.isDefault = true;
+ }
+ if (validBanks.length > 0 && !validBanks.some((item) => item.isDefault)) {
+ validBanks[0]!.isDefault = true;
+ }
+ return { ...values, contacts: validContacts, banks: validBanks };
+}
+
const [Modal, modalApi] = useVbenModal({
async onConfirm() {
const { valid } = await formApi.validate();
if (!valid) {
return;
}
- modalApi.lock();
const data = (await formApi.getValues()) as SrmSupplierApi.SupplierVO;
+ let payload: SrmSupplierApi.SupplierVO;
try {
- await (formData.value?.id ? updateSupplier(data) : createSupplier(data));
+ payload = buildPayload(data);
+ } catch (error: unknown) {
+ message.error(error instanceof Error ? error.message : '璇锋鏌ユ槑缁嗘暟鎹�');
+ return;
+ }
+ modalApi.lock();
+ try {
+ await (formData.value?.id
+ ? updateSupplier({ ...payload, id: formData.value.id })
+ : createSupplier(payload));
await modalApi.close();
emit('success');
message.success($t('ui.actionMessage.operationSuccess'));
@@ -56,15 +189,28 @@
async onOpenChange(isOpen: boolean) {
if (!isOpen) {
formData.value = undefined;
+ contacts.value = [];
+ banks.value = [];
return;
}
const data = modalApi.getData<SrmSupplierApi.SupplierVO>();
if (!data || !data.id) {
+ formData.value = undefined;
+ contacts.value = [];
+ banks.value = [];
return;
}
modalApi.lock();
try {
formData.value = await getSupplier(data.id);
+ contacts.value = (formData.value.contacts ?? []).map((item) => ({
+ ...item,
+ _key: nextKey(),
+ }));
+ banks.value = (formData.value.banks ?? []).map((item) => ({
+ ...item,
+ _key: nextKey(),
+ }));
await formApi.setValues(formData.value);
} finally {
modalApi.unlock();
@@ -76,7 +222,104 @@
</script>
<template>
- <Modal :title="getTitle" class="w-1/2">
+ <Modal :title="getTitle" class="w-3/4">
<Form class="mx-4" />
+ <div class="mx-4 mt-2">
+ <div class="mb-2 flex items-center justify-between">
+ <span class="font-medium">鑱旂郴浜哄強鑱旂郴鏂瑰紡</span>
+ <Button type="primary" size="small" @click="addContact">
+ 娣诲姞鑱旂郴浜�
+ </Button>
+ </div>
+ <a-table
+ :columns="contactColumns"
+ :data-source="contacts"
+ :pagination="false"
+ size="small"
+ bordered
+ row-key="_key"
+ >
+ <template #bodyCell="{ column, index, record }">
+ <template v-if="column.key === 'name'">
+ <a-input v-model:value="record.name" placeholder="濮撳悕锛堝繀濉級" />
+ </template>
+ <template v-else-if="column.key === 'position'">
+ <a-input v-model:value="record.position" placeholder="鑱屼綅" />
+ </template>
+ <template v-else-if="column.key === 'mobile'">
+ <a-input v-model:value="record.mobile" placeholder="鎵嬫満" />
+ </template>
+ <template v-else-if="column.key === 'telephone'">
+ <a-input v-model:value="record.telephone" placeholder="鍥哄畾鐢佃瘽" />
+ </template>
+ <template v-else-if="column.key === 'email'">
+ <a-input v-model:value="record.email" placeholder="閭" />
+ </template>
+ <template v-else-if="column.key === 'wechat'">
+ <a-input v-model:value="record.wechat" placeholder="寰俊鍙�" />
+ </template>
+ <template v-else-if="column.key === 'isDefault'">
+ <a-radio
+ :checked="record.isDefault"
+ @change="setDefaultContact(index)"
+ />
+ </template>
+ <template v-else-if="column.key === 'action'">
+ <a-button type="link" danger size="small" @click="removeContact(index)">
+ 鍒犻櫎
+ </a-button>
+ </template>
+ </template>
+ </a-table>
+ </div>
+
+ <div class="mx-4 mt-4">
+ <div class="mb-2 flex items-center justify-between">
+ <span class="font-medium">閾惰璐︽埛</span>
+ <Button type="primary" size="small" @click="addBank">
+ 娣诲姞閾惰璐︽埛
+ </Button>
+ </div>
+ <a-table
+ :columns="bankColumns"
+ :data-source="banks"
+ :pagination="false"
+ size="small"
+ bordered
+ row-key="_key"
+ >
+ <template #bodyCell="{ column, index, record }">
+ <template v-if="column.key === 'bankName'">
+ <a-input v-model:value="record.bankName" placeholder="寮�鎴疯锛堝繀濉級" />
+ </template>
+ <template v-else-if="column.key === 'bankAccount'">
+ <a-input
+ v-model:value="record.bankAccount"
+ placeholder="閾惰璐﹀彿锛堝繀濉級"
+ />
+ </template>
+ <template v-else-if="column.key === 'bankNo'">
+ <a-input v-model:value="record.bankNo" placeholder="閾惰琛屽彿" />
+ </template>
+ <template v-else-if="column.key === 'bankAddress'">
+ <a-input v-model:value="record.bankAddress" placeholder="寮�鎴疯鍦板潃" />
+ </template>
+ <template v-else-if="column.key === 'remark'">
+ <a-input v-model:value="record.remark" placeholder="澶囨敞" />
+ </template>
+ <template v-else-if="column.key === 'isDefault'">
+ <a-radio
+ :checked="record.isDefault"
+ @change="setDefaultBank(index)"
+ />
+ </template>
+ <template v-else-if="column.key === 'action'">
+ <a-button type="link" danger size="small" @click="removeBank(index)">
+ 鍒犻櫎
+ </a-button>
+ </template>
+ </template>
+ </a-table>
+ </div>
</Modal>
</template>
diff --git a/src/views/srm/supplierApply/data.ts b/src/views/srm/supplierApply/data.ts
deleted file mode 100644
index 1d681b0..0000000
--- a/src/views/srm/supplierApply/data.ts
+++ /dev/null
@@ -1,168 +0,0 @@
-import type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
-import type { VxeTableGridOptions } from '#/adapter/vxe-table';
-import type { SrmSupplierApi } from '#/api/srm/supplier';
-
-import { markRaw } from 'vue';
-
-import { z } from '#/adapter/form';
-
-import { SrmSupplierSelect } from '#/views/srm/supplier/components';
-
-import { APPLY_STATUS_CELLTAG, APPLY_STATUS_OPTIONS } from '../enums';
-
-/** 琛ㄥ崟绫诲瀷锛氭柊澧� / 缂栬緫 / 璇︽儏锛堝彧璇伙級 */
-export type FormType = 'create' | 'edit' | 'detail';
-
-/** 鏂板/淇敼鐨勮〃鍗� */
-export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
- return [
- {
- component: 'Input',
- fieldName: 'id',
- dependencies: {
- triggerFields: [''],
- show: () => false,
- },
- },
- {
- fieldName: 'supplierId',
- label: '閫夋嫨渚涘簲鍟�',
- component: markRaw(SrmSupplierSelect),
- componentProps: {
- approvalFilter: false,
- excludeApproved: true,
- placeholder: '璇烽�夋嫨SRM渚涘簲鍟嗭紙鎴栫洿鎺ュ~鍐欎緵搴斿晢鍚嶇О锛�',
- onChange: async (supplier?: SrmSupplierApi.SupplierVO) => {
- if (!supplier || !formApi) return;
- await formApi.setValues({
- supplierName: supplier.name || '',
- contactName: supplier.contactName || '',
- contactMobile: supplier.contactMobile || '',
- contactEmail: supplier.contactEmail || '',
- taxNo: supplier.taxNo || '',
- address: supplier.address || '',
- bankName: supplier.bankName || '',
- bankAccount: supplier.bankAccount || '',
- remark: supplier.remark || '',
- });
- },
- },
- dependencies: {
- triggerFields: ['supplierName'],
- componentProps: (values) => ({
- approvalFilter: false,
- excludeApproved: true,
- placeholder: '璇烽�夋嫨SRM渚涘簲鍟嗭紙鎴栫洿鎺ュ~鍐欎緵搴斿晢鍚嶇О锛�',
- supplierName: values.supplierName as string,
- }),
- },
- },
- {
- fieldName: 'supplierName',
- label: '渚涘簲鍟嗗悕绉�',
- component: 'Input',
- componentProps: { placeholder: '璇疯緭鍏ヤ緵搴斿晢鍚嶇О' },
- },
- {
- fieldName: 'contactName',
- label: '鑱旂郴浜�',
- component: 'Input',
- componentProps: { placeholder: '璇疯緭鍏ヨ仈绯讳汉' },
- },
- {
- fieldName: 'contactMobile',
- label: '鑱旂郴鐢佃瘽',
- component: 'Input',
- componentProps: { placeholder: '璇疯緭鍏ヨ仈绯荤數璇�' },
- },
- {
- fieldName: 'contactEmail',
- label: '閭',
- component: 'Input',
- componentProps: { placeholder: '璇疯緭鍏ラ偖绠�' },
- },
- {
- fieldName: 'address',
- label: '鍦板潃',
- component: 'Input',
- componentProps: { placeholder: '璇疯緭鍏ュ湴鍧�' },
- formItemClass: 'col-span-2',
- },
- {
- fieldName: 'bankName',
- label: '寮�鎴烽摱琛�',
- component: 'Input',
- componentProps: { placeholder: '璇疯緭鍏ュ紑鎴烽摱琛�' },
- },
- {
- fieldName: 'bankAccount',
- label: '閾惰璐﹀彿',
- component: 'Input',
- componentProps: { placeholder: '璇疯緭鍏ラ摱琛岃处鍙�' },
- },
- {
- fieldName: 'taxNo',
- label: '绋庡彿',
- component: 'Input',
- componentProps: { placeholder: '璇疯緭鍏ョ◣鍙�' },
- },
- {
- fieldName: 'remark',
- label: '澶囨敞',
- component: 'Textarea',
- componentProps: { placeholder: '璇疯緭鍏ュ娉�', rows: 3 },
- formItemClass: 'col-span-2',
- },
- ];
-}
-
-/** 鎼滅储琛ㄥ崟 */
-export function useGridFormSchema(): VbenFormSchema[] {
- return [
- {
- fieldName: 'applyNo',
- label: '鐢宠缂栧彿',
- component: 'Input',
- componentProps: { placeholder: '璇疯緭鍏ョ敵璇风紪鍙�', allowClear: true },
- },
- {
- fieldName: 'supplierName',
- label: '渚涘簲鍟嗗悕绉�',
- component: 'Input',
- componentProps: { placeholder: '璇疯緭鍏ヤ緵搴斿晢鍚嶇О', allowClear: true },
- },
- {
- fieldName: 'applyStatus',
- label: '鐘舵��',
- component: 'Select',
- componentProps: {
- placeholder: '璇烽�夋嫨鐘舵��',
- allowClear: true,
- options: APPLY_STATUS_OPTIONS,
- },
- },
- ];
-}
-
-/** 琛ㄦ牸鍒� */
-export function useGridColumns(): VxeTableGridOptions['columns'] {
- return [
- { field: 'applyNo', title: '鐢宠缂栧彿', minWidth: 140 },
- { field: 'supplierName', title: '渚涘簲鍟嗗悕绉�', minWidth: 150 },
- {
- field: 'applyStatus',
- title: '鐘舵��',
- minWidth: 100,
- cellRender: { name: 'CellTag', props: APPLY_STATUS_CELLTAG },
- },
- { field: 'contactName', title: '鑱旂郴浜�', minWidth: 100 },
- { field: 'contactMobile', title: '鑱旂郴鐢佃瘽', minWidth: 120 },
- { field: 'createTime', title: '鍒涘缓鏃堕棿', minWidth: 160 },
- {
- title: '鎿嶄綔',
- width: 200,
- fixed: 'right',
- slots: { default: 'actions' },
- },
- ];
-}
diff --git a/src/views/srm/supplierApply/detail/index.vue b/src/views/srm/supplierApply/detail/index.vue
deleted file mode 100644
index f4f0e73..0000000
--- a/src/views/srm/supplierApply/detail/index.vue
+++ /dev/null
@@ -1,96 +0,0 @@
-<script lang="ts" setup>
-import type { SrmSupplierApplyApi } from '#/api/srm/supplierApply';
-import type { DescriptionItemSchema } from '#/components/description';
-
-import { h, onMounted, ref } from 'vue';
-
-import { ContentWrap } from '@vben/common-ui';
-import { formatDate } from '@vben/utils';
-
-import { Spin, Tag } from 'ant-design-vue';
-
-import { getApply } from '#/api/srm/supplierApply';
-import { useDescription } from '#/components/description';
-
-import { APPLY_STATUS_CELLTAG } from '../../enums';
-
-defineOptions({ name: 'SrmSupplierApplyDetail' });
-
-const props = defineProps<{ id: string }>();
-
-const loading = ref(false);
-const formData = ref<SrmSupplierApplyApi.ApplyVO>();
-
-/** 鏂囨湰瀛楁绌哄�煎崰浣� */
-function textRender(val: unknown) {
- return val === 0 || val ? String(val) : '-';
-}
-
-/** 鐢宠鐘舵�佹爣绛炬覆鏌� */
-function statusRender(val: unknown) {
- const num = Number(val);
- const item = APPLY_STATUS_CELLTAG.data.find((i) => Number(i.value) === num);
- const label = APPLY_STATUS_CELLTAG.labels[num] || '-';
- return h(Tag, { color: item?.color }, { default: () => label });
-}
-
-const [Descriptions] = useDescription({
- bordered: true,
- column: 2,
- schema: [
- { label: '鐢宠缂栧彿', field: 'applyNo', render: textRender },
- { label: '鐢宠鐘舵��', field: 'applyStatus', render: statusRender },
- { label: '鐢宠浜�', field: 'applyUserName', render: textRender },
- {
- label: '鐢宠鏃堕棿',
- field: 'applyTime',
- render: (val) => formatDate(val) as string,
- },
- { label: '渚涘簲鍟嗗悕绉�', field: 'supplierName', render: textRender },
- { label: '渚涘簲鍟嗙被鍨�', field: 'supplierType', render: textRender },
- { label: '浼佷笟鎬ц川', field: 'companyNature', render: textRender },
- {
- label: '娉ㄥ唽璧勯噾(涓囧厓)',
- field: 'registeredCapital',
- render: textRender,
- },
- { label: '钀ヤ笟鎵х収缂栧彿', field: 'businessLicenseNo', render: textRender },
- { label: '绋庡彿', field: 'taxNo', render: textRender },
- { label: '寮�鎴烽摱琛�', field: 'bankName', render: textRender },
- { label: '閾惰璐﹀彿', field: 'bankAccount', render: textRender },
- { label: '鑱旂郴浜�', field: 'contactName', render: textRender },
- { label: '鑱旂郴鐢佃瘽', field: 'contactMobile', render: textRender },
- { label: '閭', field: 'contactEmail', render: textRender },
- { label: '鍏徃鍦板潃', field: 'address', render: textRender },
- {
- label: '澶囨敞',
- field: 'remark',
- render: textRender,
- span: 2,
- },
- ] as DescriptionItemSchema[],
-});
-
-onMounted(async () => {
- try {
- loading.value = true;
- formData.value = await getApply(Number(props.id));
- } finally {
- loading.value = false;
- }
-});
-</script>
-
-<template>
- <ContentWrap class="m-2">
- <Spin :spinning="loading" tip="鍔犺浇涓�...">
- <div class="rounded-lg border border-border bg-background p-4">
- <div class="mb-4 flex items-center gap-2">
- <span class="inline-block h-4 w-1 rounded bg-primary" />
- <span class="text-base font-semibold">渚涘簲鍟嗗噯鍏ョ敵璇�</span>
- </div>
- <Descriptions :data="formData" />
- </div>
- </Spin>
- </ContentWrap>
-</template>
diff --git a/src/views/srm/supplierApply/index.vue b/src/views/srm/supplierApply/index.vue
deleted file mode 100644
index 6adc250..0000000
--- a/src/views/srm/supplierApply/index.vue
+++ /dev/null
@@ -1,205 +0,0 @@
-<script lang="ts" setup>
-import { automaticApproval } from '#/store/audit-policy';
-import { submitApply } from '#/api/srm/supplierApply';
-import type { VxeTableGridOptions } from '#/adapter/vxe-table';
-import type { SrmSupplierApplyApi } from '#/api/srm/supplierApply';
-
-import { useRouter } from 'vue-router';
-
-import { Page, useVbenModal } from '@vben/common-ui';
-
-import { message } from 'ant-design-vue';
-
-import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
-import {
- deleteApply,
- getApproveProcessList,
- getApplyPage,
-} from '#/api/srm/supplierApply';
-import { $t } from '#/locales';
-
-import { useGridColumns, useGridFormSchema } from './data';
-import ApplyForm from './modules/form.vue';
-import ProcessSelectModal from './modules/process-select-modal.vue';
-import { APPLY_STATUS } from '../enums';
-
-defineOptions({ name: 'SrmSupplierApply' });
-
-const router = useRouter();
-
-const [FormModal, formModalApi] = useVbenModal({
- connectedComponent: ApplyForm,
- destroyOnClose: true,
-});
-
-const [ProcessModal, processModalApi] = useVbenModal({
- connectedComponent: ProcessSelectModal,
- destroyOnClose: true,
-});
-
-// ---------- grid ----------
-function handleRefresh() {
- gridApi.query();
-}
-
-function handleCreate() {
- formModalApi.setData({ formType: 'create' }).open();
-}
-
-function handleEdit(row: SrmSupplierApplyApi.ApplyVO) {
- formModalApi.setData({ formType: 'edit', id: row.id }).open();
-}
-
-/** 鏌ョ湅璇︽儏锛堝彧璇伙級 */
-function handleDetail(row: SrmSupplierApplyApi.ApplyVO) {
- formModalApi.setData({ formType: 'detail', id: row.id }).open();
-}
-
-async function handleDelete(row: SrmSupplierApplyApi.ApplyVO) {
- const hideLoading = message.loading({
- content: $t('ui.actionMessage.deleting', [row.supplierName]),
- duration: 0,
- });
- try {
- await deleteApply(row.id!);
- message.success($t('ui.actionMessage.deleteSuccess', [row.supplierName]));
- handleRefresh();
- } finally {
- hideLoading();
- }
-}
-
-/** 鎻愪氦瀹℃壒 - 鍏堣幏鍙栧崗鍚屽姙鍏鎵规祦绋嬪垪琛� */
-async function handleSubmit(row: SrmSupplierApplyApi.ApplyVO) {
- const hideLoading = message.loading({
- content: automaticApproval.value ? '姝e湪鎻愪氦鐢熸晥...' : '鑾峰彇瀹℃壒娴佺▼...',
- duration: 0,
- });
- try {
- if (automaticApproval.value) {
- await submitApply(row.id!, 'supplier_apply_approve');
- hideLoading();
- message.success('宸叉彁浜ょ敓鏁�');
- handleRefresh();
- return;
- }
- const processList = await getApproveProcessList();
- hideLoading();
- if (!processList || processList.length === 0) {
- message.warning('鏆傛棤鍙敤瀹℃壒娴佺▼锛岃鍏堝湪鍗忓悓鍔炲叕閰嶇疆瀹℃壒娴佺▼');
- return;
- }
- // 鎵撳紑娴佺▼閫夋嫨寮圭獥
-
- processModalApi.setData({ id: row.id, processList }).open();
- } catch {
- hideLoading();
- }
-}
-
-/** 鏌ョ湅瀹℃壒杩涘害锛堣烦杞崗鍚屽姙鍏祦绋嬪疄渚嬭鎯咃紝鍙鏌ョ湅锛� */
-function handleViewProcess(row: SrmSupplierApplyApi.ApplyVO) {
- if (!row.processInstanceId) {
- message.warning('璇ョ敵璇峰皻鏈彁浜ゅ鎵�');
- return;
- }
- // viewOnly=1锛氶殣钘忓鎵规搷浣滄寜閽紝浠呮煡鐪嬪鎵硅繘搴�
- router.push({
- name: 'BpmProcessInstanceDetail',
- query: { id: row.processInstanceId, viewOnly: '1' },
- });
-}
-
-const [Grid, gridApi] = useVbenVxeGrid({
- formOptions: {
- schema: useGridFormSchema(),
- },
- gridOptions: {
- columns: useGridColumns(),
- height: 'auto',
- keepSource: true,
- proxyConfig: {
- ajax: {
- query: async ({ page }, formValues) => {
- return await getApplyPage({
- pageNo: page.currentPage,
- pageSize: page.pageSize,
- ...formValues,
- });
- },
- },
- },
- rowConfig: { keyField: 'id', isHover: true },
- toolbarConfig: { refresh: true, search: true },
- } as VxeTableGridOptions<SrmSupplierApplyApi.ApplyVO>,
-});
-</script>
-
-<template>
- <Page auto-content-height>
- <FormModal @success="handleRefresh" />
- <ProcessModal @success="handleRefresh" />
- <Grid table-title="鍑嗗叆鐢宠鍒楄〃">
- <template #toolbar-tools>
- <TableAction
- :actions="[
- {
- label: $t('ui.actionTitle.create', ['鍑嗗叆鐢宠']),
- type: 'primary',
- icon: ACTION_ICON.ADD,
- auth: ['srm:supplier-apply:create'],
- onClick: handleCreate,
- },
- ]"
- />
- </template>
- <template #actions="{ row }">
- <TableAction
- :actions="[
- {
- label: $t('common.detail'),
- type: 'link',
- icon: ACTION_ICON.VIEW,
- onClick: handleDetail.bind(null, row),
- },
- {
- label: '鎻愪氦',
- type: 'link',
- icon: ACTION_ICON.AUDIT,
- auth: ['srm:supplier-apply:update'],
- ifShow: () => row.applyStatus === APPLY_STATUS.DRAFT || row.applyStatus === APPLY_STATUS.REJECTED,
- onClick: handleSubmit.bind(null, row),
- },
- {
- label: '鏌ョ湅瀹℃壒',
- type: 'link',
- icon: ACTION_ICON.VIEW,
- ifShow: () => !!row.processInstanceId,
- onClick: handleViewProcess.bind(null, row),
- },
- {
- label: $t('common.edit'),
- type: 'link',
- icon: ACTION_ICON.EDIT,
- auth: ['srm:supplier-apply:update'],
- ifShow: () => row.applyStatus === APPLY_STATUS.DRAFT || row.applyStatus === APPLY_STATUS.REJECTED,
- onClick: handleEdit.bind(null, row),
- },
- {
- label: $t('common.delete'),
- type: 'link',
- danger: true,
- icon: ACTION_ICON.DELETE,
- auth: ['srm:supplier-apply:delete'],
- ifShow: () => row.applyStatus === APPLY_STATUS.DRAFT || row.applyStatus === APPLY_STATUS.REJECTED,
- popConfirm: {
- title: $t('ui.actionMessage.deleteConfirm', [row.supplierName]),
- confirm: handleDelete.bind(null, row),
- },
- },
- ]"
- />
- </template>
- </Grid>
- </Page>
-</template>
diff --git a/src/views/srm/supplierApply/modules/form.vue b/src/views/srm/supplierApply/modules/form.vue
deleted file mode 100644
index cf382d4..0000000
--- a/src/views/srm/supplierApply/modules/form.vue
+++ /dev/null
@@ -1,98 +0,0 @@
-<script lang="ts" setup>
-import type { SrmSupplierApplyApi } from '#/api/srm/supplierApply';
-import type { FormType } from '../data';
-
-import { computed, ref } from 'vue';
-
-import { useVbenModal } from '@vben/common-ui';
-
-import { message } from 'ant-design-vue';
-
-import { useVbenForm } from '#/adapter/form';
-import {
- createApply,
- getApply,
- updateApply,
-} from '#/api/srm/supplierApply';
-import { $t } from '#/locales';
-
-import { useFormSchema } from '../data';
-
-const emit = defineEmits(['success']);
-const formData = ref<SrmSupplierApplyApi.ApplyVO>();
-const formType = ref<FormType>('create');
-
-const getTitle = computed(() => {
- if (formType.value === 'create') {
- return $t('ui.actionTitle.create', ['鍑嗗叆鐢宠']);
- } else if (formType.value === 'edit') {
- return $t('ui.actionTitle.edit', ['鍑嗗叆鐢宠']);
- } else {
- return '鍑嗗叆鐢宠璇︽儏';
- }
-});
-
-const [Form, formApi] = useVbenForm({
- commonConfig: {
- componentProps: { class: 'w-full' },
- labelWidth: 120,
- },
- wrapperClass: 'grid-cols-2',
- layout: 'horizontal',
- schema: useFormSchema(),
- showDefaultActions: false,
-});
-// 娉ㄥ叆 formApi 浠ユ敮鎸侀�夋嫨 SRM 渚涘簲鍟嗗悗鑷姩濉厖琛ㄥ崟瀛楁
-formApi.setState({ schema: useFormSchema(formApi) });
-
-const [Modal, modalApi] = useVbenModal({
- async onConfirm() {
- const { valid } = await formApi.validate();
- if (!valid) {
- return;
- }
- modalApi.lock();
- const data = (await formApi.getValues()) as SrmSupplierApplyApi.ApplyVO;
- try {
- await (formData.value?.id ? updateApply(data) : createApply(data));
- await modalApi.close();
- emit('success');
- message.success($t('ui.actionMessage.operationSuccess'));
- } finally {
- modalApi.unlock();
- }
- },
- async onOpenChange(isOpen: boolean) {
- if (!isOpen) {
- formData.value = undefined;
- return;
- }
- const data = modalApi.getData<{ formType: FormType; id?: number }>();
- formType.value = data?.formType ?? 'create';
- formApi.setDisabled(formType.value === 'detail');
- formApi.updateSchema(useFormSchema(formApi));
- if (!data || !data.id) {
- return;
- }
- modalApi.lock();
- try {
- formData.value = await getApply(data.id);
- await formApi.setValues(formData.value);
- } finally {
- modalApi.unlock();
- }
- },
-});
-
-defineExpose({ modalApi });
-</script>
-
-<template>
- <Modal
- :title="getTitle"
- class="w-1/2"
- :show-confirm-button="formType !== 'detail'"
- >
- <Form class="mx-4" />
- </Modal>
-</template>
diff --git a/src/views/srm/supplierApply/modules/process-select-modal.vue b/src/views/srm/supplierApply/modules/process-select-modal.vue
deleted file mode 100644
index e85cf5f..0000000
--- a/src/views/srm/supplierApply/modules/process-select-modal.vue
+++ /dev/null
@@ -1,74 +0,0 @@
-<script lang="ts" setup>
-import type { SrmSupplierApplyApi } from '#/api/srm/supplierApply';
-
-import { computed, ref } from 'vue';
-
-import { useVbenModal } from '@vben/common-ui';
-
-import { message, Select } from 'ant-design-vue';
-
-import { submitApply } from '#/api/srm/supplierApply';
-
-const emit = defineEmits(['success']);
-
-const applyId = ref<number>();
-const processList = ref<SrmSupplierApplyApi.ProcessDefinition[]>([]);
-const selectedProcessKey = ref<string>('');
-
-const processOptions = computed(() => {
- return processList.value.map((p) => ({
- label: p.name,
- value: p.key,
- }));
-});
-
-const [Modal, modalApi] = useVbenModal({
- async onConfirm() {
- if (!selectedProcessKey.value) {
- message.warning('璇烽�夋嫨瀹℃壒娴佺▼');
- return;
- }
- modalApi.lock();
- try {
- await submitApply(applyId.value!, selectedProcessKey.value);
- await modalApi.close();
- emit('success');
- message.success('鎻愪氦鎴愬姛');
- } finally {
- modalApi.unlock();
- }
- },
- async onOpenChange(isOpen: boolean) {
- if (!isOpen) {
- applyId.value = undefined;
- selectedProcessKey.value = '';
- processList.value = [];
- return;
- }
- const data = modalApi.getData<{
- id: number;
- processList: SrmSupplierApplyApi.ProcessDefinition[];
- }>();
- applyId.value = data?.id;
- processList.value = data?.processList || [];
- // 榛樿閫夋嫨绗竴涓祦绋�
- if (processList.value.length > 0) {
- selectedProcessKey.value = processList.value[0]!.key;
- }
- },
-});
-</script>
-
-<template>
- <Modal title="閫夋嫨瀹℃壒娴佺▼" class="w-1/3">
- <div class="mb-4">
- <span class="mr-2">瀹℃壒娴佺▼锛�</span>
- <Select
- v-model:value="selectedProcessKey"
- :options="processOptions"
- style="width: 220px"
- placeholder="璇烽�夋嫨瀹℃壒娴佺▼"
- />
- </div>
- </Modal>
-</template>
diff --git a/src/views/srm/supplierCertificate/data.ts b/src/views/srm/supplierCertificate/data.ts
deleted file mode 100644
index 030a9df..0000000
--- a/src/views/srm/supplierCertificate/data.ts
+++ /dev/null
@@ -1,173 +0,0 @@
-import type { VbenFormSchema } from '#/adapter/form';
-import type { VxeTableGridOptions } from '#/adapter/vxe-table';
-
-import { getSupplierSimpleList } from '#/api/srm/supplier';
-
-import { CERTIFICATE_TYPE_CELLTAG, CERTIFICATE_TYPE_OPTIONS } from '../enums';
-
-/** 鏂板/淇敼鐨勮〃鍗� */
-export function useFormSchema(): VbenFormSchema[] {
- return [
- {
- component: 'Input',
- fieldName: 'id',
- dependencies: {
- triggerFields: [''],
- show: () => false,
- },
- },
- {
- fieldName: 'supplierId',
- label: '渚涘簲鍟�',
- component: 'ApiSelect',
- componentProps: {
- placeholder: '璇烽�夋嫨渚涘簲鍟�',
- allowClear: true,
- showSearch: true,
- api: getSupplierSimpleList,
- labelField: 'name',
- valueField: 'id',
- },
- rules: 'required',
- },
- {
- fieldName: 'certificateName',
- label: '璧勮川璇佷功鍚嶇О',
- component: 'Input',
- componentProps: { placeholder: '璇疯緭鍏ヨ祫璐ㄨ瘉涔﹀悕绉�' },
- rules: 'required',
- },
- {
- fieldName: 'certificateNo',
- label: '璇佷功缂栧彿',
- component: 'Input',
- componentProps: { placeholder: '璇疯緭鍏ヨ瘉涔︾紪鍙�' },
- },
- {
- fieldName: 'certificateType',
- label: '璇佷功绫诲瀷',
- component: 'Select',
- componentProps: {
- placeholder: '璇烽�夋嫨璇佷功绫诲瀷',
- options: CERTIFICATE_TYPE_OPTIONS,
- },
- rules: 'required',
- },
- {
- fieldName: 'issuingAuthority',
- label: '棰佸彂鏈烘瀯',
- component: 'Input',
- componentProps: { placeholder: '璇疯緭鍏ラ鍙戞満鏋�' },
- },
- {
- fieldName: 'validStartDate',
- label: '棰佸彂鏃ユ湡',
- component: 'DatePicker',
- componentProps: {
- placeholder: '璇烽�夋嫨棰佸彂鏃ユ湡',
- allowClear: true,
- format: 'YYYY-MM-DD',
- valueFormat: 'YYYY-MM-DD',
- },
- },
- {
- fieldName: 'validEndDate',
- label: '鍒版湡鏃ユ湡',
- component: 'DatePicker',
- componentProps: {
- placeholder: '璇烽�夋嫨鍒版湡鏃ユ湡',
- allowClear: true,
- format: 'YYYY-MM-DD',
- valueFormat: 'YYYY-MM-DD',
- },
- rules: 'required',
- },
- {
- fieldName: 'blobIds',
- label: '璇佷功闄勪欢',
- component: 'FileUpload',
- componentProps: {
- valueKey: 'id',
- maxNumber: 10,
- multiple: true,
- accept: ['jpg', 'jpeg', 'png', 'pdf', 'doc', 'docx'],
- helpText: '鏀寔jpg銆乯peg銆乸ng銆乸df銆乨oc銆乨ocx鏍煎紡锛屽崟涓枃浠朵笉瓒呰繃50MB',
- },
- formItemClass: 'md:col-span-2',
- },
- {
- fieldName: 'remark',
- label: '澶囨敞',
- component: 'Textarea',
- componentProps: { placeholder: '璇疯緭鍏ュ娉�', rows: 3 },
- formItemClass: 'col-span-2',
- },
- ];
-}
-
-/** 鎼滅储琛ㄥ崟 */
-export function useGridFormSchema(): VbenFormSchema[] {
- return [
- {
- fieldName: 'certificateName',
- label: '璧勮川璇佷功鍚嶇О',
- component: 'Input',
- componentProps: { placeholder: '璇疯緭鍏ヨ祫璐ㄨ瘉涔﹀悕绉�', allowClear: true },
- },
- {
- fieldName: 'certificateType',
- label: '璇佷功绫诲瀷',
- component: 'Select',
- componentProps: {
- placeholder: '璇烽�夋嫨璇佷功绫诲瀷',
- allowClear: true,
- options: CERTIFICATE_TYPE_OPTIONS,
- },
- },
- {
- fieldName: 'supplierId',
- label: '渚涘簲鍟�',
- component: 'ApiSelect',
- componentProps: {
- placeholder: '璇烽�夋嫨渚涘簲鍟�',
- allowClear: true,
- showSearch: true,
- api: getSupplierSimpleList,
- labelField: 'name',
- valueField: 'id',
- },
- },
- ];
-}
-
-/** 琛ㄦ牸鍒� */
-export function useGridColumns(): VxeTableGridOptions['columns'] {
- return [
- { field: 'supplierName', title: '渚涘簲鍟�', minWidth: 120 },
- { field: 'certificateName', title: '璧勮川璇佷功鍚嶇О', minWidth: 150 },
- { field: 'certificateNo', title: '璇佷功缂栧彿', minWidth: 120 },
- {
- field: 'certificateType',
- title: '璇佷功绫诲瀷',
- minWidth: 120,
- cellRender: { name: 'CellTag', props: CERTIFICATE_TYPE_CELLTAG },
- },
- { field: 'issuingAuthority', title: '棰佸彂鏈烘瀯', minWidth: 120 },
- { field: 'validStartDate', title: '棰佸彂鏃ユ湡', minWidth: 120 },
- { field: 'validEndDate', title: '鍒版湡鏃ユ湡', minWidth: 120 },
- { field: 'createTime', title: '鍒涘缓鏃堕棿', minWidth: 160 },
- {
- field: 'attachmentList',
- title: '闄勪欢',
- minWidth: 100,
- fixed: 'right',
- slots: { default: 'attachment' },
- },
- {
- title: '鎿嶄綔',
- width: 130,
- fixed: 'right',
- slots: { default: 'actions' },
- },
- ];
-}
diff --git a/src/views/srm/supplierCertificate/index.vue b/src/views/srm/supplierCertificate/index.vue
deleted file mode 100644
index a26aa75..0000000
--- a/src/views/srm/supplierCertificate/index.vue
+++ /dev/null
@@ -1,156 +0,0 @@
-<script lang="ts" setup>
-import type { VxeTableGridOptions } from '#/adapter/vxe-table';
-import type { SrmSupplierCertificateApi } from '#/api/srm/supplierCertificate';
-
-import { Page, useVbenModal } from '@vben/common-ui';
-
-import { message, Tag } from 'ant-design-vue';
-
-import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
-import {
- deleteCertificate,
- getCertificatePage,
- getExpiringCertificates,
-} from '#/api/srm/supplierCertificate';
-import { $t } from '#/locales';
-
-import { useGridColumns, useGridFormSchema } from './data';
-import CertificateForm from './modules/form.vue';
-
-defineOptions({ name: 'SrmSupplierCertificate' });
-
-function handleRefresh() {
- gridApi.query();
-}
-
-function handleCreate() {
- formModalApi.setData(null).open();
-}
-
-function handleEdit(row: SrmSupplierCertificateApi.CertificateVO) {
- formModalApi.setData(row).open();
-}
-
-async function handleDelete(row: SrmSupplierCertificateApi.CertificateVO) {
- const hideLoading = message.loading({
- content: $t('ui.actionMessage.deleting', [row.certificateName]),
- duration: 0,
- });
- try {
- await deleteCertificate(row.id!);
- message.success($t('ui.actionMessage.deleteSuccess', [row.certificateName]));
- handleRefresh();
- } finally {
- hideLoading();
- }
-}
-
-async function handleExpiringCertificates() {
- try {
- const data = await getExpiringCertificates();
- if (data && data.length > 0) {
- message.warning(`鏈� ${data.length} 涓祫璐ㄨ瘉涔﹀嵆灏嗗埌鏈焋);
- } else {
- message.success('娌℃湁鍗冲皢鍒版湡鐨勮祫璐ㄨ瘉涔�');
- }
- } catch {
- message.error('鑾峰彇鍗冲皢鍒版湡鐨勮祫璐ㄨ瘉涔﹀け璐�');
- }
-}
-
-const [FormModal, formModalApi] = useVbenModal({
- connectedComponent: CertificateForm,
- destroyOnClose: true,
-});
-
-const [Grid, gridApi] = useVbenVxeGrid({
- formOptions: {
- schema: useGridFormSchema(),
- },
- gridOptions: {
- columns: useGridColumns(),
- height: 'auto',
- keepSource: true,
- proxyConfig: {
- ajax: {
- query: async ({ page }, formValues) => {
- return await getCertificatePage({
- pageNo: page.currentPage,
- pageSize: page.pageSize,
- ...formValues,
- });
- },
- },
- },
- rowConfig: { keyField: 'id', isHover: true },
- toolbarConfig: { refresh: true, search: true },
- } as VxeTableGridOptions<SrmSupplierCertificateApi.CertificateVO>,
-});
-</script>
-
-<template>
- <Page auto-content-height>
- <FormModal @success="handleRefresh" />
- <Grid table-title="璧勮川璇佷功鍒楄〃">
- <template #toolbar-tools>
- <TableAction
- :actions="[
- {
- label: $t('ui.actionTitle.create', ['璧勮川璇佷功']),
- type: 'primary',
- icon: ACTION_ICON.ADD,
- auth: ['srm:supplier-certificate:create'],
- onClick: handleCreate,
- },
- {
- label: '鍒版湡鎻愰啋',
- type: 'warning',
- icon: 'ant-design:bell-outlined',
- auth: ['srm:supplier-certificate:query'],
- onClick: handleExpiringCertificates,
- },
- ]"
- />
- </template>
- <template #attachment="{ row }">
- <div v-if="row.attachmentList && row.attachmentList.length" class="flex flex-col gap-1">
- <a
- v-for="file in row.attachmentList"
- :key="file.id"
- :href="file.url"
- target="_blank"
- rel="noopener noreferrer"
- class="text-blue-500 hover:underline"
- >
- {{ file.name || '闄勪欢-' + file.id }}
- </a>
- </div>
- <Tag v-else color="default">--</Tag>
- </template>
- <template #actions="{ row }">
- <TableAction
- :actions="[
- {
- label: $t('common.edit'),
- type: 'link',
- icon: ACTION_ICON.EDIT,
- auth: ['srm:supplier-certificate:update'],
- onClick: handleEdit.bind(null, row),
- },
- {
- label: $t('common.delete'),
- type: 'link',
- danger: true,
- icon: ACTION_ICON.DELETE,
- auth: ['srm:supplier-certificate:delete'],
- popConfirm: {
- title: $t('ui.actionMessage.deleteConfirm', [row.certificateName]),
- confirm: handleDelete.bind(null, row),
- },
- },
- ]"
- />
- </template>
- </Grid>
- </Page>
-</template>
diff --git a/src/views/srm/supplierCertificate/modules/form.vue b/src/views/srm/supplierCertificate/modules/form.vue
deleted file mode 100644
index 041e5e0..0000000
--- a/src/views/srm/supplierCertificate/modules/form.vue
+++ /dev/null
@@ -1,93 +0,0 @@
-<script lang="ts" setup>
-import type { SrmSupplierCertificateApi } from '#/api/srm/supplierCertificate';
-
-import { computed, ref } from 'vue';
-
-import { useVbenModal } from '@vben/common-ui';
-
-import { message } from 'ant-design-vue';
-
-import { useVbenForm } from '#/adapter/form';
-import {
- createCertificate,
- getCertificate,
- updateCertificate,
-} from '#/api/srm/supplierCertificate';
-import { $t } from '#/locales';
-
-import { useFormSchema } from '../data';
-
-const emit = defineEmits(['success']);
-const formData = ref<SrmSupplierCertificateApi.CertificateVO>();
-const getTitle = computed(() => {
- return formData.value?.id
- ? $t('ui.actionTitle.edit', ['璧勮川璇佷功'])
- : $t('ui.actionTitle.create', ['璧勮川璇佷功']);
-});
-
-const [Form, formApi] = useVbenForm({
- commonConfig: {
- componentProps: { class: 'w-full' },
- labelWidth: 120,
- },
- wrapperClass: 'grid-cols-2',
- layout: 'horizontal',
- schema: useFormSchema(),
- showDefaultActions: false,
-});
-
-const [Modal, modalApi] = useVbenModal({
- async onConfirm() {
- const { valid } = await formApi.validate();
- if (!valid) {
- return;
- }
- modalApi.lock();
- const data = (await formApi.getValues()) as SrmSupplierCertificateApi.CertificateVO;
- try {
- await (formData.value?.id ? updateCertificate(data) : createCertificate(data));
- await modalApi.close();
- emit('success');
- message.success($t('ui.actionMessage.operationSuccess'));
- } finally {
- modalApi.unlock();
- }
- },
- async onOpenChange(isOpen: boolean) {
- if (!isOpen) {
- formData.value = undefined;
- return;
- }
- const data = modalApi.getData<SrmSupplierCertificateApi.CertificateVO>();
- if (!data || !data.id) {
- return;
- }
- modalApi.lock();
- try {
- formData.value = await getCertificate(data.id);
- if (formData.value?.attachmentList?.length) {
- // 杞负涓婁紶缁勪欢鐨勬枃浠跺璞★紱鎻愪氦鏃� formApi 浼氭寜 valueKey 鎻愬彇闄勪欢 ID
- (formData.value as Record<string, unknown>).blobIds =
- formData.value.attachmentList.map((item) => ({
- uid: String(item.id),
- name: item.name || '',
- url: item.url || '',
- status: 'done',
- id: item.id,
- }));
- }
- await formApi.setValues(formData.value);
- } finally {
- modalApi.unlock();
- }
- },
-});
-
-defineExpose({ modalApi });
-</script>
-
-<template>
- <Modal :title="getTitle" class="w-1/2">
- <Form class="mx-4" />
- </Modal>
-</template>
diff --git a/src/views/srm/supplierEvaluation/data.ts b/src/views/srm/supplierEvaluation/data.ts
deleted file mode 100644
index 4a20888..0000000
--- a/src/views/srm/supplierEvaluation/data.ts
+++ /dev/null
@@ -1,132 +0,0 @@
-import type { VbenFormSchema } from '#/adapter/form';
-import type { VxeTableGridOptions } from '#/adapter/vxe-table';
-
-import { getSupplierSimpleList } from '#/api/srm/supplier';
-
-import { COMPOSITE_SCORE_CELLTAG, EVALUATION_GRADE_CELLTAG } from '../enums';
-
-/** 鏂板/淇敼鐨勮〃鍗� */
-export function useFormSchema(): VbenFormSchema[] {
- return [
- {
- component: 'Input',
- fieldName: 'id',
- dependencies: {
- triggerFields: [''],
- show: () => false,
- },
- },
- {
- fieldName: 'supplierId',
- label: '渚涘簲鍟�',
- component: 'ApiSelect',
- rules: 'required',
- componentProps: {
- placeholder: '璇烽�夋嫨渚涘簲鍟�',
- allowClear: true,
- showSearch: true,
- api: getSupplierSimpleList,
- labelField: 'name',
- valueField: 'id',
- },
- },
- {
- fieldName: 'evaluationPeriod',
- label: '璇勪环鍛ㄦ湡',
- component: 'Input',
- rules: 'required',
- componentProps: { placeholder: '濡� 2024-Q1' },
- },
- {
- fieldName: 'qualityScore',
- label: '璐ㄩ噺璇勫垎',
- component: 'InputNumber',
- rules: 'required',
- componentProps: { min: 0, max: 100, placeholder: '璇疯緭鍏ヨ川閲忚瘎鍒�' },
- },
- {
- fieldName: 'deliveryScore',
- label: '浜や粯璇勫垎',
- component: 'InputNumber',
- rules: 'required',
- componentProps: { min: 0, max: 100, placeholder: '璇疯緭鍏ヤ氦浠樿瘎鍒�' },
- },
- {
- fieldName: 'priceScore',
- label: '浠锋牸璇勫垎',
- component: 'InputNumber',
- rules: 'required',
- componentProps: { min: 0, max: 100, placeholder: '璇疯緭鍏ヤ环鏍艰瘎鍒�' },
- },
- {
- fieldName: 'serviceScore',
- label: '鏈嶅姟璇勫垎',
- component: 'InputNumber',
- rules: 'required',
- componentProps: { min: 0, max: 100, placeholder: '璇疯緭鍏ユ湇鍔¤瘎鍒�' },
- },
- {
- fieldName: 'remark',
- label: '璇勪环璇存槑',
- component: 'Textarea',
- componentProps: { placeholder: '璇疯緭鍏ヨ瘎浠疯鏄�', rows: 3 },
- formItemClass: 'col-span-2',
- },
- ];
-}
-
-/** 鎼滅储琛ㄥ崟 */
-export function useGridFormSchema(): VbenFormSchema[] {
- return [
- {
- fieldName: 'supplierId',
- label: '渚涘簲鍟�',
- component: 'ApiSelect',
- componentProps: {
- placeholder: '璇烽�夋嫨渚涘簲鍟�',
- allowClear: true,
- showSearch: true,
- api: getSupplierSimpleList,
- labelField: 'name',
- valueField: 'id',
- },
- },
- {
- fieldName: 'evaluationPeriod',
- label: '璇勪环鍛ㄦ湡',
- component: 'Input',
- componentProps: { placeholder: '璇疯緭鍏ヨ瘎浠峰懆鏈�', allowClear: true },
- },
- ];
-}
-
-/** 琛ㄦ牸鍒� */
-export function useGridColumns(): VxeTableGridOptions['columns'] {
- return [
- { field: 'supplierName', title: '渚涘簲鍟�', minWidth: 150 },
- { field: 'evaluationPeriod', title: '璇勪环鍛ㄦ湡', minWidth: 120 },
- { field: 'qualityScore', title: '璐ㄩ噺璇勫垎', minWidth: 100 },
- { field: 'deliveryScore', title: '浜や粯璇勫垎', minWidth: 100 },
- { field: 'priceScore', title: '浠锋牸璇勫垎', minWidth: 100 },
- { field: 'serviceScore', title: '鏈嶅姟璇勫垎', minWidth: 100 },
- {
- field: 'compositeScore',
- title: '缁煎悎璇勫垎',
- minWidth: 120,
- cellRender: { name: 'CellTag', props: COMPOSITE_SCORE_CELLTAG },
- },
- {
- field: 'grade',
- title: '绛夌骇',
- minWidth: 80,
- cellRender: { name: 'CellTag', props: EVALUATION_GRADE_CELLTAG },
- },
- { field: 'createTime', title: '鍒涘缓鏃堕棿', minWidth: 160 },
- {
- title: '鎿嶄綔',
- width: 130,
- fixed: 'right',
- slots: { default: 'actions' },
- },
- ];
-}
diff --git a/src/views/srm/supplierEvaluation/index.vue b/src/views/srm/supplierEvaluation/index.vue
deleted file mode 100644
index 0bc2675..0000000
--- a/src/views/srm/supplierEvaluation/index.vue
+++ /dev/null
@@ -1,120 +0,0 @@
-<script lang="ts" setup>
-import type { VxeTableGridOptions } from '#/adapter/vxe-table';
-import type { SrmSupplierEvaluationApi } from '#/api/srm/supplierEvaluation';
-
-import { Page, useVbenModal } from '@vben/common-ui';
-
-import { message } from 'ant-design-vue';
-
-import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
-import {
- deleteEvaluation,
- getEvaluationPage,
-} from '#/api/srm/supplierEvaluation';
-import { $t } from '#/locales';
-
-import { useGridColumns, useGridFormSchema } from './data';
-import EvaluationForm from './modules/form.vue';
-
-defineOptions({ name: 'SrmSupplierEvaluation' });
-
-function handleRefresh() {
- gridApi.query();
-}
-
-function handleCreate() {
- formModalApi.setData(null).open();
-}
-
-function handleEdit(row: SrmSupplierEvaluationApi.EvaluationVO) {
- formModalApi.setData(row).open();
-}
-
-async function handleDelete(row: SrmSupplierEvaluationApi.EvaluationVO) {
- const hideLoading = message.loading({
- content: $t('ui.actionMessage.deleting', [row.evaluationPeriod]),
- duration: 0,
- });
- try {
- await deleteEvaluation(row.id!);
- message.success($t('ui.actionMessage.deleteSuccess', [row.evaluationPeriod]));
- handleRefresh();
- } finally {
- hideLoading();
- }
-}
-
-const [FormModal, formModalApi] = useVbenModal({
- connectedComponent: EvaluationForm,
- destroyOnClose: true,
-});
-
-const [Grid, gridApi] = useVbenVxeGrid({
- formOptions: {
- schema: useGridFormSchema(),
- },
- gridOptions: {
- columns: useGridColumns(),
- height: 'auto',
- keepSource: true,
- proxyConfig: {
- ajax: {
- query: async ({ page }, formValues) => {
- return await getEvaluationPage({
- pageNo: page.currentPage,
- pageSize: page.pageSize,
- ...formValues,
- });
- },
- },
- },
- rowConfig: { keyField: 'id', isHover: true },
- toolbarConfig: { refresh: true, search: true },
- } as VxeTableGridOptions<SrmSupplierEvaluationApi.EvaluationVO>,
-});
-</script>
-
-<template>
- <Page auto-content-height>
- <FormModal @success="handleRefresh" />
- <Grid table-title="缁╂晥璇勪环鍒楄〃">
- <template #toolbar-tools>
- <TableAction
- :actions="[
- {
- label: $t('ui.actionTitle.create', ['缁╂晥璇勪环']),
- type: 'primary',
- icon: ACTION_ICON.ADD,
- auth: ['srm:supplier-evaluation:create'],
- onClick: handleCreate,
- },
- ]"
- />
- </template>
- <template #actions="{ row }">
- <TableAction
- :actions="[
- {
- label: $t('common.edit'),
- type: 'link',
- icon: ACTION_ICON.EDIT,
- auth: ['srm:supplier-evaluation:update'],
- onClick: handleEdit.bind(null, row),
- },
- {
- label: $t('common.delete'),
- type: 'link',
- danger: true,
- icon: ACTION_ICON.DELETE,
- auth: ['srm:supplier-evaluation:delete'],
- popConfirm: {
- title: $t('ui.actionMessage.deleteConfirm', [row.evaluationPeriod]),
- confirm: handleDelete.bind(null, row),
- },
- },
- ]"
- />
- </template>
- </Grid>
- </Page>
-</template>
diff --git a/src/views/srm/supplierEvaluation/modules/form.vue b/src/views/srm/supplierEvaluation/modules/form.vue
deleted file mode 100644
index d29aa1d..0000000
--- a/src/views/srm/supplierEvaluation/modules/form.vue
+++ /dev/null
@@ -1,82 +0,0 @@
-<script lang="ts" setup>
-import type { SrmSupplierEvaluationApi } from '#/api/srm/supplierEvaluation';
-
-import { computed, ref } from 'vue';
-
-import { useVbenModal } from '@vben/common-ui';
-
-import { message } from 'ant-design-vue';
-
-import { useVbenForm } from '#/adapter/form';
-import {
- createEvaluation,
- getEvaluation,
- updateEvaluation,
-} from '#/api/srm/supplierEvaluation';
-import { $t } from '#/locales';
-
-import { useFormSchema } from '../data';
-
-const emit = defineEmits(['success']);
-const formData = ref<SrmSupplierEvaluationApi.EvaluationVO>();
-const getTitle = computed(() => {
- return formData.value?.id
- ? $t('ui.actionTitle.edit', ['缁╂晥璇勪环'])
- : $t('ui.actionTitle.create', ['缁╂晥璇勪环']);
-});
-
-const [Form, formApi] = useVbenForm({
- commonConfig: {
- componentProps: { class: 'w-full' },
- labelWidth: 120,
- },
- wrapperClass: 'grid-cols-2',
- layout: 'horizontal',
- schema: useFormSchema(),
- showDefaultActions: false,
-});
-
-const [Modal, modalApi] = useVbenModal({
- async onConfirm() {
- const { valid } = await formApi.validate();
- if (!valid) {
- return;
- }
- modalApi.lock();
- const data = (await formApi.getValues()) as SrmSupplierEvaluationApi.EvaluationVO;
- try {
- await (formData.value?.id ? updateEvaluation(data) : createEvaluation(data));
- await modalApi.close();
- emit('success');
- message.success($t('ui.actionMessage.operationSuccess'));
- } finally {
- modalApi.unlock();
- }
- },
- async onOpenChange(isOpen: boolean) {
- if (!isOpen) {
- formData.value = undefined;
- return;
- }
- const data = modalApi.getData<SrmSupplierEvaluationApi.EvaluationVO>();
- if (!data || !data.id) {
- return;
- }
- modalApi.lock();
- try {
- formData.value = await getEvaluation(data.id);
- await formApi.setValues(formData.value);
- } finally {
- modalApi.unlock();
- }
- },
-});
-
-defineExpose({ modalApi });
-</script>
-
-<template>
- <Modal :title="getTitle" class="w-1/2">
- <Form class="mx-4" />
- </Modal>
-</template>
diff --git a/src/views/srm/tender/config/index.vue b/src/views/srm/tender/config/index.vue
deleted file mode 100644
index 8ece764..0000000
--- a/src/views/srm/tender/config/index.vue
+++ /dev/null
@@ -1,65 +0,0 @@
-<script lang="ts" setup>
-import { ref } from 'vue';
-
-import { Page } from '@vben/common-ui';
-
-import { message, Radio, Button, Card, Spin } from 'ant-design-vue';
-
-import { getTenderConfig, saveTenderConfig } from '#/api/srm/tender-config';
-import { BIDDING_MODE, BIDDING_MODE_OPTIONS } from '#/views/srm/enums';
-
-defineOptions({ name: 'SrmTenderConfig' });
-
-const loading = ref(false);
-const saving = ref(false);
-const defaultBiddingMode = ref<string>(BIDDING_MODE.FULL);
-
-async function loadConfig() {
- loading.value = true;
- try {
- const res = await getTenderConfig();
- if (res?.defaultBiddingMode) {
- defaultBiddingMode.value = res.defaultBiddingMode;
- }
- } finally {
- loading.value = false;
- }
-}
-
-async function handleSave() {
- saving.value = true;
- try {
- await saveTenderConfig({ defaultBiddingMode: defaultBiddingMode.value });
- message.success('淇濆瓨鎴愬姛');
- await loadConfig();
- } finally {
- saving.value = false;
- }
-}
-
-loadConfig();
-</script>
-
-<template>
- <Page>
- <Spin :spinning="loading">
- <Card title="鎷涙姇鏍囬粯璁ゆā寮忛厤缃�" class="max-w-lg">
- <div class="mb-4 text-gray-500 text-sm">
- 璁剧疆鏂板缓鎷涙爣椤圭洰鏃剁殑榛樿鎷涙姇鏍囨ā寮忥紝鐢ㄦ埛鍦ㄥ垱寤洪」鐩椂浠嶅彲鎵嬪姩鏇存敼銆�
- </div>
- <div class="flex items-center gap-4">
- <span class="font-medium">榛樿妯″紡锛�</span>
- <Radio.Group
- v-model:value="defaultBiddingMode"
- :options="BIDDING_MODE_OPTIONS"
- />
- </div>
- <div class="mt-6">
- <Button type="primary" :loading="saving" @click="handleSave">
- 淇濆瓨
- </Button>
- </div>
- </Card>
- </Spin>
- </Page>
-</template>
diff --git a/src/views/srm/tender/data.ts b/src/views/srm/tender/data.ts
deleted file mode 100644
index 451aab9..0000000
--- a/src/views/srm/tender/data.ts
+++ /dev/null
@@ -1,282 +0,0 @@
-import type { VbenFormSchema } from '#/adapter/form';
-import type { VxeTableGridOptions } from '#/adapter/vxe-table';
-
-import {
- BIDDING_MODE_MAP,
- BIDDING_MODE_OPTIONS,
- TENDER_STATUS_CELLTAG,
- TENDER_STATUS_OPTIONS,
- TENDER_TYPE_CELLTAG,
- TENDER_TYPE_OPTIONS,
-} from '../enums';
-
-/** 鏂板/淇敼鐨勮〃鍗� */
-export function useFormSchema(): VbenFormSchema[] {
- return [
- {
- component: 'Input',
- fieldName: 'id',
- dependencies: {
- triggerFields: [''],
- show: () => false,
- },
- },
- {
- component: 'Input',
- fieldName: '_partial',
- dependencies: {
- triggerFields: [''],
- show: () => false,
- },
- },
- {
- fieldName: 'tenderNo',
- label: '鎷涙爣缂栧彿',
- component: 'Input',
- rules: 'required',
- componentProps: { placeholder: '璇疯緭鍏ユ嫑鏍囩紪鍙�' },
- dependencies: {
- triggerFields: ['_partial'],
- show: (values) => !values._partial,
- },
- },
- {
- fieldName: 'tenderName',
- label: '鎷涙爣椤圭洰鍚嶇О',
- component: 'Input',
- rules: 'required',
- componentProps: { placeholder: '璇疯緭鍏ユ嫑鏍囬」鐩悕绉�' },
- dependencies: {
- triggerFields: ['_partial'],
- show: (values) => !values._partial,
- },
- },
- {
- fieldName: 'tenderType',
- label: '鎷涙爣绫诲瀷',
- component: 'Select',
- rules: 'required',
- componentProps: {
- placeholder: '璇烽�夋嫨鎷涙爣绫诲瀷',
- options: TENDER_TYPE_OPTIONS,
- },
- dependencies: {
- triggerFields: ['_partial'],
- show: (values) => !values._partial,
- },
- },
- {
- fieldName: 'purchaseOrg',
- label: '閲囪喘缁勭粐',
- component: 'Input',
- componentProps: { placeholder: '璇疯緭鍏ラ噰璐粍缁�' },
- dependencies: {
- triggerFields: ['_partial'],
- show: (values) => !values._partial,
- },
- },
- {
- fieldName: 'projectLeaderName',
- label: '椤圭洰璐熻矗浜�',
- component: 'Input',
- componentProps: { placeholder: '璇疯緭鍏ラ」鐩礋璐d汉' },
- dependencies: {
- triggerFields: ['_partial'],
- show: (values) => !values._partial,
- },
- },
- {
- fieldName: 'budgetAmount',
- label: '棰勭畻閲戦',
- component: 'InputNumber',
- componentProps: {
- class: '!w-full',
- min: 0,
- placeholder: '璇疯緭鍏ラ绠楅噾棰�',
- },
- dependencies: {
- triggerFields: ['_partial'],
- show: (values) => !values._partial,
- },
- },
- {
- fieldName: 'startTime',
- label: '寮�濮嬫椂闂�',
- component: 'DatePicker',
- componentProps: {
- class: '!w-full',
- placeholder: '璇烽�夋嫨寮�濮嬫椂闂�',
- showTime: true,
- format: 'YYYY-MM-DD HH:mm:ss',
- valueFormat: 'YYYY-MM-DD HH:mm:ss',
- },
- dependencies: {
- triggerFields: ['_partial'],
- show: (values) => !values._partial,
- },
- },
- {
- fieldName: 'endTime',
- label: '鎴鏃堕棿',
- component: 'DatePicker',
- componentProps: {
- class: '!w-full',
- placeholder: '璇烽�夋嫨鎴鏃堕棿',
- showTime: true,
- format: 'YYYY-MM-DD HH:mm:ss',
- valueFormat: 'YYYY-MM-DD HH:mm:ss',
- },
- dependencies: {
- triggerFields: ['_partial'],
- show: (values) => !values._partial,
- },
- },
- {
- fieldName: 'bidOpenTime',
- label: '寮�鏍囨椂闂�',
- component: 'DatePicker',
- componentProps: {
- class: '!w-full',
- placeholder: '璇烽�夋嫨寮�鏍囨椂闂�',
- showTime: true,
- format: 'YYYY-MM-DD HH:mm:ss',
- valueFormat: 'YYYY-MM-DD HH:mm:ss',
- },
- dependencies: {
- triggerFields: ['_partial'],
- show: (values) => !values._partial,
- },
- },
- {
- fieldName: 'biddingMode',
- label: '鎷涙姇鏍囨ā寮�',
- component: 'Select',
- rules: 'required',
- componentProps: {
- placeholder: '璇烽�夋嫨鎷涙姇鏍囨ā寮�',
- options: BIDDING_MODE_OPTIONS,
- },
- dependencies: {
- triggerFields: ['_partial', 'id'],
- show: (values) => !values._partial,
- componentProps: (values) => ({
- disabled: !!values.id,
- placeholder: '璇烽�夋嫨鎷涙姇鏍囨ā寮�',
- options: BIDDING_MODE_OPTIONS,
- }),
- },
- },
- {
- fieldName: 'tenderDesc',
- label: '鎷涙爣璇存槑',
- component: 'Textarea',
- componentProps: { placeholder: '璇疯緭鍏ユ嫑鏍囪鏄�', rows: 3 },
- formItemClass: 'col-span-2',
- },
- {
- fieldName: 'qualificationRequirements',
- label: '璧勮川瑕佹眰',
- component: 'Textarea',
- componentProps: { placeholder: '璇疯緭鍏ヨ祫璐ㄨ姹�', rows: 3 },
- formItemClass: 'col-span-2',
- },
- {
- fieldName: 'blobIds',
- label: '璧勮川瑕佹眰闄勪欢',
- component: 'FileUpload',
- componentProps: {
- valueKey: 'id',
- maxNumber: 10,
- multiple: true,
- accept: ['jpg', 'jpeg', 'png', 'pdf', 'doc', 'docx'],
- helpText: '鏀寔jpg銆乯peg銆乸ng銆乸df銆乨oc銆乨ocx鏍煎紡锛屽崟涓枃浠朵笉瓒呰繃50MB',
- },
- formItemClass: 'col-span-2',
- },
- ];
-}
-
-/** 鎼滅储琛ㄥ崟 */
-export function useGridFormSchema(): VbenFormSchema[] {
- return [
- {
- fieldName: 'tenderNo',
- label: '鎷涙爣缂栧彿',
- component: 'Input',
- componentProps: { placeholder: '璇疯緭鍏ユ嫑鏍囩紪鍙�', allowClear: true },
- },
- {
- fieldName: 'tenderName',
- label: '鎷涙爣椤圭洰鍚嶇О',
- component: 'Input',
- componentProps: { placeholder: '璇疯緭鍏ユ嫑鏍囬」鐩悕绉�', allowClear: true },
- },
- {
- fieldName: 'tenderType',
- label: '鎷涙爣绫诲瀷',
- component: 'Select',
- componentProps: {
- placeholder: '璇烽�夋嫨鎷涙爣绫诲瀷',
- allowClear: true,
- options: TENDER_TYPE_OPTIONS,
- },
- },
- {
- fieldName: 'tenderStatus',
- label: '鐘舵��',
- component: 'Select',
- componentProps: {
- placeholder: '璇烽�夋嫨鐘舵��',
- allowClear: true,
- options: TENDER_STATUS_OPTIONS,
- },
- },
- {
- fieldName: 'biddingMode',
- label: '鎷涙姇鏍囨ā寮�',
- component: 'Select',
- componentProps: {
- placeholder: '璇烽�夋嫨鎷涙姇鏍囨ā寮�',
- allowClear: true,
- options: BIDDING_MODE_OPTIONS,
- },
- },
- ];
-}
-
-/** 琛ㄦ牸鍒� */
-export function useGridColumns(): VxeTableGridOptions['columns'] {
- return [
- { field: 'tenderNo', title: '鎷涙爣缂栧彿', minWidth: 140 },
- { field: 'tenderName', title: '鎷涙爣椤圭洰鍚嶇О', minWidth: 180 },
- {
- field: 'tenderType',
- title: '鎷涙爣绫诲瀷',
- minWidth: 120,
- cellRender: { name: 'CellTag', props: TENDER_TYPE_CELLTAG },
- },
- {
- field: 'tenderStatus',
- title: '鐘舵��',
- minWidth: 100,
- cellRender: { name: 'CellTag', props: TENDER_STATUS_CELLTAG },
- },
- {
- field: 'biddingMode',
- title: '鎷涙爣妯″紡',
- minWidth: 100,
- formatter: ({ cellValue }) => BIDDING_MODE_MAP[cellValue] || cellValue,
- },
- { field: 'budgetAmount', title: '棰勭畻閲戦', minWidth: 120 },
- { field: 'purchaseOrg', title: '閲囪喘缁勭粐', minWidth: 100 },
- { field: 'startTime', title: '寮�濮嬫椂闂�', minWidth: 160 },
- { field: 'endTime', title: '鎴鏃堕棿', minWidth: 160 },
- { field: 'purchaseOrderNo', title: '閲囪喘璁㈠崟鍙�', minWidth: 140 },
- {
- title: '鎿嶄綔',
- width: 250,
- fixed: 'right',
- slots: { default: 'actions' },
- },
- ];
-}
diff --git a/src/views/srm/tender/detail.vue b/src/views/srm/tender/detail.vue
deleted file mode 100644
index afcabf7..0000000
--- a/src/views/srm/tender/detail.vue
+++ /dev/null
@@ -1,1084 +0,0 @@
-<script lang="ts" setup>
-import type { SrmTenderApi } from '#/api/srm/tender';
-
-import { computed, onMounted, ref } from 'vue';
-import { useRoute, useRouter } from 'vue-router';
-
-import { Page } from '@vben/common-ui';
-
-import { message } from 'ant-design-vue';
-import { IconifyIcon } from '@vben/icons';
-
-import {
- getTenderProject,
- getMaterialList, createMaterial, updateMaterial, deleteMaterial,
- getBidListByProject, createBid, withdrawBid, updateBidTotal,
- getQuoteList, createQuote, updateQuote,
- createBidOpen, getBidOpen,
- getEvaluationList, createBidEvaluation, updateBidEvaluation, calculateRanking,
- createAward, deleteAward, getAward, getAwardByProject, approveAward, generatePurchaseOrder,
- confirmTenderProject,
-} from '#/api/srm/tender';
-import type { MdmItemApi } from '#/api/mdm/item';
-
-import { getSupplierList } from '#/api/srm/supplier';
-import { MdmItemSelect } from '#/views/basicData/mdm/components';
-import {
- TENDER_STATUS,
- TENDER_STATUS_CELLTAG,
- TENDER_STATUS_COLORS,
- TENDER_TYPE_CELLTAG,
- BID_STATUS,
- BID_STATUS_MAP,
- AWARD_STATUS,
- AWARD_STATUS_MAP,
- getLabel,
- BIDDING_MODE,
-} from '../enums';
-
-defineOptions({ name: 'SrmTenderDetail' });
-
-const route = useRoute();
-const router = useRouter();
-const projectId = Number(route.query.id);
-
-const project = ref<SrmTenderApi.TenderProjectVO>();
-const activeTab = ref('info');
-
-// ========== 涓嬫媺閫夐」鏁版嵁 ==========
-const supplierList = ref<{ id: number; name: string }[]>([]);
-
-onMounted(async () => {
- supplierList.value = await getSupplierList();
-});
-
-const filterOption = (input: string, option: any) =>
- option.label?.toLowerCase().indexOf(input.toLowerCase()) >= 0;
-
-// ========== 鍩烘湰淇℃伅 ==========
-const materialList = ref<SrmTenderApi.TenderMaterialVO[]>([]);
-const materialLoading = ref(false);
-const materialFormVisible = ref(false);
-const materialForm = ref<SrmTenderApi.TenderMaterialVO>({ tenderProjectId: projectId });
-
-// 宸叉坊鍔犵殑鐗╂枡浜у搧ID闆嗗悎锛岄伩鍏嶉噸澶嶆坊鍔�
-const addedProductIds = computed(() => {
- const ids = new Set(
- materialList.value
- .filter((m) => m.productId !== undefined)
- .map((m) => m.productId!),
- );
- // 缂栬緫鏃跺厑璁镐繚鐣欏綋鍓嶇墿鏂欑殑 productId
- if (materialForm.value.id && materialForm.value.productId) {
- ids.delete(materialForm.value.productId);
- }
- return ids;
-});
-
-async function loadProject() {
- project.value = await getTenderProject(projectId);
-}
-async function loadMaterials() {
- materialLoading.value = true;
- try { materialList.value = await getMaterialList(projectId); } finally { materialLoading.value = false; }
-}
-async function handleSaveMaterial() {
- // 鍚屼竴鎷涙爣椤圭洰涓嬩笉鍏佽閲嶅娣诲姞鍚屼竴鐗╂枡
- if (materialForm.value.productId && addedProductIds.value.has(materialForm.value.productId)) {
- message.warning('璇ョ墿鏂欏凡娣诲姞锛岃鍕块噸澶嶆坊鍔�');
- return;
- }
- if (materialForm.value.id) {
- await updateMaterial(materialForm.value);
- } else {
- await createMaterial(materialForm.value);
- }
- materialFormVisible.value = false;
- loadMaterials();
-}
-function onMaterialSelect(item?: MdmItemApi.Item) {
- if (item) {
- materialForm.value.productCode = item.code;
- materialForm.value.productName = item.name;
- materialForm.value.productSpec = item.specification;
- materialForm.value.unit = item.unitMeasureName;
- }
-}
-
-function handleAddMaterial() {
- materialForm.value = { tenderProjectId: projectId };
- materialFormVisible.value = true;
-}
-function handleEditMaterial(row: SrmTenderApi.TenderMaterialVO) {
- materialForm.value = { ...row };
- materialFormVisible.value = true;
-}
-async function handleDeleteMaterial(id: number) {
- await deleteMaterial(id);
- loadMaterials();
-}
-
-// ========== 鎶曟爣绠$悊 ==========
-const bidList = ref<SrmTenderApi.TenderBidVO[]>([]);
-const bidLoading = ref(false);
-const bidFormVisible = ref(false);
-const bidForm = ref<SrmTenderApi.TenderBidVO>({ tenderProjectId: projectId, supplierId: undefined!, bidNo: '' });
-
-async function loadBids() {
- bidLoading.value = true;
- try { bidList.value = await getBidListByProject(projectId); } finally { bidLoading.value = false; }
-}
-async function handleCreateBid() {
- await createBid(bidForm.value);
- bidFormVisible.value = false;
- loadBids();
-}
-async function handleWithdrawBid(id: number) {
- await withdrawBid(id);
- loadBids();
-}
-
-// ========== 鎶ヤ环绠$悊 ==========
-const quoteList = ref<SrmTenderApi.QuoteVO[]>([]);
-const quoteLoading = ref(false);
-const quoteFormVisible = ref(false);
-const quoteForm = ref<SrmTenderApi.QuoteVO>({ bidId: undefined!, tenderMaterialId: undefined! });
-const selectedBidId = ref<number>();
-/** 鎶曟爣鎬婚噾棰濊崏绋匡細杩涘叆鎶ヤ环椤垫椂甯﹀嚭宸蹭繚瀛樻�讳环锛屽彲鑷姩甯﹀嚭鎶ヤ环鍚堣鍚庝汉宸ュ井璋� */
-const bidTotalDraft = ref<number>();
-
-const availableMaterials = computed(() => {
- const quotedIds = new Set(
- quoteList.value
- .filter((q) => q.tenderMaterialId !== undefined)
- .map((q) => q.tenderMaterialId),
- );
- // 缂栬緫鏃跺厑璁镐繚鐣欏綋鍓嶇墿鏂�
- if (quoteForm.value.id && quoteForm.value.tenderMaterialId) {
- quotedIds.delete(quoteForm.value.tenderMaterialId);
- }
- return materialList.value.filter((m) => !quotedIds.has(m.id));
-});
-
-async function loadQuotes(bidId?: number) {
- if (!bidId) return;
- selectedBidId.value = bidId;
- quoteLoading.value = true;
- try { quoteList.value = await getQuoteList(bidId); } finally { quoteLoading.value = false; }
- // 甯﹀嚭璇ユ姇鏍囧凡淇濆瓨鐨勬姇鏍囨�婚噾棰濓紙涓虹┖鍒欒鐢ㄦ埛褰曞叆/鑷姩甯﹀嚭锛�
- const bid = bidList.value.find((b) => b.id === bidId);
- bidTotalDraft.value = bid?.bidTotalAmount ?? undefined;
-}
-async function handleSaveQuote() {
- if (quoteForm.value.id) {
- await updateQuote(quoteForm.value);
- } else {
- await createQuote(quoteForm.value);
- }
- quoteFormVisible.value = false;
- loadQuotes(selectedBidId.value);
-}
-function handleAddQuote() {
- quoteForm.value = { bidId: selectedBidId.value!, tenderMaterialId: undefined! };
- quoteFormVisible.value = true;
-}
-function handleEditQuote(row: SrmTenderApi.QuoteVO) {
- quoteForm.value = { ...row };
- quoteFormVisible.value = true;
-}
-
-/** 鎷涙爣鐗╂枡 Map锛氭姤浠疯鎸� tenderMaterialId 鍙嶆煡鐗╂枡鏁伴噺 */
-const materialMap = computed(() => {
- const map = new Map<number, SrmTenderApi.TenderMaterialVO>();
- materialList.value.forEach((m) => {
- if (m.id != null) map.set(m.id, m);
- });
- return map;
-});
-
-/** 鎶ヤ环鏄庣粏瀵瑰簲鐨勬嫑鏍囩墿鏂欐暟閲� */
-function materialQuantityOf(quote: SrmTenderApi.QuoteVO): number {
- return materialMap.value.get(quote.tenderMaterialId!)?.quantity ?? 0;
-}
-
-/** 鎶ヤ环琛岄噾棰� = 鎶ヤ环鍗曚环 脳 鐗╂枡鏁伴噺 */
-function quoteAmountOf(quote: SrmTenderApi.QuoteVO): number {
- return (quote.quotePrice ?? 0) * materialQuantityOf(quote);
-}
-
-/** 閫変腑鎶曟爣涓嬪凡褰曟姤浠风殑鍚堣閲戦 */
-const selectedQuoteTotalAmount = computed(() =>
- quoteList.value.reduce((sum, q) => sum + quoteAmountOf(q), 0),
-);
-
-/** 缁存姢锛堟暣鍗曪級鎶曟爣鎬婚噾棰濓細鍙嚜鍔ㄥ甫鍑烘姤浠峰悎璁″悗浜哄伐寰皟锛堢敤浜庢暣鍗曡鍒╃瓑锛� */
-async function handleSaveBidTotal() {
- if (!selectedBidId.value) return;
- if (bidTotalDraft.value == null) {
- message.warning('璇峰~鍐欐姇鏍囨�婚噾棰�');
- return;
- }
- await updateBidTotal(selectedBidId.value, bidTotalDraft.value);
- message.success('鎶曟爣鎬婚噾棰濆凡淇濆瓨');
- loadBids();
-}
-
-/** 宸蹭繚瀛樼殑鎶曟爣鎬婚噾棰� 涓� 鎶ヤ环鍚堣 鐨勫樊寮傛彁绀猴紙鍙彁绀猴紝涓嶆嫤鎴級 */
-const bidTotalCompareHint = computed<{ text: string; tone: 'success' | 'warning' } | null>(() => {
- const sum = selectedQuoteTotalAmount.value;
- if (sum <= 0) {
- return null; // 灏氭湭褰曟姤浠凤紝鏆備笉姣旇緝
- }
- const stored = selectedBid.value?.bidTotalAmount;
- if (stored == null) {
- return { text: '璇ユ姇鏍囧皻鏈淮鎶ゆ�婚噾棰濓細鍙偣銆岃嚜鍔ㄥ甫鍑烘姤浠峰悎璁°�嶅~鍏ュ悗淇濆瓨', tone: 'warning' };
- }
- const diff = Math.abs(stored - sum);
- if (diff < 0.01) {
- return { text: `鎶曟爣鎬婚噾棰� 楼${stored.toLocaleString()} 涓庢姤浠峰悎璁′竴鑷碻, tone: 'success' };
- }
- return {
- text: `鎶曟爣鎬婚噾棰� 楼${stored.toLocaleString()} 涓庢姤浠峰悎璁� 楼${sum.toLocaleString()} 涓嶄竴鑷达紙宸 楼${diff.toLocaleString()}锛夈�傚闇�鏁村崟璁╁埄/璋冧环锛岀洿鎺ュ湪鎶曟爣鎬婚噾棰濆淇敼骞朵繚瀛樸�俙,
- tone: 'warning',
- };
-});
-
-// ========== 寮�鏍� ==========
-const bidOpen = ref<any>(null);
-
-async function loadBidOpen() {
- try {
- bidOpen.value = null;
- } catch { /* 鏆傛棤寮�鏍囪褰� */ }
-}
-async function handleCreateBidOpen() {
- await createBidOpen(projectId);
- message.success('寮�鏍囨垚鍔�');
- loadBidOpen();
- loadProject();
-}
-
-// ========== 璇勬爣绠$悊 ==========
-const evaluationList = ref<SrmTenderApi.BidEvaluationVO[]>([]);
-const evalLoading = ref(false);
-const evalFormVisible = ref(false);
-const evalForm = ref<SrmTenderApi.BidEvaluationVO>({ tenderProjectId: projectId, supplierId: undefined!, bidId: undefined! });
-
-async function loadEvaluations() {
- evalLoading.value = true;
- try { evaluationList.value = await getEvaluationList(projectId); } finally { evalLoading.value = false; }
-}
-async function handleCreateEvaluation() {
- if (evalForm.value.id) {
- await updateBidEvaluation(evalForm.value);
- } else {
- await createBidEvaluation(evalForm.value);
- }
- evalFormVisible.value = false;
- loadEvaluations();
- loadProject();
-}
-async function handleCalculateRanking() {
- await calculateRanking(projectId);
- message.success('鎺掑悕璁$畻瀹屾垚');
- loadEvaluations();
-}
-
-// ========== 瀹氭爣 ==========
-const award = ref<SrmTenderApi.BidAwardVO>();
-const awardFormVisible = ref(false);
-const awardForm = ref<SrmTenderApi.BidAwardVO>({ tenderProjectId: projectId, supplierId: undefined!, bidId: undefined!, awardNo: '' });
-
-/** 宸叉姇鏍囦笖鏈挙鏍囩殑渚涘簲鍟嗗垪琛紙浠庢姇鏍囪褰曚腑鎻愬彇锛� */
-const bidSuppliers = computed(() => {
- const activeBids = bidList.value.filter((b) => b.bidStatus !== BID_STATUS.WITHDRAWN);
- const seen = new Map<number, { id: number; name: string }>();
- activeBids.forEach((b) => {
- if (b.supplierId && !seen.has(b.supplierId)) {
- seen.set(b.supplierId, { id: b.supplierId, name: b.supplierName || '' });
- }
- });
- return [...seen.values()];
-});
-
-/** 鍙�夋姇鏍囪褰曪細鎺掗櫎鎾ゆ爣锛屼笖濡傛灉閫変簡渚涘簲鍟嗗垯鍙樉绀鸿渚涘簲鍟嗙殑鎶曟爣 */
-const activeBids = computed(() => {
- return bidList.value.filter((b) => {
- if (b.bidStatus === BID_STATUS.WITHDRAWN) return false;
- if (awardForm.value.supplierId && b.supplierId !== awardForm.value.supplierId) return false;
- return true;
- });
-});
-
-/** 閫夋嫨渚涘簲鍟嗘椂娓呯┖宸查�夌殑鎶曟爣 */
-function onAwardSupplierChange() {
- awardForm.value.bidId = undefined!;
-}
-
-/** 閫夋嫨鎶曟爣鏃惰嚜鍔ㄥ甫鍏ヨ鎶曟爣鐨勬姤浠烽噾棰� */
-function onAwardBidChange(bidId: number) {
- const bid = bidList.value.find((b) => b.id === bidId);
- if (bid?.bidTotalAmount != null) {
- awardForm.value.awardAmount = bid.bidTotalAmount;
- }
-}
-
-async function loadAward() {
- try { award.value = await getAwardByProject(projectId); } catch { award.value = undefined; }
-}
-async function handleCreateAward() {
- await createAward(awardForm.value);
- awardFormVisible.value = false;
- loadAward();
- loadProject();
-}
-async function handleApproveAward() {
- if (!award.value?.id) return;
- await approveAward(award.value.id);
- message.success('瀹氭爣瀹℃壒閫氳繃');
- loadAward();
- loadProject();
-}
-async function handleDeleteAward() {
- if (!award.value?.id) return;
- await deleteAward(award.value.id);
- message.success('瀹氭爣宸插垹闄�');
- award.value = undefined;
-}
-
-async function handleGeneratePurchaseOrder() {
- if (!award.value?.id) return;
- await generatePurchaseOrder(award.value.id);
- message.success('閲囪喘璁㈠崟宸茬敓鎴�');
- loadAward();
- loadProject();
-}
-
-// ========== 绠�鏄撴ā寮忥細纭涓爣 ==========
-const confirmBidId = ref<number>();
-const confirmModalVisible = ref(false);
-
-async function handleConfirmBidAsWinner(bidId: number) {
- await confirmTenderProject({ id: projectId, bidId });
- message.success('纭涓爣鎴愬姛锛岄噰璐鍗曞凡鑷姩鐢熸垚');
- loadProject();
- loadBids();
- loadAward();
-}
-
-function openSimpleConfirmModal() {
- confirmBidId.value = undefined;
- confirmModalVisible.value = true;
-}
-
-async function handleSimpleConfirm() {
- if (!confirmBidId.value) {
- message.warning('璇烽�夋嫨涓爣鐨勬姇鏍囪褰�');
- return;
- }
- await confirmTenderProject({ id: projectId, bidId: confirmBidId.value });
- message.success('纭涓爣鎴愬姛锛岄噰璐鍗曞凡鑷姩鐢熸垚');
- confirmModalVisible.value = false;
- loadProject();
- loadBids();
- loadAward();
-}
-
-// ========== 鍒濆鍖� ==========
-loadProject();
-loadMaterials();
-loadBids();
-loadEvaluations();
-loadAward();
-
-// ========== 鐘舵�佸垽鏂� ==========
-const statusLabel = computed(() => getLabel(TENDER_STATUS_CELLTAG.labels, project.value?.tenderStatus));
-const statusColor = computed(() => TENDER_STATUS_COLORS[project.value?.tenderStatus!] || 'default');
-const typeLabel = computed(() => getLabel(TENDER_TYPE_CELLTAG.labels, project.value?.tenderType));
-const isDraft = computed(() => project.value?.tenderStatus === TENDER_STATUS.DRAFT);
-const isPublished = computed(() => project.value?.tenderStatus === TENDER_STATUS.PUBLISHED);
-const isBidding = computed(() => project.value?.tenderStatus === TENDER_STATUS.BIDDING);
-const isPublishedOrBidding = computed(() => {
- const s = project.value?.tenderStatus;
- return s === TENDER_STATUS.PUBLISHED || s === TENDER_STATUS.BIDDING;
-});
-const isBiddingOrEvaluating = computed(() => {
- const s = project.value?.tenderStatus;
- return s === TENDER_STATUS.BIDDING || s === TENDER_STATUS.EVALUATING;
-});
-const isEvaluating = computed(() => project.value?.tenderStatus === TENDER_STATUS.EVALUATING);
-const canDeleteAward = computed(() => award.value?.awardStatus === AWARD_STATUS.PENDING_APPROVAL);
-const canApproveAward = computed(() => award.value?.awardStatus === AWARD_STATUS.PENDING_APPROVAL);
-const canGeneratePO = computed(() => award.value?.awardStatus === AWARD_STATUS.AWARDED);
-
-// 绠�鏄撴ā寮�
-const isSimpleMode = computed(() => project.value?.biddingMode === BIDDING_MODE.SIMPLE);
-const isPriceComparing = computed(() => project.value?.tenderStatus === TENDER_STATUS.PRICE_COMPARING);
-
-const stepItems = computed(() => {
- if (isSimpleMode.value) {
- return [
- { title: '鑽夌', status: TENDER_STATUS.DRAFT },
- { title: '姣斾环涓�', status: TENDER_STATUS.PRICE_COMPARING },
- { title: '宸茬‘璁�', status: TENDER_STATUS.CONFIRMED },
- ];
- }
- return [
- { title: '鑽夌', status: TENDER_STATUS.DRAFT },
- { title: '鍙戝竷', status: TENDER_STATUS.PUBLISHED },
- { title: '鎶曟爣涓�', status: TENDER_STATUS.BIDDING },
- { title: '璇勬爣涓�', status: TENDER_STATUS.EVALUATING },
- { title: '宸插畾鏍�', status: TENDER_STATUS.AWARDED },
- ];
-});
-const currentStep = computed(() => {
- const s = project.value?.tenderStatus ?? 0;
- const items = stepItems.value;
- if (s === TENDER_STATUS.CLOSED) return items.length - 1;
- const idx = items.findIndex((item) => item.status >= s);
- return idx === -1 ? 0 : idx;
-});
-const stepStatus = computed(() => {
- const s = project.value?.tenderStatus;
- if (s === TENDER_STATUS.CLOSED) return 'error';
- if (s === TENDER_STATUS.AWARDED || s === TENDER_STATUS.CONFIRMED) return 'finish';
- return 'process';
-});
-
-const materialTotalAmount = computed(() =>
- materialList.value.reduce((sum, m) => sum + (m.estimatedPrice ?? 0) * (m.quantity ?? 0), 0),
-);
-const bidCount = computed(() => bidList.value.length);
-const bidTotalAmount = computed(() =>
- bidList.value.reduce((sum, b) => sum + (b.bidTotalAmount ?? 0), 0),
-);
-const evalCount = computed(() => evaluationList.value.length);
-const rankedCount = computed(() => evaluationList.value.filter((e) => e.rank != null).length);
-
-const selectedBid = computed(() =>
- bidList.value.find((b) => b.id === selectedBidId.value),
-);
-
-const materialColumns = [
- { title: '鐗╂枡缂栫爜', dataIndex: 'productCode', width: 120 },
- { title: '鐗╂枡鍚嶇О', dataIndex: 'productName', width: 150 },
- { title: '瑙勬牸鍨嬪彿', dataIndex: 'productSpec', width: 120 },
- { title: '鍗曚綅', dataIndex: 'unit', width: 80 },
- { title: '鏁伴噺', dataIndex: 'quantity', width: 80 },
- { title: '鎶�鏈姹�', dataIndex: 'techRequirement', width: 150 },
- { title: '棰勪及鍗曚环', dataIndex: 'estimatedPrice', width: 100 },
- { title: '鎿嶄綔', key: 'actions', width: 150 },
-];
-
-const bidColumns = [
- { title: '鎶曟爣缂栧彿', dataIndex: 'bidNo', width: 140 },
- { title: '渚涘簲鍟�', dataIndex: 'supplierName', width: 200 },
- { title: '鎶曟爣鎬婚噾棰�', dataIndex: 'bidTotalAmount', width: 120 },
- { title: '鎶曟爣鏃堕棿', dataIndex: 'bidTime', width: 160 },
- { title: '鐘舵��', dataIndex: 'bidStatus', width: 100, customRender: ({ text }: any) => BID_STATUS_MAP[text] || text },
- { title: '鎿嶄綔', key: 'actions', width: 240 },
-];
-
-const quoteColumns = [
- { title: '鐗╂枡', dataIndex: 'materialName', width: 120 },
- { title: '鎶ヤ环鍗曚环', dataIndex: 'quotePrice', width: 100 },
- { title: '鏁伴噺', dataIndex: 'quantity', width: 70 },
- { title: '鎶ヤ环閲戦', dataIndex: 'quoteAmount', width: 110 },
- { title: '绋庣巼(%)', dataIndex: 'taxRate', width: 80 },
- { title: '浜ゆ湡(澶�)', dataIndex: 'deliveryCycle', width: 80 },
- { title: '浠樻鏉′欢', dataIndex: 'paymentTerms', width: 120 },
- { title: '璐ㄤ繚鏈�(鏈�)', dataIndex: 'warrantyPeriod', width: 80 },
- { title: '澶囨敞', dataIndex: 'remark', width: 150 },
- { title: '鎿嶄綔', key: 'actions', width: 120 },
-];
-
-const evalColumns = [
- { title: '鎶曟爣ID', dataIndex: 'bidId', width: 80 },
- { title: '渚涘簲鍟�', dataIndex: 'supplierName', width: 150 },
- { title: '浠锋牸璇勫垎', dataIndex: 'priceScore', width: 100 },
- { title: '鎶�鏈瘎鍒�', dataIndex: 'techScore', width: 100 },
- { title: '浜や粯璇勫垎', dataIndex: 'deliveryScore', width: 100 },
- { title: '鏈嶅姟璇勫垎', dataIndex: 'serviceScore', width: 100 },
- { title: '缁煎悎璇勫垎', dataIndex: 'compositeScore', width: 100 },
- { title: '鎺掑悕', dataIndex: 'rank', width: 80 },
- { title: '璇勫', dataIndex: 'evaluatorName', width: 100 },
- { title: '璇勮', dataIndex: 'evaluationOpinion', width: 150 },
- { title: '鎿嶄綔', key: 'actions', width: 120 },
-];
-</script>
-
-<template>
- <Page auto-content-height>
- <!-- 鍔犺浇涓� -->
- <a-skeleton v-if="!project" active class="p-4" />
- <template v-else>
- <!-- 椤堕儴鏍囬鏍� -->
- <div class="flex items-center gap-2 px-4 pt-3 pb-2">
- <a-button type="text" size="small" @click="router.back()">
- <template #icon><IconifyIcon icon="ant-design:arrow-left-outlined" /></template>
- </a-button>
- <span class="text-lg font-bold truncate max-w-md">{{ project.tenderName }}</span>
- <span class="text-gray-400 text-xs">{{ project.tenderNo }}</span>
- <a-tag :color="statusColor">{{ statusLabel }}</a-tag>
- <a-tag color="blue">{{ typeLabel }}</a-tag>
- <a-tag v-if="isSimpleMode" color="purple">绠�鏄撶増</a-tag>
- <div class="flex-1" />
- <a-button
- v-if="isPriceComparing"
- type="primary"
- size="small"
- @click="openSimpleConfirmModal"
- >
- 纭涓爣
- </a-button>
- <a-button size="small" @click="loadProject(); loadMaterials(); loadBids(); loadEvaluations(); loadAward();">
- <template #icon><IconifyIcon icon="ant-design:reload-outlined" /></template>
- 鍒锋柊
- </a-button>
- </div>
-
- <!-- 宸ヤ綔娴佽繘搴� + 鍏抽敭淇℃伅 -->
- <div class="px-4 mb-3">
- <a-card size="small">
- <!-- 娴佺▼姝ラ -->
- <a-steps :current="currentStep" :status="stepStatus" size="small" class="mb-3">
- <a-step v-for="item in stepItems" :key="item.status" :title="item.title" />
- </a-steps>
-
- <!-- 鍏抽敭瀛楁 -->
- <div class="grid grid-cols-6 gap-3 text-xs">
- <div>
- <div class="text-gray-400 mb-0.5">棰勭畻閲戦</div>
- <div class="font-semibold text-blue-500">{{ project.budgetAmount?.toLocaleString() ?? '-' }} 鍏�</div>
- </div>
- <div>
- <div class="text-gray-400 mb-0.5">璐熻矗浜�</div>
- <div class="font-semibold">{{ project.projectLeaderName || '-' }}</div>
- </div>
- <div>
- <div class="text-gray-400 mb-0.5">閲囪喘缁勭粐</div>
- <div class="font-semibold">{{ project.purchaseOrg || '-' }}</div>
- </div>
- <div>
- <div class="text-gray-400 mb-0.5">寮�鏍囨椂闂�</div>
- <div class="font-semibold">{{ project.bidOpenTime || '寰呭畾' }}</div>
- </div>
- <div>
- <div class="text-gray-400 mb-0.5">寮�濮嬫椂闂�</div>
- <div class="font-semibold">{{ project.startTime || '-' }}</div>
- </div>
- <div>
- <div class="text-gray-400 mb-0.5">鎴鏃堕棿</div>
- <div class="font-semibold">{{ project.endTime || '-' }}</div>
- </div>
- </div>
-
- <!-- 鎷涙爣璇存槑 / 璧勮川瑕佹眰 -->
- <template
- v-if="project.tenderDesc || project.qualificationRequirements || (project.attachmentList && project.attachmentList.length)"
- >
- <a-divider class="!my-2" />
- <a-collapse :bordered="false" ghost expand-icon-position="end">
- <a-collapse-panel v-if="project.tenderDesc" key="desc" header="鎷涙爣璇存槑">
- <p class="text-gray-500 text-xs whitespace-pre-wrap">{{ project.tenderDesc }}</p>
- </a-collapse-panel>
- <a-collapse-panel
- v-if="project.qualificationRequirements || (project.attachmentList && project.attachmentList.length)"
- key="req"
- header="璧勮川瑕佹眰"
- >
- <p v-if="project.qualificationRequirements" class="text-gray-500 text-xs whitespace-pre-wrap">{{ project.qualificationRequirements }}</p>
- <div v-if="project.attachmentList && project.attachmentList.length" class="mt-2 flex flex-col gap-1">
- <a
- v-for="file in project.attachmentList"
- :key="file.id"
- :href="file.url"
- target="_blank"
- rel="noopener noreferrer"
- class="text-blue-500 text-xs hover:underline"
- >
- {{ file.name || '闄勪欢-' + file.id }}
- </a>
- </div>
- </a-collapse-panel>
- </a-collapse>
- </template>
- </a-card>
- </div>
-
- <!-- Tab 椤电 -->
- <div class="px-4 pb-4">
- <a-card size="small">
- <a-tabs v-model:activeKey="activeTab" size="small">
- <!-- Tab1: 鐗╂枡娓呭崟 -->
- <a-tab-pane key="info">
- <template #tab>
- <a-space :size="4"><IconifyIcon icon="ant-design:unordered-list-outlined" />鐗╂枡娓呭崟</a-space>
- </template>
- <div class="flex items-center justify-between mb-3">
- <a-space>
- <span class="text-xs text-gray-400">鍏� <b class="text-gray-600">{{ materialList.length }}</b> 椤癸紝棰勪及鎬婚噾棰� <b class="text-blue-500">{{ materialTotalAmount.toLocaleString() }}</b> 鍏�</span>
- </a-space>
- <a-button v-if="isDraft" type="primary" size="small" @click="handleAddMaterial">
- <template #icon><IconifyIcon icon="ant-design:plus-outlined" /></template>
- 娣诲姞鐗╂枡
- </a-button>
- </div>
- <a-table :columns="materialColumns" :data-source="materialList" :loading="materialLoading" :pagination="false" row-key="id" size="small">
- <template #bodyCell="{ column, record }">
- <template v-if="column.dataIndex === 'estimatedPrice'">
- {{ record.estimatedPrice ? record.estimatedPrice.toLocaleString() : '-' }}
- </template>
- <template v-if="column.key === 'actions'">
- <a-space v-if="isDraft">
- <a-button size="small" type="link" @click="handleEditMaterial(record)"><IconifyIcon icon="ant-design:edit-outlined" />缂栬緫</a-button>
- <a-popconfirm title="纭鍒犻櫎璇ョ墿鏂欙紵" @confirm="handleDeleteMaterial(record.id)">
- <a-button size="small" type="link" danger><IconifyIcon icon="ant-design:delete-outlined" />鍒犻櫎</a-button>
- </a-popconfirm>
- </a-space>
- </template>
- </template>
- </a-table>
- <a-empty v-if="!materialLoading && materialList.length === 0" description="鏆傛棤鐗╂枡" class="mt-8" />
- </a-tab-pane>
-
- <!-- Tab2: 鎶曟爣绠$悊 -->
- <a-tab-pane key="bid">
- <template #tab>
- <a-space :size="4"><IconifyIcon icon="ant-design:team-outlined" />鎶曟爣绠$悊</a-space>
- </template>
- <div class="flex items-center justify-between mb-3">
- <span class="text-xs text-gray-400">鍏� <b class="text-gray-600">{{ bidCount }}</b> 涓姇鏍�</span>
- <a-button v-if="isBidding || isDraft || isPriceComparing" type="primary" size="small" @click="bidForm = { tenderProjectId: projectId, supplierId: undefined!, bidNo: '' }; bidFormVisible = true">
- <template #icon><IconifyIcon icon="ant-design:plus-outlined" /></template>
- 鏂板鎶曟爣
- </a-button>
- </div>
- <a-table :columns="bidColumns" :data-source="bidList" :loading="bidLoading" :pagination="false" row-key="id" size="small">
- <template #bodyCell="{ column, record }">
- <template v-if="column.dataIndex === 'bidTotalAmount'">
- <span class="font-medium">{{ record.bidTotalAmount?.toLocaleString() }}</span>
- </template>
- <template v-if="column.dataIndex === 'bidStatus'">
- <a-tag :color="record.bidStatus === BID_STATUS.WIN ? 'green' : record.bidStatus === BID_STATUS.LOSE ? 'red' : 'default'">
- {{ BID_STATUS_MAP[record.bidStatus] }}
- </a-tag>
- </template>
- <template v-if="column.key === 'actions'">
- <a-space>
- <a-button size="small" type="link" @click="loadQuotes(record.id); activeTab = 'quote'"><IconifyIcon icon="ant-design:dollar-outlined" />鎶ヤ环</a-button>
- <a-popconfirm v-if="isPriceComparing && record.bidStatus !== BID_STATUS.WITHDRAWN" title="纭閫夋嫨璇ユ姇鏍囦负涓爣锛熷皢鑷姩鐢熸垚閲囪喘璁㈠崟銆�" ok-text="纭涓爣" cancel-text="鍙栨秷" @confirm="handleConfirmBidAsWinner(record.id)">
- <a-button size="small" type="link" style="color: #52c41a;"><IconifyIcon icon="ant-design:check-circle-outlined" />纭涓爣</a-button>
- </a-popconfirm>
- <a-popconfirm v-if="(isPublishedOrBidding || isDraft || isPriceComparing) && record.bidStatus === BID_STATUS.REGISTERED" title="纭鎾ゆ爣锛�" @confirm="handleWithdrawBid(record.id)">
- <a-button size="small" type="link" danger><IconifyIcon icon="ant-design:close-circle-outlined" />鎾ゆ爣</a-button>
- </a-popconfirm>
- </a-space>
- </template>
- </template>
- </a-table>
- <a-empty v-if="!bidLoading && bidList.length === 0" description="鏆傛棤鎶曟爣璁板綍" class="mt-8" />
- </a-tab-pane>
-
- <!-- Tab3: 鎶ヤ环绠$悊 -->
- <a-tab-pane key="quote">
- <template #tab>
- <a-space :size="4"><IconifyIcon icon="ant-design:dollar-outlined" />鎶ヤ环绠$悊</a-space>
- </template>
- <template v-if="selectedBidId && selectedBid">
- <div class="flex items-center gap-3 mb-3 px-3 py-2 bg-gray-50 rounded text-xs">
- <span class="text-gray-400">鎶曟爣锛�<b class="text-gray-700">{{ selectedBid.bidNo }}</b></span>
- <a-divider type="vertical" />
- <span class="text-gray-400">渚涘簲鍟嗭細<b class="text-gray-700">{{ selectedBid.supplierName }}</b></span>
- <a-button size="small" type="link" class="ml-auto" @click="activeTab = 'bid'">鍒囨崲鎶曟爣</a-button>
- </div>
- <!-- 鎶曟爣鎬婚噾棰濓紙鏁村崟鎬讳环锛夛細鍙笌鎶ヤ环鍚堣鑷姩甯﹀嚭骞朵汉宸ヨ皟鏁� -->
- <div v-if="(isPublishedOrBidding || isDraft || isPriceComparing) && selectedBid?.bidStatus !== BID_STATUS.WITHDRAWN" class="flex flex-wrap items-center gap-x-3 gap-y-2 mb-2 px-3 py-2 bg-blue-50/70 rounded text-xs">
- <span class="text-gray-600 font-medium">鎶曟爣鎬婚噾棰�</span>
- <a-input-number v-model:value="bidTotalDraft" :min="0" :precision="2" class="!w-40" placeholder="鏁村崟鎬讳环">
- <template #addonAfter>鍏�</template>
- </a-input-number>
- <a-button size="small" type="link" :disabled="selectedQuoteTotalAmount <= 0" @click="bidTotalDraft = selectedQuoteTotalAmount">
- 鑷姩甯﹀嚭鎶ヤ环鍚堣 楼{{ selectedQuoteTotalAmount.toLocaleString() }}
- </a-button>
- <a-button size="small" type="primary" @click="handleSaveBidTotal">淇濆瓨鎬讳环</a-button>
- </div>
- <a-alert
- v-if="bidTotalCompareHint"
- :type="bidTotalCompareHint.tone"
- :show-icon="true"
- class="mb-3"
- :message="bidTotalCompareHint.text"
- />
- <div class="flex items-center justify-between mb-3">
- <span class="text-xs text-gray-400">
- 宸叉姤浠� <b class="text-gray-600">{{ quoteList.length }}</b> / <b class="text-gray-600">{{ materialList.length }}</b> 椤圭墿鏂欙紝鎶ヤ环鍚堣
- <b class="text-blue-500">{{ selectedQuoteTotalAmount.toLocaleString() }}</b> 鍏�
- </span>
- <a-button v-if="(isPublishedOrBidding || isDraft || isPriceComparing) && selectedBid?.bidStatus !== BID_STATUS.WITHDRAWN" type="primary" size="small" @click="handleAddQuote">
- <template #icon><IconifyIcon icon="ant-design:plus-outlined" /></template>
- 鏂板鎶ヤ环
- </a-button>
- </div>
- <a-table :columns="quoteColumns" :data-source="quoteList" :loading="quoteLoading" :pagination="false" row-key="id" size="small">
- <template #bodyCell="{ column, record }">
- <template v-if="column.dataIndex === 'quotePrice'">
- <span class="font-medium text-blue-600">{{ record.quotePrice?.toLocaleString() }}</span>
- </template>
- <template v-if="column.dataIndex === 'quantity'">
- {{ materialQuantityOf(record) || '-' }}
- </template>
- <template v-if="column.dataIndex === 'quoteAmount'">
- <span class="font-medium text-blue-600">{{ quoteAmountOf(record).toLocaleString() }}</span>
- </template>
- <template v-if="column.dataIndex === 'taxRate'">
- {{ record.taxRate != null ? `${record.taxRate}%` : '-' }}
- </template>
- <template v-if="column.dataIndex === 'deliveryCycle'">
- {{ record.deliveryCycle != null ? `${record.deliveryCycle} 澶ー : '-' }}
- </template>
- <template v-if="column.dataIndex === 'warrantyPeriod'">
- {{ record.warrantyPeriod != null ? `${record.warrantyPeriod} 涓湀` : '-' }}
- </template>
- <template v-if="column.key === 'actions'">
- <a-button v-if="(isPublishedOrBidding || isDraft || isPriceComparing) && selectedBid?.bidStatus !== BID_STATUS.WITHDRAWN" size="small" type="link" @click="handleEditQuote(record)"><IconifyIcon icon="ant-design:edit-outlined" />缂栬緫</a-button>
- </template>
- </template>
- </a-table>
- <a-empty v-if="!quoteLoading && quoteList.length === 0" description="鏆傛棤鎶ヤ环鏄庣粏" class="mt-8" />
- </template>
- <a-empty v-else description="璇峰厛鍦ㄣ�屾姇鏍囩鐞嗐�嶄腑閫夋嫨涓�涓姇鏍囨煡鐪嬫姤浠�">
- <a-button type="primary" @click="activeTab = 'bid'">鍓嶅線鎶曟爣绠$悊</a-button>
- </a-empty>
- </a-tab-pane>
-
- <!-- Tab4: 寮�鏍� -->
- <a-tab-pane v-if="!isSimpleMode" key="bidOpen">
- <template #tab>
- <a-space :size="4"><IconifyIcon icon="ant-design:unlock-outlined" />寮�鏍�</a-space>
- </template>
- <template v-if="bidOpen">
- <a-result status="success" title="宸插紑鏍�">
- <template #sub-title>
- <a-descriptions :column="2" size="small" class="mt-4">
- <a-descriptions-item label="寮�鏍囩紪鍙�">{{ bidOpen.id }}</a-descriptions-item>
- <a-descriptions-item label="寮�鏍囨椂闂�">{{ bidOpen.openTime }}</a-descriptions-item>
- </a-descriptions>
- </template>
- </a-result>
- </template>
- <template v-else>
- <div class="text-center py-8">
- <a-result status="info" title="灏氭湭寮�鏍�" sub-title="鎵ц寮�鏍囧悗椤圭洰杩涘叆鎶曟爣闃舵锛屼緵搴斿晢鍙寮忔姇鏍�" />
- <br />
- <a-button v-if="isPublished" type="primary" @click="handleCreateBidOpen">
- <template #icon><IconifyIcon icon="ant-design:thunderbolt-outlined" /></template>
- 鎵ц寮�鏍�
- </a-button>
- </div>
- </template>
- </a-tab-pane>
-
- <!-- Tab5: 璇勬爣 -->
- <a-tab-pane v-if="!isSimpleMode" key="evaluation">
- <template #tab>
- <a-space :size="4"><IconifyIcon icon="ant-design:trophy-outlined" />璇勬爣</a-space>
- </template>
- <div class="flex items-center justify-between mb-3">
- <span class="text-xs text-gray-400">鍏� <b class="text-gray-600">{{ evalCount }}</b> 鏉★紝宸叉帓鍚� <b class="text-green-500">{{ rankedCount }}</b> 鏉�</span>
- <a-space v-if="isBiddingOrEvaluating">
- <a-button size="small" @click="handleCalculateRanking">
- <template #icon><IconifyIcon icon="ant-design:bar-chart-outlined" /></template>
- 璁$畻鎺掑悕
- </a-button>
- <a-button type="primary" size="small" @click="evalForm = { tenderProjectId: projectId, supplierId: undefined!, bidId: undefined! }; evalFormVisible = true">
- <template #icon><IconifyIcon icon="ant-design:plus-outlined" /></template>
- 鏂板璇勬爣
- </a-button>
- </a-space>
- </div>
- <a-table :columns="evalColumns" :data-source="evaluationList" :loading="evalLoading" :pagination="false" row-key="id" size="small">
- <template #bodyCell="{ column, record }">
- <template v-if="['priceScore', 'techScore', 'deliveryScore', 'serviceScore'].includes(column.dataIndex)">
- <div class="flex items-center gap-2">
- <a-progress :percent="record[column.dataIndex] || 0" :show-info="false" size="small"
- :stroke-color="record[column.dataIndex] >= 80 ? '#52c41a' : record[column.dataIndex] >= 60 ? '#faad14' : '#ff4d4f'"
- class="flex-1" style="min-width: 50px;" />
- <span class="text-xs w-8 text-right">{{ record[column.dataIndex] ?? '-' }}</span>
- </div>
- </template>
- <template v-if="column.dataIndex === 'compositeScore'">
- <span class="font-bold" :class="record.compositeScore >= 80 ? 'text-green-500' : record.compositeScore >= 60 ? 'text-orange-500' : 'text-red-500'">
- {{ record.compositeScore ?? '-' }}
- </span>
- </template>
- <template v-if="column.dataIndex === 'rank'">
- <a-tag v-if="record.rank === 1" color="gold"><IconifyIcon icon="ant-design:trophy-outlined" /> 绗�1鍚�</a-tag>
- <a-tag v-else-if="record.rank" color="default">绗瑊{ record.rank }}鍚�</a-tag>
- <span v-else class="text-gray-300">-</span>
- </template>
- <template v-if="column.key === 'actions'">
- <a-button v-if="isBiddingOrEvaluating" size="small" type="link" @click="evalForm = { ...record }; evalFormVisible = true"><IconifyIcon icon="ant-design:edit-outlined" />缂栬緫</a-button>
- </template>
- </template>
- </a-table>
- <a-empty v-if="!evalLoading && evaluationList.length === 0" description="鏆傛棤璇勬爣璁板綍" class="mt-8" />
- </a-tab-pane>
-
- <!-- Tab6: 瀹氭爣 -->
- <a-tab-pane v-if="!isSimpleMode" key="award">
- <template #tab>
- <a-space :size="4"><IconifyIcon icon="ant-design:check-circle-outlined" />瀹氭爣</a-space>
- </template>
- <template v-if="award">
- <a-row :gutter="16">
- <a-col :span="16">
- <a-descriptions :column="2" bordered size="small">
- <a-descriptions-item label="瀹氭爣缂栧彿">
- <span class="font-mono">{{ award.awardNo }}</span>
- </a-descriptions-item>
- <a-descriptions-item label="涓爣渚涘簲鍟�">
- <a-tag color="blue">{{ award.supplierName || award.supplierId }}</a-tag>
- </a-descriptions-item>
- <a-descriptions-item label="瀹氭爣閲戦">
- <span class="font-bold text-blue-600">{{ award.awardAmount?.toLocaleString() }}</span> 鍏�
- </a-descriptions-item>
- <a-descriptions-item label="瀹氭爣鏃堕棿">{{ award.awardTime || '-' }}</a-descriptions-item>
- <a-descriptions-item label="鐘舵��">
- <a-tag :color="award.awardStatus === AWARD_STATUS.AWARDED ? 'green' : 'orange'">{{ AWARD_STATUS_MAP[award.awardStatus] }}</a-tag>
- </a-descriptions-item>
- <a-descriptions-item label="閲囪喘璁㈠崟">{{ award.purchaseOrderId || '寰呯敓鎴�' }}</a-descriptions-item>
- <a-descriptions-item label="澶囨敞" :span="2">{{ award.remark || '-' }}</a-descriptions-item>
- </a-descriptions>
- </a-col>
- <a-col :span="8" class="flex items-center justify-center">
- <template v-if="award.awardStatus === AWARD_STATUS.ORDER_GENERATED">
- <div class="text-center">
- <a-result status="success" title="璁㈠崟宸茬敓鎴�" class="p-0">
- <template #sub-title>
- <span class="text-sm">閲囪喘璁㈠崟 ID: {{ award.purchaseOrderId }}</span>
- </template>
- </a-result>
- <a-popconfirm v-if="canDeleteAward" title="纭畾鍒犻櫎璇ュ畾鏍囪褰曪紵" ok-text="纭畾" cancel-text="鍙栨秷" @confirm="handleDeleteAward">
- <a-button type="link" danger size="small" class="mt-2">鍒犻櫎瀹氭爣</a-button>
- </a-popconfirm>
- </div>
- </template>
- <template v-else-if="award.awardStatus === AWARD_STATUS.AWARDED">
- <div class="text-center">
- <a-result status="success" title="瀹氭爣瀹屾垚" class="p-0 mb-3" />
- <a-button v-if="canGeneratePO" type="primary" block @click="handleGeneratePurchaseOrder">
- <template #icon><IconifyIcon icon="ant-design:shopping-cart-outlined" /></template>
- 鐢熸垚閲囪喘璁㈠崟
- </a-button>
- <a-popconfirm v-if="canDeleteAward" title="纭畾鍒犻櫎璇ュ畾鏍囪褰曪紵" ok-text="纭畾" cancel-text="鍙栨秷" @confirm="handleDeleteAward">
- <a-button type="link" danger size="small" class="mt-2">鍒犻櫎瀹氭爣</a-button>
- </a-popconfirm>
- </div>
- </template>
- <template v-else>
- <div class="text-center">
- <div class="text-gray-500 text-sm mb-3">瀹氭爣淇℃伅宸插垱寤猴紝璇峰鎵�</div>
- <a-button v-if="canApproveAward" type="primary" block @click="handleApproveAward" style="background: #52c41a; border-color: #52c41a;">
- <template #icon><IconifyIcon icon="ant-design:check-outlined" /></template>
- 瀹℃壒閫氳繃
- </a-button>
- <a-popconfirm v-if="canDeleteAward" title="纭畾鍒犻櫎璇ュ畾鏍囪褰曪紵" ok-text="纭畾" cancel-text="鍙栨秷" @confirm="handleDeleteAward">
- <a-button type="link" danger size="small" class="mt-2">鍒犻櫎瀹氭爣</a-button>
- </a-popconfirm>
- </div>
- </template>
- </a-col>
- </a-row>
- </template>
- <template v-else>
- <div class="text-center py-8">
- <a-result status="info" title="灏氭湭瀹氭爣" sub-title="鍩轰簬璇勬爣鎺掑悕閫夋嫨涓爣渚涘簲鍟嗗苟鍒涘缓瀹氭爣" />
- <br />
- <a-button v-if="isEvaluating" type="primary" @click="awardForm = { tenderProjectId: projectId, supplierId: undefined!, bidId: undefined!, awardNo: '' }; awardFormVisible = true">
- <template #icon><IconifyIcon icon="ant-design:plus-outlined" /></template>
- 鍒涘缓瀹氭爣
- </a-button>
- </div>
- </template>
- </a-tab-pane>
- </a-tabs>
- </a-card>
- </div>
-
- <!-- ========== 寮圭獥 ========== -->
-
- <!-- 鐗╂枡琛ㄥ崟 -->
- <a-modal v-model:open="materialFormVisible" :title="materialForm.id ? '缂栬緫鐗╂枡' : '娣诲姞鐗╂枡'" :width="560" @ok="handleSaveMaterial">
- <a-form layout="vertical" class="mt-4">
- <a-form-item label="MDM鐗╂枡" required>
- <MdmItemSelect
- v-model:model-value="materialForm.productId"
- :label="materialForm.productName"
- placeholder="璇烽�夋嫨MDM鐗╂枡"
- @change="onMaterialSelect"
- />
- </a-form-item>
- <a-row :gutter="12">
- <a-col :span="12">
- <a-form-item label="鐗╂枡鍚嶇О" required><a-input v-model:value="materialForm.productName" placeholder="鑷姩甯﹀叆" /></a-form-item>
- </a-col>
- <a-col :span="12">
- <a-form-item label="瑙勬牸鍨嬪彿"><a-input v-model:value="materialForm.productSpec" placeholder="鑷姩甯﹀叆" /></a-form-item>
- </a-col>
- </a-row>
- <a-row :gutter="12">
- <a-col :span="8">
- <a-form-item label="鍗曚綅"><a-input v-model:value="materialForm.unit" placeholder="鑷姩甯﹀叆" /></a-form-item>
- </a-col>
- <a-col :span="8">
- <a-form-item label="鏁伴噺" required><a-input-number v-model:value="materialForm.quantity" :min="0" class="!w-full" placeholder="鏁伴噺" /></a-form-item>
- </a-col>
- <a-col :span="8">
- <a-form-item label="棰勪及鍗曚环"><a-input-number v-model:value="materialForm.estimatedPrice" :min="0" class="!w-full" placeholder="鍗曚环" /></a-form-item>
- </a-col>
- </a-row>
- <a-form-item label="鎶�鏈姹�">
- <a-textarea v-model:value="materialForm.techRequirement" placeholder="濡傦細绗﹀悎GB/T鏍囧噯" :rows="2" />
- </a-form-item>
- </a-form>
- </a-modal>
-
- <!-- 鎶曟爣琛ㄥ崟 -->
- <a-modal v-model:open="bidFormVisible" title="鏂板鎶曟爣" :width="460" @ok="handleCreateBid">
- <a-form layout="vertical" class="mt-4">
- <a-form-item label="鎶曟爣缂栧彿" required><a-input v-model:value="bidForm.bidNo" placeholder="濡� BID2024010001" /></a-form-item>
- <a-form-item label="渚涘簲鍟�" required>
- <a-select v-model:value="bidForm.supplierId" show-search placeholder="鎼滅储骞堕�夋嫨渚涘簲鍟�" :filter-option="filterOption">
- <a-select-option v-for="s in supplierList" :key="s.id" :value="s.id" :label="s.name">{{ s.name }}</a-select-option>
- </a-select>
- </a-form-item>
- <a-form-item label="鎶曟爣鎬婚噾棰�">
- <div class="text-xs text-gray-400 leading-5">
- 鍙殏涓嶅~锛氭姤浠锋槑缁嗗綍瀹屽悗锛屽湪銆屾姤浠风鐞嗐�嶉〉鎸夋姤浠峰悎璁¤嚜鍔ㄥ甫鍑恒�佸啀浜哄伐寰皟淇濆瓨銆�
- </div>
- </a-form-item>
- </a-form>
- </a-modal>
-
- <!-- 鎶ヤ环琛ㄥ崟 -->
- <a-modal v-model:open="quoteFormVisible" :title="quoteForm.id ? '缂栬緫鎶ヤ环' : '鏂板鎶ヤ环'" :width="560" @ok="handleSaveQuote">
- <a-form layout="vertical" class="mt-4">
- <a-form-item label="鎷涙爣鐗╂枡" required>
- <a-select v-model:value="quoteForm.tenderMaterialId" show-search placeholder="鎼滅储骞堕�夋嫨鎷涙爣鐗╂枡" :filter-option="filterOption">
- <a-select-option v-for="m in availableMaterials" :key="m.id" :value="m.id" :label="m.productName">{{ m.productCode }} - {{ m.productName }}</a-select-option>
- </a-select>
- </a-form-item>
- <a-row :gutter="12">
- <a-col :span="8">
- <a-form-item label="鎶ヤ环鍗曚环" required><a-input-number v-model:value="quoteForm.quotePrice" :min="0" class="!w-full" placeholder="鎶ヤ环"><template #addonAfter>鍏�</template></a-input-number></a-form-item>
- </a-col>
- <a-col :span="8">
- <a-form-item label="绋庣巼(%)"><a-input-number v-model:value="quoteForm.taxRate" :min="0" :max="100" class="!w-full" placeholder="濡� 13" /></a-form-item>
- </a-col>
- <a-col :span="8">
- <a-form-item label="浜ゆ湡(澶�)"><a-input-number v-model:value="quoteForm.deliveryCycle" :min="0" class="!w-full" placeholder="澶╂暟" /></a-form-item>
- </a-col>
- </a-row>
- <a-row :gutter="12">
- <a-col :span="12">
- <a-form-item label="浠樻鏉′欢"><a-input v-model:value="quoteForm.paymentTerms" placeholder="濡傦細璐у埌30澶╀粯娆�" /></a-form-item>
- </a-col>
- <a-col :span="12">
- <a-form-item label="璐ㄤ繚鏈�(鏈�)"><a-input-number v-model:value="quoteForm.warrantyPeriod" :min="0" class="!w-full" placeholder="鏈堟暟" /></a-form-item>
- </a-col>
- </a-row>
- <a-form-item label="澶囨敞"><a-textarea v-model:value="quoteForm.remark" placeholder="濡傚惈杩愯垂" :rows="2" /></a-form-item>
- </a-form>
- </a-modal>
-
- <!-- 璇勬爣琛ㄥ崟 -->
- <a-modal v-model:open="evalFormVisible" :title="evalForm.id ? '缂栬緫璇勬爣' : '鏂板璇勬爣'" :width="600" @ok="handleCreateEvaluation">
- <a-form layout="vertical" class="mt-4">
- <a-row :gutter="12">
- <a-col :span="12">
- <a-form-item label="鎶曟爣" required>
- <a-select v-model:value="evalForm.bidId" show-search placeholder="閫夋嫨鎶曟爣" :filter-option="filterOption"
- @change="(val: number) => { const b = bidList.find(i => i.id === val); if (b) { evalForm.supplierId = b.supplierId; evalForm.supplierName = b.supplierName; } }">
- <a-select-option v-for="b in bidList" :key="b.id" :value="b.id" :label="`${b.bidNo} - ${b.supplierName}`">{{ b.bidNo }} - {{ b.supplierName }}</a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- <a-col :span="12">
- <a-form-item label="渚涘簲鍟�">
- <a-select v-model:value="evalForm.supplierId" show-search placeholder="閫夋嫨渚涘簲鍟�" :filter-option="filterOption">
- <a-select-option v-for="s in supplierList" :key="s.id" :value="s.id" :label="s.name">{{ s.name }}</a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- </a-row>
- <a-divider class="!my-2">璇勫垎椤癸紙鐧惧垎鍒讹級</a-divider>
- <a-row :gutter="12">
- <a-col :span="12"><a-form-item label="浠锋牸璇勫垎"><a-input-number v-model:value="evalForm.priceScore" :min="0" :max="100" class="!w-full" placeholder="0-100" /></a-form-item></a-col>
- <a-col :span="12"><a-form-item label="鎶�鏈瘎鍒�"><a-input-number v-model:value="evalForm.techScore" :min="0" :max="100" class="!w-full" placeholder="0-100" /></a-form-item></a-col>
- <a-col :span="12"><a-form-item label="浜や粯璇勫垎"><a-input-number v-model:value="evalForm.deliveryScore" :min="0" :max="100" class="!w-full" placeholder="0-100" /></a-form-item></a-col>
- <a-col :span="12"><a-form-item label="鏈嶅姟璇勫垎"><a-input-number v-model:value="evalForm.serviceScore" :min="0" :max="100" class="!w-full" placeholder="0-100" /></a-form-item></a-col>
- </a-row>
- <a-divider class="!my-2" />
- <a-row :gutter="12">
- <a-col :span="12"><a-form-item label="璇勫"><a-input v-model:value="evalForm.evaluatorName" placeholder="璇勫濮撳悕" /></a-form-item></a-col>
- </a-row>
- <a-form-item label="璇勬爣鎰忚"><a-textarea v-model:value="evalForm.evaluationOpinion" placeholder="渚涘簲鍟嗙殑鎶�鏈柟妗堛�佷氦浠樿兘鍔涚瓑缁煎悎璇勪环" :rows="3" /></a-form-item>
- </a-form>
- </a-modal>
-
- <!-- 绠�鏄撴ā寮忥細纭涓爣寮圭獥 -->
- <a-modal v-model:open="confirmModalVisible" title="纭涓爣" :width="460" @ok="handleSimpleConfirm">
- <a-form layout="vertical" class="mt-4">
- <a-form-item label="涓爣鎶曟爣璁板綍" required>
- <a-select
- v-model:value="confirmBidId"
- show-search
- placeholder="閫夋嫨涓爣鐨勬姇鏍囪褰�"
- :filter-option="filterOption"
- >
- <a-select-option
- v-for="b in bidList.filter((i) => i.bidStatus !== BID_STATUS.WITHDRAWN)"
- :key="b.id"
- :value="b.id"
- :label="`${b.supplierName} - ${b.bidNo}`"
- >
- {{ b.supplierName }} - {{ b.bidNo }} (楼{{ b.bidTotalAmount?.toLocaleString?.() ?? b.bidTotalAmount }})
- </a-select-option>
- </a-select>
- </a-form-item>
- <div class="text-gray-400 text-xs">
- 纭鍚庡皢鑷姩鐢熸垚閲囪喘璁㈠崟锛岃鎿嶄綔涓嶅彲鎾ら攢銆�
- </div>
- </a-form>
- </a-modal>
-
- <!-- 瀹氭爣琛ㄥ崟 -->
- <a-modal v-model:open="awardFormVisible" title="鍒涘缓瀹氭爣" :width="500" @ok="handleCreateAward">
- <a-form layout="vertical" class="mt-4">
- <a-form-item label="瀹氭爣缂栧彿" required><a-input v-model:value="awardForm.awardNo" placeholder="濡� AWARD2024010001" /></a-form-item>
- <a-row :gutter="12">
- <a-col :span="12">
- <a-form-item label="渚涘簲鍟�" required>
- <a-select v-model:value="awardForm.supplierId" show-search placeholder="閫夋嫨渚涘簲鍟�" :filter-option="filterOption" @change="onAwardSupplierChange">
- <a-select-option v-for="s in bidSuppliers" :key="s.id" :value="s.id" :label="s.name">{{ s.name }}</a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- <a-col :span="12">
- <a-form-item label="鎶曟爣" required>
- <a-select v-model:value="awardForm.bidId" show-search placeholder="閫夋嫨鎶曟爣" :filter-option="filterOption" :disabled="!awardForm.supplierId" @change="onAwardBidChange">
- <a-select-option v-for="b in activeBids" :key="b.id" :value="b.id" :label="`${b.bidNo} - ${b.supplierName}`">{{ b.bidNo }} - {{ b.supplierName }}</a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- </a-row>
- <a-form-item label="瀹氭爣閲戦" required>
- <a-input-number v-model:value="awardForm.awardAmount" :min="0" class="!w-full" placeholder="瀹氭爣閲戦"><template #addonAfter>鍏�</template></a-input-number>
- </a-form-item>
- <a-form-item label="澶囨敞"><a-textarea v-model:value="awardForm.remark" placeholder="濡傦細缁煎悎璇勬爣绗竴鍚�" :rows="2" /></a-form-item>
- </a-form>
- </a-modal>
- </template>
- </Page>
-</template>
\ No newline at end of file
diff --git a/src/views/srm/tender/index.vue b/src/views/srm/tender/index.vue
deleted file mode 100644
index 44f6ed7..0000000
--- a/src/views/srm/tender/index.vue
+++ /dev/null
@@ -1,322 +0,0 @@
-<script lang="ts" setup>
-import type { VxeTableGridOptions } from '#/adapter/vxe-table';
-import type { SrmTenderApi } from '#/api/srm/tender';
-
-import { Page, useVbenModal } from '@vben/common-ui';
-
-import { message, Select } from 'ant-design-vue';
-import { ref } from 'vue';
-import { useRouter } from 'vue-router';
-
-import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
-import {
- closeTender,
- confirmTenderProject,
- deleteTenderProject,
- generatePurchaseOrder,
- getBidListByProject,
- getTenderProjectPage,
- publishTender,
- startBidding,
- startEvaluation,
- startPriceComparing,
-} from '#/api/srm/tender';
-import { $t } from '#/locales';
-
-import { useGridColumns, useGridFormSchema } from './data';
-import TenderForm from './modules/form.vue';
-import { BIDDING_MODE, TENDER_STATUS } from '../enums';
-
-defineOptions({ name: 'SrmTender' });
-
-const router = useRouter();
-
-function handleDetail(row: SrmTenderApi.TenderProjectVO) {
- router.push({ path: '/srm/tender/detail', query: { id: row.id } });
-}
-
-function handleRefresh() {
- gridApi.query();
-}
-
-function handleCreate() {
- formModalApi.setData(null).open();
-}
-
-function handleEdit(row: SrmTenderApi.TenderProjectVO) {
- formModalApi.setData(row).open();
-}
-
-async function handleDelete(row: SrmTenderApi.TenderProjectVO) {
- const hideLoading = message.loading({
- content: $t('ui.actionMessage.deleting', [row.tenderName]),
- duration: 0,
- });
- try {
- await deleteTenderProject(row.id!);
- message.success($t('ui.actionMessage.deleteSuccess', [row.tenderName]));
- handleRefresh();
- } finally {
- hideLoading();
- }
-}
-
-async function handlePublish(row: SrmTenderApi.TenderProjectVO) {
- await publishTender(row.id!);
- message.success('鍙戝竷鎴愬姛');
- handleRefresh();
-}
-
-async function handleStartBidding(row: SrmTenderApi.TenderProjectVO) {
- await startBidding(row.id!);
- message.success('宸插紑濮嬫姇鏍�');
- handleRefresh();
-}
-
-async function handleStartEvaluation(row: SrmTenderApi.TenderProjectVO) {
- await startEvaluation(row.id!);
- message.success('宸插紑濮嬭瘎鏍�');
- handleRefresh();
-}
-
-async function handleClose(row: SrmTenderApi.TenderProjectVO) {
- await closeTender(row.id!);
- message.success('宸插叧闂�');
- handleRefresh();
-}
-
-async function handleGeneratePurchaseOrder(row: SrmTenderApi.TenderProjectVO) {
- if (!row.awardId) return;
- await generatePurchaseOrder(row.awardId);
- message.success('閲囪喘璁㈠崟宸茬敓鎴�');
- handleRefresh();
-}
-
-async function handleStartPriceComparing(row: SrmTenderApi.TenderProjectVO) {
- await startPriceComparing(row.id!);
- message.success('宸插紑濮嬫瘮浠�');
- handleRefresh();
-}
-
-// 纭涓爣鐩稿叧
-const confirmTarget = ref<SrmTenderApi.TenderProjectVO | null>(null);
-const confirmBidId = ref<number>();
-const confirmBidOptions = ref<{ label: string; value: number }[]>([]);
-const confirmLoading = ref(false);
-
-async function openConfirmModal(row: SrmTenderApi.TenderProjectVO) {
- confirmTarget.value = row;
- confirmBidId.value = undefined;
- confirmLoading.value = true;
- try {
- const bids = await getBidListByProject(row.id!);
- confirmBidOptions.value = (bids || []).map((b: any) => ({
- label: `${b.supplierName} - ${b.bidNo} (楼${b.bidTotalAmount ?? 0})`,
- value: b.id!,
- }));
- } finally {
- confirmLoading.value = false;
- }
- confirmModalApi.open();
-}
-
-async function handleConfirmBid() {
- if (!confirmTarget.value || !confirmBidId.value) {
- message.warning('璇烽�夋嫨涓爣渚涘簲鍟嗙殑鎶曟爣璁板綍');
- return;
- }
- confirmLoading.value = true;
- try {
- await confirmTenderProject({
- id: confirmTarget.value.id!,
- bidId: confirmBidId.value,
- });
- message.success('纭涓爣鎴愬姛锛岄噰璐鍗曞凡鑷姩鐢熸垚');
- confirmModalApi.close();
- handleRefresh();
- } finally {
- confirmLoading.value = false;
- }
-}
-
-const [ConfirmModal, confirmModalApi] = useVbenModal({
- title: '纭涓爣',
- onConfirm: handleConfirmBid,
- onOpenChange(isOpen: boolean) {
- if (!isOpen) {
- confirmTarget.value = null;
- confirmBidId.value = undefined;
- }
- },
-});
-
-const [FormModal, formModalApi] = useVbenModal({
- connectedComponent: TenderForm,
- destroyOnClose: true,
-});
-
-const [Grid, gridApi] = useVbenVxeGrid({
- formOptions: {
- schema: useGridFormSchema(),
- },
- gridOptions: {
- columns: useGridColumns(),
- height: 'auto',
- keepSource: true,
- proxyConfig: {
- ajax: {
- query: async ({ page }, formValues) => {
- return await getTenderProjectPage({
- pageNo: page.currentPage,
- pageSize: page.pageSize,
- ...formValues,
- });
- },
- },
- },
- rowConfig: { keyField: 'id', isHover: true },
- toolbarConfig: { refresh: true, search: true },
- } as VxeTableGridOptions<SrmTenderApi.TenderProjectVO>,
-});
-</script>
-
-<template>
- <Page auto-content-height>
- <FormModal @success="handleRefresh" />
- <ConfirmModal>
- <div class="flex items-center gap-2">
- <span class="font-medium whitespace-nowrap">涓爣鎶曟爣璁板綍锛�</span>
- <Select
- v-model:value="confirmBidId"
- :options="confirmBidOptions"
- :loading="confirmLoading"
- placeholder="璇烽�夋嫨涓爣鐨勬姇鏍囪褰�"
- class="flex-1"
- />
- </div>
- </ConfirmModal>
- <Grid table-title="鎷涙爣椤圭洰鍒楄〃">
- <template #toolbar-tools>
- <TableAction
- :actions="[
- {
- label: $t('ui.actionTitle.create', ['鎷涙爣椤圭洰']),
- type: 'primary',
- icon: ACTION_ICON.ADD,
- auth: ['srm:tender-project:create'],
- onClick: handleCreate,
- },
- ]"
- />
- </template>
- <template #actions="{ row }">
- <TableAction
- :actions="[
- {
- label: '璇︽儏',
- type: 'link',
- icon: ACTION_ICON.EDIT,
- onClick: handleDetail.bind(null, row),
- },
- {
- label: '鍙戝竷',
- type: 'link',
- auth: ['srm:tender-project:update'],
- ifShow: row.tenderStatus === TENDER_STATUS.DRAFT && row.biddingMode !== BIDDING_MODE.SIMPLE,
- popConfirm: {
- title: '纭瑕佸彂甯冭椤圭洰鍚楋紵鍙戝竷鍚庢棤娉曚慨鏀广��',
- confirm: handlePublish.bind(null, row),
- },
- },
- {
- label: $t('common.edit'),
- type: 'link',
- icon: ACTION_ICON.EDIT,
- auth: ['srm:tender-project:update'],
- ifShow: row.tenderStatus === TENDER_STATUS.DRAFT,
- onClick: handleEdit.bind(null, row),
- },
- {
- label: '缂栬緫淇℃伅',
- type: 'link',
- icon: ACTION_ICON.EDIT,
- auth: ['srm:tender-project:update'],
- ifShow: (row.tenderStatus === TENDER_STATUS.PUBLISHED || row.tenderStatus === TENDER_STATUS.BIDDING) && row.biddingMode !== BIDDING_MODE.SIMPLE,
- onClick: handleEdit.bind(null, row),
- },
- {
- label: $t('common.delete'),
- type: 'link',
- danger: true,
- icon: ACTION_ICON.DELETE,
- auth: ['srm:tender-project:delete'],
- ifShow: row.tenderStatus === TENDER_STATUS.DRAFT,
- popConfirm: {
- title: $t('ui.actionMessage.deleteConfirm', [row.tenderName]),
- confirm: handleDelete.bind(null, row),
- },
- },
- {
- label: '寮�濮嬫姇鏍�',
- type: 'link',
- auth: ['srm:tender-project:update'],
- ifShow: row.tenderStatus === TENDER_STATUS.PUBLISHED && row.biddingMode !== BIDDING_MODE.SIMPLE,
- popConfirm: {
- title: '纭瑕佸紑濮嬫姇鏍囧悧锛�',
- confirm: handleStartBidding.bind(null, row),
- },
- },
- {
- label: '鍏抽棴',
- type: 'link',
- danger: true,
- auth: ['srm:tender-project:update'],
- ifShow: row.tenderStatus === TENDER_STATUS.PUBLISHED || row.tenderStatus === TENDER_STATUS.BIDDING || row.tenderStatus === TENDER_STATUS.EVALUATING || row.tenderStatus === TENDER_STATUS.PRICE_COMPARING,
- popConfirm: {
- title: '纭瑕佸叧闂椤圭洰鍚楋紵',
- confirm: handleClose.bind(null, row),
- },
- },
- {
- label: '寮�濮嬭瘎鏍�',
- type: 'link',
- auth: ['srm:tender-project:update'],
- ifShow: row.tenderStatus === TENDER_STATUS.BIDDING && row.biddingMode !== BIDDING_MODE.SIMPLE,
- popConfirm: {
- title: '纭瑕佸紑濮嬭瘎鏍囧悧锛�',
- confirm: handleStartEvaluation.bind(null, row),
- },
- },
- {
- label: '鐢熸垚閲囪喘璁㈠崟',
- type: 'link',
- auth: ['srm:bid-award:update'],
- ifShow: !!row.awardId && !row.purchaseOrderNo && row.biddingMode !== BIDDING_MODE.SIMPLE,
- popConfirm: {
- title: '纭瑕佺敓鎴愰噰璐鍗曞悧锛�',
- confirm: handleGeneratePurchaseOrder.bind(null, row),
- },
- },
- {
- label: '寮�濮嬫瘮浠�',
- type: 'link',
- auth: ['srm:tender-project:update'],
- ifShow: row.biddingMode === BIDDING_MODE.SIMPLE && row.tenderStatus === TENDER_STATUS.DRAFT,
- popConfirm: {
- title: '纭瑕佸紑濮嬫瘮浠峰悧锛�',
- confirm: handleStartPriceComparing.bind(null, row),
- },
- },
- {
- label: '纭涓爣',
- type: 'link',
- auth: ['srm:tender-project:update'],
- ifShow: row.biddingMode === BIDDING_MODE.SIMPLE && row.tenderStatus === TENDER_STATUS.PRICE_COMPARING,
- onClick: openConfirmModal.bind(null, row),
- },
- ]"
- />
- </template>
- </Grid>
- </Page>
-</template>
diff --git a/src/views/srm/tender/modules/form.vue b/src/views/srm/tender/modules/form.vue
deleted file mode 100644
index 652d017..0000000
--- a/src/views/srm/tender/modules/form.vue
+++ /dev/null
@@ -1,123 +0,0 @@
-<script lang="ts" setup>
-import type { SrmTenderApi } from '#/api/srm/tender';
-
-import { computed, ref } from 'vue';
-
-import { useVbenModal } from '@vben/common-ui';
-
-import { message } from 'ant-design-vue';
-
-import { useVbenForm } from '#/adapter/form';
-import {
- createTenderProject,
- getTenderProject,
- updateTenderProject,
- updateTenderProjectPartial,
-} from '#/api/srm/tender';
-import { getTenderConfig } from '#/api/srm/tender-config';
-import { $t } from '#/locales';
-
-import { TENDER_STATUS } from '../../enums';
-import { useFormSchema } from '../data';
-
-const emit = defineEmits(['success']);
-const formData = ref<SrmTenderApi.TenderProjectVO>();
-const isPartial = computed(() => {
- const data = formData.value;
- return data?.id && data.tenderStatus !== undefined && data.tenderStatus !== TENDER_STATUS.DRAFT;
-});
-const getTitle = computed(() => {
- if (isPartial.value) return '缂栬緫鎷涙爣淇℃伅';
- return formData.value?.id
- ? $t('ui.actionTitle.edit', ['鎷涙爣椤圭洰'])
- : $t('ui.actionTitle.create', ['鎷涙爣椤圭洰']);
-});
-
-const [Form, formApi] = useVbenForm({
- commonConfig: {
- componentProps: { class: 'w-full' },
- labelWidth: 120,
- },
- wrapperClass: 'grid-cols-2',
- layout: 'horizontal',
- schema: useFormSchema(),
- showDefaultActions: false,
-});
-
-const [Modal, modalApi] = useVbenModal({
- async onConfirm() {
- const { valid } = await formApi.validate();
- if (!valid) {
- return;
- }
- modalApi.lock();
- const data = (await formApi.getValues()) as SrmTenderApi.TenderProjectVO;
- try {
- if (isPartial.value) {
- await updateTenderProjectPartial({
- id: data.id!,
- tenderDesc: data.tenderDesc,
- qualificationRequirements: data.qualificationRequirements,
- blobIds: data.blobIds,
- });
- } else {
- await (formData.value?.id
- ? updateTenderProject(data)
- : createTenderProject(data));
- }
- await modalApi.close();
- emit('success');
- message.success($t('ui.actionMessage.operationSuccess'));
- } finally {
- modalApi.unlock();
- }
- },
- async onOpenChange(isOpen: boolean) {
- if (!isOpen) {
- formData.value = undefined;
- return;
- }
- const data = modalApi.getData<SrmTenderApi.TenderProjectVO>();
- if (!data || !data.id) {
- // 鏂板缓妯″紡锛氬姞杞介厤缃幏鍙栭粯璁ゆ嫑鎶曟爣妯″紡
- try {
- const config = await getTenderConfig();
- if (config?.defaultBiddingMode) {
- await formApi.setFieldValue('biddingMode', config.defaultBiddingMode);
- }
- } catch {
- // 閰嶇疆鍔犺浇澶辫触锛屼娇鐢ㄩ粯璁ゅ��
- }
- return;
- }
- modalApi.lock();
- try {
- formData.value = await getTenderProject(data.id);
- if (formData.value?.attachmentList?.length) {
- // 杞负涓婁紶缁勪欢鐨勬枃浠跺璞★紱鎻愪氦鏃� formApi 浼氭寜 valueKey 鎻愬彇闄勪欢 ID
- (formData.value as Record<string, unknown>).blobIds =
- formData.value.attachmentList.map((item) => ({
- uid: String(item.id),
- name: item.name || '',
- url: item.url || '',
- status: 'done',
- id: item.id,
- }));
- }
- const partial = formData.value.tenderStatus !== undefined
- && formData.value.tenderStatus !== TENDER_STATUS.DRAFT;
- await formApi.setValues({ ...formData.value, _partial: partial || undefined });
- } finally {
- modalApi.unlock();
- }
- },
-});
-
-defineExpose({ modalApi });
-</script>
-
-<template>
- <Modal :title="getTitle" class="w-1/2">
- <Form class="mx-4" />
- </Modal>
-</template>
--
Gitblit v1.9.3