floor.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. checked: false,
  42. name: '单幢'
  43. }]
  44. for (var i = 0; i < 25; i++) {
  45. let data = {
  46. checked: false,
  47. name: String.fromCharCode((65 + i)) + '幢'
  48. }
  49. building.push(data)
  50. }
  51. for (let i = 1; i <= 20; i++) {
  52. if (i != 0) {
  53. let data = {
  54. checked: false,
  55. name: i + '幢'
  56. }
  57. building.push(data)
  58. }
  59. }
  60. return building
  61. }
  62. module.exports = {
  63. makeRooms,
  64. floor,
  65. storiedBuilding
  66. }