import { mapState, mapMutations, mapActions } from 'vuex';
export default {
	computed: {
		...mapState({
			comId: state => state.userInfo.comId,
			userInfo: state => state.userInfo,
			pageData(state) {
				return state.pageData[this.myPrgmId];
			},
			drawer: state => state.drawer,
		}),
		// chkIsFind() {
		//   // 조회 플래그
		//   return this.pageData.isFind;
		// }
	},
	watch: {
		// chkIsFind(val) {
		//   if (val) this.search();
		// }
	},
	beforeCreate() {
		// console.log("mixin beforeCreate");
	},
	created() {
		// console.log("mixin created");
	},
	mounted() {
		// console.log("mixin mounted", this.myPrgmId);
		this.layoutInit();
		//this.init();
	},
	beforeDestroy() {
		// console.log("mixin beforeDestroy");
		this.chkOpenTabList({ key: 'destroy', prgmId: this.myPrgmId });
	},
	methods: {
		...mapMutations({
			setPageData: 'setPageData',
			setGridData: 'setGridData',
			setGridColumn: 'setGridColumn',
			setGridOption: 'setGridOption',
			setChartXAxisData: 'setChartXAxisData',
			setChartSeries: 'setChartSeries',
			setChartLegend: 'setChartLegend',
			setGridSelectData: 'setGridSelectData',
			setChartColorData: 'setChartColorData',
			setPageDataInit: 'setPageDataInit',
		}),
		...mapActions({
			postApi: 'modules/list/postApi',
			postUpdateApi: 'modules/list/postUpdateApi',
			postApiReturn: 'modules/list/postApiReturn',
			setTree: 'modules/list/setTree',
			chkOpenTabList: 'chkOpenTabList',
			getPrgmId: 'getPrgmId',
		}),
		layoutInit() {
			if (this.$refs.searchFilter) {
				const searchFilterHeight = this.$refs.searchFilter.offsetHeight;
				this.$refs.contents.style.height = `calc(100% - ${searchFilterHeight}px)`;
			}
		},
		//init() {}
	},
};
