sk_fems_ui commit

This commit is contained in:
unknown
2025-07-12 15:13:46 +09:00
commit ffdf5ccb66
380 changed files with 137913 additions and 0 deletions

View File

@ -0,0 +1,393 @@
<template>
<div>
<div
class="d-flex justify-space-between align-center"
style="height: 80px;"
>
<span class="txt">Data Set TAG 연결 정보</span>
<Buttons
:parentPrgmId="parentPrgmId"
:bindingData="gridName"
:detailList="detailDataSetTagList"
:btnActionsFnc="btnActions"
/>
</div>
<div ref="gridParent" style="height: calc((100vh - 520px) /2);">
<Grid
:ref="gridName"
:is="loadGrid ? 'Grid' : null"
:gridName="gridName"
:parentPrgmId="parentPrgmId"
@getRowsData="getRowData"
:innerTabGridInfo="innerTabGridInfo"
/>
</div>
<div ref="formParent" style="height: calc((100vh - 520px) /2);">
<component
:is="'Form'"
:parentPrgmId="parentPrgmId"
:bindingData="gridName"
:detailList="detailDataSetTagList"
@gridEditingFinish="gridEditingFinish"
/>
</div>
<div ref="formParent" style="height: 100px);" class="w100 h100">
<v-row ref="contents" class="w100">
<v-card class="searchFilter w100">
<v-row align="center" no-gutters>
<v-col :cols="7">
<component
:is="'Datepicker'"
:parentPrgmId="parentPrgmId"
:label="'검색기간'"
:labelCols="2"
/>
</v-col>
<v-col :cols="3">
<component
:is="'selectCodeList'"
:parentPrgmId="parentPrgmId"
:label="'주기'"
dataKey="mdlDataTerm"
:sendParam="{ commGrpCd: 'MDL_DATA_TERM', useFg: '1' }"
:addAll="false"
/>
</v-col>
<v-col :cols="2" class="text-right">
<v-btn
@click="jamoviProcClickEvent('view1')"
:ripple="false"
class="mr-1"
>데이터 분석</v-btn
>
</v-col>
</v-row>
</v-card>
</v-row>
</div>
</div>
</template>
<script>
import { mapState, mapMutations, mapActions } from 'vuex';
import Buttons from '~/components/common/button/Buttons';
import Grid from '~/components/common/Grid';
import { CustumChecbox } from '~/plugins/gridUtility';
import { CustomNumberEditor } from '~/plugins/gridUtility';
import Form from '~/components/common/form/Form';
import mixinGlobal from '@/mixin/global.js';
import Utility from '~/plugins/utility';
import Datepicker from '~/components/common/DatepickerTopView';
import selectCodeList from '@/components/common/select/selectCodeList';
export default {
mixins: [mixinGlobal],
components: {
Buttons,
Grid,
Form,
Datepicker,
selectCodeList,
},
props: {
parentPrgmId: {
type: String,
require: true,
},
innerTabGridInfo: {
type: Object,
default: null,
},
},
data() {
return {
loadGrid: false,
gridName: 'rowDataSetTagRelGrid',
detailDataSetTagList: myDataSetTagDetail,
};
},
computed: {
...mapState({
pageData(state) {
return state.pageData[this.parentPrgmId];
},
}),
selectedCommCd() {
return this.pageData[this.gridName].data;
},
myUseFgList() {
return this.pageData.useFgList;
},
selectedComId() {
return this.pageData.rowGridSelectData.comId;
},
selectedDataSetId() {
return this.pageData.rowGridSelectData.dataSetId;
},
},
mounted() {
this.init();
},
methods: {
...mapMutations({
setPageData: 'setPageData',
setGridData: 'setGridData',
setGridColumn: 'setGridColumn',
setGridOption: 'setGridOption',
}),
...mapActions({
postApi: 'modules/list/postApi',
postUpdateApi: 'modules/list/postUpdateApi',
postApiReturn: 'modules/list/postApiReturn',
setTree: 'modules/list/setTree',
chkOpenTabList: 'chkOpenTabList',
getCodeList: 'modules/search/getCodeList',
}),
init() {
this.gridInit();
},
gridInit() {
const gridHeight = this.$refs['gridParent'].offsetHeight - 36;
const myOptions = {
// bodyHeight: gridHeight,
// minBodyHeight: gridHeight,
header: {
height: 28,
},
rowHeight: 29,
minRowHeight: 29,
selectionUnit: 'row',
editingEvent: 'click',
// columnOptions: {
// resizable: true,
// minWidth: 100
// }
};
this.setGridOption({
gridKey: this.gridName,
// value: myOptions
value: Object.assign(Utility.defaultGridOption(gridHeight), myOptions),
});
const _this = this;
let useFgSelectList = [];
this.pageData.useFgList.forEach(item => {
const it = { text: item.commCdNm, value: item.commCd };
useFgSelectList.push(it);
});
const myColumns = [
{ header: '회사 ID', name: 'comId', hidden: true },
{ header: 'DataSet ID', name: 'dataSetId', hidden: true },
{ header: 'DataSet 명', name: 'dataSetNm', hidden: true },
{ header: 'TAG ID', name: 'tagId', align: 'left', width: 440 },
{ header: 'TAG 명', name: 'tagNm', align: 'left', width: 320 },
{
header: '모델 Data 구분',
name: 'mdlDataTypeCd',
align: 'center',
width: 120,
formatter({ value }) {
var retVal = '';
for (var i = 0; i < _this.pageData.mdlDataTypeCdList.length; i++) {
if (_this.pageData.mdlDataTypeCdList[i].commCd === value) {
retVal = _this.pageData.mdlDataTypeCdList[i].commCdNm;
}
}
return retVal;
},
},
{
header: '사용여부',
name: 'useFg',
align: 'center',
width: 100,
formatter({ value }) {
value = value === true ? '1' : '0';
const newValue = _this.pageData.useFgList.filter(
item => item.commCd == value,
);
return newValue[0].commCdNm;
},
// editor: {
// type: "select",
// options: {
// listItems: useFgSelectList
// }
// }
},
{ header: '비고', name: 'rmrk', align: 'center' },
];
this.setGridColumn({
gridKey: this.gridName,
value: myColumns,
});
this.loadGrid = true;
},
async getRowData(data, gridName) {
// if (data.rowStat === 'I') {
// this.detailDataSetTagList[0].disabled = false;
// this.detailDataSetTagList[1].disabled = false;
// } else {
// this.detailDataSetTagList[0].disabled = true;
// this.detailDataSetTagList[1].disabled = true;
// }
this.setGridSelectData({
gridKey: gridName,
gridSelect: true,
rowGridSelectKey: data.rowKey,
rowGridSelectData: Object.assign({}, data),
});
},
async btnActions(action) {
let dataArr = [];
switch (action) {
case 'add':
console.log('add this.pageData : '); // , this.pageData);
const defaultRow = {
dataSetId: this.pageData.dataSetId,
dataSetNm: this.pageData.dataSetNm,
mdlDataTypeCd: 'SUM',
tagId: '',
tagNm: '',
rmrk: null,
useFg: true,
};
this.$refs[this.gridName].addRow(defaultRow);
this.detailDataSetTagList[0].disabled = false;
this.detailDataSetTagList[1].disabled = false;
break;
case 'remove':
this.$refs[this.gridName].removeRow();
this.detailDataSetTagList[0].disabled = true;
this.detailDataSetTagList[1].disabled = true;
break;
case 'save':
dataArr = this.$refs[this.gridName].save();
// this.loadGrid = false;
const newDataArr = dataArr.map(item => {
const newData = {
...item,
comId: this.selectedComId,
dataSetId: this.selectedDataSetId,
};
newData.reprTagFg = newData.reprTagFg == true ? '1' : '0';
newData.useFg = newData.useFg == true ? '1' : '0';
return newData;
});
if (dataArr.length > 0) {
var validCheck = true;
dataArr.filter(item => {
if (item.rowStat === 'I') {
if (item.tagId == '' || item.distRt == '' || item.ercId == '') {
alert('필수 입력값을 입력해주세요.');
validCheck = false;
}
} else if (item.rowStat === 'U') {
if (item.distRt == '' || item.ercId == '') {
alert('필수 입력값을 입력해주세요.');
validCheck = false;
}
}
});
if (validCheck) {
const sendParam = {
datas: {
dsMdlDataSetTagRel: newDataArr,
},
params: {},
};
await this.postUpdateApi({
apiKey: 'saveMdlDataSetTagRel',
sendParam: sendParam,
});
// this.loadGrid = true;
this.setPageData({ isFind: true });
}
} else {
alert('저장할 내용이 없습니다.');
}
break;
default:
break;
}
},
gridEditingFinish(data, bindingData) {
this.$refs[this.gridName].editingFinish(data);
},
emits: ['jamoviClickEvent'],
search() {},
jamoviProcClickEvent() {
let data = {
comId: this.selectedComId,
dataSetId: this.selectedDataSetId,
};
console.log('data : ', data);
this.$emit('jamoviClickEvent', 'view1', data);
},
},
};
const myDataSetTagDetail = [
{
type: 'EvtObjPop',
labelContent: 'TAG',
modalTitle: 'TAG 리스트',
valueNm: 'tagId',
valueNm2: 'tagNm',
disabled: true,
cols: 6,
class: 'py-2',
required: true,
},
{
type: 'InputText',
label: 'TAG 명',
valueNm: 'tagNm',
disabled: false,
cols: 5,
class: 'py-2',
required: true,
},
{
type: 'SelectBox',
label: '모델 Data 구분',
valueNm: 'mdlDataTypeCd',
disabled: false,
cols: 6,
class: 'py-2',
list: 'mdlDataTypeCdList',
itemText: 'commCdNm',
itemValue: 'commCd',
required: true,
},
{
type: 'CheckBox',
label: '사용여부',
valueNm: 'useFg',
disabled: false,
cols: 5,
class: 'py-2',
value: { '1': true, '0': false },
required: true,
},
{
type: 'TextArea',
label: '비고',
valueNm: 'rmrk',
disabled: false,
cols: 12,
textCols: 9,
rows: 2,
class: 'py-2',
required: false,
},
];
</script>

View File

@ -0,0 +1,434 @@
<template>
<div>
<div
class="d-flex justify-space-between align-center"
style="height: 80px;"
>
<span class="txt">공정 추가 정보</span>
<Buttons
:parentPrgmId="parentPrgmId"
:bindingData="gridName"
:btnActionsFnc="btnActions"
/>
</div>
<div ref="gridParent" style="height: calc(100vh - 560px);">
<Grid
:ref="gridName"
:is="loadGrid ? 'Grid' : null"
:gridName="gridName"
:parentPrgmId="parentPrgmId"
:editorGrid="true"
:innerTabGridInfo="innerTabGridInfo"
@getRowsData="getRowData"
/>
</div>
</div>
</template>
<script>
import { mapState, mapMutations, mapActions } from 'vuex';
import Buttons from '~/components/common/button/Buttons';
import Grid from '~/components/common/Grid';
import Utility from '~/plugins/utility';
import InputText from '~/components/common/input/InputText';
import Form from '~/components/common/form/Form';
import mixinGlobal from '@/mixin/global.js';
export default {
mixins: [mixinGlobal],
components: {
Buttons,
Grid,
InputText,
Form,
Utility,
},
props: {
parentPrgmId: {
type: String,
require: true,
},
innerTabGridInfo: {
type: Object,
default: null,
},
},
data() {
return {
loadGrid: false,
gridName: 'rowDetailGrid',
rowKey: null,
edtingFinishFlag: 'Y',
};
},
computed: {
...mapState({
pageData(state) {
return state.pageData[this.parentPrgmId];
},
}),
selectedCommCd() {
return this.pageData[this.gridName].data;
},
myUseFgList() {
return this.pageData.useFgList;
},
selectedComId() {
return this.pageData.rowGridSelectData.comId;
},
selectedBlocId() {
return this.pageData.rowGridSelectData.blocId;
},
selectedEccId() {
return this.pageData.rowGridSelectData.eccId;
},
},
mounted() {
this.init();
},
methods: {
...mapMutations({
setPageData: 'setPageData',
setGridData: 'setGridData',
setGridColumn: 'setGridColumn',
setGridOption: 'setGridOption',
}),
...mapActions({
postApi: 'modules/list/postApi',
postUpdateApi: 'modules/list/postUpdateApi',
postApiReturn: 'modules/list/postApiReturn',
setTree: 'modules/list/setTree',
chkOpenTabList: 'chkOpenTabList',
}),
init() {
this.gridInit();
},
search() {},
gridInit() {
const gridHeight = this.$refs.gridParent.offsetHeight - 30;
const myOptions = {
columnOptions: {
resizable: true,
},
bodyHeight: gridHeight,
minBodyHeight: gridHeight,
header: {
height: 28,
},
rowHeight: 29,
minRowHeight: 29,
selectionUnit: 'row',
editingEvent: 'click',
};
this.setGridOption({
gridKey: this.gridName,
value: myOptions,
});
const _this = this;
let useFgSelectList = [];
this.pageData.useFgList.forEach(item => {
const it = { text: item.commCdNm, value: item.commCd };
useFgSelectList.push(it);
});
let addInfoList = [];
this.pageData.addInfoList.forEach(item => {
const it = { text: item.addInfoNm, value: item.addInfoId };
addInfoList.push(it);
});
let addInfoDataKindList = [];
this.pageData.addInfoDataKindList.forEach(item => {
const it = { text: item.commCdNm, value: item.commCd };
addInfoDataKindList.push(it);
});
class CustomRenderer {
constructor(props) {
//const { min, max } = props.columnInfo.renderer.options;
//console.log('props: %o', props);
const el = document.createElement('input');
if (
props.grid.store.data.rawData[props.rowKey].addInfoDataKind == 'FG'
) {
el.type = 'checkbox';
} else {
el.type = 'text';
$(el).addClass('tui-grid-cell-content');
$(el).css('text-align', 'center');
}
// el.min = String(min);
//el.max = String(max);
//el.disabled = true;
this.el = el;
this.render(props);
}
getElement() {
return this.el;
}
render(props) {
if (this.el.type == 'checkbox') {
if (props.value == 1) {
this.el.checked = true;
} else {
this.el.checked = false;
}
}
this.el.value = props.value;
}
}
class CustomEditor {
constructor(props) {
const el = document.createElement('input');
if (
props.grid.store.data.rawData[props.rowKey].addInfoDataKind == 'FG'
) {
el.type = 'checkbox';
if (props.value == 1) {
el.checked = true;
} else {
el.checked = false;
}
el.addEventListener('change', this.change);
} else {
el.type = 'text';
if (props.formattedValue == 'NUM') {
el.oninput = function(event) {
var regExp=/[^0-9]/g;
if(event.data != null){
if(event.data.match(regExp)){
event.target.value = event.target.value.replace(regExp, '');
}
}
};
}
$(el).addClass('tui-grid-content-text');
}
// console.log('props: %o', props);
// console.log('el: %o', el);
this.el = el;
this.render(props);
}
change(ev) {
//console.log('props: %o', ev);
if (ev.target.checked) {
ev.target.value = 1;
} else {
ev.target.value = 0;
}
}
getElement() {
return this.el;
}
getValue() {
return this.el.value;
}
render(props) {
if (this.el.type == 'checked') {
this.el.value = props.value;
} else {
this.el.value = String(props.value);
}
//console.log('props: %o', props);
}
mounted() {
if (this.el.type == 'checkbox') {
$(this.el.parentElement).css('text-align', 'center');
}
this.el.select();
}
}
const myColumns = [
{ header: '회사 ID', name: 'comId', hidden: true },
{ header: '공정 번호', name: 'eccId', hidden: true },
{
header: '추가 정보',
name: 'addInfoId',
align: 'left',
formatter({ value }) {
let retVal = '';
const newValue = addInfoList.filter(item => item.value == value);
if (newValue.length > 0) {
retVal = newValue[0].text;
}
return retVal;
},
},
{
header: 'Data 구분',
name: 'addInfoDataKind',
align: 'center',
formatter({ value }) {
let retVal = '';
const newValue = addInfoDataKindList.filter(
item => item.value == value,
);
if (newValue.length > 0) {
retVal = newValue[0].text;
}
return retVal;
},
},
{
header: '숫자 값',
name: 'addInfoNumVal',
align: 'right',
editor: 'text',
hidden: true,
},
{
header: '문자 값',
name: 'addInfoTxtVal',
align: 'left',
editor: 'text',
hidden: true,
},
{
header: '추가 정보 값',
name: 'addInfoVal',
align: 'center',
renderer: {
type: CustomRenderer,
},
editor: {
type: CustomEditor,
align: 'center',
},
formatter(data) {
return data.row.addInfoDataKind;
},
},
//{ header: "추가 정보 값", name: "addInfoVal", align: "center" , editor: "text",
// formatter({ value, row , column}) {
// console.log("addInfoVal row : ", row);
// console.log("addInfoVal state : ", column);
// if(row.addInfoDataKind === "NUM"){
// column.align = "right";
// }else{
// column.align = "left";
// }
// return value;
// }
//},
/*{
header: "사용여부",
name: "useFg",
align: "center",
formatter({ value }) {
return value == "1" ? "사용" : "사용안함";
},
editor: {
type: "select",
options: {
// listItems: useFgSelectList
listItems: [
{text:"사용", value:"1"},
{text:"사용안함", value:"0"},
]
}
}
},*/
{ header: '등록 사용자', name: 'regUserNo', hidden: true },
{ header: '등록 일자', name: 'regDttm', hidden: true },
{ header: '수정 사용자', name: 'procUserNo', hidden: true },
{ header: '수정 일자', name: 'procDttm', hidden: true },
];
this.setGridColumn({
gridKey: this.gridName,
value: myColumns,
});
this.loadGrid = true;
},
async getRowData(data, gridName) {
this.setGridSelectData({
gridKey: gridName,
gridSelect: true,
rowGridSelectKey: data.rowKey,
rowGridSelectData: Object.assign({}, data),
});
this.rowKey = data.rowKey;
this.edtingFinishFlag = 'Y';
},
async btnActions(action) {
let dataArr = [];
switch (action) {
case 'add':
this.$refs[this.gridName].addRow();
this.edtingFinishFlag = 'Y';
break;
case 'remove':
await this.$refs[this.gridName].editingFinish({
rowKey: this.rowKey,
});
this.$refs[this.gridName].removeRow();
this.edtingFinishFlag = 'N';
break;
case 'save':
if (this.edtingFinishFlag == 'Y') {
await this.$refs[this.gridName].editingFinish({
rowKey: this.rowKey,
});
}
this.loadGrid = false;
dataArr = this.$refs[this.gridName].save();
// console.log('dataArr : ', dataArr);
for (var i = 0; i < dataArr.length; i++) {
if (
dataArr[i].addInfoDataKind == 'NUM' &&
dataArr[i].addInfoVal == ''
) {
dataArr[i].addInfoVal = null;
}
}
this.setPageData({ isFind: true });
if (dataArr.length > 0) {
// console.log(this.pageData)
const sendParam = {
datas: {
dsEccAddInfo: dataArr.map(item => ({
...item,
comId: this.selectedComId,
eccId: this.selectedEccId,
})),
},
params: {},
};
await this.postUpdateApi({
apiKey: 'saveEccAddInfoList',
sendParam: sendParam,
});
this.loadGrid = true;
this.setPageData({ isFind: true });
this.edtingFinishFlag = 'Y';
} else {
this.loadGrid = true;
alert('저장할 내용이 없습니다.');
}
break;
default:
break;
}
},
gridEditingFinish2(data, bindingData) {
this.$refs[bindingData].editingFinish(data);
},
},
};
</script>

