<template>
	<div ref="mainDiv" class="l-layout">
		<v-row ref="searchFilter">
			<v-col :cols="12">
				<v-card class="searchFilter">
					<v-row align="end" no-gutters>
						<v-col :cols="3">
							<component :is="'SelectBox'" ref="SelectBox1" :propsValue="selectValue01"
								:itemList="selectValueList01" :label="'설비종류'"
								@update:propsValue="selectValue01 = $event" :customClass="'select-large'"
								:labelCols="12" :iconShow="true" :textCols="12" />
						</v-col>
						<v-col :cols="3">
							<component :is="'SelectBox'" ref="SelectBox2" :propsValue="selectValue02"
								:itemList="selectValueList02" :label="'설비그룹'"
								@update:propsValue="selectValue02 = $event" :customClass="'select-large'"
								:labelCols="12" :iconShow="true" :textCols="12" />
						</v-col>
						<v-col :cols="3">
							<component :is="'SelectBox'" ref="SelectBox3" :propsValue="selectValue03"
								:itemList="selectValueList03" :label="'가이드지표'"
								@update:propsValue="selectValue03 = $event" :customClass="'select-large'"
								:labelCols="12" :iconShow="true" :textCols="12" />
						</v-col>
						<v-col :cols="3" class="text-right">
							<BtnSearch @click="search" size="large" />
						</v-col>
					</v-row>
				</v-card>
			</v-col>
		</v-row>
		<v-row ref="contents" class="mt-3">
			<v-col :cols="12" style="height: 100%">
				<!-- <v-card class="py-5"> -->
				<v-card style="height: 60%">
					<div class="d-flex align-center justify-space-between pa-4">
						<v-card-title class="pa-0 custom-title-4">가이드 정보</v-card-title>
					</div>
					<div class="d-flex align-end justify-space-between px-4 py-2">
						<v-row :cols="12" class="align-end">
							<!-- 가이드 및 설비그룹 라인 시작 -->
							<v-col :cols="3" class="pa-2">
								<InputText :parentPrgmId="myPrgmId" :labelCols="12" :textCols="12" :label="'가이드 ID'"
									:valueNm="'gdIdxId'" :readonly="readonlyFg" :iconShow="true"  />
							</v-col>
							<v-col :cols="3" class="pa-2">
								<InputText :parentPrgmId="myPrgmId" :labelCols="12" :textCols="12" :label="''"
									:valueNm="'gdIdxNm'" :readonly="readonlyFg" :iconShow="true" />
							</v-col>
							<v-col :cols="3" class="pa-2">
								<InputText :parentPrgmId="myPrgmId" :labelCols="12" :textCols="12" :label="'설비그룹'"
									:valueNm="'eqpmGrpNm'" :readonly="readonlyFg" :iconShow="true" />
							</v-col>
							<v-col :cols="3"> </v-col>
							<!-- 가이드 및 설비그룹 라인 끝 -->
							<!-- 물리량 라인 시작 -->
							<v-col :cols="3" class="pa-2">
								<InputText :parentPrgmId="myPrgmId" :labelCols="12" :textCols="12" :label="'물리량1'"
									:valueNm="'pysclQtyCdNm1'" :readonly="readonlyFg" :iconShow="true"  />
							</v-col>
							<v-col :cols="3" class="pa-2">
								<InputText :parentPrgmId="myPrgmId" :labelCols="12" :textCols="12" :label="'물리량2'"
									:valueNm="'pysclQtyCdNm2'" :readonly="readonlyFg" :iconShow="true" />
							</v-col>
							<v-col :cols="3" class="pa-2">
								<InputText :parentPrgmId="myPrgmId" :labelCols="12" :textCols="12" :label="'물리량3'"
									:valueNm="'pysclQtyCdNm3'" :readonly="readonlyFg" :iconShow="true" />
							</v-col>
							<v-col :cols="3" class="pa-2">
								<InputText :parentPrgmId="myPrgmId" :labelCols="12" :textCols="12" :label="'물리량4'"
									:valueNm="'pysclQtyCdNm4'" :readonly="readonlyFg" :iconShow="true" />
							</v-col>
							<!-- 물리량 라인 끝 -->
							<!-- 카테고리 라인 시작 -->
							<v-col :cols="3" class="pa-2">
								<InputText :parentPrgmId="myPrgmId" :labelCols="12" :textCols="12" :label="'카테고리1'"
									:valueNm="'ctgr1'" :readonly="readonlyFg" :iconShow="true" />
							</v-col>
							<v-col :cols="3" class="pa-2">
								<InputText :parentPrgmId="myPrgmId" :labelCols="12" :textCols="12" :label="'카테고리2'"
									:valueNm="'ctgr2'" :readonly="readonlyFg" :iconShow="true" />
							</v-col>
							<v-col :cols="3" class="pa-2">
								<InputText :parentPrgmId="myPrgmId" :labelCols="12" :textCols="12" :label="'주의기준값'"
									:valueNm="'careStndVal'" :readonly="readonlyFg" :iconShow="true" />
							</v-col>
							<v-col :cols="3" class="pa-2">
								<InputText :parentPrgmId="myPrgmId" :labelCols="12" :textCols="12" :label="'경고기준값'"
									:valueNm="'warnStndVal'" :readonly="readonlyFg" :iconShow="true" />
							</v-col>
							<!-- 카테고리 및 기준값 라인 끝 -->
							<!-- 알람메세지 라인 시작 -->
							<v-col :cols="12" class="pa-2">
								<InputText :parentPrgmId="myPrgmId" :labelCols="12" :textCols="12" :label="'알람메세지'"
									:valueNm="'alrmMsg'" :readonly="readonlyFg" :iconShow="true" />
							</v-col>
							<!-- 알람메세지 라인 끝 -->
							<!-- 계산코드 라인 시작 -->
							<v-col :cols="3" class="pa-2">
								<InputText :parentPrgmId="myPrgmId" :labelCols="12" :textCols="12" :label="'계산코드'"
									:valueNm="'calcProc'" :readonly="readonlyFg" :iconShow="true" />
							</v-col>
							<v-col :cols="3"> </v-col>
							<v-col :cols="3"> </v-col>
							<v-col :cols="3"> </v-col>
							<!-- 계산코드 라인 끝 -->
							<!-- 계산설명 라인 시작 -->
							<v-col :cols="12" class="pa-2">
								<InputText :parentPrgmId="myPrgmId" :labelCols="12" :textCols="12" :label="'계산설명'"
									:valueNm="'calcDesc'" :readonly="readonlyFg" :iconShow="true" />
							</v-col>
							<!-- 계산설명 라인 끝 -->
						</v-row>
					</div>

				</v-card>

				<v-row style="height: 40%" class="mt-3">
					<v-col :cols="6" style="height: 100%" class="pr-2">
						<v-card class="pb-5">
							<div class="d-flex align-center justify-space-between pa-4">
								<v-card-title class="pa-0 custom-title-4 ">설비상세 리스트</v-card-title>
								<Buttons :parentPrgmId="myPrgmId" :bindingData="gridName" :btnActionsFnc="btnActions" />
							</div>
							<div class="h100 px-4" style="height:calc(100% - 70px)">
								<div ref="gridParent" class="w100 h100">
									<component :ref="gridName" :is="loadGrid ? 'Grid' : null" :gridName="gridName"
										:parentPrgmId="myPrgmId" @getRowsData="getRowData"
										/>
								</div>
							</div>
						</v-card>
					</v-col>
					<v-col :cols="6" style="height: 100%" class="pl-2">
						<v-card class="pb-5">
							<div class="d-flex align-center justify-space-between pa-4">
								<v-card-title class="pa-0 custom-title-4">설비가이드 기준 정보</v-card-title>
							</div>
							<div class="d-flex align-center justify-space-between pa-4">
								<v-row :cols="12">
								<!-- 가이드 및 설비그룹 라인 시작 -->
									<v-col :cols="12">
										<component :is="'Form'" :parentPrgmId="myPrgmId" :detailList="detailList"
											@gridEditingFinish="gridEditingFinish" />
									</v-col>
								</v-row>
							</div>
							
						</v-card>
					</v-col>
				</v-row>
				<!-- </v-card> -->
			</v-col>
		</v-row>
	</div>
