feat (router): 新增采购详情路由,优化预警数量管理功能

在管理员模块与商家模块中新增采购详情页面路由。
升级预警数量管理组件,优化交互体验与功能逻辑。
This commit is contained in:
pikachu1995@126.com
2026-07-22 15:52:15 +08:00
parent e91d783e22
commit c83d715234
26 changed files with 3569 additions and 206 deletions

View File

@@ -0,0 +1,91 @@
export const PROCUREMENT_STATUS = {
DRAFT: "待提交",
SUBMITTED: "已提交",
PENDING_INBOUND: "待入库",
PARTIAL_INBOUND: "部分入库",
CLOSED: "已关闭",
COMPLETED: "已完成",
REJECTED: "已拒绝",
};
export const PROCUREMENT_STATUS_TAG = {
DRAFT: "info",
SUBMITTED: "warning",
PENDING_INBOUND: "primary",
PARTIAL_INBOUND: "warning",
CLOSED: "info",
COMPLETED: "success",
REJECTED: "danger",
};
export const DAMAGE_STATUS = {
DRAFT: "待提交",
SUBMITTED: "待审核",
APPROVED: "已通过",
REJECTED: "已驳回",
CANCELLED: "已作废",
COMPLETED: "已完成",
};
export const DAMAGE_STATUS_TAG = {
DRAFT: "info",
SUBMITTED: "warning",
APPROVED: "primary",
REJECTED: "danger",
CANCELLED: "info",
COMPLETED: "success",
};
export const MARKET_ENABLE = {
UPPER: "上架",
DOWN: "下架",
};
export const STOCK_REASON_CATEGORY = {
INBOUND: "入库",
OUTBOUND: "出库",
DAMAGE: "报损",
};
export function stockReasonCategoryText(category) {
return STOCK_REASON_CATEGORY[category] || category || "-";
}
export function procurementStatusText(status) {
return PROCUREMENT_STATUS[status] || status || "-";
}
export function procurementStatusTag(status) {
return PROCUREMENT_STATUS_TAG[status] || "info";
}
export function damageStatusText(status) {
return DAMAGE_STATUS[status] || status || "-";
}
export function damageStatusTag(status) {
return DAMAGE_STATUS_TAG[status] || "info";
}
export function formatMoney(val) {
if (val === null || val === undefined || val === "") return "0.00";
return Number(val).toFixed(2);
}
export function exportCsv(filename, headers, rows) {
const escape = (v) => {
const s = v == null ? "" : String(v);
if (s.includes(",") || s.includes('"') || s.includes("\n")) {
return `"${s.replace(/"/g, '""')}"`;
}
return s;
};
const lines = [headers.map(escape).join(",")];
rows.forEach((row) => lines.push(row.map(escape).join(",")));
const blob = new Blob(["\uFEFF" + lines.join("\n")], { type: "text/csv;charset=utf-8;" });
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
link.download = filename;
link.click();
URL.revokeObjectURL(link.href);
}