View File

@ -0,0 +1,478 @@
<template>
<div>
<div
class="d-flex justify-space-between align-center"
style="height: 80px;"
>
<span class="txt">공정 입출력 정보</span>
<Buttons
:parentPrgmId="parentPrgmId"
:bindingData="gridName"
:btnActionsFnc="btnActions"
/>
</div>
<div ref="gridParent" style="height: calc(100vh - 760px);">
<component
:ref="gridName"
:is="loadGrid ? 'Grid' : null"
:gridName="gridName"
:parentPrgmId="parentPrgmId"
@getRowsData="getRowData"
:innerTabGridInfo="innerTabGridInfo"
/>
</div>
<div>
<component
:is="'Form'"
:bindingData="gridName"
:parentPrgmId="parentPrgmId"
:detailList="detailList"
@gridEditingFinish="gridEditingFinish"
/>
</div>
</div>
</template>
<script>
import { mapState, mapMutations, mapActions } from 'vuex';
import Buttons from '~/components/common/button/Buttons';
import Grid from '~/components/common/Grid';
import Form from '~/components/common/form/Form';
import Utility from '~/plugins/utility';
import mixinGlobal from '@/mixin/global.js';
export default {
mixins: [mixinGlobal],
components: {
Buttons,
Grid,
Form,
Utility,
},
props: {
parentPrgmId: {
type: String,
require: true,
},
innerTabGridInfo: {
type: Object,
default: null,
},
},
data() {
return {
loadGrid: false,
gridName: 'rowEccIaoGrid',
inputList_emMapDiv: [],
inputList_cmInOut: [],
detailList: myDetail,
};
},
computed: {
...mapState({
pageData(state) {
return state.pageData[this.parentPrgmId];
},
}),
selectedCommCd() {
return this.pageData[this.gridName].data;
},
myUseFgList() {
return this.pageData.useFgList;
},
selectedComId() {
return this.pageData.rowGridSelectData.comId;
},
selectedBlocId() {
return this.pageData.rowGridSelectData.blocId;
},
// selectedObjId() {
// return this.pageData.rowGridSelectData.objId;
// }
selectedObjId() {
if (this.pageData.rowEccIaoGrid.rowGridSelectData === null) {
return '';
} else {
return this.pageData.rowEccIaoGrid.rowGridSelectData.objKind;
}
},
},
watch: {
selectedObjId(val) {
if (val === 'TAG') {
this.detailList[2].class = 'py-2 d-none';
this.detailList[3].class = 'py-2 d-none';
this.detailList[4].class = 'py-2';
this.detailList[5].class = 'py-2';
} else {
// }else if(val==="READ_PLC"){
this.detailList[5].class = 'py-2 d-none';
this.detailList[4].class = 'py-2 d-none';
this.detailList[3].class = 'py-2';
this.detailList[2].class = 'py-2';
}
},
},
created() {},
mounted() {
this.init();
},
methods: {
...mapMutations({
setPageData: 'setPageData',
setGridData: 'setGridData',
setGridColumn: 'setGridColumn',
setGridOption: 'setGridOption',
setGridSelectData: 'setGridSelectData',
}),
...mapActions({
postApi: 'modules/list/postApi',
postUpdateApi: 'modules/list/postUpdateApi',
postApiReturn: 'modules/list/postApiReturn',
setTree: 'modules/list/setTree',
chkOpenTabList: 'chkOpenTabList',
getCodeList: 'modules/search/getCodeList',
}),
init() {
this.gridInit();
},
search() {},
setEditorContent() {
this.inputList_emMapDiv = this.pageData.emMapDivList.map(item => {
return {
text: item.commCdNm,
value: item.commCd,
};
});
this.inputList_cmInOut = this.pageData.cmInoutList.map(item => {
return {
text: item.commCdNm,
value: item.commCd,
};
});
},
gridInit() {
this.setEditorContent();
const gridHeight = this.$refs.gridParent.offsetHeight - 30;
this.loadGrid = false;
const myOptions = {
columnOptions: {
resizable: true,
},
bodyHeight: gridHeight,
minBodyHeight: gridHeight,
header: {
height: 28,
},
rowHeight: 29,
minRowHeight: 29,
selectionUnit: 'row',
editingEvent: 'click',
};
this.setGridOption({
gridKey: this.gridName,
value: myOptions,
});
const _this = this;
let useFgSelectList = [];
this.pageData.useFgList.forEach(item => {
const it = { text: item.commCdNm, value: item.commCd };
useFgSelectList.push(it);
});
const myColumns = [
{ header: '회사 ID', name: 'comId', hidden: true },
{ header: '공정 번호', name: 'eccId', hidden: true },
{ header: '대상 ID', name: 'objId', align: 'center', hidden: true },
{ header: '대상 명', name: 'objNm', width: 300, align: 'left' },
{
header: '에너지원 명',
name: 'ercId',
align: 'left',
formatter({ value }) {
var retVal = '';
for (var i = 0; i < _this.pageData.ercNmList.length; i++) {
if (_this.pageData.ercNmList[i].value === value) {
retVal = _this.pageData.ercNmList[i].text;
}
}
return retVal;
},
},
{
header: '대상 유형',
name: 'objKind',
align: 'center',
formatter({ value }) {
var retVal = '';
for (var i = 0; i < _this.pageData.emMapDivList.length; i++) {
if (_this.pageData.emMapDivList[i].commCd === value) {
retVal = _this.pageData.emMapDivList[i].commCdNm;
}
}
return retVal;
},
},
{
header: '투입 생산 유형',
name: 'inProdKind',
align: 'center',
formatter({ value }) {
var retVal = '';
for (var i = 0; i < _this.pageData.cmInoutList.length; i++) {
if (_this.pageData.cmInoutList[i].commCd === value) {
retVal = _this.pageData.cmInoutList[i].commCdNm;
}
}
return retVal;
},
},
{
header: '계산 여부',
name: 'calcFg',
align: 'center',
formatter({ value }) {
value = value === true ? '1' : '0';
const newValue = _this.pageData.useFgList.filter(
item => item.commCd == value,
);
return newValue[0].commCdNm;
// return value === true ? "사용" : "사용안함";
},
},
{ header: '분배율(1~100)', name: 'distRt', align: 'right' },
{ header: '사업장', name: 'blocId', align: 'center', hidden: true },
{ header: '등록 사용자', name: 'regUserNo', hidden: true },
{ header: '등록 일자', name: 'regDttm', hidden: true },
{ header: '수정 사용자', name: 'procUserNo', hidden: true },
{ header: '수정 일자', name: 'procDttm', hidden: true },
{ header: 'rowStat', name: 'rowStat', hidden: true },
];
this.setGridColumn({
gridKey: this.gridName,
value: myColumns,
});
this.loadGrid = true;
},
async getRowData(data, gridName) {
if (data.rowStat === 'I') {
this.detailList[0].disabled = false;
this.detailList[2].disabled = false;
this.detailList[3].disabled = false;
this.detailList[4].disabled = false;
this.detailList[5].disabled = false;
} else {
this.detailList[0].disabled = true;
this.detailList[2].disabled = true;
this.detailList[3].disabled = true;
this.detailList[4].disabled = true;
this.detailList[5].disabled = true;
}
this.setGridSelectData({
gridKey: gridName,
gridSelect: true,
rowGridSelectKey: data.rowKey,
rowGridSelectData: Object.assign({}, data),
});
},
async btnActions(action) {
let dataArr = [];
switch (action) {
case 'add':
this.$refs[this.gridName].addRow();
this.detailList[0].disabled = false;
this.detailList[2].disabled = false;
this.detailList[3].disabled = false;
this.detailList[4].disabled = false;
this.detailList[5].disabled = false;
break;
case 'remove':
this.$refs[this.gridName].removeRow();
this.detailList[0].disabled = true;
this.detailList[2].disabled = true;
this.detailList[3].disabled = true;
this.detailList[4].disabled = true;
this.detailList[5].disabled = true;
break;
case 'save':
this.loadGrid = false;
dataArr = this.$refs[this.gridName].save();
if (dataArr.length > 0) {
var validCheck = true;
// console.log('dataArr : ', dataArr);
dataArr.forEach(item => {
if (
item.distRt == '' ||
item.distRt == null ||
item.objKind == '' ||
item.objKind == null ||
item.objId == '' ||
item.objId == null ||
item.objNm == '' ||
item.objNm == null ||
item.inProdKind == '' ||
item.inProdKind == null ||
item.ercId == '' ||
item.ercId == null
) {
validCheck = false;
alert('필수 입력값을 입력해주세요');
// this.setPageData({ isFind: true });
this.loadGrid = true;
}
});
if (validCheck) {
const sendParam = {
datas: {
dsEccIao: dataArr.map(item => ({
...item,
comId: this.selectedComId,
calcFg: item.calcFg === true ? '1' : '0',
blocId: this.userInfo.blocId,
eccId: this.pageData.rowGrid.rowGridSelectData.eccId,
})),
},
params: {},
};
await this.postUpdateApi({
apiKey: 'saveEccIao',
sendParam: sendParam,
});
this.setPageData({ isFind: true });
this.loadGrid = true;
}
} else {
alert('저장할 내용이 없습니다.');
}
break;
default:
break;
}
},
gridEditingFinish(data) {
this.$refs[this.gridName].editingFinish(data);
},
},
};
const myDetail = [
{
type: 'SelectBox',
label: '대상 유형',
disabled: false,
cols: 6,
class: 'py-2',
list: 'emMapDivList',
valueNm: 'objKind',
itemText: 'commCdNm',
itemValue: 'commCd',
required: true,
disabled: true,
},
{
// 공백 처리
type: 'Label',
cols: 6,
class: 'py-2',
disabled: false,
},
{
type: 'ReadPlcPop',
label: '대상 항목',
valueNm: 'objId',
disabled: true,
cols: 6,
class: 'py-2',
required: true,
bindNm: 'objNm',
},
{
type: 'InputText',
valueNm: 'objNm',
readonly: true,
disabled: true,
cols: 5,
class: 'py-2',
},
{
type: 'EvtObjPop',
labelContent: '대상 항목',
modalTitle:'대상 항목',
valueNm: 'objId',
valueNm2: 'objNm',
bindNm: 'objNm',
disabled: true,
required: true,
cols: 6,
class: 'py-2 d-none',
labelCols: 4,
textCols: 7,
disableContent: true,
},
{
type: 'InputText',
cols: 5,
class: 'py-2 d-none',
valueNm: 'objNm',
readonly: true,
disabled: true,
},
{
type: 'SelectBox',
label: '에너지원',
disabled: false,
cols: 6,
class: 'py-2',
list: 'ercNmList',
valueNm: 'ercId',
itemText: 'text',
itemValue: 'value',
required: true,
},
{
type: 'SelectBox',
label: '투입생산유형',
disabled: false,
cols: 6,
class: 'py-2',
list: 'cmInoutList',
valueNm: 'inProdKind',
itemText: 'commCdNm',
itemValue: 'commCd',
required: true,
},
{
type: 'CheckBox',
cols: 6,
class: 'py-2',
label: '계산 여부',
valueNm: 'calcFg',
disabled: false,
value: { '1': true, '0': false },
required: true,
disabledFg: 'objKind',
},
{
type: 'InputText',
label: '분배율',
valueNm: 'distRt',
readonly: false,
cols: 6,
class: 'py-2',
required: true,
},
];
</script>

View File

