提交
This commit is contained in:
1 parent
c3be9d1dce
commit
299609706c
328 files changed
+144899
-13873
No files matched your search
@@ -115,8 +115,11 @@ export const advanceApi = {
|
||||
}
|
||||
|
||||
export const reimburseApi = {
|
||||
generateTitle() {
|
||||
return bxRequest.get('/reimburses/generate-title')
|
||||
generateTitle(reimburseDate?: string, excludeApplyId?: BxId) {
|
||||
const params: Record<string, string> = {}
|
||||
if (reimburseDate) params.reimburseDate = reimburseDate
|
||||
if (excludeApplyId) params.excludeApplyId = String(excludeApplyId)
|
||||
return bxRequest.get('/reimburses/generate-title', { params })
|
||||
},
|
||||
list(params: {
|
||||
page: number
|
||||
|
||||
@@ -60,6 +60,8 @@ export interface ContractProductForm {
|
||||
description?: string
|
||||
sort?: number
|
||||
remark?: string
|
||||
isToxic?: number
|
||||
isExplosive?: number
|
||||
priceTiers?: ContractProductPriceTierForm[]
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,649 @@
|
||||
/**
|
||||
* 运输计划管理 API
|
||||
*/
|
||||
import request from '@/utils/http/bx'
|
||||
|
||||
// =============================================================================
|
||||
// 基础数据 API
|
||||
// =============================================================================
|
||||
|
||||
// 承运商
|
||||
export interface Carrier {
|
||||
id: string
|
||||
carrierName: string
|
||||
contactName?: string
|
||||
contactPhone?: string
|
||||
status: string
|
||||
remark?: string
|
||||
createTime: string
|
||||
}
|
||||
|
||||
export interface CarrierQuery {
|
||||
q?: string
|
||||
status?: string
|
||||
}
|
||||
|
||||
export const carrierApi = {
|
||||
list: (params?: CarrierQuery) => request.get<Carrier[]>('/transport/carrier', { params }),
|
||||
get: (id: string) => request.get<Carrier>(`/transport/carrier/${id}`),
|
||||
create: (data: Partial<Carrier>) => request.post<Carrier>('/transport/carrier', data),
|
||||
update: (id: string, data: Partial<Carrier>) => request.put<Carrier>(`/transport/carrier/${id}`, data),
|
||||
delete: (id: string) => request.delete(`/transport/carrier/${id}`)
|
||||
}
|
||||
|
||||
// 证书行(嵌套保存)
|
||||
export interface CertRow {
|
||||
certId?: string
|
||||
certName: string
|
||||
certNo?: string
|
||||
expireDate?: string
|
||||
remindDays?: number
|
||||
attachmentUrls?: string
|
||||
}
|
||||
|
||||
export interface CertRead extends CertRow {
|
||||
id: string
|
||||
ownerType: string
|
||||
ownerId: string
|
||||
status: string
|
||||
createTime?: string
|
||||
}
|
||||
|
||||
// 车辆-人员关联行
|
||||
export interface VehiclePersonnelRow {
|
||||
personnelId?: string
|
||||
personnelName: string
|
||||
phoneNo?: string
|
||||
age?: number | null
|
||||
role: string
|
||||
isDefault?: number
|
||||
remark?: string
|
||||
}
|
||||
|
||||
// 车辆
|
||||
export interface Vehicle {
|
||||
id: string
|
||||
vehicleType: string
|
||||
carrierId?: string
|
||||
carrierName?: string
|
||||
licensePlate: string
|
||||
defaultDriverId?: string
|
||||
defaultDriverName?: string
|
||||
personnelSummary?: string
|
||||
loadCapacity?: number
|
||||
vehicleStatus: string
|
||||
remark?: string
|
||||
createTime: string
|
||||
}
|
||||
|
||||
export interface VehicleDetail extends Vehicle {
|
||||
personnelList: VehiclePersonnelRow[]
|
||||
certList: CertRead[]
|
||||
}
|
||||
|
||||
export interface VehiclePayload {
|
||||
vehicleType: string
|
||||
carrierId?: string
|
||||
carrierName?: string
|
||||
licensePlate: string
|
||||
loadCapacity?: number | null
|
||||
vehicleStatus: string
|
||||
remark?: string
|
||||
personnelList?: VehiclePersonnelRow[]
|
||||
certList?: CertRow[]
|
||||
}
|
||||
|
||||
export interface VehicleQuery {
|
||||
q?: string
|
||||
vehicleType?: string
|
||||
carrierId?: string
|
||||
vehicleStatus?: string
|
||||
}
|
||||
|
||||
export const vehicleApi = {
|
||||
list: (params?: VehicleQuery) => request.get<Vehicle[]>('/transport/vehicle', { params }),
|
||||
get: (id: string) => request.get<VehicleDetail>(`/transport/vehicle/${id}`),
|
||||
create: (data: VehiclePayload) => request.post<VehicleDetail>('/transport/vehicle', data),
|
||||
update: (id: string, data: Partial<VehiclePayload>) =>
|
||||
request.put<VehicleDetail>(`/transport/vehicle/${id}`, data),
|
||||
delete: (id: string) => request.delete(`/transport/vehicle/${id}`)
|
||||
}
|
||||
|
||||
// 人员
|
||||
export interface Personnel {
|
||||
id: string
|
||||
personnelName: string
|
||||
phoneNo?: string
|
||||
age?: number
|
||||
idCardNo?: string
|
||||
status: string
|
||||
remark?: string
|
||||
nearestExpireDate?: string
|
||||
createTime: string
|
||||
}
|
||||
|
||||
export interface PersonnelDetail extends Personnel {
|
||||
certList: CertRead[]
|
||||
}
|
||||
|
||||
export interface PersonnelPayload {
|
||||
personnelName: string
|
||||
phoneNo?: string
|
||||
age?: number | null
|
||||
idCardNo?: string
|
||||
status: string
|
||||
remark?: string
|
||||
certList?: CertRow[]
|
||||
}
|
||||
|
||||
export interface PersonnelQuery {
|
||||
q?: string
|
||||
status?: string
|
||||
}
|
||||
|
||||
export const personnelApi = {
|
||||
list: (params?: PersonnelQuery) => request.get<Personnel[]>('/transport/personnel', { params }),
|
||||
get: (id: string) => request.get<PersonnelDetail>(`/transport/personnel/${id}`),
|
||||
create: (data: PersonnelPayload) => request.post<PersonnelDetail>('/transport/personnel', data),
|
||||
update: (id: string, data: Partial<PersonnelPayload>) =>
|
||||
request.put<PersonnelDetail>(`/transport/personnel/${id}`, data),
|
||||
delete: (id: string) => request.delete(`/transport/personnel/${id}`)
|
||||
}
|
||||
|
||||
// 司机(兼容旧 API,映射至 personnel)
|
||||
export interface Driver {
|
||||
id: string
|
||||
driverName: string
|
||||
phoneNo?: string
|
||||
idCardNo?: string
|
||||
drivingLicenseNo?: string
|
||||
drivingLicenseExpire?: string
|
||||
vehicleLicenseNo?: string
|
||||
vehicleLicenseExpire?: string
|
||||
hazmatCertNo?: string
|
||||
hazmatCertExpire?: string
|
||||
remark?: string
|
||||
createTime: string
|
||||
}
|
||||
|
||||
export interface DriverQuery {
|
||||
q?: string
|
||||
}
|
||||
|
||||
function personnelToDriver(p: Personnel): Driver {
|
||||
return {
|
||||
id: p.id,
|
||||
driverName: p.personnelName,
|
||||
phoneNo: p.phoneNo,
|
||||
idCardNo: p.idCardNo,
|
||||
remark: p.remark,
|
||||
createTime: p.createTime
|
||||
}
|
||||
}
|
||||
|
||||
function driverToPersonnelPayload(data: Partial<Driver>): PersonnelPayload {
|
||||
return {
|
||||
personnelName: data.driverName || '',
|
||||
phoneNo: data.phoneNo,
|
||||
idCardNo: data.idCardNo,
|
||||
status: '1',
|
||||
remark: data.remark
|
||||
}
|
||||
}
|
||||
|
||||
export const driverApi = {
|
||||
list: async (params?: DriverQuery) => {
|
||||
const res = await personnelApi.list({ q: params?.q })
|
||||
const rows = (res.data ?? res) as Personnel[]
|
||||
return { ...res, data: rows.map(personnelToDriver) }
|
||||
},
|
||||
get: async (id: string) => {
|
||||
const res = await personnelApi.get(id)
|
||||
const detail = (res.data ?? res) as PersonnelDetail
|
||||
return { ...res, data: personnelToDriver(detail) }
|
||||
},
|
||||
create: async (data: Partial<Driver>) => {
|
||||
const res = await personnelApi.create(driverToPersonnelPayload(data))
|
||||
const detail = (res.data ?? res) as PersonnelDetail
|
||||
return { ...res, data: personnelToDriver(detail) }
|
||||
},
|
||||
update: async (id: string, data: Partial<Driver>) => {
|
||||
const res = await personnelApi.update(id, driverToPersonnelPayload(data))
|
||||
const detail = (res.data ?? res) as PersonnelDetail
|
||||
return { ...res, data: personnelToDriver(detail) }
|
||||
},
|
||||
delete: (id: string) => personnelApi.delete(id)
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// 计划管理 API
|
||||
// =============================================================================
|
||||
|
||||
export interface PlanProduct {
|
||||
id: string
|
||||
planId: string
|
||||
productId: string
|
||||
productNo: string
|
||||
productName: string
|
||||
model?: string
|
||||
unit: string
|
||||
categoryName?: string
|
||||
packageSpec?: string
|
||||
deliveryMethod?: string
|
||||
quantity?: number
|
||||
actualQty?: number
|
||||
taxPrice?: number
|
||||
taxAmount?: number
|
||||
taxSubtotal?: number
|
||||
isExplosive: number
|
||||
isToxic: number
|
||||
purchaseCertUrl?: string
|
||||
transportCertUrl?: string
|
||||
inboundEstimateQty?: number
|
||||
inboundQty?: number
|
||||
inboundPrice?: number
|
||||
inboundAmount?: number
|
||||
outboundEstimateQty?: number
|
||||
outboundQty?: number
|
||||
outboundPrice?: number
|
||||
outboundAmount?: number
|
||||
remark?: string
|
||||
}
|
||||
|
||||
export interface Plan {
|
||||
id: string
|
||||
planNo: string
|
||||
planDate: string
|
||||
belongsCompany: string
|
||||
planType: string
|
||||
followStatus: string
|
||||
transportStatus: string
|
||||
archiveStatus: string
|
||||
completeStatus: string
|
||||
contractId?: string
|
||||
contractNo?: string
|
||||
supplierId?: string
|
||||
supplierName?: string
|
||||
destinationId?: string
|
||||
destinationName?: string
|
||||
customerId?: string
|
||||
customerName?: string
|
||||
contactName?: string
|
||||
contactPhone?: string
|
||||
partyA?: string
|
||||
partyB?: string
|
||||
contractStartDate?: string
|
||||
contractEndDate?: string
|
||||
deliveryMethod?: string
|
||||
settlementMethod?: string
|
||||
hasFreight: number
|
||||
pickupAddress?: string
|
||||
pickupTime?: string
|
||||
pickupNotes?: string
|
||||
destinationAddress?: string
|
||||
deliveryTime?: string
|
||||
destinationNotes?: string
|
||||
vehicleId?: string
|
||||
licensePlate?: string
|
||||
driverId?: string
|
||||
driverName?: string
|
||||
transportId?: string
|
||||
transportNo?: string
|
||||
totalAmount: number
|
||||
freightAmount: number
|
||||
notifyMessage?: string
|
||||
followUserId?: string
|
||||
followUserName?: string
|
||||
remark?: string
|
||||
createTime: string
|
||||
products?: PlanProduct[]
|
||||
}
|
||||
|
||||
export interface PlanQuery {
|
||||
q?: string
|
||||
planNo?: string
|
||||
planType?: string
|
||||
followStatus?: string
|
||||
transportStatus?: string
|
||||
archiveStatus?: string
|
||||
customerName?: string
|
||||
planDateFrom?: string
|
||||
planDateTo?: string
|
||||
page?: number
|
||||
pageSize?: number
|
||||
}
|
||||
|
||||
export interface PlanListResponse {
|
||||
total: number
|
||||
list: Plan[]
|
||||
}
|
||||
|
||||
export interface PlanTransportCreateBlock {
|
||||
vehicleId: string
|
||||
driverId?: string
|
||||
carrierId?: string
|
||||
distanceKm?: number
|
||||
freightType: string
|
||||
transportQty?: number
|
||||
freightPrice?: number
|
||||
freightAmount?: number
|
||||
hasInvoice?: number
|
||||
remark?: string
|
||||
}
|
||||
|
||||
export interface PlanCreateFullPayload {
|
||||
contractId: string
|
||||
planDate: string
|
||||
belongsCompany: string
|
||||
planType: string
|
||||
contractNo?: string
|
||||
supplierId?: string
|
||||
supplierName?: string
|
||||
destinationId?: string
|
||||
destinationName?: string
|
||||
customerId?: string
|
||||
customerName?: string
|
||||
contactName?: string
|
||||
contactPhone?: string
|
||||
partyA?: string
|
||||
partyB?: string
|
||||
contractStartDate?: string
|
||||
contractEndDate?: string
|
||||
deliveryMethod?: string
|
||||
settlementMethod?: string
|
||||
hasFreight: number
|
||||
pickupAddress?: string
|
||||
pickupTime?: string
|
||||
pickupNotes?: string
|
||||
destinationAddress?: string
|
||||
deliveryTime?: string
|
||||
destinationNotes?: string
|
||||
followUserId?: string
|
||||
followUserName?: string
|
||||
remark?: string
|
||||
products: Array<{
|
||||
productId: string
|
||||
productNo: string
|
||||
productName: string
|
||||
model?: string
|
||||
unit: string
|
||||
categoryName?: string
|
||||
packageSpec?: string
|
||||
deliveryMethod?: string
|
||||
quantity?: number
|
||||
actualQty?: number
|
||||
taxPrice?: number
|
||||
taxAmount?: number
|
||||
taxSubtotal?: number
|
||||
remark?: string
|
||||
isExplosive?: number
|
||||
isToxic?: number
|
||||
}>
|
||||
transport?: PlanTransportCreateBlock
|
||||
}
|
||||
|
||||
export type PlanUpdatePayload = Partial<Omit<PlanCreateFullPayload, 'contractId'>>
|
||||
|
||||
export const planApi = {
|
||||
list: (params?: PlanQuery) => request.get<PlanListResponse>('/transport/plan/', { params }),
|
||||
get: (id: string) => request.get<Plan>(`/transport/plan/${id}`),
|
||||
countByContract: (contractIds: string[]) =>
|
||||
request.get<{ counts: Record<string, number> }>('/transport/plan/count-by-contract', {
|
||||
params: { contractIds: contractIds.join(',') }
|
||||
}),
|
||||
create: (data: Partial<Plan>) => request.post<Plan>('/transport/plan/', data),
|
||||
createFull: (data: PlanCreateFullPayload) => request.post<Plan>('/transport/plan/create-full', data),
|
||||
update: (id: string, data: PlanUpdatePayload) => request.put<Plan>(`/transport/plan/${id}`, data),
|
||||
updateProductCerts: (
|
||||
id: string,
|
||||
products: Array<{ id: string; purchaseCertUrl?: string; transportCertUrl?: string }>
|
||||
) => request.patch<Plan>(`/transport/plan/${id}/product-certs`, { products }),
|
||||
cancel: (id: string) => request.post<Plan>(`/transport/plan/${id}/cancel`),
|
||||
getArrangeInfo: (id: string) => request.get<PlanArrangeInfo>(`/transport/plan/${id}/arrange-info`),
|
||||
archive: (id: string) => request.post<Plan>(`/transport/plan/${id}/archive`),
|
||||
delete: (id: string) => request.delete(`/transport/plan/${id}`),
|
||||
createFromContract: (data: { contractId: string; planDate: string; followUserId?: string; followUserName?: string }) =>
|
||||
request.post<Plan>('/transport/plan/create-from-contract', data)
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// 运输管理 API
|
||||
// =============================================================================
|
||||
|
||||
export interface Transport {
|
||||
id: string
|
||||
transportNo: string
|
||||
vehicleId?: string
|
||||
licensePlate?: string
|
||||
driverId?: string
|
||||
driverName?: string
|
||||
driverPhone?: string
|
||||
carrierId?: string
|
||||
carrierName?: string
|
||||
transportMedium?: string
|
||||
startPoint?: string
|
||||
endPoint?: string
|
||||
distanceKm?: number
|
||||
unit?: string
|
||||
transportQty?: number
|
||||
freightPrice?: number
|
||||
freightAmount: number
|
||||
freightType: string
|
||||
hasInvoice: number
|
||||
qrCode?: string
|
||||
qrExpireDate?: string
|
||||
transportStatus: string
|
||||
approvalStatus: string
|
||||
feedbackTime?: string
|
||||
feedbackQty?: number
|
||||
feedbackImages?: string
|
||||
feedbackRemark?: string
|
||||
remark?: string
|
||||
createTime: string
|
||||
}
|
||||
|
||||
export interface TransportArrange {
|
||||
vehicleId: string
|
||||
driverId: string
|
||||
carrierId?: string
|
||||
transportMedium?: string
|
||||
startPoint?: string
|
||||
endPoint?: string
|
||||
distanceKm?: number
|
||||
unit?: string
|
||||
freightType: string
|
||||
freightPrice?: number
|
||||
freightAmount?: number
|
||||
hasInvoice?: number
|
||||
remark?: string
|
||||
generateDibangPlan?: boolean
|
||||
}
|
||||
|
||||
export interface TransportInventoryLink {
|
||||
planProductId: string
|
||||
productName: string
|
||||
dbPurchasePlanId: string
|
||||
dbInventoryId: string
|
||||
batchNo: string
|
||||
planNo: string
|
||||
}
|
||||
|
||||
export interface PlanArrangeInfo {
|
||||
driverUrl?: string
|
||||
licensePlate?: string
|
||||
inventoryRecords?: TransportInventoryLink[]
|
||||
}
|
||||
|
||||
export interface TransportArrangeResult extends Transport {
|
||||
driverAccessToken?: string
|
||||
driverUrl?: string
|
||||
inventoryRecords?: TransportInventoryLink[]
|
||||
}
|
||||
|
||||
export interface TransportQuery {
|
||||
q?: string
|
||||
transportNo?: string
|
||||
transportStatus?: string
|
||||
approvalStatus?: string
|
||||
vehicleId?: string
|
||||
driverId?: string
|
||||
page?: number
|
||||
pageSize?: number
|
||||
}
|
||||
|
||||
export interface TransportListResponse {
|
||||
total: number
|
||||
list: Transport[]
|
||||
}
|
||||
|
||||
export const transportApi = {
|
||||
list: (params?: TransportQuery) => request.get<TransportListResponse>('/transport/order/', { params }),
|
||||
get: (id: string) => request.get<Transport>(`/transport/order/${id}`),
|
||||
create: (data: Partial<Transport> & { planIds?: string[] }) =>
|
||||
request.post<Transport>('/transport/order/', data),
|
||||
arrange: (planId: string, data: TransportArrange) =>
|
||||
request.post<TransportArrangeResult>(`/transport/order/arrange/${planId}`, data),
|
||||
generateQrcode: (id: string, expireDays?: number) =>
|
||||
request.get<{ transportId: string; transportNo: string; qrCode: string; expireDate?: string }>(
|
||||
`/transport/order/${id}/qrcode`,
|
||||
{ params: { expireDays } }
|
||||
),
|
||||
submitApproval: (id: string, approverIds: string[]) =>
|
||||
request.post<Transport>(`/transport/order/${id}/submit-approval`, { approverIds }),
|
||||
scanFeedback: (data: { transportNo: string; verifyCode?: string; feedbackQty?: number; feedbackImages?: string[]; feedbackRemark?: string }) =>
|
||||
request.post('/transport/order/scan/feedback', data),
|
||||
getApprovals: (id: string) => request.get<any[]>(`/transport/order/${id}/approvals`)
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// 运费结算 API
|
||||
// =============================================================================
|
||||
|
||||
export interface FreightSettlement {
|
||||
id: string
|
||||
settlementNo: string
|
||||
totalFreight: number
|
||||
invoiceAmount?: number
|
||||
invoiceNo?: string
|
||||
invoiceDate?: string
|
||||
settlementStatus: string
|
||||
remark?: string
|
||||
createTime: string
|
||||
transports?: Transport[]
|
||||
}
|
||||
|
||||
export interface FreightSettlementQuery {
|
||||
q?: string
|
||||
settlementStatus?: string
|
||||
page?: number
|
||||
pageSize?: number
|
||||
}
|
||||
|
||||
export interface FreightSettlementListResponse {
|
||||
total: number
|
||||
list: FreightSettlement[]
|
||||
}
|
||||
|
||||
export const freightApi = {
|
||||
list: (params?: FreightSettlementQuery) =>
|
||||
request.get<FreightSettlementListResponse>('/transport/freight/', { params }),
|
||||
get: (id: string) => request.get<FreightSettlement>(`/transport/freight/${id}`),
|
||||
create: (transportIds: string[]) =>
|
||||
request.post<FreightSettlement>('/transport/freight/', { transportIds }),
|
||||
update: (id: string, data: Partial<FreightSettlement>) =>
|
||||
request.put<FreightSettlement>(`/transport/freight/${id}`, data),
|
||||
submit: (id: string) => request.post<FreightSettlement>(`/transport/freight/${id}/submit`),
|
||||
approve: (id: string) => request.post<FreightSettlement>(`/transport/freight/${id}/approve`)
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// 盘存统计 API
|
||||
// =============================================================================
|
||||
|
||||
export interface InventoryRecord {
|
||||
id: string
|
||||
productId: string
|
||||
productNo: string
|
||||
productName: string
|
||||
model?: string
|
||||
unit: string
|
||||
stockQty: number
|
||||
stockAmount: number
|
||||
lowStockWarning?: number
|
||||
highStockWarning?: number
|
||||
createTime: string
|
||||
}
|
||||
|
||||
export interface InventoryTransaction {
|
||||
id: string
|
||||
productId: string
|
||||
productName: string
|
||||
transactionType: string
|
||||
planId?: string
|
||||
planNo?: string
|
||||
qty: number
|
||||
unitPrice: number
|
||||
amount: number
|
||||
stockAfter: number
|
||||
createTime: string
|
||||
}
|
||||
|
||||
export interface InventoryWarning {
|
||||
id: string
|
||||
productId: string
|
||||
productName: string
|
||||
warningType: string
|
||||
currentQty: number
|
||||
thresholdValue: number
|
||||
status: string
|
||||
resolveTime?: string
|
||||
resolveRemark?: string
|
||||
createTime: string
|
||||
}
|
||||
|
||||
export interface DocumentReminder {
|
||||
id: string
|
||||
certId?: string
|
||||
ownerType?: string
|
||||
ownerId?: string
|
||||
ownerLabel?: string
|
||||
driverId?: string
|
||||
driverName?: string
|
||||
documentType: string
|
||||
documentNo?: string
|
||||
expireDate: string
|
||||
daysRemaining: number
|
||||
status: string
|
||||
remark?: string
|
||||
createTime: string
|
||||
}
|
||||
|
||||
export interface InventoryLedgerQuery {
|
||||
productName?: string
|
||||
page?: number
|
||||
pageSize?: number
|
||||
}
|
||||
|
||||
export interface InventoryLedgerResponse {
|
||||
total: number
|
||||
list: InventoryRecord[]
|
||||
}
|
||||
|
||||
export const inventoryApi = {
|
||||
ledger: (params?: InventoryLedgerQuery) =>
|
||||
request.get<InventoryLedgerResponse>('/transport/inventory/ledger', { params }),
|
||||
transactions: (params?: any) =>
|
||||
request.get<{ total: number; list: InventoryTransaction[] }>('/transport/inventory/transactions', { params }),
|
||||
summary: (params: { groupBy: string; dateFrom: string; dateTo: string; productId?: string }) =>
|
||||
request.get<{ list: any[] }>('/transport/inventory/summary', { params }),
|
||||
warnings: (status?: string) =>
|
||||
request.get<InventoryWarning[]>('/transport/inventory/warnings', { params: { status } }),
|
||||
updateWarning: (id: string, data: { status: string; resolveRemark?: string }) =>
|
||||
request.put<InventoryWarning>(`/transport/inventory/warnings/${id}`, data),
|
||||
setWarningThreshold: (data: { productId: string; lowStockWarning?: number; highStockWarning?: number }) =>
|
||||
request.post('/transport/inventory/warning-threshold', data),
|
||||
documentReminders: (status?: string) =>
|
||||
request.get<DocumentReminder[]>('/transport/inventory/document-reminders', { params: { status } }),
|
||||
updateDocumentReminder: (id: string, data: { status: string; remark?: string }) =>
|
||||
request.put<DocumentReminder>(`/transport/inventory/document-reminders/${id}`, data)
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import { publicPlGet, publicPlPost, publicPlUpload } from '@/utils/http/public-pl'
|
||||
|
||||
export interface PublicTransportProduct {
|
||||
productName: string
|
||||
model?: string
|
||||
packageSpec?: string
|
||||
unit?: string
|
||||
quantity?: number
|
||||
}
|
||||
|
||||
export interface PublicTransportPage {
|
||||
planNo: string
|
||||
planDate?: string
|
||||
planType: string
|
||||
pickupAddress?: string
|
||||
destinationAddress?: string
|
||||
licensePlate?: string
|
||||
driverName?: string
|
||||
driverPhone?: string
|
||||
products: PublicTransportProduct[]
|
||||
feedbackRemark?: string
|
||||
feedbackImages: string[]
|
||||
feedbackTime?: string
|
||||
planVoided?: boolean
|
||||
}
|
||||
|
||||
export interface PublicUploadResult {
|
||||
fileUrl: string
|
||||
fileName?: string
|
||||
}
|
||||
|
||||
export const publicTransportApi = {
|
||||
getPage: (token: string) => publicPlGet<PublicTransportPage>(`/public/pl/transport/${token}`),
|
||||
saveFeedback: (token: string, data: { feedbackImages?: string[]; feedbackRemark?: string }) =>
|
||||
publicPlPost<{ success: boolean }>(`/public/pl/transport/${token}/feedback`, data),
|
||||
uploadAttachment: (token: string, file: File) =>
|
||||
publicPlUpload<PublicUploadResult>(`/public/pl/transport/${token}/attachments`, file)
|
||||
}
|
||||
@@ -1074,6 +1074,74 @@ body {
|
||||
border-bottom: 1px solid var(--mint-border);
|
||||
}
|
||||
|
||||
/* 弹窗 / 抽屉内键值展示:上下布局、黑色文案 */
|
||||
:is(.el-dialog, .system-view-dialog, .el-drawer) {
|
||||
:is(.view-kv, [class*='-view-kv']:not([class*='-grid']), .pl-plan-kv) {
|
||||
display: flex !important;
|
||||
flex-direction: column !important;
|
||||
gap: 4px;
|
||||
min-width: 0;
|
||||
font-size: 13px;
|
||||
align-items: stretch;
|
||||
|
||||
dt {
|
||||
margin: 0;
|
||||
font-size: 11px;
|
||||
font-weight: 400 !important;
|
||||
color: #000 !important;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin: 0;
|
||||
font-weight: 400;
|
||||
color: #000 !important;
|
||||
word-break: break-word;
|
||||
line-height: 1.5;
|
||||
}
|
||||
}
|
||||
|
||||
.view-field-label {
|
||||
font-size: 11px;
|
||||
font-weight: 400 !important;
|
||||
color: #000 !important;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
/* 查看类弹窗 / 抽屉:value 加粗 */
|
||||
&:is(.system-view-dialog, [class*='view-dialog'], .workflow-module-dialog),
|
||||
&.system-view-dialog,
|
||||
&[class*='view-dialog'],
|
||||
&.workflow-module-dialog {
|
||||
:is(.view-kv, [class*='-view-kv']:not([class*='-grid']), .pl-plan-kv) dd,
|
||||
.pl-plan-view-remark {
|
||||
font-weight: 600 !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.el-dialog.dialog-form-layout {
|
||||
.el-form-item__label {
|
||||
color: #000 !important;
|
||||
font-weight: 400 !important;
|
||||
}
|
||||
|
||||
.el-input__inner,
|
||||
.el-textarea__inner,
|
||||
.el-select__selected-item {
|
||||
color: #000 !important;
|
||||
font-weight: 400 !important;
|
||||
}
|
||||
|
||||
.el-input.is-disabled .el-input__inner,
|
||||
.el-input.is-disabled .el-input__wrapper,
|
||||
.el-textarea.is-disabled .el-textarea__inner {
|
||||
color: #000 !important;
|
||||
-webkit-text-fill-color: #000 !important;
|
||||
font-weight: 400 !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* 弹窗 / 查看态内嵌列表面板(CRM 详情 Tab、表单弹窗、选择器等) */
|
||||
:is(.el-dialog, .system-view-dialog) {
|
||||
.dialog-list-panel,
|
||||
@@ -1143,12 +1211,12 @@ body {
|
||||
--el-table-border-color: var(--mint-border);
|
||||
--el-table-row-hover-bg-color: var(--mint-row-hover);
|
||||
--el-table-text-color: var(--mint-text);
|
||||
--el-table-header-text-color: var(--mint-text-muted);
|
||||
--el-table-header-text-color: var(--mint-text);
|
||||
font-size: 14px;
|
||||
width: 100%;
|
||||
|
||||
th.el-table__cell {
|
||||
color: var(--mint-text-muted);
|
||||
color: var(--mint-text);
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
}
|
||||
@@ -1170,3 +1238,22 @@ body {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 全局:业务界面文字统一主文本色(消除 muted 灰字) */
|
||||
.text-muted {
|
||||
color: var(--mint-text) !important;
|
||||
}
|
||||
|
||||
html:not(.dark) {
|
||||
.text-g-500,
|
||||
.text-g-600,
|
||||
.text-g-700,
|
||||
.text-g-800 {
|
||||
color: var(--mint-text) !important;
|
||||
}
|
||||
}
|
||||
|
||||
.page-container .filter-form .el-form-item__label,
|
||||
.console-container .filter-form .el-form-item__label {
|
||||
color: var(--mint-text) !important;
|
||||
}
|
||||
@@ -20,9 +20,9 @@
|
||||
// regular 用于大量控件正文(input value / select value / 普通文案)
|
||||
--el-text-color-regular: var(--mint-text) !important;
|
||||
// secondary 用于次级信息(说明/弱提示)
|
||||
--el-text-color-secondary: var(--mint-text-muted) !important;
|
||||
--el-text-color-secondary: var(--mint-text) !important;
|
||||
// placeholder 全局占位符颜色(含弹窗 Teleport 场景)
|
||||
--el-text-color-placeholder: #9ca3af !important;
|
||||
--el-text-color-placeholder: var(--mint-text-placeholder) !important;
|
||||
--el-mask-color: rgba(15, 23, 42, 0.35) !important;
|
||||
// 按钮粗度
|
||||
--el-font-weight-primary: 500 !important;
|
||||
@@ -743,13 +743,13 @@ body .el-table thead {
|
||||
--el-table-border-color: var(--mint-border);
|
||||
--el-table-row-hover-bg-color: var(--mint-row-hover);
|
||||
--el-table-text-color: var(--mint-text);
|
||||
--el-table-header-text-color: var(--mint-text-muted);
|
||||
--el-table-header-text-color: var(--mint-text);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.page-container .el-table th.el-table__cell,
|
||||
.console-container .el-table th.el-table__cell {
|
||||
color: var(--mint-text-muted);
|
||||
color: var(--mint-text);
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
}
|
||||
@@ -863,19 +863,24 @@ body .el-table thead {
|
||||
// Fresh Mint:placeholder 统一(设计图:更轻的 slate,字号略小)
|
||||
.page-container .el-input__inner::placeholder,
|
||||
.page-container .el-textarea__inner::placeholder,
|
||||
.page-container .el-range-input::placeholder,
|
||||
.console-container .el-input__inner::placeholder,
|
||||
.console-container .el-textarea__inner::placeholder {
|
||||
color: #9ca3af !important;
|
||||
-webkit-text-fill-color: #9ca3af !important;
|
||||
.console-container .el-textarea__inner::placeholder,
|
||||
.console-container .el-range-input::placeholder {
|
||||
color: var(--mint-text-placeholder) !important;
|
||||
-webkit-text-fill-color: var(--mint-text-placeholder) !important;
|
||||
font-size: 13px;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/* 全局兜底(避免 Teleport 到 body 的弹窗不命中 page-container 作用域) */
|
||||
.el-input__inner::placeholder,
|
||||
.el-textarea__inner::placeholder {
|
||||
color: #9ca3af !important;
|
||||
-webkit-text-fill-color: #9ca3af !important;
|
||||
.el-textarea__inner::placeholder,
|
||||
.el-range-input::placeholder,
|
||||
input::placeholder,
|
||||
textarea::placeholder {
|
||||
color: var(--mint-text-placeholder) !important;
|
||||
-webkit-text-fill-color: var(--mint-text-placeholder) !important;
|
||||
font-size: 13px;
|
||||
opacity: 1;
|
||||
}
|
||||
@@ -900,8 +905,8 @@ body .el-table thead {
|
||||
.el-tree-select .el-select__wrapper,
|
||||
.el-cascader__suggestion-panel,
|
||||
.el-tree-select__popper {
|
||||
--el-text-color-placeholder: #9ca3af !important;
|
||||
--el-select-multiple-input-color: #9ca3af !important;
|
||||
--el-text-color-placeholder: var(--mint-text-placeholder) !important;
|
||||
--el-select-multiple-input-color: var(--mint-text) !important;
|
||||
}
|
||||
|
||||
/* 已选中值(placeholder 无 is-transparent):保持正文深色 */
|
||||
@@ -920,22 +925,12 @@ body .el-table thead {
|
||||
-webkit-text-fill-color: var(--mint-text) !important;
|
||||
}
|
||||
|
||||
/* 未选中时 placeholder(is-transparent)应为灰色,区别于已选值 */
|
||||
/* 未选中时 placeholder(is-transparent)使用浅灰占位色 */
|
||||
.page-container .el-select__placeholder.is-transparent,
|
||||
.console-container .el-select__placeholder.is-transparent,
|
||||
.el-select__placeholder.is-transparent {
|
||||
color: #9ca3af !important;
|
||||
-webkit-text-fill-color: #9ca3af !important;
|
||||
}
|
||||
|
||||
// 兜底:页面内原生 input/textarea placeholder(避免自绘控件不走 Element)
|
||||
.page-container input::placeholder,
|
||||
.page-container textarea::placeholder,
|
||||
.console-container input::placeholder,
|
||||
.console-container textarea::placeholder {
|
||||
color: #9ca3af;
|
||||
font-size: 13px;
|
||||
opacity: 1;
|
||||
color: var(--mint-text-placeholder) !important;
|
||||
-webkit-text-fill-color: var(--mint-text-placeholder) !important;
|
||||
}
|
||||
|
||||
.page-container .el-input__wrapper:hover,
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
--mint-primary-bg: #ecfdf5;
|
||||
--mint-text: #1e293b;
|
||||
--mint-text-muted: #64748b;
|
||||
--mint-text-placeholder: #94a3b8;
|
||||
--mint-border: #d9e8e2;
|
||||
--mint-bg-page: #fefefe;
|
||||
--mint-surface: #ffffff;
|
||||
|
||||
@@ -228,7 +228,7 @@ const realHeight = computed(() => normalizeCssSize(props.height as string | numb
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
color: #909399;
|
||||
color: #1e293b;
|
||||
font-size: 30px;
|
||||
|
||||
.error-text {
|
||||
|
||||
@@ -311,7 +311,7 @@ defineExpose({ hasUploading })
|
||||
.upload-hint {
|
||||
display: block;
|
||||
font-size: 11px;
|
||||
color: #94a3b8;
|
||||
color: #1e293b;
|
||||
margin-top: 8px;
|
||||
line-height: 1;
|
||||
}
|
||||
@@ -383,7 +383,7 @@ defineExpose({ hasUploading })
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
font-size: 11px;
|
||||
color: #334155;
|
||||
color: #1e293b;
|
||||
line-height: 1.4;
|
||||
word-break: break-all;
|
||||
}
|
||||
@@ -400,7 +400,7 @@ defineExpose({ hasUploading })
|
||||
height: 22px;
|
||||
border-radius: 4px;
|
||||
background: #f1f5f9;
|
||||
color: #64748b;
|
||||
color: #1e293b;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
|
||||
@@ -0,0 +1,396 @@
|
||||
<!-- eslint-disable vue/no-v-model-argument -->
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="innerVisible"
|
||||
title="选择合同"
|
||||
width="1440px"
|
||||
align-center
|
||||
class="dialog-form-layout"
|
||||
modal-class="order-module-dialog-mask"
|
||||
:close-on-click-modal="false"
|
||||
append-to-body
|
||||
destroy-on-close
|
||||
style="backdrop-filter: none"
|
||||
@open="handleOpen"
|
||||
>
|
||||
<div class="filter-block contract-selector-filter">
|
||||
<el-form ref="queryFormRef" :model="queryParams" class="filter-form" @submit.prevent>
|
||||
<div class="filter-grid">
|
||||
<el-form-item label="合同编号" prop="contractNo">
|
||||
<el-input
|
||||
v-model="queryParams.contractNo"
|
||||
placeholder="搜索合同编号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="合同名称" prop="contractName">
|
||||
<el-input
|
||||
v-model="queryParams.contractName"
|
||||
placeholder="搜索合同名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="客户名称" prop="customerName">
|
||||
<el-input
|
||||
v-model="queryParams.customerName"
|
||||
placeholder="搜索客户名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div class="filter-actions">
|
||||
<div class="filter-actions-start" />
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" :loading="loading" @click="resetQuery">
|
||||
<el-icon><RefreshLeft /></el-icon>重置
|
||||
</el-button>
|
||||
<el-button class="btn-main" type="primary" :loading="loading" @click="handleQuery">
|
||||
<el-icon><Search /></el-icon>搜索
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div class="panel dialog-list-panel">
|
||||
<div class="list-body list-wrap dialog-list-body-only">
|
||||
<el-table
|
||||
ref="tableRef"
|
||||
v-loading="loading"
|
||||
:data="contractList"
|
||||
class="list-table contract-selector-table"
|
||||
stripe
|
||||
highlight-current-row
|
||||
row-key="id"
|
||||
:max-height="420"
|
||||
@row-click="handleRowClick"
|
||||
@current-change="handleCurrentChange"
|
||||
>
|
||||
<el-table-column label="" min-width="48" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<el-radio
|
||||
v-model="selectedId"
|
||||
:label="String(row.id)"
|
||||
@click.stop
|
||||
@change="handleRadioChange(row)"
|
||||
>
|
||||
<span class="sr-only">选择</span>
|
||||
</el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column type="index" label="序号" min-width="60" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
prop="contractNo"
|
||||
label="合同编号"
|
||||
min-width="150"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
prop="contractName"
|
||||
label="合同名称"
|
||||
min-width="180"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
prop="customerName"
|
||||
label="客户名称"
|
||||
min-width="150"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column prop="contractType" label="合同类型" min-width="110" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<DictTag dict-type="crm_contract_type" :value="row.contractType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" label="状态" min-width="100" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<DictTag dict-type="crm_contract_status" :value="row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="amount" label="合同金额" min-width="120" align="right" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<span class="money-display">{{ formatMoneyDisplay(row.amount) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="signDate" label="签订日期" min-width="120" align="center" header-align="center" />
|
||||
<el-table-column label="已关联的运输计划数" min-width="140" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
{{ planCountMap[String(row.id)] ?? 0 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<ListPagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button class="btn-ghost" @click="innerVisible = false">
|
||||
<el-icon><Close /></el-icon>取消
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
:disabled="!currentRow"
|
||||
:loading="detailLoading"
|
||||
@click="handleConfirm"
|
||||
>
|
||||
<el-icon><Check /></el-icon>确定
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Check, Close, RefreshLeft, Search } from '@element-plus/icons-vue'
|
||||
import type { FormInstance, TableInstance } from 'element-plus'
|
||||
import { getContract, listContract } from '@/api/crm/contract'
|
||||
import type { ContractQuery, ContractVO } from '@/api/crm/contract/types'
|
||||
import { planApi } from '@/api/pl'
|
||||
import DictTag from '@/components/DictTag/index.vue'
|
||||
import ListPagination from '@/components/ListPagination/index.vue'
|
||||
import { formatMoneyDisplay } from '@/utils/money-format'
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:visible': [value: boolean]
|
||||
confirm: [contract: ContractVO]
|
||||
}>()
|
||||
|
||||
const innerVisible = computed({
|
||||
get: () => props.visible,
|
||||
set: value => emit('update:visible', value)
|
||||
})
|
||||
|
||||
const queryFormRef = ref<FormInstance>()
|
||||
const tableRef = ref<TableInstance>()
|
||||
const loading = ref(false)
|
||||
const detailLoading = ref(false)
|
||||
const total = ref(0)
|
||||
const contractList = ref<ContractVO[]>([])
|
||||
const currentRow = ref<ContractVO | null>(null)
|
||||
const selectedId = ref('')
|
||||
const planCountMap = ref<Record<string, number>>({})
|
||||
|
||||
const queryParams = reactive<ContractQuery>({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
contractNo: '',
|
||||
contractName: '',
|
||||
customerName: '',
|
||||
excludeStatus: 'invalid'
|
||||
})
|
||||
|
||||
async function getList() {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await listContract(queryParams)
|
||||
contractList.value = res.rows || []
|
||||
total.value = res.total || 0
|
||||
await loadPlanCounts()
|
||||
await nextTick()
|
||||
syncTableSelection()
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function syncTableSelection() {
|
||||
const table = tableRef.value
|
||||
if (!table) return
|
||||
if (!selectedId.value) {
|
||||
table.setCurrentRow(undefined)
|
||||
return
|
||||
}
|
||||
const row = contractList.value.find(item => String(item.id) === selectedId.value)
|
||||
if (!row) {
|
||||
selectedId.value = ''
|
||||
currentRow.value = null
|
||||
table.setCurrentRow(undefined)
|
||||
return
|
||||
}
|
||||
currentRow.value = row
|
||||
table.setCurrentRow(row)
|
||||
}
|
||||
|
||||
function selectContractRow(row: ContractVO | null | undefined) {
|
||||
if (!row?.id) {
|
||||
selectedId.value = ''
|
||||
currentRow.value = null
|
||||
syncTableSelection()
|
||||
return
|
||||
}
|
||||
selectedId.value = String(row.id)
|
||||
currentRow.value = row
|
||||
syncTableSelection()
|
||||
}
|
||||
|
||||
function handleRowClick(row: ContractVO) {
|
||||
selectContractRow(row)
|
||||
}
|
||||
|
||||
function handleRadioChange(row: ContractVO) {
|
||||
selectContractRow(row)
|
||||
}
|
||||
|
||||
async function loadPlanCounts() {
|
||||
const ids = contractList.value.map(item => String(item.id)).filter(Boolean)
|
||||
if (!ids.length) {
|
||||
planCountMap.value = {}
|
||||
return
|
||||
}
|
||||
try {
|
||||
const res = await planApi.countByContract(ids)
|
||||
const data = (res.data ?? res) as { counts?: Record<string, number> }
|
||||
planCountMap.value = data.counts || {}
|
||||
} catch {
|
||||
planCountMap.value = {}
|
||||
}
|
||||
}
|
||||
|
||||
function handleQuery() {
|
||||
queryParams.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
function resetQuery() {
|
||||
queryFormRef.value?.resetFields()
|
||||
queryParams.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
watchDebounced(
|
||||
() => ({
|
||||
contractNo: queryParams.contractNo,
|
||||
contractName: queryParams.contractName,
|
||||
customerName: queryParams.customerName
|
||||
}),
|
||||
() => {
|
||||
queryParams.pageNum = 1
|
||||
getList()
|
||||
},
|
||||
{ debounce: 300, deep: true }
|
||||
)
|
||||
|
||||
function handleCurrentChange(row: ContractVO | undefined) {
|
||||
if (row?.id && String(row.id) === selectedId.value) {
|
||||
currentRow.value = row
|
||||
return
|
||||
}
|
||||
selectContractRow(row)
|
||||
}
|
||||
|
||||
function handleOpen() {
|
||||
selectedId.value = ''
|
||||
currentRow.value = null
|
||||
planCountMap.value = {}
|
||||
queryParams.pageNum = 1
|
||||
nextTick(() => {
|
||||
tableRef.value?.setCurrentRow(undefined)
|
||||
})
|
||||
getList()
|
||||
}
|
||||
|
||||
async function handleConfirm() {
|
||||
if (!currentRow.value?.id) return
|
||||
detailLoading.value = true
|
||||
try {
|
||||
const res = await getContract(currentRow.value.id)
|
||||
const detail = (res.data ?? res) as ContractVO
|
||||
emit('confirm', detail)
|
||||
innerVisible.value = false
|
||||
} finally {
|
||||
detailLoading.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.contract-selector-filter {
|
||||
padding: 12px 16px 10px;
|
||||
background: var(--mint-surface);
|
||||
border: 1px solid var(--mint-border);
|
||||
border-radius: var(--mint-radius);
|
||||
margin-bottom: 12px;
|
||||
|
||||
.filter-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 10px 14px;
|
||||
}
|
||||
|
||||
.filter-actions {
|
||||
margin-top: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.filter-actions-end {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.filter-actions-end .el-button + .el-button {
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1100px) {
|
||||
.contract-selector-filter .filter-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 560px) {
|
||||
.contract-selector-filter .filter-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.contract-selector-table {
|
||||
:deep(.el-radio) {
|
||||
margin-right: 0;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
:deep(.el-radio__label) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.sr-only {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
padding: 0;
|
||||
margin: -1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
white-space: nowrap;
|
||||
border: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,153 @@
|
||||
<!-- eslint-disable vue/no-v-model-argument -->
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="innerVisible"
|
||||
:title="dialogTitle"
|
||||
width="400px"
|
||||
align-center
|
||||
class="db-qrcode-dialog"
|
||||
modal-class="db-qrcode-overlay"
|
||||
append-to-body
|
||||
@close="handleClose"
|
||||
>
|
||||
<div v-loading="loading" class="db-qrcode-body pound-slip-capture-inline">
|
||||
<template v-if="captureRow">
|
||||
<div class="capture-card">
|
||||
<div class="capture-row capture-row-plate">
|
||||
<div class="vehicle-plate">
|
||||
<span class="vehicle-plate-dot vehicle-plate-dot-lt"></span>
|
||||
<span class="vehicle-plate-dot vehicle-plate-dot-lb"></span>
|
||||
<span class="vehicle-plate-text">{{ captureRow.vehicleNo }}</span>
|
||||
<span class="vehicle-plate-dot vehicle-plate-dot-rt"></span>
|
||||
<span class="vehicle-plate-dot vehicle-plate-dot-rb"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="capture-row capture-row-large">
|
||||
<span class="label">往来单位:</span>
|
||||
<span class="value">{{ captureRow.partnerCompany }}</span>
|
||||
</div>
|
||||
<div class="capture-row capture-row-large">
|
||||
<span class="label">物料名称:</span>
|
||||
<span class="value">
|
||||
{{ formatQrcodeProductLabel(captureRow) }}({{ captureRow.quantity }} {{ quantityUnitLabel }})
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="captureRow.remarks" class="capture-row">
|
||||
<span class="label">备注:</span>
|
||||
<span class="value">{{ captureRow.remarks }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="capture-card capture-qrcode">
|
||||
<div class="capture-id">
|
||||
{{ captureRow.date }}
|
||||
{{ captureRow.businessType === '出库' ? '出库单ID:' : '入库单ID:' }}{{ captureRow.id }}
|
||||
</div>
|
||||
<div class="capture-qr-wrap">
|
||||
<img v-if="captureQrObjectUrl" :src="captureQrObjectUrl" alt="二维码" class="capture-qr-img" />
|
||||
</div>
|
||||
<div class="capture-desc">出入库单标识(扫码核验)</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { inventoryApi, type InventoryRecord } from '@/api/db/inventory'
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean
|
||||
inventoryId?: string
|
||||
quantityUnit?: string
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:visible': [value: boolean]
|
||||
}>()
|
||||
|
||||
const innerVisible = computed({
|
||||
get: () => props.visible,
|
||||
set: value => emit('update:visible', value)
|
||||
})
|
||||
|
||||
const loading = ref(false)
|
||||
const captureRow = ref<InventoryRecord | null>(null)
|
||||
const captureQrObjectUrl = ref('')
|
||||
|
||||
const quantityUnitLabel = computed(() => (props.quantityUnit || '').trim() || '吨')
|
||||
|
||||
const dialogTitle = computed(() => {
|
||||
if (!captureRow.value) return '磅单二维码'
|
||||
return captureRow.value.businessType === '出库' ? '出库磅单二维码' : '入库磅单二维码'
|
||||
})
|
||||
|
||||
function formatQrcodeProductLabel(row: InventoryRecord) {
|
||||
const product = (row.product || '').trim()
|
||||
const specification = (row.specification || '').trim()
|
||||
if (!specification) return product
|
||||
if (product.endsWith(specification)) {
|
||||
const base = product.slice(0, -specification.length).trimEnd()
|
||||
return base ? `${base} ${specification}` : specification
|
||||
}
|
||||
return `${product} ${specification}`
|
||||
}
|
||||
|
||||
function getQrImageUrl(inventoryId: string) {
|
||||
return `https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(inventoryId)}`
|
||||
}
|
||||
|
||||
async function loadQrcode(inventoryId: string) {
|
||||
loading.value = true
|
||||
captureRow.value = null
|
||||
if (captureQrObjectUrl.value) {
|
||||
URL.revokeObjectURL(captureQrObjectUrl.value)
|
||||
captureQrObjectUrl.value = ''
|
||||
}
|
||||
try {
|
||||
const res = await inventoryApi.get(inventoryId)
|
||||
const row = (res.data ?? res) as InventoryRecord
|
||||
captureRow.value = row
|
||||
await nextTick()
|
||||
const qrImageUrl = getQrImageUrl(row.id)
|
||||
const fetchRes = await fetch(qrImageUrl, { mode: 'cors' })
|
||||
if (!fetchRes.ok) throw new Error('二维码图片加载失败')
|
||||
const blob = await fetchRes.blob()
|
||||
captureQrObjectUrl.value = URL.createObjectURL(blob)
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e?.message || '加载二维码失败')
|
||||
innerVisible.value = false
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleClose() {
|
||||
if (captureQrObjectUrl.value) URL.revokeObjectURL(captureQrObjectUrl.value)
|
||||
captureRow.value = null
|
||||
captureQrObjectUrl.value = ''
|
||||
}
|
||||
|
||||
async function copyQrcodeImage() {
|
||||
if (!captureQrObjectUrl.value) return false
|
||||
try {
|
||||
const blob = await fetch(captureQrObjectUrl.value).then(r => r.blob())
|
||||
await navigator.clipboard.write([new ClipboardItem({ [blob.type]: blob })])
|
||||
ElMessage.success('已复制磅单二维码')
|
||||
return true
|
||||
} catch {
|
||||
ElMessage.warning('当前浏览器不支持复制图片,请手动截图')
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => [props.visible, props.inventoryId] as const,
|
||||
async ([visible, inventoryId]) => {
|
||||
if (visible && inventoryId) {
|
||||
await loadQrcode(inventoryId)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
defineExpose({ copyQrcodeImage, loadQrcode })
|
||||
</script>
|
||||
@@ -0,0 +1,208 @@
|
||||
<!-- eslint-disable vue/no-v-model-argument -->
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="innerVisible"
|
||||
:title="carrier?.carrierName || '承运商详情'"
|
||||
width="1080px"
|
||||
align-center
|
||||
destroy-on-close
|
||||
class="dialog-form-layout carrier-view-dialog"
|
||||
modal-class="order-module-dialog-mask"
|
||||
append-to-body
|
||||
style="backdrop-filter: none"
|
||||
@closed="handleClosed"
|
||||
>
|
||||
<div class="carrier-view-body" v-loading="loading">
|
||||
<section class="carrier-view-top">
|
||||
<h3 class="carrier-view-block-title">承运商信息</h3>
|
||||
<dl v-if="carrier" class="carrier-view-kv-grid">
|
||||
<div class="carrier-view-kv">
|
||||
<dt>承运商名称</dt>
|
||||
<dd>{{ carrier.carrierName || '—' }}</dd>
|
||||
</div>
|
||||
<div class="carrier-view-kv">
|
||||
<dt>联系人</dt>
|
||||
<dd>{{ carrier.contactName || '—' }}</dd>
|
||||
</div>
|
||||
<div class="carrier-view-kv">
|
||||
<dt>联系电话</dt>
|
||||
<dd>{{ carrier.contactPhone || '—' }}</dd>
|
||||
</div>
|
||||
<div class="carrier-view-kv">
|
||||
<dt>合作状态</dt>
|
||||
<dd>
|
||||
<el-tag :type="getPlCarrierStatusTagType(carrier.status)" size="small">
|
||||
{{ getPlCarrierStatusLabel(carrier.status) }}
|
||||
</el-tag>
|
||||
</dd>
|
||||
</div>
|
||||
<div class="carrier-view-kv">
|
||||
<dt>创建时间</dt>
|
||||
<dd>{{ formatDateTime(carrier.createTime) }}</dd>
|
||||
</div>
|
||||
<div class="carrier-view-kv carrier-view-kv-span">
|
||||
<dt>备注</dt>
|
||||
<dd>{{ carrier.remark || '—' }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</section>
|
||||
|
||||
<section class="carrier-view-bottom">
|
||||
<h3 class="carrier-view-block-title">关联车辆</h3>
|
||||
<p v-if="!vehicleBundles.length && !loading" class="carrier-view-empty">暂无关联车辆</p>
|
||||
<el-tabs v-else v-model="activeTab" class="carrier-vehicle-tabs">
|
||||
<el-tab-pane
|
||||
v-for="bundle in vehicleBundles"
|
||||
:key="bundle.detail.id"
|
||||
:label="bundle.detail.licensePlate"
|
||||
:name="bundle.detail.id"
|
||||
>
|
||||
<PlVehicleViewPanel
|
||||
:detail="bundle.detail"
|
||||
:personnel-list="bundle.personnelList"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="innerVisible = false">
|
||||
<el-icon><Close /></el-icon>关闭
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Close } from '@element-plus/icons-vue'
|
||||
import { carrierApi, vehicleApi, type Carrier } from '@/api/pl'
|
||||
import PlVehicleViewPanel from '@/components/business/pl-vehicle-view-panel/index.vue'
|
||||
import {
|
||||
loadVehicleViewBundles,
|
||||
type VehicleViewBundle
|
||||
} from '@/composables/usePlVehicleViewDetail'
|
||||
import { formatDateTime } from '@/utils/format'
|
||||
import { getPlCarrierStatusLabel, getPlCarrierStatusTagType } from '@/utils/pl-display'
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean
|
||||
carrierId?: string
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:visible': [value: boolean]
|
||||
}>()
|
||||
|
||||
const innerVisible = computed({
|
||||
get: () => props.visible,
|
||||
set: value => emit('update:visible', value)
|
||||
})
|
||||
|
||||
const loading = ref(false)
|
||||
const carrier = ref<Carrier | null>(null)
|
||||
const vehicleBundles = ref<VehicleViewBundle[]>([])
|
||||
const activeTab = ref('')
|
||||
|
||||
watch(
|
||||
() => [props.visible, props.carrierId] as const,
|
||||
async ([visible, carrierId]) => {
|
||||
if (!visible || !carrierId) return
|
||||
await loadDetail(carrierId)
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
async function loadDetail(carrierId: string) {
|
||||
loading.value = true
|
||||
carrier.value = null
|
||||
vehicleBundles.value = []
|
||||
activeTab.value = ''
|
||||
try {
|
||||
const [carrierRes, vehicleListRes] = await Promise.all([
|
||||
carrierApi.get(carrierId),
|
||||
vehicleApi.list({ carrierId })
|
||||
])
|
||||
carrier.value = ((carrierRes.data ?? carrierRes) || null) as Carrier | null
|
||||
const vehicles = ((vehicleListRes.data ?? vehicleListRes) || []) as { id: string }[]
|
||||
vehicleBundles.value = await loadVehicleViewBundles(vehicles.map(item => item.id))
|
||||
activeTab.value = vehicleBundles.value[0]?.detail.id || ''
|
||||
} catch {
|
||||
innerVisible.value = false
|
||||
ElMessage.error('加载承运商详情失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleClosed() {
|
||||
carrier.value = null
|
||||
vehicleBundles.value = []
|
||||
activeTab.value = ''
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.carrier-view-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
min-height: 120px;
|
||||
}
|
||||
|
||||
.carrier-view-block-title {
|
||||
margin: 0 0 12px;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.carrier-view-top {
|
||||
padding-bottom: 16px;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.carrier-view-kv-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 12px 20px;
|
||||
}
|
||||
|
||||
.carrier-view-kv {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.carrier-view-kv-span {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.carrier-view-empty {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.carrier-vehicle-tabs {
|
||||
:deep(.el-tabs__header) {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
:deep(.el-tabs__content) {
|
||||
padding-top: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.carrier-view-kv-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.carrier-view-kv-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,215 @@
|
||||
<template>
|
||||
<div class="cert-form-section">
|
||||
<div class="cert-form-header">
|
||||
<span class="cert-form-title">{{ title }}</span>
|
||||
<el-button type="primary" size="small" @click="handleAddCert">
|
||||
<el-icon><Plus /></el-icon>添加证书
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<div v-if="!certList.length" class="cert-empty">暂无证书,点击「添加证书」</div>
|
||||
|
||||
<div v-else class="cert-card-list">
|
||||
<div v-for="(cert, index) in certList" :key="cert._key" class="cert-card">
|
||||
<div class="cert-card-head">
|
||||
<span class="cert-card-index">证书 {{ index + 1 }}</span>
|
||||
<el-button link type="danger" @click="handleRemoveCert(index)">
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<div class="form-grid-4 cert-card-grid">
|
||||
<el-form-item label="证书名称" required>
|
||||
<el-select
|
||||
v-model="cert.certName"
|
||||
placeholder="请选择或输入证书名称"
|
||||
filterable
|
||||
allow-create
|
||||
default-first-option
|
||||
>
|
||||
<el-option v-for="name in certNameOptions" :key="name" :label="name" :value="name" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="证号">
|
||||
<el-input v-model="cert.certNo" placeholder="请输入证号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="有效期">
|
||||
<el-date-picker
|
||||
v-model="cert.expireDate"
|
||||
type="date"
|
||||
placeholder="选择有效期"
|
||||
value-format="YYYY-MM-DD"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="提醒天数">
|
||||
<template #label>
|
||||
提醒天数<span class="form-label-tip">默认 30 天</span>
|
||||
</template>
|
||||
<el-input-number
|
||||
v-model="cert.remindDays"
|
||||
:min="1"
|
||||
:max="365"
|
||||
:controls="false"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="附件" class="form-col-span-2">
|
||||
<AttachmentUploadField
|
||||
:ref="(el) => setCertUploadRef(index, el)"
|
||||
v-model="cert.attachmentUrls"
|
||||
:folder="uploadFolder"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Delete, Plus } from '@element-plus/icons-vue'
|
||||
import AttachmentUploadField from '@/components/business/attachment-upload-field/index.vue'
|
||||
import type { CertRow } from '@/api/pl'
|
||||
|
||||
type CertRowWithKey = CertRow & { _key: string }
|
||||
type CertUploadRef = InstanceType<typeof AttachmentUploadField>
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
title?: string
|
||||
uploadFolder: string
|
||||
certNameOptions?: string[]
|
||||
}>(),
|
||||
{
|
||||
title: '证书',
|
||||
certNameOptions: () => []
|
||||
}
|
||||
)
|
||||
|
||||
const certList = defineModel<CertRowWithKey[]>('modelValue', { default: () => [] })
|
||||
|
||||
const certUploadRefs = ref<Record<number, CertUploadRef | null>>({})
|
||||
|
||||
function createEmptyCert(): CertRowWithKey {
|
||||
return {
|
||||
_key: `cert-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
||||
certName: '',
|
||||
certNo: '',
|
||||
expireDate: '',
|
||||
remindDays: 30,
|
||||
attachmentUrls: ''
|
||||
}
|
||||
}
|
||||
|
||||
function handleAddCert() {
|
||||
certList.value = [...certList.value, createEmptyCert()]
|
||||
}
|
||||
|
||||
function handleRemoveCert(index: number) {
|
||||
const next = [...certList.value]
|
||||
next.splice(index, 1)
|
||||
certList.value = next
|
||||
delete certUploadRefs.value[index]
|
||||
}
|
||||
|
||||
function setCertUploadRef(index: number, el: unknown) {
|
||||
if (el) {
|
||||
certUploadRefs.value[index] = el as CertUploadRef
|
||||
} else {
|
||||
delete certUploadRefs.value[index]
|
||||
}
|
||||
}
|
||||
|
||||
function hasUploading() {
|
||||
return Object.values(certUploadRefs.value).some(ref => ref?.hasUploading?.())
|
||||
}
|
||||
|
||||
function clearUploadRefs() {
|
||||
certUploadRefs.value = {}
|
||||
}
|
||||
|
||||
defineExpose({ hasUploading, clearUploadRefs })
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.cert-form-section {
|
||||
margin-top: 16px;
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.cert-form-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.cert-form-title {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: var(--text, #1e293b);
|
||||
}
|
||||
|
||||
.cert-empty {
|
||||
padding: 24px;
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
color: var(--mint-text);
|
||||
border: 1px dashed var(--border, #d9e8e2);
|
||||
border-radius: 8px;
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.cert-card-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.cert-card {
|
||||
border: 1px solid var(--border, #d9e8e2);
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
padding: 14px 16px 4px;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
.cert-card-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 12px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #eef2f6;
|
||||
}
|
||||
|
||||
.cert-card-index {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: var(--primary, #10b981);
|
||||
}
|
||||
|
||||
.cert-card-index::before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
width: 3px;
|
||||
height: 14px;
|
||||
margin-right: 8px;
|
||||
vertical-align: -2px;
|
||||
border-radius: 2px;
|
||||
background: var(--primary, #10b981);
|
||||
}
|
||||
|
||||
.cert-card-grid {
|
||||
:deep(.el-form-item) {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
:deep(.el-form-item__label) {
|
||||
font-size: 11px;
|
||||
color: var(--mint-text);
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,141 @@
|
||||
<template>
|
||||
<div class="cert-view-section">
|
||||
<p v-if="!certList.length" class="view-empty-hint">暂无证书</p>
|
||||
|
||||
<div v-else class="cert-view-list">
|
||||
<div
|
||||
v-for="(cert, index) in certList"
|
||||
:key="cert.id || cert.certId || `cert-${index}`"
|
||||
class="cert-view-card"
|
||||
>
|
||||
<h4 class="cert-view-card-title">证书 {{ index + 1 }}</h4>
|
||||
|
||||
<dl class="cert-view-kv-grid">
|
||||
<div class="cert-view-kv">
|
||||
<dt>证书名称</dt>
|
||||
<dd>{{ cert.certName || '—' }}</dd>
|
||||
</div>
|
||||
<div class="cert-view-kv">
|
||||
<dt>证号</dt>
|
||||
<dd>{{ cert.certNo || '—' }}</dd>
|
||||
</div>
|
||||
<div class="cert-view-kv">
|
||||
<dt>有效期</dt>
|
||||
<dd>
|
||||
<el-tag v-if="cert.expireDate" :type="getExpireTagType(cert.expireDate)" size="small">
|
||||
{{ cert.expireDate }}
|
||||
</el-tag>
|
||||
<span v-else>—</span>
|
||||
</dd>
|
||||
</div>
|
||||
<div class="cert-view-kv">
|
||||
<dt>提醒天数</dt>
|
||||
<dd>{{ cert.remindDays ?? 30 }} 天</dd>
|
||||
</div>
|
||||
<div class="cert-view-kv cert-view-kv-span">
|
||||
<dt>附件</dt>
|
||||
<dd>
|
||||
<AttachmentUploadField
|
||||
v-if="cert.attachmentUrls"
|
||||
:model-value="cert.attachmentUrls"
|
||||
disabled
|
||||
/>
|
||||
<span v-else class="view-empty-inline">—</span>
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import AttachmentUploadField from '@/components/business/attachment-upload-field/index.vue'
|
||||
import type { CertRead } from '@/api/pl'
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
certList?: CertRead[]
|
||||
}>(),
|
||||
{
|
||||
certList: () => []
|
||||
}
|
||||
)
|
||||
|
||||
function getExpireTagType(dateStr: string | undefined) {
|
||||
if (!dateStr) return 'info'
|
||||
const expDate = new Date(dateStr)
|
||||
const today = new Date()
|
||||
const diffDays = Math.ceil((expDate.getTime() - today.getTime()) / (1000 * 60 * 60 * 24))
|
||||
if (diffDays <= 0) return 'danger'
|
||||
if (diffDays <= 30) return 'warning'
|
||||
return 'success'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.cert-view-section {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.view-empty-hint {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
color: #000;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.cert-view-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.cert-view-card {
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
padding: 14px 16px;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
.cert-view-card-title {
|
||||
margin: 0 0 12px;
|
||||
padding-left: 10px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
border-left: 3px solid #10b981;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.cert-view-kv-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 12px 20px;
|
||||
}
|
||||
|
||||
.cert-view-kv {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.cert-view-kv-span {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.view-empty-inline {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
@media (max-width: 1200px) {
|
||||
.cert-view-kv-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.cert-view-kv-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,661 @@
|
||||
<!-- eslint-disable vue/no-v-model-argument -->
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="innerVisible"
|
||||
:title="dialogTitle"
|
||||
align-center
|
||||
destroy-on-close
|
||||
append-to-body
|
||||
class="dialog-form-layout pl-plan-arrange-dialog"
|
||||
modal-class="order-module-dialog-mask"
|
||||
:close-on-click-modal="false"
|
||||
style="backdrop-filter: none"
|
||||
@closed="handleClosed"
|
||||
@opened="handleOpened"
|
||||
>
|
||||
<div class="pl-arrange-layout">
|
||||
<section class="pl-arrange-form-panel">
|
||||
<div v-loading="loading" class="pl-arrange-form-scroll">
|
||||
<section v-if="arrangeSuccess" class="pl-plan-form-section pl-arrange-success">
|
||||
<h3 class="pl-plan-form-section-title">安排成功</h3>
|
||||
<el-alert type="success" :closable="false" show-icon title="运输已安排,可复制司机链接或计划简述" />
|
||||
<div class="pl-arrange-link-row">
|
||||
<span class="pl-arrange-link-label">司机链接</span>
|
||||
<el-input :model-value="driverUrl || arrangeResult?.driverUrl || ''" readonly />
|
||||
<el-button @click="copyDriverUrl(arrangeResult?.driverUrl)">
|
||||
<el-icon><CopyDocument /></el-icon>复制链接
|
||||
</el-button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section v-else class="pl-plan-form-section">
|
||||
<h3 class="pl-plan-form-section-title">运输安排</h3>
|
||||
<el-form ref="formRef" :model="formData" :rules="formRules" label-position="top">
|
||||
<div class="form-grid-4">
|
||||
<el-form-item label="选择车辆" prop="vehicleId">
|
||||
<el-select
|
||||
v-model="formData.vehicleId"
|
||||
placeholder="请选择车辆"
|
||||
filterable
|
||||
:loading="vehicleLoading"
|
||||
@change="handleVehicleChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="v in vehicleList"
|
||||
:key="v.id"
|
||||
:label="`${v.licensePlate} (${v.loadCapacity || '-'}吨)`"
|
||||
:value="v.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="选择司机" prop="driverId">
|
||||
<el-select
|
||||
v-model="formData.driverId"
|
||||
placeholder="请先选择车辆"
|
||||
filterable
|
||||
:disabled="!formData.vehicleId || vehicleDriverList.length === 0"
|
||||
>
|
||||
<el-option
|
||||
v-for="d in vehicleDriverList"
|
||||
:key="d.personnelId"
|
||||
:label="formatDriverLabel(d)"
|
||||
:value="d.personnelId!"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="运输公司">
|
||||
<el-input v-if="isSelfVehicle" :model-value="SELF_CARRIER_NAME" readonly />
|
||||
<el-select
|
||||
v-else
|
||||
v-model="formData.carrierId"
|
||||
placeholder="请选择运输公司"
|
||||
filterable
|
||||
clearable
|
||||
>
|
||||
<el-option v-for="c in carrierList" :key="c.id" :label="c.carrierName" :value="c.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="运输起点" prop="startPoint">
|
||||
<el-input v-model="formData.startPoint" placeholder="请输入运输起点" />
|
||||
</el-form-item>
|
||||
<el-form-item label="运输终点" prop="endPoint">
|
||||
<el-input v-model="formData.endPoint" placeholder="请输入运输终点" />
|
||||
</el-form-item>
|
||||
<el-form-item label="运输介质">
|
||||
<el-input :model-value="transportMediumText" readonly placeholder="—" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" class="pl-arrange-remark-item">
|
||||
<el-input v-model="formData.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<el-form-item class="form-col-span-2 pl-arrange-dibang-item">
|
||||
<template #label>
|
||||
是否生成地磅计划
|
||||
<span v-if="plan.planType === 'direct'" class="form-label-tip">直销单不涉及地磅</span>
|
||||
</template>
|
||||
<div class="pl-arrange-dibang-row">
|
||||
<el-tooltip v-if="plan.planType === 'direct'" content="直销单不涉及地磅" placement="top">
|
||||
<el-checkbox v-model="formData.generateDibangPlan" disabled>生成地磅计划与出入库单</el-checkbox>
|
||||
</el-tooltip>
|
||||
<el-checkbox v-else v-model="formData.generateDibangPlan">生成地磅计划与出入库单</el-checkbox>
|
||||
<p v-if="showDibangHint" class="pl-arrange-dibang-hint">
|
||||
<template v-if="isRearrangeWithDibang">
|
||||
将作废本运输单此前待处理的出入库单,并按当前计划产品重新生成;已关联磅单或已完成的单据不会被自动作废,需先在地磅管理中处理。
|
||||
</template>
|
||||
<template v-else>
|
||||
将按当前计划产品生成地磅月计划(当月已有则复用)及待处理出入库单。
|
||||
</template>
|
||||
</p>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="pl-arrange-view-panel">
|
||||
<h3 class="pl-arrange-view-title">计划单查看</h3>
|
||||
<PlPlanViewTabs v-if="planId" ref="tabsRef" :plan-id="planId" embedded />
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<DbPoundSlipQrcodeDialog
|
||||
v-model:visible="qrcodeVisible"
|
||||
:inventory-id="selectedInventoryId"
|
||||
:quantity-unit="selectedInventoryUnit"
|
||||
ref="qrcodeDialogRef"
|
||||
/>
|
||||
|
||||
<template #footer>
|
||||
<div class="dialog-footer pl-arrange-footer">
|
||||
<template v-if="arrangeSuccess">
|
||||
<el-button @click="innerVisible = false">
|
||||
<el-icon><Close /></el-icon>关闭
|
||||
</el-button>
|
||||
<el-button
|
||||
@click="
|
||||
copyPlanSummary({
|
||||
startPoint: formData.startPoint,
|
||||
endPoint: formData.endPoint,
|
||||
licensePlate: vehicleList.find(v => v.id === formData.vehicleId)?.licensePlate,
|
||||
driverUrl: arrangeResult?.driverUrl
|
||||
})
|
||||
"
|
||||
>
|
||||
<el-icon><CopyDocument /></el-icon>复制计划简述
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="inventoryRecords.length > 0"
|
||||
type="primary"
|
||||
@click="copyPoundSlipQrcode()"
|
||||
>
|
||||
<el-icon><CopyDocument /></el-icon>复制磅单二维码
|
||||
</el-button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-button @click="innerVisible = false">
|
||||
<el-icon><Close /></el-icon>取消
|
||||
</el-button>
|
||||
<el-button type="primary" :loading="submitLoading" @click="handleSubmit">
|
||||
<el-icon><Check /></el-icon>确认安排
|
||||
</el-button>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Check, Close, CopyDocument } from '@element-plus/icons-vue'
|
||||
import {
|
||||
carrierApi,
|
||||
planApi,
|
||||
transportApi,
|
||||
vehicleApi,
|
||||
type Carrier,
|
||||
type Plan,
|
||||
type PlanProduct,
|
||||
type Transport,
|
||||
type TransportArrangeResult,
|
||||
type Vehicle,
|
||||
type VehicleDetail,
|
||||
type VehiclePersonnelRow
|
||||
} from '@/api/pl'
|
||||
import DbPoundSlipQrcodeDialog from '@/components/business/db/DbPoundSlipQrcodeDialog.vue'
|
||||
import PlPlanViewTabs from '@/components/business/pl-plan-view-tabs/index.vue'
|
||||
import type { PlanFormProductRow } from '@/composables/usePlContractToPlan'
|
||||
import { usePlFreightCalc } from '@/composables/usePlFreightCalc'
|
||||
import { buildMissingHazardCertMessage } from '@/composables/usePlToxicProductCertCheck'
|
||||
import { usePlPlanArrangeActions } from '@/composables/usePlPlanArrangeActions'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { pickBxData, pickBxList } from '@/utils/http/bx'
|
||||
|
||||
const SELF_CARRIER_NAME = '安庆市山峡化工有限公司'
|
||||
|
||||
const dictStore = useDictStore()
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean
|
||||
planId: string
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:visible': [value: boolean]
|
||||
success: []
|
||||
}>()
|
||||
|
||||
const innerVisible = computed({
|
||||
get: () => props.visible,
|
||||
set: value => emit('update:visible', value)
|
||||
})
|
||||
|
||||
const loading = ref(false)
|
||||
const submitLoading = ref(false)
|
||||
const vehicleLoading = ref(false)
|
||||
const arrangeSuccess = ref(false)
|
||||
const arrangeResult = ref<TransportArrangeResult | null>(null)
|
||||
const {
|
||||
driverUrl,
|
||||
inventoryRecords,
|
||||
qrcodeVisible,
|
||||
selectedInventoryId,
|
||||
selectedInventoryUnit,
|
||||
qrcodeDialogRef,
|
||||
resetArrangeActions,
|
||||
applyArrangeResult,
|
||||
copyDriverUrl,
|
||||
copyPlanSummary,
|
||||
copyPoundSlipQrcode
|
||||
} = usePlPlanArrangeActions()
|
||||
const tabsRef = ref<InstanceType<typeof PlPlanViewTabs> | null>(null)
|
||||
const formRef = ref()
|
||||
const plan = ref<Partial<Plan>>({})
|
||||
const products = ref<PlanProduct[]>([])
|
||||
const vehicleList = ref<Vehicle[]>([])
|
||||
const carrierList = ref<Carrier[]>([])
|
||||
const vehicleDriverList = ref<VehiclePersonnelRow[]>([])
|
||||
const prefilledDriverId = ref('')
|
||||
|
||||
const formData = reactive({
|
||||
vehicleId: '',
|
||||
driverId: '',
|
||||
carrierId: '',
|
||||
startPoint: '',
|
||||
endPoint: '',
|
||||
distanceKm: null as number | null,
|
||||
freightType: 'by_weight',
|
||||
hasInvoice: 0,
|
||||
remark: '',
|
||||
generateDibangPlan: false
|
||||
})
|
||||
|
||||
const formRules = {
|
||||
vehicleId: [{ required: true, message: '请选择车辆', trigger: 'change' }],
|
||||
driverId: [{ required: true, message: '请选择司机', trigger: 'change' }]
|
||||
}
|
||||
|
||||
const dialogTitle = computed(() =>
|
||||
plan.value.planNo ? `安排运输 · ${plan.value.planNo}` : '安排运输'
|
||||
)
|
||||
|
||||
function getUnitLabel(unit: string) {
|
||||
return dictStore.getLabel('crm_product_unit', unit) || unit
|
||||
}
|
||||
|
||||
function buildTransportMediumText(items: PlanProduct[]) {
|
||||
return items
|
||||
.map(p => {
|
||||
const name = p.productName?.trim()
|
||||
if (!name) return ''
|
||||
const model = (p.model || p.packageSpec || '').trim()
|
||||
const qty = p.quantity ?? p.inboundEstimateQty ?? p.outboundEstimateQty ?? ''
|
||||
const unit = getUnitLabel(p.unit || '吨')
|
||||
const detail = [model, qty, unit].filter(part => part !== '' && part != null).join('、')
|
||||
return detail ? `${name}(${detail})` : name
|
||||
})
|
||||
.filter(Boolean)
|
||||
.join(';')
|
||||
}
|
||||
|
||||
const transportMediumText = computed(() => buildTransportMediumText(products.value))
|
||||
|
||||
const productRows = computed<PlanFormProductRow[]>(() =>
|
||||
products.value.map((item, index) => ({
|
||||
productId: String(item.productId || index),
|
||||
productNo: item.productNo || String(item.productId || index),
|
||||
productName: item.productName || '',
|
||||
model: item.model,
|
||||
categoryName: item.categoryName,
|
||||
unit: item.unit || '吨',
|
||||
quantity: Number(item.quantity ?? item.inboundEstimateQty ?? item.outboundEstimateQty ?? 0),
|
||||
actualQty: Number(
|
||||
item.actualQty ?? item.quantity ?? item.inboundEstimateQty ?? item.outboundEstimateQty ?? 0
|
||||
),
|
||||
packageSpec: item.packageSpec,
|
||||
deliveryMethod: item.deliveryMethod,
|
||||
remark: item.remark,
|
||||
isExplosive: Number(item.isExplosive ?? 0),
|
||||
isToxic: Number(item.isToxic ?? 0)
|
||||
}))
|
||||
)
|
||||
|
||||
const hasFreightRef = computed(() => plan.value.hasFreight ?? 0)
|
||||
const freightTypeRef = computed(() => formData.freightType)
|
||||
const freightCalc = usePlFreightCalc({
|
||||
products: productRows,
|
||||
hasFreight: hasFreightRef,
|
||||
freightType: freightTypeRef
|
||||
})
|
||||
|
||||
const selectedVehicle = computed(() => vehicleList.value.find(item => item.id === formData.vehicleId))
|
||||
const isSelfVehicle = computed(() => selectedVehicle.value?.vehicleType === 'self')
|
||||
|
||||
const showDibangHint = computed(
|
||||
() => formData.generateDibangPlan && plan.value.planType && plan.value.planType !== 'direct'
|
||||
)
|
||||
|
||||
const isRearrangeWithDibang = computed(
|
||||
() => showDibangHint.value && Boolean(plan.value.transportId)
|
||||
)
|
||||
|
||||
function formatDriverLabel(d: VehiclePersonnelRow) {
|
||||
const phone = d.phoneNo ? ` (${d.phoneNo})` : ''
|
||||
return `${d.personnelName}${phone}`
|
||||
}
|
||||
|
||||
function resolveSelfCarrierId() {
|
||||
if (!Array.isArray(carrierList.value)) return
|
||||
const matched = carrierList.value.find(item => item.carrierName === SELF_CARRIER_NAME)
|
||||
formData.carrierId = matched?.id || formData.carrierId || ''
|
||||
}
|
||||
|
||||
function applyVehiclePersonnel(personnelList: VehiclePersonnelRow[], preferredDriverId?: string) {
|
||||
vehicleDriverList.value = personnelList.filter(p => p.role === 'driver' && p.personnelId)
|
||||
if (preferredDriverId && vehicleDriverList.value.some(d => d.personnelId === preferredDriverId)) {
|
||||
formData.driverId = preferredDriverId
|
||||
return
|
||||
}
|
||||
const defaultDriver = personnelList.find(p => p.role === 'driver' && p.isDefault === 1 && p.personnelId)
|
||||
if (defaultDriver?.personnelId) {
|
||||
formData.driverId = defaultDriver.personnelId
|
||||
} else if (vehicleDriverList.value.length === 1 && vehicleDriverList.value[0].personnelId) {
|
||||
formData.driverId = vehicleDriverList.value[0].personnelId
|
||||
} else {
|
||||
formData.driverId = ''
|
||||
}
|
||||
}
|
||||
|
||||
async function applyPrefillFromPlan(data: Plan) {
|
||||
formData.startPoint = data.pickupAddress || ''
|
||||
formData.endPoint = data.destinationAddress || data.destinationName || ''
|
||||
formData.remark = data.remark || ''
|
||||
formData.vehicleId = data.vehicleId || ''
|
||||
prefilledDriverId.value = data.driverId || ''
|
||||
|
||||
freightCalc.resetFreightCalc()
|
||||
if (data.freightAmount != null && data.hasFreight === 1) {
|
||||
freightCalc.freightAmount.value = Number(data.freightAmount)
|
||||
freightCalc.freightAmountTouched.value = true
|
||||
}
|
||||
|
||||
if (!data.transportId) return
|
||||
|
||||
try {
|
||||
const transportRes = await transportApi.get(data.transportId)
|
||||
const transport = pickBxData<Transport>(transportRes)
|
||||
formData.vehicleId = transport.vehicleId || formData.vehicleId
|
||||
formData.carrierId = transport.carrierId || ''
|
||||
formData.startPoint = transport.startPoint || formData.startPoint
|
||||
formData.endPoint = transport.endPoint || formData.endPoint
|
||||
formData.distanceKm = transport.distanceKm != null ? Number(transport.distanceKm) : null
|
||||
formData.freightType = transport.freightType || 'by_weight'
|
||||
formData.hasInvoice = transport.hasInvoice ?? 0
|
||||
formData.remark = transport.remark || formData.remark
|
||||
prefilledDriverId.value = transport.driverId || prefilledDriverId.value
|
||||
|
||||
if (transport.transportQty != null) {
|
||||
freightCalc.transportQty.value = Number(transport.transportQty)
|
||||
freightCalc.transportQtyTouched.value = true
|
||||
}
|
||||
if (transport.freightPrice != null) {
|
||||
freightCalc.freightPrice.value = Number(transport.freightPrice)
|
||||
}
|
||||
if (transport.freightAmount != null) {
|
||||
freightCalc.freightAmount.value = Number(transport.freightAmount)
|
||||
freightCalc.freightAmountTouched.value = true
|
||||
}
|
||||
} catch {
|
||||
// 草稿运输单不存在时,回退到计划主表冗余字段
|
||||
}
|
||||
}
|
||||
|
||||
function resetState() {
|
||||
arrangeSuccess.value = false
|
||||
arrangeResult.value = null
|
||||
resetArrangeActions()
|
||||
plan.value = {}
|
||||
products.value = []
|
||||
vehicleDriverList.value = []
|
||||
prefilledDriverId.value = ''
|
||||
Object.assign(formData, {
|
||||
vehicleId: '',
|
||||
driverId: '',
|
||||
carrierId: '',
|
||||
startPoint: '',
|
||||
endPoint: '',
|
||||
distanceKm: null,
|
||||
freightType: 'by_weight',
|
||||
hasInvoice: 0,
|
||||
remark: '',
|
||||
generateDibangPlan: false
|
||||
})
|
||||
freightCalc.resetFreightCalc()
|
||||
formRef.value?.clearValidate()
|
||||
}
|
||||
|
||||
async function loadMasterData() {
|
||||
const [vehicleRes, carrierRes] = await Promise.all([
|
||||
vehicleApi.list({ vehicleStatus: 'available' }),
|
||||
carrierApi.list({ status: '1' })
|
||||
])
|
||||
vehicleList.value = pickBxList<Vehicle>(vehicleRes)
|
||||
carrierList.value = pickBxList<Carrier>(carrierRes)
|
||||
}
|
||||
|
||||
async function handleVehicleChange(vehicleId: string, preferredDriverId?: string) {
|
||||
if (!vehicleId) {
|
||||
formData.driverId = ''
|
||||
formData.carrierId = ''
|
||||
vehicleDriverList.value = []
|
||||
return
|
||||
}
|
||||
|
||||
const vehicle = Array.isArray(vehicleList.value)
|
||||
? vehicleList.value.find(v => v.id === vehicleId)
|
||||
: undefined
|
||||
if (vehicle?.vehicleType === 'self') {
|
||||
resolveSelfCarrierId()
|
||||
} else if (vehicle?.carrierId) {
|
||||
formData.carrierId = vehicle.carrierId
|
||||
}
|
||||
|
||||
if (!formData.startPoint && vehicle?.carrierName) {
|
||||
formData.startPoint = vehicle.carrierName
|
||||
}
|
||||
|
||||
vehicleLoading.value = true
|
||||
try {
|
||||
const res = await vehicleApi.get(vehicleId)
|
||||
const detail = pickBxData<VehicleDetail>(res)
|
||||
if (detail?.vehicleType === 'self') {
|
||||
resolveSelfCarrierId()
|
||||
}
|
||||
applyVehiclePersonnel(detail?.personnelList || [], preferredDriverId)
|
||||
} finally {
|
||||
vehicleLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleOpened() {
|
||||
if (!props.planId) return
|
||||
loading.value = true
|
||||
resetState()
|
||||
try {
|
||||
await loadMasterData()
|
||||
const res = await planApi.get(props.planId)
|
||||
const data = pickBxData<Plan>(res)
|
||||
if (!data?.id) {
|
||||
throw new Error('运输计划数据无效')
|
||||
}
|
||||
plan.value = data
|
||||
products.value = Array.isArray(data.products) ? data.products : []
|
||||
await applyPrefillFromPlan(data)
|
||||
if (formData.vehicleId) {
|
||||
await handleVehicleChange(formData.vehicleId, prefilledDriverId.value || data.driverId)
|
||||
}
|
||||
} catch (error) {
|
||||
innerVisible.value = false
|
||||
const message = error instanceof Error ? error.message : '加载运输计划失败'
|
||||
ElMessage.error(message.includes('加载') ? message : `加载运输计划失败:${message}`)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleClosed() {
|
||||
resetState()
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
const valid = await formRef.value?.validate().catch(() => false)
|
||||
if (!valid) return
|
||||
|
||||
const certMessage = buildMissingHazardCertMessage(products.value)
|
||||
if (certMessage) {
|
||||
await ElMessageBox.alert(`${certMessage}。请先上传购买证和运输证。`, '无法安排运输', {
|
||||
type: 'warning'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
submitLoading.value = true
|
||||
try {
|
||||
if (formData.generateDibangPlan && plan.value.transportId) {
|
||||
await ElMessageBox.confirm(
|
||||
'将作废本运输单此前待处理的出入库单,并按当前计划产品重新生成。已执行或已关联磅单的单据不会被自动作废。是否继续?',
|
||||
'地磅联动确认',
|
||||
{
|
||||
type: 'warning',
|
||||
confirmButtonText: '继续安排',
|
||||
cancelButtonText: '取消'
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
const payload = {
|
||||
vehicleId: formData.vehicleId,
|
||||
driverId: formData.driverId,
|
||||
carrierId: formData.carrierId || undefined,
|
||||
startPoint: formData.startPoint || undefined,
|
||||
endPoint: formData.endPoint || undefined,
|
||||
transportMedium: transportMediumText.value || undefined,
|
||||
distanceKm: formData.distanceKm ?? undefined,
|
||||
freightType: formData.freightType,
|
||||
freightPrice:
|
||||
formData.freightType === 'by_weight' ? freightCalc.freightPrice.value ?? undefined : undefined,
|
||||
freightAmount:
|
||||
plan.value.hasFreight === 1
|
||||
? freightCalc.calculatedFreight.value || freightCalc.freightAmount.value || undefined
|
||||
: undefined,
|
||||
hasInvoice: formData.hasInvoice,
|
||||
remark: formData.remark || undefined,
|
||||
generateDibangPlan: formData.generateDibangPlan
|
||||
}
|
||||
|
||||
const res = await transportApi.arrange(props.planId, payload)
|
||||
const result = pickBxData<TransportArrangeResult>(res)
|
||||
arrangeResult.value = result
|
||||
applyArrangeResult(result, plan.value, products.value)
|
||||
arrangeSuccess.value = true
|
||||
ElMessage.success('运输安排成功')
|
||||
tabsRef.value?.reload()
|
||||
emit('success')
|
||||
} catch (e: unknown) {
|
||||
if (e === 'cancel') return
|
||||
const message = e instanceof Error ? e.message : '安排失败'
|
||||
ElMessage.error(message)
|
||||
} finally {
|
||||
submitLoading.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.pl-arrange-layout {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
min-height: 480px;
|
||||
}
|
||||
|
||||
.pl-arrange-form-panel {
|
||||
flex: 0 0 auto;
|
||||
max-height: 42vh;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.pl-arrange-form-scroll {
|
||||
max-height: 42vh;
|
||||
overflow-y: auto;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
.pl-arrange-view-panel {
|
||||
flex: 1 1 auto;
|
||||
min-height: 280px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
padding: 12px 16px 16px;
|
||||
}
|
||||
|
||||
.pl-arrange-view-title {
|
||||
margin: 0 0 12px;
|
||||
padding-left: 10px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
border-left: 3px solid #10b981;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.pl-plan-form-section {
|
||||
padding: 16px;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.pl-plan-form-section-title {
|
||||
margin: 0 0 12px;
|
||||
padding-left: 10px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
border-left: 3px solid #10b981;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.pl-arrange-dibang-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.pl-arrange-dibang-hint {
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.pl-arrange-remark-item {
|
||||
grid-column: span 2;
|
||||
}
|
||||
|
||||
.pl-arrange-success {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.pl-arrange-link-row {
|
||||
display: grid;
|
||||
grid-template-columns: 72px 1fr auto;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.pl-arrange-link-label {
|
||||
font-size: 13px;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.pl-arrange-footer {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
.el-dialog.pl-plan-arrange-dialog.dialog-form-layout {
|
||||
width: min(1680px, calc(100vw - 80px)) !important;
|
||||
max-height: calc(100vh - 48px);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,209 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visibleProxy"
|
||||
title="上传易制毒/易制爆证书"
|
||||
width="min(960px, calc(100vw - 80px))"
|
||||
align-center
|
||||
destroy-on-close
|
||||
append-to-body
|
||||
class="dialog-form-layout pl-plan-cert-upload-dialog"
|
||||
@closed="handleClosed"
|
||||
>
|
||||
<div v-loading="loading" class="pl-plan-cert-upload-body">
|
||||
<p v-if="planBrief.planNo" class="plan-brief">
|
||||
计划编号:<strong>{{ planBrief.planNo }}</strong>
|
||||
<span v-if="planBrief.customerName"> · {{ planBrief.customerName }}</span>
|
||||
</p>
|
||||
|
||||
<el-alert
|
||||
type="info"
|
||||
:closable="false"
|
||||
show-icon
|
||||
title="易制毒或易制爆产品须上传购买证、运输证;安排运输时将校验是否齐全。"
|
||||
class="cert-tip"
|
||||
/>
|
||||
|
||||
<el-empty v-if="!loading && !hazardProducts.length" description="该计划暂无易制毒/易制爆产品" />
|
||||
|
||||
<div v-for="item in hazardProducts" :key="item.id" class="product-cert-block">
|
||||
<div class="product-cert-head">
|
||||
<span class="product-name">{{ item.productName }}</span>
|
||||
<el-tag v-if="item.isExplosive" type="danger" size="small">易制爆</el-tag>
|
||||
<el-tag v-if="item.isToxic" type="warning" size="small">易制毒</el-tag>
|
||||
</div>
|
||||
<div class="form-grid-2 product-cert-grid">
|
||||
<el-form-item label="购买证" required>
|
||||
<AttachmentUploadField
|
||||
v-model="item.purchaseCertUrl"
|
||||
folder="pl/plan-cert"
|
||||
:limit="1"
|
||||
hint="支持图片、PDF 等,上传购买证"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="运输证" required>
|
||||
<AttachmentUploadField
|
||||
v-model="item.transportCertUrl"
|
||||
folder="pl/plan-cert"
|
||||
:limit="1"
|
||||
hint="支持图片、PDF 等,上传运输证"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="visibleProxy = false">
|
||||
<el-icon><Close /></el-icon>取消
|
||||
</el-button>
|
||||
<el-button type="primary" :loading="submitLoading" :disabled="!hazardProducts.length" @click="handleSubmit">
|
||||
<el-icon><Check /></el-icon>保存
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Check, Close } from '@element-plus/icons-vue'
|
||||
import { planApi, type Plan, type PlanProduct } from '@/api/pl'
|
||||
import AttachmentUploadField from '@/components/business/attachment-upload-field/index.vue'
|
||||
import { isHazardProduct } from '@/composables/usePlToxicProductCertCheck'
|
||||
|
||||
type HazardProductRow = PlanProduct & {
|
||||
purchaseCertUrl?: string
|
||||
transportCertUrl?: string
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean
|
||||
planId: string
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:visible': [value: boolean]
|
||||
success: []
|
||||
}>()
|
||||
|
||||
const visibleProxy = computed({
|
||||
get: () => props.visible,
|
||||
set: (val: boolean) => emit('update:visible', val)
|
||||
})
|
||||
|
||||
const loading = ref(false)
|
||||
const submitLoading = ref(false)
|
||||
const planBrief = reactive({ planNo: '', customerName: '' })
|
||||
const hazardProducts = ref<HazardProductRow[]>([])
|
||||
|
||||
watch(
|
||||
() => [props.visible, props.planId] as const,
|
||||
([open, planId]) => {
|
||||
if (open && planId) {
|
||||
loadPlan(planId)
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
async function loadPlan(planId: string) {
|
||||
loading.value = true
|
||||
hazardProducts.value = []
|
||||
planBrief.planNo = ''
|
||||
planBrief.customerName = ''
|
||||
try {
|
||||
const res = await planApi.get(planId)
|
||||
const data = (res.data ?? res) as Plan
|
||||
planBrief.planNo = data.planNo || ''
|
||||
planBrief.customerName = data.customerName || ''
|
||||
hazardProducts.value = (data.products || [])
|
||||
.filter(p => isHazardProduct(p))
|
||||
.map(p => ({
|
||||
...p,
|
||||
purchaseCertUrl: p.purchaseCertUrl || '',
|
||||
transportCertUrl: p.transportCertUrl || ''
|
||||
}))
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
if (!props.planId || !hazardProducts.value.length) return
|
||||
|
||||
const incomplete = hazardProducts.value.filter(
|
||||
p => !p.purchaseCertUrl?.trim() || !p.transportCertUrl?.trim()
|
||||
)
|
||||
if (incomplete.length) {
|
||||
ElMessage.warning('请为每个危化品产品上传购买证和运输证')
|
||||
return
|
||||
}
|
||||
|
||||
submitLoading.value = true
|
||||
try {
|
||||
await planApi.updateProductCerts(
|
||||
props.planId,
|
||||
hazardProducts.value.map(p => ({
|
||||
id: p.id,
|
||||
purchaseCertUrl: p.purchaseCertUrl?.trim() || '',
|
||||
transportCertUrl: p.transportCertUrl?.trim() || ''
|
||||
}))
|
||||
)
|
||||
ElMessage.success('证书保存成功')
|
||||
visibleProxy.value = false
|
||||
emit('success')
|
||||
} finally {
|
||||
submitLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleClosed() {
|
||||
hazardProducts.value = []
|
||||
planBrief.planNo = ''
|
||||
planBrief.customerName = ''
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.pl-plan-cert-upload-body {
|
||||
min-height: 120px;
|
||||
}
|
||||
|
||||
.plan-brief {
|
||||
margin: 0 0 12px;
|
||||
color: var(--mint-text);
|
||||
font-size: 14px;
|
||||
|
||||
strong {
|
||||
color: var(--text, #1e293b);
|
||||
}
|
||||
}
|
||||
|
||||
.cert-tip {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.product-cert-block {
|
||||
padding: 16px;
|
||||
margin-bottom: 12px;
|
||||
border: 1px solid var(--border, #d9e8e2);
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.product-cert-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.product-name {
|
||||
font-weight: 600;
|
||||
color: var(--text, #1e293b);
|
||||
}
|
||||
|
||||
.product-cert-grid {
|
||||
:deep(.el-form-item) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,112 @@
|
||||
<template>
|
||||
<div class="panel dialog-list-panel pl-plan-product-table-wrap">
|
||||
<div class="list-body list-wrap dialog-list-body-only">
|
||||
<el-table :data="products" stripe class="list-table pl-plan-product-table" empty-text="暂无产品">
|
||||
<el-table-column label="序号" type="index" min-width="60" align="center" header-align="center" />
|
||||
<el-table-column label="产品名称" min-width="140" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<PlProductNameHazardCell :product="row" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="型号/规格" min-width="120" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ row.model || row.productModel || '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="categoryName" label="产品分类" min-width="110" show-overflow-tooltip />
|
||||
<el-table-column label="税率(%)" min-width="90" align="center">
|
||||
<template #default="{ row }">{{ row.taxRate ?? 0 }}%</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位" min-width="80" align="center">
|
||||
<template #default="{ row }">
|
||||
<DictTag dict-type="crm_product_unit" :value="row.unit" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="计划数量" min-width="110" align="right">
|
||||
<template #default="{ row }">
|
||||
<el-input-number
|
||||
v-if="editableQty"
|
||||
v-model="row.quantity"
|
||||
:min="0"
|
||||
:precision="3"
|
||||
:controls="false"
|
||||
style="width: 100%"
|
||||
/>
|
||||
<span v-else>{{ row.quantity ?? '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="实际数量" min-width="110" align="right">
|
||||
<template #default="{ row }">
|
||||
<el-input-number
|
||||
v-if="editableQty"
|
||||
v-model="row.actualQty"
|
||||
:min="0"
|
||||
:precision="3"
|
||||
:controls="false"
|
||||
style="width: 100%"
|
||||
/>
|
||||
<span v-else>{{ row.actualQty ?? '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="含税单价(元)" min-width="120" align="right">
|
||||
<template #default="{ row }">{{ formatMoneyDisplay(row.taxPrice) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="含税总价(元)" min-width="120" align="right">
|
||||
<template #default="{ row }">{{ formatMoneyDisplay(row.taxSubtotal) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="税费(元)" min-width="100" align="right">
|
||||
<template #default="{ row }">{{ formatMoneyDisplay(row.taxAmount) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="packageSpec" label="包装规格" min-width="110" show-overflow-tooltip />
|
||||
<el-table-column label="送货方式" min-width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag size="small" type="info">{{ getDeliveryMethodLabel(row.deliveryMethod) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="editableRemark" label="备注" min-width="140">
|
||||
<template #default="{ row }">
|
||||
<el-input v-model="row.remark" placeholder="备注" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-else prop="remark" label="备注" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column v-if="showDelete" label="操作" min-width="80" align="center" fixed="right">
|
||||
<template #default="{ $index }">
|
||||
<el-button link type="danger" @click="emit('remove', $index)">
|
||||
<el-icon><Delete /></el-icon>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Delete } from '@element-plus/icons-vue'
|
||||
import type { PlanFormProductRow } from '@/composables/usePlContractToPlan'
|
||||
import { getDeliveryMethodLabel } from '@/composables/usePlContractToPlan'
|
||||
import PlProductNameHazardCell from '@/components/business/pl-product-name-hazard-cell/index.vue'
|
||||
import DictTag from '@/components/DictTag/index.vue'
|
||||
import { formatMoneyDisplay } from '@/utils/money-format'
|
||||
|
||||
defineProps<{
|
||||
products: PlanFormProductRow[]
|
||||
showDelete?: boolean
|
||||
editableRemark?: boolean
|
||||
editableQty?: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
remove: [index: number]
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.pl-plan-product-table-wrap {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.dialog-list-body-only {
|
||||
margin-top: 0;
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,140 @@
|
||||
<template>
|
||||
<div v-if="hazardProducts.length" class="pl-plan-list-cert-cell">
|
||||
<div
|
||||
v-for="(product, index) in hazardProducts"
|
||||
:key="product.id || `${product.productNo}-${index}`"
|
||||
class="pl-plan-list-cert-cell__group"
|
||||
>
|
||||
<div class="pl-plan-list-cert-cell__product">
|
||||
<span class="pl-plan-list-cert-cell__name">{{ product.productName || '—' }}</span>
|
||||
<el-tag v-if="product.isToxic" type="warning" size="small">易制毒</el-tag>
|
||||
<el-tag v-if="product.isExplosive" type="danger" size="small">易制爆</el-tag>
|
||||
</div>
|
||||
<div class="pl-plan-list-cert-cell__certs">
|
||||
<div class="pl-plan-list-cert-cell__cert-item">
|
||||
<AttachmentUploadField
|
||||
v-if="product.purchaseCertUrl"
|
||||
:model-value="product.purchaseCertUrl"
|
||||
disabled
|
||||
/>
|
||||
<span v-else class="pl-plan-list-cert-cell__missing">未上传</span>
|
||||
<span class="pl-plan-list-cert-cell__cert-label">购买证</span>
|
||||
</div>
|
||||
<div class="pl-plan-list-cert-cell__cert-item">
|
||||
<AttachmentUploadField
|
||||
v-if="product.transportCertUrl"
|
||||
:model-value="product.transportCertUrl"
|
||||
disabled
|
||||
/>
|
||||
<span v-else class="pl-plan-list-cert-cell__missing">未上传</span>
|
||||
<span class="pl-plan-list-cert-cell__cert-label">运输证</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<span v-else class="pl-plan-list-cert-cell__empty">—</span>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import type { PlanProduct } from '@/api/pl'
|
||||
import AttachmentUploadField from '@/components/business/attachment-upload-field/index.vue'
|
||||
import { isHazardProduct } from '@/composables/usePlToxicProductCertCheck'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
products?: PlanProduct[]
|
||||
}>(),
|
||||
{
|
||||
products: () => []
|
||||
}
|
||||
)
|
||||
|
||||
const hazardProducts = computed(() => (props.products || []).filter(product => isHazardProduct(product)))
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.pl-plan-list-cert-cell {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.pl-plan-list-cert-cell__group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.pl-plan-list-cert-cell__product {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.pl-plan-list-cert-cell__name {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: var(--text, #1e293b);
|
||||
}
|
||||
|
||||
.pl-plan-list-cert-cell__certs {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.pl-plan-list-cert-cell__cert-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
width: 96px;
|
||||
}
|
||||
|
||||
.pl-plan-list-cert-cell__cert-label {
|
||||
color: var(--mint-text);
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pl-plan-list-cert-cell__missing {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 96px;
|
||||
height: 56px;
|
||||
border: 1px dashed var(--border, #d9e8e2);
|
||||
border-radius: 8px;
|
||||
background: var(--table-head, #f8fafc);
|
||||
color: var(--mint-text);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.pl-plan-list-cert-cell__empty {
|
||||
color: var(--mint-text);
|
||||
}
|
||||
|
||||
:deep(.attachment-upload) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
:deep(.attachment-list) {
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
:deep(.attachment-item) {
|
||||
width: 96px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
:deep(.attachment-preview) {
|
||||
height: 56px;
|
||||
}
|
||||
|
||||
:deep(.attachment-footer) {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,91 @@
|
||||
<template>
|
||||
<div v-if="products.length" class="pl-plan-list-product-cell">
|
||||
<div
|
||||
v-for="(product, index) in products"
|
||||
:key="product.id || `${product.productNo}-${index}`"
|
||||
class="pl-plan-list-product-cell__row"
|
||||
>
|
||||
<span class="pl-plan-list-product-cell__line">
|
||||
<span class="pl-plan-list-product-cell__text">{{ formatProductLine(product) }}</span>
|
||||
<el-tag v-if="getHazardFlags(product).isToxic" type="warning" size="small" class="pl-plan-list-product-cell__mark">
|
||||
毒
|
||||
</el-tag>
|
||||
<el-tag
|
||||
v-if="getHazardFlags(product).isExplosive"
|
||||
type="danger"
|
||||
size="small"
|
||||
class="pl-plan-list-product-cell__mark"
|
||||
>
|
||||
爆
|
||||
</el-tag>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<span v-else class="pl-plan-list-product-cell__empty">—</span>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { PlanProduct } from '@/api/pl'
|
||||
import { resolveProductHazardFlags } from '@/composables/usePlToxicProductCertCheck'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { formatPlanProductListText } from '@/utils/pl-display'
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
products?: PlanProduct[]
|
||||
}>(),
|
||||
{
|
||||
products: () => []
|
||||
}
|
||||
)
|
||||
|
||||
const dictStore = useDictStore()
|
||||
|
||||
function getUnitLabel(unit: string) {
|
||||
return dictStore.getLabel('crm_product_unit', unit)
|
||||
}
|
||||
|
||||
function formatProductLine(product: PlanProduct) {
|
||||
return formatPlanProductListText(product, getUnitLabel)
|
||||
}
|
||||
|
||||
function getHazardFlags(product: PlanProduct) {
|
||||
return resolveProductHazardFlags(product)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.pl-plan-list-product-cell {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.pl-plan-list-product-cell__row {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.pl-plan-list-product-cell__line {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
max-width: 100%;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
color: var(--text, #1e293b);
|
||||
}
|
||||
|
||||
.pl-plan-list-product-cell__text {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.pl-plan-list-product-cell__mark {
|
||||
flex-shrink: 0;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.pl-plan-list-product-cell__empty {
|
||||
color: var(--mint-text);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,157 @@
|
||||
<!-- eslint-disable vue/no-v-model-argument -->
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="innerVisible"
|
||||
:title="dialogTitle"
|
||||
width="1680px"
|
||||
align-center
|
||||
destroy-on-close
|
||||
append-to-body
|
||||
class="dialog-form-layout pl-plan-view-dialog"
|
||||
modal-class="order-module-dialog-mask"
|
||||
style="backdrop-filter: none"
|
||||
@closed="handleClosed"
|
||||
@opened="handleOpened"
|
||||
>
|
||||
<section v-if="showArrangeActions" class="pl-plan-arrange-summary">
|
||||
<h3 class="pl-plan-arrange-summary-title">运输安排结果</h3>
|
||||
<div class="pl-arrange-link-row">
|
||||
<span class="pl-arrange-link-label">司机链接</span>
|
||||
<el-input :model-value="driverUrl" readonly />
|
||||
<el-button @click="copyDriverUrl()">
|
||||
<el-icon><CopyDocument /></el-icon>复制链接
|
||||
</el-button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<PlPlanViewTabs v-if="planId" ref="tabsRef" :plan-id="planId" />
|
||||
|
||||
<DbPoundSlipQrcodeDialog
|
||||
v-model:visible="qrcodeVisible"
|
||||
:inventory-id="selectedInventoryId"
|
||||
:quantity-unit="selectedInventoryUnit"
|
||||
ref="qrcodeDialogRef"
|
||||
/>
|
||||
|
||||
<template #footer>
|
||||
<div class="dialog-footer pl-plan-view-footer">
|
||||
<template v-if="showArrangeActions">
|
||||
<el-button @click="copyPlanSummary()">
|
||||
<el-icon><CopyDocument /></el-icon>复制计划简述
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="inventoryRecords.length > 0"
|
||||
type="primary"
|
||||
@click="copyPoundSlipQrcode()"
|
||||
>
|
||||
<el-icon><CopyDocument /></el-icon>复制磅单二维码
|
||||
</el-button>
|
||||
</template>
|
||||
<el-button @click="innerVisible = false">
|
||||
<el-icon><Close /></el-icon>关闭
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Close, CopyDocument } from '@element-plus/icons-vue'
|
||||
import { planApi } from '@/api/pl'
|
||||
import DbPoundSlipQrcodeDialog from '@/components/business/db/DbPoundSlipQrcodeDialog.vue'
|
||||
import PlPlanViewTabs from '@/components/business/pl-plan-view-tabs/index.vue'
|
||||
import { usePlPlanArrangeActions } from '@/composables/usePlPlanArrangeActions'
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean
|
||||
planId?: string
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:visible': [value: boolean]
|
||||
}>()
|
||||
|
||||
const innerVisible = computed({
|
||||
get: () => props.visible,
|
||||
set: value => emit('update:visible', value)
|
||||
})
|
||||
|
||||
const tabsRef = ref<InstanceType<typeof PlPlanViewTabs> | null>(null)
|
||||
const planNo = ref('')
|
||||
|
||||
const {
|
||||
showArrangeActions,
|
||||
driverUrl,
|
||||
inventoryRecords,
|
||||
qrcodeVisible,
|
||||
selectedInventoryId,
|
||||
selectedInventoryUnit,
|
||||
qrcodeDialogRef,
|
||||
resetArrangeActions,
|
||||
loadArrangeActions,
|
||||
copyDriverUrl,
|
||||
copyPlanSummary,
|
||||
copyPoundSlipQrcode
|
||||
} = usePlPlanArrangeActions()
|
||||
|
||||
const dialogTitle = computed(() =>
|
||||
planNo.value ? `查看运输计划 · ${planNo.value}` : '查看运输计划'
|
||||
)
|
||||
|
||||
async function handleOpened() {
|
||||
if (!props.planId) return
|
||||
try {
|
||||
const res = await planApi.get(props.planId)
|
||||
const data = res.data ?? res
|
||||
planNo.value = data?.planNo || ''
|
||||
await loadArrangeActions(props.planId)
|
||||
} catch {
|
||||
innerVisible.value = false
|
||||
ElMessage.error('加载运输计划详情失败')
|
||||
}
|
||||
}
|
||||
|
||||
function handleClosed() {
|
||||
planNo.value = ''
|
||||
resetArrangeActions()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.pl-plan-view-footer {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.pl-plan-arrange-summary {
|
||||
margin-bottom: 12px;
|
||||
padding: 12px 16px;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 10px;
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.pl-plan-arrange-summary-title {
|
||||
margin: 0 0 10px;
|
||||
padding-left: 10px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
border-left: 3px solid #10b981;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.pl-arrange-link-row {
|
||||
display: grid;
|
||||
grid-template-columns: 72px 1fr auto;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.pl-arrange-link-label {
|
||||
font-size: 13px;
|
||||
color: #64748b;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,802 @@
|
||||
<!-- eslint-disable vue/no-v-model-argument -->
|
||||
<template>
|
||||
<div v-loading="loading" class="pl-plan-view-tabs" :class="{ 'is-embedded': embedded }">
|
||||
<el-tabs v-model="activeTab" class="pl-plan-view-tabs__nav">
|
||||
<el-tab-pane label="计划概况" name="overview">
|
||||
<section class="pl-plan-form-section">
|
||||
<h3 class="pl-plan-form-section-title">基础信息</h3>
|
||||
<dl class="pl-plan-kv-grid">
|
||||
<div class="pl-plan-kv">
|
||||
<dt>计划编号</dt>
|
||||
<dd>{{ plan?.planNo || '—' }}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>计划日期</dt>
|
||||
<dd>{{ plan?.planDate || '—' }}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>归属公司</dt>
|
||||
<dd>{{ getPlPlanCompanyLabel(plan?.belongsCompany) }}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>单据类型</dt>
|
||||
<dd>{{ getPlPlanTypeLabel(plan?.planType || '') }}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>跟进人</dt>
|
||||
<dd>{{ plan?.followUserName || '—' }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</section>
|
||||
|
||||
<section class="pl-plan-form-section">
|
||||
<h3 class="pl-plan-form-section-title">产品信息</h3>
|
||||
<p v-if="!productRows.length && !loading" class="pl-plan-form-empty-hint">暂无产品明细</p>
|
||||
<PlPlanFormProductTable v-else :products="productRows" />
|
||||
</section>
|
||||
|
||||
<section class="pl-plan-form-section">
|
||||
<h3 class="pl-plan-form-section-title">危化品证书信息</h3>
|
||||
<p v-if="!hazardProducts.length && !loading" class="pl-plan-form-empty-hint"
|
||||
>暂无易制毒/易制爆产品</p
|
||||
>
|
||||
<div v-for="item in hazardProducts" :key="item.id" class="pl-plan-cert-block">
|
||||
<div class="pl-plan-cert-head">
|
||||
<span class="pl-plan-cert-name">{{ item.productName }}</span>
|
||||
<el-tag v-if="item.isToxic" type="warning" size="small">易制毒</el-tag>
|
||||
<el-tag v-if="item.isExplosive" type="danger" size="small">易制爆</el-tag>
|
||||
</div>
|
||||
<dl class="pl-plan-kv-grid pl-plan-kv-grid-2 pl-plan-cert-grid">
|
||||
<div class="pl-plan-kv">
|
||||
<dt>购买证</dt>
|
||||
<dd>
|
||||
<AttachmentUploadField
|
||||
v-if="item.purchaseCertUrl"
|
||||
:model-value="item.purchaseCertUrl"
|
||||
disabled
|
||||
/>
|
||||
<span v-else>未上传</span>
|
||||
</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>运输证</dt>
|
||||
<dd>
|
||||
<AttachmentUploadField
|
||||
v-if="item.transportCertUrl"
|
||||
:model-value="item.transportCertUrl"
|
||||
disabled
|
||||
/>
|
||||
<span v-else>未上传</span>
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="pl-plan-form-section">
|
||||
<h3 class="pl-plan-form-section-title">备注</h3>
|
||||
<p class="pl-plan-view-remark">{{ plan?.remark || '—' }}</p>
|
||||
</section>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="运输信息" name="transport">
|
||||
<section class="pl-plan-form-section">
|
||||
<h3 class="pl-plan-form-section-title">运输信息</h3>
|
||||
<dl class="pl-plan-kv-grid">
|
||||
<div class="pl-plan-kv">
|
||||
<dt>车牌号</dt>
|
||||
<dd>{{ plan?.licensePlate || transport?.licensePlate || '—' }}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>运输公司</dt>
|
||||
<dd>{{ displayCarrierName || '—' }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
<div v-if="vehicleBundle" class="pl-plan-vehicle-detail">
|
||||
<PlVehicleViewPanel
|
||||
collapsible
|
||||
:default-expanded="false"
|
||||
:detail="vehicleBundle.detail"
|
||||
:personnel-list="vehicleBundle.personnelList"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="pl-plan-logistics-row">
|
||||
<div class="pl-plan-logistics-block">
|
||||
<h4 class="pl-plan-subtitle">取货信息</h4>
|
||||
<dl class="pl-plan-kv-grid pl-plan-kv-grid-2">
|
||||
<div class="pl-plan-kv pl-plan-kv-span">
|
||||
<dt>取货地址</dt>
|
||||
<dd>{{ plan?.pickupAddress || '—' }}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>取货时间</dt>
|
||||
<dd>{{ plan?.pickupTime || '—' }}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>注意事项</dt>
|
||||
<dd>{{ plan?.pickupNotes || '—' }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="pl-plan-flow-bridge" aria-hidden="true">
|
||||
<el-icon class="pl-plan-flow-bridge__arrow"><Right /></el-icon>
|
||||
</div>
|
||||
|
||||
<div class="pl-plan-logistics-block">
|
||||
<h4 class="pl-plan-subtitle">送货信息</h4>
|
||||
<dl class="pl-plan-kv-grid pl-plan-kv-grid-2">
|
||||
<div class="pl-plan-kv pl-plan-kv-span">
|
||||
<dt>送货地址</dt>
|
||||
<dd>{{ plan?.destinationAddress || plan?.destinationName || '—' }}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>送达时间</dt>
|
||||
<dd>{{ plan?.deliveryTime || '—' }}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>注意事项</dt>
|
||||
<dd>{{ plan?.destinationNotes || '—' }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4 class="pl-plan-subtitle">运费信息</h4>
|
||||
<dl class="pl-plan-kv-grid">
|
||||
<div class="pl-plan-kv">
|
||||
<dt>是否有运输费用</dt>
|
||||
<dd>{{ getPlYesNoLabel(plan?.hasFreight) }}</dd>
|
||||
</div>
|
||||
<template v-if="plan?.hasFreight === 1">
|
||||
<div class="pl-plan-kv">
|
||||
<dt>运输公里数</dt>
|
||||
<dd>{{ displayDistanceKm }}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>运费计算方式</dt>
|
||||
<dd>{{ getPlFreightTypeLabel(displayFreightType) }}</dd>
|
||||
</div>
|
||||
<div v-if="displayFreightType === 'by_weight'" class="pl-plan-kv">
|
||||
<dt>运输量(吨)</dt>
|
||||
<dd>{{ displayTransportQty }}</dd>
|
||||
</div>
|
||||
<div v-if="displayFreightType === 'by_weight'" class="pl-plan-kv">
|
||||
<dt>运输单价(元/吨)</dt>
|
||||
<dd class="money-display">{{ displayFreightPrice }}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>运费金额(元)</dt>
|
||||
<dd class="money-display">{{ displayFreightAmount }}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>是否开票</dt>
|
||||
<dd>{{ getPlYesNoLabel(transport?.hasInvoice) }}</dd>
|
||||
</div>
|
||||
</template>
|
||||
</dl>
|
||||
|
||||
<h4 class="pl-plan-subtitle">司机回传信息</h4>
|
||||
<p v-if="!hasDriverFeedback" class="pl-plan-form-empty-hint">暂无司机回传</p>
|
||||
<template v-else>
|
||||
<dl class="pl-plan-kv-grid">
|
||||
<div class="pl-plan-kv">
|
||||
<dt>回传时间</dt>
|
||||
<dd>{{ displayFeedbackTime }}</dd>
|
||||
</div>
|
||||
<div v-if="transport?.feedbackQty != null" class="pl-plan-kv">
|
||||
<dt>回传数量</dt>
|
||||
<dd>{{ transport?.feedbackQty }}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv pl-plan-kv-span">
|
||||
<dt>回传备注</dt>
|
||||
<dd class="pl-plan-view-remark">{{ transport?.feedbackRemark || '—' }}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv pl-plan-kv-span">
|
||||
<dt>回传附件</dt>
|
||||
<dd>
|
||||
<AttachmentUploadField
|
||||
v-if="feedbackImageCsv"
|
||||
:model-value="feedbackImageCsv"
|
||||
disabled
|
||||
/>
|
||||
<span v-else>—</span>
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</template>
|
||||
|
||||
<h4 class="pl-plan-subtitle">地磅单信息</h4>
|
||||
<p v-if="!dibangRows.length && !loading" class="pl-plan-form-empty-hint"
|
||||
>暂无关联地磅单</p
|
||||
>
|
||||
<div
|
||||
v-for="(row, idx) in dibangRows"
|
||||
:key="row.link.dbInventoryId || idx"
|
||||
class="pl-plan-dibang-block"
|
||||
>
|
||||
<div class="pl-plan-dibang-head">
|
||||
<span class="pl-plan-dibang-product">{{
|
||||
row.link.productName || row.inventory?.product || '—'
|
||||
}}</span>
|
||||
<el-tag
|
||||
v-if="row.inventory?.status"
|
||||
:type="inventoryStatusTagType(row.inventory.status)"
|
||||
size="small"
|
||||
>
|
||||
{{ row.inventory.status }}
|
||||
</el-tag>
|
||||
</div>
|
||||
|
||||
<dl class="pl-plan-kv-grid pl-plan-kv-grid-2">
|
||||
<div class="pl-plan-kv">
|
||||
<dt>出入库单号</dt>
|
||||
<dd>{{ row.inventory?.batchNo || row.link.batchNo || '—' }}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>业务类型</dt>
|
||||
<dd>
|
||||
<el-tag
|
||||
v-if="row.inventory?.businessType"
|
||||
:type="businessTypeTagType(row.inventory.businessType)"
|
||||
size="small"
|
||||
>
|
||||
{{ row.inventory.businessType }}
|
||||
</el-tag>
|
||||
<span v-else>—</span>
|
||||
</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>往来单位</dt>
|
||||
<dd>{{ row.inventory?.partnerCompany || '—' }}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>车牌号</dt>
|
||||
<dd>{{
|
||||
row.inventory?.vehicleNo || plan?.licensePlate || transport?.licensePlate || '—'
|
||||
}}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>产品</dt>
|
||||
<dd>{{ row.inventory?.product || row.link.productName || '—' }}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>数量(吨)</dt>
|
||||
<dd>{{ row.inventory?.quantity ?? '—' }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
<template v-if="row.weighing">
|
||||
<h5 class="pl-plan-dibang-weighing-title">地磅单</h5>
|
||||
<div class="view-subtable-wrap">
|
||||
<el-table :data="[row.weighing]" class="view-subtable list-table" stripe>
|
||||
<el-table-column
|
||||
prop="batchNo"
|
||||
label="出入库单号"
|
||||
min-width="130"
|
||||
align="center"
|
||||
/>
|
||||
<el-table-column prop="vehicleNo" label="车牌号" min-width="110" align="center" />
|
||||
<el-table-column
|
||||
prop="cargoName"
|
||||
label="货物名称"
|
||||
min-width="120"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
prop="businessType"
|
||||
label="业务类型"
|
||||
min-width="100"
|
||||
align="center"
|
||||
>
|
||||
<template #default="{ row: weighingRow }">
|
||||
<el-tag :type="businessTypeTagType(weighingRow.businessType)" size="small">
|
||||
{{ weighingRow.businessType }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="supplier"
|
||||
label="供货单位"
|
||||
min-width="140"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
prop="consignee"
|
||||
label="收货单位"
|
||||
min-width="140"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
prop="grossWeight"
|
||||
label="毛重(kg)"
|
||||
min-width="100"
|
||||
align="right"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="grossWeightTime"
|
||||
label="毛重时间"
|
||||
min-width="160"
|
||||
align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="tareWeight"
|
||||
label="皮重(kg)"
|
||||
min-width="100"
|
||||
align="right"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="tareWeightTime"
|
||||
label="皮重时间"
|
||||
min-width="160"
|
||||
align="center"
|
||||
/>
|
||||
<el-table-column prop="deduction" label="扣杂(kg)" min-width="100" align="right">
|
||||
<template #default="{ row: weighingRow }">
|
||||
{{ weighingRow.deduction ?? 0 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="netWeight"
|
||||
label="净重(kg)"
|
||||
min-width="100"
|
||||
align="right"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="remarks"
|
||||
label="备注"
|
||||
min-width="140"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
<p v-else class="pl-plan-form-empty-hint pl-plan-dibang-pending">尚未关联地磅单</p>
|
||||
</div>
|
||||
</section>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="合同信息" name="contract">
|
||||
<section class="pl-plan-form-section">
|
||||
<h3 class="pl-plan-form-section-title">合同信息</h3>
|
||||
<p v-if="!contractSnapshot" class="pl-plan-form-empty-hint">暂无关联合同信息</p>
|
||||
<template v-else>
|
||||
<dl class="pl-plan-kv-grid">
|
||||
<div class="pl-plan-kv">
|
||||
<dt>合同编号</dt>
|
||||
<dd>{{ contractSnapshot.contractNo || '—' }}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>合同名称</dt>
|
||||
<dd>{{ contractSnapshot.contractName || '—' }}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>签订日期</dt>
|
||||
<dd>{{ contractSnapshot.signDate || '—' }}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>合同有效期</dt>
|
||||
<dd
|
||||
>{{ contractSnapshot.startDate || '—' }} ~
|
||||
{{ contractSnapshot.endDate || '—' }}</dd
|
||||
>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>结算方式</dt>
|
||||
<dd>
|
||||
<DictTag
|
||||
v-if="contractSnapshot.settlementMethod"
|
||||
dict-type="crm_settlement_method"
|
||||
:value="contractSnapshot.settlementMethod"
|
||||
/>
|
||||
<span v-else>—</span>
|
||||
</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>合同金额</dt>
|
||||
<dd class="money-display">{{ formatMoneyDisplay(contractSnapshot.amount) }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
<div class="pl-plan-party-row">
|
||||
<div class="pl-plan-party-block">
|
||||
<h4 class="pl-plan-party-title">供方信息</h4>
|
||||
<dl class="pl-plan-kv-grid pl-plan-kv-grid-party">
|
||||
<div class="pl-plan-kv">
|
||||
<dt>名称</dt>
|
||||
<dd>{{ contractSnapshot.supplierName || contractSnapshot.partyA || '—' }}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>联系人</dt>
|
||||
<dd>{{ contractSnapshot.partyAContact || '—' }}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>电话</dt>
|
||||
<dd>{{ contractSnapshot.partyAMobile || '—' }}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv pl-plan-kv-span">
|
||||
<dt>地址</dt>
|
||||
<dd>{{ contractSnapshot.partyAAddress || '—' }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="pl-plan-flow-bridge" aria-hidden="true">
|
||||
<el-icon class="pl-plan-flow-bridge__arrow"><Right /></el-icon>
|
||||
</div>
|
||||
|
||||
<div class="pl-plan-party-block">
|
||||
<h4 class="pl-plan-party-title">需方信息</h4>
|
||||
<dl class="pl-plan-kv-grid pl-plan-kv-grid-party">
|
||||
<div class="pl-plan-kv">
|
||||
<dt>名称</dt>
|
||||
<dd>{{ contractSnapshot.customerName || contractSnapshot.partyB || '—' }}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>联系人</dt>
|
||||
<dd>{{
|
||||
contractSnapshot.partyBContact || contractSnapshot.contactName || '—'
|
||||
}}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv">
|
||||
<dt>电话</dt>
|
||||
<dd>{{
|
||||
contractSnapshot.partyBMobile || contractSnapshot.contactMobile || '—'
|
||||
}}</dd>
|
||||
</div>
|
||||
<div class="pl-plan-kv pl-plan-kv-span">
|
||||
<dt>地址</dt>
|
||||
<dd>{{ contractSnapshot.partyBAddress || '—' }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4 class="pl-plan-subtitle">合同产品预览</h4>
|
||||
<PlPlanFormProductTable :products="productRows" />
|
||||
</template>
|
||||
</section>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Right } from '@element-plus/icons-vue'
|
||||
import AttachmentUploadField from '@/components/business/attachment-upload-field/index.vue'
|
||||
import PlPlanFormProductTable from '@/components/business/pl-plan-form-dialog/PlPlanFormProductTable.vue'
|
||||
import PlVehicleViewPanel from '@/components/business/pl-vehicle-view-panel/index.vue'
|
||||
import DictTag from '@/components/DictTag/index.vue'
|
||||
import {
|
||||
businessTypeTagType,
|
||||
inventoryStatusTagType
|
||||
} from '@/components/business/db/db-related-view'
|
||||
import type { PlanFormProductRow } from '@/composables/usePlContractToPlan'
|
||||
import { mapPlanProductToFormRow, usePlPlanViewDetail } from '@/composables/usePlPlanViewDetail'
|
||||
import { isHazardProduct } from '@/composables/usePlToxicProductCertCheck'
|
||||
import { formatDateTime } from '@/utils/format'
|
||||
import {
|
||||
getPlFreightTypeLabel,
|
||||
getPlPlanCompanyLabel,
|
||||
getPlPlanTypeLabel,
|
||||
getPlYesNoLabel,
|
||||
parsePlFeedbackImages
|
||||
} from '@/utils/pl-display'
|
||||
import { formatMoneyDisplay } from '@/utils/money-format'
|
||||
import type { Transport } from '@/api/pl'
|
||||
|
||||
const SELF_CARRIER_NAME = '安庆市山峡化工有限公司'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
planId: string
|
||||
embedded?: boolean
|
||||
}>(),
|
||||
{ embedded: false }
|
||||
)
|
||||
|
||||
const activeTab = ref('overview')
|
||||
const {
|
||||
loading,
|
||||
plan,
|
||||
products,
|
||||
transport,
|
||||
vehicleBundle,
|
||||
contractSnapshot,
|
||||
dibangRows,
|
||||
loadDetail,
|
||||
resetDetail
|
||||
} = usePlPlanViewDetail()
|
||||
|
||||
const feedbackImageList = computed(() => parsePlFeedbackImages(transport.value?.feedbackImages))
|
||||
|
||||
const feedbackImageCsv = computed(() => feedbackImageList.value.join(','))
|
||||
|
||||
const hasDriverFeedback = computed(() =>
|
||||
Boolean(
|
||||
transport.value?.feedbackTime ||
|
||||
transport.value?.feedbackRemark ||
|
||||
feedbackImageList.value.length ||
|
||||
transport.value?.feedbackQty != null
|
||||
)
|
||||
)
|
||||
|
||||
const displayFeedbackTime = computed(() => formatDateTime(transport.value?.feedbackTime) || '—')
|
||||
|
||||
const displayCarrierName = computed(() => {
|
||||
if (transport.value?.carrierName) return transport.value.carrierName
|
||||
const vehicle = vehicleBundle.value?.detail
|
||||
if (vehicle?.carrierName) return vehicle.carrierName
|
||||
if (vehicle?.vehicleType === 'self') return SELF_CARRIER_NAME
|
||||
return ''
|
||||
})
|
||||
|
||||
const displayFreightType = computed(() => transport.value?.freightType || 'by_weight')
|
||||
|
||||
const displayDistanceKm = computed(() => {
|
||||
const km = transport.value?.distanceKm
|
||||
return km != null ? String(km) : '—'
|
||||
})
|
||||
|
||||
const displayTransportQty = computed(() => {
|
||||
const qty = (transport.value as Transport & { transportQty?: number })?.transportQty
|
||||
if (qty != null) return String(qty)
|
||||
if (!productRows.value.length) return '—'
|
||||
const sum = productRows.value.reduce(
|
||||
(total, item) => total + Number(item.actualQty ?? item.quantity ?? 0),
|
||||
0
|
||||
)
|
||||
return sum ? String(sum) : '—'
|
||||
})
|
||||
|
||||
const displayFreightPrice = computed(() => {
|
||||
const price = transport.value?.freightPrice
|
||||
return price != null ? formatMoneyDisplay(Number(price)) : '—'
|
||||
})
|
||||
|
||||
const displayFreightAmount = computed(() => {
|
||||
const amount = plan.value?.freightAmount ?? transport.value?.freightAmount
|
||||
return amount ? formatMoneyDisplay(Number(amount)) : '—'
|
||||
})
|
||||
|
||||
const productRows = computed<PlanFormProductRow[]>(() =>
|
||||
products.value.map((item, index) => mapPlanProductToFormRow(item, index))
|
||||
)
|
||||
|
||||
const hazardProducts = computed(() => products.value.filter((item) => isHazardProduct(item)))
|
||||
|
||||
watch(
|
||||
() => props.planId,
|
||||
async (planId) => {
|
||||
if (!planId) {
|
||||
resetDetail()
|
||||
return
|
||||
}
|
||||
await loadDetail(planId)
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
onUnmounted(() => {
|
||||
resetDetail()
|
||||
})
|
||||
|
||||
function reload() {
|
||||
if (props.planId) return loadDetail(props.planId)
|
||||
}
|
||||
|
||||
defineExpose({ reload })
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.pl-plan-view-tabs {
|
||||
min-height: 200px;
|
||||
|
||||
&.is-embedded {
|
||||
.pl-plan-form-section:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.pl-plan-view-tabs__nav :deep(.el-tabs__content) {
|
||||
max-height: min(52vh, 560px);
|
||||
overflow-y: auto;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
.pl-plan-form-section {
|
||||
padding: 16px;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
|
||||
& + & {
|
||||
margin-top: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.pl-plan-form-section-title {
|
||||
margin: 0 0 12px;
|
||||
padding-left: 10px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
border-left: 3px solid #10b981;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.pl-plan-subtitle {
|
||||
margin: 16px 0 10px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.pl-plan-form-empty-hint {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.pl-plan-view-remark {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #000;
|
||||
line-height: 1.5;
|
||||
word-break: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.pl-plan-kv-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 12px 20px;
|
||||
}
|
||||
|
||||
.pl-plan-kv-grid-2 {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.pl-plan-kv {
|
||||
min-width: 0;
|
||||
|
||||
dt {
|
||||
margin: 0 0 4px;
|
||||
font-size: 11px;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
word-break: break-word;
|
||||
}
|
||||
}
|
||||
|
||||
.pl-plan-kv-span {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.pl-plan-party-row,
|
||||
.pl-plan-logistics-row {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
gap: 0;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.pl-plan-party-row .pl-plan-party-block,
|
||||
.pl-plan-logistics-row .pl-plan-logistics-block {
|
||||
flex: 1 1 0;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.pl-plan-flow-bridge {
|
||||
flex: 0 0 72px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 8px;
|
||||
}
|
||||
|
||||
.pl-plan-flow-bridge__arrow {
|
||||
font-size: 28px;
|
||||
color: #10b981;
|
||||
}
|
||||
|
||||
.pl-plan-kv-grid-party {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.pl-plan-logistics-block,
|
||||
.pl-plan-party-block {
|
||||
padding: 12px;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.pl-plan-party-title {
|
||||
margin: 0 0 10px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.pl-plan-vehicle-detail {
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.pl-plan-cert-block {
|
||||
padding: 12px;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
|
||||
& + & {
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.pl-plan-cert-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.pl-plan-cert-name {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.money-display {
|
||||
color: #059669;
|
||||
}
|
||||
|
||||
.pl-plan-dibang-block {
|
||||
margin-top: 12px;
|
||||
padding: 12px;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
background: #f8fafc;
|
||||
|
||||
& + & {
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.pl-plan-dibang-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.pl-plan-dibang-product {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.pl-plan-dibang-weighing-title {
|
||||
margin: 12px 0 8px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.pl-plan-dibang-pending {
|
||||
margin: 8px 0 0;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<span class="pl-product-name-hazard">
|
||||
<span class="pl-product-name-hazard__name">{{ product.productName || '—' }}</span>
|
||||
<el-tag v-if="flags.isToxic" type="warning" size="small" class="pl-product-name-hazard__mark">毒</el-tag>
|
||||
<el-tag v-if="flags.isExplosive" type="danger" size="small" class="pl-product-name-hazard__mark">爆</el-tag>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { resolveProductHazardFlags } from '@/composables/usePlToxicProductCertCheck'
|
||||
|
||||
const props = defineProps<{
|
||||
product: {
|
||||
productName?: string
|
||||
isToxic?: number
|
||||
isExplosive?: number
|
||||
is_toxic?: number
|
||||
is_explosive?: number
|
||||
}
|
||||
}>()
|
||||
|
||||
const flags = computed(() => resolveProductHazardFlags(props.product))
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.pl-product-name-hazard {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.pl-product-name-hazard__name {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.pl-product-name-hazard__mark {
|
||||
flex-shrink: 0;
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,81 @@
|
||||
<template>
|
||||
<el-tabs v-model="activeTab" class="vehicle-detail-tabs">
|
||||
<el-tab-pane label="车辆证书" name="vehicle-cert">
|
||||
<PlCertViewList :cert-list="certList" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane
|
||||
v-for="(person, index) in personnelList"
|
||||
:key="getPersonKey(person, index)"
|
||||
:label="getPersonTabLabel(person)"
|
||||
:name="getPersonKey(person, index)"
|
||||
>
|
||||
<PersonnelViewPanel :person="person" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import PlCertViewList from '@/components/business/pl-cert-view-list/index.vue'
|
||||
import PersonnelViewPanel from '@/components/business/pl-vehicle-personnel-view-list/PersonnelViewPanel.vue'
|
||||
import type { CertRead } from '@/api/pl'
|
||||
import type { VehiclePersonnelViewRow } from '@/components/business/pl-vehicle-personnel-view-list/index.vue'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
certList?: CertRead[]
|
||||
personnelList?: VehiclePersonnelViewRow[]
|
||||
}>(),
|
||||
{
|
||||
certList: () => [],
|
||||
personnelList: () => []
|
||||
}
|
||||
)
|
||||
|
||||
const activeTab = ref('vehicle-cert')
|
||||
|
||||
function getPersonKey(person: VehiclePersonnelViewRow, index: number) {
|
||||
return `person-${person.personnelId || `${person.personnelName}-${index}`}`
|
||||
}
|
||||
|
||||
function getRoleLabel(role: string) {
|
||||
const map: Record<string, string> = {
|
||||
driver: '司机',
|
||||
escort: '押运员'
|
||||
}
|
||||
return map[role] || role
|
||||
}
|
||||
|
||||
function getPersonTabLabel(person: VehiclePersonnelViewRow) {
|
||||
const name = person.personnelName || '—'
|
||||
const role = getRoleLabel(person.role)
|
||||
return `${name}(${role})`
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.personnelList,
|
||||
list => {
|
||||
if (!list.length) {
|
||||
activeTab.value = 'vehicle-cert'
|
||||
return
|
||||
}
|
||||
if (activeTab.value === 'vehicle-cert') return
|
||||
const keys = list.map((person, index) => getPersonKey(person, index))
|
||||
if (!keys.includes(activeTab.value)) {
|
||||
activeTab.value = 'vehicle-cert'
|
||||
}
|
||||
},
|
||||
{ immediate: true, deep: true }
|
||||
)
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.vehicle-detail-tabs {
|
||||
:deep(.el-tabs__header) {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
:deep(.el-tabs__content) {
|
||||
padding-top: 4px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
<template>
|
||||
<div class="personnel-view-panel">
|
||||
<h4 v-if="showTitle" class="personnel-view-card-title">
|
||||
{{ person.personnelName || '—' }}
|
||||
<el-tag :type="getRoleTagType(person.role)" size="small">
|
||||
{{ getRoleLabel(person.role) }}
|
||||
</el-tag>
|
||||
<el-tag v-if="person.role === 'driver' && person.isDefault === 1" type="success" size="small">
|
||||
默认司机
|
||||
</el-tag>
|
||||
</h4>
|
||||
|
||||
<dl class="personnel-view-kv-grid">
|
||||
<div class="personnel-view-kv">
|
||||
<dt>手机号</dt>
|
||||
<dd>{{ person.phoneNo || '—' }}</dd>
|
||||
</div>
|
||||
<div class="personnel-view-kv">
|
||||
<dt>年龄</dt>
|
||||
<dd>{{ person.age ?? '—' }}</dd>
|
||||
</div>
|
||||
<div class="personnel-view-kv personnel-view-kv-span">
|
||||
<dt>备注</dt>
|
||||
<dd>{{ person.remark || '—' }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
<div class="personnel-certs-block">
|
||||
<p class="personnel-certs-title">人员证书</p>
|
||||
<PlCertViewList :cert-list="person.certList || []" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import PlCertViewList from '@/components/business/pl-cert-view-list/index.vue'
|
||||
import type { CertRead, VehiclePersonnelRow } from '@/api/pl'
|
||||
|
||||
type VehiclePersonnelViewRow = VehiclePersonnelRow & { certList?: CertRead[] }
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
person: VehiclePersonnelViewRow
|
||||
showTitle?: boolean
|
||||
}>(),
|
||||
{
|
||||
showTitle: false
|
||||
}
|
||||
)
|
||||
|
||||
function getRoleLabel(role: string) {
|
||||
const map: Record<string, string> = {
|
||||
driver: '司机',
|
||||
escort: '押运员'
|
||||
}
|
||||
return map[role] || role
|
||||
}
|
||||
|
||||
function getRoleTagType(role: string) {
|
||||
return role === 'driver' ? 'primary' : 'warning'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.personnel-view-card-title {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin: 0 0 12px;
|
||||
padding-left: 10px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
border-left: 3px solid #10b981;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.personnel-view-kv-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 12px 20px;
|
||||
margin: 0 0 12px;
|
||||
}
|
||||
|
||||
.personnel-view-kv {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.personnel-view-kv-span {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.personnel-certs-block {
|
||||
padding-top: 12px;
|
||||
border-top: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.personnel-certs-title {
|
||||
margin: 0 0 10px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.personnel-view-kv-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,122 @@
|
||||
<template>
|
||||
<div class="personnel-view-section">
|
||||
<p v-if="!personnelList.length" class="view-empty-hint">暂无关联人员</p>
|
||||
|
||||
<el-tabs
|
||||
v-else-if="layout === 'tabs'"
|
||||
v-model="activeTab"
|
||||
class="personnel-view-tabs"
|
||||
>
|
||||
<el-tab-pane
|
||||
v-for="(person, index) in personnelList"
|
||||
:key="getPersonKey(person, index)"
|
||||
:label="getTabLabel(person)"
|
||||
:name="getPersonKey(person, index)"
|
||||
>
|
||||
<PersonnelViewPanel :person="person" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
<div v-else class="personnel-view-list">
|
||||
<div
|
||||
v-for="(person, index) in personnelList"
|
||||
:key="getPersonKey(person, index)"
|
||||
class="personnel-view-card"
|
||||
>
|
||||
<PersonnelViewPanel :person="person" show-title />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import PersonnelViewPanel from './PersonnelViewPanel.vue'
|
||||
import type { CertRead, VehiclePersonnelRow } from '@/api/pl'
|
||||
|
||||
export interface VehiclePersonnelViewRow extends VehiclePersonnelRow {
|
||||
certList?: CertRead[]
|
||||
}
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
personnelList?: VehiclePersonnelViewRow[]
|
||||
layout?: 'list' | 'tabs'
|
||||
}>(),
|
||||
{
|
||||
personnelList: () => [],
|
||||
layout: 'list'
|
||||
}
|
||||
)
|
||||
|
||||
const activeTab = ref('')
|
||||
|
||||
function getPersonKey(person: VehiclePersonnelViewRow, index: number) {
|
||||
return person.personnelId || `${person.personnelName}-${index}`
|
||||
}
|
||||
|
||||
function getRoleLabel(role: string) {
|
||||
const map: Record<string, string> = {
|
||||
driver: '司机',
|
||||
escort: '押运员'
|
||||
}
|
||||
return map[role] || role
|
||||
}
|
||||
|
||||
function getTabLabel(person: VehiclePersonnelViewRow) {
|
||||
const name = person.personnelName || '—'
|
||||
const role = getRoleLabel(person.role)
|
||||
return `${name}(${role})`
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.personnelList,
|
||||
list => {
|
||||
if (props.layout !== 'tabs' || !list.length) {
|
||||
activeTab.value = ''
|
||||
return
|
||||
}
|
||||
const firstKey = getPersonKey(list[0], 0)
|
||||
if (!list.some((person, index) => getPersonKey(person, index) === activeTab.value)) {
|
||||
activeTab.value = firstKey
|
||||
}
|
||||
},
|
||||
{ immediate: true, deep: true }
|
||||
)
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.personnel-view-section {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.view-empty-hint {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
color: #1e293b;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.personnel-view-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.personnel-view-card {
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
padding: 14px 16px;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
.personnel-view-tabs {
|
||||
:deep(.el-tabs__header) {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
:deep(.el-tabs__content) {
|
||||
padding-top: 4px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,199 @@
|
||||
<template>
|
||||
<div class="vehicle-view-panel" :class="{ 'is-collapsible': collapsible }">
|
||||
<button
|
||||
v-if="collapsible"
|
||||
type="button"
|
||||
class="vehicle-view-collapse-trigger"
|
||||
:aria-expanded="expanded"
|
||||
@click="expanded = !expanded"
|
||||
>
|
||||
<span class="vehicle-view-collapse-title">车辆信息</span>
|
||||
<span v-if="!expanded && detail.licensePlate" class="vehicle-view-collapse-summary">
|
||||
{{ detail.licensePlate }}
|
||||
</span>
|
||||
<el-icon class="vehicle-view-collapse-icon" :class="{ 'is-expanded': expanded }">
|
||||
<ArrowDown />
|
||||
</el-icon>
|
||||
</button>
|
||||
|
||||
<div v-show="!collapsible || expanded" class="vehicle-view-panel-body">
|
||||
<section class="vehicle-view-section">
|
||||
<h4 v-if="!collapsible" class="vehicle-view-section-title">车辆信息</h4>
|
||||
<dl class="vehicle-view-kv-grid">
|
||||
<div class="vehicle-view-kv">
|
||||
<dt>车牌号</dt>
|
||||
<dd>{{ detail.licensePlate || '—' }}</dd>
|
||||
</div>
|
||||
<div class="vehicle-view-kv">
|
||||
<dt>车辆类型</dt>
|
||||
<dd>
|
||||
<el-tag :type="getPlVehicleTypeTagType(detail.vehicleType)" size="small">
|
||||
{{ getPlVehicleTypeLabel(detail.vehicleType) }}
|
||||
</el-tag>
|
||||
</dd>
|
||||
</div>
|
||||
<div class="vehicle-view-kv">
|
||||
<dt>承运商</dt>
|
||||
<dd>{{ detail.carrierName || '—' }}</dd>
|
||||
</div>
|
||||
<div class="vehicle-view-kv">
|
||||
<dt>载重(吨)</dt>
|
||||
<dd>{{ detail.loadCapacity ?? '—' }}</dd>
|
||||
</div>
|
||||
<div class="vehicle-view-kv">
|
||||
<dt>车辆状态</dt>
|
||||
<dd>
|
||||
<el-tag :type="getPlVehicleStatusTagType(detail.vehicleStatus)" size="small">
|
||||
{{ getPlVehicleStatusLabel(detail.vehicleStatus) }}
|
||||
</el-tag>
|
||||
</dd>
|
||||
</div>
|
||||
<div class="vehicle-view-kv">
|
||||
<dt>关联人员摘要</dt>
|
||||
<dd>{{ detail.personnelSummary || '—' }}</dd>
|
||||
</div>
|
||||
<div class="vehicle-view-kv vehicle-view-kv-span">
|
||||
<dt>备注</dt>
|
||||
<dd>{{ detail.remark || '—' }}</dd>
|
||||
</div>
|
||||
<div class="vehicle-view-kv">
|
||||
<dt>创建时间</dt>
|
||||
<dd>{{ formatDateTime(detail.createTime) }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</section>
|
||||
|
||||
<section class="vehicle-view-section">
|
||||
<PlVehicleCertPersonnelTabs
|
||||
:cert-list="detail.certList || []"
|
||||
:personnel-list="personnelList"
|
||||
/>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ArrowDown } from '@element-plus/icons-vue'
|
||||
import PlVehicleCertPersonnelTabs from '@/components/business/pl-vehicle-cert-personnel-tabs/index.vue'
|
||||
import type { VehiclePersonnelViewRow } from '@/components/business/pl-vehicle-personnel-view-list/index.vue'
|
||||
import type { VehicleDetail } from '@/api/pl'
|
||||
import { formatDateTime } from '@/utils/format'
|
||||
import {
|
||||
getPlVehicleStatusLabel,
|
||||
getPlVehicleStatusTagType,
|
||||
getPlVehicleTypeLabel,
|
||||
getPlVehicleTypeTagType
|
||||
} from '@/utils/pl-display'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
detail: VehicleDetail
|
||||
personnelList?: VehiclePersonnelViewRow[]
|
||||
collapsible?: boolean
|
||||
defaultExpanded?: boolean
|
||||
}>(),
|
||||
{
|
||||
personnelList: () => [],
|
||||
collapsible: false,
|
||||
defaultExpanded: false
|
||||
}
|
||||
)
|
||||
|
||||
const expanded = ref(props.defaultExpanded)
|
||||
|
||||
watch(
|
||||
() => props.defaultExpanded,
|
||||
value => {
|
||||
expanded.value = value
|
||||
}
|
||||
)
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.vehicle-view-panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.vehicle-view-collapse-trigger {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
background: #f8fafc;
|
||||
cursor: pointer;
|
||||
text-align: left;
|
||||
|
||||
&:hover {
|
||||
background: #f1f5f9;
|
||||
}
|
||||
}
|
||||
|
||||
.vehicle-view-collapse-title {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.vehicle-view-collapse-summary {
|
||||
font-size: 13px;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.vehicle-view-collapse-icon {
|
||||
margin-left: auto;
|
||||
color: #1e293b;
|
||||
transition: transform 0.2s ease;
|
||||
|
||||
&.is-expanded {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
}
|
||||
|
||||
.vehicle-view-panel-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.vehicle-view-section-title {
|
||||
margin: 0 0 12px;
|
||||
padding-left: 10px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
border-left: 3px solid #10b981;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.vehicle-view-kv-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 12px 20px;
|
||||
}
|
||||
|
||||
.vehicle-view-kv {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.vehicle-view-kv-span {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
@media (max-width: 1200px) {
|
||||
.vehicle-view-kv-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.vehicle-view-kv-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,128 @@
|
||||
<template>
|
||||
<dl class="view-kv-grid" :class="`view-kv-grid--cols-${columns}`">
|
||||
<div
|
||||
v-for="field in fields"
|
||||
:key="field.label"
|
||||
class="view-kv"
|
||||
:class="spanClass(field)"
|
||||
>
|
||||
<dt>{{ field.label }}</dt>
|
||||
<dd>
|
||||
<el-tag v-if="field.tagType" :type="field.tagType" size="small">{{
|
||||
formatViewValue(field.value)
|
||||
}}</el-tag>
|
||||
<ul v-else-if="field.items?.length" class="view-plain-list">
|
||||
<li v-for="(item, idx) in field.items" :key="idx">{{ item }}</li>
|
||||
</ul>
|
||||
<template v-else>
|
||||
<span :class="{ 'money-display': field.money }">{{
|
||||
formatViewValue(field.value)
|
||||
}}</span>
|
||||
</template>
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { ViewField } from './types'
|
||||
import { formatViewValue } from './types'
|
||||
import { getViewKvSpanClass } from '@/utils/view-field-layout'
|
||||
|
||||
const props = defineProps<{
|
||||
fields: ViewField[]
|
||||
columns: number
|
||||
}>()
|
||||
|
||||
function spanClass(field: ViewField) {
|
||||
return getViewKvSpanClass(field, props.columns, formatViewValue)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.view-kv-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 12px 18px;
|
||||
|
||||
&--cols-1 {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
&--cols-3 {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
&--cols-4 {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
.view-kv {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
min-width: 0;
|
||||
font-size: 13px;
|
||||
align-items: stretch;
|
||||
|
||||
dt {
|
||||
margin: 0;
|
||||
font-size: 11px;
|
||||
font-weight: 400;
|
||||
color: #000;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin: 0;
|
||||
font-weight: 600;
|
||||
color: #000;
|
||||
word-break: break-word;
|
||||
line-height: 1.5;
|
||||
}
|
||||
}
|
||||
|
||||
.view-kv-span-2 {
|
||||
grid-column: span 2;
|
||||
}
|
||||
|
||||
.view-kv-span-full {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.view-plain-list {
|
||||
margin: 0;
|
||||
padding-left: 1.15em;
|
||||
list-style: disc;
|
||||
|
||||
li + li {
|
||||
margin-top: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1100px) {
|
||||
.view-kv-grid--cols-4 {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.view-kv-grid--cols-3,
|
||||
.view-kv-grid--cols-4 {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.view-kv-grid,
|
||||
.view-kv-grid--cols-3,
|
||||
.view-kv-grid--cols-4 {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.view-kv-span-2 {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,206 @@
|
||||
<template>
|
||||
<div class="view-kv-table-wrap">
|
||||
<table class="view-kv-table" :class="`view-kv-table--${mode}`">
|
||||
<tbody>
|
||||
<template v-if="mode === 'pair'">
|
||||
<tr
|
||||
v-for="field in fields"
|
||||
:key="field.label"
|
||||
:class="{ 'row-long': isLong(field) }"
|
||||
>
|
||||
<th>{{ field.label }}</th>
|
||||
<td>
|
||||
<ViewKvTableCell :field="field" />
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
<template v-else-if="mode === 'dual'">
|
||||
<tr
|
||||
v-for="(row, idx) in dualRows"
|
||||
:key="dualRowKey(row, idx)"
|
||||
:class="{ 'row-long': row.type === 'long' }"
|
||||
>
|
||||
<template v-if="row.type === 'long'">
|
||||
<th>{{ row.field.label }}</th>
|
||||
<td colspan="3">
|
||||
<ViewKvTableCell :field="row.field" />
|
||||
</td>
|
||||
</template>
|
||||
<template v-else>
|
||||
<th>{{ row.left.label }}</th>
|
||||
<td>
|
||||
<ViewKvTableCell :field="row.left" />
|
||||
</td>
|
||||
<template v-if="row.right">
|
||||
<th>{{ row.right.label }}</th>
|
||||
<td>
|
||||
<ViewKvTableCell :field="row.right" />
|
||||
</td>
|
||||
</template>
|
||||
<template v-else>
|
||||
<th></th>
|
||||
<td></td>
|
||||
</template>
|
||||
</template>
|
||||
</tr>
|
||||
</template>
|
||||
<template v-else>
|
||||
<tr
|
||||
v-for="(row, idx) in tripleRows"
|
||||
:key="tripleRowKey(row, idx)"
|
||||
:class="{ 'row-long': row.type === 'long' }"
|
||||
>
|
||||
<template v-if="row.type === 'long'">
|
||||
<th>{{ row.field.label }}</th>
|
||||
<td colspan="5">
|
||||
<ViewKvTableCell :field="row.field" />
|
||||
</td>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-for="slot in 3" :key="slot">
|
||||
<template v-if="row.fields[slot - 1]">
|
||||
<th>{{ row.fields[slot - 1].label }}</th>
|
||||
<td>
|
||||
<ViewKvTableCell :field="row.fields[slot - 1]" />
|
||||
</td>
|
||||
</template>
|
||||
<template v-else>
|
||||
<th></th>
|
||||
<td></td>
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import type { ViewField } from './types'
|
||||
import { formatViewValue } from './types'
|
||||
import ViewKvTableCell from './ViewKvTableCell.vue'
|
||||
import {
|
||||
buildViewKvTableDualRows,
|
||||
buildViewKvTableTripleRows,
|
||||
getViewFieldDisplayText,
|
||||
isViewFieldFullSpan,
|
||||
isViewFieldLong,
|
||||
type ViewKvTableRow,
|
||||
type ViewKvTableTripleRow
|
||||
} from '@/utils/view-field-layout'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
fields: ViewField[]
|
||||
/** pair:一行一组;dual:一行两组(四列);triple:一行三组(六列) */
|
||||
mode?: 'pair' | 'dual' | 'triple'
|
||||
}>(),
|
||||
{
|
||||
mode: 'pair'
|
||||
}
|
||||
)
|
||||
|
||||
const dualRows = computed(() => buildViewKvTableDualRows(props.fields, formatViewValue))
|
||||
const tripleRows = computed(() => buildViewKvTableTripleRows(props.fields, formatViewValue))
|
||||
|
||||
function isLong(field: ViewField) {
|
||||
const text = getViewFieldDisplayText(field, formatViewValue)
|
||||
return isViewFieldLong(field, text) || isViewFieldFullSpan(field, text)
|
||||
}
|
||||
|
||||
function dualRowKey(row: ViewKvTableRow, idx: number) {
|
||||
if (row.type === 'long') return row.field.label
|
||||
return `${row.left.label}-${row.right?.label ?? idx}`
|
||||
}
|
||||
|
||||
function tripleRowKey(row: ViewKvTableTripleRow, idx: number) {
|
||||
if (row.type === 'long') return row.field.label
|
||||
return row.fields.map((f) => f.label).join('-') || String(idx)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.view-kv-table-wrap {
|
||||
border: 1px solid var(--border, #d9e8e2);
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.view-kv-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 13px;
|
||||
table-layout: fixed;
|
||||
|
||||
th {
|
||||
padding: 10px 12px;
|
||||
background: var(--table-head, #f8fafc);
|
||||
color: var(--text-muted, #64748b);
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
border-bottom: 1px solid #eef2f6;
|
||||
border-right: 1px solid #eef2f6;
|
||||
white-space: normal;
|
||||
word-break: break-word;
|
||||
overflow-wrap: anywhere;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 10px 14px;
|
||||
font-weight: 600;
|
||||
color: var(--text, #1e293b);
|
||||
border-bottom: 1px solid #eef2f6;
|
||||
vertical-align: top;
|
||||
word-break: break-word;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
tr:last-child th,
|
||||
tr:last-child td {
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
|
||||
.view-kv-table--pair th {
|
||||
width: 128px;
|
||||
}
|
||||
|
||||
.view-kv-table--dual th {
|
||||
width: 12%;
|
||||
}
|
||||
|
||||
.view-kv-table--dual td {
|
||||
width: 38%;
|
||||
}
|
||||
|
||||
.view-kv-table--dual tr.row-long th {
|
||||
width: 12%;
|
||||
}
|
||||
|
||||
.view-kv-table--dual tr.row-long td {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.view-kv-table--triple th {
|
||||
width: 10%;
|
||||
}
|
||||
|
||||
.view-kv-table--triple td {
|
||||
width: 23.33%;
|
||||
}
|
||||
|
||||
.view-kv-table--triple tr.row-long th {
|
||||
width: 10%;
|
||||
}
|
||||
|
||||
.view-kv-table--triple tr.row-long td {
|
||||
width: auto;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<el-tag v-if="field.tagType" :type="field.tagType" size="small">{{
|
||||
formatViewValue(field.value)
|
||||
}}</el-tag>
|
||||
<ul v-else-if="field.items?.length" class="view-plain-list">
|
||||
<li v-for="(item, idx) in field.items" :key="idx">{{ item }}</li>
|
||||
</ul>
|
||||
<span v-else :class="{ 'money-display': field.money, 'muted-display': isMuted }">{{
|
||||
formatViewValue(field.value)
|
||||
}}</span>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import type { ViewField } from './types'
|
||||
import { formatViewValue } from './types'
|
||||
|
||||
const props = defineProps<{
|
||||
field: ViewField
|
||||
}>()
|
||||
|
||||
const isMuted = computed(
|
||||
() => !props.field.money && formatViewValue(props.field.value) === '—'
|
||||
)
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.view-plain-list {
|
||||
margin: 0;
|
||||
padding-left: 1.15em;
|
||||
list-style: disc;
|
||||
|
||||
li + li {
|
||||
margin-top: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.muted-display {
|
||||
color: var(--text-muted, #64748b);
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
||||
@@ -52,63 +52,19 @@
|
||||
>
|
||||
{{ group.title }}
|
||||
</div>
|
||||
<dl
|
||||
<ViewKvGrid
|
||||
v-if="group.fields.length"
|
||||
class="view-kv-grid"
|
||||
:class="`view-kv-grid--cols-${splitGridColumns}`"
|
||||
>
|
||||
<div
|
||||
v-for="field in group.fields"
|
||||
:key="field.label"
|
||||
class="view-kv"
|
||||
:class="{ 'view-kv-span-2': field.span }"
|
||||
>
|
||||
<dt>{{ field.label }}</dt>
|
||||
<dd>
|
||||
<el-tag v-if="field.tagType" :type="field.tagType" size="small">{{
|
||||
formatViewValue(field.value)
|
||||
}}</el-tag>
|
||||
<ul v-else-if="field.items?.length" class="view-plain-list">
|
||||
<li v-for="(item, idx) in field.items" :key="idx">{{ item }}</li>
|
||||
</ul>
|
||||
<template v-else
|
||||
><span :class="{ 'money-display': field.money }">{{
|
||||
formatViewValue(field.value)
|
||||
}}</span></template
|
||||
>
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
:fields="group.fields"
|
||||
:columns="splitGridColumns"
|
||||
/>
|
||||
<p v-else-if="group.title" class="view-empty-hint">{{ group.emptyHint || '—' }}</p>
|
||||
</div>
|
||||
</template>
|
||||
<dl
|
||||
<ViewKvGrid
|
||||
v-else-if="section.fields.length"
|
||||
class="view-kv-grid"
|
||||
:class="`view-kv-grid--cols-${splitGridColumns}`"
|
||||
>
|
||||
<div
|
||||
v-for="field in section.fields"
|
||||
:key="field.label"
|
||||
class="view-kv"
|
||||
:class="{ 'view-kv-span-2': field.span }"
|
||||
>
|
||||
<dt>{{ field.label }}</dt>
|
||||
<dd>
|
||||
<el-tag v-if="field.tagType" :type="field.tagType" size="small">{{
|
||||
formatViewValue(field.value)
|
||||
}}</el-tag>
|
||||
<ul v-else-if="field.items?.length" class="view-plain-list">
|
||||
<li v-for="(item, idx) in field.items" :key="idx">{{ item }}</li>
|
||||
</ul>
|
||||
<template v-else
|
||||
><span :class="{ 'money-display': field.money }">{{
|
||||
formatViewValue(field.value)
|
||||
}}</span></template
|
||||
>
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
:fields="section.fields"
|
||||
:columns="splitGridColumns"
|
||||
/>
|
||||
<div
|
||||
v-if="section.slotTitle && section.slotTitleStyle === 'field'"
|
||||
class="view-field-label"
|
||||
@@ -162,63 +118,19 @@
|
||||
>
|
||||
{{ group.title }}
|
||||
</div>
|
||||
<dl
|
||||
<ViewKvGrid
|
||||
v-if="group.fields.length"
|
||||
class="view-kv-grid"
|
||||
:class="`view-kv-grid--cols-${gridColumns}`"
|
||||
>
|
||||
<div
|
||||
v-for="field in group.fields"
|
||||
:key="field.label"
|
||||
class="view-kv"
|
||||
:class="{ 'view-kv-span-2': field.span }"
|
||||
>
|
||||
<dt>{{ field.label }}</dt>
|
||||
<dd>
|
||||
<el-tag v-if="field.tagType" :type="field.tagType" size="small">{{
|
||||
formatViewValue(field.value)
|
||||
}}</el-tag>
|
||||
<ul v-else-if="field.items?.length" class="view-plain-list">
|
||||
<li v-for="(item, idx) in field.items" :key="idx">{{ item }}</li>
|
||||
</ul>
|
||||
<template v-else
|
||||
><span :class="{ 'money-display': field.money }">{{
|
||||
formatViewValue(field.value)
|
||||
}}</span></template
|
||||
>
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
:fields="group.fields"
|
||||
:columns="effectiveGridColumns"
|
||||
/>
|
||||
<p v-else-if="group.title" class="view-empty-hint">{{ group.emptyHint || '—' }}</p>
|
||||
</div>
|
||||
</template>
|
||||
<dl
|
||||
<ViewKvGrid
|
||||
v-else-if="section.fields.length"
|
||||
class="view-kv-grid"
|
||||
:class="`view-kv-grid--cols-${gridColumns}`"
|
||||
>
|
||||
<div
|
||||
v-for="field in section.fields"
|
||||
:key="field.label"
|
||||
class="view-kv"
|
||||
:class="{ 'view-kv-span-2': field.span }"
|
||||
>
|
||||
<dt>{{ field.label }}</dt>
|
||||
<dd>
|
||||
<el-tag v-if="field.tagType" :type="field.tagType" size="small">{{
|
||||
formatViewValue(field.value)
|
||||
}}</el-tag>
|
||||
<ul v-else-if="field.items?.length" class="view-plain-list">
|
||||
<li v-for="(item, idx) in field.items" :key="idx">{{ item }}</li>
|
||||
</ul>
|
||||
<template v-else
|
||||
><span :class="{ 'money-display': field.money }">{{
|
||||
formatViewValue(field.value)
|
||||
}}</span></template
|
||||
>
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
:fields="section.fields"
|
||||
:columns="effectiveGridColumns"
|
||||
/>
|
||||
<div
|
||||
v-if="section.slotTitle && section.slotTitleStyle === 'field'"
|
||||
class="view-field-label"
|
||||
@@ -245,54 +157,17 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, useSlots, type Component } from 'vue'
|
||||
import { Close, Document } from '@element-plus/icons-vue'
|
||||
import ViewKvGrid from './ViewKvGrid.vue'
|
||||
import {
|
||||
isIconComponent,
|
||||
type TagType,
|
||||
type ViewField,
|
||||
type ViewFieldGroup,
|
||||
type ViewGridColumns,
|
||||
type ViewSection
|
||||
} from './types'
|
||||
|
||||
function isIconComponent(val: unknown): val is Component {
|
||||
return val != null && (typeof val === 'object' || typeof val === 'function')
|
||||
}
|
||||
|
||||
/** 查看弹窗字段展示:null/undefined/空字符串 → —;布尔转是/否 */
|
||||
function formatViewValue(val: unknown): string {
|
||||
if (val === null || val === undefined || val === '') return '—'
|
||||
if (typeof val === 'boolean') return val ? '是' : '否'
|
||||
return String(val)
|
||||
}
|
||||
|
||||
export type TagType = 'success' | 'warning' | 'danger' | 'info' | '' | 'primary'
|
||||
|
||||
export interface ViewField {
|
||||
label: string
|
||||
value?: string | number | boolean | null | undefined
|
||||
/** 无编号列表(ul),与 value / tagType 二选一 */
|
||||
items?: string[]
|
||||
span?: boolean
|
||||
/** 传入后以 el-tag 渲染,值为 el-tag 的 type 属性 */
|
||||
tagType?: TagType
|
||||
/** 价格/单价/金额类只读数值,套用全局 .money-display 红色样式 */
|
||||
money?: boolean
|
||||
}
|
||||
|
||||
export interface ViewFieldGroup {
|
||||
/** 分组小标题;field=与 KV 字段 label 一致;section=绿条区块标题 */
|
||||
title?: string
|
||||
titleStyle?: 'section' | 'field'
|
||||
fields: ViewField[]
|
||||
/** fields 为空且存在 title 时的占位文案 */
|
||||
emptyHint?: string
|
||||
}
|
||||
|
||||
export interface ViewSection {
|
||||
title: string
|
||||
fields: ViewField[]
|
||||
/** 同区块内多组 KV(如任务信息 + 检测参数),与 fields 二选一 */
|
||||
fieldGroups?: ViewFieldGroup[]
|
||||
/** section=区块绿条标题;field=与 KV 字段 label(dt)一致 */
|
||||
titleStyle?: 'section' | 'field'
|
||||
/** 插槽上方标题(可与 fields 同区块,避免额外分割线) */
|
||||
slotTitle?: string
|
||||
slotTitleStyle?: 'section' | 'field'
|
||||
/** 区块内追加内容(如附件列表),对应具名插槽名 */
|
||||
slot?: string
|
||||
}
|
||||
export type { TagType, ViewField, ViewFieldGroup, ViewSection }
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -305,10 +180,10 @@
|
||||
/** 与 code 搭配的标签文案,默认「编码」 */
|
||||
codeLabel?: string
|
||||
sections: ViewSection[]
|
||||
/** 弹窗宽度,默认 720px */
|
||||
/** 弹窗宽度,默认 1040px(适配 4 列 KV) */
|
||||
width?: string
|
||||
/** 字段栅格列数,默认 2 */
|
||||
gridColumns?: 2 | 3 | 4
|
||||
/** 字段栅格列数,默认 4(短值 4 个/行,长值 2 个/行) */
|
||||
gridColumns?: ViewGridColumns
|
||||
/** 挂到 body,用于嵌套在其它弹窗内时叠层展示 */
|
||||
appendToBody?: boolean
|
||||
/** 遮罩类名(可配合全局样式提高 z-index) */
|
||||
@@ -322,11 +197,11 @@
|
||||
/** default 单列滚动;split 左右分栏(需 split-right 插槽) */
|
||||
layout?: 'default' | 'split'
|
||||
/** split 布局时左侧 KV 栅格列数,默认 1 */
|
||||
splitGridColumns?: 1 | 2
|
||||
splitGridColumns?: ViewGridColumns
|
||||
}>(),
|
||||
{
|
||||
width: '720px',
|
||||
gridColumns: 2,
|
||||
width: '1040px',
|
||||
gridColumns: 4,
|
||||
appendToBody: false,
|
||||
modalClass: '',
|
||||
dialogClass: '',
|
||||
@@ -343,6 +218,11 @@
|
||||
() => props.layout === 'split' || Boolean(slots['split-right'])
|
||||
)
|
||||
|
||||
/** 紧凑模式降为 2 列,避免 4 列过密 */
|
||||
const effectiveGridColumns = computed<ViewGridColumns>(() =>
|
||||
props.compact ? 2 : props.gridColumns
|
||||
)
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:visible', val: boolean): void
|
||||
}>()
|
||||
@@ -431,8 +311,8 @@
|
||||
padding: 16px 20px;
|
||||
}
|
||||
|
||||
.view-split-left .view-kv {
|
||||
grid-template-columns: 84px 1fr;
|
||||
.view-split-left :deep(.view-kv) {
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
@media (max-width: 1100px) {
|
||||
@@ -500,7 +380,7 @@
|
||||
.view-hero-meta {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
color: #64748b;
|
||||
color: #000;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
@@ -523,64 +403,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
.view-kv-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 12px 20px;
|
||||
|
||||
&--cols-1 {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
&--cols-3 {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
&--cols-4 {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
.view-kv {
|
||||
display: grid;
|
||||
grid-template-columns: 96px 1fr;
|
||||
gap: 8px 12px;
|
||||
font-size: 13px;
|
||||
align-items: start;
|
||||
|
||||
dt {
|
||||
margin: 0;
|
||||
color: #64748b;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin: 0;
|
||||
color: #1e293b;
|
||||
word-break: break-word;
|
||||
}
|
||||
}
|
||||
|
||||
.view-kv-span-2 {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.view-plain-list {
|
||||
margin: 0;
|
||||
padding-left: 1.15em;
|
||||
list-style: disc;
|
||||
|
||||
li + li {
|
||||
margin-top: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.view-field-label {
|
||||
margin: 0 0 8px;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: #64748b;
|
||||
line-height: 1.5;
|
||||
font-size: 11px;
|
||||
font-weight: 400;
|
||||
color: #000;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.view-section-slot {
|
||||
@@ -592,12 +420,12 @@
|
||||
}
|
||||
|
||||
.view-field-label + .view-section-slot,
|
||||
.view-kv-grid + .view-field-label,
|
||||
:deep(.view-kv-grid) + .view-field-label,
|
||||
.view-field-group + .view-field-label {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.view-kv-grid + .view-field-label {
|
||||
:deep(.view-kv-grid) + .view-field-label {
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
@@ -608,36 +436,10 @@
|
||||
.view-field-group .view-empty-hint {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
color: #64748b;
|
||||
color: #000;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
@media (max-width: 1100px) {
|
||||
.view-kv-grid--cols-4 {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.view-kv-grid--cols-3,
|
||||
.view-kv-grid--cols-4 {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.view-kv-grid,
|
||||
.view-kv-grid--cols-3,
|
||||
.view-kv-grid--cols-4 {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.view-kv {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.system-view-dialog--compact {
|
||||
.dialog-scroll {
|
||||
max-height: min(68vh, 560px);
|
||||
@@ -676,13 +478,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
.view-kv-grid {
|
||||
:deep(.view-kv-grid) {
|
||||
gap: 8px 16px;
|
||||
}
|
||||
|
||||
.view-kv {
|
||||
:deep(.view-kv) {
|
||||
font-size: 12px;
|
||||
grid-template-columns: 84px 1fr;
|
||||
}
|
||||
|
||||
.view-field-label {
|
||||
@@ -740,7 +541,7 @@
|
||||
|
||||
.view-section-slot .view-subtable-wrap .el-table.view-subtable {
|
||||
--el-table-header-bg-color: #f8fafc;
|
||||
--el-table-header-text-color: #64748b;
|
||||
--el-table-header-text-color: #1e293b;
|
||||
--el-table-border-color: #e2e8f0;
|
||||
width: 100%;
|
||||
|
||||
@@ -752,7 +553,7 @@
|
||||
|
||||
.el-table__header th.el-table__cell .cell {
|
||||
font-weight: 500;
|
||||
color: #64748b;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.el-table__body td.el-table__cell .cell {
|
||||
@@ -763,7 +564,7 @@
|
||||
.view-section-slot .view-empty-hint {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
color: #64748b;
|
||||
color: #1e293b;
|
||||
line-height: 1.5;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
import type { Component } from 'vue'
|
||||
|
||||
export type TagType = 'success' | 'warning' | 'danger' | 'info' | '' | 'primary'
|
||||
|
||||
export interface ViewField {
|
||||
label: string
|
||||
value?: string | number | boolean | null | undefined
|
||||
/** 无编号列表(ul),与 value / tagType 二选一 */
|
||||
items?: string[]
|
||||
/**
|
||||
* 跨列:true=长值(4 列下占 2 格,一行 2 个);
|
||||
* 'full'=占满整行(超长备注等)
|
||||
*/
|
||||
span?: boolean | 'full'
|
||||
/** 显式长值,等同 span:true */
|
||||
long?: boolean
|
||||
/** 显式占满整行,等同 span:'full' */
|
||||
fullSpan?: boolean
|
||||
tagType?: TagType
|
||||
money?: boolean
|
||||
}
|
||||
|
||||
export interface ViewFieldGroup {
|
||||
title?: string
|
||||
titleStyle?: 'section' | 'field'
|
||||
fields: ViewField[]
|
||||
emptyHint?: string
|
||||
}
|
||||
|
||||
export interface ViewSection {
|
||||
title: string
|
||||
fields: ViewField[]
|
||||
fieldGroups?: ViewFieldGroup[]
|
||||
titleStyle?: 'section' | 'field'
|
||||
slotTitle?: string
|
||||
slotTitleStyle?: 'section' | 'field'
|
||||
slot?: string
|
||||
}
|
||||
|
||||
export type ViewGridColumns = 1 | 2 | 3 | 4
|
||||
|
||||
export function isIconComponent(val: unknown): val is Component {
|
||||
return val != null && (typeof val === 'object' || typeof val === 'function')
|
||||
}
|
||||
|
||||
export function formatViewValue(val: unknown): string {
|
||||
if (val === null || val === undefined || val === '') return '—'
|
||||
if (typeof val === 'boolean') return val ? '是' : '否'
|
||||
return String(val)
|
||||
}
|
||||
@@ -139,7 +139,7 @@ function connectorClass(index: number) {
|
||||
justify-content: center;
|
||||
border: 2px solid #e2e8f0;
|
||||
background: #f8fafc;
|
||||
color: #94a3b8;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.approval-flow-circle.is-approved {
|
||||
|
||||
@@ -135,7 +135,7 @@ const sortedItems = computed(() =>
|
||||
justify-content: center;
|
||||
border: 2px solid #e2e8f0;
|
||||
background: #f8fafc;
|
||||
color: #94a3b8;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.approval-history-circle.is-approved {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<template>
|
||||
<ViewKvGrid :fields="fields" :columns="columns" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ViewKvGrid from '@/components/business/system-view-dialog/ViewKvGrid.vue'
|
||||
import type { ViewField, ViewGridColumns } from '@/components/business/system-view-dialog/types'
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
fields: ViewField[]
|
||||
/** 默认 4 列:短值 4 个/行,长值 2 个/行 */
|
||||
columns?: ViewGridColumns
|
||||
}>(),
|
||||
{
|
||||
columns: 4
|
||||
}
|
||||
)
|
||||
</script>
|
||||
@@ -0,0 +1,23 @@
|
||||
<template>
|
||||
<ViewKvTable :fields="fields" :mode="mode" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ViewKvTable from '@/components/business/system-view-dialog/ViewKvTable.vue'
|
||||
import type { ViewField } from '@/components/business/system-view-dialog/types'
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
fields: ViewField[]
|
||||
/**
|
||||
* pair:标准两列表格;
|
||||
* dual:双组四列表格;
|
||||
* triple:三组六列表格(一行 3 组 label|value)
|
||||
*/
|
||||
mode?: 'pair' | 'dual' | 'triple'
|
||||
}>(),
|
||||
{
|
||||
mode: 'pair'
|
||||
}
|
||||
)
|
||||
</script>
|
||||
@@ -353,7 +353,7 @@
|
||||
i {
|
||||
padding-left: 0;
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.el-icon-circle-check {
|
||||
|
||||
@@ -10,19 +10,19 @@
|
||||
<div
|
||||
:class="
|
||||
isClickable(item, index)
|
||||
? 'c-p py-1 rounded tad-200 hover:bg-active-color hover:[&_span]:text-g-600'
|
||||
? 'c-p py-1 rounded tad-200 hover:bg-active-color hover:[&_span]:text-[var(--mint-text)]'
|
||||
: ''
|
||||
"
|
||||
@click="handleBreadcrumbClick(item, index)"
|
||||
>
|
||||
<span
|
||||
class="block max-w-46 overflow-hidden text-ellipsis whitespace-nowrap px-1.5 text-sm text-g-600 dark:text-g-800"
|
||||
class="block max-w-46 overflow-hidden text-ellipsis whitespace-nowrap px-1.5 text-sm text-[var(--mint-text)]"
|
||||
>{{ formatMenuTitle(item.meta?.title as string) }}</span
|
||||
>
|
||||
</div>
|
||||
<div
|
||||
v-if="!isLastItem(index) && item.meta?.title"
|
||||
class="mx-1 text-sm not-italic text-g-500"
|
||||
class="mx-1 text-sm not-italic text-[var(--mint-text)]"
|
||||
aria-hidden="true"
|
||||
>
|
||||
/
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<template>
|
||||
<div
|
||||
class="layout-sidebar"
|
||||
v-if="showLeftMenu || isDualMenu"
|
||||
:class="{ 'no-border': menuList.length === 0 }"
|
||||
:class="{ 'no-border': menuList.length === 0, 'layout-sidebar-portal': isPortalMenu }"
|
||||
v-if="showLeftMenu || isDualMenu || isPortalMenu"
|
||||
>
|
||||
<!-- 双列菜单(左侧) -->
|
||||
<div
|
||||
@@ -36,16 +36,8 @@
|
||||
}"
|
||||
>
|
||||
<ArtSvgIcon
|
||||
v-if="menu.meta.icon"
|
||||
class="menu-icon text-g-700 dark:text-g-800"
|
||||
:icon="menu.meta.icon"
|
||||
:style="{
|
||||
marginBottom: dualMenuShowText ? '5px' : '0'
|
||||
}"
|
||||
/>
|
||||
<div
|
||||
v-else
|
||||
class="dual-menu-icon-placeholder"
|
||||
:icon="resolveSidebarMenuIcon(menu, Boolean(menu.children?.length))"
|
||||
:style="{
|
||||
marginBottom: dualMenuShowText ? '5px' : '0'
|
||||
}"
|
||||
@@ -70,8 +62,9 @@
|
||||
:class="`menu-left-${getMenuTheme.theme} menu-left-${!menuOpen ? 'close' : 'open'}`"
|
||||
:style="{ background: getMenuTheme.background }"
|
||||
>
|
||||
<!-- Logo、系统名称 -->
|
||||
<!-- Logo、系统名称(门户布局顶栏已展示,侧栏隐藏) -->
|
||||
<div
|
||||
v-if="!isPortalMenu"
|
||||
class="header"
|
||||
@click="navigateToHome"
|
||||
:style="{
|
||||
@@ -109,6 +102,7 @@
|
||||
<SidebarSubmenu
|
||||
:list="menuList"
|
||||
:isMobile="isMobileMode"
|
||||
:level="isPortalMenu ? 1 : 0"
|
||||
:theme="getMenuTheme"
|
||||
@close="handleMenuClose"
|
||||
/>
|
||||
@@ -141,6 +135,7 @@
|
||||
import { isIframe } from '@/utils/navigation'
|
||||
import { handleMenuJump } from '@/utils/navigation'
|
||||
import { filterSidebarRoutes } from '@/utils/router/sidebar-menu-filter'
|
||||
import { resolveSidebarMenuIcon } from '@/utils/router/menu-icon'
|
||||
import SidebarSubmenu from './widget/SidebarSubmenu.vue'
|
||||
import { useCommon } from '@/hooks/core/useCommon'
|
||||
import { useWindowSize, useTimeoutFn } from '@vueuse/core'
|
||||
@@ -183,8 +178,12 @@
|
||||
|
||||
// 菜单类型判断
|
||||
const isTopLeftMenu = computed(() => menuType.value === MenuTypeEnum.TOP_LEFT)
|
||||
const isPortalMenu = computed(() => menuType.value === MenuTypeEnum.PORTAL)
|
||||
const showLeftMenu = computed(
|
||||
() => menuType.value === MenuTypeEnum.LEFT || menuType.value === MenuTypeEnum.TOP_LEFT
|
||||
() =>
|
||||
menuType.value === MenuTypeEnum.LEFT ||
|
||||
menuType.value === MenuTypeEnum.TOP_LEFT ||
|
||||
menuType.value === MenuTypeEnum.PORTAL
|
||||
)
|
||||
const isDualMenu = computed(() => menuType.value === MenuTypeEnum.DUAL_MENU)
|
||||
|
||||
@@ -204,8 +203,8 @@
|
||||
const menuStore = useMenuStore()
|
||||
const allMenus = menuStore.menuList
|
||||
|
||||
// 如果不是顶部左侧菜单或双列菜单,直接返回完整菜单列表
|
||||
if (!isTopLeftMenu.value && !isDualMenu.value) {
|
||||
// 顶部混合菜单、门户布局或双列菜单:仅展示当前一级模块下的子菜单
|
||||
if (!isTopLeftMenu.value && !isDualMenu.value && !isPortalMenu.value) {
|
||||
return allMenus
|
||||
}
|
||||
|
||||
@@ -284,6 +283,14 @@
|
||||
|
||||
// 双列菜单收起时的滚动条样式
|
||||
const scrollbarStyle = computed(() => {
|
||||
if (isPortalMenu.value) {
|
||||
return {
|
||||
height: '100%',
|
||||
transform: 'translateY(0)',
|
||||
transition: 'transform 0.3s ease'
|
||||
}
|
||||
}
|
||||
|
||||
const isCollapsed = isDualMenu.value && !menuOpen.value
|
||||
return {
|
||||
transform: isCollapsed ? 'translateY(-50px)' : 'translateY(0)',
|
||||
@@ -377,6 +384,12 @@
|
||||
* 监听窗口尺寸变化,自动处理移动端菜单
|
||||
*/
|
||||
watch(width, (newWidth) => {
|
||||
if (isPortalMenu.value) {
|
||||
settingStore.setMenuOpen(true)
|
||||
showMobileModal.value = false
|
||||
return
|
||||
}
|
||||
|
||||
if (newWidth < MOBILE_BREAKPOINT) {
|
||||
settingStore.setMenuOpen(false)
|
||||
if (!menuOpen.value) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.layout-sidebar {
|
||||
.layout-sidebar {
|
||||
display: flex;
|
||||
height: 100vh;
|
||||
user-select: none;
|
||||
@@ -6,6 +6,10 @@
|
||||
border-right: none;
|
||||
background: var(--mint-surface, #fff);
|
||||
|
||||
&.layout-sidebar-portal {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
&.no-border {
|
||||
border-right: none !important;
|
||||
}
|
||||
|
||||
@@ -158,8 +158,8 @@ $popup-menu-radius: 6px;
|
||||
flex-shrink: 0;
|
||||
font-size: $menu-font-size !important;
|
||||
font-weight: 500;
|
||||
// Fresh Mint:默认菜单项为中性色(demo `.nav a`)
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
// Fresh Mint:菜单文字使用主文本色
|
||||
color: var(--mint-text, #1e293b);
|
||||
text-rendering: geometricprecision;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
@@ -170,7 +170,7 @@ $popup-menu-radius: 6px;
|
||||
.el-sub-menu > .el-sub-menu__title {
|
||||
font-size: 12px !important;
|
||||
font-weight: 700;
|
||||
color: var(--mint-text-muted, #64748b) !important;
|
||||
color: var(--mint-text, #1e293b) !important;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ $popup-menu-radius: 6px;
|
||||
}
|
||||
|
||||
.el-sub-menu__icon-arrow {
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
color: var(--mint-text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ $popup-menu-radius: 6px;
|
||||
@include menu-hover($hover-bg-color);
|
||||
|
||||
.el-sub-menu__icon-arrow {
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
color: var(--mint-text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-14
@@ -2,17 +2,12 @@
|
||||
<template v-for="(item, index) in filteredMenuItems" :key="getUniqueKey(item, index)">
|
||||
<ElSubMenu v-if="hasChildren(item)" :index="item.path || item.meta.title" :level="level">
|
||||
<template #title>
|
||||
<div
|
||||
v-if="level === 0 && (item.meta.icon || item.meta.virtualMenuIcon)"
|
||||
class="menu-icon flex-cc"
|
||||
>
|
||||
<div class="menu-icon flex-cc">
|
||||
<ArtSvgIcon
|
||||
v-if="item.meta.icon"
|
||||
:icon="item.meta.icon"
|
||||
:icon="resolveSidebarMenuIcon(item, true)"
|
||||
:color="theme?.iconColor"
|
||||
:style="{ color: theme.iconColor }"
|
||||
/>
|
||||
<span v-else class="menu-icon__virtual" aria-hidden="true" />
|
||||
</div>
|
||||
<span class="menu-name">
|
||||
{{ formatMenuTitle(item.meta.title) }}
|
||||
@@ -35,17 +30,12 @@
|
||||
:level-item="level + 1"
|
||||
@click="goPage(item)"
|
||||
>
|
||||
<div
|
||||
v-if="level === 0 && (item.meta.icon || item.meta.virtualMenuIcon)"
|
||||
class="menu-icon flex-cc"
|
||||
>
|
||||
<div class="menu-icon flex-cc">
|
||||
<ArtSvgIcon
|
||||
v-if="item.meta.icon"
|
||||
:icon="item.meta.icon"
|
||||
:icon="resolveSidebarMenuIcon(item, false)"
|
||||
:color="theme?.iconColor"
|
||||
:style="{ color: theme.iconColor }"
|
||||
/>
|
||||
<span v-else class="menu-icon__virtual" aria-hidden="true" />
|
||||
</div>
|
||||
<div
|
||||
v-show="item.meta.showBadge && level === 0 && !menuOpen"
|
||||
@@ -71,6 +61,7 @@
|
||||
import type { AppRouteRecord } from '@/types/router'
|
||||
import { formatMenuTitle } from '@/utils/router'
|
||||
import { filterSidebarRoutes } from '@/utils/router/sidebar-menu-filter'
|
||||
import { resolveSidebarMenuIcon } from '@/utils/router/menu-icon'
|
||||
import { handleMenuJump } from '@/utils/navigation'
|
||||
import { useSettingStore } from '@/store/modules/setting'
|
||||
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
<!-- 一体化门户顶栏 -->
|
||||
<template>
|
||||
<header class="portal-header">
|
||||
<div class="portal-header-brand" @click="toHome">
|
||||
<ArtLogo class="portal-header-logo" />
|
||||
<p class="portal-header-title">{{ AppConfig.systemInfo.name }}</p>
|
||||
</div>
|
||||
|
||||
<ArtPortalTopNav class="portal-header-nav" />
|
||||
|
||||
<div class="portal-header-actions">
|
||||
<ArtIconButton
|
||||
v-if="shouldShowFullscreen"
|
||||
icon="fullscreen"
|
||||
:class="[!isFullscreen ? 'full-screen-btn' : 'exit-full-screen-btn']"
|
||||
class="max-md:!hidden"
|
||||
@click="toggleFullScreen"
|
||||
/>
|
||||
<ArtUserMenu />
|
||||
</div>
|
||||
</header>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useFullscreen } from '@vueuse/core'
|
||||
import AppConfig from '@/config'
|
||||
import { useCommon } from '@/hooks/core/useCommon'
|
||||
import { useHeaderBar } from '@/hooks/core/useHeaderBar'
|
||||
import ArtUserMenu from '../art-header-bar/widget/ArtUserMenu.vue'
|
||||
|
||||
defineOptions({ name: 'ArtPortalHeader' })
|
||||
|
||||
const router = useRouter()
|
||||
const { homePath } = useCommon()
|
||||
const { shouldShowFullscreen } = useHeaderBar()
|
||||
const { isFullscreen, toggle: toggleFullscreen } = useFullscreen()
|
||||
|
||||
const toHome = (): void => {
|
||||
router.push(homePath.value)
|
||||
}
|
||||
|
||||
const toggleFullScreen = (): void => {
|
||||
toggleFullscreen()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.portal-header {
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 72px;
|
||||
padding: 0 20px;
|
||||
user-select: none;
|
||||
background: var(--default-bg-color, #fff);
|
||||
border-bottom: 1px solid var(--art-card-border, #d9e8e2);
|
||||
}
|
||||
|
||||
.portal-header-brand {
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.portal-header-logo {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.portal-header-title {
|
||||
margin: 0;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
line-height: 1.2;
|
||||
color: var(--mint-text, #1e293b);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.portal-header-nav {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
margin-left: 24px;
|
||||
}
|
||||
|
||||
.portal-header-actions {
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.full-screen-btn:hover :deep(.art-svg-icon) {
|
||||
animation: portal-expand 0.6s forwards;
|
||||
}
|
||||
|
||||
.exit-full-screen-btn:hover :deep(.art-svg-icon) {
|
||||
animation: portal-shrink 0.6s forwards;
|
||||
}
|
||||
|
||||
@keyframes portal-expand {
|
||||
0% {
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
50% {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes portal-shrink {
|
||||
0% {
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
50% {
|
||||
transform: scale(0.9);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,155 @@
|
||||
<!-- 门户顶栏一级模块卡片 -->
|
||||
<template>
|
||||
<div class="portal-top-nav">
|
||||
<ElScrollbar v-if="moduleList.length" wrap-class="portal-top-nav-scroll">
|
||||
<div class="portal-top-nav-list">
|
||||
<button
|
||||
v-for="item in moduleList"
|
||||
:key="item.path"
|
||||
type="button"
|
||||
class="portal-top-nav-card"
|
||||
:class="{ 'is-active': item.isActive }"
|
||||
@click="handleModuleClick(item)"
|
||||
>
|
||||
<ArtSvgIcon
|
||||
v-if="item.meta.icon"
|
||||
:icon="item.meta.icon"
|
||||
class="portal-top-nav-card__icon"
|
||||
/>
|
||||
<span class="portal-top-nav-card__label">{{ item.formattedTitle }}</span>
|
||||
<div v-if="item.meta.showBadge" class="art-badge art-badge-mixed" />
|
||||
</button>
|
||||
</div>
|
||||
</ElScrollbar>
|
||||
<p v-else class="portal-top-nav-empty">暂无可用模块</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { formatMenuTitle } from '@/utils/router'
|
||||
import { useMenuStore } from '@/store/modules/menu'
|
||||
import {
|
||||
filterPortalTopModules,
|
||||
getFirstAccessiblePath,
|
||||
isPortalModuleActive
|
||||
} from '@/utils/router/portal-menu'
|
||||
import type { AppRouteRecord } from '@/types/router'
|
||||
|
||||
defineOptions({ name: 'ArtPortalTopNav' })
|
||||
|
||||
interface PortalModuleItem extends AppRouteRecord {
|
||||
isActive: boolean
|
||||
formattedTitle: string
|
||||
}
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const menuStore = useMenuStore()
|
||||
const { menuList } = storeToRefs(menuStore)
|
||||
|
||||
const currentRoutePath = computed(() =>
|
||||
String(route.meta.activePath || route.path)
|
||||
)
|
||||
|
||||
const moduleList = computed<PortalModuleItem[]>(() => {
|
||||
return filterPortalTopModules(menuList.value).map((item) => ({
|
||||
...item,
|
||||
isActive: isPortalModuleActive(item, currentRoutePath.value),
|
||||
formattedTitle: formatMenuTitle(item.meta.title)
|
||||
}))
|
||||
})
|
||||
|
||||
const handleModuleClick = (item: PortalModuleItem): void => {
|
||||
if (item.isActive) {
|
||||
return
|
||||
}
|
||||
|
||||
const target = getFirstAccessiblePath(item)
|
||||
if (target && target !== route.path) {
|
||||
router.push(target)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.portal-top-nav {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.portal-top-nav-empty {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
}
|
||||
|
||||
:deep(.portal-top-nav-scroll) {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.portal-top-nav-list {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
min-height: 56px;
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
.portal-top-nav-card {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
flex-direction: column;
|
||||
flex-shrink: 0;
|
||||
gap: 4px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 72px;
|
||||
padding: 8px 12px;
|
||||
cursor: pointer;
|
||||
background: transparent;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
transition:
|
||||
background-color 0.2s ease,
|
||||
color 0.2s ease;
|
||||
|
||||
&__icon {
|
||||
font-size: 22px;
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
}
|
||||
|
||||
&__label {
|
||||
max-width: 88px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 12px;
|
||||
line-height: 1.3;
|
||||
color: var(--mint-text, #1e293b);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
&:hover:not(.is-active) {
|
||||
background: var(--primary-bg, #ecfdf5);
|
||||
|
||||
.portal-top-nav-card__icon,
|
||||
.portal-top-nav-card__label {
|
||||
color: var(--primary-dark, #059669);
|
||||
}
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
background: var(--primary, #10b981);
|
||||
|
||||
.portal-top-nav-card__icon,
|
||||
.portal-top-nav-card__label {
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
+5
-1
@@ -19,7 +19,11 @@ export function useSettingsState() {
|
||||
|
||||
// 菜单布局切换
|
||||
const switchMenuLayouts = (type: MenuTypeEnum) => {
|
||||
if (type === MenuTypeEnum.LEFT || type === MenuTypeEnum.TOP_LEFT) {
|
||||
if (
|
||||
type === MenuTypeEnum.LEFT ||
|
||||
type === MenuTypeEnum.TOP_LEFT ||
|
||||
type === MenuTypeEnum.PORTAL
|
||||
) {
|
||||
settingStore.setMenuOpen(true)
|
||||
}
|
||||
settingStore.switchMenuLayouts(type)
|
||||
|
||||
@@ -34,7 +34,8 @@
|
||||
left: 'MenuTypeEnum.LEFT',
|
||||
top: 'MenuTypeEnum.TOP',
|
||||
'top-left': 'MenuTypeEnum.TOP_LEFT',
|
||||
'dual-menu': 'MenuTypeEnum.DUAL_MENU'
|
||||
'dual-menu': 'MenuTypeEnum.DUAL_MENU',
|
||||
portal: 'MenuTypeEnum.PORTAL'
|
||||
},
|
||||
systemTheme: {
|
||||
auto: 'SystemThemeEnum.AUTO',
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
import type { ContractProductForm, ContractVO } from '@/api/crm/contract/types'
|
||||
|
||||
export interface PlanFormProductRow {
|
||||
id?: string
|
||||
productId: string
|
||||
productNo: string
|
||||
productName: string
|
||||
model?: string
|
||||
categoryName?: string
|
||||
unit: string
|
||||
quantity: number
|
||||
actualQty?: number
|
||||
packageSpec?: string
|
||||
deliveryMethod?: string
|
||||
taxRate?: number
|
||||
taxPrice?: number
|
||||
taxSubtotal?: number
|
||||
taxAmount?: number
|
||||
remark?: string
|
||||
isExplosive?: number
|
||||
isToxic?: number
|
||||
purchaseCertUrl?: string
|
||||
transportCertUrl?: string
|
||||
}
|
||||
|
||||
export function determinePlPlanType(supplierName?: string, destinationName?: string) {
|
||||
if (destinationName && (destinationName.includes('安庆山峡') || destinationName.includes('安徽云栋'))) {
|
||||
return 'inbound'
|
||||
}
|
||||
if (supplierName && (supplierName.includes('安庆山峡') || supplierName.includes('安徽云栋'))) {
|
||||
return 'outbound'
|
||||
}
|
||||
return 'direct'
|
||||
}
|
||||
|
||||
export function resolveBelongsCompany(supplierName?: string) {
|
||||
if (supplierName?.includes('安徽云栋')) return 'yundong'
|
||||
return 'shanxia'
|
||||
}
|
||||
|
||||
export function mapContractProductToPlanRow(item: ContractProductForm, index: number): PlanFormProductRow {
|
||||
const productId = String(item.productId || item.id || index)
|
||||
return {
|
||||
productId,
|
||||
productNo: productId,
|
||||
productName: item.productName || '',
|
||||
model: item.model || item.productModel,
|
||||
categoryName: item.categoryName,
|
||||
unit: item.unit || '吨',
|
||||
quantity: Number(item.quantity || 0),
|
||||
actualQty: Number(item.quantity || 0),
|
||||
packageSpec: item.packageSpec,
|
||||
deliveryMethod: item.deliveryMethod,
|
||||
taxRate: item.taxRate != null ? Number(item.taxRate) : undefined,
|
||||
taxPrice: item.price != null ? Number(item.price) : undefined,
|
||||
taxSubtotal: item.subtotal != null ? Number(item.subtotal) : undefined,
|
||||
taxAmount: item.taxAmount != null ? Number(item.taxAmount) : undefined,
|
||||
remark: item.remark,
|
||||
isExplosive: Number(item.isExplosive ?? 0),
|
||||
isToxic: Number(item.isToxic ?? 0)
|
||||
}
|
||||
}
|
||||
|
||||
export function mapContractProducts(products?: ContractProductForm[]) {
|
||||
return (products || []).map(mapContractProductToPlanRow)
|
||||
}
|
||||
|
||||
export function applyContractToPlanForm(contract: ContractVO) {
|
||||
const supplierName = contract.supplierName || contract.partyA
|
||||
const destinationName = contract.customerName || contract.partyB
|
||||
const planType = determinePlPlanType(supplierName, destinationName)
|
||||
|
||||
return {
|
||||
contractId: String(contract.id),
|
||||
contractNo: contract.contractNo,
|
||||
belongsCompany: resolveBelongsCompany(supplierName),
|
||||
planType,
|
||||
supplierId: contract.supplierId != null ? String(contract.supplierId) : '',
|
||||
supplierName: supplierName || '',
|
||||
destinationId: contract.customerId != null ? String(contract.customerId) : '',
|
||||
destinationName: destinationName || '',
|
||||
customerId: contract.customerId != null ? String(contract.customerId) : '',
|
||||
customerName: contract.customerName || '',
|
||||
contactName: contract.contactName || contract.partyBContact || '',
|
||||
contactPhone: contract.contactMobile || contract.partyBMobile || '',
|
||||
partyA: contract.partyA || '',
|
||||
partyB: contract.partyB || '',
|
||||
contractStartDate: contract.startDate || '',
|
||||
contractEndDate: contract.endDate || '',
|
||||
settlementMethod: contract.settlementMethod || '',
|
||||
hasFreight: contract.settlementMethod?.includes('含运') ? 1 : 0,
|
||||
products: mapContractProducts(contract.products)
|
||||
}
|
||||
}
|
||||
|
||||
export function getPlanTypeLabel(planType: string) {
|
||||
const map: Record<string, string> = {
|
||||
direct: '直销单',
|
||||
inbound: '入库单',
|
||||
outbound: '出库单'
|
||||
}
|
||||
return map[planType] || planType
|
||||
}
|
||||
|
||||
export function getPlanTypeTagType(planType: string) {
|
||||
const map: Record<string, string> = {
|
||||
direct: 'primary',
|
||||
inbound: 'success',
|
||||
outbound: 'warning'
|
||||
}
|
||||
return map[planType] || 'info'
|
||||
}
|
||||
|
||||
export function getDeliveryMethodLabel(method?: string) {
|
||||
const map: Record<string, string> = {
|
||||
self_pick: '山峡自提',
|
||||
one_ticket: '一票制',
|
||||
customer_pick: '客户自提'
|
||||
}
|
||||
if (!method) return '—'
|
||||
return map[method] || method
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
import { computed, ref, watch, type Ref } from 'vue'
|
||||
|
||||
export interface FreightCalcProductRow {
|
||||
quantity?: number | null
|
||||
actualQty?: number | null
|
||||
unit?: string | null
|
||||
}
|
||||
|
||||
export function sumProductActualQuantities(products: FreightCalcProductRow[]) {
|
||||
return products.reduce((sum, row) => {
|
||||
const actual = row.actualQty
|
||||
if (actual != null && !Number.isNaN(Number(actual))) {
|
||||
return sum + Number(actual)
|
||||
}
|
||||
return sum + Number(row.quantity || 0)
|
||||
}, 0)
|
||||
}
|
||||
|
||||
/** @deprecated 使用 sumProductActualQuantities */
|
||||
export function sumProductQuantities(products: FreightCalcProductRow[]) {
|
||||
return sumProductActualQuantities(products)
|
||||
}
|
||||
|
||||
export function resolveFreightUnitLabel(products: FreightCalcProductRow[]) {
|
||||
const units = products.map(row => row.unit).filter(Boolean) as string[]
|
||||
if (!units.length) return '吨'
|
||||
const first = units[0]
|
||||
return first
|
||||
}
|
||||
|
||||
export function usePlFreightCalc(options: {
|
||||
products: Ref<FreightCalcProductRow[]>
|
||||
hasFreight: Ref<number>
|
||||
freightType: Ref<string>
|
||||
}) {
|
||||
const transportQty = ref<number | null>(null)
|
||||
const transportQtyTouched = ref(false)
|
||||
const freightAmount = ref<number | null>(null)
|
||||
const freightAmountTouched = ref(false)
|
||||
const freightPrice = ref<number | null>(null)
|
||||
|
||||
const defaultTransportQty = computed(() => sumProductActualQuantities(options.products.value))
|
||||
|
||||
watch(
|
||||
() => options.products.value,
|
||||
() => {
|
||||
if (!transportQtyTouched.value) {
|
||||
transportQty.value = defaultTransportQty.value || null
|
||||
}
|
||||
},
|
||||
{ deep: true, immediate: true }
|
||||
)
|
||||
|
||||
const calculatedFreight = computed(() => {
|
||||
if (!options.hasFreight.value) return 0
|
||||
if (options.freightType.value === 'by_trip') {
|
||||
return Number(freightAmount.value || 0)
|
||||
}
|
||||
const qty = Number(transportQty.value || 0)
|
||||
const price = Number(freightPrice.value || 0)
|
||||
return qty * price
|
||||
})
|
||||
|
||||
watch(calculatedFreight, val => {
|
||||
if (options.freightType.value === 'by_weight' && !freightAmountTouched.value) {
|
||||
freightAmount.value = val > 0 ? val : null
|
||||
}
|
||||
})
|
||||
|
||||
watch([transportQty, freightPrice], () => {
|
||||
if (options.freightType.value === 'by_weight' && options.hasFreight.value) {
|
||||
freightAmountTouched.value = false
|
||||
}
|
||||
})
|
||||
|
||||
watch(
|
||||
() => options.freightType.value,
|
||||
type => {
|
||||
freightAmountTouched.value = false
|
||||
if (type === 'by_trip') {
|
||||
freightPrice.value = null
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
function resetFreightCalc() {
|
||||
transportQty.value = null
|
||||
transportQtyTouched.value = false
|
||||
freightAmount.value = null
|
||||
freightAmountTouched.value = false
|
||||
freightPrice.value = null
|
||||
}
|
||||
|
||||
function markTransportQtyTouched() {
|
||||
transportQtyTouched.value = true
|
||||
}
|
||||
|
||||
function markFreightAmountTouched() {
|
||||
freightAmountTouched.value = true
|
||||
}
|
||||
|
||||
return {
|
||||
transportQty,
|
||||
transportQtyTouched,
|
||||
freightPrice,
|
||||
freightAmount,
|
||||
freightAmountTouched,
|
||||
defaultTransportQty,
|
||||
calculatedFreight,
|
||||
resetFreightCalc,
|
||||
markTransportQtyTouched,
|
||||
markFreightAmountTouched
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
import type { Plan, PlanProduct, TransportArrangeResult, TransportInventoryLink } from '@/api/pl'
|
||||
import { planApi } from '@/api/pl'
|
||||
import DbPoundSlipQrcodeDialog from '@/components/business/db/DbPoundSlipQrcodeDialog.vue'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { pickBxData } from '@/utils/http/bx'
|
||||
import { formatPlanProductListText } from '@/utils/pl-display'
|
||||
|
||||
export function usePlPlanArrangeActions() {
|
||||
const dictStore = useDictStore()
|
||||
|
||||
const plan = ref<Partial<Plan> | null>(null)
|
||||
const products = ref<PlanProduct[]>([])
|
||||
const driverUrl = ref('')
|
||||
const licensePlate = ref('')
|
||||
const inventoryRecords = ref<TransportInventoryLink[]>([])
|
||||
const qrcodeVisible = ref(false)
|
||||
const selectedInventoryId = ref('')
|
||||
const selectedInventoryUnit = ref('')
|
||||
const qrcodeDialogRef = ref<InstanceType<typeof DbPoundSlipQrcodeDialog> | null>(null)
|
||||
|
||||
const showArrangeActions = computed(
|
||||
() =>
|
||||
Boolean(
|
||||
plan.value?.transportStatus === 'arranged' &&
|
||||
plan.value?.followStatus !== 'cancelled' &&
|
||||
(driverUrl.value || inventoryRecords.value.length)
|
||||
)
|
||||
)
|
||||
|
||||
function getUnitLabel(unit: string) {
|
||||
return dictStore.getLabel('crm_product_unit', unit) || unit
|
||||
}
|
||||
|
||||
function resetArrangeActions() {
|
||||
plan.value = null
|
||||
products.value = []
|
||||
driverUrl.value = ''
|
||||
licensePlate.value = ''
|
||||
inventoryRecords.value = []
|
||||
qrcodeVisible.value = false
|
||||
selectedInventoryId.value = ''
|
||||
selectedInventoryUnit.value = ''
|
||||
}
|
||||
|
||||
function applyArrangeResult(result: TransportArrangeResult, contextPlan?: Partial<Plan>, contextProducts?: PlanProduct[]) {
|
||||
if (contextPlan) plan.value = contextPlan
|
||||
if (contextProducts) products.value = contextProducts
|
||||
driverUrl.value = result.driverUrl || ''
|
||||
licensePlate.value = result.licensePlate || ''
|
||||
inventoryRecords.value = result.inventoryRecords || []
|
||||
}
|
||||
|
||||
async function loadArrangeActions(planId: string) {
|
||||
resetArrangeActions()
|
||||
const planRes = await planApi.get(planId)
|
||||
const data = pickBxData<Plan>(planRes)
|
||||
if (!data) return
|
||||
plan.value = data
|
||||
products.value = Array.isArray(data.products) ? data.products : []
|
||||
|
||||
if (data.transportStatus !== 'arranged' || data.followStatus === 'cancelled') {
|
||||
return
|
||||
}
|
||||
|
||||
const infoRes = await planApi.getArrangeInfo(planId)
|
||||
const info = pickBxData<{ driverUrl?: string; licensePlate?: string; inventoryRecords?: TransportInventoryLink[] }>(
|
||||
infoRes
|
||||
)
|
||||
driverUrl.value = info?.driverUrl || ''
|
||||
licensePlate.value = info?.licensePlate || data.licensePlate || ''
|
||||
inventoryRecords.value = info?.inventoryRecords || []
|
||||
}
|
||||
|
||||
function buildPlanSummaryText(options?: {
|
||||
startPoint?: string
|
||||
endPoint?: string
|
||||
licensePlate?: string
|
||||
driverUrl?: string
|
||||
}) {
|
||||
const lines = ['【运输安排】', `计划号:${plan.value?.planNo || '—'}`]
|
||||
lines.push(`车牌:${options?.licensePlate || licensePlate.value || plan.value?.licensePlate || '—'}`)
|
||||
lines.push(`时间:${plan.value?.pickupTime || plan.value?.planDate || '—'}`)
|
||||
const productText = products.value.map(p => formatPlanProductListText(p, getUnitLabel)).join(';')
|
||||
lines.push(`产品:${productText || '—'}`)
|
||||
lines.push(
|
||||
`路线:${plan.value?.pickupAddress || options?.startPoint || '—'} → ${
|
||||
plan.value?.destinationAddress || plan.value?.destinationName || options?.endPoint || '—'
|
||||
}`
|
||||
)
|
||||
lines.push(`司机链接:${options?.driverUrl || driverUrl.value || '—'}`)
|
||||
return lines.join('\n')
|
||||
}
|
||||
|
||||
async function copyDriverUrl(url?: string) {
|
||||
const target = url || driverUrl.value
|
||||
if (!target) return
|
||||
await navigator.clipboard.writeText(target)
|
||||
ElMessage.success('已复制司机链接')
|
||||
}
|
||||
|
||||
async function copyPlanSummary(options?: {
|
||||
startPoint?: string
|
||||
endPoint?: string
|
||||
licensePlate?: string
|
||||
driverUrl?: string
|
||||
}) {
|
||||
await navigator.clipboard.writeText(buildPlanSummaryText(options))
|
||||
ElMessage.success('已复制计划简述')
|
||||
}
|
||||
|
||||
function resolveInventoryUnitLabel(record: TransportInventoryLink) {
|
||||
const product = products.value.find(item => item.id === record.planProductId)
|
||||
const unitRaw = product?.unit || ''
|
||||
return unitRaw ? getUnitLabel(unitRaw) : '吨'
|
||||
}
|
||||
|
||||
async function copyPoundSlipQrcode() {
|
||||
if (!inventoryRecords.value.length) return
|
||||
if (inventoryRecords.value.length === 1) {
|
||||
selectedInventoryId.value = inventoryRecords.value[0].dbInventoryId
|
||||
selectedInventoryUnit.value = resolveInventoryUnitLabel(inventoryRecords.value[0])
|
||||
qrcodeVisible.value = true
|
||||
await nextTick()
|
||||
await qrcodeDialogRef.value?.copyQrcodeImage()
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const { value } = await ElMessageBox.prompt('请选择要复制二维码的产品行', '复制磅单二维码', {
|
||||
inputPlaceholder: inventoryRecords.value.map((item, idx) => `${idx + 1}. ${item.productName}`).join('\n'),
|
||||
confirmButtonText: '确定',
|
||||
inputValidator: val => {
|
||||
const index = Number(val) - 1
|
||||
if (!Number.isInteger(index) || index < 0 || index >= inventoryRecords.value.length) {
|
||||
return '请输入有效序号'
|
||||
}
|
||||
return true
|
||||
}
|
||||
})
|
||||
const index = Number(value) - 1
|
||||
const record = inventoryRecords.value[index]
|
||||
selectedInventoryId.value = record.dbInventoryId
|
||||
selectedInventoryUnit.value = resolveInventoryUnitLabel(record)
|
||||
qrcodeVisible.value = true
|
||||
await nextTick()
|
||||
await qrcodeDialogRef.value?.copyQrcodeImage()
|
||||
} catch {
|
||||
// 用户取消
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
plan,
|
||||
products,
|
||||
driverUrl,
|
||||
licensePlate,
|
||||
inventoryRecords,
|
||||
qrcodeVisible,
|
||||
selectedInventoryId,
|
||||
selectedInventoryUnit,
|
||||
qrcodeDialogRef,
|
||||
showArrangeActions,
|
||||
resetArrangeActions,
|
||||
applyArrangeResult,
|
||||
loadArrangeActions,
|
||||
buildPlanSummaryText,
|
||||
copyDriverUrl,
|
||||
copyPlanSummary,
|
||||
copyPoundSlipQrcode
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
import { getContract } from '@/api/crm/contract'
|
||||
import type { ContractVO } from '@/api/crm/contract/types'
|
||||
import {
|
||||
inventoryApi,
|
||||
type InventoryRecord,
|
||||
type InventoryWeighingRecord
|
||||
} from '@/api/db/inventory'
|
||||
import {
|
||||
planApi,
|
||||
transportApi,
|
||||
type Plan,
|
||||
type PlanProduct,
|
||||
type Transport,
|
||||
type TransportInventoryLink
|
||||
} from '@/api/pl'
|
||||
import type { PlanFormProductRow } from '@/composables/usePlContractToPlan'
|
||||
import { loadVehicleViewBundle, type VehicleViewBundle } from '@/composables/usePlVehicleViewDetail'
|
||||
import { enrichPlanProductsHazardFromCrm } from '@/composables/usePlToxicProductCertCheck'
|
||||
import { pickBxData } from '@/utils/http/bx'
|
||||
|
||||
export interface PlPlanTransportDibangRow {
|
||||
link: TransportInventoryLink
|
||||
inventory: InventoryRecord | null
|
||||
weighing: InventoryWeighingRecord | null
|
||||
}
|
||||
|
||||
export function mapPlanProductToFormRow(item: PlanProduct, index: number): PlanFormProductRow {
|
||||
return {
|
||||
productId: String(item.productId || index),
|
||||
productNo: item.productNo || String(item.productId || index),
|
||||
productName: item.productName || '',
|
||||
model: item.model,
|
||||
categoryName: item.categoryName,
|
||||
unit: item.unit || '吨',
|
||||
quantity: Number(item.quantity || item.inboundEstimateQty || item.outboundEstimateQty || 0),
|
||||
actualQty: Number(
|
||||
item.actualQty ?? item.quantity ?? item.inboundEstimateQty ?? item.outboundEstimateQty ?? 0
|
||||
),
|
||||
packageSpec: item.packageSpec,
|
||||
deliveryMethod: item.deliveryMethod,
|
||||
taxPrice: item.taxPrice ?? item.inboundPrice ?? item.outboundPrice,
|
||||
taxSubtotal: item.taxSubtotal ?? item.inboundAmount ?? item.outboundAmount,
|
||||
taxAmount: item.taxAmount,
|
||||
remark: item.remark,
|
||||
isExplosive: Number(item.isExplosive ?? 0),
|
||||
isToxic: Number(item.isToxic ?? 0)
|
||||
}
|
||||
}
|
||||
|
||||
export function buildContractSnapshotFromPlan(data: Plan, rows: PlanFormProductRow[]): ContractVO {
|
||||
return {
|
||||
id: data.contractId || '',
|
||||
contractNo: data.contractNo || '',
|
||||
contractName: data.contractNo || '',
|
||||
customerId: data.customerId || '',
|
||||
customerName: data.customerName || '',
|
||||
contactName: data.contactName || '',
|
||||
contactMobile: data.contactPhone || '',
|
||||
contractType: '',
|
||||
amount: data.totalAmount || 0,
|
||||
signDate: '',
|
||||
startDate: data.contractStartDate || '',
|
||||
endDate: data.contractEndDate || '',
|
||||
contractPeriod: 0,
|
||||
status: '',
|
||||
approvalStatus: '',
|
||||
contractFile: '',
|
||||
attachmentFiles: '',
|
||||
ownerUserId: '',
|
||||
ownerUserName: '',
|
||||
receivedAmount: 0,
|
||||
unreceivedAmount: 0,
|
||||
invoiceAmount: 0,
|
||||
uninvoiceAmount: 0,
|
||||
partyA: data.partyA || '',
|
||||
partyAAddress: '',
|
||||
partyAContact: '',
|
||||
partyAMobile: '',
|
||||
supplierName: data.supplierName,
|
||||
settlementMethod: data.settlementMethod,
|
||||
partyB: data.partyB || '',
|
||||
partyBAddress: data.destinationAddress || '',
|
||||
partyBContact: data.contactName || '',
|
||||
partyBMobile: data.contactPhone || '',
|
||||
paymentTerms: '',
|
||||
deliveryTerms: '',
|
||||
contractTerms: '',
|
||||
invalidReason: '',
|
||||
invalidTime: '',
|
||||
createTime: '',
|
||||
remark: data.remark || '',
|
||||
products: rows as unknown as ContractVO['products']
|
||||
}
|
||||
}
|
||||
|
||||
export function usePlPlanViewDetail() {
|
||||
const loading = ref(false)
|
||||
const plan = ref<Plan | null>(null)
|
||||
const products = ref<PlanProduct[]>([])
|
||||
const transport = ref<Transport | null>(null)
|
||||
const vehicleBundle = ref<VehicleViewBundle | null>(null)
|
||||
const contractSnapshot = ref<ContractVO | null>(null)
|
||||
const dibangRows = ref<PlPlanTransportDibangRow[]>([])
|
||||
|
||||
async function loadDibangRows(planId: string, data: Plan) {
|
||||
dibangRows.value = []
|
||||
if (data.followStatus === 'cancelled' || data.transportStatus !== 'arranged') {
|
||||
return
|
||||
}
|
||||
try {
|
||||
const infoRes = await planApi.getArrangeInfo(planId)
|
||||
const info = pickBxData<{ inventoryRecords?: TransportInventoryLink[] }>(infoRes)
|
||||
const links = info?.inventoryRecords || []
|
||||
if (!links.length) return
|
||||
|
||||
dibangRows.value = await Promise.all(
|
||||
links.map(async (link) => {
|
||||
let inventory: InventoryRecord | null = null
|
||||
let weighing: InventoryWeighingRecord | null = null
|
||||
try {
|
||||
inventory = await inventoryApi.get(link.dbInventoryId)
|
||||
} catch {
|
||||
inventory = null
|
||||
}
|
||||
try {
|
||||
const related = await inventoryApi.getRelated(link.dbInventoryId)
|
||||
weighing = related?.weighing ?? null
|
||||
} catch {
|
||||
weighing = null
|
||||
}
|
||||
return { link, inventory, weighing }
|
||||
})
|
||||
)
|
||||
} catch {
|
||||
dibangRows.value = []
|
||||
}
|
||||
}
|
||||
|
||||
async function loadDetail(planId: string) {
|
||||
loading.value = true
|
||||
plan.value = null
|
||||
products.value = []
|
||||
transport.value = null
|
||||
vehicleBundle.value = null
|
||||
contractSnapshot.value = null
|
||||
dibangRows.value = []
|
||||
try {
|
||||
const res = await planApi.get(planId)
|
||||
const data = pickBxData<Plan>(res)
|
||||
plan.value = data || null
|
||||
|
||||
const rows = (data?.products || []).map(mapPlanProductToFormRow)
|
||||
products.value = await enrichPlanProductsHazardFromCrm(data?.products || [])
|
||||
|
||||
if (data?.contractId) {
|
||||
try {
|
||||
const contractRes = await getContract(data.contractId)
|
||||
contractSnapshot.value = (contractRes.data ?? contractRes) as ContractVO
|
||||
} catch {
|
||||
contractSnapshot.value = buildContractSnapshotFromPlan(data, rows)
|
||||
}
|
||||
} else if (data) {
|
||||
contractSnapshot.value = buildContractSnapshotFromPlan(data, rows)
|
||||
}
|
||||
|
||||
const detailTasks: Promise<void>[] = []
|
||||
|
||||
if (data?.transportId) {
|
||||
detailTasks.push(
|
||||
transportApi
|
||||
.get(data.transportId)
|
||||
.then((transportRes) => {
|
||||
transport.value = pickBxData<Transport>(transportRes)
|
||||
})
|
||||
.catch(() => {
|
||||
transport.value = null
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
if (data?.vehicleId) {
|
||||
detailTasks.push(
|
||||
loadVehicleViewBundle(data.vehicleId)
|
||||
.then((bundle) => {
|
||||
vehicleBundle.value = bundle
|
||||
})
|
||||
.catch(() => {
|
||||
vehicleBundle.value = null
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
if (detailTasks.length) {
|
||||
await Promise.all(detailTasks)
|
||||
}
|
||||
|
||||
if (data) {
|
||||
await loadDibangRows(planId, data)
|
||||
}
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function resetDetail() {
|
||||
plan.value = null
|
||||
products.value = []
|
||||
transport.value = null
|
||||
vehicleBundle.value = null
|
||||
contractSnapshot.value = null
|
||||
dibangRows.value = []
|
||||
}
|
||||
|
||||
return {
|
||||
loading,
|
||||
plan,
|
||||
products,
|
||||
transport,
|
||||
vehicleBundle,
|
||||
contractSnapshot,
|
||||
dibangRows,
|
||||
loadDetail,
|
||||
resetDetail
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
import { fetchProductDetail } from '@/api/crm/product'
|
||||
import type { PlanProduct } from '@/api/pl'
|
||||
|
||||
export type HazardFlagProduct = {
|
||||
productId?: string
|
||||
productName?: string
|
||||
isToxic?: number
|
||||
isExplosive?: number
|
||||
is_toxic?: number
|
||||
is_explosive?: number
|
||||
}
|
||||
|
||||
function isTruthyHazardFlag(value: unknown) {
|
||||
return value === 1 || value === true || value === '1'
|
||||
}
|
||||
|
||||
export function resolveProductHazardFlags(product: HazardFlagProduct) {
|
||||
const isToxic =
|
||||
isTruthyHazardFlag(product.isToxic) || isTruthyHazardFlag(product.is_toxic)
|
||||
const isExplosive =
|
||||
isTruthyHazardFlag(product.isExplosive) || isTruthyHazardFlag(product.is_explosive)
|
||||
return { isToxic, isExplosive }
|
||||
}
|
||||
|
||||
export function isHazardProduct(product: Pick<PlanProduct, 'isToxic' | 'isExplosive'>) {
|
||||
const flags = resolveProductHazardFlags(product)
|
||||
return flags.isToxic || flags.isExplosive
|
||||
}
|
||||
|
||||
export function getHazardProductLabel(product: Pick<PlanProduct, 'isToxic' | 'isExplosive'>) {
|
||||
const flags = resolveProductHazardFlags(product)
|
||||
if (flags.isExplosive) return '易制爆'
|
||||
if (flags.isToxic) return '易制毒'
|
||||
return ''
|
||||
}
|
||||
|
||||
/** 产品名称后追加易制毒/易制爆标识:毒、爆,或「毒 爆」 */
|
||||
export function formatPlProductNameWithHazardMarks(product: HazardFlagProduct) {
|
||||
const name = product.productName || ''
|
||||
const { isToxic, isExplosive } = resolveProductHazardFlags(product)
|
||||
const marks: string[] = []
|
||||
if (isToxic) marks.push('毒')
|
||||
if (isExplosive) marks.push('爆')
|
||||
if (!marks.length) return name
|
||||
return `${name}${marks.join(' ')}`
|
||||
}
|
||||
|
||||
/** 从 CRM 产品主数据补全易制毒/易制爆标识(合同明细通常不带该字段) */
|
||||
export async function enrichPlanProductsHazardFromCrm<T extends HazardFlagProduct & { productId: string }>(
|
||||
products: T[]
|
||||
): Promise<T[]> {
|
||||
if (!products.length) return products
|
||||
|
||||
const needLookupIds = [
|
||||
...new Set(
|
||||
products
|
||||
.filter(product => {
|
||||
const flags = resolveProductHazardFlags(product)
|
||||
return !flags.isToxic && !flags.isExplosive && product.productId
|
||||
})
|
||||
.map(product => product.productId)
|
||||
)
|
||||
]
|
||||
if (!needLookupIds.length) return products
|
||||
|
||||
const hazardMap = new Map<string, { isToxic: number; isExplosive: number }>()
|
||||
await Promise.all(
|
||||
needLookupIds.map(async productId => {
|
||||
try {
|
||||
const res = await fetchProductDetail({ id: productId })
|
||||
const data = (res as { data?: Record<string, unknown> }).data ?? res
|
||||
const row = data as Record<string, unknown>
|
||||
hazardMap.set(productId, {
|
||||
isToxic: Number(row.isToxic ?? row.is_toxic ?? 0),
|
||||
isExplosive: Number(row.isExplosive ?? row.is_explosive ?? 0)
|
||||
})
|
||||
} catch {
|
||||
// 单条产品查询失败时跳过
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
return products.map(product => {
|
||||
const flags = resolveProductHazardFlags(product)
|
||||
if (flags.isToxic || flags.isExplosive) return product
|
||||
const fromCrm = hazardMap.get(product.productId)
|
||||
if (!fromCrm) return product
|
||||
return {
|
||||
...product,
|
||||
isToxic: fromCrm.isToxic,
|
||||
isExplosive: fromCrm.isExplosive
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function findMissingHazardCerts(products: PlanProduct[]) {
|
||||
return products.filter(
|
||||
p => isHazardProduct(p) && (!p.purchaseCertUrl?.trim() || !p.transportCertUrl?.trim())
|
||||
)
|
||||
}
|
||||
|
||||
export function buildMissingHazardCertMessage(products: PlanProduct[]) {
|
||||
const missing = findMissingHazardCerts(products)
|
||||
if (!missing.length) return ''
|
||||
const names = missing.map(p => `「${p.productName}」`).join('、')
|
||||
return `以下产品须上传购买证和运输证:${names}`
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import { personnelApi, vehicleApi, type VehicleDetail, type VehiclePersonnelRow } from '@/api/pl'
|
||||
import type { VehiclePersonnelViewRow } from '@/components/business/pl-vehicle-personnel-view-list/index.vue'
|
||||
|
||||
export interface VehicleViewBundle {
|
||||
detail: VehicleDetail
|
||||
personnelList: VehiclePersonnelViewRow[]
|
||||
}
|
||||
|
||||
export async function loadPersonnelWithCerts(
|
||||
personnelList: VehiclePersonnelRow[]
|
||||
): Promise<VehiclePersonnelViewRow[]> {
|
||||
return Promise.all(
|
||||
personnelList.map(async person => {
|
||||
if (!person.personnelId) {
|
||||
return { ...person, certList: [] } as VehiclePersonnelViewRow
|
||||
}
|
||||
try {
|
||||
const res = await personnelApi.get(person.personnelId)
|
||||
const detail = ((res.data ?? res) || {}) as { certList?: VehiclePersonnelViewRow['certList'] }
|
||||
return {
|
||||
...person,
|
||||
certList: detail.certList || []
|
||||
} as VehiclePersonnelViewRow
|
||||
} catch {
|
||||
return { ...person, certList: [] } as VehiclePersonnelViewRow
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
export async function loadVehicleViewBundle(vehicleId: string): Promise<VehicleViewBundle> {
|
||||
const res = await vehicleApi.get(vehicleId)
|
||||
const detail = ((res.data ?? res) || {}) as VehicleDetail
|
||||
const personnelList = await loadPersonnelWithCerts(detail.personnelList || [])
|
||||
return { detail, personnelList }
|
||||
}
|
||||
|
||||
export async function loadVehicleViewBundles(vehicleIds: string[]): Promise<VehicleViewBundle[]> {
|
||||
if (!vehicleIds.length) return []
|
||||
return Promise.all(vehicleIds.map(id => loadVehicleViewBundle(id)))
|
||||
}
|
||||
@@ -77,7 +77,8 @@ const appConfig: SystemConfig = {
|
||||
{ name: 'Left', value: MenuTypeEnum.LEFT, img: configImages.menuLayouts.vertical },
|
||||
{ name: 'Top', value: MenuTypeEnum.TOP, img: configImages.menuLayouts.horizontal },
|
||||
{ name: 'Mixed', value: MenuTypeEnum.TOP_LEFT, img: configImages.menuLayouts.mixed },
|
||||
{ name: 'Dual Column', value: MenuTypeEnum.DUAL_MENU, img: configImages.menuLayouts.dualColumn }
|
||||
{ name: 'Dual Column', value: MenuTypeEnum.DUAL_MENU, img: configImages.menuLayouts.dualColumn },
|
||||
{ name: 'Portal', value: MenuTypeEnum.PORTAL, img: configImages.menuLayouts.mixed }
|
||||
],
|
||||
// 菜单主题列表
|
||||
themeList: [
|
||||
|
||||
@@ -15,11 +15,11 @@ import { HeaderBarFeatureConfig } from '@/types'
|
||||
*/
|
||||
export const headerBarConfig: HeaderBarFeatureConfig = {
|
||||
menuButton: {
|
||||
enabled: true,
|
||||
enabled: false,
|
||||
description: '控制左侧菜单的展开/收起按钮'
|
||||
},
|
||||
refreshButton: {
|
||||
enabled: true,
|
||||
enabled: false,
|
||||
description: '页面刷新按钮'
|
||||
},
|
||||
fastEnter: {
|
||||
@@ -27,7 +27,7 @@ export const headerBarConfig: HeaderBarFeatureConfig = {
|
||||
description: '快速入口功能,提供常用应用和链接的快速访问'
|
||||
},
|
||||
breadcrumb: {
|
||||
enabled: true,
|
||||
enabled: false,
|
||||
description: '面包屑导航,显示当前页面路径'
|
||||
},
|
||||
globalSearch: {
|
||||
|
||||
@@ -28,7 +28,7 @@ import { SystemThemeEnum, MenuThemeEnum, MenuTypeEnum, ContainerWidthEnum } from
|
||||
*/
|
||||
export const SETTING_DEFAULT_CONFIG = {
|
||||
/** 菜单类型 */
|
||||
menuType: MenuTypeEnum.LEFT,
|
||||
menuType: MenuTypeEnum.PORTAL,
|
||||
/** 菜单展开宽度 */
|
||||
menuOpenWidth: 230,
|
||||
/** 菜单是否展开 */
|
||||
@@ -44,13 +44,13 @@ export const SETTING_DEFAULT_CONFIG = {
|
||||
/** 系统主题颜色 */
|
||||
systemThemeColor: AppConfig.systemMainColor[0],
|
||||
/** 是否显示菜单按钮 */
|
||||
showMenuButton: true,
|
||||
showMenuButton: false,
|
||||
/** 是否显示快速入口 */
|
||||
showFastEnter: true,
|
||||
/** 是否显示刷新按钮 */
|
||||
showRefreshButton: true,
|
||||
showRefreshButton: false,
|
||||
/** 是否显示面包屑 */
|
||||
showCrumbs: true,
|
||||
showCrumbs: false,
|
||||
/** 是否显示工作台标签 */
|
||||
showWorkTab: true,
|
||||
/** 是否显示语言切换 */
|
||||
|
||||
@@ -25,7 +25,9 @@ export enum MenuTypeEnum {
|
||||
/** 顶部+左侧菜单 */
|
||||
TOP_LEFT = 'top-left',
|
||||
/** 双栏菜单 */
|
||||
DUAL_MENU = 'dual-menu'
|
||||
DUAL_MENU = 'dual-menu',
|
||||
/** 一体化门户(顶栏模块卡片 + 左侧子菜单) */
|
||||
PORTAL = 'portal'
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<template>
|
||||
<div class="public-mobile-shell">
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.public-mobile-shell {
|
||||
min-height: 100vh;
|
||||
margin: 0 auto;
|
||||
max-width: 480px;
|
||||
background: #f8fafc;
|
||||
color: #1e293b;
|
||||
padding: 12px 16px calc(24px + env(safe-area-inset-bottom));
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
@@ -15,6 +15,7 @@ import { fetchGetMenuCodes } from '@/api/auth'
|
||||
import { asyncRoutes } from '../routes/asyncRoutes'
|
||||
import { RoutesAlias } from '../routesAlias'
|
||||
import { formatMenuTitle } from '@/utils'
|
||||
import { isDashboardMenuItem } from '@/utils/router/portal-menu'
|
||||
|
||||
export class MenuProcessor {
|
||||
/**
|
||||
@@ -51,7 +52,24 @@ export class MenuProcessor {
|
||||
this.validateMenuPaths(menuList)
|
||||
|
||||
// 规范化路径(将相对路径转换为完整路径)
|
||||
return this.normalizeMenuPaths(menuList)
|
||||
return this.normalizeMenuPaths(this.filterDashboardMenus(menuList))
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除控制台/Dashboard 一级菜单(门户布局不在菜单中展示)
|
||||
*/
|
||||
private filterDashboardMenus(menuList: AppRouteRecord[]): AppRouteRecord[] {
|
||||
return menuList
|
||||
.filter((item) => !isDashboardMenuItem(item))
|
||||
.map((item) => {
|
||||
if (!item.children?.length) {
|
||||
return item
|
||||
}
|
||||
return {
|
||||
...item,
|
||||
children: this.filterDashboardMenus(item.children)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { AppRouteRecord } from '@/types/router'
|
||||
import { sqxpAdminRoutes } from './sqxp'
|
||||
import { plRoutes } from './pl'
|
||||
|
||||
/**
|
||||
* 动态菜单与路由(前端权限模式 VITE_ACCESS_MODE=frontend 时使用)
|
||||
* 山峡化工业务菜单,与 backend/app/api/menu.py 中 get_admin_menu_list 对齐
|
||||
*/
|
||||
export const routeModules: AppRouteRecord[] = [...sqxpAdminRoutes]
|
||||
export const routeModules: AppRouteRecord[] = [...sqxpAdminRoutes, ...plRoutes]
|
||||
@@ -0,0 +1,121 @@
|
||||
import { AppRouteRecord } from '@/types/router'
|
||||
|
||||
/**
|
||||
* 运输管理路由
|
||||
*/
|
||||
export const plRoutes: AppRouteRecord[] = [
|
||||
{
|
||||
id: 'PL000000000000000000000000000001',
|
||||
name: 'TransportPlan',
|
||||
path: '/pl',
|
||||
component: '/index/index',
|
||||
meta: { title: '运输管理', icon: 'ri:truck-line', keepAlive: false, roles: ['admin'] },
|
||||
children: [
|
||||
{
|
||||
id: 'PL00000000000000000000000000002',
|
||||
name: 'PlCarrier',
|
||||
path: 'carrier',
|
||||
component: '/pl/carrier/index',
|
||||
meta: { title: '承运商管理', keepAlive: true, menuCode: 'pl:carrier:list' }
|
||||
},
|
||||
{
|
||||
id: 'PL00000000000000000000000000003',
|
||||
name: 'PlVehicle',
|
||||
path: 'vehicle',
|
||||
component: '/pl/vehicle/index',
|
||||
meta: { title: '车辆管理', keepAlive: true, menuCode: 'pl:vehicle:list' }
|
||||
},
|
||||
{
|
||||
id: 'PL00000000000000000000000000003S',
|
||||
name: 'PlSelfVehicle',
|
||||
path: 'self-vehicle',
|
||||
component: '/pl/self-vehicle/index',
|
||||
meta: { title: '山峡自有车辆', keepAlive: true, menuCode: 'pl:self-vehicle:list' }
|
||||
},
|
||||
{
|
||||
id: 'PL00000000000000000000000000004',
|
||||
name: 'PlPersonnel',
|
||||
path: 'personnel',
|
||||
component: '/pl/personnel/index',
|
||||
meta: { title: '人员管理', keepAlive: true, menuCode: 'pl:driver:list' }
|
||||
},
|
||||
{
|
||||
id: 'PL00000000000000000000000000004R',
|
||||
name: 'PlDriverRedirect',
|
||||
path: 'driver',
|
||||
redirect: '/pl/personnel',
|
||||
meta: { title: '司机管理', isHide: true, menuCode: 'pl:driver:list' }
|
||||
},
|
||||
{
|
||||
id: 'PL00000000000000000000000000010',
|
||||
name: 'PlPlan',
|
||||
path: 'plan',
|
||||
component: '/pl/plan/index',
|
||||
meta: { title: '运输计划', keepAlive: true, menuCode: 'pl:plan:list' }
|
||||
},
|
||||
{
|
||||
id: 'PL00000000000000000000000000015',
|
||||
name: 'PlPlanCert',
|
||||
path: 'plan-cert',
|
||||
component: '/pl/plan-cert/index',
|
||||
meta: { title: '危化品证上传', keepAlive: true, menuCode: 'pl:plan-cert:list' }
|
||||
},
|
||||
{
|
||||
id: 'PL00000000000000000000000000011',
|
||||
name: 'PlPlanCreate',
|
||||
path: 'plan/create',
|
||||
component: '/pl/plan/form',
|
||||
meta: { title: '新增计划', keepAlive: false, isHide: true, menuCode: 'pl:plan:add' }
|
||||
},
|
||||
{
|
||||
id: 'PL00000000000000000000000000012',
|
||||
name: 'PlPlanEdit',
|
||||
path: 'plan/edit/:id',
|
||||
component: '/pl/plan/form',
|
||||
meta: { title: '编辑计划', keepAlive: false, isHide: true, menuCode: 'pl:plan:edit' }
|
||||
},
|
||||
{
|
||||
id: 'PL00000000000000000000000000013',
|
||||
name: 'PlPlanDetail',
|
||||
path: 'plan/detail/:id',
|
||||
component: '/pl/plan/detail',
|
||||
meta: { title: '计划详情', keepAlive: false, isHide: true, menuCode: 'pl:plan:query' }
|
||||
},
|
||||
{
|
||||
id: 'PL00000000000000000000000000014',
|
||||
name: 'PlPlanArrange',
|
||||
path: 'plan/arrange/:id',
|
||||
component: '/pl/plan/arrange',
|
||||
meta: { title: '运输安排', keepAlive: false, isHide: true, menuCode: 'pl:plan:arrange' }
|
||||
},
|
||||
{
|
||||
id: 'PL00000000000000000000000000020',
|
||||
name: 'PlTransport',
|
||||
path: 'transport',
|
||||
component: '/pl/transport/index',
|
||||
meta: { title: '运输管理', keepAlive: true, isHide: true, menuCode: 'pl:transport:list' }
|
||||
},
|
||||
{
|
||||
id: 'PL00000000000000000000000000030',
|
||||
name: 'PlFreight',
|
||||
path: 'freight',
|
||||
component: '/pl/freight/index',
|
||||
meta: { title: '运费结算', keepAlive: true, menuCode: 'pl:freight:list' }
|
||||
},
|
||||
{
|
||||
id: 'PL00000000000000000000000000040',
|
||||
name: 'PlInventory',
|
||||
path: 'inventory',
|
||||
component: '/pl/inventory/ledger',
|
||||
meta: { title: '库存台账', keepAlive: true, isHide: true, menuCode: 'pl:inventory:list' }
|
||||
},
|
||||
{
|
||||
id: 'PL00000000000000000000000000050',
|
||||
name: 'PlDocumentReminder',
|
||||
path: 'document-reminder',
|
||||
component: '/pl/inventory/document-reminder',
|
||||
meta: { title: '证件提醒', keepAlive: true, menuCode: 'pl:document:list' }
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -1,12 +1,12 @@
|
||||
import type { AppRouteRecord } from '@/types/router'
|
||||
|
||||
/**
|
||||
* 前端路由(控制台、报销管理、CRM 管理、地磅管理、工作流管理、系统管理)
|
||||
* 前端路由(报销管理、CRM 管理、地磅管理、工作流管理、系统管理;运输见 pl.ts)
|
||||
* 与后端菜单对齐时请同步 `sys_menu`(bx 见 docs/sql/20260606_bx_menu.sql;db 见 docs/sql/20260607_db_menu.sql)。
|
||||
*/
|
||||
export const sqxpAdminRoutes: AppRouteRecord[] = [
|
||||
// ──────────────────────────────────────────────
|
||||
// 1. 控制台(Dashboard)
|
||||
// 控制台(已废弃,门户布局不展示;路由保留兼容旧链接)
|
||||
// ──────────────────────────────────────────────
|
||||
{
|
||||
id: 'DSH000000000000000000000000000001',
|
||||
@@ -17,6 +17,7 @@ export const sqxpAdminRoutes: AppRouteRecord[] = [
|
||||
title: '控制台',
|
||||
icon: 'ri:dashboard-line',
|
||||
keepAlive: false,
|
||||
isHide: true,
|
||||
roles: ['admin']
|
||||
}
|
||||
},
|
||||
|
||||
@@ -57,6 +57,12 @@ export const staticRoutes: AppRouteRecordRaw[] = [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/public/pl/transport/:token',
|
||||
name: 'PublicPlTransportDriver',
|
||||
component: () => import('@views/public/pl/transport/index.vue'),
|
||||
meta: { title: '运输计划', isHideTab: true, isPublicMobile: true }
|
||||
},
|
||||
{
|
||||
path: '/:pathMatch(.*)*',
|
||||
name: 'Exception404CatchAll',
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
}
|
||||
.route-config-process-code {
|
||||
font-size: 11px;
|
||||
color: #9ca3af;
|
||||
color: #1e293b;
|
||||
}
|
||||
.route-config-process-info {
|
||||
flex: 1;
|
||||
@@ -138,7 +138,7 @@
|
||||
}
|
||||
.route-config-step-count {
|
||||
font-size: 12px;
|
||||
color: #9ca3af;
|
||||
color: #1e293b;
|
||||
}
|
||||
.route-config-center-dropzone {
|
||||
flex: 1;
|
||||
@@ -151,7 +151,7 @@
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
color: #9ca3af;
|
||||
color: #1e293b;
|
||||
|
||||
p {
|
||||
margin-top: 8px;
|
||||
@@ -180,7 +180,7 @@
|
||||
}
|
||||
.route-config-step-handle {
|
||||
cursor: grab;
|
||||
color: #9ca3af;
|
||||
color: #1e293b;
|
||||
flex-shrink: 0;
|
||||
font-size: 16px;
|
||||
|
||||
@@ -215,7 +215,7 @@
|
||||
}
|
||||
.route-config-step-desc {
|
||||
font-size: 11px;
|
||||
color: #9ca3af;
|
||||
color: #1e293b;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
@@ -265,7 +265,7 @@
|
||||
justify-content: center;
|
||||
flex: 1;
|
||||
padding: 16px;
|
||||
color: #9ca3af;
|
||||
color: #1e293b;
|
||||
|
||||
p {
|
||||
margin-top: 12px;
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
.upload-hint {
|
||||
display: block;
|
||||
font-size: 11px;
|
||||
color: #94a3b8;
|
||||
color: #1e293b;
|
||||
margin-top: 8px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
@@ -110,7 +110,7 @@
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
font-size: 11px;
|
||||
color: #334155;
|
||||
color: #1e293b;
|
||||
line-height: 1.4;
|
||||
word-break: break-all;
|
||||
}
|
||||
@@ -127,7 +127,7 @@
|
||||
height: 22px;
|
||||
border-radius: 4px;
|
||||
background: #f1f5f9;
|
||||
color: #64748b;
|
||||
color: #1e293b;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
--info: #64748b;
|
||||
--info-bg: #f8fafc;
|
||||
--text: #1e293b;
|
||||
--text-muted: #64748b;
|
||||
--text-muted: #1e293b;
|
||||
--border: #d9e8e2;
|
||||
--bg-page: #fefefe;
|
||||
--surface: #ffffff;
|
||||
@@ -66,7 +66,7 @@
|
||||
--el-color-info-light-9: var(--info-bg);
|
||||
|
||||
--el-text-color-primary: var(--text);
|
||||
--el-text-color-regular: var(--text-muted);
|
||||
--el-text-color-regular: var(--text);
|
||||
--el-border-color: var(--border);
|
||||
--el-border-color-light: #edf0f3;
|
||||
--el-fill-color-light: #f8fafc;
|
||||
@@ -1323,7 +1323,7 @@ body {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.bx-tag--pending { color: #475569; }
|
||||
.bx-tag--pending { color: #1e293b; }
|
||||
.bx-tag--processing { color: #00a874; }
|
||||
.bx-tag--done { color: #0f766e; }
|
||||
.bx-tag--warning {
|
||||
@@ -1527,21 +1527,34 @@ body {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin: 0 0 10px;
|
||||
margin: 0 0 14px;
|
||||
padding-left: 10px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--text, #1e293b);
|
||||
border-left: 3px solid var(--primary, #10b981);
|
||||
line-height: 1;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
width: 4px;
|
||||
height: 14px;
|
||||
border-radius: 999px;
|
||||
background: var(--primary, #10b981);
|
||||
flex-shrink: 0;
|
||||
content: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* 报销查看弹窗 KV:复用 SystemViewDialog 四列上下堆叠(短 4 / 长 2) */
|
||||
.dlg-view-section :deep(.view-kv-grid) {
|
||||
gap: 12px 18px;
|
||||
}
|
||||
|
||||
/* 查看弹窗 KV 表格模式(label | value) */
|
||||
.dlg-view-section :deep(.view-kv-table-wrap) {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.dlg-view-section-attach {
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
/* @deprecated 旧版左右 KV,迁移至 BxViewKvGrid 后删除 */
|
||||
.dlg-kv {
|
||||
display: grid;
|
||||
grid-template-columns: 96px minmax(0, 1fr) 96px minmax(0, 1fr);
|
||||
@@ -1556,7 +1569,7 @@ body {
|
||||
|
||||
.dialog-view-xl .el-dialog,
|
||||
.bx-dialog.dialog-view-xl .el-dialog {
|
||||
width: min(920px, calc(100vw - 32px)) !important;
|
||||
width: min(1040px, calc(100vw - 32px)) !important;
|
||||
}
|
||||
|
||||
.money-em,
|
||||
|
||||
@@ -151,7 +151,7 @@
|
||||
|
||||
.db-related-table-dialog .view-subtable-wrap .el-table.view-subtable {
|
||||
--el-table-header-bg-color: #f8fafc;
|
||||
--el-table-header-text-color: #64748b;
|
||||
--el-table-header-text-color: #1e293b;
|
||||
--el-table-border-color: #e2e8f0;
|
||||
width: 100%;
|
||||
|
||||
@@ -163,7 +163,7 @@
|
||||
|
||||
.el-table__header th.el-table__cell .cell {
|
||||
font-weight: 500;
|
||||
color: #64748b;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.el-table__body td.el-table__cell .cell {
|
||||
@@ -404,7 +404,7 @@
|
||||
}
|
||||
|
||||
.pound-slip-capture-inline .capture-row .label {
|
||||
color: #6b7280;
|
||||
color: #1e293b;
|
||||
min-width: 82px;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
:root {
|
||||
--van-primary-color: #10b981;
|
||||
--van-success-color: #10b981;
|
||||
--van-button-primary-background: #10b981;
|
||||
--van-button-primary-border-color: #10b981;
|
||||
--van-nav-bar-background: #ecfdf5;
|
||||
--van-nav-bar-title-text-color: #059669;
|
||||
--van-cell-group-inset-padding: 0;
|
||||
--van-uploader-size: 96px;
|
||||
--van-uploader-upload-background: #ecfdf5;
|
||||
--van-uploader-upload-icon-color: #059669;
|
||||
--van-uploader-upload-active-color: #10b981;
|
||||
}
|
||||
|
||||
.public-pl-transport-page {
|
||||
padding-bottom: 72px;
|
||||
}
|
||||
|
||||
.public-pl-transport-page .van-cell__title {
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.public-pl-transport-page .van-cell__value {
|
||||
color: #1e293b;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.public-pl-transport-page .route-cell .van-cell__value {
|
||||
text-align: left;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.public-pl-transport-page .product-cell .van-cell__title {
|
||||
color: #1e293b;
|
||||
font-weight: 600;
|
||||
line-height: 1.5;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.public-pl-transport-page .product-cell .van-cell__label {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.public-pl-transport-page .page-footer {
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
bottom: 0;
|
||||
transform: translateX(-50%);
|
||||
width: min(480px, 100vw);
|
||||
padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
|
||||
background: rgba(248, 250, 252, 0.96);
|
||||
border-top: 1px solid #d9e8e2;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
@@ -32,6 +32,15 @@ export function statusTone(status: number | string | null | undefined): string {
|
||||
return map[status] ?? 'info'
|
||||
}
|
||||
|
||||
/** 业务类型 → Element Plus Tag type(报销单/备用金) */
|
||||
export function bizTypeTagType(
|
||||
bizType: string | undefined | null
|
||||
): 'success' | 'warning' | 'danger' | 'info' | 'primary' {
|
||||
if (bizType === '报销单') return 'primary'
|
||||
if (bizType === '备用金') return 'warning'
|
||||
return 'info'
|
||||
}
|
||||
|
||||
/** bx 状态 → Element Plus Tag type(对齐 OpenSpec 语义色) */
|
||||
export function statusTagType(
|
||||
status: number | string | null | undefined
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import type { ViewField } from '@/components/business/system-view-dialog/types'
|
||||
|
||||
type BxKvOpts = Partial<Pick<ViewField, 'long' | 'fullSpan' | 'span' | 'money' | 'tagType'>>
|
||||
|
||||
/** 构建报销模块查看弹窗 KV 字段(空值统一为 —) */
|
||||
export function bxViewKv(label: string, value: unknown, opts: BxKvOpts = {}): ViewField {
|
||||
const text =
|
||||
value === null || value === undefined || value === ''
|
||||
? undefined
|
||||
: typeof value === 'boolean'
|
||||
? value
|
||||
? '是'
|
||||
: '否'
|
||||
: String(value)
|
||||
return { label, value: text, ...opts }
|
||||
}
|
||||
|
||||
/** 长文本 / 备注 / 地址等 */
|
||||
export function bxViewKvLong(label: string, value: unknown, opts: BxKvOpts = {}): ViewField {
|
||||
return bxViewKv(label, value, { long: true, span: true, ...opts })
|
||||
}
|
||||
|
||||
/** 金额类(红色加粗由 money 样式控制) */
|
||||
export function bxViewKvMoney(label: string, display: string, opts: BxKvOpts = {}): ViewField {
|
||||
return { label, value: display || '—', money: true, ...opts }
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import type { TagType, ViewField } from '@/components/business/system-view-dialog/types'
|
||||
import { formatViewValue } from '@/components/business/system-view-dialog/types'
|
||||
|
||||
type DictStoreLike = {
|
||||
getLabel: (dictType: string, value: string) => string
|
||||
getTagType: (dictType: string, value: string) => TagType
|
||||
}
|
||||
|
||||
export function crmField(label: string, value: unknown, extra?: Partial<ViewField>): ViewField {
|
||||
return { label, value: formatViewValue(value), ...extra }
|
||||
}
|
||||
|
||||
export function crmLongField(label: string, value: unknown, extra?: Partial<ViewField>): ViewField {
|
||||
return { label, value: formatViewValue(value), long: true, span: true, ...extra }
|
||||
}
|
||||
|
||||
export function crmDictField(
|
||||
label: string,
|
||||
dictType: string,
|
||||
value: string | null | undefined,
|
||||
dictStore: DictStoreLike,
|
||||
extra?: Partial<ViewField>
|
||||
): ViewField {
|
||||
return {
|
||||
label,
|
||||
value: value ? String(dictStore.getLabel(dictType, value)) : '—',
|
||||
tagType: value ? dictStore.getTagType(dictType, value) : undefined,
|
||||
...extra
|
||||
}
|
||||
}
|
||||
|
||||
export function crmTagField(
|
||||
label: string,
|
||||
display: string,
|
||||
tagType?: TagType,
|
||||
extra?: Partial<ViewField>
|
||||
): ViewField {
|
||||
return { label, value: display || '—', tagType, ...extra }
|
||||
}
|
||||
@@ -5,7 +5,6 @@
|
||||
import axios, { type AxiosRequestConfig, type InternalAxiosRequestConfig } from 'axios'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { applyPortalAuthHeader } from '@/utils/http/portal-auth'
|
||||
|
||||
export interface BxApiResponse<T = unknown> {
|
||||
code: number
|
||||
@@ -13,14 +12,80 @@ export interface BxApiResponse<T = unknown> {
|
||||
data?: T
|
||||
}
|
||||
|
||||
/** 解析 bx / 运输模块响应体:兼容直出 JSON 与 { code, data } 信封 */
|
||||
export function pickBxData<T>(res: unknown): T {
|
||||
if (res == null) return res as T
|
||||
if (Array.isArray(res)) return res as T
|
||||
if (typeof res !== 'object') return res as T
|
||||
|
||||
const obj = res as BxApiResponse<T> & Record<string, unknown>
|
||||
if ('data' in obj && obj.data !== undefined) {
|
||||
return obj.data as T
|
||||
}
|
||||
return res as T
|
||||
}
|
||||
|
||||
/** 解析列表类响应,保证始终返回数组 */
|
||||
export function pickBxList<T>(res: unknown): T[] {
|
||||
const payload = pickBxData<T[] | { list?: T[]; rows?: T[] }>(res)
|
||||
if (Array.isArray(payload)) return payload
|
||||
if (payload && typeof payload === 'object') {
|
||||
const record = payload as { list?: T[]; rows?: T[] }
|
||||
if (Array.isArray(record.list)) return record.list
|
||||
if (Array.isArray(record.rows)) return record.rows
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
||||
const bxAxios = axios.create({
|
||||
baseURL: '/api',
|
||||
timeout: 60000,
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
})
|
||||
|
||||
bxAxios.interceptors.request.use((config: InternalAxiosRequestConfig) => {
|
||||
applyPortalAuthHeader(config)
|
||||
/** FastAPI @router.get("/") 集合根须带尾斜杠,否则 307 重定向到绝对 URL 会丢 Authorization */
|
||||
const BX_COLLECTION_ROOT = /^\/(transport\/(order|plan|freight)|reimburses|advances|payments|workflows|expense-items)$/
|
||||
|
||||
function normalizeBxUrl(url?: string): string | undefined {
|
||||
if (!url || url.endsWith('/')) return url
|
||||
return BX_COLLECTION_ROOT.test(url) ? `${url}/` : url
|
||||
}
|
||||
|
||||
/** 从 localStorage 兜底读取 accessToken(兼容 Pinia persist 的版本化 key) */
|
||||
function readTokenFallback(): string {
|
||||
if (typeof localStorage === 'undefined') return ''
|
||||
try {
|
||||
// 尝试 Pinia persist 的版本化 key(如 sys-v3.0.2-user)
|
||||
for (const k of Object.keys(localStorage)) {
|
||||
if (!k.startsWith('sys-') || !k.includes('-user')) continue
|
||||
const raw = localStorage.getItem(k)
|
||||
if (!raw) continue
|
||||
const parsed = JSON.parse(raw) as { accessToken?: unknown }
|
||||
const token = parsed?.accessToken
|
||||
if (typeof token === 'string' && token.trim()) return token.trim()
|
||||
}
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
bxAxios.interceptors.request.use(async (config: InternalAxiosRequestConfig) => {
|
||||
if (config.url) {
|
||||
config.url = normalizeBxUrl(config.url)
|
||||
}
|
||||
const store = useUserStore()
|
||||
let token = store.accessToken as unknown as string
|
||||
if (!token) {
|
||||
token = readTokenFallback()
|
||||
}
|
||||
if (token) {
|
||||
if (typeof config.headers.set === 'function') {
|
||||
config.headers.set('Authorization', `Bearer ${token}`)
|
||||
} else {
|
||||
config.headers.Authorization = `Bearer ${token}`
|
||||
}
|
||||
}
|
||||
return config
|
||||
})
|
||||
|
||||
@@ -76,6 +141,9 @@ const bxRequest = {
|
||||
put<T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig) {
|
||||
return request<T>({ ...config, url, method: 'PUT', data })
|
||||
},
|
||||
patch<T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig) {
|
||||
return request<T>({ ...config, url, method: 'PATCH', data })
|
||||
},
|
||||
delete<T = unknown>(url: string, config?: AxiosRequestConfig) {
|
||||
return request<T>({ ...config, url, method: 'DELETE' })
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import axios, { type AxiosRequestConfig, type InternalAxiosRequestConfig } from
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { fetchRefreshToken } from '@/api/auth'
|
||||
import { applyPortalAuthHeader } from '@/utils/http/portal-auth'
|
||||
|
||||
type RetryableConfig = InternalAxiosRequestConfig & {
|
||||
_retry?: boolean
|
||||
@@ -51,11 +50,40 @@ function onRefreshFailed(error: unknown) {
|
||||
pendingRequests = []
|
||||
}
|
||||
|
||||
dbAxios.interceptors.request.use((config: InternalAxiosRequestConfig) => {
|
||||
/** 从 localStorage 兜底读取 accessToken(兼容 Pinia persist 的版本化 key) */
|
||||
function readTokenFallback(): string {
|
||||
if (typeof localStorage === 'undefined') return ''
|
||||
try {
|
||||
for (const k of Object.keys(localStorage)) {
|
||||
if (!k.startsWith('sys-') || !k.includes('-user')) continue
|
||||
const raw = localStorage.getItem(k)
|
||||
if (!raw) continue
|
||||
const parsed = JSON.parse(raw) as { accessToken?: unknown }
|
||||
const token = parsed?.accessToken
|
||||
if (typeof token === 'string' && token.trim()) return token.trim()
|
||||
}
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
dbAxios.interceptors.request.use(async (config: InternalAxiosRequestConfig) => {
|
||||
if (config.url) {
|
||||
config.url = normalizeDbUrl(config.url)
|
||||
}
|
||||
applyPortalAuthHeader(config)
|
||||
const store = useUserStore()
|
||||
let token = store.accessToken as unknown as string
|
||||
if (!token) {
|
||||
token = readTokenFallback()
|
||||
}
|
||||
if (token) {
|
||||
if (typeof config.headers.set === 'function') {
|
||||
config.headers.set('Authorization', `Bearer ${token}`)
|
||||
} else {
|
||||
config.headers.Authorization = `Bearer ${token}`
|
||||
}
|
||||
}
|
||||
return config
|
||||
})
|
||||
|
||||
@@ -74,7 +102,11 @@ dbAxios.interceptors.response.use(
|
||||
return new Promise((resolve, reject) => {
|
||||
subscribeTokenRefresh(
|
||||
(newToken: string) => {
|
||||
applyPortalAuthHeader(config)
|
||||
if (typeof config.headers.set === 'function') {
|
||||
config.headers.set('Authorization', `Bearer ${newToken}`)
|
||||
} else {
|
||||
config.headers.Authorization = `Bearer ${newToken}`
|
||||
}
|
||||
config._retry = true
|
||||
resolve(dbAxios.request(config))
|
||||
},
|
||||
@@ -89,7 +121,11 @@ dbAxios.interceptors.response.use(
|
||||
const result = await fetchRefreshToken(storedRefreshToken)
|
||||
userStore.setToken(result.token, result.refreshToken)
|
||||
onRefreshed(result.token)
|
||||
applyPortalAuthHeader(config)
|
||||
if (typeof config.headers.set === 'function') {
|
||||
config.headers.set('Authorization', `Bearer ${result.token}`)
|
||||
} else {
|
||||
config.headers.Authorization = `Bearer ${result.token}`
|
||||
}
|
||||
return dbAxios.request(config)
|
||||
} catch (refreshError) {
|
||||
onRefreshFailed(refreshError)
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import axios from 'axios'
|
||||
import type { BaseResponse } from '@/types'
|
||||
|
||||
const publicPlRequest = axios.create({
|
||||
baseURL: import.meta.env.VITE_API_URL || '/api',
|
||||
timeout: 60000
|
||||
})
|
||||
|
||||
publicPlRequest.interceptors.response.use(response => {
|
||||
const payload = response.data as BaseResponse<unknown>
|
||||
if (payload && typeof payload.code === 'number' && payload.code !== 200) {
|
||||
return Promise.reject(new Error(payload.message || '请求失败'))
|
||||
}
|
||||
return response
|
||||
})
|
||||
|
||||
export async function publicPlGet<T>(url: string): Promise<T> {
|
||||
const res = await publicPlRequest.get<BaseResponse<T>>(url)
|
||||
return (res.data?.data ?? res.data) as T
|
||||
}
|
||||
|
||||
export async function publicPlPost<T>(url: string, data?: unknown): Promise<T> {
|
||||
const res = await publicPlRequest.post<BaseResponse<T>>(url, data)
|
||||
return (res.data?.data ?? res.data) as T
|
||||
}
|
||||
|
||||
export async function publicPlUpload<T>(url: string, file: File): Promise<T> {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
const res = await publicPlRequest.post<BaseResponse<T>>(url, formData, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' }
|
||||
})
|
||||
return (res.data?.data ?? res.data) as T
|
||||
}
|
||||
|
||||
export default publicPlRequest
|
||||
@@ -0,0 +1,160 @@
|
||||
export function getPlVehicleStatusTagType(status: string) {
|
||||
const map: Record<string, string> = {
|
||||
available: 'success',
|
||||
maintaining: 'warning',
|
||||
scrapped: 'danger'
|
||||
}
|
||||
return map[status] || 'info'
|
||||
}
|
||||
|
||||
export function getPlVehicleStatusLabel(status: string) {
|
||||
const map: Record<string, string> = {
|
||||
available: '可用',
|
||||
maintaining: '维修中',
|
||||
scrapped: '报废'
|
||||
}
|
||||
return map[status] || status
|
||||
}
|
||||
|
||||
export function getPlVehicleTypeLabel(type: string) {
|
||||
return type === 'self' ? '自有' : type === 'carrier' ? '承运商' : type
|
||||
}
|
||||
|
||||
export function getPlVehicleTypeTagType(type: string) {
|
||||
return type === 'self' ? 'success' : 'warning'
|
||||
}
|
||||
|
||||
export function getPlCarrierStatusLabel(status: string) {
|
||||
return status === '1' ? '合作中' : '已终止'
|
||||
}
|
||||
|
||||
export function getPlCarrierStatusTagType(status: string) {
|
||||
return status === '1' ? 'success' : 'danger'
|
||||
}
|
||||
|
||||
export function getPlanProductSpec(product: { model?: string; packageSpec?: string }) {
|
||||
return product.model || product.packageSpec || '—'
|
||||
}
|
||||
|
||||
export function getPlanProductQuantity(product: {
|
||||
quantity?: number | string | null
|
||||
actualQty?: number | string | null
|
||||
inboundEstimateQty?: number | string | null
|
||||
outboundEstimateQty?: number | string | null
|
||||
}) {
|
||||
const qty =
|
||||
product.actualQty ??
|
||||
product.quantity ??
|
||||
product.inboundEstimateQty ??
|
||||
product.outboundEstimateQty
|
||||
if (qty === undefined || qty === null || qty === '') return '—'
|
||||
return String(qty)
|
||||
}
|
||||
|
||||
export function formatPlanProductListText(
|
||||
product: {
|
||||
productName?: string
|
||||
model?: string
|
||||
packageSpec?: string
|
||||
unit?: string
|
||||
quantity?: number | string | null
|
||||
actualQty?: number | string | null
|
||||
inboundEstimateQty?: number | string | null
|
||||
outboundEstimateQty?: number | string | null
|
||||
},
|
||||
getUnitLabel?: (unit: string) => string
|
||||
) {
|
||||
const name = product.productName || '—'
|
||||
const spec = getPlanProductSpec(product)
|
||||
const qty = getPlanProductQuantity(product)
|
||||
const unitRaw = product.unit || ''
|
||||
const unit = unitRaw ? (getUnitLabel ? getUnitLabel(unitRaw) || unitRaw : unitRaw) : ''
|
||||
|
||||
const specPart = spec && spec !== '—' ? `(${spec})` : ''
|
||||
let qtyUnit = '—'
|
||||
if (qty !== '—' && unit) {
|
||||
qtyUnit = `${qty}${unit}`
|
||||
} else if (qty !== '—') {
|
||||
qtyUnit = qty
|
||||
} else if (unit) {
|
||||
qtyUnit = unit
|
||||
}
|
||||
|
||||
return `${name}${specPart},${qtyUnit}`
|
||||
}
|
||||
|
||||
export function getPlPlanCompanyLabel(company?: string) {
|
||||
const map: Record<string, string> = { shanxia: '安庆山峡', yundong: '安徽云栋' }
|
||||
return company ? map[company] || company : '—'
|
||||
}
|
||||
|
||||
export function getPlPlanTypeTagType(type?: string) {
|
||||
const map: Record<string, string> = { direct: 'primary', inbound: 'success', outbound: 'warning' }
|
||||
return map[type || ''] || 'info'
|
||||
}
|
||||
|
||||
export function getPlPlanTypeLabel(type?: string) {
|
||||
const map: Record<string, string> = { direct: '直销单', inbound: '入库单', outbound: '出库单' }
|
||||
return type ? map[type] || type : '—'
|
||||
}
|
||||
|
||||
export function getPlPlanFollowStatusTagType(status?: string) {
|
||||
const map: Record<string, string> = {
|
||||
draft: 'info',
|
||||
processing: 'warning',
|
||||
completed: 'success',
|
||||
cancelled: 'danger'
|
||||
}
|
||||
return map[status || ''] || 'info'
|
||||
}
|
||||
|
||||
export function getPlPlanFollowStatusLabel(status?: string) {
|
||||
const map: Record<string, string> = {
|
||||
draft: '草稿',
|
||||
processing: '进行中',
|
||||
completed: '已完成',
|
||||
cancelled: '已取消'
|
||||
}
|
||||
return status ? map[status] || status : '—'
|
||||
}
|
||||
|
||||
export function getPlPlanArchiveStatusTagType(status?: string) {
|
||||
return status === 'archived' ? 'info' : 'success'
|
||||
}
|
||||
|
||||
export function getPlPlanArchiveStatusLabel(status?: string) {
|
||||
return status === 'archived' ? '已归档' : '未归档'
|
||||
}
|
||||
|
||||
export function getPlPlanCompleteStatusLabel(status?: string) {
|
||||
return status === 'yes' ? '是' : '否'
|
||||
}
|
||||
|
||||
export function getPlFreightTypeLabel(type?: string) {
|
||||
const map: Record<string, string> = { by_weight: '按重量', by_trip: '按趟' }
|
||||
return type ? map[type] || type : '—'
|
||||
}
|
||||
|
||||
export function getPlYesNoLabel(value?: number | boolean | null) {
|
||||
return value === 1 || value === true ? '是' : '否'
|
||||
}
|
||||
|
||||
/** 解析运输单司机回传附件(JSON 数组或逗号分隔) */
|
||||
export function parsePlFeedbackImages(raw?: string | string[] | null): string[] {
|
||||
if (!raw) return []
|
||||
if (Array.isArray(raw)) return raw.map((item) => String(item).trim()).filter(Boolean)
|
||||
const text = String(raw).trim()
|
||||
if (!text) return []
|
||||
try {
|
||||
const parsed = JSON.parse(text)
|
||||
if (Array.isArray(parsed)) {
|
||||
return parsed.map((item) => String(item).trim()).filter(Boolean)
|
||||
}
|
||||
} catch {
|
||||
// fall through
|
||||
}
|
||||
return text
|
||||
.split(',')
|
||||
.map((item) => item.trim())
|
||||
.filter(Boolean)
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
import type { AppRouteRecord } from '@/types/router'
|
||||
|
||||
/** 目录型菜单缺省图标 */
|
||||
export const DEFAULT_SUBMENU_ICON = 'ri:folder-2-line'
|
||||
|
||||
/** 叶子菜单缺省图标 */
|
||||
export const DEFAULT_MENU_ITEM_ICON = 'ri:file-list-2-line'
|
||||
|
||||
/**
|
||||
* 侧栏菜单图标映射(按路由 name;未在 meta 配置 icon 时使用)
|
||||
* 键与 router/modules 中 name 一致,便于前后端菜单对齐。
|
||||
*/
|
||||
export const SIDEBAR_MENU_ICON_MAP: Record<string, string> = {
|
||||
// ── 报销管理 ──
|
||||
BxManagement: 'ri:wallet-3-line',
|
||||
BxExpenseItem: 'ri:price-tag-3-line',
|
||||
BxWorkflowAdvance: 'ri:git-branch-line',
|
||||
BxWorkflowReimburse: 'ri:git-merge-line',
|
||||
BxAdvanceApply: 'ri:money-cny-circle-line',
|
||||
BxAdvanceApprove: 'ri:check-double-line',
|
||||
BxAdvanceIssue: 'ri:hand-coin-line',
|
||||
BxReimburseApply: 'ri:file-edit-line',
|
||||
BxReimburseApprove: 'ri:checkbox-circle-line',
|
||||
BxPayment: 'ri:bank-card-line',
|
||||
BxViewMine: 'ri:user-line',
|
||||
BxViewTodo: 'ri:time-line',
|
||||
BxViewAll: 'ri:file-list-3-line',
|
||||
|
||||
// ── CRM ──
|
||||
CrmManagement: 'goods',
|
||||
CrmProductCategory: 'ri:folder-3-line',
|
||||
CrmProduct: 'ri:box-3-line',
|
||||
CrmClue: 'ri:seedling-line',
|
||||
CrmOpportunity: 'ri:trophy-line',
|
||||
CrmQuote: 'ri:file-text-line',
|
||||
CrmContract: 'ri:file-paper-2-line',
|
||||
CrmCustomer: 'ri:team-line',
|
||||
CrmCustomerPool: 'ri:global-line',
|
||||
|
||||
// ── 地磅 ──
|
||||
DbManagement: 'ri:scales-3-line',
|
||||
DbDashboard: 'ri:dashboard-line',
|
||||
DbPlans: 'ri:calendar-schedule-line',
|
||||
DbInventory: 'ri:archive-line',
|
||||
DbWeighing: 'ri:scales-line',
|
||||
DbVehicles: 'ri:car-line',
|
||||
|
||||
// ── 工作流 ──
|
||||
Workflow: 'workflow',
|
||||
WorkflowProcess: 'workflow',
|
||||
WorkflowPending: 'ri:inbox-line',
|
||||
WorkflowCompleted: 'ri:checkbox-circle-line',
|
||||
WorkflowMyApplications: 'ri:file-user-line',
|
||||
LeaveRequest: 'ri:calendar-event-line',
|
||||
|
||||
// ── 系统 ──
|
||||
SystemManage: 'ri:settings-3-line',
|
||||
Tenant: 'ri:building-line',
|
||||
Dict: 'ri:book-2-line',
|
||||
Menu: 'ri:menu-line',
|
||||
Dept: 'ri:organization-chart',
|
||||
Role: 'ri:shield-user-line',
|
||||
User: 'user',
|
||||
Post: 'ri:briefcase-line',
|
||||
|
||||
// ── 运输 ──
|
||||
TransportPlan: 'ri:truck-line',
|
||||
PlCarrier: 'ri:building-2-line',
|
||||
PlVehicle: 'ri:truck-line',
|
||||
PlSelfVehicle: 'ri:car-line',
|
||||
PlPersonnel: 'ri:user-settings-line',
|
||||
PlPlan: 'ri:route-line',
|
||||
PlPlanCert: 'ri:shield-check-line',
|
||||
PlFreight: 'ri:money-cny-box-line',
|
||||
PlDocumentReminder: 'ri:alarm-warning-line'
|
||||
}
|
||||
|
||||
/** 按 menuCode 补充映射(后端菜单可能仅有 code) */
|
||||
export const SIDEBAR_MENU_ICON_BY_CODE: Record<string, string> = {
|
||||
'bx:expenseItem:list': 'ri:price-tag-3-line',
|
||||
'bx:workflowAdvance:list': 'ri:git-branch-line',
|
||||
'bx:workflowReimburse:list': 'ri:git-merge-line',
|
||||
'bx:advanceApply:list': 'ri:money-cny-circle-line',
|
||||
'bx:advanceApprove:list': 'ri:check-double-line',
|
||||
'bx:advanceIssue:list': 'ri:hand-coin-line',
|
||||
'bx:reimburseApply:list': 'ri:file-edit-line',
|
||||
'bx:reimburseApprove:list': 'ri:checkbox-circle-line',
|
||||
'bx:payment:list': 'ri:bank-card-line',
|
||||
'bx:viewMine:list': 'ri:user-line',
|
||||
'bx:viewTodo:list': 'ri:time-line',
|
||||
'bx:viewAll:list': 'ri:file-list-3-line',
|
||||
'crm:productCategory:list': 'ri:folder-3-line',
|
||||
'crm:product:list': 'ri:box-3-line',
|
||||
'crm:clue:list': 'ri:seedling-line',
|
||||
'crm:opportunity:list': 'ri:trophy-line',
|
||||
'crm:quote:list': 'ri:file-text-line',
|
||||
'crm:contract:list': 'ri:file-paper-2-line',
|
||||
'crm:customer:list': 'ri:team-line',
|
||||
'crm:customerPool:list': 'ri:global-line',
|
||||
'db:dashboard:list': 'ri:dashboard-line',
|
||||
'db:plan:list': 'ri:calendar-schedule-line',
|
||||
'db:inventory:list': 'ri:archive-line',
|
||||
'db:weighing:list': 'ri:scales-line',
|
||||
'db:vehicle:list': 'ri:car-line',
|
||||
'workflow:process': 'workflow',
|
||||
'workflow:pending': 'ri:inbox-line',
|
||||
'workflow:completed': 'ri:checkbox-circle-line',
|
||||
'workflow:myApplications': 'ri:file-user-line',
|
||||
'workflow:leave': 'ri:calendar-event-line',
|
||||
'system:tenant:list': 'ri:building-line',
|
||||
'system:dict:list': 'ri:book-2-line',
|
||||
'system:menu:list': 'ri:menu-line',
|
||||
'system:dept:list': 'ri:organization-chart',
|
||||
'system:role:list': 'ri:shield-user-line',
|
||||
'system:user:list': 'user',
|
||||
'system:post:list': 'ri:briefcase-line',
|
||||
'pl:carrier:list': 'ri:building-2-line',
|
||||
'pl:vehicle:list': 'ri:truck-line',
|
||||
'pl:self-vehicle:list': 'ri:car-line',
|
||||
'pl:driver:list': 'ri:user-settings-line',
|
||||
'pl:plan:list': 'ri:route-line',
|
||||
'pl:plan-cert:list': 'ri:shield-check-line',
|
||||
'pl:freight:list': 'ri:money-cny-box-line',
|
||||
'pl:document:list': 'ri:alarm-warning-line'
|
||||
}
|
||||
|
||||
function lookupMappedIcon(item: AppRouteRecord): string {
|
||||
const metaIcon = String(item.meta?.icon ?? '').trim()
|
||||
if (metaIcon) return metaIcon
|
||||
|
||||
const name = String(item.name ?? '').trim()
|
||||
if (name && SIDEBAR_MENU_ICON_MAP[name]) {
|
||||
return SIDEBAR_MENU_ICON_MAP[name]
|
||||
}
|
||||
|
||||
const menuCode = String((item.meta as { menuCode?: string })?.menuCode ?? '').trim()
|
||||
if (menuCode && SIDEBAR_MENU_ICON_BY_CODE[menuCode]) {
|
||||
return SIDEBAR_MENU_ICON_BY_CODE[menuCode]
|
||||
}
|
||||
|
||||
return ''
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析侧栏菜单图标:meta.icon → 路由 name / menuCode 映射 → 缺省图标。
|
||||
*/
|
||||
export function resolveSidebarMenuIcon(
|
||||
item: AppRouteRecord,
|
||||
hasChildren = false
|
||||
): string {
|
||||
const mapped = lookupMappedIcon(item)
|
||||
if (mapped) return mapped
|
||||
return hasChildren ? DEFAULT_SUBMENU_ICON : DEFAULT_MENU_ITEM_ICON
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
import type { AppRouteRecord } from '@/types/router'
|
||||
import { getFirstMenuPath } from '@/utils/navigation/route'
|
||||
import { filterSidebarRoutes } from '@/utils/router/sidebar-menu-filter'
|
||||
|
||||
/** 门户顶栏一级模块展示顺序(与路由注册顺序无关) */
|
||||
export const PORTAL_TOP_MODULE_ORDER = [
|
||||
'/crm',
|
||||
'/bx',
|
||||
'/db',
|
||||
'/pl',
|
||||
'/workflow',
|
||||
'/system'
|
||||
] as const
|
||||
|
||||
export type PortalTopModulePath = (typeof PORTAL_TOP_MODULE_ORDER)[number]
|
||||
|
||||
export function isDashboardMenuItem(item: AppRouteRecord): boolean {
|
||||
const path = String(item.path ?? '')
|
||||
const title = String(item.meta?.title ?? '')
|
||||
const name = String(item.name ?? '')
|
||||
return (
|
||||
path === '/dashboard' ||
|
||||
title === '控制台' ||
|
||||
name === 'Dashboard' ||
|
||||
title === 'menus.dashboard.title'
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤并排序门户一级模块(排除控制台与 isHide)
|
||||
*/
|
||||
export function filterPortalTopModules(menuList: AppRouteRecord[]): AppRouteRecord[] {
|
||||
const visible = (menuList || []).filter(
|
||||
(item) => !item.meta?.isHide && !isDashboardMenuItem(item)
|
||||
)
|
||||
const orderMap = new Map<string, number>(
|
||||
PORTAL_TOP_MODULE_ORDER.map((path, index) => [path, index])
|
||||
)
|
||||
|
||||
return visible.sort((a, b) => {
|
||||
const orderA = orderMap.get(String(a.path ?? '')) ?? 999
|
||||
const orderB = orderMap.get(String(b.path ?? '')) ?? 999
|
||||
return orderA - orderB
|
||||
})
|
||||
}
|
||||
|
||||
export function resolveTopModulePath(routePath: string): string {
|
||||
const segment = routePath.split('/').filter(Boolean)[0]
|
||||
return segment ? `/${segment}` : ''
|
||||
}
|
||||
|
||||
export function resolveActivePortalModule(
|
||||
menuList: AppRouteRecord[],
|
||||
routePath: string
|
||||
): AppRouteRecord | undefined {
|
||||
const tops = filterPortalTopModules(menuList)
|
||||
const activeTopPath = resolveTopModulePath(routePath)
|
||||
return tops.find((menu) => menu.path === activeTopPath)
|
||||
}
|
||||
|
||||
function isRouteInMenuTree(item: AppRouteRecord, targetPath: string): boolean {
|
||||
const activePath = String(targetPath)
|
||||
const itemPath = String(item.meta?.activePath || item.path || '')
|
||||
|
||||
if (itemPath && (activePath === itemPath || activePath.startsWith(`${itemPath}/`))) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (item.children?.length) {
|
||||
return item.children.some((child) => isRouteInMenuTree(child, activePath))
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/** 判断一级模块卡片是否为当前路由所属模块 */
|
||||
export function isPortalModuleActive(item: AppRouteRecord, routePath: string): boolean {
|
||||
const modulePath = String(item.path || '')
|
||||
const activePath = String(routePath)
|
||||
|
||||
if (modulePath && (activePath === modulePath || activePath.startsWith(`${modulePath}/`))) {
|
||||
return true
|
||||
}
|
||||
|
||||
return isRouteInMenuTree(item, activePath)
|
||||
}
|
||||
|
||||
/** 模块首个可访问叶子路径(用于点击卡片跳转) */
|
||||
export function getFirstAccessiblePath(module: AppRouteRecord): string {
|
||||
if (module.redirect) {
|
||||
return String(module.redirect)
|
||||
}
|
||||
|
||||
const children = module.children ? filterSidebarRoutes(module.children) : []
|
||||
if (children.length) {
|
||||
const childPath = getFirstMenuPath(children, module.path)
|
||||
if (childPath) {
|
||||
return childPath
|
||||
}
|
||||
}
|
||||
|
||||
return module.path || '/'
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
import type { ViewField } from '@/components/business/system-view-dialog/types'
|
||||
|
||||
/** 显示文本达到此长度视为长值(一行占 2 格,4 列栅格下每行 2 个) */
|
||||
export const VIEW_KV_LONG_MIN_LEN = 17
|
||||
|
||||
/** 显示文本达到此长度占满整行 */
|
||||
export const VIEW_KV_FULL_MIN_LEN = 80
|
||||
|
||||
const LONG_LABEL_RE =
|
||||
/备注|地址|描述|说明|条款|原因|摘要|网站|路径|意向|竞争|决策|需求|付款|交付|关联人员/
|
||||
|
||||
export function getViewFieldDisplayText(
|
||||
field: ViewField,
|
||||
formatValue: (val: unknown) => string
|
||||
): string {
|
||||
if (field.items?.length) return field.items.join('、')
|
||||
return formatValue(field.value)
|
||||
}
|
||||
|
||||
/** 是否长值字段(4 列栅格下占 2 列,即一行 2 个) */
|
||||
export function isViewFieldLong(field: ViewField, displayText: string): boolean {
|
||||
if (field.long === false) return false
|
||||
if (field.long === true || field.span === true) return true
|
||||
if (field.span === 'full') return true
|
||||
if (field.items?.length) {
|
||||
const joined = field.items.join('、')
|
||||
if (joined.length >= VIEW_KV_LONG_MIN_LEN) return true
|
||||
}
|
||||
if (displayText === '—') return false
|
||||
if (displayText.includes(' / ')) return true
|
||||
if (LONG_LABEL_RE.test(field.label)) return true
|
||||
return displayText.length >= VIEW_KV_LONG_MIN_LEN
|
||||
}
|
||||
|
||||
/** 是否占满整行(备注超长、显式 fullSpan / span:'full') */
|
||||
export function isViewFieldFullSpan(field: ViewField, displayText: string): boolean {
|
||||
if (field.fullSpan === true || field.span === 'full') return true
|
||||
if (displayText === '—') return false
|
||||
return displayText.length >= VIEW_KV_FULL_MIN_LEN
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看弹窗 KV 栅格跨列 class。
|
||||
* - 4 列:短值 1 列(4 个/行),长值 span 2(2 个/行),超长 span full
|
||||
* - 2 列:长值占满一行
|
||||
*/
|
||||
export function getViewKvSpanClass(
|
||||
field: ViewField,
|
||||
gridColumns: number,
|
||||
formatValue: (val: unknown) => string
|
||||
): string {
|
||||
const text = getViewFieldDisplayText(field, formatValue)
|
||||
if (isViewFieldFullSpan(field, text)) return 'view-kv-span-full'
|
||||
if (!isViewFieldLong(field, text)) return ''
|
||||
if (gridColumns <= 1) return ''
|
||||
if (gridColumns === 2) return 'view-kv-span-full'
|
||||
return 'view-kv-span-2'
|
||||
}
|
||||
|
||||
export type ViewKvTableRow =
|
||||
| { type: 'long'; field: ViewField }
|
||||
| { type: 'dual'; left: ViewField; right?: ViewField }
|
||||
|
||||
/** KV 表格模式(双组四列):长字段独占行,短字段两两一行 */
|
||||
export function buildViewKvTableDualRows(
|
||||
fields: ViewField[],
|
||||
formatValue: (val: unknown) => string
|
||||
): ViewKvTableRow[] {
|
||||
const rows: ViewKvTableRow[] = []
|
||||
let i = 0
|
||||
while (i < fields.length) {
|
||||
const field = fields[i]
|
||||
const text = getViewFieldDisplayText(field, formatValue)
|
||||
if (isViewFieldLong(field, text) || isViewFieldFullSpan(field, text)) {
|
||||
rows.push({ type: 'long', field })
|
||||
i += 1
|
||||
continue
|
||||
}
|
||||
const next = fields[i + 1]
|
||||
if (next) {
|
||||
const nextText = getViewFieldDisplayText(next, formatValue)
|
||||
if (!isViewFieldLong(next, nextText) && !isViewFieldFullSpan(next, nextText)) {
|
||||
rows.push({ type: 'dual', left: field, right: next })
|
||||
i += 2
|
||||
continue
|
||||
}
|
||||
}
|
||||
rows.push({ type: 'dual', left: field })
|
||||
i += 1
|
||||
}
|
||||
return rows
|
||||
}
|
||||
|
||||
export type ViewKvTableTripleRow =
|
||||
| { type: 'long'; field: ViewField }
|
||||
| { type: 'triple'; fields: ViewField[] }
|
||||
|
||||
/** KV 表格模式(三组六列):长字段独占行,短字段最多三个一组 */
|
||||
export function buildViewKvTableTripleRows(
|
||||
fields: ViewField[],
|
||||
formatValue: (val: unknown) => string
|
||||
): ViewKvTableTripleRow[] {
|
||||
const rows: ViewKvTableTripleRow[] = []
|
||||
let i = 0
|
||||
while (i < fields.length) {
|
||||
const field = fields[i]
|
||||
const text = getViewFieldDisplayText(field, formatValue)
|
||||
if (isViewFieldLong(field, text) || isViewFieldFullSpan(field, text)) {
|
||||
rows.push({ type: 'long', field })
|
||||
i += 1
|
||||
continue
|
||||
}
|
||||
const group: ViewField[] = [field]
|
||||
i += 1
|
||||
while (i < fields.length && group.length < 3) {
|
||||
const next = fields[i]
|
||||
const nextText = getViewFieldDisplayText(next, formatValue)
|
||||
if (isViewFieldLong(next, nextText) || isViewFieldFullSpan(next, nextText)) break
|
||||
group.push(next)
|
||||
i += 1
|
||||
}
|
||||
rows.push({ type: 'triple', fields: group })
|
||||
}
|
||||
return rows
|
||||
}
|
||||
@@ -309,7 +309,7 @@
|
||||
|
||||
.input-icon {
|
||||
font-size: 16px;
|
||||
color: #909399;
|
||||
color: #1e293b;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@
|
||||
<el-dialog
|
||||
v-model="dialogs.view"
|
||||
title="备用金申请详情"
|
||||
width="920px"
|
||||
width="1040px"
|
||||
class="dialog-form-layout dialog-view-xl"
|
||||
align-center
|
||||
destroy-on-close
|
||||
@@ -315,24 +315,8 @@
|
||||
</div>
|
||||
|
||||
<div class="dlg-view-section">
|
||||
<div class="dlg-kv dlg-kv--triple">
|
||||
<div class="k">申请人</div>
|
||||
<div class="v">{{ viewData.applicantName || '-' }}</div>
|
||||
<div class="k">申请原因</div>
|
||||
<div class="v"><BaseClampText :text="viewData.reason" /></div>
|
||||
<div class="k">实际发放金额(元)</div>
|
||||
<div class="v money-value">
|
||||
{{ viewData.actualAmount != null ? formatMoneyYuan(viewData.actualAmount) : '—' }}
|
||||
</div>
|
||||
<div class="k">申请金额(元)</div>
|
||||
<div class="v money-value">{{ formatMoneyYuan(viewData.amount || 0) }}</div>
|
||||
<div class="k">冲抵总金额(元)</div>
|
||||
<div class="v money-value">{{ formatMoneyYuan(viewData.offsetAmount || 0) }}</div>
|
||||
<div class="k">当前节点</div>
|
||||
<div class="v">{{ workflowNodeDisplay(viewData.currentNode, viewData.status) }}</div>
|
||||
<div class="k">申请时间</div>
|
||||
<div class="v">{{ viewData.applyTime || '-' }}</div>
|
||||
</div>
|
||||
<h4 class="dlg-view-section-title">基础信息</h4>
|
||||
<BxViewKvTable :fields="viewMainKvFields" mode="triple" />
|
||||
</div>
|
||||
|
||||
<BaseDetailTableSection title="冲抵记录" :data="viewOffsetRecords" empty-text="暂无冲抵记录">
|
||||
@@ -384,7 +368,7 @@
|
||||
<div class="dlg-view-section">
|
||||
<h4 class="dlg-view-section-title">审批进度</h4>
|
||||
<div class="flow-scroll">
|
||||
<ApprovalFlowView :nodes="viewFlowNodes" />
|
||||
<ApprovalFlowView :nodes="viewFlowNodes" :loading="viewFlowLoading" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -405,7 +389,7 @@
|
||||
<el-dialog
|
||||
v-model="dialogs.viewFlow"
|
||||
title="审批流程"
|
||||
width="920px"
|
||||
width="1040px"
|
||||
class="dialog-form-layout dialog-view-xl"
|
||||
align-center
|
||||
destroy-on-close
|
||||
@@ -464,8 +448,10 @@ import {
|
||||
import { useServerPaged } from '@/hooks/bx/useServerPaged'
|
||||
import ApprovalFlowView from '@/components/bx/base/ApprovalFlowView.vue'
|
||||
import ApprovalHistoryView from '@/components/bx/base/ApprovalHistoryView.vue'
|
||||
import BaseClampText from '@/components/bx/base/BaseClampText.vue'
|
||||
import BxViewKvTable from '@/components/bx/base/BxViewKvTable.vue'
|
||||
import BaseDetailTableSection from '@/components/bx/base/BaseDetailTableSection.vue'
|
||||
import type { ViewField } from '@/components/business/system-view-dialog/types'
|
||||
import { bxViewKv, bxViewKvLong, bxViewKvMoney } from '@/utils/bx/view-kv'
|
||||
|
||||
type DialogKey = 'add' | 'view' | 'viewFlow'
|
||||
|
||||
@@ -539,6 +525,22 @@ const addFormRules = {
|
||||
|
||||
const addFormRef = ref<FormInstance>()
|
||||
const viewData = ref<Record<string, any>>({})
|
||||
|
||||
const viewMainKvFields = computed<ViewField[]>(() => {
|
||||
const d = viewData.value
|
||||
return [
|
||||
bxViewKv('申请人', d.applicantName),
|
||||
bxViewKvMoney(
|
||||
'实际发放金额(元)',
|
||||
d.actualAmount != null ? formatMoneyYuan(d.actualAmount) : '—'
|
||||
),
|
||||
bxViewKvMoney('申请金额(元)', formatMoneyYuan(d.amount || 0)),
|
||||
bxViewKvMoney('冲抵总金额(元)', formatMoneyYuan(d.offsetAmount || 0)),
|
||||
bxViewKv('当前节点', workflowNodeDisplay(d.currentNode, d.status)),
|
||||
bxViewKv('申请时间', d.applyTime),
|
||||
bxViewKvLong('申请原因', d.reason)
|
||||
]
|
||||
})
|
||||
const selectedRows = ref<any[]>([])
|
||||
const editingId = ref<number | null>(null)
|
||||
const flowNodes = ref<any[]>([])
|
||||
|
||||
@@ -304,7 +304,7 @@
|
||||
<el-dialog
|
||||
v-model="dialogs.view"
|
||||
title="备用金申请详情"
|
||||
width="920px"
|
||||
width="1040px"
|
||||
class="dialog-form-layout dialog-view-xl"
|
||||
align-center
|
||||
destroy-on-close
|
||||
@@ -325,29 +325,19 @@
|
||||
</div>
|
||||
|
||||
<div class="dlg-view-section">
|
||||
<div class="dlg-kv dlg-kv--triple">
|
||||
<div class="k">申请人</div>
|
||||
<div class="v">{{ viewData.applicantName || '-' }}</div>
|
||||
<div class="k">申请原因</div>
|
||||
<div class="v"><BaseClampText :text="viewData.reason" /></div>
|
||||
<div class="k">申请金额(元)</div>
|
||||
<div class="v money-value">{{ formatMoneyYuan(viewData.amount || 0) }}</div>
|
||||
<div class="k">当前节点</div>
|
||||
<div class="v">{{ workflowNodeDisplay(viewData.currentNode, viewData.status) }}</div>
|
||||
<div class="k">申请时间</div>
|
||||
<div class="v">{{ viewData.applyTime || '-' }}</div>
|
||||
</div>
|
||||
<h4 class="dlg-view-section-title">基础信息</h4>
|
||||
<BxViewKvTable :fields="viewMainKvFields" mode="dual" />
|
||||
</div>
|
||||
|
||||
<div class="dlg-view-section">
|
||||
<h4>审批进度</h4>
|
||||
<h4 class="dlg-view-section-title">审批进度</h4>
|
||||
<div class="flow-scroll">
|
||||
<ApprovalFlowView :nodes="viewFlowNodes" :loading="viewFlowLoading" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dlg-view-section">
|
||||
<h4>审批历史</h4>
|
||||
<h4 class="dlg-view-section-title">审批历史</h4>
|
||||
<div class="flow-scroll">
|
||||
<ApprovalHistoryView :items="viewApprovalHistory" :loading="viewFlowLoading" />
|
||||
</div>
|
||||
@@ -424,7 +414,9 @@ import { useServerPaged } from '@/hooks/bx/useServerPaged'
|
||||
import { useApplicantOptions } from '@/hooks/bx/useApplicantOptions'
|
||||
import ApprovalFlowView from '@/components/bx/base/ApprovalFlowView.vue'
|
||||
import ApprovalHistoryView from '@/components/bx/base/ApprovalHistoryView.vue'
|
||||
import BaseClampText from '@/components/bx/base/BaseClampText.vue'
|
||||
import BxViewKvTable from '@/components/bx/base/BxViewKvTable.vue'
|
||||
import type { ViewField } from '@/components/business/system-view-dialog/types'
|
||||
import { bxViewKv, bxViewKvLong, bxViewKvMoney } from '@/utils/bx/view-kv'
|
||||
|
||||
type DialogKey = 'view' | 'approve'
|
||||
|
||||
@@ -477,6 +469,17 @@ const stats = computed(() => {
|
||||
})
|
||||
|
||||
const viewData = ref<Record<string, any>>({})
|
||||
|
||||
const viewMainKvFields = computed<ViewField[]>(() => {
|
||||
const d = viewData.value
|
||||
return [
|
||||
bxViewKv('申请人', d.applicantName),
|
||||
bxViewKvLong('申请原因', d.reason),
|
||||
bxViewKvMoney('申请金额(元)', formatMoneyYuan(d.amount || 0)),
|
||||
bxViewKv('当前节点', workflowNodeDisplay(d.currentNode, d.status)),
|
||||
bxViewKv('申请时间', d.applyTime)
|
||||
]
|
||||
})
|
||||
const viewFlowNodes = ref<any[]>([])
|
||||
const viewApprovalHistory = ref<any[]>([])
|
||||
const viewFlowLoading = ref(false)
|
||||
|
||||
@@ -383,7 +383,7 @@
|
||||
<el-dialog
|
||||
v-model="dialogs.view"
|
||||
title="备用金发放详情"
|
||||
width="920px"
|
||||
width="1040px"
|
||||
class="dialog-form-layout dialog-view-xl"
|
||||
align-center
|
||||
destroy-on-close
|
||||
@@ -407,27 +407,13 @@
|
||||
</div>
|
||||
|
||||
<div class="dlg-view-section">
|
||||
<h4 class="dlg-view-section-title">申请信息</h4>
|
||||
<div class="dlg-kv dlg-kv--triple">
|
||||
<div class="k">申请人</div>
|
||||
<div class="v">{{ viewData.applicantName || '-' }}</div>
|
||||
<div class="k">申请原因</div>
|
||||
<div class="v"><BaseClampText :text="viewData.reason" /></div>
|
||||
<div class="k">审批通过时间</div>
|
||||
<div class="v">{{ viewData.approveTime || '-' }}</div>
|
||||
</div>
|
||||
<h4 class="dlg-view-section-title">基础信息</h4>
|
||||
<BxViewKvTable :fields="viewApplyKvFields" mode="triple" />
|
||||
</div>
|
||||
|
||||
<div v-if="viewData.issueStatus === 'issued'" class="dlg-view-section">
|
||||
<h4 class="dlg-view-section-title">发放信息</h4>
|
||||
<div class="dlg-kv dlg-kv--triple">
|
||||
<div class="k">发放时间</div>
|
||||
<div class="v">{{ viewData.issueTime || '-' }}</div>
|
||||
<div class="k">发放操作人</div>
|
||||
<div class="v">{{ viewData.issueUserName || '-' }}</div>
|
||||
<div class="k">发放备注</div>
|
||||
<div class="v"><BaseClampText :text="viewData.issueRemark" /></div>
|
||||
</div>
|
||||
<BxViewKvTable :fields="viewIssueKvFields" mode="triple" />
|
||||
</div>
|
||||
|
||||
<BaseDetailTableSection title="冲抵流水" :data="offsetRecords" empty-text="暂无冲抵记录">
|
||||
@@ -474,7 +460,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref, onMounted } from 'vue'
|
||||
import { reactive, ref, computed, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Check, Download, View, Close, Search, RefreshLeft } from '@element-plus/icons-vue'
|
||||
import { paymentApi, advanceApi } from '@/api/bx'
|
||||
@@ -484,10 +470,12 @@ import { useServerPaged } from '@/hooks/bx/useServerPaged'
|
||||
import { useApplicantOptions } from '@/hooks/bx/useApplicantOptions'
|
||||
import ApprovalFlowView from '@/components/bx/base/ApprovalFlowView.vue'
|
||||
import ApprovalHistoryView from '@/components/bx/base/ApprovalHistoryView.vue'
|
||||
import BaseClampText from '@/components/bx/base/BaseClampText.vue'
|
||||
import BxViewKvTable from '@/components/bx/base/BxViewKvTable.vue'
|
||||
import BaseDetailTableSection from '@/components/bx/base/BaseDetailTableSection.vue'
|
||||
import BxAttachmentUpload from '@/components/bx/base/BxAttachmentUpload.vue'
|
||||
import BxAttachmentReadonly from '@/components/bx/base/BxAttachmentReadonly.vue'
|
||||
import type { ViewField } from '@/components/business/system-view-dialog/types'
|
||||
import { bxViewKv } from '@/utils/bx/view-kv'
|
||||
|
||||
type DialogKey = 'issue' | 'view'
|
||||
|
||||
@@ -547,6 +535,24 @@ const selectedRows = ref<any[]>([])
|
||||
const issueRemark = ref('')
|
||||
const viewData = ref<Record<string, any>>({})
|
||||
|
||||
const viewApplyKvFields = computed<ViewField[]>(() => {
|
||||
const d = viewData.value
|
||||
return [
|
||||
bxViewKv('申请人', d.applicantName, { long: false }),
|
||||
bxViewKv('申请原因', d.reason, { long: false }),
|
||||
bxViewKv('审批通过时间', d.approveTime, { long: false })
|
||||
]
|
||||
})
|
||||
|
||||
const viewIssueKvFields = computed<ViewField[]>(() => {
|
||||
const d = viewData.value
|
||||
return [
|
||||
bxViewKv('发放时间', d.issueTime, { long: false }),
|
||||
bxViewKv('发放操作人', d.issueUserName, { long: false }),
|
||||
bxViewKv('发放备注', d.issueRemark, { long: false })
|
||||
]
|
||||
})
|
||||
|
||||
const actualAmount = ref<number | string>('')
|
||||
const uploadedFiles = ref<BxAttachmentItem[]>([])
|
||||
const issueAttachmentRef = ref<InstanceType<typeof BxAttachmentUpload> | null>(null)
|
||||
|
||||
@@ -323,7 +323,7 @@
|
||||
<el-dialog
|
||||
v-model="dialogs.viewDetail"
|
||||
title="单据详情"
|
||||
width="920px"
|
||||
width="1040px"
|
||||
class="dialog-form-layout dialog-view-xl"
|
||||
align-center
|
||||
destroy-on-close
|
||||
@@ -343,20 +343,12 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="dlg-view-section">
|
||||
<div class="dlg-kv dlg-kv--triple">
|
||||
<div class="k">单号</div>
|
||||
<div class="v">{{ viewData.applyCode || '-' }}</div>
|
||||
<div class="k">申请人</div>
|
||||
<div class="v">{{ viewData.applicantName || '-' }}</div>
|
||||
<div class="k">报销标题</div>
|
||||
<div class="v"><BaseClampText :text="viewData.title" /></div>
|
||||
<div class="k">审批完成时间</div>
|
||||
<div class="v">{{ viewData.applyTime || '-' }}</div>
|
||||
<div class="k">金额(元)</div>
|
||||
<div class="v money-value">{{ formatMoneyYuan(viewData.amount || 0) }}</div>
|
||||
<div class="k">状态</div>
|
||||
<div class="v">{{ statusLabel(viewData.status) }}</div>
|
||||
</div>
|
||||
<h4 class="dlg-view-section-title">基础信息</h4>
|
||||
<BxViewKvTable :fields="viewBasicKvFields" mode="triple" />
|
||||
</div>
|
||||
<div class="dlg-view-section">
|
||||
<h4 class="dlg-view-section-title">发放信息</h4>
|
||||
<BxViewKvTable :fields="viewPayKvFields" mode="triple" />
|
||||
</div>
|
||||
<div v-if="viewAttachments.length" class="dlg-view-section">
|
||||
<h4 class="dlg-view-section-title">相关附件</h4>
|
||||
@@ -520,7 +512,7 @@
|
||||
<el-dialog
|
||||
v-model="dialogs.processedDetail"
|
||||
title="处理详情"
|
||||
width="920px"
|
||||
width="1040px"
|
||||
class="dialog-form-layout dialog-view-xl"
|
||||
align-center
|
||||
destroy-on-close
|
||||
@@ -541,75 +533,29 @@
|
||||
</div>
|
||||
|
||||
<div class="dlg-view-section">
|
||||
<h4 class="dlg-view-section-title">申请信息</h4>
|
||||
<div class="dlg-kv dlg-kv--triple">
|
||||
<div class="k">单号</div>
|
||||
<div class="v">{{ processedViewData.applyCode || '-' }}</div>
|
||||
<div class="k">申请人</div>
|
||||
<div class="v">{{ processedViewData.applicantName || '-' }}</div>
|
||||
<div class="k">标题</div>
|
||||
<div class="v"><BaseClampText :text="processedViewData.title || processedViewData.reason" /></div>
|
||||
<div class="k">金额(元)</div>
|
||||
<div class="v money-value">{{ formatMoneyYuan(processedViewData.amount || 0) }}</div>
|
||||
</div>
|
||||
<div v-if="processedAttachments['申请附件']?.length" class="dlg-kv dlg-kv--triple section-gap-tight">
|
||||
<div class="k">附件</div>
|
||||
<div class="v kv-full">
|
||||
<BxAttachmentReadonly :files="processedAttachments['申请附件']" />
|
||||
</div>
|
||||
<h4 class="dlg-view-section-title">基础信息</h4>
|
||||
<BxViewKvTable :fields="processedBasicKvFields" mode="triple" />
|
||||
<div v-if="processedAttachments['申请附件']?.length" class="dlg-view-section-attach">
|
||||
<h4 class="dlg-view-section-title">申请附件</h4>
|
||||
<BxAttachmentReadonly :files="processedAttachments['申请附件']" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dlg-view-section">
|
||||
<h4 class="dlg-view-section-title">发放信息</h4>
|
||||
<div class="dlg-kv dlg-kv--triple">
|
||||
<div class="k">发放金额(元)</div>
|
||||
<div class="v money-value">{{ formatMoneyYuan((processedViewData.amount || 0) - (processedViewData.offsetAmount || 0)) }}</div>
|
||||
<div class="k">实际发放金额(元)</div>
|
||||
<div class="v money-value">
|
||||
{{
|
||||
formatMoneyYuan(
|
||||
processedViewData.actualAmount ??
|
||||
(processedViewData.amount || 0) - (processedViewData.offsetAmount || 0)
|
||||
)
|
||||
}}
|
||||
</div>
|
||||
<template v-if="processedViewData.payTime">
|
||||
<div class="k">发放时间</div>
|
||||
<div class="v">{{ processedViewData.payTime }}</div>
|
||||
</template>
|
||||
<template v-if="processedViewData.payUserName">
|
||||
<div class="k">发放操作人</div>
|
||||
<div class="v">{{ processedViewData.payUserName }}</div>
|
||||
</template>
|
||||
<template v-if="processedAttachments['发放附件']?.length">
|
||||
<div class="k">附件</div>
|
||||
<div class="v kv-full">
|
||||
<BxAttachmentReadonly :files="processedAttachments['发放附件']" />
|
||||
</div>
|
||||
</template>
|
||||
<BxViewKvTable :fields="processedPayKvFields" mode="triple" />
|
||||
<div v-if="processedAttachments['发放附件']?.length" class="dlg-view-section-attach">
|
||||
<h4 class="dlg-view-section-title">发放附件</h4>
|
||||
<BxAttachmentReadonly :files="processedAttachments['发放附件']" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="Number(processedViewData.offsetAmount || 0) > 0" class="dlg-view-section">
|
||||
<h4 class="dlg-view-section-title">冲抵信息</h4>
|
||||
<div class="dlg-kv dlg-kv--triple">
|
||||
<div class="k">冲抵金额(元)</div>
|
||||
<div class="v money-value">{{ formatMoneyYuan(processedViewData.offsetAmount || 0) }}</div>
|
||||
<template v-if="processedViewData.payTime">
|
||||
<div class="k">处理时间</div>
|
||||
<div class="v">{{ processedViewData.payTime }}</div>
|
||||
</template>
|
||||
<template v-if="processedViewData.payUserName">
|
||||
<div class="k">处理操作人</div>
|
||||
<div class="v">{{ processedViewData.payUserName }}</div>
|
||||
</template>
|
||||
</div>
|
||||
<div v-if="processedAttachments['冲抵附件']?.length" class="dlg-kv dlg-kv--triple section-gap-tight">
|
||||
<div class="k">附件</div>
|
||||
<div class="v kv-full">
|
||||
<BxAttachmentReadonly :files="processedAttachments['冲抵附件']" />
|
||||
</div>
|
||||
<BxViewKvGrid :fields="processedOffsetKvFields" />
|
||||
<div v-if="processedAttachments['冲抵附件']?.length" class="dlg-view-section-attach">
|
||||
<h4 class="dlg-view-section-title">冲抵附件</h4>
|
||||
<BxAttachmentReadonly :files="processedAttachments['冲抵附件']" />
|
||||
</div>
|
||||
|
||||
<h4 class="dlg-view-section-title section-gap-tight">冲抵明细</h4>
|
||||
@@ -671,10 +617,13 @@ import { useServerPaged } from '@/hooks/bx/useServerPaged'
|
||||
import { useApplicantOptions } from '@/hooks/bx/useApplicantOptions'
|
||||
import ApprovalFlowView from '@/components/bx/base/ApprovalFlowView.vue'
|
||||
import ApprovalHistoryView from '@/components/bx/base/ApprovalHistoryView.vue'
|
||||
import BaseClampText from '@/components/bx/base/BaseClampText.vue'
|
||||
import BxViewKvGrid from '@/components/bx/base/BxViewKvGrid.vue'
|
||||
import BxViewKvTable from '@/components/bx/base/BxViewKvTable.vue'
|
||||
import BaseDetailTableSection from '@/components/bx/base/BaseDetailTableSection.vue'
|
||||
import BxAttachmentUpload from '@/components/bx/base/BxAttachmentUpload.vue'
|
||||
import BxAttachmentReadonly from '@/components/bx/base/BxAttachmentReadonly.vue'
|
||||
import type { ViewField } from '@/components/business/system-view-dialog/types'
|
||||
import { bxViewKv, bxViewKvMoney } from '@/utils/bx/view-kv'
|
||||
|
||||
type DialogKey = 'viewDetail' | 'issue' | 'offset' | 'processedDetail'
|
||||
|
||||
@@ -733,6 +682,35 @@ const filterForm = reactive({
|
||||
const currentRow = ref<Record<string, any>>({})
|
||||
const selectedRows = ref<any[]>([])
|
||||
const viewData = ref<Record<string, any>>({})
|
||||
|
||||
const viewBasicKvFields = computed<ViewField[]>(() => {
|
||||
const d = viewData.value
|
||||
return [
|
||||
bxViewKv('单号', d.applyCode, { long: false }),
|
||||
bxViewKv('申请人', d.applicantName, { long: false }),
|
||||
bxViewKv('报销标题', d.title, { long: false }),
|
||||
bxViewKv('审批完成时间', d.applyTime, { long: false }),
|
||||
bxViewKvMoney('金额(元)', formatMoneyYuan(d.amount || 0), { long: false }),
|
||||
bxViewKv('状态', statusLabel(d.status), { long: false, tagType: statusTagType(d.status) })
|
||||
]
|
||||
})
|
||||
|
||||
const viewPayKvFields = computed<ViewField[]>(() => {
|
||||
const d = viewData.value
|
||||
const payAmount = Number(d.amount || 0) - Number(d.offsetAmount || 0)
|
||||
return [
|
||||
bxViewKvMoney('冲抵金额(元)', formatMoneyYuan(d.offsetAmount || 0), { long: false }),
|
||||
bxViewKvMoney('发放金额(元)', formatMoneyYuan(Math.max(0, payAmount)), { long: false }),
|
||||
bxViewKvMoney(
|
||||
'实际发放金额(元)',
|
||||
d.actualAmount != null && d.actualAmount !== '' ? formatMoneyYuan(d.actualAmount) : '—',
|
||||
{ long: false }
|
||||
),
|
||||
bxViewKv('发放时间', d.payTime, { long: false }),
|
||||
bxViewKv('发放操作人', d.payUserName, { long: false }),
|
||||
bxViewKv('发放备注', d.payRemark, { long: false })
|
||||
]
|
||||
})
|
||||
const issueRemark = ref('')
|
||||
const actualAmount = ref('')
|
||||
const offsetRemark = ref('')
|
||||
@@ -804,6 +782,48 @@ const {
|
||||
})
|
||||
|
||||
const processedViewData = ref<Record<string, any>>({})
|
||||
|
||||
const processedBasicKvFields = computed<ViewField[]>(() => {
|
||||
const d = processedViewData.value
|
||||
return [
|
||||
bxViewKv('单号', d.applyCode, { long: false }),
|
||||
bxViewKv('申请人', d.applicantName, { long: false }),
|
||||
bxViewKv('报销标题', d.title || d.reason, { long: false }),
|
||||
bxViewKvMoney('金额(元)', formatMoneyYuan(d.amount || 0), { long: false }),
|
||||
bxViewKv('处理状态', processedStatusLabel(d.status, d.payStatus), {
|
||||
long: false,
|
||||
tagType: processedStatusTagType(d.status, d.payStatus)
|
||||
}),
|
||||
bxViewKv('处理时间', d.payTime, { long: false })
|
||||
]
|
||||
})
|
||||
|
||||
const processedPayKvFields = computed<ViewField[]>(() => {
|
||||
const d = processedViewData.value
|
||||
const payAmount = Number(d.amount || 0) - Number(d.offsetAmount || 0)
|
||||
return [
|
||||
bxViewKvMoney('冲抵金额(元)', formatMoneyYuan(d.offsetAmount || 0), { long: false }),
|
||||
bxViewKvMoney('发放金额(元)', formatMoneyYuan(Math.max(0, payAmount)), { long: false }),
|
||||
bxViewKvMoney(
|
||||
'实际发放金额(元)',
|
||||
formatMoneyYuan(d.actualAmount ?? Math.max(0, payAmount)),
|
||||
{ long: false }
|
||||
),
|
||||
bxViewKv('发放时间', d.payTime, { long: false }),
|
||||
bxViewKv('发放操作人', d.payUserName, { long: false }),
|
||||
bxViewKv('发放备注', d.payRemark, { long: false })
|
||||
]
|
||||
})
|
||||
|
||||
const processedOffsetKvFields = computed<ViewField[]>(() => {
|
||||
const d = processedViewData.value
|
||||
const fields: ViewField[] = [
|
||||
bxViewKvMoney('冲抵金额(元)', formatMoneyYuan(d.offsetAmount || 0))
|
||||
]
|
||||
if (d.payTime) fields.push(bxViewKv('处理时间', d.payTime))
|
||||
if (d.payUserName) fields.push(bxViewKv('处理操作人', d.payUserName))
|
||||
return fields
|
||||
})
|
||||
const processedApprovals = ref<any[]>([])
|
||||
const processedApprovalHistory = ref<any[]>([])
|
||||
const processedApprovalLoading = ref(false)
|
||||
|
||||
@@ -209,8 +209,22 @@
|
||||
|
||||
<el-form label-position="top">
|
||||
<div class="form-grid-2">
|
||||
<el-form-item label="报销标题" style="grid-column: 1 / -1">
|
||||
<el-input v-model="addForm.title" placeholder="不填则自动生成" />
|
||||
<el-form-item label="报销日期">
|
||||
<el-date-picker
|
||||
v-model="addForm.reimburseDate"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="选择报销日期"
|
||||
style="width: 100%"
|
||||
@change="onReimburseDateChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="报销标题">
|
||||
<el-input
|
||||
v-model="addForm.title"
|
||||
placeholder="不填则自动生成"
|
||||
@input="onTitleInput"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
@@ -310,7 +324,7 @@
|
||||
<el-dialog
|
||||
v-model="dialogs.view"
|
||||
title="报销单详情"
|
||||
width="920px"
|
||||
width="1040px"
|
||||
class="dialog-form-layout dialog-view-xl"
|
||||
align-center
|
||||
destroy-on-close
|
||||
@@ -331,16 +345,8 @@
|
||||
</div>
|
||||
|
||||
<div class="dlg-view-section">
|
||||
<div class="dlg-kv dlg-kv--triple">
|
||||
<div class="k">报销标题</div>
|
||||
<div class="v kv-full"><BaseClampText :text="viewData.title" /></div>
|
||||
<div class="k">申请人</div>
|
||||
<div class="v">{{ viewData.applicantName || '-' }}</div>
|
||||
<div class="k">当前节点</div>
|
||||
<div class="v">{{ workflowNodeDisplay(viewData.currentNode, viewData.status) }}</div>
|
||||
<div class="k">申请时间</div>
|
||||
<div class="v">{{ viewData.applyTime || '-' }}</div>
|
||||
</div>
|
||||
<h4 class="dlg-view-section-title">基础信息</h4>
|
||||
<BxViewKvTable :fields="viewMainKvFields" mode="triple" />
|
||||
</div>
|
||||
|
||||
<div class="dlg-view-section">
|
||||
@@ -377,10 +383,7 @@
|
||||
</div>
|
||||
|
||||
<div class="dlg-view-section">
|
||||
<div class="dlg-kv dlg-kv--triple">
|
||||
<div class="k">报销说明</div>
|
||||
<div class="v kv-full"><BaseClampText :text="viewData.remark" /></div>
|
||||
</div>
|
||||
<BxViewKvGrid :fields="viewRemarkKvFields" />
|
||||
</div>
|
||||
|
||||
<div
|
||||
@@ -391,25 +394,8 @@
|
||||
"
|
||||
class="dlg-view-section"
|
||||
>
|
||||
<h4>处理情况</h4>
|
||||
<div class="dlg-kv dlg-kv--triple">
|
||||
<div class="k">处理方式</div>
|
||||
<div class="v">{{ viewProcessMode(viewData) }}</div>
|
||||
<div class="k">冲抵金额(元)</div>
|
||||
<div class="v money-value">{{ formatMoneyYuan(viewData.offsetAmount || 0) }}</div>
|
||||
<div class="k">发放金额(元)</div>
|
||||
<div class="v money-value">
|
||||
{{
|
||||
formatMoneyYuan(
|
||||
viewData.actualAmount ?? Number(viewData.amount || 0) - Number(viewData.offsetAmount || 0)
|
||||
)
|
||||
}}
|
||||
</div>
|
||||
<div class="k">处理时间</div>
|
||||
<div class="v">{{ viewData.payTime || '-' }}</div>
|
||||
<div class="k">处理操作人</div>
|
||||
<div class="v">{{ viewData.payUserName || '-' }}</div>
|
||||
</div>
|
||||
<h4 class="dlg-view-section-title">处理情况</h4>
|
||||
<BxViewKvTable :fields="viewProcessKvFields" mode="triple" />
|
||||
</div>
|
||||
|
||||
<div v-if="viewPayAttachments.length" class="dlg-view-section">
|
||||
@@ -446,19 +432,19 @@
|
||||
<el-dialog
|
||||
v-model="dialogs.viewFlow"
|
||||
title="审批流程"
|
||||
width="920px"
|
||||
width="1040px"
|
||||
class="dialog-form-layout dialog-view-xl"
|
||||
align-center
|
||||
destroy-on-close
|
||||
>
|
||||
<div class="dlg-view-section">
|
||||
<h4>审批进度</h4>
|
||||
<h4 class="dlg-view-section-title">审批进度</h4>
|
||||
<div class="flow-scroll">
|
||||
<ApprovalFlowView :nodes="flowNodes" :loading="flowLoading" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="dlg-view-section">
|
||||
<h4>审批历史</h4>
|
||||
<h4 class="dlg-view-section-title">审批历史</h4>
|
||||
<div class="flow-scroll">
|
||||
<ApprovalHistoryView :items="flowHistory" :loading="flowLoading" />
|
||||
</div>
|
||||
@@ -504,9 +490,12 @@ import {
|
||||
import { useServerPaged } from '@/hooks/bx/useServerPaged'
|
||||
import ApprovalFlowView from '@/components/bx/base/ApprovalFlowView.vue'
|
||||
import ApprovalHistoryView from '@/components/bx/base/ApprovalHistoryView.vue'
|
||||
import BaseClampText from '@/components/bx/base/BaseClampText.vue'
|
||||
import BxViewKvGrid from '@/components/bx/base/BxViewKvGrid.vue'
|
||||
import BxViewKvTable from '@/components/bx/base/BxViewKvTable.vue'
|
||||
import BxAttachmentUpload from '@/components/bx/base/BxAttachmentUpload.vue'
|
||||
import BxAttachmentReadonly from '@/components/bx/base/BxAttachmentReadonly.vue'
|
||||
import type { ViewField } from '@/components/business/system-view-dialog/types'
|
||||
import { bxViewKv, bxViewKvLong, bxViewKvMoney } from '@/utils/bx/view-kv'
|
||||
|
||||
type DialogKey = 'add' | 'view' | 'viewFlow'
|
||||
|
||||
@@ -581,13 +570,52 @@ const filterForm = reactive({
|
||||
applyDate: null as string | null
|
||||
})
|
||||
|
||||
function todayYmd() {
|
||||
const d = new Date()
|
||||
const y = d.getFullYear()
|
||||
const m = String(d.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(d.getDate()).padStart(2, '0')
|
||||
return `${y}-${m}-${day}`
|
||||
}
|
||||
|
||||
const addForm = reactive({
|
||||
reimburseDate: todayYmd(),
|
||||
title: '',
|
||||
remark: '',
|
||||
details: [{ expenseItemId: '', amount: '' as number | string, remark: '' }] as DetailLine[]
|
||||
})
|
||||
|
||||
const viewData = ref<Record<string, any>>({})
|
||||
|
||||
const viewMainKvFields = computed<ViewField[]>(() => {
|
||||
const d = viewData.value
|
||||
return [
|
||||
bxViewKv('报销日期', d.reimburseDate, { long: false }),
|
||||
bxViewKv('报销标题', d.title, { long: false }),
|
||||
bxViewKv('申请人', d.applicantName, { long: false }),
|
||||
bxViewKv('当前节点', workflowNodeDisplay(d.currentNode, d.status), { long: false }),
|
||||
bxViewKv('申请时间', d.applyTime, { long: false })
|
||||
]
|
||||
})
|
||||
|
||||
const viewRemarkKvFields = computed<ViewField[]>(() => [
|
||||
bxViewKvLong('报销说明', viewData.value.remark, { fullSpan: true })
|
||||
])
|
||||
|
||||
const viewProcessKvFields = computed<ViewField[]>(() => {
|
||||
const d = viewData.value
|
||||
return [
|
||||
bxViewKv('处理方式', viewProcessMode(d), { long: false }),
|
||||
bxViewKvMoney('冲抵金额(元)', formatMoneyYuan(d.offsetAmount || 0), { long: false }),
|
||||
bxViewKvMoney(
|
||||
'发放金额(元)',
|
||||
formatMoneyYuan(d.actualAmount ?? Number(d.amount || 0) - Number(d.offsetAmount || 0)),
|
||||
{ long: false }
|
||||
),
|
||||
bxViewKv('处理时间', d.payTime, { long: false }),
|
||||
bxViewKv('处理操作人', d.payUserName, { long: false })
|
||||
]
|
||||
})
|
||||
const selectedRows = ref<any[]>([])
|
||||
const flowNodes = ref<any[]>([])
|
||||
const flowHistory = ref<any[]>([])
|
||||
@@ -601,24 +629,50 @@ const viewAttachments = ref<BxAttachmentItem[]>([])
|
||||
const viewPayAttachments = ref<BxAttachmentItem[]>([])
|
||||
const viewOffsetAttachments = ref<BxAttachmentItem[]>([])
|
||||
const editingId = ref<number | null>(null)
|
||||
const titleAutoLinked = ref(true)
|
||||
|
||||
function isAutoReimburseTitle(title: string) {
|
||||
return /报销单\d{11}$/.test(String(title || '').trim())
|
||||
}
|
||||
|
||||
const detailTotalAmount = computed(() => {
|
||||
return addForm.details.reduce((sum: number, d) => sum + Number(d.amount || 0), 0)
|
||||
})
|
||||
|
||||
async function refreshGeneratedTitle() {
|
||||
if (!addForm.reimburseDate) return
|
||||
try {
|
||||
const res: any = await reimburseApi.generateTitle(
|
||||
addForm.reimburseDate,
|
||||
editingId.value ?? undefined
|
||||
)
|
||||
addForm.title = res.data || ''
|
||||
titleAutoLinked.value = true
|
||||
} catch {
|
||||
/* fallback: user can type manually */
|
||||
}
|
||||
}
|
||||
|
||||
function onTitleInput(value: string) {
|
||||
titleAutoLinked.value = isAutoReimburseTitle(value)
|
||||
}
|
||||
|
||||
async function onReimburseDateChange() {
|
||||
if (!editingId.value || titleAutoLinked.value) {
|
||||
await refreshGeneratedTitle()
|
||||
}
|
||||
}
|
||||
|
||||
async function openAddDialog() {
|
||||
addForm.reimburseDate = todayYmd()
|
||||
addForm.title = ''
|
||||
addForm.remark = ''
|
||||
addForm.details = [{ expenseItemId: '', amount: '', remark: '' }]
|
||||
uploadedFiles.value = []
|
||||
editingId.value = null
|
||||
titleAutoLinked.value = true
|
||||
dialogs.add = true
|
||||
try {
|
||||
const res: any = await reimburseApi.generateTitle()
|
||||
addForm.title = res.data || ''
|
||||
} catch {
|
||||
/* fallback: user can type manually */
|
||||
}
|
||||
await refreshGeneratedTitle()
|
||||
}
|
||||
|
||||
async function openEditDialog(row: any) {
|
||||
@@ -626,6 +680,8 @@ async function openEditDialog(row: any) {
|
||||
const res: any = await reimburseApi.getById(row.id)
|
||||
const data = res.data || res
|
||||
addForm.title = data.title || ''
|
||||
addForm.reimburseDate = data.reimburseDate || todayYmd()
|
||||
titleAutoLinked.value = isAutoReimburseTitle(addForm.title)
|
||||
addForm.remark = data.remark || ''
|
||||
addForm.details = (data.details || []).map((d: any) => ({
|
||||
expenseItemId: d.expenseId,
|
||||
@@ -718,6 +774,8 @@ async function submitAdd() {
|
||||
try {
|
||||
if (editingId.value) {
|
||||
await reimburseApi.update(editingId.value, {
|
||||
reimburseDate: addForm.reimburseDate,
|
||||
title: addForm.title,
|
||||
details: validDetails.map((d) => ({
|
||||
expenseItemId: String(d.expenseItemId),
|
||||
amount: Number(d.amount),
|
||||
@@ -733,6 +791,7 @@ async function submitAdd() {
|
||||
ElMessage.success('保存成功')
|
||||
} else {
|
||||
const res: any = await reimburseApi.create({
|
||||
reimburseDate: addForm.reimburseDate,
|
||||
title: addForm.title || undefined,
|
||||
remark: addForm.remark,
|
||||
details: validDetails.map((d) => ({
|
||||
@@ -749,6 +808,7 @@ async function submitAdd() {
|
||||
ElMessage.success('新增成功')
|
||||
}
|
||||
dialogs.add = false
|
||||
addForm.reimburseDate = todayYmd()
|
||||
addForm.title = ''
|
||||
addForm.remark = ''
|
||||
addForm.details = [{ expenseItemId: '', amount: '', remark: '' }]
|
||||
@@ -913,7 +973,7 @@ function viewDetailSummary({ columns, data }: { columns: any[]; data: any[] }) {
|
||||
text-align: left;
|
||||
padding: 8px 10px;
|
||||
border-bottom: 1px solid var(--mint-border, #d9e8e2);
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
color: var(--mint-text);
|
||||
font-size: 12px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
@@ -927,7 +987,7 @@ function viewDetailSummary({ columns, data }: { columns: any[]; data: any[] }) {
|
||||
.detail-table .col-index {
|
||||
width: 56px;
|
||||
text-align: center;
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
color: var(--mint-text);
|
||||
}
|
||||
|
||||
.detail-table .col-expense {
|
||||
|
||||
@@ -418,7 +418,7 @@
|
||||
<el-dialog
|
||||
v-model="dialogs.viewDetail"
|
||||
title="报销单详情"
|
||||
width="920px"
|
||||
width="1040px"
|
||||
class="dialog-form-layout dialog-view-xl"
|
||||
align-center
|
||||
destroy-on-close
|
||||
@@ -439,16 +439,8 @@
|
||||
</div>
|
||||
|
||||
<div class="dlg-view-section">
|
||||
<div class="dlg-kv dlg-kv--triple">
|
||||
<div class="k">申请人</div>
|
||||
<div class="v">{{ viewData.applicantName || '-' }}</div>
|
||||
<div class="k">当前节点</div>
|
||||
<div class="v">{{ workflowNodeDisplay(viewData.currentNode, viewData.status) }}</div>
|
||||
<div class="k">申请时间</div>
|
||||
<div class="v">{{ viewData.applyTime || '-' }}</div>
|
||||
<div class="k">报销说明</div>
|
||||
<div class="v"><BaseClampText :text="viewData.remark" /></div>
|
||||
</div>
|
||||
<h4 class="dlg-view-section-title">基础信息</h4>
|
||||
<BxViewKvTable :fields="viewMainKvFields" mode="triple" />
|
||||
</div>
|
||||
|
||||
<div class="dlg-view-section">
|
||||
@@ -576,8 +568,10 @@ import { useExpenseItemTree } from '@/hooks/bx/useExpenseItemTree'
|
||||
import { useApplicantOptions } from '@/hooks/bx/useApplicantOptions'
|
||||
import ApprovalFlowView from '@/components/bx/base/ApprovalFlowView.vue'
|
||||
import ApprovalHistoryView from '@/components/bx/base/ApprovalHistoryView.vue'
|
||||
import BaseClampText from '@/components/bx/base/BaseClampText.vue'
|
||||
import BxViewKvTable from '@/components/bx/base/BxViewKvTable.vue'
|
||||
import BxAttachmentReadonly from '@/components/bx/base/BxAttachmentReadonly.vue'
|
||||
import type { ViewField } from '@/components/business/system-view-dialog/types'
|
||||
import { bxViewKv, bxViewKvLong } from '@/utils/bx/view-kv'
|
||||
|
||||
type DialogKey = 'viewDetail' | 'approve'
|
||||
|
||||
@@ -633,6 +627,18 @@ const stats = computed(() => {
|
||||
})
|
||||
|
||||
const viewData = ref<Record<string, any>>({})
|
||||
|
||||
const viewMainKvFields = computed<ViewField[]>(() => {
|
||||
const d = viewData.value
|
||||
return [
|
||||
bxViewKv('报销日期', d.reimburseDate, { long: false }),
|
||||
bxViewKv('报销标题', d.title, { long: false }),
|
||||
bxViewKv('申请人', d.applicantName, { long: false }),
|
||||
bxViewKv('当前节点', workflowNodeDisplay(d.currentNode, d.status), { long: false }),
|
||||
bxViewKv('申请时间', d.applyTime, { long: false }),
|
||||
bxViewKvLong('报销说明', d.remark, { fullSpan: true })
|
||||
]
|
||||
})
|
||||
const viewFlowNodes = ref<any[]>([])
|
||||
const viewApprovalHistory = ref<any[]>([])
|
||||
const viewFlowLoading = ref(false)
|
||||
|
||||
@@ -190,7 +190,7 @@
|
||||
<el-dialog
|
||||
v-model="dialogs.viewDetail"
|
||||
title="申请单详情"
|
||||
width="920px"
|
||||
width="1040px"
|
||||
class="dialog-form-layout dialog-view-xl"
|
||||
align-center
|
||||
destroy-on-close
|
||||
@@ -214,24 +214,8 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="dlg-view-section">
|
||||
<div class="dlg-kv dlg-kv--triple">
|
||||
<div class="k">申请单号</div>
|
||||
<div class="v">{{ currentRow?.applyCode || '-' }}</div>
|
||||
<div class="k">业务类型</div>
|
||||
<div class="v">{{ currentRow?.bizType || '-' }}</div>
|
||||
<div class="k">申请人</div>
|
||||
<div class="v">{{ currentRow?.applicantName || '-' }}</div>
|
||||
<div class="k">申请标题</div>
|
||||
<div class="v"><BaseClampText :text="currentRow?.title" /></div>
|
||||
<div class="k">申请金额(元)</div>
|
||||
<div class="v money-value">{{ formatMoneyYuan(currentRow?.amount || 0) }}</div>
|
||||
<div class="k">状态</div>
|
||||
<div class="v">{{ statusLabel(currentRow?.status) }}</div>
|
||||
<div class="k">当前节点</div>
|
||||
<div class="v">{{ workflowNodeDisplay(currentRow?.currentNode, currentRow?.status) }}</div>
|
||||
<div class="k">申请时间</div>
|
||||
<div class="v">{{ currentRow?.applyTime || '-' }}</div>
|
||||
</div>
|
||||
<h4 class="dlg-view-section-title">基础信息</h4>
|
||||
<BxViewKvTable :fields="viewDetailKvFields" mode="triple" />
|
||||
</div>
|
||||
<div class="dlg-view-section">
|
||||
<h4 class="dlg-view-section-title">审批进度</h4>
|
||||
@@ -262,6 +246,7 @@ import { ElMessage } from 'element-plus'
|
||||
import { View, Close, Search, RefreshLeft, ArrowUpBold, ArrowDownBold } from '@element-plus/icons-vue'
|
||||
import { advanceApi, reimburseApi } from '@/api/bx'
|
||||
import {
|
||||
bizTypeTagType,
|
||||
statusLabel,
|
||||
statusTagType,
|
||||
formatSumMoney,
|
||||
@@ -274,7 +259,9 @@ import {
|
||||
} from '@/utils/bx/format'
|
||||
import ApprovalFlowView from '@/components/bx/base/ApprovalFlowView.vue'
|
||||
import ApprovalHistoryView from '@/components/bx/base/ApprovalHistoryView.vue'
|
||||
import BaseClampText from '@/components/bx/base/BaseClampText.vue'
|
||||
import BxViewKvTable from '@/components/bx/base/BxViewKvTable.vue'
|
||||
import type { ViewField } from '@/components/business/system-view-dialog/types'
|
||||
import { bxViewKv, bxViewKvMoney } from '@/utils/bx/view-kv'
|
||||
import { usePagedTable } from '@/hooks/bx/usePagedTable'
|
||||
import { useApplicantOptions } from '@/hooks/bx/useApplicantOptions'
|
||||
|
||||
@@ -348,6 +335,20 @@ const filteredMergedRows = computed(() => filterMergedRows(mergedRows.value))
|
||||
|
||||
const pager = usePagedTable(() => filteredMergedRows.value, { initialPageSize: 10 })
|
||||
const currentRow = ref<any>(null)
|
||||
|
||||
const viewDetailKvFields = computed<ViewField[]>(() => {
|
||||
const r = currentRow.value
|
||||
return [
|
||||
bxViewKv('申请单号', r?.applyCode, { long: false }),
|
||||
bxViewKv('业务类型', r?.bizType, { long: false, tagType: bizTypeTagType(r?.bizType) }),
|
||||
bxViewKv('申请人', r?.applicantName, { long: false }),
|
||||
bxViewKv('申请标题', r?.title, { long: false }),
|
||||
bxViewKvMoney('申请金额(元)', formatMoneyYuan(r?.amount || 0), { long: false }),
|
||||
bxViewKv('状态', statusLabel(r?.status), { long: false, tagType: statusTagType(r?.status) }),
|
||||
bxViewKv('当前节点', workflowNodeDisplay(r?.currentNode, r?.status), { long: false }),
|
||||
bxViewKv('申请时间', r?.applyTime, { long: false })
|
||||
]
|
||||
})
|
||||
const viewFlowNodes = ref<any[]>([])
|
||||
const viewApprovalHistory = ref<any[]>([])
|
||||
const viewFlowLoading = ref(false)
|
||||
@@ -364,10 +365,6 @@ const bizTypeOptions = ['全部', '报销单', '备用金']
|
||||
const statusOptions = ['全部', '待提交', '审批中', '审批通过', '审批驳回', '已发放']
|
||||
const nodeOptions = ['全部', '草稿', '发起人主管审批', '财务复核', '总经理审批', '已完成', '已驳回', '已发放']
|
||||
|
||||
function bizTypeTagType(bizType: string | undefined): 'primary' | 'info' {
|
||||
return bizType === '报销单' ? 'primary' : 'info'
|
||||
}
|
||||
|
||||
function countStatus(m: Record<string, number> | undefined, key: string) {
|
||||
return Number(m?.[key] ?? 0)
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@
|
||||
<el-dialog
|
||||
v-model="dialogs.viewDetail"
|
||||
title="申请单详情"
|
||||
width="920px"
|
||||
width="1040px"
|
||||
class="dialog-form-layout dialog-view-xl"
|
||||
align-center
|
||||
destroy-on-close
|
||||
@@ -202,22 +202,8 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="dlg-view-section">
|
||||
<div class="dlg-kv dlg-kv--triple">
|
||||
<div class="k">申请单号</div>
|
||||
<div class="v">{{ currentRow?.applyCode || '-' }}</div>
|
||||
<div class="k">业务类型</div>
|
||||
<div class="v">{{ currentRow?.bizType || '-' }}</div>
|
||||
<div class="k">申请标题</div>
|
||||
<div class="v"><BaseClampText :text="currentRow?.title" /></div>
|
||||
<div class="k">申请金额(元)</div>
|
||||
<div class="v money-value">{{ formatMoneyYuan(currentRow?.amount || 0) }}</div>
|
||||
<div class="k">状态</div>
|
||||
<div class="v">{{ statusLabel(currentRow?.status) }}</div>
|
||||
<div class="k">当前节点</div>
|
||||
<div class="v">{{ workflowNodeDisplay(currentRow?.currentNode, currentRow?.status) }}</div>
|
||||
<div class="k">申请时间</div>
|
||||
<div class="v">{{ currentRow?.applyTime || '-' }}</div>
|
||||
</div>
|
||||
<h4 class="dlg-view-section-title">基础信息</h4>
|
||||
<BxViewKvTable :fields="viewDetailKvFields" mode="triple" />
|
||||
</div>
|
||||
<div class="dlg-view-section">
|
||||
<h4 class="dlg-view-section-title">审批进度</h4>
|
||||
@@ -248,6 +234,7 @@ import { ElMessage } from 'element-plus'
|
||||
import { View, Close, Search, RefreshLeft, ArrowUpBold, ArrowDownBold } from '@element-plus/icons-vue'
|
||||
import { advanceApi, reimburseApi } from '@/api/bx'
|
||||
import {
|
||||
bizTypeTagType,
|
||||
statusLabel,
|
||||
statusTagType,
|
||||
formatMoneyYuan,
|
||||
@@ -259,7 +246,9 @@ import {
|
||||
} from '@/utils/bx/format'
|
||||
import ApprovalFlowView from '@/components/bx/base/ApprovalFlowView.vue'
|
||||
import ApprovalHistoryView from '@/components/bx/base/ApprovalHistoryView.vue'
|
||||
import BaseClampText from '@/components/bx/base/BaseClampText.vue'
|
||||
import BxViewKvTable from '@/components/bx/base/BxViewKvTable.vue'
|
||||
import type { ViewField } from '@/components/business/system-view-dialog/types'
|
||||
import { bxViewKv, bxViewKvMoney } from '@/utils/bx/view-kv'
|
||||
import { usePagedTable } from '@/hooks/bx/usePagedTable'
|
||||
|
||||
type DialogKey = 'viewDetail'
|
||||
@@ -323,6 +312,19 @@ const {
|
||||
onSizeChange
|
||||
} = usePagedTable(() => filteredMergedRows.value, { initialPageSize: 10 })
|
||||
const currentRow = ref<any>(null)
|
||||
|
||||
const viewDetailKvFields = computed<ViewField[]>(() => {
|
||||
const r = currentRow.value
|
||||
return [
|
||||
bxViewKv('申请单号', r?.applyCode, { long: false }),
|
||||
bxViewKv('业务类型', r?.bizType, { long: false, tagType: bizTypeTagType(r?.bizType) }),
|
||||
bxViewKv('申请标题', r?.title, { long: false }),
|
||||
bxViewKvMoney('申请金额(元)', formatMoneyYuan(r?.amount || 0), { long: false }),
|
||||
bxViewKv('状态', statusLabel(r?.status), { long: false, tagType: statusTagType(r?.status) }),
|
||||
bxViewKv('当前节点', workflowNodeDisplay(r?.currentNode, r?.status), { long: false }),
|
||||
bxViewKv('申请时间', r?.applyTime, { long: false })
|
||||
]
|
||||
})
|
||||
const viewFlowNodes = ref<any[]>([])
|
||||
const viewApprovalHistory = ref<any[]>([])
|
||||
const viewFlowLoading = ref(false)
|
||||
@@ -343,10 +345,6 @@ function buildApiQuery() {
|
||||
return q
|
||||
}
|
||||
|
||||
function bizTypeTagType(bizType: string | undefined): 'primary' | 'info' {
|
||||
return bizType === '报销单' ? 'primary' : 'info'
|
||||
}
|
||||
|
||||
function mapAdvanceMineRow(r: any) {
|
||||
return {
|
||||
...r,
|
||||
|
||||
@@ -202,7 +202,7 @@
|
||||
<el-dialog
|
||||
v-model="dialogs.viewDetail"
|
||||
title="申请单详情"
|
||||
width="920px"
|
||||
width="1040px"
|
||||
class="dialog-form-layout dialog-view-xl"
|
||||
align-center
|
||||
destroy-on-close
|
||||
@@ -230,22 +230,8 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="dlg-view-section">
|
||||
<div class="dlg-kv dlg-kv--triple">
|
||||
<div class="k">申请单号</div>
|
||||
<div class="v">{{ currentRow?.applyCode || '-' }}</div>
|
||||
<div class="k">业务类型</div>
|
||||
<div class="v">{{ currentRow?.bizType || '-' }}</div>
|
||||
<div class="k">申请人</div>
|
||||
<div class="v">{{ currentRow?.applicantName || '-' }}</div>
|
||||
<div class="k">申请标题</div>
|
||||
<div class="v"><BaseClampText :text="currentRow?.title" /></div>
|
||||
<div class="k">申请金额(元)</div>
|
||||
<div class="v money-value">{{ formatMoneyYuan(currentRow?.amount || 0) }}</div>
|
||||
<div class="k">当前节点</div>
|
||||
<div class="v">{{ workflowNodeDisplay(currentRow?.currentNode, currentRow?.status) }}</div>
|
||||
<div class="k">申请时间</div>
|
||||
<div class="v">{{ currentRow?.applyTime || '-' }}</div>
|
||||
</div>
|
||||
<h4 class="dlg-view-section-title">基础信息</h4>
|
||||
<BxViewKvTable :fields="viewDetailKvFields" mode="triple" />
|
||||
</div>
|
||||
<div class="dlg-view-section">
|
||||
<h4 class="dlg-view-section-title">审批进度</h4>
|
||||
@@ -311,6 +297,7 @@ import {
|
||||
} from '@element-plus/icons-vue'
|
||||
import { advanceApi, reimburseApi } from '@/api/bx'
|
||||
import {
|
||||
bizTypeTagType,
|
||||
formatSumMoney,
|
||||
formatMoneyYuan,
|
||||
moneyTableFormatter,
|
||||
@@ -321,7 +308,9 @@ import {
|
||||
} from '@/utils/bx/format'
|
||||
import ApprovalFlowView from '@/components/bx/base/ApprovalFlowView.vue'
|
||||
import ApprovalHistoryView from '@/components/bx/base/ApprovalHistoryView.vue'
|
||||
import BaseClampText from '@/components/bx/base/BaseClampText.vue'
|
||||
import BxViewKvTable from '@/components/bx/base/BxViewKvTable.vue'
|
||||
import type { ViewField } from '@/components/business/system-view-dialog/types'
|
||||
import { bxViewKv, bxViewKvMoney } from '@/utils/bx/view-kv'
|
||||
import { usePagedTable } from '@/hooks/bx/usePagedTable'
|
||||
import { useApplicantOptions } from '@/hooks/bx/useApplicantOptions'
|
||||
|
||||
@@ -389,6 +378,19 @@ const {
|
||||
onSizeChange
|
||||
} = usePagedTable(() => filteredMergedRows.value, { initialPageSize: 10 })
|
||||
const currentRow = ref<any>(null)
|
||||
|
||||
const viewDetailKvFields = computed<ViewField[]>(() => {
|
||||
const r = currentRow.value
|
||||
return [
|
||||
bxViewKv('申请单号', r?.applyCode, { long: false }),
|
||||
bxViewKv('业务类型', r?.bizType, { long: false, tagType: bizTypeTagType(r?.bizType) }),
|
||||
bxViewKv('申请人', r?.applicantName, { long: false }),
|
||||
bxViewKv('申请标题', r?.title, { long: false }),
|
||||
bxViewKvMoney('申请金额(元)', formatMoneyYuan(r?.amount || 0), { long: false }),
|
||||
bxViewKv('当前节点', workflowNodeDisplay(r?.currentNode, r?.status), { long: false }),
|
||||
bxViewKv('申请时间', r?.applyTime, { long: false })
|
||||
]
|
||||
})
|
||||
const approveOpinion = ref('')
|
||||
const viewFlowNodes = ref<any[]>([])
|
||||
const viewApprovalHistory = ref<any[]>([])
|
||||
@@ -467,10 +469,6 @@ async function loadData(options: { buttonLoading?: boolean } = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
function bizTypeTagType(bizType: string | undefined): 'primary' | 'info' {
|
||||
return bizType === '报销单' ? 'primary' : 'info'
|
||||
}
|
||||
|
||||
async function handleApprove(row: any) {
|
||||
const key = `pass_${row.id}`
|
||||
loadingMap[key] = true
|
||||
|
||||
@@ -454,7 +454,7 @@
|
||||
|
||||
.follow-creator {
|
||||
font-size: 13px;
|
||||
color: #64748b;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.follow-content {
|
||||
@@ -467,7 +467,7 @@
|
||||
.follow-meta {
|
||||
margin-top: 8px;
|
||||
font-size: 13px;
|
||||
color: #64748b;
|
||||
color: #1e293b;
|
||||
|
||||
&--warn {
|
||||
color: #d97706;
|
||||
@@ -475,7 +475,7 @@
|
||||
}
|
||||
|
||||
:deep(.el-timeline-item__timestamp) {
|
||||
color: #64748b;
|
||||
color: #1e293b;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -331,7 +331,7 @@
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
color: var(--text-muted, #64748b);
|
||||
color: var(--mint-text);
|
||||
}
|
||||
|
||||
.view-kv-grid {
|
||||
@@ -343,20 +343,6 @@
|
||||
|
||||
.view-kv {
|
||||
min-width: 0;
|
||||
|
||||
dt {
|
||||
margin: 0 0 4px;
|
||||
font-size: 12px;
|
||||
color: var(--text-muted, #64748b);
|
||||
}
|
||||
|
||||
dd {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
color: var(--text, #1e293b);
|
||||
word-break: break-word;
|
||||
}
|
||||
}
|
||||
|
||||
.invalid-batch-table {
|
||||
|
||||
@@ -552,7 +552,7 @@
|
||||
|
||||
.stat-title {
|
||||
font-size: 13px;
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
color: var(--mint-text);
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
@@ -566,7 +566,7 @@
|
||||
.stat-desc {
|
||||
margin-top: 4px;
|
||||
font-size: 12px;
|
||||
color: #94a3b8;
|
||||
color: #1e293b;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -103,32 +103,17 @@
|
||||
<!-- 分页 -->
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
|
||||
<!-- 查看详情对话框 -->
|
||||
<el-dialog title="审批详情" v-model="viewDialog.visible" width="800px" append-to-body>
|
||||
<el-descriptions :column="2" border>
|
||||
<el-descriptions-item label="合同编号">{{ viewDialog.data.contractNo }}</el-descriptions-item>
|
||||
<el-descriptions-item label="合同名称">{{ viewDialog.data.contractName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="审批流程ID">{{ viewDialog.data.flowId }}</el-descriptions-item>
|
||||
<el-descriptions-item label="审批级别">第{{ viewDialog.data.step }}级</el-descriptions-item>
|
||||
<el-descriptions-item label="步骤名称">{{ viewDialog.data.stepName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="审批人部门">{{ viewDialog.data.approverDept }}</el-descriptions-item>
|
||||
<el-descriptions-item label="审批人">{{ viewDialog.data.approverName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="审批结果">
|
||||
<el-tag v-if="viewDialog.data.approvalResult === 'approved'" type="success">通过</el-tag>
|
||||
<el-tag v-else-if="viewDialog.data.approvalResult === 'rejected'" type="danger">驳回</el-tag>
|
||||
<el-tag v-else type="warning">待审批</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="审批意见" :span="2">{{ viewDialog.data.approvalOpinion }}</el-descriptions-item>
|
||||
<el-descriptions-item label="审批时间">{{ parseTime(viewDialog.data.approvalTime) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">{{ parseTime(viewDialog.data.createTime) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="备注" :span="2">{{ viewDialog.data.remark }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="viewDialog.visible = false">关 闭</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<!-- 查看详情 -->
|
||||
<SystemViewDialog
|
||||
v-model:visible="viewDialog.visible"
|
||||
title="审批详情"
|
||||
:icon="Document"
|
||||
:code="viewDialog.data.contractNo"
|
||||
code-label="合同编号"
|
||||
:meta="viewDialog.data.contractName"
|
||||
:sections="approvalViewSections"
|
||||
append-to-body
|
||||
/>
|
||||
|
||||
<!-- 审批对话框 -->
|
||||
<el-dialog title="审批" v-model="approvalDialog.visible" width="600px" append-to-body>
|
||||
@@ -159,8 +144,14 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="ContractApproval">
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ref, reactive, computed, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { Document } from '@element-plus/icons-vue'
|
||||
import SystemViewDialog, {
|
||||
type ViewField,
|
||||
type ViewSection
|
||||
} from '@/components/business/system-view-dialog/index.vue'
|
||||
import { crmField, crmLongField, crmTagField } from '@/utils/crm/view-fields'
|
||||
import {
|
||||
listApproval,
|
||||
getApproval,
|
||||
@@ -226,6 +217,41 @@ const viewDialog = reactive({
|
||||
data: {} as ApprovalVO
|
||||
});
|
||||
|
||||
function approvalResultTag(result?: string) {
|
||||
if (result === 'approved') return { label: '通过', type: 'success' as const }
|
||||
if (result === 'rejected') return { label: '驳回', type: 'danger' as const }
|
||||
return { label: '待审批', type: 'warning' as const }
|
||||
}
|
||||
|
||||
const approvalViewSections = computed<ViewSection[]>(() => {
|
||||
const d = viewDialog.data
|
||||
if (!d?.id && !d?.contractNo) return []
|
||||
|
||||
const result = approvalResultTag(d.approvalResult)
|
||||
|
||||
const basicFields: ViewField[] = [
|
||||
crmField('合同名称', d.contractName),
|
||||
crmField('审批流程 ID', d.flowId),
|
||||
crmField('审批级别', d.step != null ? `第${d.step}级` : undefined),
|
||||
crmField('步骤名称', d.stepName),
|
||||
crmField('审批人部门', d.approverDept),
|
||||
crmField('审批人', d.approverName),
|
||||
crmTagField('审批结果', result.label, result.type)
|
||||
]
|
||||
|
||||
const detailFields: ViewField[] = [
|
||||
crmLongField('审批意见', d.approvalOpinion, { fullSpan: true }),
|
||||
crmField('审批时间', parseTime(d.approvalTime)),
|
||||
crmField('创建时间', parseTime(d.createTime)),
|
||||
crmLongField('备注', d.remark, { fullSpan: true })
|
||||
]
|
||||
|
||||
return [
|
||||
{ title: '基本信息', fields: basicFields },
|
||||
{ title: '审批详情', fields: detailFields }
|
||||
]
|
||||
})
|
||||
|
||||
// 审批对话框
|
||||
const approvalDialog = reactive({
|
||||
visible: false
|
||||
|
||||
@@ -196,55 +196,29 @@
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 查看详情对话框 -->
|
||||
<el-dialog title="变更详情" v-model="viewDialog.visible" width="800px" append-to-body>
|
||||
<el-descriptions :column="2" border>
|
||||
<el-descriptions-item label="合同编号">{{ viewDialog.data.contractNo }}</el-descriptions-item>
|
||||
<el-descriptions-item label="合同名称">{{ viewDialog.data.contractName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="变更类型">
|
||||
<DictTag dict-type="crm_contract_change_type" :value="viewDialog.data.changeType" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="变更状态">
|
||||
<el-tag v-if="viewDialog.data.changeStatus === 'pending'" type="warning">待审批</el-tag>
|
||||
<el-tag v-else-if="viewDialog.data.changeStatus === 'approved'" type="success">已通过</el-tag>
|
||||
<el-tag v-else-if="viewDialog.data.changeStatus === 'rejected'" type="danger">已驳回</el-tag>
|
||||
<el-tag v-else-if="viewDialog.data.changeStatus === 'executed'" type="info">已执行</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="变更原因" :span="2">{{ viewDialog.data.changeReason }}</el-descriptions-item>
|
||||
<el-descriptions-item label="变更内容" :span="2">{{ viewDialog.data.changeContent }}</el-descriptions-item>
|
||||
<el-descriptions-item label="变更前值" :span="2">
|
||||
<div class="text-content">{{ viewDialog.data.oldValue }}</div>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="变更后值" :span="2">
|
||||
<div class="text-content">{{ viewDialog.data.newValue }}</div>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="变更金额">
|
||||
<span v-if="viewDialog.data.changeAmount">¥{{ viewDialog.data.changeAmount.toLocaleString() }}</span>
|
||||
<span v-else>-</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="审批状态">
|
||||
<el-tag v-if="viewDialog.data.approvalStatus === 'pending'" type="warning">待审批</el-tag>
|
||||
<el-tag v-else-if="viewDialog.data.approvalStatus === 'approved'" type="success">已通过</el-tag>
|
||||
<el-tag v-else-if="viewDialog.data.approvalStatus === 'rejected'" type="danger">已驳回</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="审批人">{{ viewDialog.data.approverName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="审批时间">{{ parseTime(viewDialog.data.approvalTime) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="审批意见" :span="2">{{ viewDialog.data.approvalOpinion }}</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">{{ parseTime(viewDialog.data.createTime) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="备注" :span="2">{{ viewDialog.data.remark }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="viewDialog.visible = false">关 闭</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<!-- 查看详情 -->
|
||||
<SystemViewDialog
|
||||
v-model:visible="viewDialog.visible"
|
||||
title="变更详情"
|
||||
:icon="Document"
|
||||
:code="viewDialog.data.contractNo"
|
||||
code-label="合同编号"
|
||||
:meta="viewDialog.data.contractName"
|
||||
:sections="changeViewSections"
|
||||
append-to-body
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="ContractChange">
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ref, reactive, computed, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { Document } from '@element-plus/icons-vue'
|
||||
import SystemViewDialog, {
|
||||
type ViewField,
|
||||
type ViewSection
|
||||
} from '@/components/business/system-view-dialog/index.vue'
|
||||
import { crmDictField, crmField, crmLongField, crmTagField } from '@/utils/crm/view-fields'
|
||||
import {
|
||||
listChange,
|
||||
getChange,
|
||||
@@ -323,6 +297,66 @@ const viewDialog = reactive({
|
||||
data: {} as ChangeVO
|
||||
});
|
||||
|
||||
function changeStatusTag(status?: string) {
|
||||
if (status === 'pending') return { label: '待审批', type: 'warning' as const }
|
||||
if (status === 'approved') return { label: '已通过', type: 'success' as const }
|
||||
if (status === 'rejected') return { label: '已驳回', type: 'danger' as const }
|
||||
if (status === 'executed') return { label: '已执行', type: 'info' as const }
|
||||
return { label: '—', type: undefined }
|
||||
}
|
||||
|
||||
function approvalStatusTag(status?: string) {
|
||||
if (status === 'pending') return { label: '待审批', type: 'warning' as const }
|
||||
if (status === 'approved') return { label: '已通过', type: 'success' as const }
|
||||
if (status === 'rejected') return { label: '已驳回', type: 'danger' as const }
|
||||
return { label: '—', type: undefined }
|
||||
}
|
||||
|
||||
const changeViewSections = computed<ViewSection[]>(() => {
|
||||
const d = viewDialog.data
|
||||
if (!d?.id && !d?.contractNo) return []
|
||||
|
||||
const changeStatus = changeStatusTag(d.changeStatus)
|
||||
const approvalStatus = approvalStatusTag(d.approvalStatus)
|
||||
|
||||
const basicFields: ViewField[] = [
|
||||
crmField('合同名称', d.contractName),
|
||||
crmDictField('变更类型', 'crm_contract_change_type', d.changeType, dictStore),
|
||||
crmTagField('变更状态', changeStatus.label, changeStatus.type)
|
||||
]
|
||||
|
||||
const contentFields: ViewField[] = [
|
||||
crmLongField('变更原因', d.changeReason),
|
||||
crmLongField('变更内容', d.changeContent),
|
||||
crmLongField('变更前值', d.oldValue, { fullSpan: true }),
|
||||
crmLongField('变更后值', d.newValue, { fullSpan: true }),
|
||||
{
|
||||
label: '变更金额',
|
||||
value: d.changeAmount != null ? `¥${Number(d.changeAmount).toLocaleString()}` : '—',
|
||||
money: true
|
||||
}
|
||||
]
|
||||
|
||||
const approvalFields: ViewField[] = [
|
||||
crmTagField('审批状态', approvalStatus.label, approvalStatus.type),
|
||||
crmField('审批人', d.approverName),
|
||||
crmField('审批时间', parseTime(d.approvalTime)),
|
||||
crmLongField('审批意见', d.approvalOpinion, { fullSpan: true })
|
||||
]
|
||||
|
||||
const otherFields: ViewField[] = [
|
||||
crmField('创建时间', parseTime(d.createTime)),
|
||||
crmLongField('备注', d.remark, { fullSpan: true })
|
||||
]
|
||||
|
||||
return [
|
||||
{ title: '基本信息', fields: basicFields },
|
||||
{ title: '变更内容', fields: contentFields },
|
||||
{ title: '审批信息', fields: approvalFields },
|
||||
{ title: '其他', fields: otherFields }
|
||||
]
|
||||
})
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const formRef = ref<ElFormInstance>();
|
||||
|
||||
|
||||
@@ -349,7 +349,7 @@ defineExpose({ hasUploading })
|
||||
.upload-hint {
|
||||
display: block;
|
||||
font-size: 11px;
|
||||
color: #94a3b8;
|
||||
color: #1e293b;
|
||||
margin-top: 8px;
|
||||
line-height: 1;
|
||||
}
|
||||
@@ -412,7 +412,7 @@ defineExpose({ hasUploading })
|
||||
margin-top: 4px;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
color: #64748b;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.attachment-preview__icon {
|
||||
@@ -442,7 +442,7 @@ defineExpose({ hasUploading })
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
font-size: 11px;
|
||||
color: #334155;
|
||||
color: #1e293b;
|
||||
line-height: 1.4;
|
||||
word-break: break-all;
|
||||
}
|
||||
@@ -467,7 +467,7 @@ defineExpose({ hasUploading })
|
||||
height: 22px;
|
||||
border-radius: 4px;
|
||||
background: #f1f5f9;
|
||||
color: #64748b;
|
||||
color: #1e293b;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
@@ -503,7 +503,7 @@ defineExpose({ hasUploading })
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
min-height: 240px;
|
||||
color: #64748b;
|
||||
color: #1e293b;
|
||||
font-size: 14px;
|
||||
}
|
||||
</style>
|
||||
@@ -9,7 +9,6 @@
|
||||
:meta="viewHeroMeta"
|
||||
:sections="viewSections"
|
||||
:loading="loading"
|
||||
:grid-columns="2"
|
||||
dialog-class="contract-view-dialog"
|
||||
modal-class="order-module-dialog-mask"
|
||||
append-to-body
|
||||
@@ -324,7 +323,7 @@ defineExpose({ open })
|
||||
margin: 8px 0 0;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
color: #64748b;
|
||||
color: #1e293b;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -2199,7 +2199,7 @@ const loadSupplierList = async () => {
|
||||
}
|
||||
|
||||
.text-muted {
|
||||
color: #909399;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
:deep(.money-field-input.el-input-number .el-input__inner),
|
||||
|
||||
@@ -350,7 +350,7 @@ const handleClose = () => {
|
||||
}
|
||||
|
||||
.text-muted {
|
||||
color: #909399;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.mr-2 {
|
||||
|
||||
@@ -2769,7 +2769,7 @@ const handleGeneratePdfFile = async () => {
|
||||
.approval-remark {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #909399;
|
||||
color: #1e293b;
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
@@ -2803,7 +2803,7 @@ const handleGeneratePdfFile = async () => {
|
||||
|
||||
:deep(.el-timeline-item__timestamp) {
|
||||
font-size: 13px;
|
||||
color: #909399;
|
||||
color: #1e293b;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
@@ -2914,7 +2914,7 @@ const handleGeneratePdfFile = async () => {
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #909399;
|
||||
color: #1e293b;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
|
||||
@@ -2609,7 +2609,7 @@ onMounted(async () => {
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #909399;
|
||||
color: #1e293b;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
|
||||
@@ -4251,7 +4251,7 @@ onMounted(async () => {
|
||||
}
|
||||
|
||||
.text-muted {
|
||||
color: #999;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.framework-tier-detail-block {
|
||||
@@ -4482,7 +4482,7 @@ onMounted(async () => {
|
||||
.approval-remark {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #909399;
|
||||
color: #1e293b;
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
@@ -4600,7 +4600,7 @@ onMounted(async () => {
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #909399;
|
||||
color: #1e293b;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
@@ -4756,7 +4756,7 @@ onMounted(async () => {
|
||||
|
||||
.el-icon {
|
||||
font-size: 22px;
|
||||
color: #64748b;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
@@ -4778,7 +4778,7 @@ onMounted(async () => {
|
||||
border-radius: 50%;
|
||||
background: #fff;
|
||||
border: 1px solid #e2e8f0;
|
||||
color: #64748b;
|
||||
color: #1e293b;
|
||||
cursor: pointer;
|
||||
z-index: 2;
|
||||
|
||||
@@ -4794,7 +4794,7 @@ onMounted(async () => {
|
||||
width: 100%;
|
||||
font-size: 11px;
|
||||
line-height: 1.3;
|
||||
color: #64748b;
|
||||
color: #1e293b;
|
||||
text-align: center;
|
||||
white-space: normal;
|
||||
word-break: break-all;
|
||||
@@ -4874,7 +4874,7 @@ onMounted(async () => {
|
||||
|
||||
.quick-search-icon {
|
||||
cursor: pointer;
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
color: var(--mint-text);
|
||||
}
|
||||
|
||||
.quick-search-icon:hover {
|
||||
@@ -4967,7 +4967,7 @@ onMounted(async () => {
|
||||
margin-top: 4px;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
color: #64748b;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.detail-attachment-footer {
|
||||
@@ -4982,7 +4982,7 @@ onMounted(async () => {
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
font-size: 11px;
|
||||
color: #334155;
|
||||
color: #1e293b;
|
||||
line-height: 1.4;
|
||||
word-break: break-all;
|
||||
}
|
||||
@@ -4993,7 +4993,7 @@ onMounted(async () => {
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 6px;
|
||||
font-size: 12px;
|
||||
color: #334155;
|
||||
color: #1e293b;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
@@ -164,48 +164,27 @@
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 查看详情对话框 -->
|
||||
<el-dialog title="模板详情" v-model="viewDialog.visible" width="900px" append-to-body>
|
||||
<el-descriptions :column="2" border>
|
||||
<el-descriptions-item label="模板名称">{{ viewDialog.data.templateName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="模板类型">
|
||||
<DictTag dict-type="crm_contract_type" :value="viewDialog.data.templateType" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="模板编号">{{ viewDialog.data.templateNo }}</el-descriptions-item>
|
||||
<el-descriptions-item label="状态">
|
||||
<el-tag :type="viewDialog.data.isActive === 1 ? 'success' : 'info'">
|
||||
{{ viewDialog.data.isActive === 1 ? '启用' : '停用' }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="使用次数">{{ viewDialog.data.usageCount }}</el-descriptions-item>
|
||||
<el-descriptions-item label="排序">{{ viewDialog.data.sort }}</el-descriptions-item>
|
||||
<el-descriptions-item label="合同条款" :span="2">
|
||||
<div class="text-content">{{ viewDialog.data.contractTerms }}</div>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="付款条款" :span="2">
|
||||
<div class="text-content">{{ viewDialog.data.paymentTerms }}</div>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="交付条款" :span="2">
|
||||
<div class="text-content">{{ viewDialog.data.deliveryTerms }}</div>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="模板内容" :span="2">
|
||||
<div class="text-content">{{ viewDialog.data.templateContent }}</div>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">{{ parseTime(viewDialog.data.createTime) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="更新时间">{{ parseTime(viewDialog.data.updateTime) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="备注" :span="2">{{ viewDialog.data.remark }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="viewDialog.visible = false">关 闭</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<!-- 查看详情 -->
|
||||
<SystemViewDialog
|
||||
v-model:visible="viewDialog.visible"
|
||||
:title="viewDialog.data.templateName || '模板详情'"
|
||||
:icon="Document"
|
||||
:code="viewDialog.data.templateNo"
|
||||
code-label="模板编号"
|
||||
:sections="templateViewSections"
|
||||
append-to-body
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="ContractTemplate">
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ref, reactive, computed, onMounted } from 'vue'
|
||||
import { Document } from '@element-plus/icons-vue'
|
||||
import SystemViewDialog, {
|
||||
type ViewField,
|
||||
type ViewSection
|
||||
} from '@/components/business/system-view-dialog/index.vue'
|
||||
import { crmDictField, crmField, crmLongField, crmTagField } from '@/utils/crm/view-fields'
|
||||
import {
|
||||
listTemplate,
|
||||
getTemplate,
|
||||
@@ -279,6 +258,33 @@ const viewDialog = reactive({
|
||||
data: {} as TemplateVO
|
||||
});
|
||||
|
||||
const templateViewSections = computed<ViewSection[]>(() => {
|
||||
const d = viewDialog.data
|
||||
if (!d?.id && !d?.templateNo) return []
|
||||
|
||||
const basicFields: ViewField[] = [
|
||||
crmField('模板名称', d.templateName),
|
||||
crmDictField('模板类型', 'crm_contract_type', d.templateType, dictStore),
|
||||
crmTagField('状态', d.isActive === 1 ? '启用' : '停用', d.isActive === 1 ? 'success' : 'info'),
|
||||
crmField('使用次数', d.usageCount),
|
||||
crmField('排序', d.sort),
|
||||
crmField('创建时间', parseTime(d.createTime)),
|
||||
crmField('更新时间', parseTime(d.updateTime))
|
||||
]
|
||||
|
||||
const termFields: ViewField[] = [
|
||||
crmLongField('合同条款', d.contractTerms, { fullSpan: true }),
|
||||
crmLongField('付款条款', d.paymentTerms, { fullSpan: true }),
|
||||
crmLongField('交付条款', d.deliveryTerms, { fullSpan: true }),
|
||||
crmLongField('模板内容', d.templateContent, { fullSpan: true }),
|
||||
crmLongField('备注', d.remark, { fullSpan: true })
|
||||
].filter((f) => f.value !== '—')
|
||||
|
||||
const sections: ViewSection[] = [{ title: '基本信息', fields: basicFields }]
|
||||
if (termFields.length) sections.push({ title: '条款与内容', fields: termFields })
|
||||
return sections
|
||||
})
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const formRef = ref<ElFormInstance>();
|
||||
|
||||
|
||||
Loaded 100 of 328 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user