✨ 结算单业务模式运输方式与编辑体验优化
预结算/收付款结算支持业务模式与运输方式展示导出;完善结算调整、对账导入与变更记录;组织合同初始流水号未填不再显示-1。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -7,7 +7,7 @@ import 'nprogress/nprogress.css';
|
||||
const excelPattern = /\.(xls|xlsx)$/;
|
||||
|
||||
/** 是否为浏览器 Blob(含跨 realm 的 Blob-like) */
|
||||
const isBlobLike = value =>
|
||||
export const isBlobLike = value =>
|
||||
value != null &&
|
||||
typeof value === 'object' &&
|
||||
typeof value.size === 'number' &&
|
||||
@@ -15,14 +15,14 @@ const isBlobLike = value =>
|
||||
(typeof value.text === 'function' || typeof value.arrayBuffer === 'function');
|
||||
|
||||
/** axios 拦截器已把 JSON Blob 解析成的业务对象 */
|
||||
const isBusinessJson = value =>
|
||||
export const isBusinessJson = value =>
|
||||
value != null &&
|
||||
typeof value === 'object' &&
|
||||
!isBlobLike(value) &&
|
||||
!(value instanceof ArrayBuffer) &&
|
||||
('code' in value || 'success' in value || 'msg' in value);
|
||||
|
||||
const isExcelResponse = res => {
|
||||
export const isExcelResponse = res => {
|
||||
// 已是业务 JSON(导入成功/失败提示)时,绝不能当失败明细 Excel 处理
|
||||
if (isBusinessJson(res?.data)) {
|
||||
return false;
|
||||
@@ -54,7 +54,7 @@ const isExcelResponse = res => {
|
||||
* 提前解析成普通对象;此处需同时兼容 Blob / 字符串 / 已解析对象,避免再调
|
||||
* `blob.text()` 时出现「blob.text is not a function」。
|
||||
*/
|
||||
const parseBlobJson = async data => {
|
||||
export const parseBlobJson = async data => {
|
||||
if (data == null) {
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -3,10 +3,27 @@ export function isFreightFeeName(name) {
|
||||
return text.includes('运费') || text.includes('运输费');
|
||||
}
|
||||
|
||||
function parseBillingRules(row = {}) {
|
||||
const rule = row.billingRule || {};
|
||||
const nested = Array.isArray(rule.rules) ? rule.rules : [];
|
||||
if (nested.length) return nested;
|
||||
const raw = row.billingRulesJson ?? row.billingRules;
|
||||
if (Array.isArray(raw)) return raw.filter(item => item && typeof item === 'object');
|
||||
if (typeof raw === 'string' && raw.trim()) {
|
||||
try {
|
||||
const parsed = JSON.parse(raw);
|
||||
return Array.isArray(parsed) ? parsed.filter(item => item && typeof item === 'object') : [];
|
||||
} catch (error) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
/** 运输单价对应的运费计费类型。 */
|
||||
export function freightBillingType(row = {}) {
|
||||
const rule = row.billingRule || {};
|
||||
const rules = Array.isArray(rule.rules) ? rule.rules : [];
|
||||
const rules = parseBillingRules(row);
|
||||
const freightRule = rules.find(
|
||||
item => isFreightFeeName(item?.feeItem) || isFreightFeeName(item?.feeType)
|
||||
);
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
/** 审批通过、驳回等审批流转类变更内容,不在结算单变更记录中展示。 */
|
||||
export function isApprovalSettlementChange(content) {
|
||||
const text = String(content || '').trim();
|
||||
if (!text) return false;
|
||||
return text.includes('审批通过') || text.includes('审批驳回') || text === '已驳回';
|
||||
}
|
||||
Reference in New Issue
Block a user