@ -0,0 +1,633 @@
<template>
<div>
<v-row>
<v-col :cols="6" class="py-2">
<InputText
ref="effcIdxId"
:parentPrgmId="parentPrgmId"
label="효율지표 ID"
valueNm="effcIdxId"
:required="false"
:readonly="true"
/>
</v-col>
<v-col :cols="6"> </v-col>
<v-col :cols="6" class="py-2">
<InputText
ref="effcIdxNm"
:parentPrgmId="parentPrgmId"
label="효율지표 명"
valueNm="effcIdxNm"
:readonly="true"
:required="false"
/>
</v-col>
<v-col :cols="6"> </v-col>
<v-col :cols="6" class="py-2">
<component
:is="'SelectBox'"
:propsValue="selectValue01"
:itemList="selectValueList01"
:label="'지표종류'"
:textCols="7"
:required="false"
:readonly="true"
@update:propsValue="selectValue01 = $event"
/>
</v-col>
</v-row>
<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="parentPrgmId"
:bindingData="gridName"
:btnActionsFnc="btnActions"
/>
<component
v-show="false"
ref="EgrpPysclQtyPop"
:is="'EgrpPysclQtyPop'"
:parentPrgmId="parentPrgmId"
:item="EgrpPysclQtyPopItem"
:labelContent="'물리량'"
/>
<component
v-show="false"
ref="GdIdxPop"
:is="'GdIdxPop'"
:parentPrgmId="parentPrgmId"
:item="GdIdxPopItem"
:labelContent="'가이드지표'"
/>
</div>
<div class="px-5" style="height:calc(100% - 76px)">
<div ref="gridParent" style="height: calc(35vh);">
<component
:ref="gridName"
:is="loadGrid ? 'Grid' : null"
:gridName="gridName"
:parentPrgmId="parentPrgmId"
@getRowsData="getRowData"
:innerTabGridInfo="innerTabGridInfo"
/>
</div>
</div>
</div>
</template>
<script>
import { mapState, mapMutations, mapActions } from 'vuex';
import Buttons from '~/components/common/button/Buttons';
import Grid from '~/components/common/Grid';
// import Form from '~/components/common/form/Form';
import InputText from '@/components/common/input/InputText';
import SelectBox from '@/components/common/select/SelectBox';
import Utility from '~/plugins/utility';
import mixinGlobal from '@/mixin/global.js';
import EgrpPysclQtyPop from '~/components/common/modal/EgrpPysclQtyPop';
import GdIdxPop from '~/components/common/modal/GdIdxPop';
export default {
mixins: [mixinGlobal],
components: {
Buttons,
Grid,
// Form,
Utility,
InputText,
SelectBox,
EgrpPysclQtyPop,
GdIdxPop,
},
props: {
parentPrgmId: {
type: String,
require: true,
},
innerTabGridInfo: {
type: Object,
default: null,
},
},
data() {
return {
loadGrid: false,
gridName: 'effcInfoGrid',
itemList: [],
tagTpList: [],
// detailList: myDetail,
selectValueList01: [],
selectValue01: null,
EgrpPysclQtyPopItem: {
dataList: [],
openMode: 'ALL',
bindingItemList: {
infoPysclQtyId: 'pysclQtyId',
infoPysclQtyCd: 'pysclQtyCd',
infoPysclQtyNm: 'pysclQtyNm',
infoPysclQtyTpNm: 'pysclQtyTpNm',
infoTotMeth: 'upTotMeth',
infoEqpmGrpId: 'eqpmGrpId',
infoEqpmKindId: 'eqpmKindId',
infoTotMethNm: 'upTotMethNm',
},
},
GdIdxPopItem: {
dataList: [],
bindingItemList: {
infoGdIdxId: 'gdIdxId',
infoGdIdxNm: 'gdIdxNm',
infoTotMeth: 'upTotMeth',
infoTotMethNm: 'upTotMethNm',
infoEqpmGrpId: 'eqpmGrpId',
infoEqpmKindId: 'eqpmKindId',
},
},
eqpmKindList: [],
eqpmGrpList: [],
addCheck: false,
targetElem: '',
gridColumn: [],
};
},
computed: {
...mapState({
pageData(state) {
return state.pageData[this.parentPrgmId];
},
}),
selectedCommCd() {
return this.pageData[this.gridName].data;
},
effcKind() {
return this.pageData.effcKind;
},
infoPysclQtyId() {
return this.pageData.infoPysclQtyId;
},
infoPysclQtyCd() {
return this.pageData.infoPysclQtyCd;
},
infoPysclQtyNm() {
return this.pageData.infoPysclQtyNm;
},
infoPysclQtyTpNm() {
return this.pageData.infoPysclQtyTpNm;
},
infoGdIdxId() {
return this.pageData.infoGdIdxId;
},
infoGdIdxNm() {
return this.pageData.infoGdIdxNm;
},
infoTotMeth() {
return this.pageData.infoTotMeth;
},
infoEqpmGrpId() {
return this.pageData.infoEqpmGrpId;
},
infoEqpmKindId() {
return this.pageData.infoEqpmKindId;
},
infoTotMethNm() {
return this.pageData.infoTotMethNm;
},
initFlag() {
if (this.eqpmKindList.length > 0 && this.eqpmGrpList.length > 0) {
return true;
} else {
return false;
}
},
targetElemDialog() {
return this.targetElem.dialog;
},
},
watch: {
effcKind(val) {
this.selectValue01 = val;
// this.gridInit();
},
innerTabGridInfo(val) {
if (val.tab == 1) {
// this.gridInit();
this.getRowGridData();
}
},
infoPysclQtyId(val) {
// console.log("@@ : ", val)
const dt = {
columnName: 'pysclQtyId',
value: val,
};
this.$refs[this.gridName].getData().filter(item => {
if (item.pysclQtyId == val && item.pysclQtyId != '') {
alert('중복되는 물리량 입니다');
this.$refs[this.gridName].removeRow();
}
});
this.$refs[this.gridName].editingFinish(dt);
},
infoPysclQtyCd(val) {
const dt = {
columnName: 'pysclQtyCd',
value: val,
};
this.$refs[this.gridName].editingFinish(dt);
},
infoPysclQtyNm(val) {
const dt = {
columnName: 'pysclQtyNm',
value: val,
};
this.$refs[this.gridName].editingFinish(dt);
},
infoPysclQtyTpNm(val) {
const dt = {
columnName: 'pysclQtyTpNm',
value: val,
};
this.$refs[this.gridName].editingFinish(dt);
},
infoGdIdxId(val) {
this.$refs[this.gridName].getData().filter(item => {
if (item.gdIdxId == val && item.gdIdxId != '') {
alert('중복되는 가이드지표 입니다');
this.$refs[this.gridName].removeRow();
}
});
const dt = {
columnName: 'gdIdxId',
value: val,
};
this.$refs[this.gridName].editingFinish(dt);
},
infoGdIdxNm(val) {
const dt = {
columnName: 'gdIdxNm',
value: val,
};
this.$refs[this.gridName].editingFinish(dt);
},
infoTotMeth(val) {
const dt = {
columnName: 'totMeth',
value: val,
};
this.$refs[this.gridName].editingFinish(dt);
},
infoTotMethNm(val) {
const dt = {
columnName: 'totMethNm',
value: val,
};
this.$refs[this.gridName].editingFinish(dt);
},
infoEqpmGrpId(val) {
const dt = {
columnName: 'eqpmGrpId',
value: val,
};
this.$refs[this.gridName].editingFinish(dt);
},
infoEqpmKindId(val) {
const dt = {
columnName: 'eqpmKindId',
value: val,
};
this.$refs[this.gridName].editingFinish(dt);
},
async initFlag(val) {
if (val) {
await this.init();
}
},
targetElemDialog(val) {
if (!val) {
if (this.$refs[this.gridName] != undefined) {
//탭 처음 열릴때 오류 방지
var gridData = this.$refs[this.gridName].getData();
if (
gridData[gridData.length - 1].gdIdxId == '' &&
this.targetElem.myModalKey == 'gdIdxPop'
) {
this.$refs[this.gridName].removeRow();
} else if (
gridData[gridData.length - 1].pysclQtyId == '' &&
this.targetElem.myModalKey == 'egrpPysclQtyPop'
) {
this.$refs[this.gridName].removeRow();
}
}
}
},
},
async created() {
this.eqpmKindList = await this.postApiReturn({
apiKey: 'selectEmsEqpmKindList',
resKey: 'eqpmGrpPysclQtyMngData',
sendParam: {},
});
this.eqpmGrpList = await this.postApiReturn({
apiKey: 'selectEqpmGrp',
resKey: 'eqpmGrpData',
sendParam: {},
});
},
mounted() {
// this.init();
},
methods: {
...mapMutations({
setPageData: 'setPageData',
setGridData: 'setGridData',
setGridColumn: 'setGridColumn',
setGridOption: 'setGridOption',
setGridSelectData: 'setGridSelectData',
}),
...mapActions({
postApi: 'modules/list/postApi',
postUpdateApi: 'modules/list/postUpdateApi',
postApiReturn: 'modules/list/postApiReturn',
setTree: 'modules/list/setTree',
chkOpenTabList: 'chkOpenTabList',
getCodeList: 'modules/search/getCodeList',
}),
async init() {
await this.setSelectValueList01();
await this.gridInit();
},
search() {},
async setSelectValueList01() {
this.selectValueList01 = [
{
text: '물리량',
value: 'PYSCL',
},
{
text: '가이드지표',
value: 'GD_IDX',
},
];
this.selectValue01 = this.pageData.effcKind;
},
async gridInit() {
const gridHeight = this.$refs.gridParent.offsetHeight - 30;
// this.loadGrid = false;
const myOptions = {
columnOptions: {
resizable: true,
},
// bodyHeight: gridHeight,
// minBodyHeight: gridHeight,
// header: {
// height: 28,
// },
// rowHeight: 29,
// minRowHeight: 29,
// selectionUnit: 'row',
// editingEvent: 'click',
};
this.setGridOption({
gridKey: this.gridName,
value: Object.assign(Utility.defaultGridOption(gridHeight), myOptions),
});
const _this = this;
let useFgSelectList = [];
let myColumns = [
{
header: '대상설비종류',
name: 'eqpmKindId',
formatter({ value }) {
var retVal = '';
const newValue = _this.eqpmKindList.filter(
item => item.eqpmKindId == value,
);
if (newValue.length > 0) {
retVal = newValue[0].eqpmKindNm;
}
return retVal;
},
},
{
header: '대상설비그룹',
name: 'eqpmGrpId',
formatter({ value }) {
var retVal = '';
const newValue = _this.eqpmGrpList.filter(
item => item.eqpmGrpId == value,
);
if (newValue.length > 0) {
retVal = newValue[0].eqpmGrpNm;
}
return retVal;
},
},
{
header: '물리량ID',
name: 'pysclQtyId',
width: 200,
align: 'center',
hidden: true,
},
{ header: '물리량', name: 'pysclQtyCd', hidden: true, minWidth: 200 },
{ header: '물리량명', name: 'pysclQtyNm', hidden: true },
{ header: '물리량타입', name: 'pysclQtyTpNm', hidden: true },
{ header: '가이드지표', name: 'gdIdxId', hidden: true },
{ header: '가이드지표명', name: 'gdIdxNm', hidden: true },
{ header: '집계방법', name: 'totMeth', hidden: true },
{ header: '집계방법', name: 'totMethNm', align: 'center' },
];
if (this.selectValue01 == 'PYSCL') {
myColumns[2].hidden = false;
myColumns[3].hidden = false;
myColumns[4].hidden = false;
myColumns[5].hidden = false;
myColumns[6].hidden = true;
myColumns[7].hidden = true;
this.targetElem = this.$refs.EgrpPysclQtyPop;
} else {
this.targetElem = this.$refs.GdIdxPop;
myColumns[2].hidden = true;
myColumns[3].hidden = true;
myColumns[4].hidden = true;
myColumns[5].hidden = true;
myColumns[6].hidden = false;
myColumns[7].hidden = false;
}
this.gridColumn = myColumns;
this.setGridColumn({
gridKey: this.gridName,
value: myColumns,
});
await this.getRowGridData();
// this.$nextTick(() => {
// this.loadGrid = true;
// });
},
async getRowGridData() {
var myColumns = this.gridColumn;
this.loadGrid = false;
var apiKey =
this.selectValue01 == 'PYSCL' ? 'selectPysclList' : 'selectGdiList';
if (this.selectValue01 == 'PYSCL') {
myColumns[2].hidden = false;
myColumns[3].hidden = false;
myColumns[4].hidden = false;
myColumns[5].hidden = false;
myColumns[6].hidden = true;
myColumns[7].hidden = true;
this.targetElem = this.$refs.EgrpPysclQtyPop;
} else {
this.targetElem = this.$refs.GdIdxPop;
myColumns[2].hidden = true;
myColumns[3].hidden = true;
myColumns[4].hidden = true;
myColumns[5].hidden = true;
myColumns[6].hidden = false;
myColumns[7].hidden = false;
}
this.setGridColumn({
gridKey: this.gridName,
value: myColumns,
});
var res = await this.postApiReturn({
apiKey: apiKey,
resKey: 'effcIdxInfoData',
sendParam: {
effcIdxId: this.pageData.effcIdxId,
},
});
var newRes = [];
if (res.length > 0) {
newRes = res.map(item => {
return {
...item,
rowStat: null,
};
});
}
this.setGridData({
gridKey: this.gridName,
value: newRes,
});
// this.$nextTick(() => {
this.loadGrid = true;
// });
},
async getRowData(data) {
if (this.addCheck) {
this.setPageData({
infoPysclQtyId: data.pysclQtyId,
infoPysclQtyCd: data.pysclQtyCd,
infoPysclQtyNm: data.pysclQtyNm,
infoPysclQtyTpNm: data.pysclQtyTpNm,
infoGdIdxId: data.gdIdxId,
infoGdIdxNm: data.gdIdxNm,
infoTotMeth: data.totMeth,
infoEqpmGrpId: data.eqpmGrpId,
infoEqpmKindId: data.eqpmKindId,
});
this.addCheck = false;
}
},
async btnActions(action) {
let dataArr = [];
switch (action) {
case 'add':
var defaultRow = {
eqpmKindId: '',
eqpmGrpId: '',
pysclQtyId: '',
pysclQtyCd: '',
pysclQtyNm: '',
pysclQtyTpNm: '',
upTotMeth: null,
gdIdxId: '',
gdidxNm: '',
rowStat: null,
};
if (this.targetElem.myModalKey == 'gdIdxPop') {
this.GdIdxPopItem['dataList'] = this.$refs[this.gridName]
.getData()
.map(item => {
return item.gdIdxId;
});
} else if (this.targetElem.myModalKey == 'egrpPysclQtyPop') {
this.EgrpPysclQtyPopItem['dataList'] = this.$refs[this.gridName]
.getData()
.map(item => {
return item.pysclQtyId;
});
}
this.$refs[this.gridName].addRow(defaultRow);
this.addCheck = true;
this.$nextTick(() => {
this.$refs[this.gridName].focus({
rowKey: this.$refs[this.gridName].getData().length - 1,
setScroll: true,
});
});
// var targetElem;
// if(this.selectValue01 == 'PYSCL'){
// targetElem = this.$refs.EgrpPysclQtyPop;
// }else{
// targetElem = this.$refs.GdIdxPop;
// }
this.targetElem.dialogOpenCloseEvent(this.targetElem.dialog);
break;
case 'remove':
this.$refs[this.gridName].removeRow();
break;
case 'save':
// this.loadGrid = false;
dataArr = this.$refs[this.gridName].save();
if (dataArr.length > 0) {
const sendParam = {
datas: {
dsArg: dataArr.map(item => ({
...item,
useFg: item.useFg === true ? '1' : '0',
effcIdxId: this.pageData.effcIdxId,
})),
},
params: {},
};
await this.postUpdateApi({
apiKey: 'saveArgList',
sendParam: sendParam,
});
// this.setPageData({ isFind: true });
this.setPageData({
tabSaveCheck: true,
});
await this.getRowGridData();
// this.loadGrid = true;
} else {
alert('저장할 내용이 없습니다.');
}
break;
default:
break;
}
},
gridEditingFinish(data) {
this.$refs[this.gridName].editingFinish(data);
},
},
};
</script>

View File

@ -0,0 +1,396 @@
<template>
<div>
<div
class="d-flex justify-space-between align-center"
style="height: 80px;"
>
<span class="txt">설비 추가 정보</span>
<Buttons
:parentPrgmId="parentPrgmId"
:bindingData="gridName"
:btnActionsFnc="btnActions"
/>
</div>
<div ref="gridParent" style="height: calc(100vh - 520px);">
<Grid
:ref="gridName"
:is="loadGrid ? 'Grid' : null"
:gridName="gridName"
:parentPrgmId="parentPrgmId"
:editorGrid="true"
:innerTabGridInfo="innerTabGridInfo"
@getRowsData="getRowData"
/>
</div>
</div>
</template>
<script>
import { mapState, mapMutations, mapActions } from 'vuex';
import Buttons from '~/components/common/button/Buttons';
import Grid from '~/components/common/Grid';
import InputText from '~/components/common/input/InputText';
import Form from '~/components/common/form/Form';
import mixinGlobal from '@/mixin/global.js';
export default {
mixins: [mixinGlobal],
components: {
Buttons,
Grid,
InputText,
Form,
},
props: {
parentPrgmId: {
type: String,
require: true,
},
innerTabGridInfo: {
type: Object,
default: null,
},
},
data() {
return {
loadGrid: false,
gridName: 'rowDetailGrid',
rowKey: null,
edtingFinishFlag: 'Y',
};
},
computed: {
...mapState({
pageData(state) {
return state.pageData[this.parentPrgmId];
},
}),
selectedCommCd() {
return this.pageData[this.gridName].data;
},
myUseFgList() {
return this.pageData.useFgList;
},
selectedComId() {
return this.pageData.rowGridSelectData.comId;
},
selectedBlocId() {
return this.pageData.rowGridSelectData.blocId;
},
selectedEqpmId() {
return this.pageData.rowGridSelectData.eqpmId;
},
},
mounted() {
this.init();
},
methods: {
...mapMutations({
setPageData: 'setPageData',
setGridData: 'setGridData',
setGridColumn: 'setGridColumn',
setGridOption: 'setGridOption',
}),
...mapActions({
postApi: 'modules/list/postApi',
postUpdateApi: 'modules/list/postUpdateApi',
postApiReturn: 'modules/list/postApiReturn',
setTree: 'modules/list/setTree',
chkOpenTabList: 'chkOpenTabList',
}),
init() {
this.gridInit();
},
gridInit() {
const gridHeight = this.$refs.gridParent.offsetHeight - 30;
const myOptions = {
columnOptions: {
resizable: true,
},
bodyHeight: gridHeight,
minBodyHeight: gridHeight,
header: {
height: 28,
},
rowHeight: 29,
minRowHeight: 29,
selectionUnit: 'row',
editingEvent: 'click',
};
this.setGridOption({
gridKey: this.gridName,
value: myOptions,
});
let addInfoList = [];
this.pageData.addInfoList.forEach(item => {
const it = { text: item.addInfoNm, value: item.addInfoId };
addInfoList.push(it);
});
let addInfoDataKindList = [];
this.pageData.addInfoDataKindList.forEach(item => {
const it = { text: item.commCdNm, value: item.commCd };
addInfoDataKindList.push(it);
});
class CustomRenderer {
constructor(props) {
//const { min, max } = props.columnInfo.renderer.options;
//console.log('props: %o', props);
const el = document.createElement('input');
if (
props.grid.store.data.rawData[props.rowKey].addInfoDataKind == 'FG'
) {
el.type = 'checkbox';
} else {
el.type = 'text';
$(el).addClass('tui-grid-cell-content');
$(el).css('text-align', 'center');
}
// el.min = String(min);
//el.max = String(max);
//el.disabled = true;
this.el = el;
this.render(props);
}
getElement() {
return this.el;
}
render(props) {
if (this.el.type == 'checkbox') {
if (props.value == 1) {
this.el.checked = true;
} else {
this.el.checked = false;
}
}
this.el.value = props.value;
}
}
class CustomEditor {
constructor(props) {
const el = document.createElement('input');
if (
props.grid.store.data.rawData[props.rowKey].addInfoDataKind == 'FG'
) {
el.type = 'checkbox';
if (props.value == 1) {
el.checked = true;
} else {
el.checked = false;
}
el.addEventListener('change', this.change);
} else {
el.type = 'text';
if (props.formattedValue == 'NUM') {
el.oninput = function(event) {
var regExp=/[^0-9]/g;
if(event.data != null){
if(event.data.match(regExp)){
event.target.value = event.target.value.replace(regExp, '');
}
}
};
}
$(el).addClass('tui-grid-content-text');
}
this.el = el;
this.render(props);
}
change(ev) {
//console.log('props: %o', ev);
if (ev.target.checked) {
ev.target.value = 1;
} else {
ev.target.value = 0;
}
}
getElement() {
return this.el;
}
getValue() {
return this.el.value;
}
render(props) {
if (this.el.type == 'checked') {
this.el.value = props.value;
} else {
this.el.value = String(props.value);
// this.el.value = '';
}
//console.log('props: %o', props);
}
mounted() {
if (this.el.type == 'checkbox') {
$(this.el.parentElement).css('text-align', 'center');
}
this.el.select();
}
}
const myColumns = [
{ header: '회사 ID', name: 'comId', hidden: true },
{ header: '설비 번호', name: 'eqpmId', hidden: true },
{
header: '추가 정보',
name: 'addInfoId',
align: 'left',
formatter({ value }) {
let retVal = '';
const newValue = addInfoList.filter(item => item.value == value);
if (newValue.length > 0) {
retVal = newValue[0].text;
}
return retVal;
},
},
{
header: 'Data 구분',
name: 'addInfoDataKind',
align: 'center',
formatter({ value }) {
let retVal = '';
const newValue = addInfoDataKindList.filter(
item => item.value == value,
);
if (newValue.length > 0) {
retVal = newValue[0].text;
}
return retVal;
},
},
{
header: '숫자 값',
name: 'addInfoNumVal',
align: 'right',
editor: 'text',
hidden: true,
},
{
header: '문자 값',
name: 'addInfoTxtVal',
align: 'left',
editor: 'text',
hidden: true,
},
{
header: '추가 정보 값',
name: 'addInfoVal',
align: 'center',
renderer: {
type: CustomRenderer,
},
editor: {
type: CustomEditor,
align: 'center',
},
formatter(data) {
// console.log('test :', test);
return data.row.addInfoDataKind;
},
},
//{ header: "추가 정보 값", name: "addInfoVal", align: "center" , editor: "text",
//},
/*{
header: "사용여부",
name: "useFg",
align: "center",
formatter({ value }) {
return value == "1" ? "사용" : "사용안함";
},
editor: {
type: "select",
options: {
listItems: [
{text:"사용", value:"1"},
{text:"사용안함", value:"0"},
]
}
}
},*/
{ header: '등록 사용자', name: 'regUserNo', hidden: true },
{ header: '등록 일자', name: 'regDttm', hidden: true },
{ header: '수정 사용자', name: 'procUserNo', hidden: true },
{ header: '수정 일자', name: 'procDttm', hidden: true },
];
this.setGridColumn({
gridKey: this.gridName,
value: myColumns,
});
this.loadGrid = true;
},
async btnActions(action) {
let dataArr = [];
switch (action) {
case 'add':
this.$refs[this.gridName].addRow();
this.edtingFinishFlag = 'Y';
break;
case 'remove':
this.$refs[this.gridName].removeRow();
this.edtingFinishFlag = 'N';
break;
case 'save':
if (this.edtingFinishFlag == 'Y') {
await this.$refs[this.gridName].editingFinish({
rowKey: this.rowKey,
});
}
dataArr = this.$refs[this.gridName].save();
for (var i = 0; i < dataArr.length; i++) {
if (
dataArr[i].addInfoDataKind == 'NUM' &&
dataArr[i].addInfoVal == ''
) {
dataArr[i].addInfoVal = null;
}
}
if (dataArr.length > 0) {
const sendParam = {
datas: {
dsReadPlcAddInfo: dataArr.map(item => ({
...item,
comId: this.selectedComId,
eqpmId: this.selectedEqpmId,
})),
},
params: {},
};
await this.postUpdateApi({
apiKey: 'saveEqpmAddInfoList',
sendParam: sendParam,
});
this.setPageData({ isFind: true });
this.edtingFinishFlag = 'Y';
} else {
alert('저장할 내용이 없습니다.');
}
break;
default:
break;
}
},
search() {},
async getRowData(data) {
this.rowKey = data.rowKey;
this.edtingFinishFlag = 'Y';
},
},
};
</script>

