mattersListDrawer.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <div class="ship-info-drawer">
  3. <el-drawer
  4. v-model="visible"
  5. title="事项清单查询列表"
  6. :with-header="true"
  7. :close-on-click-modal="false"
  8. size="70%"
  9. >
  10. </el-drawer>
  11. </div>
  12. </template>
  13. <script setup lang="ts">
  14. import { ref, reactive, defineProps, defineEmits } from 'vue';
  15. import type { FormInstance } from 'element-plus';
  16. const props = defineProps<{
  17. visible: boolean;
  18. }>();
  19. // 向父组件发送事件
  20. const emit = defineEmits<{
  21. (e: 'update:visible', value: boolean): void;
  22. (e: 'selectShip', shipData: any): void; // 选择船舶时通知父组件(预留)
  23. }>();
  24. // 抽屉显示状态(双向绑定)
  25. const visible = ref(props.visible);
  26. // 查询表单数据
  27. const searchForm = reactive({
  28. shipName: '',
  29. shipId: '',
  30. registrationNo: '',
  31. firstRegNo: '',
  32. surveyRegNo: '',
  33. imo: '',
  34. licenseNo: ''
  35. });
  36. // 表单实例
  37. const searchFormRef = ref<FormInstance>();
  38. // 重置按钮事件
  39. const handleReset = () => {
  40. if (searchFormRef.value) {
  41. searchFormRef.value.resetFields(); // 重置表单
  42. }
  43. };
  44. // 监听抽屉显示状态变化,通知父组件
  45. watch(
  46. () => visible.value,
  47. (newVal) => {
  48. emit('update:visible', newVal);
  49. }
  50. );
  51. // 监听父组件传入的visible变化(同步抽屉状态)
  52. watch(
  53. () => props.visible,
  54. (newVal) => {
  55. visible.value = newVal;
  56. }
  57. );
  58. </script>
  59. <style scoped lang="scss">
  60. .ship-info-drawer {
  61. :deep(.el-drawer__header) {
  62. background-color: #163a8a !important;
  63. margin: 0 !important;
  64. padding: 20px !important;
  65. color: white !important;
  66. }
  67. }
  68. .business-desc {
  69. padding-bottom: 15px;
  70. border-bottom: 1px dashed #e0e0e0;
  71. h4 {
  72. font-weight: 500;
  73. margin-bottom: 5px;
  74. }
  75. }
  76. .search-form {
  77. .el-form-item {
  78. margin-bottom: 15px;
  79. }
  80. }
  81. .demo-drawer__footer {
  82. display: flex; /* 使用flex布局 */
  83. justify-content: center; /* 水平居中 */
  84. gap: 12px; /* 按钮间距(可选,根据需要调整) */
  85. margin-top: 20px; /* 与上方表单的间距(可选) */
  86. }
  87. </style>