<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 x-small color="primary" class="mr-1">mdi-record-circle</v-icon>
				{{ label }}
			</label>
		</v-col>
		<v-col :cols="label ? textCols : ''">
			<v-text-field v-model="InputValue" class="v-input__custom"></v-text-field>
		</v-col>
	</v-row>
</template>

<script>
import { mapState, mapMutations } from 'vuex';
export default {
	props: {
		parentPrgmId: {
			type: String,
			require: true,
		},
		diffModel: {
			type: String,
			require: false,
		},
		labelCols: {
			type: Number,
			require: false,
			default: 4,
		},
		textCols: {
			type: Number,
			require: false,
			default: 7,
		},
	},
	data() {
		return {
			label: '그룹코드명',
		};
	},
	computed: {
		...mapState({
			searchParam: state => state.pageData,
			menuData: 'menuData',
		}),
		InputValue: {
			get() {
				if (!this.diffModel) {
					return this.searchParam[this.parentPrgmId].commGrpCdNm;
				} else {
					return this.searchParam[this.parentPrgmId][this.diffModel];
				}
			},
			set(value) {
				if (!this.diffModel) {
					return this.setPageData({ commGrpCdNm: value });
				} else {
					return this.setPageData({ [this.diffModel]: value });
				}
			},
		},
	},
	created() {},
	methods: {
		...mapMutations({ setPageData: 'setPageData' }),
	},
};
</script>

<style></style>