</template>
<script>
import { mapActions } from 'vuex';
import mixinGlobal from '@/mixin/global.js';
import { resize } from '@/mixin/resize.js';
import BtnSearch from '~/components/common/button/BtnSearch';
import Buttons from '~/components/common/button/Buttons';
import SelectBox from '@/components/common/select/SelectBox';
import InputText from '@/components/common/input/InputText';
import Form from '~/components/common/form/Form';
import Grid from '~/components/common/Grid';
import Utility from '~/plugins/utility';

let myTitle;
// const myPrgmId = "PRG0009";
let myPrgmId;
export default {
	mixins: [mixinGlobal, resize],
	async asyncData(context) {
		const myState = context.store.state;
		// console.log('asyncData',context.store)
		// console.log(context.store.$router.currentRoute.fullPath);
		myPrgmId = context.route.query.prgmId;
		// context.store.commit('pageInit', { prgmId: myPrgmId, value: payload.defaultData });
		await context.store.commit('setActiveMenuInfo', myState.menuData[myPrgmId]);
		myTitle = await myState.activeMenuInfo.menuNm;
	},
	meta: {
		title: () => {
			return myTitle;
		},
		prgmId: myPrgmId,
		closable: true,
	},
	components: {
		BtnSearch,
		Buttons,
		InputText,
		Form,
		Grid,
		SelectBox,
	},
	data() {
		return {
			myPrgmId: myPrgmId,
			readonlyFg: true,
			initedFlag: false,
			gridName: 'rowGrid',
			loadGrid: false,
			detailList: myDetail,
			selectValue01: null,
			selectValueList01: [],
			selectValue02: null,
			selectValueList02: [],
			selectValue03: null,
			selectValueList03: [],
			// dataPathExample: {
			// 	"rowGrid": {
			// 		data: [

			// 			{
			// 				eqpmId: 'EQ001',
			// 				originEqpmId: 'ORIG001',
			// 				eqpmNm: '냉각기 A',
			// 				careStndVal: 75,
			// 				warnStndVal: 90,
			// 			},
			// 			{
			// 				eqpmId: 'EQ002',
			// 				originEqpmId: 'ORIG002',
			// 				eqpmNm: '펌프 B',
			// 				careStndVal: 60,
			// 				warnStndVal: 80,
			// 			},
			// 			{
			// 				eqpmId: 'EQ003',
			// 				originEqpmId: 'ORIG003',
			// 				eqpmNm: '모터 C',
			// 				careStndVal: 50,
			// 				warnStndVal: 70,
			// 			},
			// 			{
			// 				eqpmId: 'EQ004',
			// 				originEqpmId: 'ORIG004',
			// 				eqpmNm: '밸브 D',
			// 				careStndVal: 65,
			// 				warnStndVal: 85,
			// 			},
			// 			{
			// 				eqpmId: 'EQ005',
			// 				originEqpmId: 'ORIG005',
			// 				eqpmNm: '컨트롤러 E',
			// 				careStndVal: 55,
			// 				warnStndVal: 75,
			// 			},

			// 		],
			// 		column: [
			// 			{ header: '설비', name: 'eqpmId', align: 'left' },
			// 			{
			// 				header: 'origin설비',
			// 				name: 'originEqpmId',
			// 				align: 'center',
			// 				hidden: true,
			// 			},
			// 			{ header: '설비명', name: 'eqpmNm', align: 'left' },
			// 			{ header: '주의기준', name: 'careStndVal', align: 'right' },
			// 			{ header: '심각기준', name: 'warnStndVal', align: 'right' },
			// 		]

			// 	}
			// }
		};
	},
	computed: {
		// ...mapState({
		//   pageData: state => state.pageData[myPrgmId]
		// }),
		chkIsFind() {
			// 조회 플래그
			return this.pageData.isFind;
		},
	},
	watch: {
		chkIsFind(val) {
			if (val) this.search();
		},
		async selectValue01(val) {
			this.setPageData({ eqpmKindId: val });
			if (this.initedFlag) await this.getEqpmGrp();
			// this.setPageData({ isFind: true });
		},
		async selectValue02(val) {
			this.setPageData({ eqpmGrpId: val });
			if (this.initedFlag) await this.getEqpmGdIdx();
			// this.setPageData({ isFind: true });
		},
		async selectValue03(val) {
			this.setPageData({ eqpmGdIdx: val });
			if (this.initedFlag) this.setPageData({ isFind: true });
		},
	},
	async beforeCreate() {
		myPrgmId = this.$route.query.prgmId;
		await this.$store.dispatch('chkOpenTabList', {
			key: 'create',
			prgmId: myPrgmId,
			defaultData: defaultData,
		});
	},
	created() {
		// 검침 Data 구분 목록 조회
	},
	async mounted() {
		await this.init();
		this.initedFlag = true;
	},
	beforeDestroy() {
		this.chkOpenTabList({ key: 'destroy', prgmId: myPrgmId });
	},
	methods: {
		...mapActions({
			getCodeList: 'modules/search/getCodeList',
			getBlocMstrList: 'modules/search/getBlocMstrList',
			getAddInfoList: 'modules/search/getAddInfoList',
		}),
		async init() {
			await this.getEqpmKind();
			await this.getEqpmGrp();
			await this.getEqpmGdIdx();
			this.gridInit();
		},
		search() {
			this.getGdIdxData();
			this.getGridData();
			this.setPageData({
				isFind: false,
			});
		},
		async getEqpmKind() {
			let res = await this.postApiReturn({
				apiKey: 'selectEqpmKindCodeList',
				resKey: 'eqpmKindCodeLists',
				sendParam: {},
			});
			if (res.length > 0) {
				this.selectValueList01 = await res.map(item => {
					return {
						text: item.eqpmKindNm,
						value: item.eqpmKindId,
					};
				});
				this.selectValue01 = this.selectValueList01[0].value;
			} else {
				this.selectValueList01 = [];
				this.selectValue01 = null;
			}
			this.setPageData({
				eqpmKindList: this.selectValueList01,
				eqpmKindId: this.selectValue01,
			});
		},
		async getEqpmGrp() {
			let res = await this.postApiReturn({
				apiKey: 'selectEqpmGrpCodeList',
				resKey: 'eqpmGrpCodeLists',
				sendParam: { eqpmKindId: this.selectValue01 },
			});
			if (res.length > 0) {
				this.selectValueList02 = await res.map(item => {
					return {
						text: item.eqpmGrpNm,
						value: item.eqpmGrpId,
					};
				});
				this.selectValue02 = this.selectValueList02[0].value;
			} else {
				this.selectValueList02 = [];
				this.selectValue02 = null;
			}
			this.setPageData({
				eqpmGrpList: this.selectValueList02,
				eqpmGrpId: this.selectValue02,
			});
		},
		async getEqpmGdIdx() {
			let res = await this.postApiReturn({
				apiKey: 'selectEqpmGdIdxCodeList',
				resKey: 'eqpmGdIdxCodeLists',
				sendParam: { eqpmGrpId: this.selectValue02 },
			});
			if (res.length > 0) {
				this.selectValueList03 = await res.map(item => {
					return {
						text: item.gdIdxId + ': ' + item.gdIdxNm,
						value: item.gdIdxId,
					};
				});
				this.selectValue03 = this.selectValueList03[0].value;
			} else {
				this.selectValueList03 = [];
				this.selectValue03 = null;
			}
			this.setPageData({
				eqpmGdIdxList: this.selectValueList03,
				eqpmGdIdx: this.selectValue03,
			});
		},
		gridInit() {
			const gridHeight = this.$refs.gridParent.offsetHeight - 30;

			const myOptions = {
				columnOptions: {
					resizable: true,
				},
				header: {
					height: 37,
				},
				rowHeight: 'auto',
			};
			this.setGridOption({
				gridKey: this.gridName,
				value: Object.assign(Utility.defaultGridOption(gridHeight), myOptions),
			});

			const _this = this;
			const myColumns = [
				// { header: '가이드ID', name: 'gdIdxId', align: 'center', hidden: true},
				{ header: '설비', name: 'eqpmId', align: 'left' },
				{
					header: 'origin설비',
					name: 'originEqpmId',
					align: 'center',
					hidden: true,
				},
				{ header: '설비명', name: 'eqpmNm', align: 'left' },
				{ header: '주의기준', name: 'careStndVal', align: 'right' },
				{ header: '심각기준', name: 'warnStndVal', align: 'right' },
			];

			this.setGridColumn({
				gridKey: this.gridName,
				value: myColumns,
			});

			this.loadGrid = true;

			this.search();
		},
		async getGdIdxData() {
			let res = [];
			if (this.selectValue01 && this.selectValue02 && this.selectValue03) {
				res = await this.postApiReturn({
					apiKey: 'selectEqpmGdIdxData',
					resKey: 'eqpmGdIdxData',
					sendParam: {
						eqpmGrpId: this.selectValue02,
						gdIdxId: this.selectValue03,
					},
				});
			} else {
				if (this.initedFlag) {
					alert('조회 조건을 확인해 주세요.');
				}
			}
			this.setGuideInfo(res);
		},
		setGuideInfo(res) {
			if (res.length == 0) {
				this.setPageData({
					gdIdxId: '',
					gdIdxNm: '',
					eqpmGrpNm: '',
					upTotMeth: '',
					unit: '',
					pysclQtyCdNm1: '',
					pysclQtyCdNm2: '',
					pysclQtyCdNm3: '',
					pysclQtyCdNm4: '',
					pysclQtyId1: '',
					pysclQtyId2: '',
					pysclQtyId3: '',
					pysclQtyId4: '',
					ctgr1: '',
					ctgr2: '',
					careStndVal: '',
					warnStndVal: '',
					gdMeth: '',
					alrmMsg: '',
					calcProc: '',
					calcDesc: '',
				});
			} else {
				this.setPageData({
					gdIdxId: res[0].gdIdxId,
					gdIdxNm: res[0].gdIdxNm,
					eqpmGrpNm: res[0].eqpmGrpNm,
					upTotMeth: res[0].upTotMeth,
					unit: res[0].unit,
					pysclQtyCdNm1: res[0].pysclQtyCdNm1,
					pysclQtyCdNm2: res[0].pysclQtyCdNm2,
					pysclQtyCdNm3: res[0].pysclQtyCdNm3,
					pysclQtyCdNm4: res[0].pysclQtyCdNm4,
					pysclQtyId1: res[0].pysclQtyId1,
					pysclQtyId2: res[0].pysclQtyId2,
					pysclQtyId3: res[0].pysclQtyId3,
					pysclQtyId4: res[0].pysclQtyId4,
					ctgr1: res[0].ctgr1,
					ctgr2: res[0].ctgr2,
					careStndVal: res[0].careStndVal,
					warnStndVal: res[0].warnStndVal,
					gdMeth: res[0].geMeth,
					alrmMsg: res[0].alrmMsg,
					calcProc: res[0].calcProc,
					calcDesc: res[0].calcDesc,
				});
			}
		},
		async getGridData() {
			this.loadGrid = false;
			let res = [];

			if (this.selectValue01 && this.selectValue02 && this.selectValue03) {
				res = await this.postApiReturn({
					apiKey: 'selectEqpmGdDetl',
					resKey: 'eqpmGdDetlData',
					sendParam: {
						gdIdxId: this.selectValue03,
					},
				});
			}

			// grid에서 eqpmId를 기억해서 popup에서 중복되는 값을 제거하는데 사용하기위해 저장 - 시작
			let eqpmIdList = res.map(item => {
				return item.eqpmId;
			});
			this.setPageData({ nowGridEqpmIdList: eqpmIdList });
			// grid에서 eqpmId를 기억해서 popup에서 중복되는 값을 제거하는데 사용하기위해 저장 - 끝
			const newRes = res.map(item => {
				const newObj = {
					...item,
					rowStat: null,
				};
				return newObj;
			});
			// const newRes = [


			// 	{
			// 		eqpmId: 'EQ001',
			// 		originEqpmId: 'ORIG001',
			// 		eqpmNm: '냉각기 A',
			// 		careStndVal: 75,
			// 		warnStndVal: 90,
			// 	},
			// 	{
			// 		eqpmId: 'EQ002',
			// 		originEqpmId: 'ORIG002',
			// 		eqpmNm: '펌프 B',
			// 		careStndVal: 60,
			// 		warnStndVal: 80,
			// 	},
			// 	{
			// 		eqpmId: 'EQ003',
			// 		originEqpmId: 'ORIG003',
			// 		eqpmNm: '모터 C',
			// 		careStndVal: 50,
			// 		warnStndVal: 70,
			// 	},
			// 	{
			// 		eqpmId: 'EQ004',
			// 		originEqpmId: 'ORIG004',
			// 		eqpmNm: '밸브 D',
			// 		careStndVal: 65,
			// 		warnStndVal: 85,
			// 	},
			// 	{
			// 		eqpmId: 'EQ005',
			// 		originEqpmId: 'ORIG005',
			// 		eqpmNm: '컨트롤러 E',
			// 		careStndVal: 55,
			// 		warnStndVal: 75,
			// 	},

			// ]
			this.setGridData({
				gridKey: this.gridName,
				value: newRes,
			});
			this.loadGrid = true;
			this.$nextTick(() => {
				if (newRes.length > 0) {
					try {
						this.$refs[this.gridName].focus({
							//rowKey: 0,
							rowKey:
								this.pageData.rowGridSelectKey == '' ||
									this.pageData.rowGridSelectKey == null
									? 0
									: this.pageData.rowGridSelectKey ==
										this.$refs[this.gridName].getData().length - 1
										? this.pageData.rowGridSelectKey
										: 0,
							columnNmae: 'eqpmId',
							setScroll: true,
						});
					} catch (error) { }
				} else {
					this.detailDataInit();
				}
			});
		},
		async getRowData(data) {
			// this.setReadObjAddInfo(data);
			this.setPageData({
				rowGridSelectKey: data.rowKey,
				rowGridSelectData: data,
			});
		},
		gridEditingFinish(data) {
			this.$refs[this.gridName].editingFinish(data);
		},
		detailDataInit() {
			this.setPageData({
				rowGridSelectKey: null,
				rowGridSelectData: [],
			});
			this.setGridData({
				gridKey: 'rowGrid',
				value: [],
			});
		},
		async btnActions(action) {
			let dataArr = [];
			switch (action) {
				case 'add':
					if (this.pageData.eqpmGdIdx == null) {
						alert(
							'조회된 가이드 정보가 없습니다.\n설비그룹의 가이드 지표를 먼저 추가해 주세요',
						);
						break;
					}
					// console.log("this.pageData : ", this.pageData.readObjGrp);
					const defaultRow = {
						gdIdxId: this.pageData.eqpmGdIdx,
						eqpmId: '',
						eqpmNm: '',
						careStndVal: null,
						warnStndVal: null,
						rowStat: 'I',
					};
					this.$refs[this.gridName].addRow(defaultRow);
					break;

				case 'remove':
					//if (confirm('삭제 하시겠습니까?')) {
					this.$refs[this.gridName].removeRow();
					this.setPageData({ rowGridSelectData: null });
					//}
					break;

				case 'save':
					dataArr = this.$refs[this.gridName].save();
					var validCheck = true;
					let chkEqpmIdList = [];

					if (dataArr.length > 0) {
						dataArr.filter(item => {
							// 미입력시 0으로 입력 되는 거 방지
							if (item.careStndVal == '') {
								item.careStndVal = null;
							}
							if (item.warnStndVal == '') {
								item.warnStndVal = null;
							}
							if (item.eqpmId == '') {
								item.eqpmId = null;
							}
							if (item.rowStat === 'I') {
								if (
									item.eqpmId == null ||
									item.eqpmId == '' ||
									((item.careStndVal == null || item.careStndVal == '') &&
										(item.warnStndVal == null || item.warnStndVal == ''))
								) {
									alert('필수 입력값을 입력해주세요.');
									validCheck = false;
								}
								if (chkEqpmIdList.includes(item.eqpmId)) {
									alert('특정 가이드지표에 대한 설비는 중복될 수 없습니다.');
									validCheck = false;
								} else {
									chkEqpmIdList.push(item.eqpmId);
								}
							} else if (item.rowStat === 'U') {
								if (
									item.eqpmId == null ||
									item.eqpmId == '' ||
									((item.careStndVal == null || item.careStndVal == '') &&
										(item.warnStndVal == null || item.warnStndVal == ''))
								) {
									alert('필수 입력값을 입력해주세요.');
									validCheck = false;
								}
							}
						});
						if (validCheck) {
							const sendParam = {
								datas: {
									dsEqpmGdDetlInfo: dataArr.map(item => ({
										...item,
									})),
								},
								params: {},
							};
							await this.postUpdateApi({
								apiKey: 'saveEqpmGdDetl',
								sendParam: sendParam,
							});

							this.$nextTick(() => {
								this.setPageData({ isFind: true });
							});
						}
					} else {
						alert('저장할 내용이 없습니다.');
					}
					break;

				default:
					break;
			}
		},
		// click2(val){
		// 	console.log('wpfkqfdfafasd', val);
		// }
	},
};

