Files
sk_fems_ui/components/common/select/SelectBlocMstr.vue
Tran Van Dung/(Tran Van Dung)/현장대리인/SK bf6d03df63 fixbugs grid
2025-08-05 17:28:12 +07:00

116 lines
2.3 KiB
Vue

<template>
<v-row class="search-box" align="center" no-gutters>
<v-col v-if="label" :cols="labelCols">
<label for="" class="search-box-label">
<v-icon v-if="iconShow" small :class="['mr-1', required ? 'icon-orange' : 'icon-blue']">$icoBulletPoint</v-icon>
{{ label }}
</label>
</v-col>
<v-col :cols="label ? textCols : ''">
<v-select v-model="selectValue" :items="searchParam[parentPrgmId].blocMstrList"
item-text="blocNm" item-value="idx" append-icon="" outlined
:hide-details="true" :class="['v-select__custom', customClass]"
:menu-props="{ top: false, offsetY: true }"
>
<template v-slot:append><v-icon>$icoChevronDown</v-icon></template>
</v-select>
</v-col>
</v-row>
</template>
<script>
import { mapState, mapMutations, mapActions } from 'vuex';
export default {
props: {
parentPrgmId: {
type: String,
require: true,
},
dataKey: {
type: String,
require: false,
},
sendParam: {
type: Object,
require: false,
default: () => {
return {};
},
},
addAll: {
type: Boolean,
require: false,
default: false,
},
textCols: {
type: Number,
require: false,
default: 8,
},
labelCols: {
type: Number,
require: false,
default: 4,
},
required: {
type: Boolean,
require: false,
default: false
},
iconShow: {
type: Boolean,
require: false,
default: true,
},
customClass: {
type: String,
require: false,
default: null,
}
},
data() {
return {
label: '사업장',
labelPrepend: true,
};
},
computed: {
...mapState({
searchParam: state => state.pageData,
menuData: 'menuData',
}),
selectValue: {
get() {
if (!this.dataKey) {
return this.searchParam[this.parentPrgmId].blocId;
} else {
return this.searchParam[this.parentPrgmId][this.dataKey];
}
},
set(value) {
if (!this.dataKey) {
return this.setPageData({ blocId: value });
} else {
return this.setPageData({ [this.dataKey]: value });
}
},
},
},
created() {
this.getBlocMstrList({
dataKey: this.dataKey,
params: this.sendParam,
addAll: this.addAll,
});
},
methods: {
...mapMutations({ setPageData: 'setPageData' }),
...mapActions({
getBlocMstrList: 'modules/search/getBlocMstrList',
}),
},
};
</script>
<style></style>