<template>
	<div class="l-layout">
		<v-row ref="searchFilter">
			<v-col :cols="12">
				<v-card class="searchFilter">
					<v-row align="end" no-gutters>
						<v-col :cols="2.5">
							<!-- 사업장 -->
							<component :is="'SelectBlocMstr'" ref="SelectBlocMstr" :parentPrgmId="myPrgmId" 
								:labelCols="12"
								:textCols="12" 
								customClass="select-large" 
								/>
						</v-col>
						<v-col :cols="2.5">
							<component :is="'selectCodeList'" :parentPrgmId="myPrgmId" :label="'설비 유형'" dataKey="searchEqpmKind"
								:sendParam="{ commGrpCd: 'CM_EQKIND', useFg: '1' }" :addAll="true" 
								customClass="select-large" />
						</v-col>
						<v-col :cols="2.5">
							<component :is="'SelectEqpmGrp'" :parentPrgmId="myPrgmId" :label="'설비 그룹'" dataKey="searchEqpmGrp"
								:sendParam="{ useFg: '1', test: 'dfadfadf' }" :addAll="true" :labelCols="12" :textCols="12"
								customClass="select-large"
								 />
						</v-col>
						<v-col :cols="2.5">
							<InputText :parentPrgmId="myPrgmId" label="설비명" valueNm="eqpmNm" :searchOption="true" :labelCols="12"
								:textCols="12"
								customClass="input-large" />
						</v-col>
						<BtnSearch @click="search" size="large" />
					</v-row>
				</v-card>
			</v-col>
		</v-row>
		<v-row ref="contents">
			<v-col :cols="5" class="h100">
				<v-card class="pb-5">
					<div class="d-flex align-center justify-space-between pa-5">
						<v-card-title class="pa-0 custom-title-4">설비 정보</v-card-title>
						<Buttons :parentPrgmId="myPrgmId" :bindingData="gridName" :detailList="detailList"
							:btnActionsFnc="btnActions" />
					</div>
					<div class="px-5" style="min-height:calc(100% - 76px)">
						<div ref="gridParent" class="w100 h100">
							<component :ref="gridName" :is="loadGrid ? 'Grid' : null" :gridName="gridName" :parentPrgmId="myPrgmId"
								@getRowsData="getRowData" @sendSelectedRowStatInfo="getSelectedRowStatInfo"
								:selectedRowDataWatchFlag="true" :preventFocusChangeEventFlag="false" :dataPath="dataPathMock" />
						</div>
					</div>
				</v-card>
			</v-col>
			<v-col :cols="7" class="h100">
				<v-card class="pb-5">
					<v-card-title class="custom-title-4" style="min-height:76px;">설비 상세</v-card-title>
					<div class="px-5" style="min-height:calc(100% - 76px)">
						<v-tabs v-model="tab">
							<v-tab v-for="item in items" :key="item.id" :disabled="item.disabledFlag">
								{{ item.name }}
							</v-tab>
						</v-tabs>
						<v-tabs-items v-model="tab" style="min-height: calc(100% - 65px);" class="py-6">
							<v-tab-item v-for="(item, idx) in items" :key="item.id">
								<component v-if="item.id == 'eqpmBaseInfoTab'" :is="'Form'" :parentPrgmId="myPrgmId"
									:detailList="detailList" @gridEditingFinish="gridEditingFinish" />
								<EqpmAddInfoTab v-if="item.id == 'eqpmAddInfoTab'" :parentPrgmId="myPrgmId"
									:innerTabGridInfo="{ tab, idx }" />
								<EqpmIaoTab v-if="item.id == 'eqpmIaoTab'" :parentPrgmId="myPrgmId" :innerTabGridInfo="{ tab, idx }" />
								<EqpmConstTab v-if="item.id == 'eqpmConstTab'" :parentPrgmId="myPrgmId"
									:innerTabGridInfo="{ tab, idx }" />
							</v-tab-item>
						</v-tabs-items>
					</div>
				</v-card>
			</v-col>
		</v-row>
	</div>