View File

@ -0,0 +1,421 @@
<template>
<div>
<div
class="d-flex justify-space-between align-center"
style="height: 80px;"
>
<span class="txt">설비 상수 정보</span>
<Buttons
:parentPrgmId="parentPrgmId"
:bindingData="gridName"
:btnActionsFnc="btnActions"
/>
</div>
<div ref="gridParent" style="height: calc(100vh - 800px);">
<Grid
:ref="gridName"
:is="loadGrid ? 'Grid' : null"
:gridName="gridName"
:parentPrgmId="parentPrgmId"
@getRowsData="getRowData"
:innerTabGridInfo="innerTabGridInfo"
/>
</div>
<div style="height: calc(100vh - 900px);">
<component
:is="'Form'"
:parentPrgmId="parentPrgmId"
:bindingData="gridName"
:detailList="detailList"
@gridEditingFinish="gridEditingFinish"
/>
</div>
</div>
</template>
<script>
import { mapState, mapMutations, mapActions } from 'vuex';
import Buttons from '~/components/common/button/Buttons';
import Grid from '~/components/common/Grid';
import InputText from '~/components/common/input/InputText';
import Form from '~/components/common/form/Form';
import mixinGlobal from '@/mixin/global.js';
export default {
mixins: [mixinGlobal],
components: {
Buttons,
Grid,
InputText,
Form,
},
props: {
parentPrgmId: {
type: String,
require: true,
},
innerTabGridInfo: {
type: Object,
default: null,
},
},
data() {
return {
loadGrid: false,
gridName: 'rowEqpmConstGrid',
detailList: myEqpmConstDetail,
inputList_emMapDiv: [],
inputList_cmInOut: [],
};
},
computed: {
...mapState({
pageData(state) {
return state.pageData[this.parentPrgmId];
},
}),
// selectedCommCd() {
// return this.pageData[this.gridName].data;
// },
selectedBlocId() {
return this.pageData.rowGridSelectData.blocId;
},
selectedEqpmIaoId() {
return this.pageData.rowGridSelectData.eqpmId;
},
selectedComId() {
return this.pageData.rowGridSelectData.comId;
},
selectedEqpmKindId() {
return this.pageData.rowGridSelectData.eqpmKindId;
},
selectedEqpmGrpId() {
return this.pageData.rowGridSelectData.eqpmGrpId;
},
// myUseFgList() {
// return this.pageData.useFgList;
// },
},
watch: {
selectedEqpmKindId(val) {
if (val) {
this.detailList[2].eqpmKindId = val;
}
},
selectedEqpmGrpId(val){
// if(!val){
// this.detailList[2].eqpmGrpId = '';
// }else{
// this.detailList[2].eqpmGrpId = val;
// }
// if(val){
// this.detailList[2].eqpmGrpId = val;
// }
// else if(val == null || val == ''){
// this.detailList[2].eqpmGrpId = '';
// }
},
},
mounted() {
this.init();
},
methods: {
...mapMutations({
setPageData: 'setPageData',
setGridData: 'setGridData',
setGridColumn: 'setGridColumn',
setGridOption: 'setGridOption',
setGridSelectData: 'setGridSelectData',
}),
...mapActions({
postApi: 'modules/list/postApi',
postUpdateApi: 'modules/list/postUpdateApi',
postApiReturn: 'modules/list/postApiReturn',
setTree: 'modules/list/setTree',
chkOpenTabList: 'chkOpenTabList',
}),
init() {
this.gridInit();
},
gridInit() {
const gridHeight = this.$refs.gridParent.offsetHeight - 30;
const myOptions = {
columnOptions: {
resizable: true,
},
bodyHeight: gridHeight,
minBodyHeight: gridHeight,
header: {
height: 28,
},
rowHeight: 29,
minRowHeight: 29,
selectionUnit: 'row',
editingEvent: 'click',
};
this.setGridOption({
gridKey: this.gridName,
value: myOptions,
});
const _this = this;
const myColumns = [
{ header: '회사 ID', name: 'comId', hidden: true },
{ header: '설비 번호', name: 'eqpmId', hidden: true },
// { header: '대상항목', name: 'objId', align: 'center', hidden: true},
{ header: '물리량 ID', name: 'pysclQtyId', align: 'left' },
{ header: '물리량 명', name: 'pysclQtyNm', align: 'left' },
{ header: '물리량값', name: 'pysclQtyVal', align: 'left' },
// { header: '대상항목', name: 'objNm', align: 'left'},
{ header: '대상항목', name: 'objId', align: 'left' },
{
header: '에너지원 명',
name: 'ercId',
align: 'left',
hidden: true,
formatter({ value }) {
var retVal = '';
for (var i = 0; i < _this.pageData.ercNmList.length; i++) {
if (_this.pageData.ercNmList[i].value === value) {
retVal = _this.pageData.ercNmList[i].text;
}
}
return retVal;
},
},
{
header: '대상 유형',
name: 'objKind',
align: 'center',
hidden: true,
formatter({ value }) {
var retVal = '';
for (var i = 0; i < _this.pageData.emMapDivList.length; i++) {
if (_this.pageData.emMapDivList[i].commCd === value) {
retVal = _this.pageData.emMapDivList[i].commCdNm;
}
}
return retVal;
},
},
{
header: 'inProdKind',
name: 'inProdKind',
align: 'left',
hidden: true,
},
{ header: 'blocId', name: 'blocId', align: 'left', hidden: true },
{
header: '계산여부',
name: 'calcFg',
align: 'center',
hidden: true,
formatter({ value }) {
value = value === true ? '1' : '0';
const newValue = _this.pageData.useFgList.filter(
item => item.commCd == value,
);
return newValue[0].commCdNm;
},
},
{ header: '분배율', name: 'distRt', align: 'right', hidden: true },
{ header: '등록 사용자', name: 'regUserNo', hidden: true },
{ header: '등록 일자', name: 'regDttm', hidden: true },
{ header: '수정 사용자', name: 'procUserNo', hidden: true },
{ header: '수정 일자', name: 'procDttm', hidden: true },
{ header: 'rowStat', name: 'rowStat', hidden: true },
];
this.setGridColumn({
gridKey: this.gridName,
value: myColumns,
});
this.loadGrid = true;
},
async getRowData(data, gridName) {
if (data.rowStat === 'I') {
this.detailList[2].disabled = false;
this.detailList[3].disabled = false;
} else {
this.detailList[2].disabled = true;
this.detailList[3].disabled = true;
}
this.setGridSelectData({
gridKey: gridName,
gridSelect: true,
rowGridSelectKey: data.rowKey,
rowGridSelectData: Object.assign({}, data),
});
},
async btnActions(action) {
let dataArr = [];
switch (action) {
case 'add':
this.$refs[this.gridName].addRow();
this.detailList[2].disabled = false;
this.detailList[3].disabled = false;
break;
case 'remove':
this.detailList[2].disabled = true;
this.detailList[3].disabled = true;
this.$refs[this.gridName].removeRow();
break;
case 'save':
dataArr = this.$refs[this.gridName].save();
var validCheck = true;
var gridInstance = this.$refs[this.gridName];
var gridData = gridInstance.getData();
// check duplicate of pysclQtyId
if (checkDuplicate(gridData, 'pysclQtyId')) {
alert('물리량 값이 중복되었습니다.');
break;
}
if (dataArr.length > 0) {
var requiredKeyList = this.detailList
.filter(item => {
return item.class != 'py-2 d-none' && item.required == true;
})
.map(item => {
return item.valueNm;
});
dataArr.map(item => {
for (var key of Object.keys(item)) {
console.log('key : ', key);
console.log('item[key] : ', item[key]);
if (!item[key] && requiredKeyList.includes(key)) {
validCheck = false;
}
}
});
if (validCheck) {
const sendParam = {
datas: {
dsEqpmIao: dataArr.map(item => ({
...item,
comId: this.selectedComId,
blocId: this.selectedBlocId,
eqpmId: this.selectedEqpmIaoId,
calcFg: item.calcFg == true ? '1' : '0',
})),
},
params: {},
};
await this.postUpdateApi({
apiKey: 'saveEqpmIao',
sendParam: sendParam,
});
this.setPageData({ isFind: true });
} else {
alert('필수 입력값을 입력해주세요');
}
} else {
alert('저장할 내용이 없습니다.');
}
break;
default:
break;
}
},
gridEditingFinish(data, bindingData) {
this.$refs[this.gridName].editingFinish(data);
},
search() {},
},
};
function checkDuplicate(data, targetKey) {
var duplicateFlag = false;
var set = new Set();
for (var row of data) {
if (set.has(row[targetKey])) {
duplicateFlag = true;
break;
} else {
if (row[targetKey]) {
set.add(row[targetKey]);
}
}
}
return duplicateFlag;
}
const myEqpmConstDetail = [
{
type: 'SelectBox',
label: '대상 유형',
disabled: true,
cols: 6,
class: 'py-2',
list: 'emMapDivList2',
valueNm: 'objKind',
itemText: 'commCdNm',
itemValue: 'commCd',
required: true,
disabled: true,
},
{
// 공백 처리
type: 'Label',
cols: 6,
class: 'py-2',
disabled: true,
},
{
type: 'EgrpPysclQtyPop',
labelContent: '물리량',
modalTitle: '물리량 선택',
bindingItemList: {
objId: 'pysclQtyId',
objNm: 'pysclQtyNm',
pysclQtyId: 'pysclQtyId',
pysclQtyNm: 'pysclQtyNm',
},
valueNm: 'objId',
disabled: false,
required: true,
openMode: 'CONST',
cols: 6,
class: 'py-2',
eqpmGrpDisableFlag:true,
// eqpmGrpId:''
},
{
type: 'InputText',
valueNm: 'pysclQtyNm',
disabled: true,
readonly: true,
cols: 5,
class: 'py-2',
align: 'right',
// class: 'py-2 d-none',
},
{
type: 'InputText',
label: '물리량 값',
valueNm: 'pysclQtyVal',
disabled: false,
cols: 6,
class: 'py-2',
align: 'right',
inputType: 'number',
min: 0,
max: 100,
required: true,
},
];
</script>

View File

