422 lines
9.0 KiB
Vue
422 lines
9.0 KiB
Vue
<template>
|
|
<v-row class="search-box" align="center" no-gutters>
|
|
<v-col :cols="labelCols">
|
|
<label for="" class="search-box-label">
|
|
<v-icon x-small :color="required ? '#fb8200' : 'primary'" class="mr-1"
|
|
>mdi-record-circle</v-icon
|
|
>
|
|
{{ labelContent }}
|
|
</label>
|
|
</v-col>
|
|
<v-col :cols="textCols">
|
|
<v-text-field
|
|
readonly
|
|
v-model="selectValue"
|
|
append-icon="mdi-magnify"
|
|
class="v-input__custom"
|
|
@click="dialogOpenCloseEvent(dialog)"
|
|
outlined
|
|
:hide-details="true"
|
|
:required="required || false"
|
|
:disabled="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">{{ 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="3">
|
|
<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="5">
|
|
<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: calc(50vh)'">
|
|
<!-- <div :style="{ height: 'calc(100% - 213px)' }"> -->
|
|
<div ref="modalGridParent" class="h100 py-3">
|
|
<component
|
|
:is="loadGrid && dialog ? 'Grid' : null"
|
|
:gridName="grid_01"
|
|
:dataPath="searchParam.modalData2.eqpmPop"
|
|
: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-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';
|
|
|
|
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: '검색',
|
|
},
|
|
required: {
|
|
require: false,
|
|
default: false,
|
|
},
|
|
disabled: {
|
|
require: false,
|
|
default: false,
|
|
},
|
|
bindOption: {
|
|
type: Object,
|
|
requrie: false,
|
|
default: null,
|
|
},
|
|
},
|
|
components: {
|
|
Grid,
|
|
Utility,
|
|
},
|
|
data() {
|
|
return {
|
|
dialog: false,
|
|
|
|
loadGrid: false,
|
|
grid_01: 'grid_01',
|
|
myModalKey: 'eqpmPop',
|
|
modalDataKey: 'modalData2',
|
|
|
|
searchWord: '',
|
|
selectedData: {},
|
|
textFieldData: '',
|
|
parentModalState: 'close',
|
|
};
|
|
},
|
|
computed: {
|
|
...mapState({
|
|
searchParam(state) {
|
|
return state.pageData[this.parentPrgmId];
|
|
},
|
|
}),
|
|
selectValue: {
|
|
get() {
|
|
if (!this.item) {
|
|
return this.textFieldData;
|
|
}
|
|
},
|
|
set(value) {
|
|
return value;
|
|
},
|
|
},
|
|
},
|
|
watch: {
|
|
async dialog(val) {
|
|
if (val) {
|
|
await this.getGridData();
|
|
}
|
|
},
|
|
parentModalState(val) {
|
|
if (this.bindOption !== null) {
|
|
if (val === 'open') {
|
|
this.textFieldData = this.searchParam.rowGridSelectData.eqpmNm;
|
|
this.searchParam[
|
|
this.bindOption.eqpmId
|
|
] = this.searchParam.rowGridSelectData.eqpmId;
|
|
this.searchParam[
|
|
this.bindOption.eqpmNm
|
|
] = this.searchParam.rowGridSelectData.eqpmNm;
|
|
} else if (val === 'openWithInit') {
|
|
this.textFieldData = '';
|
|
this.searchParam[this.bindOption.eqpmId] = '';
|
|
this.searchParam[this.bindOption.eqpmNm] = '';
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
beforeCreate() {
|
|
this.$store.commit('setPageData', {
|
|
modalData2: { eqpmPop },
|
|
});
|
|
},
|
|
created() {
|
|
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();
|
|
},
|
|
search() {
|
|
this.getGridData();
|
|
},
|
|
initSearch() {
|
|
this.searchWord = '';
|
|
this.getGridData();
|
|
|
|
this.textFieldData = '';
|
|
this.selectedData.eqpmId = '';
|
|
this.selectedData.eqpmNm = '';
|
|
|
|
if (this.bindOption === null) {
|
|
this.setPageData({
|
|
modalEqpmId: '',
|
|
modalEqpmNm: '',
|
|
});
|
|
} else {
|
|
this.setPageData({
|
|
[this.bindOption.eqpmId]: '',
|
|
[this.bindOption.eqpmNm]: '',
|
|
});
|
|
}
|
|
},
|
|
gridInit() {
|
|
const myOptions = {
|
|
columnOptions: {
|
|
resizable: true,
|
|
},
|
|
};
|
|
this.setModalGridOption({
|
|
modalKey: this.myModalKey,
|
|
gridKey: this.grid_01,
|
|
modalDataKey: this.modalDataKey,
|
|
value: Object.assign(
|
|
Utility.defaultGridOption(400, myOptions),
|
|
myOptions,
|
|
),
|
|
});
|
|
|
|
const _this = this;
|
|
|
|
this.setModalGridColumn({
|
|
modalKey: this.myModalKey,
|
|
gridKey: this.grid_01,
|
|
modalDataKey: this.modalDataKey,
|
|
value: [
|
|
{ header: '회사 ID', name: 'comId', hidden: true },
|
|
{ header: '설비 ID', name: 'eqpmId', width: 100, align: 'center' },
|
|
{ header: '설비명', name: 'eqpmNm', width: 150, align: 'center' },
|
|
{
|
|
header: '설비 유형',
|
|
name: 'eqpmKind',
|
|
width: 100,
|
|
align: 'center',
|
|
formatter({ value }) {
|
|
let retVal = '';
|
|
const newValue = _this.searchParam.eqpmKindList.filter(
|
|
item => item.commCd == value,
|
|
);
|
|
if (newValue.length > 0) {
|
|
retVal = newValue[0].commCdNm;
|
|
}
|
|
return retVal;
|
|
},
|
|
},
|
|
{
|
|
header: '설비 그룹',
|
|
name: 'eqpmGrpId',
|
|
width: 100,
|
|
align: 'center',
|
|
formatter({ value }) {
|
|
let retVal = '';
|
|
const newValue = _this.searchParam.eqpmGrpList.filter(
|
|
item => item.eqpmGrpId == value,
|
|
);
|
|
if (newValue.length > 0) {
|
|
retVal = newValue[0].eqpmGrpNm;
|
|
}
|
|
return retVal;
|
|
},
|
|
},
|
|
{
|
|
header: '사업장',
|
|
name: 'blocId',
|
|
width: 88,
|
|
align: 'center',
|
|
formatter({ value }) {
|
|
let retVal = '';
|
|
const newValue = _this.searchParam.blocIdList.filter(
|
|
item => item.blocId == value,
|
|
);
|
|
if (newValue.length > 0) {
|
|
retVal = newValue[0].blocNm;
|
|
}
|
|
return retVal;
|
|
},
|
|
},
|
|
],
|
|
});
|
|
},
|
|
async getGridData() {
|
|
this.loadGrid = false;
|
|
|
|
const res = await this.postApiReturn({
|
|
apiKey: 'selectEqpmBaseInfo',
|
|
resKey: 'eqpmBaseInfoData',
|
|
sendParam: {
|
|
eqpmNmLike: this.searchWord,
|
|
},
|
|
});
|
|
|
|
this.setModalGridData({
|
|
modalKey: this.myModalKey,
|
|
gridKey: this.grid_01,
|
|
modalDataKey: this.modalDataKey,
|
|
value: res,
|
|
});
|
|
|
|
this.loadGrid = true;
|
|
},
|
|
getRowData(data) {
|
|
this.selectedData = { ...data };
|
|
},
|
|
setUpdate(v) {
|
|
this.dialog = false;
|
|
this.textFieldData = this.selectedData.eqpmNm;
|
|
if (this.bindOption === null) {
|
|
this.searchParam.modalEqpmId = this.selectedData.eqpmId;
|
|
this.searchParam.modalEqpmNm = this.selectedData.eqpmNm;
|
|
} else {
|
|
this.searchParam[this.bindOption.eqpmId] = this.selectedData.eqpmId;
|
|
this.searchParam[this.bindOption.eqpmNm] = this.selectedData.eqpmNm;
|
|
}
|
|
|
|
this.setPageData({ isFind: true });
|
|
},
|
|
dialogOpenCloseEvent(val) {
|
|
this.dialog = !val;
|
|
},
|
|
},
|
|
};
|
|
|
|
var eqpmPop = {
|
|
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>
|