const defaultData = {
	/* 검색옵션 */
	eqpmKindList: [],
	eqpmKindId: '',
	eqpmGrpList: [],
	eqpmGrpId: '',
	eqpmGdIdxList: [],
	eqpmGdIdx: '',

	// 가이드 정보
	gdIdxId: '',
	gdIdxNm: '',
	eqpmGrpNm: '',
	upTotMeth: '',
	unit: '',
	pysclQtyCdNm1: '',
	pysclQtyCdNm2: '',
	pysclQtyCdNm3: '',
	pysclQtyCdNm4: '',
	pysclQtyId1: '',
	pysclQtyId2: '',
	pysclQtyId3: '',
	pysclQtyId4: '',
	ctgr1: '',
	ctgr2: '',
	careStndVal: '',
	warnStndVal: '',
	gdMeth: '',
	alrmMsg: '',
	calcProc: '',
	calcDesc: '',

	// Popup과 설비가이드 기준 정보(grid) databinding에 사용 될 변수
	eqpmId: '',
	eqpmNm: '',
	nowGridEqpmIdList: [],

	// 선택된 그룹코드 상세 데이터
	rowGridSelectKey: 0,
	rowGridSelectData: null,

	isFind: false, // true 경우 조회, 조회버튼도 이 값으로 연동 예정
	/* data 세팅 */
	// 로컬 gridName 값과 동일한 이름으로 세팅
	rowGrid: {
		data: [],
		column: [], // myColumns,
		option: {}, // myOptions
		defaultRow: {
			gdIdxId: '',
			eqpmId: '',
			eqpmNm: '',
			careStndVal: null,
			warnStndVal: null,
			rowStat: null,
		},
		buttonAuth: {
			add: true,
			remove: true,
			save: true,
			excel: false,
		},
	},
};
const myDetail = [
	{
		type: 'EqpmBaseInfoPop',
		label: '설비',
		valueNm: 'eqpmId',
		valueNm2: 'eqpmNm',
		cols: 6,
		class: 'py-2 pb-3 pr-2',
		required: true,
		openMode: 'GRP',
		labelCols: 12,
		textCols: 12,
		iconShow: true
	},
	{
		type: 'InputText',
		label: '검침 대상 명',
		valueNm: 'eqpmNm',
		readonly: true,
		// disabled: true,
		cols: 6,
		class: 'py-2 pl-2',
		required: true,
		labelCols: 12,
		textCols: 12,
		iconShow: true
	},
	{
		type: 'InputText',
		label: '주의기준값',
		valueNm: 'careStndVal',
		disabled: false,
		cols: 6,
		class: 'py-3 pr-3',
		inputType: 'number',
		required: true,
		labelCols: 12,
		textCols: 12,
		iconShow: true
	},
	{
		// 공백 처리
		type: 'Label',
		cols: 6,
		class: 'py-3',
		disabled: false,
	},
	{
		type: 'InputText',
		label: '경고기준값',
		valueNm: 'warnStndVal',
		disabled: false,
		cols: 6,
		class: 'py-3 pr-3',
		inputType: 'number',
		required: true,
		labelCols: 12,
		textCols: 12,
		iconShow: true
	},
	{
		// 공백 처리
		type: 'Label',
		cols: 6,
		class: 'py-3',
		disabled: false,
	},
	{
		// 공백 처리
		type: 'Label',
		cols: 12,
		class: 'py-3',
		label: "* '주의기준값' 또는 '경고기준값' 중 하나는 필수로 입력해 주세요.",
		disabled: false,
	},
];
</script>
