| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- <template>
- <div class="public-range-container">
- <!-- 统一使用带标题容器的结构,确保标题对齐 -->
- <!-- FC区域 - 支持可插拔控制 -->
- <div class="fc-bt-area-form" v-if="showFc">
- <div class="section-title">FC</div>
- <div class="section-content fc-content">
- <el-checkbox-group v-model="modelValue.brandCode">
- <el-checkbox
- v-for="dict in yamadaFcBrand"
- :key="dict.value"
- :value="dict.value"
- style="margin-right: 60px;"
- >
- {{ dict.label }}
- </el-checkbox>
- </el-checkbox-group>
- </div>
- </div>
- <!-- 業種区域 - 原有可插拔控制 -->
- <div class="fc-bt-area-form" v-if="showBusinessType">
- <div class="section-title">業種</div>
- <div class="section-content">
- <el-checkbox-group v-model="modelValue.businessTypeCode">
- <el-checkbox
- v-for="dict in yamadaBusinessType"
- :key="dict.value"
- :value="dict.value"
- style="margin-right: 32px;"
- >
- {{ dict.label }}
- </el-checkbox>
- </el-checkbox-group>
- </div>
- </div>
- <!-- エリア区域 - 支持可插拔控制 -->
- <div class="fc-bt-area-form" v-if="showArea">
- <div class="section-title">エリア</div>
- <div class="area-header-row">
- <RegionTree
- class="region-tree-container"
- :treeData="regionTree"
- @check-change="handleCheckChange"
- />
- </div>
- </div>
- </div>
- </template>
- <script setup>
- import { defineProps, defineEmits, watch } from 'vue';
- import RegionTree from './RegionTree.vue';
- const props = defineProps({
- modelValue: {
- type: Object,
- required: true,
- default: () => ({
- brandCode: [],
- businessTypeCode: [],
- regions: []
- })
- },
- regionTree: {
- type: Array,
- required: true,
- default: () => []
- },
- yamadaFcBrand: {
- type: Array,
- required: true,
- default: () => []
- },
- yamadaBusinessType: {
- type: Array,
- required: true,
- default: () => []
- },
- // 業種显示控制
- showBusinessType: {
- type: Boolean,
- default: false
- },
- // FC显示控制
- showFc: {
- type: Boolean,
- default: false
- },
- // エリア显示控制
- showArea: {
- type: Boolean,
- default: true
- }
- });
- const emits = defineEmits([
- 'update:modelValue',
- 'check-change'
- ]);
- const handleCheckChange = (regionId, isChecked) => {
- emits('check-change', regionId, isChecked);
- };
- watch(
- () => props.modelValue,
- (newValue) => {
- emits('update:modelValue', newValue);
- },
- { deep: true }
- );
- </script>
- <style scoped>
- .public-range-container {
- margin-top: 10px;
- }
- /* 统一的区块样式,标题和内容横向排列 */
- .fc-bt-area-form {
- display: flex;
- align-items: flex-start; /* 标题和内容顶部对齐 */
- margin-top: 5px;
- }
- /* 标题容器 - 固定宽度确保垂直对齐 */
- .section-title {
- width: 100px; /* 固定宽度,确保三个标题垂直对齐 */
- margin-right: 14px; /* 标题与内容的间距 */
- font-size: 14px;
- color: #606266;
- font-weight: 700;
- text-align: left; /* 首字母对齐关键:左对齐 */
- padding-top: 4px; /* 与复选框组件基线对齐 */
- }
- /* 内容区域 - 占剩余宽度 */
- .section-content {
- flex: 1; /* 内容区域自适应剩余宽度 */
- align-items: flex-start;
- }
- .area-header-row {
- flex: 1; /* 内容区域自适应剩余宽度 */
- display: flex;
- align-items: flex-start;
- }
- /* 区域树特殊样式调整 */
- .region-tree-container {
- margin-top: 2px; /* 微调与标题的垂直对齐 */
- margin-left: -4px; /* 微调与标题的垂直对齐 */
- }
- /* 响应式调整 */
- @media (max-width: 768px) {
- .section-title {
- width: 100px !important;/* 移动端标题宽度微调 */
- margin-right: 0;
- }
- }
- </style>
|