| | |
| | | <template> |
| | | <el-select |
| | | class="w-32" |
| | | :style="{width:selectWidth}" |
| | | :style="{ width: selectWidth }" |
| | | v-model="selectValue" |
| | | @change="changeValue" |
| | | :disabled="disabled" |
| | | :placeholder="data.title" |
| | | > |
| | | <el-option v-for="item in data.list" :key="item.value" :value="item.value" :label="item.title"></el-option> |
| | | <el-option v-for="item in selectList" :key="item.value" :value="item.value" :label="item.title"></el-option> |
| | | </el-select> |
| | | </template> |
| | | |
| | |
| | | import { ref, type PropType, computed } from 'vue'; |
| | | import { getTextWidth } from '/@/utils/util'; |
| | | import { StepParam } from '../types'; |
| | | import { DAY_STEP_LIST, HOUR_STEP_LIST, IS_DAY_LIST } from './constants'; |
| | | |
| | | const props = defineProps({ |
| | | data: { |
| | |
| | | }, |
| | | }); |
| | | |
| | | const getSelectList = (defaultStepValue: string) => { |
| | | if (IS_DAY_LIST.includes(defaultStepValue)) { |
| | | return DAY_STEP_LIST; |
| | | } else { |
| | | return HOUR_STEP_LIST; |
| | | } |
| | | }; |
| | | |
| | | const selectList = getSelectList(props.data.origin.step_value); |
| | | |
| | | const emit = defineEmits(['change']); |
| | | const SELECT_OFFSET = 47; |
| | | const selectWidth = computed(() => { |