sk_fems_ui commit
This commit is contained in:
594
components/common/modal/EgrpPysclQtyPop.vue
Normal file
594
components/common/modal/EgrpPysclQtyPop.vue
Normal file
@ -0,0 +1,594 @@
|
||||
<template>
|
||||
<v-row class="search-box" align="center" no-gutters>
|
||||
<v-col :cols="option.labelCols">
|
||||
<label for="" class="search-box-label">
|
||||
<v-icon
|
||||
x-small
|
||||
:color="item.required ? '#fb8200' : 'primary'"
|
||||
class="mr-1"
|
||||
>mdi-record-circle</v-icon
|
||||
>
|
||||
{{ option.labelContent }}
|
||||
</label>
|
||||
</v-col>
|
||||
<v-col :cols="option.textCols">
|
||||
<v-text-field
|
||||
:readonly="item.readonly || false"
|
||||
v-model="selectValue"
|
||||
append-icon="mdi-magnify"
|
||||
class="v-input__custom"
|
||||
@click="dialogOpenCloseEvent(dialog)"
|
||||
outlined
|
||||
:hide-details="true"
|
||||
:required="item.required || false"
|
||||
:disabled="item.disabled || false"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
|
||||
<v-dialog v-model="dialog" scrollable width="540px">
|
||||
<v-card style="height: 100%">
|
||||
<v-card-title class="pa-5 d-flex align-center justify-space-between">
|
||||
<span class="custom-title-4">{{ option.modalTitle }}</span>
|
||||
<v-btn
|
||||
icon
|
||||
tile
|
||||
:ripple="false"
|
||||
@click="dialogOpenCloseEvent(dialog)"
|
||||
>
|
||||
<v-icon>mdi-close</v-icon>
|
||||
</v-btn>
|
||||
</v-card-title>
|
||||
<div class="pa-5">
|
||||
<v-row align="center" no-gutters>
|
||||
<v-col :cols="12">
|
||||
<component
|
||||
:is="'SelectBox'"
|
||||
ref="SelectBox1"
|
||||
:labelCols="2"
|
||||
:textCols="6"
|
||||
:disabled="option.eqpmGrpDisableFlag"
|
||||
:propsValue="selectValue01"
|
||||
:itemList="selectValueList01"
|
||||
:label="'설비그룹'"
|
||||
@update:propsValue="selectValue01 = $event"
|
||||
:readonly="
|
||||
item.selectBoxReadonly != undefined
|
||||
? item.selectBoxReadonly
|
||||
: false
|
||||
"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row align="center" no-gutters>
|
||||
<v-col :cols="2">
|
||||
<label for="" class="search-box-label">
|
||||
<v-icon x-small color="primary" class="mr-1"
|
||||
>mdi-record-circle</v-icon
|
||||
>
|
||||
물리량명
|
||||
</label>
|
||||
</v-col>
|
||||
<v-col :cols="6">
|
||||
<v-text-field
|
||||
append-icon="mdi-magnify"
|
||||
class="v-input__custom"
|
||||
outlined
|
||||
:hide-details="true"
|
||||
v-model="searchWord"
|
||||
@keyup.enter="search"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-spacer></v-spacer>
|
||||
<v-col cols="4" class="text-right">
|
||||
<v-btn :ripple="false" @click="search()">
|
||||
조회
|
||||
</v-btn>
|
||||
<!-- <v-btn :ripple="false" @click="initSearch()">
|
||||
초기화
|
||||
</v-btn> -->
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
<v-divider></v-divider>
|
||||
<div :style="'height: 429px;'">
|
||||
<!-- <div :style="{ height: 'calc(100% - 213px)' }"> -->
|
||||
<div ref="modalGridParent" class="h100 w100">
|
||||
<component
|
||||
:is="loadGrid && dialog ? 'Grid' : null"
|
||||
:gridName="grid_01"
|
||||
:dataPath="searchParam.pyscModalData.egrpPysclQtyPop"
|
||||
:parentPrgmId="parentPrgmId"
|
||||
@getRowsData="getRowData"
|
||||
@dblClick="setUpdate($event)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<v-card-actions class="pa-5 d-flex align-center justify-center">
|
||||
<v-btn :ripple="false" @click="setUpdate($event)">확인</v-btn>
|
||||
<v-btn :ripple="false" @click="dialogOpenCloseEvent(dialog)"
|
||||
>닫기</v-btn
|
||||
>
|
||||
<v-btn
|
||||
v-if="item.closeBtnFg || false"
|
||||
:ripple="false"
|
||||
@click="deleteBtnAction($event)"
|
||||
>삭제</v-btn
|
||||
>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</v-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState, mapMutations, mapActions } from 'vuex';
|
||||
import Grid from '~/components/common/Grid';
|
||||
import Utility from '~/plugins/utility';
|
||||
import SelectBox from '@/components/common/select/SelectBox';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
parentPrgmId: {
|
||||
type: String,
|
||||
require: true,
|
||||
},
|
||||
labelCols: {
|
||||
type: Number,
|
||||
require: false,
|
||||
default: 4,
|
||||
},
|
||||
labelContent: {
|
||||
type: String,
|
||||
require: false,
|
||||
default: '물리량',
|
||||
},
|
||||
textCols: {
|
||||
type: Number,
|
||||
require: false,
|
||||
default: 7,
|
||||
},
|
||||
modalTitle: {
|
||||
type: String,
|
||||
require: false,
|
||||
default: '물리량선택',
|
||||
},
|
||||
modalContent: {
|
||||
type: String,
|
||||
require: false,
|
||||
default: '검색',
|
||||
},
|
||||
item: {
|
||||
type: Object,
|
||||
require: false,
|
||||
},
|
||||
bindingData: {
|
||||
type: String,
|
||||
require: false,
|
||||
},
|
||||
eqpmGrpDisableFlag:{
|
||||
type: Boolean,
|
||||
require: false,
|
||||
default: false
|
||||
}
|
||||
// bindingFlag:{
|
||||
// type:Boolean,
|
||||
// require: false,
|
||||
// default: false
|
||||
// }
|
||||
},
|
||||
components: {
|
||||
Grid,
|
||||
Utility,
|
||||
SelectBox,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialog: false,
|
||||
|
||||
loadGrid: false,
|
||||
grid_01: 'grid_01',
|
||||
myModalKey: 'egrpPysclQtyPop',
|
||||
modalDataKey: 'pyscModalData',
|
||||
searchWord: '',
|
||||
selectedData: {},
|
||||
textFieldData: '',
|
||||
selectValue01: null,
|
||||
selectValueList01: [],
|
||||
pyscPopVal: '',
|
||||
option: {
|
||||
labelCols:
|
||||
this.item !== undefined
|
||||
? this.item.labelCols !== undefined
|
||||
? this.item.labelCols
|
||||
: this.labelCols
|
||||
: this.labelCols,
|
||||
labelContent:
|
||||
this.item !== undefined
|
||||
? this.item.labelContent !== undefined
|
||||
? this.item.labelContent
|
||||
: this.labelContent
|
||||
: this.labelContent,
|
||||
textCols:
|
||||
this.item !== undefined
|
||||
? this.item.textCols !== undefined
|
||||
? this.item.textCols
|
||||
: this.textCols
|
||||
: this.textCols,
|
||||
modalTitle:
|
||||
this.item !== undefined
|
||||
? this.item.modalTitle !== undefined
|
||||
? this.item.modalTitle
|
||||
: this.modalTitle
|
||||
: this.modalTitle,
|
||||
eqpmGrpDisableFlag:
|
||||
this.item !== undefined
|
||||
? this.item.eqpmGrpDisableFlag !== undefined
|
||||
? this.item.eqpmGrpDisableFlag
|
||||
: this.eqpmGrpDisableFlag
|
||||
: this.eqpmGrpDisableFlag
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
searchParam(state) {
|
||||
return state.pageData[this.parentPrgmId];
|
||||
},
|
||||
myBindingData(state) {
|
||||
if (!this.bindingData) {
|
||||
return state.pageData[this.parentPrgmId]['rowGridSelectData'];
|
||||
} else {
|
||||
return state.pageData[this.parentPrgmId][this.bindingData][
|
||||
'rowGridSelectData'
|
||||
];
|
||||
}
|
||||
},
|
||||
pyscPopValChg(state) {
|
||||
if (this.item.popupSeq != undefined) {
|
||||
return state.pageData[this.parentPrgmId]['pyscPopValChg'];
|
||||
}
|
||||
},
|
||||
}),
|
||||
selectValue: {
|
||||
get() {
|
||||
if (!this.item) {
|
||||
return this.textFieldData;
|
||||
}
|
||||
// else if(this.item.disableContent){
|
||||
// return "NONE";
|
||||
// }
|
||||
else {
|
||||
return this.myBindingData
|
||||
? this.myBindingData[this.item.valueNm]
|
||||
: this.textFieldData;
|
||||
}
|
||||
},
|
||||
set(value) {
|
||||
// if(this.item && this.item.disableContent){
|
||||
// return "NONE";
|
||||
// }
|
||||
return value;
|
||||
},
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
async dialog(val) {
|
||||
if (val) {
|
||||
await this.getGridData();
|
||||
}
|
||||
var dt = {
|
||||
dialog: this.dialog,
|
||||
selectedData: this.selectedData,
|
||||
};
|
||||
|
||||
this.$emit('dialogOpenCloseEvent', dt);
|
||||
},
|
||||
async selectValue01(value) {
|
||||
await this.search();
|
||||
},
|
||||
pyscPopValChg(value) {
|
||||
this.pyscPopVal = value;
|
||||
},
|
||||
},
|
||||
|
||||
beforeCreate() {
|
||||
this.$store.commit('setPageData', {
|
||||
pyscModalData: { egrpPysclQtyPop },
|
||||
});
|
||||
},
|
||||
async created() {
|
||||
await this.setSelectValueList01();
|
||||
this.init();
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
...mapMutations({
|
||||
setPageData: 'setPageData',
|
||||
setModalGridData: 'setModalGridData',
|
||||
setModalGridColumn: 'setModalGridColumn',
|
||||
setModalGridOption: 'setModalGridOption',
|
||||
}),
|
||||
...mapActions({
|
||||
postApiReturn: 'modules/list/postApiReturn',
|
||||
setTree: 'modules/list/setTree',
|
||||
}),
|
||||
init() {
|
||||
this.gridInit();
|
||||
},
|
||||
async setSelectValueList01() {
|
||||
// form으로 popup 사용할 때 인자로 eqpmKindId, eqpmGrpId 보내줘야한다.
|
||||
let res = await this.postApiReturn({
|
||||
apiKey: 'selectEqpmGrpCodeList',
|
||||
resKey: 'eqpmGrpCodeLists',
|
||||
sendParam: {
|
||||
eqpmKindId:
|
||||
this.item.eqpmKindId != undefined
|
||||
? this.item.eqpmKindId
|
||||
: this.searchParam.eqpmKindId,
|
||||
},
|
||||
// form을 통해 popup을 사용할 경우 -> this.item.eqpmKindId 사용
|
||||
// 부모 페이지에서 설비종류인 eqpmKindId 값을 꼭 가져와야한다.
|
||||
});
|
||||
if (res.length > 0) {
|
||||
this.selectValueList01 = await res.map(obj => {
|
||||
return {
|
||||
text: obj.eqpmGrpNm,
|
||||
value: obj.eqpmGrpId,
|
||||
};
|
||||
});
|
||||
// form을 통해 popup을 사용할 경우 -> this.item.eqpmGrpId 사용
|
||||
// 부모 페이지에서 설비그룹을 선택한 값이 있다면(eqpmGrpId) 그 값으로 바인딩 아닐 경우 조회한 데이터의 첫번째 값으로 선택
|
||||
// console.log('this.item.eqpmGrpId : ', this.item.eqpmGrpId);
|
||||
// console.log('this.searchParam.eqpmGrpId : ', this.searchParam.eqpmGrpId);
|
||||
this.selectValue01 =
|
||||
this.item.eqpmGrpId != undefined
|
||||
? this.item.eqpmGrpId
|
||||
: this.searchParam.eqpmGrpId != undefined
|
||||
? this.searchParam.eqpmGrpId
|
||||
: this.selectValueList01[0].value;
|
||||
} else {
|
||||
this.selectValueList01 = [];
|
||||
this.selectValue01 = null;
|
||||
}
|
||||
},
|
||||
search() {
|
||||
this.getGridData();
|
||||
},
|
||||
initSearch() {
|
||||
this.searchWord = '';
|
||||
this.getGridData();
|
||||
},
|
||||
gridInit() {
|
||||
const myOptions = {
|
||||
columnOptions: {
|
||||
resizable: true,
|
||||
},
|
||||
};
|
||||
this.setModalGridOption({
|
||||
modalKey: this.myModalKey,
|
||||
gridKey: this.grid_01,
|
||||
modalDataKey: this.modalDataKey,
|
||||
value: Object.assign(
|
||||
// Utility.defaultGridOption(this.$refs.modalGridParent.offsetHeight - 60, myOptions),
|
||||
Utility.defaultGridOption(400, myOptions),
|
||||
myOptions,
|
||||
),
|
||||
});
|
||||
|
||||
this.setModalGridColumn({
|
||||
modalKey: this.myModalKey,
|
||||
gridKey: this.grid_01,
|
||||
modalDataKey: this.modalDataKey,
|
||||
value: [
|
||||
{ header: '설비종류', name: 'eqpmKindId', hidden: true },
|
||||
{ header: '설비그룹ID', name: 'eqpmGrpId', hidden: true },
|
||||
{ header: '물리량ID', name: 'pysclQtyId', width: 100 },
|
||||
{
|
||||
header: '물리량코드',
|
||||
name: 'pysclQtyCd',
|
||||
align: 'left',
|
||||
},
|
||||
{ header: '물리량명', name: 'pysclQtyNm', width: 100 },
|
||||
{ header: 'pysclQtyTp', name: 'pysclQtyTp', hidden: true },
|
||||
{ header: '물리량타입', name: 'pysclQtyTpNm', width: 80 },
|
||||
// { header: 'rowStat', name : 'rowStat'},
|
||||
],
|
||||
});
|
||||
},
|
||||
async getGridData() {
|
||||
this.loadGrid = false;
|
||||
|
||||
let res = [];
|
||||
res = await this.postApiReturn({
|
||||
apiKey: 'selectEgrpPysclQtyPop',
|
||||
resKey: 'egrpPysclQtyData',
|
||||
sendParam: {
|
||||
searchWord: this.searchWord,
|
||||
eqpmGrpId: this.selectValue01,
|
||||
openMode: this.item.openMode,
|
||||
},
|
||||
});
|
||||
let newRes = [];
|
||||
let tempTagList = this.pyscPopVal.split('/*wq2a/');
|
||||
let tagList = tempTagList.filter(item => item != '');
|
||||
if (tagList.length > 0) {
|
||||
newRes = res.filter(item => {
|
||||
return !tagList.includes(item.pysclQtyId);
|
||||
});
|
||||
res = newRes;
|
||||
}
|
||||
|
||||
//이미 선택된 값들 제거(배열)
|
||||
if (this.item.dataList) {
|
||||
if (this.item.dataList.length > 0) {
|
||||
newRes = res.filter(item => {
|
||||
return !this.item.dataList.includes(item.pysclQtyId);
|
||||
});
|
||||
res = newRes;
|
||||
}
|
||||
}
|
||||
|
||||
// res = [
|
||||
// {
|
||||
// 'pysclQtyId' : 'PYSCL00001',
|
||||
// 'pysclQtyCd' : 'AMP_1A',
|
||||
// 'pysclQtyNm' : '회로1 전류A',
|
||||
// 'pysclQtyTpNm' : 'TAG'
|
||||
|
||||
// }
|
||||
// ]
|
||||
this.setModalGridData({
|
||||
modalKey: this.myModalKey,
|
||||
gridKey: this.grid_01,
|
||||
modalDataKey: this.modalDataKey,
|
||||
value: res,
|
||||
});
|
||||
|
||||
this.loadGrid = true;
|
||||
},
|
||||
getRowData(data) {
|
||||
this.selectedData = { ...data };
|
||||
},
|
||||
setUpdate(v) {
|
||||
let flag = false;
|
||||
let bindingObj = {};
|
||||
if (this.item.bindingItemList != undefined) {
|
||||
bindingObj = this.item.bindingItemList;
|
||||
}
|
||||
if (
|
||||
bindingObj.constructor === Object &&
|
||||
Object.keys(bindingObj).length === 0
|
||||
) {
|
||||
this.textFieldData = this.selectedData.calcProc;
|
||||
} else {
|
||||
for (const [parentPageBindingKey, popupBindingKey] of Object.entries(
|
||||
bindingObj,
|
||||
)) {
|
||||
// 여러 물리량 popup을 사용시 같은 물리량 ID 선택을 방지////
|
||||
if (this.item.popupSeq != undefined) {
|
||||
flag = this.checkPyscPopVal(this.selectedData[popupBindingKey]);
|
||||
}
|
||||
if (flag) {
|
||||
alert('물리량이 중복 선택되었습니다.');
|
||||
break;
|
||||
}
|
||||
/////////////////////////////////////////////////////////
|
||||
this.myBindingData[parentPageBindingKey] = this.selectedData[
|
||||
popupBindingKey
|
||||
];
|
||||
|
||||
const dt = {
|
||||
columnName: parentPageBindingKey,
|
||||
value: this.selectedData[popupBindingKey],
|
||||
};
|
||||
|
||||
this.$emit('gridEditingFinish', dt);
|
||||
this.setPageData({
|
||||
[parentPageBindingKey]: this.selectedData[popupBindingKey],
|
||||
});
|
||||
}
|
||||
}
|
||||
this.dialog = flag;
|
||||
},
|
||||
async dialogOpenCloseEvent(val) {
|
||||
await this.setSelectValueList01();
|
||||
if (!this.myBindingData) {
|
||||
return alert('그리드를 먼저 선택해주세요.');
|
||||
}
|
||||
this.dialog = !val;
|
||||
},
|
||||
deleteBtnAction(v) {
|
||||
this.dialog = false;
|
||||
let bindingObj = {};
|
||||
if (this.item.bindingItemList != undefined) {
|
||||
bindingObj = this.item.bindingItemList;
|
||||
}
|
||||
if (
|
||||
bindingObj.constructor === Object &&
|
||||
Object.keys(bindingObj).length === 0
|
||||
) {
|
||||
this.textFieldData = null;
|
||||
} else {
|
||||
for (const [parentPageBindingKey, popupBindingKey] of Object.entries(
|
||||
bindingObj,
|
||||
)) {
|
||||
this.myBindingData[parentPageBindingKey] = null;
|
||||
|
||||
const dt = {
|
||||
columnName: parentPageBindingKey,
|
||||
value: null,
|
||||
};
|
||||
|
||||
this.$emit('gridEditingFinish', dt);
|
||||
|
||||
this.setPageData({ [parentPageBindingKey]: null });
|
||||
}
|
||||
}
|
||||
},
|
||||
checkPyscPopVal(data) {
|
||||
//GdIdxMngPage의 setPyscPopValChg 참고
|
||||
let tempList = [];
|
||||
let res = false;
|
||||
tempList = this.pyscPopVal.split('/*wq2a/');
|
||||
if (tempList.includes(data)) {
|
||||
if (this.item.popupSeq > tempList.indexOf(data)) {
|
||||
res = true;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
var egrpPysclQtyPop = {
|
||||
grid_01: {
|
||||
data: [],
|
||||
column: [],
|
||||
option: {},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep {
|
||||
.v-dialog {
|
||||
overflow-y: hidden !important;
|
||||
}
|
||||
|
||||
.tui-grid-table-container {
|
||||
.tui-grid-table {
|
||||
border-right-style: solid !important;
|
||||
border-right-color: rgba(255, 255, 255, 0.1) !important;
|
||||
}
|
||||
}
|
||||
|
||||
.tui-grid-cell.tui-grid-cell-has-tree
|
||||
.tui-grid-tree-extra-content
|
||||
+ .tui-grid-cell-content:before {
|
||||
content: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
@each $theme in dark, light {
|
||||
.v-application.#{$theme}-mode {
|
||||
.v-dialog {
|
||||
.v-card {
|
||||
&__title {
|
||||
color: map-deep-get($color, 'white', '0');
|
||||
@if $theme == dark {
|
||||
background-color: #2d3355;
|
||||
.v-btn {
|
||||
background-color: #2d3355;
|
||||
}
|
||||
} @else {
|
||||
background-color: #3f4d7d;
|
||||
.v-btn {
|
||||
background-color: #3f4d7d;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user