@ -0,0 +1,559 @@
<template>
<div>
<div
class="d-flex justify-space-between align-center"
style="height: 80px;"
>
<span class="txt">설비 입출력 정보</span>
<Buttons
:parentPrgmId="parentPrgmId"
:bindingData="gridName"
:btnActionsFnc="btnActions"
/>
</div>
<div ref="gridParent" style="height: calc(100vh - 800px);">
<Grid
:ref="gridName"
:is="loadGrid ? 'Grid' : null"
:gridName="gridName"
:parentPrgmId="parentPrgmId"
@getRowsData="getRowData"
:innerTabGridInfo="innerTabGridInfo"
/>
</div>
<div style="height: calc(100vh - 900px);">
<component
:is="'Form'"
:parentPrgmId="parentPrgmId"
:bindingData="gridName"
:detailList="detailList"
@gridEditingFinish="gridEditingFinish"
/>
</div>
</div>
</template>
<script>
import { mapState, mapMutations, mapActions } from 'vuex';
import Buttons from '~/components/common/button/Buttons';
import Grid from '~/components/common/Grid';
import InputText from '~/components/common/input/InputText';
import Form from '~/components/common/form/Form';
import mixinGlobal from '@/mixin/global.js';
export default {
mixins: [mixinGlobal],
components: {
Buttons,
Grid,
InputText,
Form,
},
props: {
parentPrgmId: {
type: String,
require: true,
},
innerTabGridInfo: {
type: Object,
default: null,
},
},
data() {
return {
loadGrid: false,
gridName: 'rowEqpmIaoGrid',
detailList: myEqpmIaoDetail,
inputList_emMapDiv: [],
inputList_cmInOut: [],
};
},
computed: {
...mapState({
pageData(state) {
return state.pageData[this.parentPrgmId];
},
}),
// selectedCommCd() {
// return this.pageData[this.gridName].data;
// },
selectedBlocId() {
return this.pageData.rowGridSelectData.blocId;
},
selectedEqpmIaoId() {
return this.pageData.rowGridSelectData.eqpmId;
},
selectedComId() {
return this.pageData.rowGridSelectData.comId;
},
// myUseFgList() {
// return this.pageData.useFgList;
// },
selectedObjId() {
if (this.pageData.rowEqpmIaoGrid.rowGridSelectData === null) {
return '';
} else {
return this.pageData.rowEqpmIaoGrid.rowGridSelectData.objKind;
}
},
selectedCalcFg() {
if (this.pageData.rowEqpmIaoGrid.rowGridSelectData === null) {
return '';
} else {
return this.pageData.rowEqpmIaoGrid.rowGridSelectData.calcFg;
}
},
selectedEqpmKindId() {
return this.pageData.rowGridSelectData.eqpmKindId;
},
selectedEqpmGrpId() {
return this.pageData.rowGridSelectData.eqpmGrpId;
},
},
watch: {
selectedObjId(val) {
console.log('selectedObjId : ', val);
if (val === 'TAG') {
this.detailList[2].class = 'py-2 d-none';
this.detailList[3].class = 'py-2 d-none';
this.detailList[4].class = 'py-2';
this.detailList[5].class = 'py-2';
} else {
// }else if(val==="READ_PLC"){
this.detailList[5].class = 'py-2 d-none';
this.detailList[4].class = 'py-2 d-none';
this.detailList[3].class = 'py-2';
this.detailList[2].class = 'py-2';
}
},
selectedCalcFg(val) {
if (val === true) {
this.detailList[6].required = true;
this.detailList[7].required = true;
} else {
this.detailList[6].required = false;
this.detailList[7].required = false;
}
},
selectedEqpmKindId(val) {
if (val) {
this.detailList[10].eqpmKindId = val;
}
},
selectedEqpmGrpId(val) {
// console.log('selectedEqpmGrpId : ', val);
// if (!val) {
// this.detailList[10].eqpmGrpId = '';
// } else {
// this.detailList[10].eqpmGrpId = val;
// }
// if(val){
// this.detailList[10].eqpmGrpId = val;
// }
// else if(val == null || val == ''){
// this.detailList[10].eqpmGrpId = '';
// }
},
},
mounted() {
this.init();
},
methods: {
...mapMutations({
setPageData: 'setPageData',
setGridData: 'setGridData',
setGridColumn: 'setGridColumn',
setGridOption: 'setGridOption',
setGridSelectData: 'setGridSelectData',
}),
...mapActions({
postApi: 'modules/list/postApi',
postUpdateApi: 'modules/list/postUpdateApi',
postApiReturn: 'modules/list/postApiReturn',
setTree: 'modules/list/setTree',
chkOpenTabList: 'chkOpenTabList',
}),
init() {
this.gridInit();
},
gridInit() {
const gridHeight = this.$refs.gridParent.offsetHeight - 30;
const myOptions = {
columnOptions: {
resizable: true,
},
bodyHeight: gridHeight,
minBodyHeight: gridHeight,
header: {
height: 28,
},
rowHeight: 29,
minRowHeight: 29,
selectionUnit: 'row',
editingEvent: 'click',
};
this.setGridOption({
gridKey: this.gridName,
value: myOptions,
});
// let addInfoDataKindList = [];
// this.pageData.addInfoDataKindList.forEach(item => {
// const it = { text: item.commCdNm, value: item.commCd };
// addInfoDataKindList.push(it);
// });
const _this = this;
const myColumns = [
{ header: '회사 ID', name: 'comId', hidden: true },
{ header: '설비 번호', name: 'eqpmId', hidden: true },
{ header: '대상항목', name: 'objId', align: 'center', hidden: true },
{ header: '대상항목', name: 'objNm', align: 'left', width: 350 },
{
header: '에너지원 명',
name: 'ercId',
align: 'left',
formatter({ value }) {
var retVal = '';
for (var i = 0; i < _this.pageData.ercNmList.length; i++) {
if (_this.pageData.ercNmList[i].value === value) {
retVal = _this.pageData.ercNmList[i].text;
}
}
return retVal;
},
},
{
header: '대상 유형',
name: 'objKind',
align: 'center',
formatter({ value }) {
var retVal = '';
for (var i = 0; i < _this.pageData.emMapDivList.length; i++) {
if (_this.pageData.emMapDivList[i].commCd === value) {
retVal = _this.pageData.emMapDivList[i].commCdNm;
}
}
return retVal;
},
},
{ header: '물리량', name: 'pysclQtyId', align: 'left', hidden: true },
{ header: '물리량', name: 'pysclQtyNm', align: 'left' },
{
header: '물리량값',
name: 'pysclQtyVal',
align: 'left',
hidden: true,
},
{
header: 'inProdKind',
name: 'inProdKind',
align: 'left',
hidden: true,
},
{ header: 'blocId', name: 'blocId', align: 'left', hidden: true },
{
header: '계산여부',
name: 'calcFg',
align: 'center',
formatter({ value }) {
value = value === true ? '1' : '0';
const newValue = _this.pageData.useFgList.filter(
item => item.commCd == value,
);
return newValue[0].commCdNm;
},
},
{ header: '분배율', name: 'distRt', align: 'right' },
{ header: '등록 사용자', name: 'regUserNo', hidden: true },
{ header: '등록 일자', name: 'regDttm', hidden: true },
{ header: '수정 사용자', name: 'procUserNo', hidden: true },
{ header: '수정 일자', name: 'procDttm', hidden: true },
{ header: 'rowStat', name: 'rowStat', hidden: true },
];
this.setGridColumn({
gridKey: this.gridName,
value: myColumns,
});
this.loadGrid = true;
},
async getRowData(data, gridName) {
if (data.rowStat === 'I') {
this.detailList[0].disabled = false;
this.detailList[2].disabled = false;
this.detailList[3].disabled = false;
this.detailList[4].disabled = false;
this.detailList[5].disabled = false;
} else {
this.detailList[0].disabled = true;
this.detailList[2].disabled = true;
this.detailList[3].disabled = true;
this.detailList[4].disabled = true;
this.detailList[5].disabled = true;
}
this.setGridSelectData({
gridKey: gridName,
gridSelect: true,
rowGridSelectKey: data.rowKey,
rowGridSelectData: Object.assign({}, data),
});
},
async btnActions(action) {
let dataArr = [];
switch (action) {
case 'add':
this.$refs[this.gridName].addRow();
this.detailList[0].disabled = false;
this.detailList[2].disabled = false;
this.detailList[3].disabled = false;
this.detailList[4].disabled = false;
this.detailList[5].disabled = false;
break;
case 'remove':
this.$refs[this.gridName].removeRow();
this.detailList[0].disabled = true;
this.detailList[2].disabled = true;
this.detailList[3].disabled = true;
this.detailList[4].disabled = true;
this.detailList[5].disabled = true;
break;
case 'save':
dataArr = this.$refs[this.gridName].save();
var validCheck = true;
var gridInstance = this.$refs[this.gridName];
var gridData = gridInstance.getData();
// check duplicate of pysclQtyId
if (checkDuplicate(gridData, 'pysclQtyId')) {
alert('물리량 값이 중복되었습니다.');
break;
}
if (dataArr.length > 0) {
console.log('dataArr : ', dataArr);
var requiredKeyList = this.detailList
.filter(item => {
return item.class != 'py-2 d-none' && item.required == true;
})
.map(item => {
return item.valueNm;
});
dataArr.map(item => {
for (var key of Object.keys(item)) {
// calcFg는 체크해제시에 입력값이 false로 들어가있어서 제외
if (
!item[key] &&
requiredKeyList.includes(key) &&
key != 'calcFg'
) {
validCheck = false;
}
}
});
if (validCheck) {
const sendParam = {
datas: {
dsEqpmIao: dataArr.map(item => ({
...item,
comId: this.selectedComId,
blocId: this.selectedBlocId,
eqpmId: this.selectedEqpmIaoId,
calcFg: item.calcFg == true ? '1' : '0',
pysclQtyId: item.pysclQtyId ? item.pysclQtyId : '',
})),
},
params: {},
};
await this.postUpdateApi({
apiKey: 'saveEqpmIao',
sendParam: sendParam,
});
this.setPageData({ isFind: true });
} else {
alert('필수 입력값을 입력해주세요');
}
} else {
alert('저장할 내용이 없습니다.');
}
break;
default:
break;
}
},
gridEditingFinish(data, bindingData) {
this.$refs[this.gridName].editingFinish(data);
},
search() {},
},
};
function checkDuplicate(data, targetKey) {
var duplicateFlag = false;
var set = new Set();
for (var row of data) {
if (set.has(row[targetKey])) {
duplicateFlag = true;
break;
} else {
if (row[targetKey]) {
set.add(row[targetKey]);
}
}
}
return duplicateFlag;
}
const myEqpmIaoDetail = [
{
type: 'SelectBox',
label: '대상 유형',
disabled: false,
cols: 6,
class: 'py-2',
list: 'emMapDivList',
valueNm: 'objKind',
itemText: 'commCdNm',
itemValue: 'commCd',
required: true,
disabled: false,
},
{
// 공백 처리
type: 'Label',
cols: 6,
class: 'py-2',
disabled: true,
},
{
type: 'ReadPlcPop',
label: '대상 항목',
valueNm: 'objId',
disabled: true,
cols: 6,
class: 'py-2',
required: true,
bindNm: 'objNm',
},
{
type: 'InputText',
valueNm: 'objNm',
readonly: true,
disabled: true,
cols: 5,
class: 'py-2',
},
{
type: 'EvtObjPop',
labelContent: '대상 항목',
valueNm: 'objId',
valueNm2: 'objNm',
bindNm: 'objNm',
disabled: true,
required: true,
cols: 6,
class: 'py-2 d-none',
labelCols: 4,
textCols: 7,
disableContent: true,
},
{
type: 'InputText',
cols: 5,
class: 'py-2 d-none',
valueNm: 'objNm',
readonly: true,
disabled: true,
},
{
type: 'SelectBox',
label: '에너지원',
disabled: false,
cols: 6,
class: 'py-2',
list: 'ercNmList',
valueNm: 'ercId',
itemText: 'text',
itemValue: 'value',
required: false,
},
{
type: 'SelectBox',
label: '투입생산유형',
disabled: false,
cols: 6,
class: 'py-2',
list: 'cmInoutList',
valueNm: 'inProdKind',
itemText: 'commCdNm',
itemValue: 'commCd',
required: false,
},
{
type: 'InputText',
label: '분배율(1~100)',
valueNm: 'distRt',
disabled: false,
cols: 6,
class: 'py-2',
align: 'right',
inputType: 'number',
min: 0,
max: 100,
required: false,
},
{
type: 'CheckBox',
label: '계산 여부',
valueNm: 'calcFg',
disabled: false,
cols: 6,
class: 'py-2',
value: { '1': true, '0': false },
required: false,
},
{
type: 'EgrpPysclQtyPop',
labelContent: '물리량',
modalTitle: '물리량 선택',
bindingItemList: {
pysclQtyId: 'pysclQtyId',
pysclQtyNm: 'pysclQtyNm',
},
// bindingData:'rowEqpmIaoGrid',
valueNm: 'pysclQtyId',
// valueNm:'calcProc',
// valueNm2:'calcDesc',
disabled: false,
required: false,
openMode: 'TAG',
cols: 6,
class: 'py-2',
eqpmGrpDisableFlag: true,
// eqpmGrpId: '',
},
{
type: 'InputText',
valueNm: 'pysclQtyNm',
disabled: true,
readonly: true,
cols: 5,
class: 'py-2',
align: 'right',
// class: 'py-2 d-none',
},
];
</script>

View File

@ -0,0 +1,366 @@
<template>
<div class="l-layout">
<v-row ref="searchFilter">
<v-col :cols="12">
<v-card class="searchFilter">
<v-row>
<v-col :cols="8">
<!-- 조회기간 -->
<DatePicker :parentPrgmId="parentPrgmId" label="조회기간" />
</v-col>
<v-col cols="4" class="d-flex justify-end align-center">
<Buttons
:parentPrgmId="parentPrgmId"
:bindingData="gridName"
:btnActionsFnc="btnActions"
/>
</v-col>
</v-row>
</v-card>
</v-col>
</v-row>
<v-row class="search-box" align="center" no-gutters style="height: 44px;">
<v-col :cols="4">
<label for="" class="search-box-label">
<v-icon x-small color="primary" class="mr-1"
>mdi-record-circle</v-icon
>
월별 요금 정보
</label>
</v-col>
</v-row>
<v-row ref="contents">
<v-col :cols="12">
<div
ref="gridParent"
class="w100"
style="height: calc((100vh - 600px) / 2);"
>
<Grid
:ref="gridName"
:is="loadGrid ? 'Grid' : null"
:gridName="gridName"
:parentPrgmId="parentPrgmId"
:editorGrid="true"
:innerTabGridInfo="innerTabGridInfo"
@getRowsData="getRowData"
/>
</div>
</v-col>
</v-row>
<v-row class="search-box" align="center" no-gutters style="height: 44px;">
<v-col :cols="4">
<label for="" class="search-box-label">
<v-icon x-small color="primary" class="mr-1"
>mdi-record-circle</v-icon
>
월별 요금 정보
</label>
</v-col>
</v-row>
<v-row ref="contents">
<v-col :cols="12">
<div
ref="chartParent"
class="h100 w100"
style="height: calc((100vh - 600px) / 2 - 30px);"
>
<component
class="w100 h100"
:is="loadChart ? 'Chart' : null"
:parentPrgmId="parentPrgmId"
:chartName="chartName"
/>
</div>
</v-col>
</v-row>
</div>
</template>
<script>
import { mapState, mapMutations, mapActions } from 'vuex';
import Buttons from '~/components/common/button/Buttons';
import BtnSearch from '~/components/common/button/BtnSearch';
import Utility from '~/plugins/utility';
import Grid from '~/components/common/Grid';
import Chart from '~/components/common/Chart';
import DatePicker from '~/components/common/Datepicker';
import SelectDate from '~/components/common/select/SelectDate';
import SelectDateVc from '~/components/common/select/SelectDateVc';
import Label from '~/components/common/form/Label';
export default {
components: {
Buttons,
BtnSearch,
Grid,
Chart,
DatePicker,
SelectDate,
SelectDateVc,
Utility,
Label,
},
props: {
parentPrgmId: {
type: String,
require: true,
},
innerTabGridInfo: {
type: Object,
default: null,
},
},
data() {
return {
loadGrid: false,
loadChart: false,
gridName: 'rowDetailGrid',
chartName: 'rowGridChart',
rowKey: null,
edtingFinishFlag: 'Y',
};
},
computed: {
...mapState({
pageData(state) {
return state.pageData[this.parentPrgmId];
},
}),
swichDatePicker() {
let picker = 'SelectDateVc';
if (this.pageData.cmCycle == 'CYC_MONTH') {
picker = 'SelectDate';
}
return picker;
},
chkRowdata() {
return this.pageData[this.gridName].data;
},
chkLoadGrid() {
return this.loadGrid;
},
},
watch: {
chkRowdata(val) {
// console.log("chkRowdata", val);
this.setChartData(val);
},
chkLoadGrid() {
if (this.pageData[this.gridName].data > 0) {
this.setChartData(this.pageData[this.gridName].data);
}
},
},
mounted() {
this.init();
},
methods: {
...mapMutations({
setPageData: 'setPageData',
setGridData: 'setGridData',
setGridColumn: 'setGridColumn',
setGridOption: 'setGridOption',
setChartYAxisData: 'setChartYAxisData',
setChartXAxisData: 'setChartXAxisData',
setChartSeries: 'setChartSeries',
setChartOption: 'setChartOption',
}),
...mapActions({
postApi: 'modules/list/postApi',
postUpdateApi: 'modules/list/postUpdateApi',
postApiReturn: 'modules/list/postApiReturn',
setTree: 'modules/list/setTree',
chkOpenTabList: 'chkOpenTabList',
}),
init() {
this.gridInit();
this.setChartData(this.pageData[this.gridName].data);
},
numFormat(val) {
return val.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
},
gridInit() {
const gridHeight = this.$refs.gridParent.offsetHeight - 50;
const myOptions = {
columnOptions: {
resizable: true,
},
bodyHeight: gridHeight,
minBodyHeight: gridHeight,
header: {
height: 28,
},
rowHeight: 29,
minRowHeight: 29,
selectionUnit: 'row',
editingEvent: 'click',
};
this.setGridOption({
gridKey: this.gridName,
value: myOptions,
});
const _this = this;
const myColumns = [
{ header: '회사 ID', name: 'comId', hidden: true },
{ header: '에너지원 번호', name: 'ercId', hidden: true },
{ header: '대상월', name: 'objMm', align: 'right', hidden: true },
{ header: '대상 월', name: 'objYm', width: 100, align: 'center' },
{
header: '요금 단가',
name: 'unitPrce',
width: 100,
align: 'right',
editor: 'text',
formatter: numberFormatter,
},
{
header: '피크 전력',
name: 'peakPow',
width: 100,
align: 'right',
editor: 'text',
formatter: numberFormatter,
},
{
header: '기본 요금',
name: 'baseChrg',
width: 100,
align: 'right',
editor: 'text',
formatter: numberFormatter,
},
{
header: '고지 요금',
name: 'notiChrg',
width: 100,
align: 'right',
editor: 'text',
formatter: numberFormatter,
},
{
header: '비고',
name: 'rmrk',
align: 'left',
editor: 'text',
},
{
header: '사업장',
name: 'blocId',
width: 100,
align: 'center',
hidden: true,
},
{ header: '등록 사용자', name: 'regUserNo', hidden: true },
{ header: '등록 일자', name: 'regDttm', hidden: true },
{ header: '수정 사용자', name: 'procUserNo', hidden: true },
{ header: '수정 일자', name: 'procDttm', hidden: true },
];
this.setGridColumn({
gridKey: this.gridName,
value: myColumns,
});
this.loadGrid = true;
},
async btnActions(action) {
let dataArr = [];
switch (action) {
case 'add':
this.$refs[this.gridName].addRow();
this.edtingFinishFlag = 'Y';
break;
case 'remove':
await this.$refs[this.gridName].editingFinish({
rowKey: this.rowKey,
});
this.$refs[this.gridName].removeRow();
this.edtingFinishFlag = 'N';
break;
case 'save':
if (this.edtingFinishFlag == 'Y') {
await this.$refs[this.gridName].editingFinish({
rowKey: this.rowKey,
});
}
dataArr = this.$refs[this.gridName].save();
this.setPageData({ isFind: true });
if (dataArr.length > 0) {
const sendParam = {
datas: {
dsEnrgChrgInfo: dataArr.map(item => ({
...item,
comId: this.selectedComId,
tagId: this.selectedTagId,
})),
},
params: {},
};
await this.postUpdateApi({
apiKey: 'saveEnrgChrgPrcInfo',
sendParam: sendParam,
});
this.setPageData({ isFind: true });
this.edtingFinishFlag = 'Y';
} else {
alert('저장할 내용이 없습니다.');
}
break;
default:
break;
}
},
async getRowData(data) {
this.rowKey = data.rowKey;
this.edtingFinishFlag = 'Y';
},
async setChartData(data) {
// console.log("차트 옵션 세팅");
let xAxisData = [];
let seriesData = [];
let seriesDataBaseChrg = {
name: '기본요금',
type: 'line',
stack: 'Total',
data: [],
};
let seriesDataNotiChrg = {
name: '고지요금',
type: 'line',
stack: 'Total',
data: [],
};
for (let idx in data) {
xAxisData.push(data[idx].objYm);
if (data[idx].baseChrg == null || data[idx].baseChrg == '') {
seriesDataBaseChrg.data.push(0);
} else {
seriesDataBaseChrg.data.push(data[idx].baseChrg);
}
if (data[idx].notiChrg == null || data[idx].notiChrg == '') {
seriesDataNotiChrg.data.push(0);
} else {
seriesDataNotiChrg.data.push(data[idx].notiChrg);
}
}
seriesData.push(seriesDataBaseChrg);
seriesData.push(seriesDataNotiChrg);
this.setChartXAxisData({ chartKey: this.chartName, value: xAxisData });
this.setChartSeries({ chartKey: this.chartName, value: seriesData });
this.loadChart = true;
},
},
};
function numberFormatter({ value }) {
return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
}
</script>

View File