</template>
<script>
import { mapState, mapMutations, 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 SelectBlocMstr from '@/components/common/select/SelectBlocMstr';
import selectCodeList from '@/components/common/select/selectCodeList';
import SelectEqpmGrp from '@/components/common/select/SelectEqpmGrp';
import InputText from '@/components/common/input/InputText';
import EqpmAddInfoTab from '@/components/pages/ems/EqpmInfo/EqpmAddInfoTab';
import EqpmIaoTab from '@/components/pages/ems/EqpmInfo/EqpmIaoTab';
import EqpmConstTab from '@/components/pages/ems/EqpmInfo/EqpmConstTab';
import Form from '~/components/common/form/Form';
import Grid from '~/components/common/Grid';
import Utility from '~/plugins/utility';

let myTitle;
// const myPrgmId = "PRG0014";
let myPrgmId;
export default {
	mixins: [mixinGlobal, resize],
	async asyncData(context) {
		const myState = context.store.state;
		// context.store.commit("setActiveMenuInfo", myState.menuData[myPrgmId]);
		// myTitle = myState.activeMenuInfo.menuNm;
		myPrgmId = context.route.query.prgmId;
		await context.store.commit('setActiveMenuInfo', myState.menuData[myPrgmId]);
		myTitle = await myState.activeMenuInfo.menuNm;
	},
	meta: {
		title: () => {
			return myTitle;
		},
		prgmId: myPrgmId,
		closable: true,
	},
	components: {
		BtnSearch,
		Buttons,
		SelectBlocMstr,
		selectCodeList,
		SelectEqpmGrp,
		InputText,
		Form,
		EqpmAddInfoTab,
		EqpmIaoTab,
		EqpmConstTab,
		Grid,
	},
	data() {
		return {
			myPrgmId: myPrgmId,
			gridName: 'rowGrid',
			loadGrid: false,
			tab: null,
			items: [
				{ name: '설비 상세 정보', id: 'eqpmBaseInfoTab', disabledFlag: false },
				{ name: '설비 추가 정보', id: 'eqpmAddInfoTab', disabledFlag: false },
				{ name: '설비 입출력 정보', id: 'eqpmIaoTab', disabledFlag: false },
				{ name: '설비 상수 정보', id: 'eqpmConstTab', disabledFlag: false },
			],
			detailList: myDetail,
			lastInsertEqpmId: null,
			dataPathMock: {
				'rowGrid': {
					column: [
						{ header: '설비 ID', name: 'id', headerAlign: 'left' },
						{ header: '설비 명', name: 'lable', headerAlign: 'left' },
						{ header: '설비 유형', name: 'type', headerAlign: 'left' },
						{ header: '설비 그룹ㅅ', name: 'note', headerAlign: 'left' },
						{ header: '사용 여부', name: 'field1', headerAlign: 'left' },
						// { header: '분배율', name: 'field2', headerAlign: 'left' }
					],
					data: dataPathDataExample,
					defaultRow: dataPathDataExample,
					option: { 
						// rowHeaders: ['checkbox']
					},
					
				}
			},
		};
	},
	computed: {
		chkIsFind() {
			// 조회 플래그
			return this.pageData.isFind;
		},
		chkBlocCd() {
			return this.pageData.blocId;
		},
		chkEqpmKind() {
			// 시스템구분 선택 감지
			return this.pageData.searchEqpmKind;
		},
		chkEqpmGrp() {
			// 시스템구분 선택 감지
			return this.pageData.searchEqpmGrp;
		},
	},
	watch: {
		chkIsFind(val) {
			if (val) this.search();
		},
		chkBlocCd() {
			this.setPageData({ isFind: true });
		},
		chkEqpmKind() {
			this.setPageData({ isFind: true });
		},
		chkEqpmGrp() {
			this.setPageData({ isFind: true });
		},
	},
	async beforeCreate() {
		myPrgmId = this.$route.query.prgmId;
		await this.$store.dispatch('chkOpenTabList', {
			key: 'create',
			prgmId: myPrgmId,
			defaultData: defaultData,
		});
	},
	created() {
		//
		this.getBlocMstrList({
			dataKey: 'blocId',
			params: { useFg: '1' },
			addAll: false,
		});

		// 사용여부
		this.getCodeList({
			dataKey: 'useFg',
			params: { commGrpCd: 'CO_USEFG', useFg: '1' },
			addAll: false,
		});

		// 설비 구분 목록 조회
		this.getCodeList({
			dataKey: 'eqpmKind',
			params: { commGrpCd: 'CM_EQKIND', useFg: '1' },
			addAll: false,
		});
		// 설비 그룹 목록 조회
		this.getEqpmGrpList({
			dataKey: 'eqpmGrp',
			params: { comId: this.userInfo.comCd, useFg: '1', test: 'List 조회' },
			addAll: false,
		});

		/////////// 추가 정보 Tab 에서 사용
		// 데이터 유형 목록 조회
		this.getCodeList({
			dataKey: 'addInfoDataKind',
			params: { commGrpCd: 'CO_DATA_TYPE', useFg: '1' },
			addAll: false,
		});

		// 추가 정보 목록 조회
		this.getAddInfoList({
			dataKey: 'addInfo',
			params: { addGrpId: 'EQPM_INFO', useFg: '1' },
			addAll: false,
		});

		this.getCodeList({
			dataKey: 'emMapDiv',
			params: { commGrpCd: 'EM_MAP_DIV', useFg: 1 },
			addAll: false,
		});

		this.setPageData({
			emMapDivList2: [{ commCd: 'CONST', commCdNm: '상수' }],
		});

		this.getCodeList({
			dataKey: 'cmInout',
			params: { commGrpCd: 'CM_INOUT', useFg: 1 },
			addAll: false,
			addBlank: true,
		});

		this.search();
	},
	mounted() {
		this.init();
	},
	beforeDestroy() {
		this.chkOpenTabList({ key: 'destroy', prgmId: myPrgmId });
	},
	methods: {
		...mapActions({
			getCodeList: 'modules/search/getCodeList',
			getBlocMstrList: 'modules/search/getBlocMstrList',
			getEqpmGrpList: 'modules/search/getEqpmGrpList',
			getAddInfoList: 'modules/search/getAddInfoList',
		}),
		init() {
			this.gridInit();
			this.initData();
		},
		async initData() {
			let ercList = [];
			const res = await this.postApiReturn({
				apiKey: 'selectErcInfo',
				resKey: 'ercInfoData',
				sendParam: {
					blocId: this.userInfo.blocId,
				},
			});
			console.log('res : ', res);
			res.map(item => {
				const it = { text: item.ercNm, value: item.ercId };
				ercList.push(it);
			});
			ercList.unshift({
				text: '',
				value: '',
			});
			this.setPageData({ ercNmList: ercList });
		},
		gridInit() {
			const gridHeight = this.$refs.gridParent.offsetHeight - 30;

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

			const _this = this;
			const myColumns = [
				{ header: '회사 ID', name: 'comId', hidden: true },
				{
					header: '설비 ID',
					name: 'eqpmId',
					width: 'auto',
					minWidth: 130,
					align: 'left',
				},
				{
					header: '설비명',
					name: 'eqpmNm',
					width: 'auto',
					minWidth: 130,
					align: 'left',
				},
				{
					header: '설비 유형',
					name: 'eqpmKind',
					minWidth: 120,
					align: 'left',
					formatter({ value }) {
						let retVal = '';
						const newValue = _this.pageData.eqpmKindList.filter(
							item => item.commCd == value,
						);
						if (newValue.length > 0) {
							retVal = newValue[0].commCdNm;
						}
						return retVal;
					},
				},
				{
					header: '설비 그룹',
					name: 'eqpmGrpId',
					minWidth: 140,
					align: 'left',
					formatter({ value }) {
						let retVal = '';
						const newValue = _this.pageData.eqpmGrpList.filter(
							item => item.eqpmGrpId == value,
						);
						if (newValue.length > 0) {
							retVal = newValue[0].eqpmGrpNm;
						}
						return retVal;
					},
				},
				{
					header: '사업장',
					name: 'blocId',
					width: 100,
					align: 'center',
					hidden: true,
					formatter({ value }) {
						let retVal = '';
						const newValue = _this.pageData.blocIdList.filter(
							item => item.blocId == value,
						);
						if (newValue.length > 0) {
							retVal = newValue[0].blocNm;
						}
						return retVal;
					},
				},
				{
					header: '사용 여부',
					name: 'useFg',
					width: 100,
					align: 'center',
					formatter({ value }) {
						const newValue = _this.pageData.useFgList.filter(
							item => item.commCd == value,
						);
						return newValue[0].commCdNm;
					},
				},
				{
					header: '에너지 센터 ID',
					name: 'eccId',
					width: 150,
					align: 'center',
					hidden: true,
				},
				{
					header: '에너지 센터명',
					name: 'eccNm',
					width: 150,
					align: 'center',
					hidden: true,
				},
			];

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

			this.loadGrid = true;

			this.getRowGridData();
		},
		async search() {
			this.loadGrid = false;
			await this.getRowGridData();
			await this.setPageData({
				isFind: false,
			});
		},
		async getRowGridData() {
			let res = [];

			if (this.pageData.blocMstrList.length > 0) {
				res = await this.postApiReturn({
					apiKey: 'selectEqpmBaseInfo',
					resKey: 'eqpmBaseInfoData',
					sendParam: {
						comId: this.userInfo.comCd,
						blocId: this.pageData.blocMstrList[this.pageData.blocId].blocId,
						eqpmKind: this.pageData.searchEqpmKind,
						eqpmGrpId: this.pageData.searchEqpmGrp,
						eqpmNmLike: this.pageData.eqpmNm,
					},
				});
			} else {
				this.setPageData({ isFind: false });
			}
			const newRes = res.map(item => {
				const newObj = {
					...item,
					rowStat: null,
					blocId: item.blocId,
					eqpmId: item.eqpmId,
					useFg: item.useFg === '1' ? true : false, // 화면 개발 편의를 위해 boolean 타입으로 교체, 저장시 "1", "0" 으로 바꿔 보내야 함
				};
				return newObj;
			});
			this.setGridData({
				gridKey: this.gridName,
				value: newRes,
			});
			this.loadGrid = true;
			this.$nextTick(() => {
				if (newRes.length > 0) {
					this.$refs[this.gridName].focus({
						rowKey:
							this.pageData.rowGridSelectKey != '' ||
								this.pageData.rowGridSelectKey != null
								? this.pageData.rowGridSelectKey
								: this.$refs[this.gridName]
									.getData()
									.findIndex(item => item.eqpmId == this.lastInsertEqpmId) ==
									-1
									? 0
									: this.$refs[this.gridName]
										.getData()
										.findIndex(item => item.eqpmId == this.lastInsertEqpmId),
						columnName: 'eqpmId',
						setScroll: true,
					});
				} else {
					this.detailDataInit();
				}
			});
		},
		async getRowData(data) {
			this.setEqpmAddInfo(data);
			this.setEqpmIao(data);
			this.setEqpmConstIao(data);
			this.setPageData({
				eqpmGrpId: data.eqpmGrpId ? data.eqpmGrpId : '',
			});
			this.setGridSelectData({
				gridKey: 'rowEqpmIaoGrid',
				gridSelect: true,
				rowGridSelectKey: '',
				rowGridSelectData: Object.assign({}, {}),
			});
			this.setGridSelectData({
				gridKey: 'rowEqpmConstGrid',
				gridSelect: true,
				rowGridSelectKey: '',
				rowGridSelectData: Object.assign({}, {}),
			});
		},
		async setEqpmAddInfo(data) {
			this.setPageData({
				rowGridSelectKey: data.rowKey,
				rowGridSelectData: data,
			});
			const res = await this.postApiReturn({
				apiKey: 'selectEqpmAddInfoList',
				resKey: 'eqpmAddInfoData',
				sendParam: {
					comId: data.comId,
					tagId: data.tagId,
					eqpmId: data.eqpmId,
				},
			});

			const newRes = res.map(item => {
				const newObj = {
					...item,
					comId: item.comId || '',
					eqpmId: item.eqpmId || '',
					addInfoId: item.addInfoId || '',
					addInfoDataKind: item.addInfoDataKind || '',
					addInfoNumVal: item.addInfoNumVal || '',
					addInfoTxtVal: item.addInfoTxtVal || '',
					addInfoVal: item.addInfoVal || '',
					useFg: item.useFg === '1' ? true : false,
					rowStat: null,
				};
				return newObj;
			});

			this.setGridData({
				gridKey: 'rowDetailGrid',
				value: newRes,
			});
		},
		async setEqpmIao(data) {
			this.setPageData({
				rowGridSelectKey: data.rowKey,
				rowGridSelectData: data,
			});
			// 검침개소 추가 정보 처리
			const res = await this.postApiReturn({
				apiKey: 'selectEqpmIao',
				resKey: 'eqpmIaoData',
				sendParam: {
					comId: data.comId,
					eqpmId: data.eqpmId,
					objKind: ['TAG', 'READ_PLC'],
				},
			});

			const newRes = res.map(item => {
				const newObj = {
					...item,
					comId: item.comId || '',
					blocId: item.blocId || '',
					eqpmId: item.eqpmId || '',
					readPlcId: item.readPlcId || '',
					calcFg: item.calcFg === '1' ? true : false,
					rowStat: null,
				};
				return newObj;
			});

			this.setGridData({
				gridKey: 'rowEqpmIaoGrid',
				value: newRes,
			});
		},
		async setEqpmConstIao(data) {
			const res = await this.postApiReturn({
				apiKey: 'selectEqpmIao',
				resKey: 'eqpmIaoData',
				sendParam: {
					comId: data.comId,
					eqpmId: data.eqpmId,
					objKind: ['CONST'],
				},
			});

			const newRes = res.map(item => {
				const newObj = {
					...item,
					comId: item.comId || '',
					blocId: item.blocId || '',
					eqpmId: item.eqpmId || '',
					readPlcId: item.readPlcId || '',
					calcFg: item.calcFg === '1' ? true : false,
					rowStat: null,
				};
				return newObj;
			});

			this.setGridData({
				gridKey: 'rowEqpmConstGrid',
				value: newRes,
			});
		},
		detailDataInit() {
			this.setPageData({
				rowGridSelectKey: null,
				rowGridSelectData: [],
			});
			this.setGridData({
				gridKey: 'rowDetailGrid',
				value: [],
			});
		},
		detailEqpmIaoInit() {
			this.setPageData({
				rowGridSelectKey: null,
				rowGridSelectData: [],
			});
			this.setGridData({
				gridKey: 'rowEqpmIaoGrid',
				value: [],
			});
		},
		getSelectedRowStatInfo(data) {
			if (data) {
				var rowStat = data.rowStat;
				if (rowStat === 'I') {
					this.tab = 0;
					for (var i = 1; i < this.items.length; i++) {
						this.items[i].disabledFlag = true;
						this.detailList[0].disabled = false;
					}
				} else if (rowStat === 'U') {
					for (var i = 1; i < this.items.length; i++) {
						this.items[i].disabledFlag = false;
						this.detailList[0].disabled = true;
					}
				} else if (rowStat === 'D') {
					for (var i = 1; i < this.items.length; i++) {
						this.items[i].disabledFlag = false;
						this.detailList[0].disabled = true;
					}
				} else if (rowStat === null) {
					for (var i = 1; i < this.items.length; i++) {
						this.items[i].disabledFlag = false;
						this.detailList[0].disabled = true;
					}
				}
			}
		},
		async btnActions(action) {
			let dataArr = [];
			switch (action) {
				case 'add':
					this.$refs[this.gridName].addRow();
					break;

				case 'remove':
					this.$refs[this.gridName].removeRow();
					break;

				case 'save':
					dataArr = this.$refs[this.gridName].save();
					var validCheck = true;
					if (dataArr.length > 0) {
						if (await this.checkDuplicateEqpmId(dataArr)) {
							validCheck = false;
							alert('설비ID 값이 중복되었습니다.');
						}
						dataArr.filter(item => {
							if (item.rowStat === 'I') {
								if (
									item.eqpmNm == '' ||
									item.eqpmNm == null ||
									item.eqpmId == '' ||
									item.eqpmId == null
								) {
									alert('필수 입력값을 입력해주세요.');
									validCheck = false;
								}
							} else if (item.rowStat === 'U') {
								if (item.eqpmNm == '') {
									alert('설비 명을 입력해주세요.');
									validCheck = false;
								}
							}
						});
						if (validCheck) {
							const sendParam = {
								datas: {
									dsEqpmBaseInfo: dataArr.map(item => {
										this.lastInsertEqpmId = item.eqpmId;
										return {
											...item,
											blocId: this.pageData.blocIdList[this.pageData.blocId]
												.blocId,
											useFg: item.useFg == true ? '1' : '0',
										};
									}),
								},
								params: {},
							};
							await this.postUpdateApi({
								apiKey: 'saveEqpmBaseInfo',
								sendParam: sendParam,
							});

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

				default:
					break;
			}
		},
		gridEditingFinish(data) {
			this.$refs[this.gridName].editingFinish(data);
		},
		// key duplicate -> return true
		async checkDuplicateEqpmId(dataArr) {
			var res = await this.postApiReturn({
				apiKey: 'selectEqpmBaseInfo',
				resKey: 'eqpmBaseInfoData',
				sendParam: {
					comId: this.userInfo.comCd,
					blocId: this.pageData.blocMstrList[this.pageData.blocId].blocId,
				},
			});

			for (var i = 0; i < res.length; i++) {
				for (var j = 0; j < dataArr.length; j++) {
					if (res[i].eqpmId == dataArr[j].eqpmId && dataArr[j].rowStat == 'I') {
						return true;
					}
				}
			}

			return false;
		},
		// gridEditingFinish(data, bindingData) {
		//   switch (bindingData) {
		//     case this.gridName:
		//       this.$refs[bindingData].editingFinish(data);
		//       break;
		//     default:
		//       this.$refs[bindingData][0].editingFinish(data);
		//       break;
		//   }
		// }
	},
};

const defaultData = {
	/* 검색옵션 */
	tagNm: '',
	blocId: '',
	blocMstrList: [],
	blocIdList: [],
	searchEqpmKind: '',
	searchEqpmKindList: [],
	searchEqpmGrp: '',
	searchEqpmGrpList: [],
	eqpmKind: '',
	eqpmKindList: [],
	eqpmGrpId: '',
	eqpmGrp: '',
	eqpmGrpList: [],
	eqpmNm: '',
	useFg: '1',
	useFgList: [],

	addInfoDataKind: '',
	addInfoDataKindList: [],
	addInfo: '',
	addInfoList: [],

	ercNm: '',
	ercNmList: [],

	facInfo: {},
	isMulti: false,

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

	isFind: false, // true 경우 조회, 조회버튼도 이 값으로 연동 예정
	/* data 세팅 */
	// 로컬 gridName 값과 동일한 이름으로 세팅
	rowGrid: {
		data: [],
		column: [], // myColumns,
		option: {}, // myOptions
		defaultRow: {
			comId: '',
			eccId: '',
			eqpmId: '',
			eqpmNm: null,
			eqpmKind: 'PROD',
			eqpmGrpId: 'EQG000001',
			blocId: null,
			useFg: '1',
			rowStat: 'I',
		},
		buttonAuth: {
			add: true,
			remove: true,
			save: true,
			excel: false,
		},
	},
	rowDetailGrid: {
		data: [],
		column: [], // myColumns,
		option: {}, // myOptions
		defaultRow: {
			comId: '',
			blcoId: '',
			eqpmId: '',
			addInfoId: null,
			addInfoDataKind: null,
			addInfoNumVal: null,
			addInfoTxtVal: null,
			addInfoVal: null,
			useFg: '1',
			rowStat: null,
		},
		buttonAuth: {
			remove: false,
			save: true,
			excel: false,
		},
		rowGridSelectKey: 0,
		rowGridSelectData: null,
	},
	rowEqpmIaoGrid: {
		data: [],
		column: [], // myColumns,
		option: {}, // myOptions
		defaultRow: {
			comId: '',
			blocId: '',
			rowStat: null,
			eqpmId: '',
			objId: '',
			ercId: '',
			objKind: '',
			inProdKind: 'INOUT_ENV',
			calcFg: '',
			distRt: 100,
			pysclQtyId: '',
			pysclQtyNm: '',
			pysclQtyVal: '',
			regUserNo: '',
			regDttm: '',
			procUserNo: '',
			procDttm: '',
		},
		buttonAuth: {
			add: true,
			remove: true,
			save: true,
			excel: false,
		},
		rowGridSelectKey: 0,
		rowGridSelectData: null,
	},
	rowEqpmConstGrid: {
		data: [],
		column: [], // myColumns,
		option: {}, // myOptions
		defaultRow: {
			comId: '',
			blocId: '',
			rowStat: null,
			eqpmId: '',
			objId: '',
			ercId: '',
			objKind: 'CONST',
			inProdKind: '',
			calcFg: '',
			distRt: 100,
			pysclQtyId: '',
			pysclQtyNm: '',
			pysclQtyVal: '',
			regUserNo: '',
			regDttm: '',
			procUserNo: '',
			procDttm: '',
		},
		buttonAuth: {
			add: true,
			remove: true,
			save: true,
			excel: false,
		},
		rowGridSelectKey: 0,
		rowGridSelectData: null,
	},
};

const myDetail = [
	{
		type: 'InputTextReg',
		label: '설비 ID',
		valueNm: 'eqpmId',
		// readonly: true,
		disabled: true,
		cols: 6,
		class: 'py-3 pr-4',
		required: true,
		iconShow: true,
		labelCols: 12,
		textCols: 12,
	},
	{
		type: 'InputText',
		label: '설비 명',
		valueNm: 'eqpmNm',
		disabled: false,
		cols: 6,
		class: 'py-3 pl-4',
		required: true,
		labelCols: 12,
		textCols: 12,
		iconShow: true,
	},
	{
		type: 'SelectBox',
		label: '설비 유형',
		valueNm: 'eqpmKind',
		disabled: false,
		cols: 6,
		class: 'py-3 pr-4',
		list: 'eqpmKindList',
		itemText: 'commCdNm',
		itemValue: 'commCd',
		required: true,
		labelCols: 12,
		textCols: 12,
		iconShow: true,
	},
	{
		type: 'SelectBox',
		label: '설비 그룹',
		valueNm: 'eqpmGrpId',
		disabled: false,
		cols: 6,
		class: 'py-3 pl-4',
		list: 'eqpmGrpList',
		itemText: 'eqpmGrpNm',
		itemValue: 'eqpmGrpId',
		required: true,
		labelCols: 12,
		textCols: 12,
		iconShow: true,
	},
	{
		type: 'FtnPlcFormPop',
		valueNm: 'eccId',
		valueNm2: 'eccNm',
		label: '공정',
		disabled: false,
		required: false,
		cols: 6,
		disableContent: true,
		eccFgYn: 'Y',
		labelCols: 12,
		textCols: 12,
		iconShow: true,
		class: 'py-3 pr-4',
	},
	{
		type: 'CheckBox',
		label: '사용 여부',
		valueNm: 'useFg',
		disabled: false,
		cols: 6,
		class: 'py-3 pl-4',
		value: { '1': true, '0': false },
		required: true,
		iconShow: true,
		// class: 'd-flex align-end pb-3'
	},
	{
		type: 'InputText',
		valueNm: 'eccNm',
		readonly: true,
		cols: 6,
		labelCols: 12,
		textCols: 12,
		iconShow: true,
		class: 'pt-0 py-3 pr-4'
	},

];

import { getPathDataExample } from '@/const/const'
const dataPathDataExample = getPathDataExample({
		id: 'INCHEON.HVAC.EQP_HT_CH001.UT_CH101.CHI_AMP_1A_PV',
		lable: 'INCHEON 고온 냉동기 101호기 - 호로1',
		type: '사용', note: '-',
		field1: '1111',
		field2: '2222',
	});
</script>
