PublicRange.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <div class="public-range-container">
  3. <!-- 统一使用带标题容器的结构,确保标题对齐 -->
  4. <!-- FC区域 - 支持可插拔控制 -->
  5. <div class="fc-bt-area-form" v-if="showFc">
  6. <div class="section-title">FC</div>
  7. <div class="section-content fc-content">
  8. <el-checkbox-group v-model="modelValue.brandCode">
  9. <el-checkbox
  10. v-for="dict in yamadaFcBrand"
  11. :key="dict.value"
  12. :value="dict.value"
  13. style="margin-right: 60px;"
  14. >
  15. {{ dict.label }}
  16. </el-checkbox>
  17. </el-checkbox-group>
  18. </div>
  19. </div>
  20. <!-- 業種区域 - 原有可插拔控制 -->
  21. <div class="fc-bt-area-form" v-if="showBusinessType">
  22. <div class="section-title">業種</div>
  23. <div class="section-content">
  24. <el-checkbox-group v-model="modelValue.businessTypeCode">
  25. <el-checkbox
  26. v-for="dict in yamadaBusinessType"
  27. :key="dict.value"
  28. :value="dict.value"
  29. style="margin-right: 32px;"
  30. >
  31. {{ dict.label }}
  32. </el-checkbox>
  33. </el-checkbox-group>
  34. </div>
  35. </div>
  36. <!-- エリア区域 - 支持可插拔控制 -->
  37. <div class="fc-bt-area-form" v-if="showArea">
  38. <div class="section-title">エリア</div>
  39. <div class="area-header-row">
  40. <RegionTree
  41. class="region-tree-container"
  42. :treeData="regionTree"
  43. @check-change="handleCheckChange"
  44. />
  45. </div>
  46. </div>
  47. </div>
  48. </template>
  49. <script setup>
  50. import { defineProps, defineEmits, watch } from 'vue';
  51. import RegionTree from './RegionTree.vue';
  52. const props = defineProps({
  53. modelValue: {
  54. type: Object,
  55. required: true,
  56. default: () => ({
  57. brandCode: [],
  58. businessTypeCode: [],
  59. regions: []
  60. })
  61. },
  62. regionTree: {
  63. type: Array,
  64. required: true,
  65. default: () => []
  66. },
  67. yamadaFcBrand: {
  68. type: Array,
  69. required: true,
  70. default: () => []
  71. },
  72. yamadaBusinessType: {
  73. type: Array,
  74. required: true,
  75. default: () => []
  76. },
  77. // 業種显示控制
  78. showBusinessType: {
  79. type: Boolean,
  80. default: false
  81. },
  82. // FC显示控制
  83. showFc: {
  84. type: Boolean,
  85. default: false
  86. },
  87. // エリア显示控制
  88. showArea: {
  89. type: Boolean,
  90. default: true
  91. }
  92. });
  93. const emits = defineEmits([
  94. 'update:modelValue',
  95. 'check-change'
  96. ]);
  97. const handleCheckChange = (regionId, isChecked) => {
  98. emits('check-change', regionId, isChecked);
  99. };
  100. watch(
  101. () => props.modelValue,
  102. (newValue) => {
  103. emits('update:modelValue', newValue);
  104. },
  105. { deep: true }
  106. );
  107. </script>
  108. <style scoped>
  109. .public-range-container {
  110. margin-top: 10px;
  111. }
  112. /* 统一的区块样式,标题和内容横向排列 */
  113. .fc-bt-area-form {
  114. display: flex;
  115. align-items: flex-start; /* 标题和内容顶部对齐 */
  116. margin-top: 5px;
  117. }
  118. /* 标题容器 - 固定宽度确保垂直对齐 */
  119. .section-title {
  120. width: 100px; /* 固定宽度,确保三个标题垂直对齐 */
  121. margin-right: 14px; /* 标题与内容的间距 */
  122. font-size: 14px;
  123. color: #606266;
  124. font-weight: 700;
  125. text-align: left; /* 首字母对齐关键:左对齐 */
  126. padding-top: 4px; /* 与复选框组件基线对齐 */
  127. }
  128. /* 内容区域 - 占剩余宽度 */
  129. .section-content {
  130. flex: 1; /* 内容区域自适应剩余宽度 */
  131. align-items: flex-start;
  132. }
  133. .area-header-row {
  134. flex: 1; /* 内容区域自适应剩余宽度 */
  135. display: flex;
  136. align-items: flex-start;
  137. }
  138. /* 区域树特殊样式调整 */
  139. .region-tree-container {
  140. margin-top: 2px; /* 微调与标题的垂直对齐 */
  141. margin-left: -4px; /* 微调与标题的垂直对齐 */
  142. }
  143. /* 响应式调整 */
  144. @media (max-width: 768px) {
  145. .section-title {
  146. width: 100px !important;/* 移动端标题宽度微调 */
  147. margin-right: 0;
  148. }
  149. }
  150. </style>