SeoMarketPlanModal.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <j-modal
  3. :title="title"
  4. :width="width"
  5. :visible="visible"
  6. @ok="handleOk"
  7. :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }"
  8. @cancel="handleCancel"
  9. cancelText="关闭"
  10. >
  11. <SeoMarketPlanForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false" />
  12. </j-modal>
  13. </template>
  14. <script lang="ts" setup>
  15. import { ref, nextTick, defineExpose } from 'vue';
  16. import SeoMarketPlanForm from './SeoMarketPlanForm.vue';
  17. import JModal from '/@/components/Modal/src/JModal/JModal.vue';
  18. const title = ref<string>('');
  19. const width = ref<number>(800);
  20. const visible = ref<boolean>(false);
  21. const disableSubmit = ref<boolean>(false);
  22. const registerForm = ref();
  23. const emit = defineEmits(['register', 'success']);
  24. /**
  25. * 新增
  26. */
  27. function add() {
  28. title.value = '新增';
  29. visible.value = true;
  30. nextTick(() => {
  31. registerForm.value.add();
  32. });
  33. }
  34. /**
  35. * 编辑
  36. * @param record
  37. */
  38. function edit(record) {
  39. title.value = disableSubmit.value ? '详情' : '编辑';
  40. visible.value = true;
  41. nextTick(() => {
  42. registerForm.value.edit(record);
  43. });
  44. }
  45. /**
  46. * 确定按钮点击事件
  47. */
  48. function handleOk() {
  49. registerForm.value.submitForm();
  50. }
  51. /**
  52. * form保存回调事件
  53. */
  54. function submitCallback() {
  55. handleCancel();
  56. emit('success');
  57. }
  58. /**
  59. * 取消按钮回调事件
  60. */
  61. function handleCancel() {
  62. visible.value = false;
  63. }
  64. defineExpose({
  65. add,
  66. edit,
  67. disableSubmit,
  68. });
  69. </script>
  70. <style lang="less">
  71. /**隐藏样式-modal确定按钮 */
  72. .jee-hidden {
  73. display: none !important;
  74. }
  75. </style>
  76. <style lang="less" scoped></style>