feat(钢卷管理): 添加钢卷号前缀生成功能并优化样式
添加钢卷号前缀生成工具函数及测试用例 在合并、拆分、分条和录入页面使用自动生成的钢卷号前缀 调整EmployeeSelector组件默认触发器的样式 移除typing.vue中未使用的变更历史代码块 添加钢卷号长度校验规则
This commit is contained in:
37
klp-ui/src/utils/coil/coilNo.js
Normal file
37
klp-ui/src/utils/coil/coilNo.js
Normal file
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* 生成钢卷号前五位
|
||||
* 格式:年份后两位 + 月份字母 + 日期两位
|
||||
* 例如: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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user