@ -0,0 +1,501 @@
<template>
<div>
<div
class="d-flex justify-space-between align-center"
style="height: 50px;"
>
<span class="txt">태그 정보</span>
<Buttons
:parentPrgmId="parentPrgmId"
:bindingData="gridName"
:btnActionsFnc="btnActions"
/>
</div>
<div ref="gridParent" style="height: calc(100vh - 760px);">
<component
:ref="gridName"
:is="loadGrid ? 'Grid' : null"
:gridName="gridName"
:parentPrgmId="parentPrgmId"
@getRowsData="getRowData"
:innerTabGridInfo="innerTabGridInfo"
/>
</div>
<div>
<component
:is="'Form'"
:bindingData="gridName"
:parentPrgmId="parentPrgmId"
:detailList="detailList"
@gridEditingFinish="gridEditingFinish"
/>
</div>
</div>
</template>
<script>
import { mapState, mapMutations, mapActions } from 'vuex';
import Buttons from '~/components/common/button/Buttons';
import Grid from '~/components/common/Grid';
import Form from '~/components/common/form/Form';
import Utility from '~/plugins/utility';
import mixinGlobal from '@/mixin/global.js';
export default {
mixins: [mixinGlobal],
components: {
Buttons,
Grid,
Form,
Utility,
},
props: {
parentPrgmId: {
type: String,
require: true,
},
innerTabGridInfo: {
type: Object,
default: null,
},
},
data() {
return {
loadGrid: false,
gridName: 'rowTagInfoGrid',
itemList: [],
tagTpList: [],
detailList: myDetail,
};
},
computed: {
...mapState({
pageData(state) {
return state.pageData[this.parentPrgmId];
},
}),
selectedCommCd() {
return this.pageData[this.gridName].data;
},
selectedComId() {
return this.pageData.rowGridSelectData.comId;
},
selectedBlocId() {
return this.pageData.rowGridSelectData.blocId;
},
},
watch: {},
created() {},
mounted() {
this.init();
},
methods: {
...mapMutations({
setPageData: 'setPageData',
setGridData: 'setGridData',
setGridColumn: 'setGridColumn',
setGridOption: 'setGridOption',
setGridSelectData: 'setGridSelectData',
}),
...mapActions({
postApi: 'modules/list/postApi',
postUpdateApi: 'modules/list/postUpdateApi',
postApiReturn: 'modules/list/postApiReturn',
setTree: 'modules/list/setTree',
chkOpenTabList: 'chkOpenTabList',
getCodeList: 'modules/search/getCodeList',
}),
init() {
this.gridInit();
},
search() {},
setEditorContent() {
this.itemList = this.pageData.itemList.map(item => {
return {
text: item.commCdNm,
value: item.commCd,
};
});
this.tagTpList = this.pageData.tagTpList.map(item => {
return {
text: item.commCdNm,
value: item.commCd,
};
});
this.setPageData({});
},
gridInit() {
this.setEditorContent();
const gridHeight = this.$refs.gridParent.offsetHeight - 30;
this.loadGrid = false;
const myOptions = {
columnOptions: {
resizable: true,
},
bodyHeight: gridHeight,
minBodyHeight: gridHeight,
header: {
height: 28,
},
rowHeight: 29,
minRowHeight: 29,
selectionUnit: 'row',
editingEvent: 'click',
};
this.setGridOption({
gridKey: this.gridName,
value: myOptions,
});
const _this = this;
let useFgSelectList = [];
const myColumns = [
{ header: '회사 ID', name: 'comId', hidden: true },
{ header: '공정코드', name: 'eccId', hidden: true },
{ header: '태그별칭', name: 'tagNm', width: 200, align: 'left' },
{ header: '케이스ID', name: 'ucId', hidden: true },
{ header: '태그ID', name: 'tagId', hidden: true },
{
header: '변수명-콤보',
name: 'tagAlis',
align: 'left',
align: 'center',
},
{
header: '검침대상',
name: 'readObjId',
align: 'center',
hidden: true,
formatter({ value }) {
let retVal = '';
const newValue = _this.pageData.energyList.filter(
item => item.cd == value,
);
if (newValue.length > 0) {
retVal = newValue[0].readObjNm;
}
return retVal;
},
},
{
header: '항목명',
name: 'item',
align: 'center',
formatter({ value }) {
const newValue = _this.pageData.itemList.filter(
item => item.commCd == value,
);
return newValue[0].commCdNm;
},
},
{
header: '항목계산식',
name: 'calcFrmlItem',
align: 'left',
align: 'center',
},
{
header: '태그타입',
name: 'tagTp',
align: 'center',
formatter({ value }) {
const newValue = _this.pageData.tagTpList.filter(
item => item.commCd == value,
);
return newValue[0].commCdNm;
},
},
{ header: '디폴트값', name: 'dfltVal', align: 'center' },
{
header: '사용자세팅값',
name: 'userVal',
align: 'center',
hidden: true,
},
{ header: '순번', name: 'seq', align: 'right' },
{
header: '사용여부',
name: 'useFg',
align: 'right',
formatter({ value }) {
value = value === true ? '1' : '0';
const newValue = _this.pageData.useFgList.filter(
item => item.commCd == value,
);
return newValue[0].commCdNm;
},
},
{ header: '비고', name: 'rmrk', align: 'center', hidden: true },
{ header: '등록 사용자', name: 'regUserNo', hidden: true },
{ header: '등록 일자', name: 'regDttm', hidden: true },
{ header: '수정 사용자', name: 'procUserNo', hidden: true },
{ header: '수정 일자', name: 'procDttm', hidden: true },
{ header: 'rowStat', name: 'rowStat', hidden: true },
];
this.setGridColumn({
gridKey: this.gridName,
value: myColumns,
});
this.loadGrid = true;
},
async getRowData(data, gridName) {
if (data.tagTp == 'FIX_VAL') {
this.detailList[2].showValue = false;
this.detailList[3].showValue = true;
this.detailList[4].showValue = true;
} else if (data.tagTp == 'READ_VAL') {
this.detailList[2].showValue = true;
this.detailList[3].showValue = false;
this.detailList[4].showValue = false;
}
this.setGridSelectData({
gridKey: gridName,
gridSelect: true,
rowGridSelectKey: data.rowKey,
rowGridSelectData: Object.assign({}, data),
});
},
async btnActions(action) {
let dataArr = [];
switch (action) {
case 'add':
const defaultRow = {
comId: '',
tagId: '',
tagNm: '',
calcFrml: this.pageData.calcFrml,
calcFrmlTxt: this.pageData.calcFrmlTxt,
tagAlis: 'A',
item: 'ENRG_USE_QTY',
calcFrmlItem: '',
tagTp: 'READ_VAL',
ucId: this.pageData.ucId,
};
this.$refs[this.gridName].addRow(defaultRow);
break;
case 'remove':
this.$refs[this.gridName].removeRow();
break;
case 'save':
this.loadGrid = false;
dataArr = this.$refs[this.gridName].save();
if (dataArr.length > 0) {
var validCheck = true;
// console.log('dataArr : ', dataArr);
dataArr.forEach(item => {
if (
item.tagId == '' ||
item.tagId == null ||
item.tagNm == '' ||
item.tagNm == null ||
item.tagAlis == '' ||
item.tagAlis == null ||
item.tagTp == '' ||
item.tagTp == null ||
item.item == '' ||
item.item == null ||
item.dfltVal == '' ||
item.dfltVal == null ||
item.seq == '' ||
item.seq == null
) {
validCheck = false;
alert('필수 입력값을 입력해주세요');
// this.setPageData({ isFind: true });
this.loadGrid = true;
}
});
// dataArr.forEach(item =>{
// if(item.tagTp == 'FIX_VAL'){
// console.log('11');
// item.tagId = item.tagNm;
// }
// });
if (validCheck) {
const sendParam = {
datas: {
dsOnlnBasicTagInfoData: dataArr.map(item => ({
...item,
useFg: item.useFg === true ? '1' : '0',
eccId: this.pageData.rowGrid.rowGridSelectData.eccId,
readObjId: this.pageData.rowGrid.rowGridSelectData
.readObjId,
})),
},
params: {},
};
await this.postUpdateApi({
apiKey: 'saveOnlnBasicUnitTagInfoMng',
sendParam: sendParam,
});
this.setPageData({ isFind: true });
this.loadGrid = true;
}
} else {
alert('저장할 내용이 없습니다.');
}
break;
default:
break;
}
},
gridEditingFinish(data) {
// console.log('data : ', data);
// console.log("data.columnName == 'tagTp' : ", data.columnName == 'tagTp');
// console.log("data.value == 'FIX_VAL' : ", data.value == 'FIX_VAL');
// console.log("data.value == 'READ_VAL' : ", data.value == 'READ_VAL');
// console.log("data.columnName == 'tagTp' && data.value == 'FIX_VAL' : ", (data.columnName == 'tagTP' && data.value == 'FIX_VAL'));
// console.log("(data.columnName == 'tagTp' && data.value == 'READ_VAL') : ", (data.columnName == 'tagTP' && data.value == 'READ_VAL'));
if (data.columnName == 'tagTp' && data.value == 'FIX_VAL') {
// console.log('if case 1 ...');
this.detailList[2].showValue = false;
this.detailList[3].showValue = true;
this.detailList[4].showValue = true;
// }else{
} else if (data.columnName == 'tagTp' && data.value == 'READ_VAL') {
// console.log('if case 2 ...');
this.detailList[2].showValue = true;
this.detailList[3].showValue = false;
this.detailList[4].showValue = false;
}
if (!this.detailList[2].showValue && data.columnName == 'tagId') {
data = {
columnName: 'tagNm',
value: data.value,
};
}
this.$refs[this.gridName].editingFinish(data);
},
},
};
const myDetail = [
{
type: 'InputText',
label: '계산식(명칭)',
valueNm: 'calcFrmlTxt',
disabled: true,
cols: 12,
labelCols: 2,
textCols: 5,
class: 'py-2',
required: true,
},
{
type: 'InputText',
label: '계산식(변수)',
valueNm: 'calcFrml',
disabled: true,
cols: 12,
labelCols: 2,
textCols: 5,
class: 'py-2',
required: true,
},
{
type: 'InputText',
label: '태그',
valueNm: 'tagId',
disabled: false,
cols: 12,
labelCols: 2,
textCols: 5,
class: 'py-2',
required: true,
showValue: true,
},
{
type: 'OnlnBasicUnitAddInfoPop',
labelContent: '태그',
modalTitle: 'TAG 리스트',
valueNm: 'tagId',
valueNm2: 'tagNm',
disabled: true,
cols: 6,
class: 'py-2',
required: true,
showValue: false,
},
{
type: 'InputText',
label: '태그별칭',
valueNm: 'tagNm',
disabled: false,
cols: 6,
labelCols: 2,
textCols: 5,
class: 'py-2',
required: true,
showValue: false,
},
{
type: 'SelectBox',
label: '태그타입',
disabled: false,
cols: 6,
class: 'py-2',
list: 'tagTpList',
valueNm: 'tagTp',
itemText: 'commCdNm',
itemValue: 'commCd',
required: true,
},
{
type: 'InputText',
label: '디폴트값',
valueNm: 'dfltVal',
readonly: false,
cols: 6,
class: 'py-2',
required: true,
},
{
type: 'InputText',
label: '순번',
valueNm: 'seq',
readonly: false,
cols: 6,
class: 'py-2',
required: true,
},
{
type: 'SelectBox',
label: '항목명',
disabled: false,
cols: 6,
class: 'py-2',
list: 'itemList',
valueNm: 'item',
itemText: 'commCdNm',
itemValue: 'commCd',
required: true,
},
{
type: 'InputText',
label: '항목계산식',
disabled: false,
readonly: false,
cols: 6,
class: 'py-2',
valueNm: 'calcFrmlItem',
required: true,
},
{
type: 'CheckBox',
label: '사용 여부',
valueNm: 'useFg',
disabled: false,
cols: 6,
class: 'py-2',
value: { '1': true, '0': false },
required: true,
},
];
</script>

View File

@ -0,0 +1,449 @@
<template>
<div>
<div
class="d-flex justify-space-between align-center"
style="height: 80px;"
>
<span class="txt">검침 대상 추가 정보</span>
<Buttons
:parentPrgmId="parentPrgmId"
:bindingData="gridName"
:btnActionsFnc="btnActions"
/>
</div>
<div ref="gridParent" style="height: calc(100vh - 520px);">
<Grid
:ref="gridName"
:is="loadGrid ? 'Grid' : null"
:gridName="gridName"
:parentPrgmId="parentPrgmId"
:editorGrid="true"
:innerTabGridInfo="innerTabGridInfo"
@getRowsData="getRowData"
/>
</div>
</div>
</template>
<script>
import { mapState, mapMutations, mapActions } from 'vuex';
import Buttons from '~/components/common/button/Buttons';
import Grid from '~/components/common/Grid';
import InputText from '~/components/common/input/InputText';
import Form from '~/components/common/form/Form';
import mixinGlobal from '@/mixin/global.js';
import { NewCustomRenderer } from '~/plugins/gridUtility';
import { NewCustomEditor } from '~/plugins/gridUtility';
export default {
mixins: [mixinGlobal],
components: {
Buttons,
Grid,
InputText,
Form,
},
props: {
parentPrgmId: {
type: String,
require: true,
},
innerTabGridInfo: {
type: Object,
default: null,
},
},
data() {
return {
loadGrid: false,
gridName: 'rowDetailGrid',
rowKey: null,
edtingFinishFlag: 'Y',
};
},
computed: {
...mapState({
pageData(state) {
return state.pageData[this.parentPrgmId];
},
}),
selectedCommCd() {
return this.pageData[this.gridName].data;
},
myUseFgList() {
return this.pageData.useFgList;
},
selectedComId() {
return this.pageData.rowGridSelectData.comId;
},
selectedBlocId() {
return this.pageData.rowGridSelectData.blocId;
},
selectedReadObjId() {
return this.pageData.rowGridSelectData.readObjId;
},
},
mounted() {
this.init();
},
methods: {
...mapMutations({
setPageData: 'setPageData',
setGridData: 'setGridData',
setGridColumn: 'setGridColumn',
setGridOption: 'setGridOption',
}),
...mapActions({
postApi: 'modules/list/postApi',
postUpdateApi: 'modules/list/postUpdateApi',
postApiReturn: 'modules/list/postApiReturn',
setTree: 'modules/list/setTree',
chkOpenTabList: 'chkOpenTabList',
}),
init() {
this.gridInit();
},
gridInit() {
const gridHeight = this.$refs.gridParent.offsetHeight - 30;
const myOptions = {
columnOptions: {
resizable: true,
},
bodyHeight: gridHeight,
minBodyHeight: gridHeight,
header: {
height: 28,
},
rowHeight: 29,
minRowHeight: 29,
selectionUnit: 'row',
editingEvent: 'click',
};
this.setGridOption({
gridKey: this.gridName,
value: myOptions,
});
const _this = this;
let useFgSelectList = [];
this.pageData.useFgList.forEach(item => {
const it = { text: item.commCdNm, value: item.commCd };
useFgSelectList.push(it);
});
let addInfoList = [];
this.pageData.addInfoList.forEach(item => {
const it = { text: item.addInfoNm, value: item.addInfoId };
addInfoList.push(it);
});
let addInfoDataKindList = [];
this.pageData.addInfoDataKindList.forEach(item => {
const it = { text: item.commCdNm, value: item.commCd };
addInfoDataKindList.push(it);
});
class CustomRenderer {
constructor(props) {
//const { min, max } = props.columnInfo.renderer.options;
//console.log('props: %o', props);
const el = document.createElement('input');
if (
props.grid.store.data.rawData[props.rowKey].addInfoDataKind == 'FG'
) {
el.type = 'checkbox';
} else {
el.type = 'text';
$(el).addClass('tui-grid-cell-content');
$(el).css('text-align', 'center');
}
// el.min = String(min);
//el.max = String(max);
//el.disabled = true;
this.el = el;
this.render(props);
}
getElement() {
return this.el;
}
render(props) {
if (this.el.type == 'checkbox') {
if (props.value == 1) {
this.el.checked = true;
} else {
this.el.checked = false;
}
}
this.el.value = props.value;
}
}
class CustomEditor {
constructor(props) {
const el = document.createElement('input');
if (
props.grid.store.data.rawData[props.rowKey].addInfoDataKind == 'FG'
) {
el.type = 'checkbox';
if (props.value == 1) {
el.checked = true;
} else {
el.checked = false;
}
el.addEventListener('change', this.change);
} else {
el.type = 'text';
if (props.formattedValue == 'NUM') {
// el.keyDown = "this.value=this.value.replace(/[^0-9]/g,'');"
el.onkeydown = function(event) {
var code = event.keyCode;
if (
(code > 47 && code < 58) ||
event.ctrlKey ||
event.altKey ||
code == 8 ||
code == 9 ||
code == 46
) {
if (event.ctrlKey && event.keyCode == 86) {
event.preventDefault();
}
return;
}
event.preventDefault();
};
}
$(el).addClass('tui-grid-content-text');
}
// console.log('props: %o', props);
// console.log('el: %o', el);
this.el = el;
this.render(props);
}
change(ev) {
//console.log('props: %o', ev);
if (ev.target.checked) {
ev.target.value = 1;
} else {
ev.target.value = 0;
}
}
getElement() {
return this.el;
}
getValue() {
return this.el.value;
}
render(props) {
if (this.el.type == 'checked') {
this.el.value = props.value;
} else {
this.el.value = String(props.value);
}
//console.log('props: %o', props);
}
mounted() {
if (this.el.type == 'checkbox') {
$(this.el.parentElement).css('text-align', 'center');
}
this.el.select();
}
}
const myColumns = [
{ header: '회사 ID', name: 'comId', hidden: true },
{ header: '검침 대상 ID', name: 'readObjId', hidden: true },
{
header: '추가 정보',
name: 'addInfoId',
align: 'left',
formatter({ value }) {
let retVal = '';
const newValue = addInfoList.filter(item => item.value == value);
if (newValue.length > 0) {
retVal = newValue[0].text;
}
return retVal;
},
},
{
header: 'Data 구분',
name: 'addInfoDataKind',
align: 'center',
formatter({ value }) {
let retVal = '';
const newValue = addInfoDataKindList.filter(
item => item.value == value,
);
if (newValue.length > 0) {
retVal = newValue[0].text;
}
return retVal;
},
// editor: {
// type: "select",
// options: {
// listItems: addInfoDataKindList
// }
// }
},
{
header: '숫자 값',
name: 'addInfoNumVal',
align: 'right',
editor: 'text',
hidden: true,
},
{
header: '문자 값',
name: 'addInfoTxtVal',
align: 'left',
editor: 'text',
hidden: true,
},
{
header: '추가 정보 값',
name: 'addInfoVal',
align: 'center',
renderer: {
type: NewCustomRenderer,
},
editor: {
type: NewCustomEditor,
},
formatter(data) {
return data.row.addInfoDataKind;
},
},
//{ header: "추가 정보 값", name: "addInfoVal", align: "center" , editor: "text",
// formatter({ value, row , column}) {
// console.log("addInfoVal row : ", row);
// console.log("addInfoVal state : ", column);
// if(row.addInfoDataKind === "NUM"){
// column.align = "right";
// }else{
// column.align = "left";
// }
// return value;
// }
//},
/*{
header: "사용여부",
name: "useFg",
align: "center",
formatter({ value }) {
return value == "1" ? "사용" : "사용안함";
},
editor: {
type: "select",
options: {
// listItems: useFgSelectList
listItems: [
{text:"사용", value:"1"},
{text:"사용안함", value:"0"},
]
}
}
},*/
{ header: '등록 사용자', name: 'regUserNo', hidden: true },
{ header: '등록 일자', name: 'regDttm', hidden: true },
{ header: '수정 사용자', name: 'procUserNo', hidden: true },
{ header: '수정 일자', name: 'procDttm', hidden: true },
];
this.setGridColumn({
gridKey: this.gridName,
value: myColumns,
});
this.loadGrid = true;
},
async getRowData2(data, gridName) {
this.setGridSelectData({
gridKey: gridName,
gridSelect: true,
rowGridSelectKey: data.rowKey,
rowGridSelectData: Object.assign({}, data),
});
},
async btnActions(action) {
let dataArr = [];
switch (action) {
case 'add':
this.$refs[this.gridName].addRow();
this.edtingFinishFlag = 'Y';
break;
case 'remove':
await this.$refs[this.gridName].editingFinish({
rowKey: this.rowKey,
});
this.$refs[this.gridName].removeRow();
this.edtingFinishFlag = 'N';
break;
case 'save':
if (this.edtingFinishFlag == 'Y') {
await this.$refs[this.gridName].editingFinish({
rowKey: this.rowKey,
});
}
this.loadGrid = false;
dataArr = this.$refs[this.gridName].save();
// this.setPageData({ isFind: true });
for (var i = 0; i < dataArr.length; i++) {
if (
dataArr[i].addInfoDataKind == 'NUM' &&
dataArr[i].addInfoVal == ''
) {
dataArr[i].addInfoVal = null;
}
}
if (dataArr.length > 0) {
const sendParam = {
datas: {
dsReadObjAddInfo: dataArr.map(item => ({
...item,
comId: this.selectedComId,
blocId: this.selectedBlocId,
readObjId: this.selectedReadObjId,
})),
},
params: {},
};
await this.postUpdateApi({
apiKey: 'saveReadObjAddInfoList',
sendParam: sendParam,
});
this.loadGrid = true;
this.setPageData({ isFind: true });
this.edtingFinishFlag = 'Y';
} else {
this.loadGrid = true;
alert('저장할 내용이 없습니다.');
}
break;
default:
break;
}
},
async getRowData(data) {
this.rowKey = data.rowKey;
this.edtingFinishFlag = 'Y';
},
gridEditingFinish2(data, bindingData) {
this.$refs[bindingData].editingFinish(data);
},
search() {},
},
};
</script>

