floor.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // 生成房间号数组
  2. const makeRooms = (floor, rooms, extraRooms) => {
  3. // makeRooms(floor, rooms, extraRooms) {
  4. let arr = [];
  5. for (let i = 1; i < rooms + 1; i++) {
  6. let roomNumber = floor * 100 + i;
  7. for (let j = 0; j < extraRooms + 1; j++) {
  8. if (j > 0) {
  9. let realRoom = roomNumber + "-" + j;
  10. let data = {
  11. name: realRoom,
  12. checked: false
  13. };
  14. arr.push(data);
  15. } else {
  16. let data = {
  17. name: roomNumber,
  18. checked: false
  19. };
  20. arr.push(data);
  21. }
  22. }
  23. }
  24. return arr;
  25. };
  26. const floor = () => {
  27. let floorNum = [];
  28. for (let i = 1; i < 56; i++) {
  29. if (i != 0) {
  30. let data = {
  31. checked: false,
  32. name: i + "楼"
  33. };
  34. floorNum.push(data);
  35. }
  36. }
  37. return floorNum;
  38. };
  39. const storiedBuilding = () => {
  40. let building = [
  41. {
  42. checked: false,
  43. name: "单幢"
  44. }
  45. ];
  46. for (var i = 0; i < 25; i++) {
  47. let data = {
  48. checked: false,
  49. name: String.fromCharCode(65 + i) + "幢"
  50. };
  51. building.push(data);
  52. }
  53. for (let i = 1; i <= 20; i++) {
  54. if (i != 0) {
  55. let data = {
  56. checked: false,
  57. name: i + "幢"
  58. };
  59. building.push(data);
  60. }
  61. }
  62. return building;
  63. };
  64. module.exports = {
  65. makeRooms,
  66. floor,
  67. storiedBuilding
  68. };