SelectRoomFormModal.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <j-modal
  3. :title="title"
  4. :width="width"
  5. :visible="visible"
  6. switchFullscreen
  7. @ok="handleOk"
  8. :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }"
  9. @cancel="handleCancel"
  10. cancelText="关闭"
  11. >
  12. <select-room-form
  13. ref="realForm"
  14. @ok="submitCallback"
  15. :disabled="disableSubmit"
  16. ></select-room-form>
  17. </j-modal>
  18. </template>
  19. <script>
  20. import SelectRoomForm from "./SelectRoomForm";
  21. export default {
  22. name: "SelectRoomFormModal",
  23. components: {
  24. SelectRoomForm,
  25. },
  26. data() {
  27. return {
  28. title: "",
  29. width: 800,
  30. visible: false,
  31. disableSubmit: false,
  32. };
  33. },
  34. methods: {
  35. add() {
  36. this.visible = true;
  37. this.$nextTick(() => {
  38. this.$refs.realForm.add();
  39. });
  40. },
  41. edit(record) {
  42. this.visible = true;
  43. this.$nextTick(() => {
  44. this.$refs.realForm.edit(record);
  45. });
  46. },
  47. close() {
  48. this.$emit("close");
  49. this.visible = false;
  50. },
  51. handleOk() {
  52. this.$refs.realForm.submitForm();
  53. },
  54. submitCallback(e) {
  55. console.log("e", e);
  56. this.$emit("ok", e);
  57. this.visible = false;
  58. },
  59. handleCancel() {
  60. this.close();
  61. },
  62. },
  63. };
  64. </script>