meetingroomschedule.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  1. <template>
  2. <a-card :bordered="false">
  3. <div class="course-week">
  4. <div class="week-top">
  5. <div class="week-btn-wrap">
  6. <span @click="getLastWeek">上周</span>
  7. <span @click="getCurWeek">本周</span>
  8. <span @click="getNextWeek">下周</span>
  9. </div>
  10. <span class="w-today-date"> {{ todayDate }}</span>
  11. <div class="w-choose-status">
  12. <div v-for="sta in cardStatus">
  13. <span class="square" :style="{ background: sta.color }"></span>
  14. <span class="title">{{ sta.title }}</span>
  15. </div>
  16. </div>
  17. </div>
  18. <div class="week-table">
  19. <div class="table-header">
  20. <div class="table-week">
  21. <template v-for="(item, index) of weeks">
  22. <span class="w-first" v-if="index === 0" :key="index">{{
  23. item
  24. }}</span>
  25. <span v-else :key="index">{{ item }}</span>
  26. </template>
  27. </div>
  28. <div class="w-table-date">
  29. <template v-for="(item, index) of months">
  30. <span class="w-first" v-if="index === 0" :key="index"> </span>
  31. <template v-else>
  32. <span
  33. :key="index"
  34. class="w-day-item"
  35. :class="{ 'w-isCurDate': item && item.isCurDate }"
  36. >
  37. {{
  38. `${
  39. item && item.isCurDate
  40. ? (item && item.showDate + "(今天)") || ""
  41. : (item && item.showDate) || ""
  42. }`
  43. }}
  44. </span>
  45. </template>
  46. </template>
  47. </div>
  48. </div>
  49. <div class="w-time-period-list">
  50. <ul
  51. class="w-time-period-row"
  52. v-for="(i, i_index) in planList2"
  53. :key="i_index"
  54. >
  55. <!--循环时段,看时段有多少个-->
  56. <template v-if="i.child && i.child.length > 0">
  57. <li
  58. class="w-time-period-col"
  59. v-for="(period, p_index) in i.child"
  60. :key="`period${p_index}`"
  61. >
  62. <!--第一列显示时段-->
  63. <div class="w-time-period">
  64. <span v-if="p_index == 1" class="meeting-room-center">{{
  65. i.meetingRoomName
  66. }}</span
  67. >{{ period.timePeriod }}
  68. </div>
  69. <!-- 后面显示周一到周日的计划-->
  70. <div class="w-row-day">
  71. <!-- 循环显示每周的日期-->
  72. <template v-for="(month, m_index) of months">
  73. <!-- v-if="month" 去除数据处理的时候移除数组第一个为empty的问题-->
  74. <div
  75. v-if="month"
  76. :key="`month${m_index}`"
  77. class="w-things"
  78. @click="handleCardDetail(month, period)"
  79. >
  80. <!-- 循环每个时间段的计划-->
  81. <template v-for="(card, t_index) of period.schedule">
  82. <template
  83. v-if="card.key == month.date"
  84. v-for="(single, sIndex) in card.value"
  85. >
  86. <div style="width: 80%">
  87. <a-popover placement="rightTop">
  88. <template slot="content">
  89. <p>会议室:{{ i.meetingRoomName }}</p>
  90. <p>会议主题:{{ single.roomSchedule.theme }}</p>
  91. <p>公司名称:{{ single.roomSchedule.name }}</p>
  92. <p>
  93. 预定人:{{ single.roomSchedule.destinedName }}
  94. </p>
  95. <p>
  96. 联系电话:{{ single.roomSchedule.mobile }}
  97. </p>
  98. <p>是否结账:未结账</p>
  99. <p>备注:{{ single.roomSchedule.remark }}</p>
  100. </template>
  101. <template slot="title">
  102. <span>详情</span>
  103. </template>
  104. <div
  105. :key="`thing${sIndex}`"
  106. class="w-thing-item"
  107. @click.stop="handleDetail(single)"
  108. :style="{
  109. background:
  110. cardStatus[single.detail.status].color,
  111. }"
  112. >
  113. <span>{{ single.theme }}</span>
  114. </div>
  115. </a-popover>
  116. </div>
  117. </template>
  118. </template>
  119. </div>
  120. </template>
  121. </div>
  122. </li>
  123. </template>
  124. <!-- <div class="w-noMore" v-else><span>暂无数据</span></div> -->
  125. </ul>
  126. </div>
  127. </div>
  128. </div>
  129. <bus-meeting-room-schedule-modal
  130. ref="modalForm"
  131. @ok="modalFormOk"
  132. ></bus-meeting-room-schedule-modal>
  133. <bus-meeting-room-schedule-confirm-modal
  134. ref="modalBusMeetingRoomScheduleConfirm"
  135. @ok="modalFormOk"
  136. ></bus-meeting-room-schedule-confirm-modal>
  137. </a-card>
  138. </template>
  139. <script>
  140. import "@/assets/less/TableExpand.less";
  141. // import { mixinDevice } from "@/utils/mixin";
  142. // import { JeecgListMixin } from "@/mixins/JeecgListMixin";
  143. import { httpAction, getAction } from "@/api/manage";
  144. import BusMeetingRoomScheduleModal from "./modules/meetingRoomSchedule/BusMeetingRoomScheduleModal.vue";
  145. import BusMeetingRoomScheduleConfirmModal from "./modules/meetingRoomSchedule/BusMeetingRoomScheduleConfirmModal.vue";
  146. export default {
  147. name: "BusMeetingRoomList",
  148. // mixins: [JeecgListMixin, mixinDevice],
  149. components: {
  150. BusMeetingRoomScheduleModal,
  151. BusMeetingRoomScheduleConfirmModal,
  152. },
  153. data() {
  154. const planList = [
  155. {
  156. timePeriod: "上午",
  157. schedule: [
  158. {
  159. key: "2023-03-15",
  160. value: [
  161. {
  162. theme: "大会议室",
  163. status: 1,
  164. meeting_room_schedule: {}, //预定信息实体
  165. },
  166. ],
  167. },
  168. {
  169. key: "2023-03-14",
  170. value: [
  171. {
  172. theme: "大会议室",
  173. status: 0,
  174. meeting_room_schedule: {}, //预定信息实体
  175. },
  176. ],
  177. },
  178. ],
  179. },
  180. {
  181. timePeriod: "下午",
  182. schedule: [
  183. {
  184. key: "2023-03-15",
  185. value: [
  186. {
  187. theme: "大会议室1111111111111111111111111",
  188. status: 0,
  189. meeting_room_schedule: {}, //预定信息实体
  190. },
  191. ],
  192. },
  193. {
  194. key: "2023-03-14",
  195. value: [
  196. {
  197. theme: "大会议室",
  198. status: 0,
  199. meeting_room_schedule: {}, //预定信息实体
  200. },
  201. ],
  202. },
  203. ],
  204. },
  205. {
  206. timePeriod: "晚上",
  207. schedule: [],
  208. },
  209. ];
  210. return {
  211. isFirstDayOfMondayOrSunday: 1,
  212. cardStatus: {
  213. 0: {
  214. title: "预定未确认",
  215. color: "#3291F8",
  216. },
  217. 1: {
  218. title: "预定已确认",
  219. color: "#FF6200",
  220. },
  221. },
  222. weeks: ["时段", "周一", "周二", "周三", "周四", "周五", "周六", "周日"],
  223. todayDate: "",
  224. months: [],
  225. curDate: "",
  226. nowDate: new Date(),
  227. planList2: [
  228. // { meetingRoomName: "大会议", child: planList },
  229. // { meetingRoomName: "大会议2", child: planList },
  230. ],
  231. startDate: "",
  232. endDate: "",
  233. };
  234. },
  235. watch: {
  236. isFirstDayOfMondayOrSunday: {
  237. handler(val) {
  238. if (val > 1) {
  239. let arr = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"];
  240. const arr1 = arr.slice(val - 1);
  241. const arr2 = arr.slice(0, val - 1);
  242. this.weeks = ["时段", ...arr1, ...arr2];
  243. }
  244. },
  245. immediate: true,
  246. },
  247. },
  248. mounted() {
  249. this.getCurWeek();
  250. },
  251. created() {},
  252. methods: {
  253. modalFormOk() {
  254. this.loadData();
  255. },
  256. loadData() {
  257. var _info = JSON.parse(localStorage.getItem("storeInfo"));
  258. getAction("/business/busMeetingRoomSchedule/fetch", {
  259. startDate: this.startDate,
  260. endDate: this.endDate,
  261. hotelId: _info.id,
  262. }).then((res) => {
  263. if (res.success) {
  264. this.planList2 = res.result;
  265. }
  266. });
  267. },
  268. /**
  269. * 获取 时间
  270. * @param time
  271. */
  272. getWeek(time) {
  273. this.curDate = new Date(time);
  274. //当前是周几
  275. const whichDay = time.getDay();
  276. let num = 0;
  277. if (this.isFirstDayOfMondayOrSunday <= whichDay) {
  278. num = this.isFirstDayOfMondayOrSunday;
  279. } else {
  280. num = this.isFirstDayOfMondayOrSunday - 7;
  281. }
  282. const weekDay = time.getDay() - num;
  283. time = this.addDate(time, weekDay * -1);
  284. for (let i = 0; i < 7; i++) {
  285. const { year, month, day } = this.formatDate(
  286. i === 0 ? time : this.addDate(time, 1)
  287. );
  288. this.months.push({
  289. date: `${year}-${month}-${day}`,
  290. showDate: `${month}-${day}`,
  291. timestamp: new Date(`${year}-${month}-${day}`).getTime(),
  292. });
  293. }
  294. this.months.sort((a, b) => a.timestamp - b.timestamp);
  295. delete this.months[0];
  296. this.todayDate = `${this.months[1].date} ~ ${
  297. this.months[this.months.length - 1].date
  298. }`;
  299. this.startDate = this.months[1].date + " 00:00:00";
  300. this.endDate = this.months[this.months.length - 1].date + " 00:00:00";
  301. this.loadData();
  302. },
  303. /**
  304. * 处理日期
  305. * @param date
  306. * @param n
  307. * @returns {*}
  308. */
  309. addDate(date, n) {
  310. date.setDate(date.getDate() + n);
  311. return date;
  312. },
  313. /**
  314. * 上周
  315. */
  316. getLastWeek() {
  317. const date = this.addDate(this.curDate, -7),
  318. { year, month, day } = this.formatDate(date),
  319. dateObj = {
  320. date: `${year}-${month}-${day}`,
  321. timestamp: new Date(`${year}-${month}-${day}`).getTime(),
  322. };
  323. this.dealDate(date);
  324. this.$emit("changeWeek", dateObj);
  325. },
  326. /**
  327. * 本周
  328. */
  329. getCurWeek() {
  330. const { year, month, day } = this.formatDate(new Date()),
  331. dateObj = {
  332. date: `${year}-${month}-${day}`,
  333. timestamp: new Date(`${year}-${month}-${day}`).getTime(),
  334. };
  335. this.dealDate(new Date());
  336. this.$emit("changeWeek", dateObj);
  337. },
  338. //日期格式处理
  339. formatDate(date) {
  340. var year = date.getFullYear();
  341. var months = date.getMonth() + 1;
  342. var month = (months < 10 ? "0" + months : months).toString();
  343. var day = (
  344. date.getDate() < 10 ? "0" + date.getDate() : date.getDate()
  345. ).toString();
  346. return {
  347. year: year.toString(),
  348. month,
  349. day,
  350. };
  351. },
  352. /**
  353. * 获取当天时间
  354. * @returns {string}
  355. */
  356. getCurDay(num = 0) {
  357. var datetime = new Date();
  358. var year = datetime.getFullYear();
  359. var month =
  360. datetime.getMonth() + 1 < 10
  361. ? "0" + (datetime.getMonth() + 1)
  362. : datetime.getMonth() + 1;
  363. let day = datetime.getDate();
  364. if (day + num > 0) {
  365. day =
  366. day + num < 10
  367. ? "0" + (datetime.getDate() + num)
  368. : datetime.getDate() + num;
  369. } else {
  370. day =
  371. day - num < 10
  372. ? "0" + (datetime.getDate() - num)
  373. : datetime.getDate() - num;
  374. }
  375. return `${year}-${month}-${day}`;
  376. },
  377. /**
  378. * 下周
  379. */
  380. getNextWeek() {
  381. const date = this.addDate(this.curDate, 7),
  382. { year, month, day } = this.formatDate(date),
  383. dateObj = {
  384. date: `${year}-${month}-${day}`,
  385. timestamp: new Date(`${year}-${month}-${day}`).getTime(),
  386. };
  387. this.dealDate(date);
  388. this.$emit("changeWeek", dateObj);
  389. },
  390. /**
  391. * 显示当天日期状态
  392. * @param date
  393. */
  394. dealDate(date) {
  395. this.months = [""];
  396. this.getWeek(date);
  397. const curDate = this.getCurDay();
  398. this.months.forEach((item) => {
  399. item.isCurDate = item.date === curDate;
  400. });
  401. },
  402. /**
  403. * 预定确认
  404. * @param row
  405. */
  406. handleDetail(row) {
  407. console.log("row", row);
  408. this.$refs.modalBusMeetingRoomScheduleConfirm.edit(row);
  409. this.$refs.modalBusMeetingRoomScheduleConfirm.title = "预定确认";
  410. this.$refs.modalBusMeetingRoomScheduleConfirm.disableSubmit = false;
  411. this.$refs.modalBusMeetingRoomScheduleConfirm.disableSubmit = true;
  412. },
  413. /**
  414. * 预定登记
  415. * @param month
  416. * @param period
  417. */
  418. handleCardDetail(month, period) {
  419. this.$refs.modalForm.add();
  420. this.$refs.modalForm.title = "预定登记";
  421. this.$refs.modalForm.disableSubmit = false;
  422. },
  423. },
  424. };
  425. </script>
  426. <style scoped>
  427. @import "~@assets/less/common.less";
  428. </style>
  429. <style scoped>
  430. ul {
  431. list-style: none;
  432. }
  433. ul,
  434. li {
  435. margin: 0;
  436. padding: 0;
  437. }
  438. .course-week {
  439. width: 100%;
  440. border: 1px solid #ddd;
  441. padding: 1%;
  442. box-sizing: border-box;
  443. }
  444. .week-top {
  445. display: flex;
  446. justify-content: space-between;
  447. align-items: center;
  448. width: 100%;
  449. height: 40px;
  450. padding: 0 1%;
  451. box-sizing: border-box;
  452. }
  453. .week-top .week-btn-wrap {
  454. width: 200px;
  455. display: flex;
  456. justify-content: space-around;
  457. color: #409eff;
  458. }
  459. .week-top .week-btn-wrap span {
  460. cursor: pointer;
  461. display: flex;
  462. justify-content: center;
  463. align-items: center;
  464. font-size: 15px;
  465. }
  466. .w-today-date {
  467. font-weight: bold;
  468. font-size: 16px;
  469. }
  470. .w-choose-status {
  471. display: flex;
  472. justify-content: flex-end;
  473. width: 200px;
  474. }
  475. .w-choose-status > div {
  476. width: 100%;
  477. flex: 1;
  478. display: flex;
  479. padding: 0 2%;
  480. white-space: nowrap;
  481. line-height: 20px;
  482. box-sizing: border-box;
  483. }
  484. .w-choose-status > div .square {
  485. display: flex;
  486. width: 16px;
  487. height: 16px;
  488. border-radius: 4px;
  489. box-sizing: border-box;
  490. }
  491. .w-choose-status > div .title {
  492. display: flex;
  493. align-items: center;
  494. line-height: 16px;
  495. padding-left: 4px;
  496. font-size: 14px;
  497. box-sizing: border-box;
  498. }
  499. .week-table {
  500. display: flex;
  501. flex-direction: column;
  502. }
  503. .week-table .table-header {
  504. width: 100%;
  505. height: 80px;
  506. background: #eaedf2;
  507. display: flex;
  508. flex-direction: column;
  509. align-items: center;
  510. border-bottom: 1px solid #eaedf2;
  511. box-sizing: border-box;
  512. }
  513. .table-header .w-table-date,
  514. .table-week {
  515. width: 100%;
  516. height: 40px;
  517. text-align: left;
  518. display: flex;
  519. justify-content: center;
  520. align-items: center;
  521. }
  522. .table-header .w-table-date > span,
  523. .table-week > span {
  524. flex: 1;
  525. color: #000;
  526. height: 100%;
  527. font-size: 14px;
  528. display: flex;
  529. justify-content: center;
  530. align-items: center;
  531. font-weight: bold;
  532. }
  533. .w-table-date .w-day-item,
  534. .table-week .w-day-item {
  535. color: #000;
  536. font-size: 14px;
  537. display: flex;
  538. justify-content: center;
  539. align-items: center;
  540. }
  541. .week-table .w-time-period-list {
  542. width: 100%;
  543. }
  544. .w-time-period-list .w-time-period-row {
  545. width: 100%;
  546. min-height: 60px;
  547. }
  548. .w-time-period-col {
  549. width: 100%;
  550. min-height: 60px;
  551. display: flex;
  552. }
  553. .w-time-period-col .w-time-period {
  554. width: 12.5%;
  555. display: flex;
  556. justify-content: center;
  557. align-items: center;
  558. border-left: 1px solid #eaedf2;
  559. /* border-bottom: 1px solid #eaedf2; */
  560. box-sizing: border-box;
  561. }
  562. .w-time-period-col:last-child {
  563. border-bottom: 1px solid #eaedf2;
  564. }
  565. .meeting-room-center {
  566. transform: translate(-200%, 0%);
  567. width: 14px;
  568. font-size: 14px;
  569. word-wrap: break-word;
  570. position: absolute;
  571. }
  572. .w-time-period-col .w-row-day {
  573. width: 87.5%;
  574. display: flex;
  575. justify-content: center;
  576. }
  577. .w-row-day .w-things {
  578. flex: 1;
  579. display: flex;
  580. flex-direction: column;
  581. align-items: center;
  582. border-left: 1px solid #eaedf2;
  583. border-bottom: 1px solid #eaedf2;
  584. box-sizing: border-box;
  585. cursor: pointer;
  586. }
  587. .w-row-day .w-things:last-child {
  588. border-right: 1px solid #eaedf2;
  589. }
  590. .w-things .w-thing-item {
  591. display: flex;
  592. width: 80%;
  593. font-size: 14px;
  594. flex-direction: column;
  595. justify-content: space-around;
  596. min-height: 50px;
  597. border-radius: 10px;
  598. margin: 2% 1%;
  599. padding: 1% 2%;
  600. cursor: pointer;
  601. color: #fff;
  602. background: #ff6200;
  603. box-sizing: border-box;
  604. transition: all 1s linear 0.5s;
  605. }
  606. .w-isCurDate {
  607. color: #ff2525 !important;
  608. }
  609. .w-noMore {
  610. min-height: 200px;
  611. padding: 2%;
  612. display: flex;
  613. justify-content: center;
  614. align-items: center;
  615. border: 1px solid rgba(156, 173, 173, 0.3);
  616. color: #9cadadb7;
  617. box-sizing: border-box;
  618. }
  619. .w_expand,
  620. .w_shrink {
  621. color: #0a98d5;
  622. cursor: pointer;
  623. width: 100%;
  624. padding: 2% 0;
  625. display: flex;
  626. justify-content: center;
  627. align-items: center;
  628. }
  629. </style>