|
@@ -18,10 +18,9 @@ export const APPROVAL_STATUS = Object.freeze({
|
|
|
|
|
|
/**
|
|
|
* 审批状态配置映射
|
|
|
- * @readonly
|
|
|
- * @type {Record<number, {label: string, type: string, color: string}>}
|
|
|
+ * @enum {Record<typeof APPROVAL_STATUS[keyof typeof APPROVAL_STATUS], {label: string, type: string, color: string}>}
|
|
|
*/
|
|
|
-export const APPROVAL_STATUS_CONFIG = {
|
|
|
+export const APPROVAL_STATUS_CONFIG = Object.freeze({
|
|
|
[APPROVAL_STATUS.PENDING]: {
|
|
|
label: '未审批',
|
|
|
type: 'warning',
|
|
@@ -37,7 +36,7 @@ export const APPROVAL_STATUS_CONFIG = {
|
|
|
type: 'danger',
|
|
|
color: '#F56C6C'
|
|
|
}
|
|
|
-}
|
|
|
+})
|
|
|
|
|
|
/**
|
|
|
* 审批状态选项数组
|
|
@@ -52,7 +51,7 @@ export const APPROVAL_STATUS_OPTIONS = [
|
|
|
|
|
|
/**
|
|
|
* 获取审批状态标签
|
|
|
- * @param {number} status - 审批状态值
|
|
|
+ * @param {typeof APPROVAL_STATUS[keyof typeof APPROVAL_STATUS]} status - 审批状态值
|
|
|
* @returns {string} 状态标签文本
|
|
|
*/
|
|
|
export function getApprovalStatusLabel(status) {
|
|
@@ -61,7 +60,7 @@ export function getApprovalStatusLabel(status) {
|
|
|
|
|
|
/**
|
|
|
* 获取审批状态类型
|
|
|
- * @param {number} status - 审批状态值
|
|
|
+ * @param {typeof APPROVAL_STATUS[keyof typeof APPROVAL_STATUS]} status - 审批状态值
|
|
|
* @returns {string} 状态类型
|
|
|
*/
|
|
|
export function getApprovalStatusType(status) {
|
|
@@ -70,7 +69,7 @@ export function getApprovalStatusType(status) {
|
|
|
|
|
|
/**
|
|
|
* 获取审批状态颜色
|
|
|
- * @param {number} status - 审批状态值
|
|
|
+ * @param {typeof APPROVAL_STATUS[keyof typeof APPROVAL_STATUS]} status - 审批状态值
|
|
|
* @returns {string} 状态颜色
|
|
|
*/
|
|
|
export function getApprovalStatusColor(status) {
|
|
@@ -79,7 +78,7 @@ export function getApprovalStatusColor(status) {
|
|
|
|
|
|
/**
|
|
|
* 验证审批状态是否有效
|
|
|
- * @param {number} status - 审批状态值
|
|
|
+ * @param {typeof APPROVAL_STATUS[keyof typeof APPROVAL_STATUS]} status - 审批状态值
|
|
|
* @returns {boolean} 是否为有效状态
|
|
|
*/
|
|
|
export function isValidApprovalStatus(status) {
|
|
@@ -88,7 +87,7 @@ export function isValidApprovalStatus(status) {
|
|
|
|
|
|
/**
|
|
|
* 判断是否可以编辑
|
|
|
- * @param {number} approvalStatus - 审批状态
|
|
|
+ * @param {typeof APPROVAL_STATUS[keyof typeof APPROVAL_STATUS]} approvalStatus - 审批状态
|
|
|
* @returns {boolean} 是否可以编辑
|
|
|
*/
|
|
|
export function canEdit(approvalStatus) {
|
|
@@ -97,7 +96,7 @@ export function canEdit(approvalStatus) {
|
|
|
|
|
|
/**
|
|
|
* 判断是否可以审批
|
|
|
- * @param {number} approvalStatus - 审批状态
|
|
|
+ * @param {typeof APPROVAL_STATUS[keyof typeof APPROVAL_STATUS]} approvalStatus - 审批状态
|
|
|
* @returns {boolean} 是否可以审批
|
|
|
*/
|
|
|
export function canApprove(approvalStatus) {
|
|
@@ -106,7 +105,7 @@ export function canApprove(approvalStatus) {
|
|
|
|
|
|
/**
|
|
|
* 判断是否可以拒绝
|
|
|
- * @param {number} approvalStatus - 审批状态
|
|
|
+ * @param {typeof APPROVAL_STATUS[keyof typeof APPROVAL_STATUS]} approvalStatus - 审批状态
|
|
|
* @returns {boolean} 是否可以拒绝
|
|
|
*/
|
|
|
export function canReject(approvalStatus) {
|
|
@@ -115,7 +114,7 @@ export function canReject(approvalStatus) {
|
|
|
|
|
|
/**
|
|
|
* 判断是否已审批完成
|
|
|
- * @param {number} approvalStatus - 审批状态
|
|
|
+ * @param {typeof APPROVAL_STATUS[keyof typeof APPROVAL_STATUS]} approvalStatus - 审批状态
|
|
|
* @returns {boolean} 是否已审批完成
|
|
|
*/
|
|
|
export function isApprovalCompleted(approvalStatus) {
|
|
@@ -124,7 +123,7 @@ export function isApprovalCompleted(approvalStatus) {
|
|
|
|
|
|
/**
|
|
|
* 判断是否审批通过
|
|
|
- * @param {number} approvalStatus - 审批状态
|
|
|
+ * @param {typeof APPROVAL_STATUS[keyof typeof APPROVAL_STATUS]} approvalStatus - 审批状态
|
|
|
* @returns {boolean} 是否审批通过
|
|
|
*/
|
|
|
export function isApproved(approvalStatus) {
|
|
@@ -133,7 +132,7 @@ export function isApproved(approvalStatus) {
|
|
|
|
|
|
/**
|
|
|
* 判断是否审批拒绝
|
|
|
- * @param {number} approvalStatus - 审批状态
|
|
|
+ * @param {typeof APPROVAL_STATUS[keyof typeof APPROVAL_STATUS]} approvalStatus - 审批状态
|
|
|
* @returns {boolean} 是否审批拒绝
|
|
|
*/
|
|
|
export function isRejected(approvalStatus) {
|
|
@@ -142,7 +141,7 @@ export function isRejected(approvalStatus) {
|
|
|
|
|
|
/**
|
|
|
* 获取所有审批状态值
|
|
|
- * @returns {Array<number>} 所有审批状态值数组
|
|
|
+ * @returns {(typeof APPROVAL_STATUS[keyof typeof APPROVAL_STATUS])[]} 所有审批状态值数组
|
|
|
*/
|
|
|
export function getAllApprovalStatusValues() {
|
|
|
return Object.values(APPROVAL_STATUS)
|
|
@@ -165,7 +164,7 @@ export const AUDIT_ACTION_TYPE = {
|
|
|
/**
|
|
|
* 审核操作配置映射
|
|
|
* @readonly
|
|
|
- * @type {Record<string, {label: string, type: string, icon: string}>}
|
|
|
+ * @type {Record<(typeof AUDIT_ACTION_TYPE[keyof typeof AUDIT_ACTION_TYPE]), {label: string, type: string, icon: string}>}
|
|
|
*/
|
|
|
export const AUDIT_ACTION_CONFIG = {
|
|
|
[AUDIT_ACTION_TYPE.APPROVE]: {
|
|
@@ -187,8 +186,8 @@ export const AUDIT_ACTION_CONFIG = {
|
|
|
|
|
|
/**
|
|
|
* 获取可执行的审核操作
|
|
|
- * @param {number} approvalStatus - 审批状态
|
|
|
- * @returns {Array<string>} 可执行的操作类型数组
|
|
|
+ * @param {typeof APPROVAL_STATUS[keyof typeof APPROVAL_STATUS]} approvalStatus - 审批状态
|
|
|
+ * @returns {(typeof AUDIT_ACTION_TYPE[keyof typeof AUDIT_ACTION_TYPE])[]} 可执行的操作类型数组
|
|
|
*/
|
|
|
export function getAvailableAuditActions(approvalStatus) {
|
|
|
const actions = [AUDIT_ACTION_TYPE.VIEW]
|
|
@@ -326,7 +325,7 @@ export const NUMBER_FORMAT_OPTIONS = {
|
|
|
/**
|
|
|
* 格式化数字显示
|
|
|
* @param {number|null|undefined} value - 数值
|
|
|
- * @param {Object} options - 格式化选项
|
|
|
+ * @param {typeof NUMBER_FORMAT_OPTIONS[keyof typeof NUMBER_FORMAT_OPTIONS]} options - 格式化选项
|
|
|
* @returns {string} 格式化后的字符串
|
|
|
*/
|
|
|
export function formatNumber(value, options = NUMBER_FORMAT_OPTIONS.quantity) {
|
|
@@ -356,60 +355,11 @@ export function formatCurrency(value) {
|
|
|
|
|
|
// ==================== 汇总模块相关常量 ====================
|
|
|
|
|
|
-/**
|
|
|
- * 预测汇总查询参数类型定义
|
|
|
- * @typedef {Object} ForecastSummaryQueryParams
|
|
|
- * @property {number} [current=1] - 当前页码
|
|
|
- * @property {number} [size=10] - 每页数量
|
|
|
- * @property {number} [year] - 年份
|
|
|
- * @property {number} [month] - 月份
|
|
|
- * @property {number} [customerId] - 客户ID
|
|
|
- * @property {string} [customerCode] - 客户编码
|
|
|
- * @property {string} [customerName] - 客户名称
|
|
|
- * @property {number} [brandId] - 品牌ID
|
|
|
- * @property {string} [brandCode] - 品牌编码
|
|
|
- * @property {string} [brandName] - 品牌名称
|
|
|
- * @property {number} [itemId] - 物料ID
|
|
|
- * @property {string} [itemCode] - 物料编码
|
|
|
- * @property {string} [itemName] - 物料名称
|
|
|
- * @property {number} [approvalStatus] - 审批状态
|
|
|
- */
|
|
|
-
|
|
|
-/**
|
|
|
- * 预测汇总数据项类型定义
|
|
|
- * @typedef {Object} ForecastSummaryItem
|
|
|
- * @property {string} id - 汇总记录ID
|
|
|
- * @property {string} createUser - 创建用户ID
|
|
|
- * @property {string} createDept - 创建部门ID
|
|
|
- * @property {string} createTime - 创建时间
|
|
|
- * @property {string} updateUser - 更新用户ID
|
|
|
- * @property {string} updateTime - 更新时间
|
|
|
- * @property {number} status - 状态
|
|
|
- * @property {number} isDeleted - 是否删除
|
|
|
- * @property {number} year - 年份
|
|
|
- * @property {number} month - 月份
|
|
|
- * @property {number} customerId - 客户ID
|
|
|
- * @property {string} customerCode - 客户编码
|
|
|
- * @property {string} customerName - 客户名称
|
|
|
- * @property {number} brandId - 品牌ID
|
|
|
- * @property {string} brandCode - 品牌编码
|
|
|
- * @property {string} brandName - 品牌名称
|
|
|
- * @property {number} itemId - 物料ID
|
|
|
- * @property {string} itemCode - 物料编码
|
|
|
- * @property {string} itemName - 物料名称
|
|
|
- * @property {string} specs - 规格
|
|
|
- * @property {string} pattern - 花纹
|
|
|
- * @property {string} forecastQuantity - 预测数量
|
|
|
- * @property {number} approvalStatus - 审批状态 0未审批 1已通过 2已拒绝
|
|
|
- * @property {number|null} approvedBy - 审批人ID
|
|
|
- * @property {string|null} approvedName - 审批人姓名
|
|
|
- * @property {string|null} approvedTime - 审批时间
|
|
|
- */
|
|
|
+// 类型定义已迁移到 @/api/types/forecast.d.ts
|
|
|
|
|
|
/**
|
|
|
* 预测汇总默认查询参数
|
|
|
* @readonly
|
|
|
- * @type {ForecastSummaryQueryParams}
|
|
|
*/
|
|
|
export const DEFAULT_FORECAST_SUMMARY_QUERY = {
|
|
|
current: 1,
|
|
@@ -431,7 +381,6 @@ export const DEFAULT_FORECAST_SUMMARY_QUERY = {
|
|
|
/**
|
|
|
* 月份选项数组
|
|
|
* @readonly
|
|
|
- * @type {Array<{label: string, value: number}>}
|
|
|
*/
|
|
|
export const MONTH_OPTIONS = [
|
|
|
{ label: '1月', value: 1 },
|
|
@@ -543,7 +492,6 @@ export const FORECAST_SUMMARY_FORM_RULES = {
|
|
|
/**
|
|
|
* 销售预测汇总默认表单数据
|
|
|
* @readonly
|
|
|
- * @type {Object}
|
|
|
*/
|
|
|
export const DEFAULT_FORECAST_SUMMARY_FORM = {
|
|
|
id: null,
|