Files
sk_fems_ui/components/common/select/selectCodeList.vue
2025-07-28 16:12:24 +07:00

146 lines
2.8 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][dataKey + 'List']" item-text="commCdNm"
item-value="commCd" outlined :hide-details="true" append-icon=""
:class="['v-select__custom', customClass]">
<template v-slot:append>
<v-icon>$icoChevronDown</v-icon>
</template>
</v-select>
<!-- @change="updateBlocCode($event)" -->
</v-col>
</v-row>
</template>
<script>
import { mapState, mapMutations, mapActions } from 'vuex';
export default {
props: {
parentPrgmId: {
type: String,
require: true,
},
dataKey: {
type: String,
require: true,
},
autoLoad: {
type: Boolean,
require: false,
default: true,
},
label: {
type: String,
require: false,
default: null,
},
sendParam: {
type: Object,
require: false,
default: () => {
return {};
},
},
addAll: {
type: Boolean,
require: false,
default: false,
},
textCols: {
type: Number,
require: false,
default: 12,
},
labelCols: {
type: Number,
require: false,
default: 12,
},
mttGrpCd: {
type: Boolean,
require: false,
default: false,
},
customClass: {
type: String,
require: false,
default: null,
},
required: {
type: Boolean,
require: false,
default: false
},
iconShow: {
type: Boolean,
require: false,
default: true
},
},
data() {
return {
// label: "검침대상유형",
// labelPrepend: true
};
},
computed: {
...mapState({
searchParam: state => state.pageData,
}),
selectValue: {
get() {
return this.searchParam[this.parentPrgmId][this.dataKey];
},
set(value) {
if (this.mttGrpCd) {
var userDefVal1 = '';
for (
var i = 0;
i < this.searchParam[this.parentPrgmId].commCdList.length;
i++
) {
if (
this.searchParam[this.parentPrgmId].commCdList[i].commCd == value
) {
userDefVal1 = this.searchParam[this.parentPrgmId].commCdList[i]
.userDefVal1;
}
}
return this.setPageData({
[this.dataKey]: value,
userDefVal1: userDefVal1,
});
} else {
return this.setPageData({ [this.dataKey]: value });
}
},
},
},
created() {
if (this.autoLoad)
this.getCodeList({
dataKey: this.dataKey,
params: this.sendParam,
addAll: this.addAll,
});
},
methods: {
...mapMutations({ setPageData: 'setPageData' }),
...mapActions({
getCodeList: 'modules/search/getCodeList',
}),
},
};
</script>
<style></style>