7/30 限制前端输入字数

This commit is contained in:
Zy
2026-07-30 17:59:32 +08:00
parent 903c92fef0
commit 2907f9202c
115 changed files with 2561 additions and 1213 deletions

View File

@@ -183,11 +183,32 @@ export const useHouseStore = defineStore(
// 清空 楼层信息
floorslist.value.clear();
// 重新获取楼层信息
currentHouseInfoList.value.units.forEach((item) => {
const units = currentHouseInfoList.value.units.toSorted((a, b) => {
const aVal = a.unitNoName;
const bVal = b.unitNoName;
// 判断是否为纯数字
const aIsNumber = /^-?\d+$/.test(aVal);
const bIsNumber = /^-?\d+$/.test(bVal);
if (aIsNumber && bIsNumber) {
// 都是数字,按数值排序
return Number(aVal) - Number(bVal);
} else if (aIsNumber) {
// a是数字,优先排前面
return -1;
} else if (bIsNumber) {
// b是数字,优先排前面
return 1;
} else {
// 都是文字,按中文字典序排序
return aVal.localeCompare(bVal, 'zh-CN');
}
});
units.forEach((item) => {
item.floors.forEach((floor) => {
floorslist.value.add(floor.floorNo);
});
});
console.log(units);
return;
});
};