Files
klp-oa/klp-ui/src/utils/coil/coilNo.js
砂糖 07e982b736 feat(钢卷管理): 添加钢卷号前缀生成功能并优化样式
添加钢卷号前缀生成工具函数及测试用例
在合并、拆分、分条和录入页面使用自动生成的钢卷号前缀
调整EmployeeSelector组件默认触发器的样式
移除typing.vue中未使用的变更历史代码块
添加钢卷号长度校验规则
2026-03-03 14:15:45 +08:00

38 lines
888 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 生成钢卷号前五位
* 格式:年份后两位 + 月份字母 + 日期两位
* 例如2026年3月3日生成 26L03
* @returns {string} 钢卷号前五位
*/
export function generateCoilNoPrefix() {
const now = new Date();
// 取年份后两位
const year = now.getFullYear().toString().slice(-2);
// 月份字母映射
const monthLetters = {
1: 'J', // 1月
2: 'K', // 2月
3: 'L', // 3月
4: 'M', // 4月
5: 'N', // 5月
6: 'O', // 6月
7: 'P', // 7月
8: 'Q', // 8月
9: 'R', // 9月
10: 'S', // 10月
11: 'T', // 11月
12: 'U' // 12月
};
// 获取月份字母
const month = monthLetters[now.getMonth() + 1];
// 日期补零
const day = String(now.getDate()).padStart(2, '0');
// 组合前五位:年份后两位 + 月份字母 + 日期两位
return year + month + day;
}