View File

@ -0,0 +1,330 @@
<template>
<div>
<div
class="d-flex justify-space-between align-center"
style="height: 80px;"
>
<span class="txt">검침개소 추가 정보</span>
<Buttons
:parentPrgmId="parentPrgmId"
:bindingData="gridName"
:btnActionsFnc="btnActions"
/>
</div>
<div ref="gridParent" style="height: calc(100vh - 520px);">
<Grid
:ref="gridName"
:is="loadGrid ? 'Grid' : null"
:gridName="gridName"
:parentPrgmId="parentPrgmId"
:editorGrid="true"
:innerTabGridInfo="innerTabGridInfo"
@getRowsData="getRowData"
/>
</div>
</div>
</template>
<script>
import { mapState, mapMutations, mapActions } from 'vuex';
import Buttons from '~/components/common/button/Buttons';
import Grid from '~/components/common/Grid';
import InputText from '~/components/common/input/InputText';
import Form from '~/components/common/form/Form';
import mixinGlobal from '@/mixin/global.js';
import { NewCustomRenderer } from '~/plugins/gridUtility';
import { NewCustomEditor } from '~/plugins/gridUtility';
export default {
mixins: [mixinGlobal],
components: {
Buttons,
Grid,
InputText,
Form,
},
props: {
parentPrgmId: {
type: String,
require: true,
},
innerTabGridInfo: {
type: Object,
default: null,
},
},
data() {
return {
loadGrid: false,
gridName: 'rowDetailGrid',
rowKey: null,
edtingFinishFlag: 'Y',
};
},
computed: {
...mapState({
pageData(state) {
return state.pageData[this.parentPrgmId];
},
}),
selectedCommCd() {
return this.pageData[this.gridName].data;
},
myUseFgList() {
return this.pageData.useFgList;
},
selectedComId() {
return this.pageData.rowGridSelectData.comId;
},
selectedBlocId() {
return this.pageData.rowGridSelectData.blocId;
},
selectedReadPlcId() {
return this.pageData.rowGridSelectData.readPlcId;
},
},
mounted() {
this.init();
},
methods: {
...mapMutations({
setPageData: 'setPageData',
setGridData: 'setGridData',
setGridColumn: 'setGridColumn',
setGridOption: 'setGridOption',
}),
...mapActions({
postApi: 'modules/list/postApi',
postUpdateApi: 'modules/list/postUpdateApi',
postApiReturn: 'modules/list/postApiReturn',
setTree: 'modules/list/setTree',
chkOpenTabList: 'chkOpenTabList',
}),
init() {
this.gridInit();
},
gridInit() {
const gridHeight = this.$refs.gridParent.offsetHeight - 30;
const myOptions = {
columnOptions: {
resizable: true,
},
bodyHeight: gridHeight,
minBodyHeight: gridHeight,
header: {
height: 28,
},
rowHeight: 29,
minRowHeight: 29,
selectionUnit: 'row',
editingEvent: 'click',
};
this.setGridOption({
gridKey: this.gridName,
value: myOptions,
});
const _this = this;
let useFgSelectList = [];
this.pageData.useFgList.forEach(item => {
const it = { text: item.commCdNm, value: item.commCd };
useFgSelectList.push(it);
});
let addInfoList = [];
this.pageData.addInfoList.forEach(item => {
const it = { text: item.addInfoNm, value: item.addInfoId };
addInfoList.push(it);
});
let addInfoDataKindList = [];
this.pageData.addInfoDataKindList.forEach(item => {
const it = { text: item.commCdNm, value: item.commCd };
addInfoDataKindList.push(it);
});
const myColumns = [
{ header: '회사 ID', name: 'comId', hidden: true },
{ header: '검침개소 번호', name: 'readPlcId', hidden: true },
{
header: '추가 정보',
name: 'addInfoId',
align: 'left',
formatter({ value }) {
let retVal = '';
const newValue = addInfoList.filter(item => item.value == value);
if (newValue.length > 0) {
retVal = newValue[0].text;
}
return retVal;
},
},
{
header: 'Data 구분',
name: 'addInfoDataKind',
align: 'center',
formatter({ value }) {
let retVal = '';
const newValue = addInfoDataKindList.filter(
item => item.value == value,
);
if (newValue.length > 0) {
retVal = newValue[0].text;
}
return retVal;
},
// editor: {
// type: "select",
// options: {
// listItems: addInfoDataKindList
// }
// }
},
{
header: '숫자 값',
name: 'addInfoNumVal',
align: 'right',
editor: 'text',
hidden: true,
},
{
header: '문자 값',
name: 'addInfoTxtVal',
align: 'left',
editor: 'text',
hidden: true,
},
{
header: '추가 정보 값',
name: 'addInfoVal',
align: 'center',
renderer: {
type: NewCustomRenderer,
},
editor: {
type: NewCustomEditor,
},
formatter(data) {
return data.row.addInfoDataKind;
},
},
//{ header: "추가 정보 값", name: "addInfoVal", align: "center" , editor: "text",
// formatter({ value, row , column}) {
// console.log("addInfoVal row : ", row);
// console.log("addInfoVal state : ", column);
// if(row.addInfoDataKind === "NUM"){
// column.align = "right";
// }else{
// column.align = "left";
// }
// return value;
// }
//},
/*{
header: "사용여부",
name: "useFg",
align: "center",
formatter({ value }) {
return value == "1" ? "사용" : "사용안함";
},
editor: {
type: "select",
options: {
// listItems: useFgSelectList
listItems: [
{text:"사용", value:"1"},
{text:"사용안함", value:"0"},
]
}
}
},*/
{ header: '등록 사용자', name: 'regUserNo', hidden: true },
{ header: '등록 일자', name: 'regDttm', hidden: true },
{ header: '수정 사용자', name: 'procUserNo', hidden: true },
{ header: '수정 일자', name: 'procDttm', hidden: true },
];
this.setGridColumn({
gridKey: this.gridName,
value: myColumns,
});
this.loadGrid = true;
},
async getRowData2(data, gridName) {
this.setGridSelectData({
gridKey: gridName,
gridSelect: true,
rowGridSelectKey: data.rowKey,
rowGridSelectData: Object.assign({}, data),
});
},
async btnActions(action) {
let dataArr = [];
switch (action) {
case 'add':
this.$refs[this.gridName].addRow();
this.edtingFinishFlag = 'Y';
break;
case 'remove':
this.$refs[this.gridName].removeRow();
this.edtingFinishFlag = 'N';
break;
case 'save':
if (this.edtingFinishFlag == 'Y') {
await this.$refs[this.gridName].editingFinish({
rowKey: this.rowKey,
});
}
this.loadGrid = false;
dataArr = this.$refs[this.gridName].save();
// this.setPageData({ isFind: true });
for (var i = 0; i < dataArr.length; i++) {
if (
dataArr[i].addInfoDataKind == 'NUM' &&
dataArr[i].addInfoVal == ''
) {
dataArr[i].addInfoVal = null;
}
}
if (dataArr.length > 0) {
const sendParam = {
datas: {
dsReadPlcAddInfo: dataArr.map(item => ({
...item,
comId: this.selectedComId,
blocId: this.selectedBlocId,
readPlcId: this.selectedReadPlcId,
})),
},
params: {},
};
await this.postUpdateApi({
apiKey: 'saveReadPlcAddInfoList',
sendParam: sendParam,
});
this.loadGrid = true;
this.setPageData({ isFind: true });
this.edtingFinishFlag = 'Y';
} else {
this.loadGrid = true;
alert('저장할 내용이 없습니다.');
}
break;
default:
break;
}
},
async getRowData(data) {
this.rowKey = data.rowKey;
this.edtingFinishFlag = 'Y';
},
gridEditingFinish2(data, bindingData) {
this.$refs[bindingData].editingFinish(data);
},
search() {},
},
};
</script>

View File

@ -0,0 +1,273 @@
<template>
<div>
<div
class="d-flex justify-space-between align-center"
style="height: 80px;"
>
<span class="txt">가상 검침 정보</span>
<Buttons
:parentPrgmId="parentPrgmId"
:bindingData="gridName"
:detailList="detailReadPlcImgList"
:btnActionsFnc="btnActions"
/>
</div>
<div ref="gridParent" style="height: calc((100vh - 520px) /2);">
<Grid
:ref="gridName"
:is="loadGrid ? 'Grid' : null"
:gridName="gridName"
:parentPrgmId="parentPrgmId"
@getRowsData="getRowData"
:innerTabGridInfo="innerTabGridInfo"
/>
</div>
<div ref="formParent" style="height: calc((100vh - 520px) /2);">
<component
:is="'Form'"
:parentPrgmId="parentPrgmId"
:bindingData="gridName"
:detailList="detailReadPlcImgList"
@gridEditingFinish="gridEditingFinish"
/>
</div>
</div>
</template>
<script>
import { mapState, mapMutations, mapActions } from 'vuex';
import Buttons from '~/components/common/button/Buttons';
import Grid from '~/components/common/Grid';
import InputText from '~/components/common/input/InputText';
import Form from '~/components/common/form/Form';
import mixinGlobal from '@/mixin/global.js';
import Utility from '~/plugins/utility';
export default {
mixins: [mixinGlobal],
components: {
Buttons,
Grid,
InputText,
Form,
},
props: {
parentPrgmId: {
type: String,
require: true,
},
innerTabGridInfo: {
type: Object,
default: null,
},
},
data() {
return {
loadGrid: false,
gridName: 'rowReadPlcImgGrid',
detailReadPlcImgList: myReadPlcImgDetail,
};
},
computed: {
...mapState({
pageData(state) {
return state.pageData[this.parentPrgmId];
},
}),
selectedCommCd() {
return this.pageData[this.gridName].data;
},
myUseFgList() {
return this.pageData.useFgList;
},
selectedComId() {
return this.pageData.rowGridSelectData.comId;
},
selectedBlocId() {
return this.pageData.rowGridSelectData.blocId;
},
selectedReadPlcId() {
return this.pageData.rowGridSelectData.readPlcId;
},
},
mounted() {
this.init();
},
methods: {
...mapMutations({
setPageData: 'setPageData',
setGridData: 'setGridData',
setGridColumn: 'setGridColumn',
setGridOption: 'setGridOption',
}),
...mapActions({
postApi: 'modules/list/postApi',
postUpdateApi: 'modules/list/postUpdateApi',
postApiReturn: 'modules/list/postApiReturn',
setTree: 'modules/list/setTree',
chkOpenTabList: 'chkOpenTabList',
}),
init() {
this.gridInit();
},
gridInit() {
const gridHeight = this.$refs['gridParent'].offsetHeight - 36;
const myOptions = {
columnOptions: {
resizable: true,
},
// bodyHeight: gridHeight,
// minBodyHeight: gridHeight,
header: {
height: 28,
},
rowHeight: 29,
minRowHeight: 29,
selectionUnit: 'row',
editingEvent: 'click',
};
this.setGridOption({
gridKey: this.gridName,
// value: myOptions
value: Object.assign(Utility.defaultGridOption(gridHeight), myOptions),
});
const _this = this;
let ddctKindList = [];
this.pageData.ddctKindList.forEach(item => {
const it = { text: item.commCdNm, value: item.commCd };
ddctKindList.push(it);
});
const myColumns = [
{ header: '회사 ID', name: 'comId', hidden: true },
{ header: '검침개소 번호', name: 'readPlcId', hidden: true },
{ header: '대상 검침개소 번호', name: 'objReadPlcId', align: 'center' },
{ header: '대상 검침개소명', name: 'objReadPlcNm', align: 'left' },
{ header: '분배율(1~100)', name: 'distRt', align: 'right' },
{
header: '가감유형',
name: 'ddctKind',
align: 'center',
formatter({ value }) {
let retVal = '';
const newValue = ddctKindList.filter(item => item.value == value);
if (newValue.length > 0) {
retVal = newValue[0].text;
}
return retVal;
},
},
{ header: '등록 사용자', name: 'regUserNo', hidden: true },
{ header: '등록 일자', name: 'regDttm', hidden: true },
{ header: '수정 사용자', name: 'procUserNo', hidden: true },
{ header: '수정 일자', name: 'procDttm', hidden: true },
];
this.setGridColumn({
gridKey: this.gridName,
value: myColumns,
});
this.loadGrid = true;
},
async getRowData(data, gridName) {
this.setGridSelectData({
gridKey: gridName,
gridSelect: true,
rowGridSelectKey: data.rowKey,
rowGridSelectData: Object.assign({}, data),
});
},
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':
this.loadGrid = false;
dataArr = this.$refs[this.gridName].save();
this.setPageData({ isFind: true });
if (dataArr.length > 0) {
const sendParam = {
datas: {
dsReadPlcImgInfo: dataArr.map(item => ({
...item,
comId: this.selectedComId,
readPlcId: this.selectedReadPlcId,
})),
},
params: {},
};
await this.postUpdateApi({
apiKey: 'saveReadPlcImgInfo',
sendParam: sendParam,
});
this.loadGrid = true;
this.setPageData({ isFind: true });
} else {
this.loadGrid = true;
alert('저장할 내용이 없습니다.');
}
break;
default:
break;
}
},
gridEditingFinish(data, bindingData) {
this.$refs[this.gridName].editingFinish(data);
},
search() {},
},
};
const myReadPlcImgDetail = [
{
type: 'ReadPlcPop',
label: '대상 검침개소',
title: '검침개소명',
valueNm: 'objReadPlcId',
disabled: false,
cols: 6,
class: 'py-2',
required: true,
},
{
type: 'InputText',
valueNm: 'objReadPlcNm',
readonly: true,
cols: 5,
class: 'py-2',
},
{
type: 'InputNumber',
label: '분배율(1~100)',
valueNm: 'distRt',
disabled: false,
cols: 6,
class: 'py-2',
inputType: 'number',
min: 1,
max: 100,
required: true,
},
{
type: 'SelectBox',
label: '가감유형',
valueNm: 'ddctKind',
disabled: false,
cols: 6,
class: 'py-2',
list: 'ddctKindList',
itemText: 'commCdNm',
itemValue: 'commCd',
required: true,
},
];
</script>

View File

