🔀 合并 origin/master 到 dev
# Conflicts: # src/views/business/components/business-crud-page.vue
This commit is contained in:
@@ -23,7 +23,7 @@ export const MK_BIZ = {
|
||||
},
|
||||
'pre-settlement': {
|
||||
dictName: '提交预结算审核流',
|
||||
subjectPrefix: '预结算审批',
|
||||
subjectPrefix: '预付结算审批',
|
||||
rejected: ['returned'],
|
||||
approved: ['approved'],
|
||||
},
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
export function isFreightFeeName(name) {
|
||||
const text = String(name || '');
|
||||
return text.includes('运费') || text.includes('运输费');
|
||||
}
|
||||
|
||||
/** 运输单价对应的运费计费类型。 */
|
||||
export function freightBillingType(row = {}) {
|
||||
const rule = row.billingRule || {};
|
||||
const rules = Array.isArray(rule.rules) ? rule.rules : [];
|
||||
const freightRule = rules.find(
|
||||
item => isFreightFeeName(item?.feeItem) || isFreightFeeName(item?.feeType)
|
||||
);
|
||||
return freightRule?.billingType || row.billingType || rule.billingType || '';
|
||||
}
|
||||
|
||||
export function isTierUnitPrice(row) {
|
||||
return freightBillingType(row) === '阶梯单价';
|
||||
}
|
||||
|
||||
export function isIntervalBilling(row) {
|
||||
const type = freightBillingType(row);
|
||||
return type === '区间单价' || (type.includes('区间') && type.includes('一口价'));
|
||||
}
|
||||
|
||||
/** 阶梯单价、区间单价、区间一口价的运输单价不开放手工调整。 */
|
||||
export function isUnitPriceAdjustable(row) {
|
||||
const type = freightBillingType(row);
|
||||
if (!type) return true;
|
||||
return !isTierUnitPrice(row) && !isIntervalBilling(row);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/** 结算菜单拆分后的展示名与权限前缀 */
|
||||
|
||||
export const SETTLEMENT_TYPE_PAYABLE = 'payable';
|
||||
export const SETTLEMENT_TYPE_RECEIVABLE = 'receivable';
|
||||
|
||||
export function settlementBillLabel(settlementType) {
|
||||
return settlementType === SETTLEMENT_TYPE_RECEIVABLE ? '收款结算单' : '付款结算单';
|
||||
}
|
||||
|
||||
export function settlementPermissionPrefix(settlementType) {
|
||||
return settlementType === SETTLEMENT_TYPE_RECEIVABLE
|
||||
? 'receipt_settlement'
|
||||
: 'payment_settlement';
|
||||
}
|
||||
|
||||
export function settlementListPath(settlementType) {
|
||||
return settlementType === SETTLEMENT_TYPE_RECEIVABLE
|
||||
? '/settlement/receipt-settlement'
|
||||
: '/settlement/payment-settlement';
|
||||
}
|
||||
|
||||
/**
|
||||
* 权限判断:优先新菜单码,兼容旧 formal_settlement_*。
|
||||
* @param {Object} ctx 组件实例(需含 permission、isAdmin、validData)
|
||||
* @param {string} settlementType payable|receivable
|
||||
* @param {string} action add|edit|view...
|
||||
*/
|
||||
export function hasSettlementPermission(ctx, settlementType, action) {
|
||||
if (ctx?.isAdmin) return true;
|
||||
const prefix = settlementPermissionPrefix(settlementType);
|
||||
const codes = [`${prefix}_${action}`, `formal_settlement_${action}`];
|
||||
return codes.some(code => {
|
||||
const value = ctx?.permission?.[code];
|
||||
if (typeof ctx?.validData === 'function') {
|
||||
return ctx.validData(value, false);
|
||||
}
|
||||
return value === true;
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 结算单预付记录单据状态名(预结算编辑器与正式结算编辑器共用,避免两页状态名不一致)
|
||||
*/
|
||||
export function settlementStatusName(status, displayValue) {
|
||||
const labels = {
|
||||
reviewing: '审批中',
|
||||
approved: '审批通过',
|
||||
paid: '已付款',
|
||||
returned: '已驳回',
|
||||
voided: '已作废',
|
||||
draft: '草稿',
|
||||
};
|
||||
const name = labels[status];
|
||||
if (name) return name;
|
||||
return typeof displayValue === 'function' ? displayValue(status) : status || '-';
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一预付付款记录类型名
|
||||
*/
|
||||
export function settlementRecordTypeName(recordType) {
|
||||
return { progress_advance: '进度预付', project_advance: '项目预付核销' }[recordType] || '';
|
||||
}
|
||||
Reference in New Issue
Block a user