feat(pl): 增加合同与证件用量视图以追踪共享额度及段产品使用。
This commit is contained in:
1 parent
ce6f102dae
commit
0d1d264bc7
18 files changed
+1017
-16
No files matched your search
@@ -44,11 +44,13 @@ export interface CertBody {
|
||||
routeText?: string | null
|
||||
consigneeName?: string | null
|
||||
applicantName?: string | null
|
||||
contractBindings?: CertificateContractBinding[]
|
||||
purchaseRefs?: PurchaseReference[]
|
||||
}
|
||||
export interface QuotaCert extends Omit<CertBody, 'status'> {
|
||||
id: string
|
||||
status: 'draft' | 'active' | 'suspended' | 'void'
|
||||
bindingsEditable?: boolean
|
||||
revision: number
|
||||
reservedQty: string | number
|
||||
usedQty: string | number
|
||||
@@ -268,3 +270,108 @@ export const quotaAdjustmentApi = {
|
||||
total: (kind: CertType, id: string, body: CertTotalAdjustment) =>
|
||||
request.post(`${base}/${kind}/${id}/total-adjust`, body)
|
||||
}
|
||||
|
||||
export type QuotaQuantity = string | number
|
||||
export interface CertificateContractBinding {
|
||||
id?: string
|
||||
contractId: string
|
||||
linkStatus?: 'active' | 'inactive'
|
||||
products: ScopeProduct[]
|
||||
scopeRevision?: number
|
||||
remark?: string | null
|
||||
orderNum?: number | null
|
||||
}
|
||||
export interface StatisticsPage<T> {
|
||||
list: T[]
|
||||
total: number
|
||||
page: number
|
||||
pageSize: number
|
||||
}
|
||||
export interface ContractStatisticsSummary extends ContractOption {
|
||||
certCount: number
|
||||
}
|
||||
export interface CertificateStatisticsSummary {
|
||||
id: string
|
||||
certId: string
|
||||
certType: CertType
|
||||
certNo: string
|
||||
productNameOnCert: string
|
||||
quantityUnit: string
|
||||
totalQty: QuotaQuantity
|
||||
reservedQty: QuotaQuantity
|
||||
usedQty: QuotaQuantity
|
||||
availableQty: QuotaQuantity
|
||||
status: string
|
||||
validFrom: string | null
|
||||
validTo: string | null
|
||||
}
|
||||
export interface StatisticsProduct {
|
||||
id: string
|
||||
contractProductId: string
|
||||
productId: string
|
||||
productName: string
|
||||
model: string | null
|
||||
unit: string | null
|
||||
bindingId: string | null
|
||||
scopeId: string | null
|
||||
scopeStatus: string | null
|
||||
linkStatus: string | null
|
||||
reservedQty: QuotaQuantity
|
||||
usedQty: QuotaQuantity
|
||||
}
|
||||
export interface StatisticsBinding {
|
||||
bindingId: string | null
|
||||
linkStatus: string | null
|
||||
scopeRevision: number | null
|
||||
contractReservedQty: QuotaQuantity
|
||||
contractUsedQty: QuotaQuantity
|
||||
products: StatisticsProduct[]
|
||||
}
|
||||
export interface ContractStatistics extends ContractOption {
|
||||
certificates: (CertificateStatisticsSummary & StatisticsBinding & { productNames: string[] })[]
|
||||
}
|
||||
export interface StatisticsUsageItem {
|
||||
id: string
|
||||
usageId: string
|
||||
certType: CertType
|
||||
certId: string
|
||||
planId: string
|
||||
planNo: string
|
||||
stopType: string
|
||||
stopId: string
|
||||
stopProductId: string
|
||||
planProductId: string
|
||||
contractId: string
|
||||
contractProductId: string
|
||||
productName: string
|
||||
quantityUnit: string
|
||||
reservedQty: QuotaQuantity
|
||||
usedQty: QuotaQuantity
|
||||
itemStatus: string
|
||||
}
|
||||
export interface CertificateStatistics extends CertificateStatisticsSummary {
|
||||
contracts: (ContractOption & StatisticsBinding)[]
|
||||
usageItems: StatisticsUsageItem[]
|
||||
openingUsedQty: QuotaQuantity
|
||||
unattributedUsedQty: QuotaQuantity
|
||||
}
|
||||
export interface StatisticsQuery {
|
||||
keyword?: string
|
||||
page?: number
|
||||
pageSize?: number
|
||||
certType?: CertType
|
||||
}
|
||||
export const quotaStatisticsApi = {
|
||||
contracts: (params: StatisticsQuery) =>
|
||||
request
|
||||
.get(`${base}/statistics/contracts`, { params })
|
||||
.then(pickBxData<StatisticsPage<ContractStatisticsSummary>>),
|
||||
certificates: (params: StatisticsQuery) =>
|
||||
request
|
||||
.get(`${base}/statistics/certificates`, { params })
|
||||
.then(pickBxData<StatisticsPage<CertificateStatisticsSummary>>),
|
||||
contract: (id: string) =>
|
||||
request.get(`${base}/contracts/${id}/statistics`).then(pickBxData<ContractStatistics>),
|
||||
certificate: (kind: CertType, id: string) =>
|
||||
request.get(`${base}/${kind}/${id}/statistics`).then(pickBxData<CertificateStatistics>)
|
||||
}
|
||||
Reference in new issue
Block a user