@ -0,0 +1,409 @@
<template>
<div>
<div
class="d-flex justify-space-between align-center"
style="height: 80px;"
>
<span class="txt">검침개소 TAG 연결 정보</span>
<Buttons
:parentPrgmId="parentPrgmId"
:bindingData="gridName"
:detailList="detailReadPlcTagList"
:btnActionsFnc="btnActions"
/>
</div>
<div ref="gridParent" style="height: calc((100vh - 520px) /2);">
<Grid
:ref="gridName"
:is="loadGrid ? 'Grid' : null"
:gridName="gridName"
:parentPrgmId="parentPrgmId"
@getRowsData="getRowData"
:innerTabGridInfo="innerTabGridInfo"
/>
</div>
<div ref="formParent" style="height: calc((100vh - 520px) /2);">
<component
:is="'Form'"
:parentPrgmId="parentPrgmId"
:bindingData="gridName"
:detailList="detailReadPlcTagList"
@gridEditingFinish="gridEditingFinish"
/>
</div>
</div>
</template>
<script>
import { mapState, mapMutations, mapActions } from 'vuex';
import Buttons from '~/components/common/button/Buttons';
import Grid from '~/components/common/Grid';
import { CustumChecbox } from '~/plugins/gridUtility';
import { CustomNumberEditor } from '~/plugins/gridUtility';
import Form from '~/components/common/form/Form';
import mixinGlobal from '@/mixin/global.js';
import Utility from '~/plugins/utility';
export default {
mixins: [mixinGlobal],
components: {
Buttons,
Grid,
Form,
},
props: {
parentPrgmId: {
type: String,
require: true,
},
innerTabGridInfo: {
type: Object,
default: null,
},
},
data() {
return {
loadGrid: false,
gridName: 'rowReadPlcTagRelGrid',
detailReadPlcTagList: myReadPlcTagDetail,
};
},
computed: {
...mapState({
pageData(state) {
return state.pageData[this.parentPrgmId];
},
}),
selectedCommCd() {
return this.pageData[this.gridName].data;
},
myUseFgList() {
return this.pageData.useFgList;
},
selectedComId() {
return this.pageData.rowGridSelectData.comId;
},
selectedBlocId() {
return this.pageData.rowGridSelectData.blocId;
},
selectedReadPlcId() {
return this.pageData.rowGridSelectData.readPlcId;
},
},
mounted() {
this.init();
},
methods: {
...mapMutations({
setPageData: 'setPageData',
setGridData: 'setGridData',
setGridColumn: 'setGridColumn',
setGridOption: 'setGridOption',
}),
...mapActions({
postApi: 'modules/list/postApi',
postUpdateApi: 'modules/list/postUpdateApi',
postApiReturn: 'modules/list/postApiReturn',
setTree: 'modules/list/setTree',
chkOpenTabList: 'chkOpenTabList',
}),
init() {
this.gridInit();
},
gridInit() {
const gridHeight = this.$refs['gridParent'].offsetHeight - 36;
const myOptions = {
// bodyHeight: gridHeight,
// minBodyHeight: gridHeight,
header: {
height: 28,
},
rowHeight: 29,
minRowHeight: 29,
selectionUnit: 'row',
editingEvent: 'click',
// columnOptions: {
// resizable: true,
// minWidth: 100
// }
};
this.setGridOption({
gridKey: this.gridName,
// value: myOptions
value: Object.assign(Utility.defaultGridOption(gridHeight), myOptions),
});
const _this = this;
let useFgSelectList = [];
this.pageData.useFgList.forEach(item => {
const it = { text: item.commCdNm, value: item.commCd };
useFgSelectList.push(it);
});
let addInfoList = [];
this.pageData.addInfoList.forEach(item => {
const it = { text: item.addInfoNm, value: item.addInfoId };
addInfoList.push(it);
});
let addInfoDataKindList = [];
this.pageData.addInfoDataKindList.forEach(item => {
const it = { text: item.commCdNm, value: item.commCd };
addInfoDataKindList.push(it);
});
const myColumns = [
{ header: '회사 ID', name: 'comId', hidden: true },
{ header: '검침개소 번호', name: 'readPlcId', hidden: true },
{ header: 'ERC NM', name: 'ercNm', align: 'center', hidden: true },
{ header: 'TAG 명', name: 'tagNm', align: 'left' },
{ header: 'TAG ID', name: 'tagId', align: 'center', hidden: true },
{
header: '에너지원',
name: 'ercId',
align: 'center',
width: 100,
formatter({ value }) {
let retVal = '';
const newValue = _this.pageData.ercNmList.filter(
item => item.value == value,
);
if (newValue.length > 0) {
retVal = newValue[0].text;
}
return retVal;
},
},
{
header: '분배율(1~100)',
name: 'distRt',
align: 'right',
width: 100,
// editor: {
// type: CustomNumberEditor,
// options: {
// min: 0,
// max: 100,
// }
// }
},
{
header: '대표 TAG 여부',
name: 'reprTagFg',
align: 'center',
width: 100,
// renderer: {
// type: CustumChecbox,
// options: {
// onlyone: true,
// // disabled: true
// }
// }
formatter({ value }) {
return value == '1' ? '예' : '아니오';
},
},
{
header: '사용여부',
name: 'useFg',
align: 'center',
width: 100,
formatter({ value }) {
value = value === true ? '1' : '0';
const newValue = _this.pageData.useFgList.filter(
item => item.commCd == value,
);
return newValue[0].commCdNm;
},
// editor: {
// type: "select",
// options: {
// listItems: useFgSelectList
// }
// }
},
{ header: '비고', name: 'rmrk', align: 'left', width: 100 },
{ header: '등록 사용자', name: 'regUserNo', hidden: true },
{ header: '등록 일자', name: 'regDttm', hidden: true },
{ header: '수정 사용자', name: 'procUserNo', hidden: true },
{ header: '수정 일자', name: 'procDttm', hidden: true },
];
this.setGridColumn({
gridKey: this.gridName,
value: myColumns,
});
this.loadGrid = true;
},
async getRowData(data, gridName) {
if (data.rowStat === 'I') {
this.detailReadPlcTagList[0].disabled = false;
this.detailReadPlcTagList[1].disabled = false;
} else {
this.detailReadPlcTagList[0].disabled = true;
this.detailReadPlcTagList[1].disabled = true;
}
this.setGridSelectData({
gridKey: gridName,
gridSelect: true,
rowGridSelectKey: data.rowKey,
rowGridSelectData: Object.assign({}, data),
});
},
async btnActions(action) {
let dataArr = [];
switch (action) {
case 'add':
const defaultRow = {
tagId: '',
tagNm: '',
ercId: this.pageData.ercNmList[0].value,
rmrk: null,
distRt: '',
reprTagFg: '1',
useFg: true,
};
this.$refs[this.gridName].addRow(defaultRow);
this.detailReadPlcTagList[0].disabled = false;
this.detailReadPlcTagList[1].disabled = false;
break;
case 'remove':
this.$refs[this.gridName].removeRow();
this.detailReadPlcTagList[0].disabled = true;
this.detailReadPlcTagList[1].disabled = true;
break;
case 'save':
dataArr = this.$refs[this.gridName].save();
// this.loadGrid = false;
const newDataArr = dataArr.map(item => {
const newData = {
...item,
comId: this.selectedComId,
readPlcId: this.selectedReadPlcId,
};
newData.reprTagFg = newData.reprTagFg == true ? '1' : '0';
newData.useFg = newData.useFg == true ? '1' : '0';
return newData;
});
if (dataArr.length > 0) {
var validCheck = true;
dataArr.filter(item => {
if (item.rowStat === 'I') {
if (item.tagId == '' || item.distRt == '' || item.ercId == '') {
alert('필수 입력값을 입력해주세요.');
validCheck = false;
}
} else if (item.rowStat === 'U') {
if (item.distRt == '' || item.ercId == '') {
alert('필수 입력값을 입력해주세요.');
validCheck = false;
}
}
});
if (validCheck) {
const sendParam = {
datas: {
dsReadPlcTagRel: newDataArr,
},
params: {},
};
await this.postUpdateApi({
apiKey: 'saveReadPlcTagRel',
sendParam: sendParam,
});
// this.loadGrid = true;
this.setPageData({ isFind: true });
}
} else {
alert('저장할 내용이 없습니다.');
}
break;
default:
break;
}
},
gridEditingFinish(data, bindingData) {
this.$refs[this.gridName].editingFinish(data);
},
search() {},
},
};
const myReadPlcTagDetail = [
{
type: 'EvtObjPop',
labelContent: 'TAG',
modalTitle: 'TAG 리스트',
valueNm: 'tagId',
valueNm2: 'tagNm',
disabled: true,
cols: 6,
class: 'py-2',
required: true,
},
{
type: 'InputText',
valueNm: 'tagNm',
readonly: true,
cols: 5,
class: 'py-2',
required: true,
},
{
type: 'SelectBox',
label: '에너지원',
valueNm: 'ercId',
disabled: false,
cols: 6,
class: 'py-2',
list: 'ercNmList',
itemText: 'text',
itemValue: 'value',
required: true,
},
{
type: 'CheckBox',
label: '대표 TAG 여부',
valueNm: 'reprTagFg',
disabled: false,
cols: 6,
class: 'py-2',
value: { '1': true, '0': false },
required: true,
},
{
type: 'InputNumber',
label: '분배율(1~100)',
valueNm: 'distRt',
disabled: false,
cols: 6,
class: 'py-2',
inputType: 'number',
min: 1,
max: 100,
required: true,
},
{
type: 'CheckBox',
label: '사용여부',
valueNm: 'useFg',
disabled: false,
cols: 6,
class: 'py-2',
value: { '1': true, '0': false },
required: true,
},
{
type: 'InputText',
label: '비고',
valueNm: 'rmrk',
disabled: false,
cols: 6,
class: 'py-2',
inputType: 'string',
},
];
</script>

View File

@ -0,0 +1,431 @@
<template>
<div>
<div
class="d-flex justify-space-between align-center"
style="height: 80px;"
>
<span class="txt">TAG 추가 정보</span>
<Buttons
:parentPrgmId="parentPrgmId"
:bindingData="gridName"
:btnActionsFnc="btnActions"
/>
</div>
<div ref="gridParent" style="height: calc(100vh - 520px);">
<Grid
:ref="gridName"
:is="loadGrid ? 'Grid' : null"
:gridName="gridName"
:parentPrgmId="parentPrgmId"
:editorGrid="true"
:innerTabGridInfo="innerTabGridInfo"
@getRowsData="getRowData"
/>
</div>
</div>
</template>
<script>
import { mapState, mapMutations, mapActions } from 'vuex';
import Buttons from '~/components/common/button/Buttons';
import Grid from '~/components/common/Grid';
import { NewCustomRenderer } from '~/plugins/gridUtility';
import { NewCustomEditor } from '~/plugins/gridUtility';
export default {
components: {
Buttons,
Grid,
},
props: {
parentPrgmId: {
type: String,
require: true,
},
innerTabGridInfo: {
type: Object,
default: null,
},
},
data() {
return {
loadGrid: false,
gridName: 'rowDetailGrid',
rowKey: null,
edtingFinishFlag: 'Y',
};
},
computed: {
...mapState({
pageData(state) {
return state.pageData[this.parentPrgmId];
},
}),
selectedCommCd() {
return this.pageData[this.gridName].data;
},
myUseFgList() {
return this.pageData.useFgList;
},
selectedComId() {
return this.pageData.rowGridSelectData.comId;
},
selectedTagId() {
return this.pageData.rowGridSelectData.tagId;
},
},
mounted() {
this.init();
},
methods: {
...mapMutations({
setPageData: 'setPageData',
setGridData: 'setGridData',
setGridColumn: 'setGridColumn',
setGridOption: 'setGridOption',
}),
...mapActions({
postApi: 'modules/list/postApi',
postUpdateApi: 'modules/list/postUpdateApi',
postApiReturn: 'modules/list/postApiReturn',
setTree: 'modules/list/setTree',
chkOpenTabList: 'chkOpenTabList',
}),
init() {
this.gridInit();
},
gridInit() {
const gridHeight = this.$refs.gridParent.offsetHeight - 30;
const myOptions = {
columnOptions: {
resizable: true,
},
bodyHeight: gridHeight,
minBodyHeight: gridHeight,
header: {
height: 28,
},
rowHeight: 29,
minRowHeight: 29,
selectionUnit: 'row',
editingEvent: 'click',
};
this.setGridOption({
gridKey: this.gridName,
value: myOptions,
});
const _this = this;
let useFgSelectList = [];
this.pageData.useFgList.forEach(item => {
const it = { text: item.commCdNm, value: item.commCd };
useFgSelectList.push(it);
});
let addInfoList = [];
this.pageData.addInfoList.forEach(item => {
const it = { text: item.addInfoNm, value: item.addInfoId };
addInfoList.push(it);
});
let addInfoDataKindList = [];
this.pageData.addInfoDataKindList.forEach(item => {
const it = { text: item.commCdNm, value: item.commCd };
addInfoDataKindList.push(it);
});
// class CustomRenderer {
// constructor(props) {
// //const { min, max } = props.columnInfo.renderer.options;
// //console.log('props: %o', props);
// const el = document.createElement('input');
// if (
// props.grid.store.data.rawData[props.rowKey].addInfoDataKind == 'FG'
// ) {
// el.type = 'checkbox';
// } else {
// el.type = 'text';
// $(el).addClass('tui-grid-cell-content');
// $(el).css('text-align', 'center');
// }
// // el.min = String(min);
// //el.max = String(max);
// //el.disabled = true;
// this.el = el;
// this.render(props);
// }
// getElement() {
// return this.el;
// }
// render(props) {
// if (this.el.type == 'checkbox') {
// if (props.value == 1) {
// this.el.checked = true;
// } else {
// this.el.checked = false;
// }
// }
// this.el.value = props.value;
// }
// }
// class CustomEditor {
// constructor(props) {
// const el = document.createElement('input');
// if (
// props.grid.store.data.rawData[props.rowKey].addInfoDataKind == 'FG'
// ) {
// el.type = 'checkbox';
// if (props.value == 1) {
// el.checked = true;
// } else {
// el.checked = false;
// }
// el.addEventListener('change', this.change);
// } else {
// el.type = 'text';
// if (props.formattedValue == 'NUM') {
// // el.keyDown = "this.value=this.value.replace(/[^0-9]/g,'');"
// el.onkeydown = function(event) {
// var code = event.keyCode;
// if (
// (code > 47 && code < 58) ||
// event.ctrlKey ||
// event.altKey ||
// code == 8 ||
// code == 9 ||
// code == 46
// ) {
// if (event.ctrlKey && event.keyCode == 86) {
// event.preventDefault();
// }
// return;
// }
// event.preventDefault();
// };
// }
// $(el).addClass('tui-grid-content-text');
// }
// // console.log('props: %o', props);
// // console.log('el: %o', el);
// this.el = el;
// this.render(props);
// }
// change(ev) {
// //console.log('props: %o', ev);
// if (ev.target.checked) {
// ev.target.value = 1;
// } else {
// ev.target.value = 0;
// }
// }
// getElement() {
// return this.el;
// }
// getValue() {
// return this.el.value;
// }
// render(props) {
// if (this.el.type == 'checked') {
// this.el.value = props.value;
// } else {
// this.el.value = String(props.value);
// }
// //console.log('props: %o', props);
// }
// mounted() {
// if (this.el.type == 'checkbox') {
// $(this.el.parentElement).css('text-align', 'center');
// }
// this.el.select();
// }
// }
const myColumns = [
{ header: '회사 ID', name: 'comId', hidden: true },
{ header: 'TAG 번호', name: 'tagId', hidden: true },
{
header: '추가 정보',
name: 'addInfoId',
align: 'left',
formatter({ value }) {
let retVal = '';
const newValue = addInfoList.filter(item => item.value == value);
if (newValue.length > 0) {
retVal = newValue[0].text;
}
return retVal;
},
},
{
header: 'Data 구분',
name: 'addInfoDataKind',
align: 'center',
formatter({ value }) {
let retVal = '';
const newValue = addInfoDataKindList.filter(
item => item.value == value,
);
if (newValue.length > 0) {
retVal = newValue[0].text;
}
return retVal;
},
},
{
header: '숫자 값',
name: 'addInfoNumVal',
align: 'right',
editor: 'text',
hidden: true,
},
{
header: '문자 값',
name: 'addInfoTxtVal',
align: 'left',
editor: 'text',
hidden: true,
},
{
header: '추가 정보 값',
name: 'addInfoVal',
align: 'center',
renderer: {
type: NewCustomRenderer,
/*options: {
min: 1,
max: 5
}*/
},
editor: {
type: NewCustomEditor,
/*type: "checkbox",
options: {
listItems: [
{text:"사용", value:"1"},
{text:"사용안함", value:"0"},
]
}*/
},
formatter(data) {
return data.row.addInfoDataKind;
},
},
//{ header: "추가 정보 값", name: "addInfoVal", align: "center" , editor: "text",
// formatter({ value, row , column}) {
// console.log("addInfoVal row : ", row);
// console.log("addInfoVal state : ", column);
// if(row.addInfoDataKind === "NUM"){
// column.align = "right";
// }else{
// column.align = "left";
// }
// return value;
// }
// },
/*{
header: "사용여부",
name: "useFg",
align: "center",
formatter({ value }) {
return value == "1" ? "사용" : "사용안함";
},
editor: {
type: "select",
options: {
// listItems: useFgSelectList
listItems: [
{text:"사용", value:"1"},
{text:"사용안함", value:"0"},
]
}
}
},*/
{ header: '등록 사용자', name: 'regUserNo', hidden: true },
{ header: '등록 일자', name: 'regDttm', hidden: true },
{ header: '수정 사용자', name: 'procUserNo', hidden: true },
{ header: '수정 일자', name: 'procDttm', hidden: true },
];
this.setGridColumn({
gridKey: this.gridName,
value: myColumns,
});
this.loadGrid = true;
},
async btnActions(action) {
let dataArr = [];
switch (action) {
case 'remove':
await this.$refs[this.gridName].editingFinish({
rowKey: this.rowKey,
});
this.$refs[this.gridName].removeRow();
this.edtingFinishFlag = 'N';
break;
case 'save':
if (this.edtingFinishFlag == 'Y') {
await this.$refs[this.gridName].editingFinish({
rowKey: this.rowKey,
});
}
this.loadGrid = false;
dataArr = this.$refs[this.gridName].save();
// console.log('dataArr : ', dataArr);
for (var i = 0; i < dataArr.length; i++) {
if (
dataArr[i].addInfoDataKind == 'NUM' &&
dataArr[i].addInfoVal == ''
) {
dataArr[i].addInfoVal = null;
}
}
this.setPageData({ isFind: true });
if (dataArr.length > 0) {
const sendParam = {
datas: {
dsTagAddInfo: dataArr.map(item => ({
...item,
comId: this.selectedComId,
tagId: this.selectedTagId,
})),
},
params: {},
};
await this.postUpdateApi({
apiKey: 'saveTagAddInfoList',
sendParam: sendParam,
});
this.loadGrid = true;
this.setPageData({ isFind: true });
this.edtingFinishFlag = 'Y';
} else {
this.loadGrid = true;
alert('저장할 내용이 없습니다.');
}
break;
default:
break;
}
},
async getRowData(data) {
this.rowKey = data.rowKey;
this.edtingFinishFlag = 'Y';
},
gridEditingFinish(data) {
this.$refs[this.gridName].editingFinish(data);
},
search() {},
},
};
</script>