Files
sk_fems_ui/components/common/select/SelectBlocMstr.vue
2025-07-22 09:58:38 +07:00

121 lines
2.3 KiB
Vue
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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" label="사업장을 선택하세요"
item-text="blocNm" item-value="idx" append-icon="" class="v-select__custom" outlined
:hide-details="true" :class="['v-select__custom', customClass]">
<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>