sk_fems_ui commit
This commit is contained in:
520
pages/comm/auth/IndvDashboardMngPage.vue
Normal file
520
pages/comm/auth/IndvDashboardMngPage.vue
Normal file
@ -0,0 +1,520 @@
|
||||
<template>
|
||||
<div class="l-layout">
|
||||
<v-row ref="searchFilter"> </v-row>
|
||||
<v-row ref="contents">
|
||||
<v-col cols="12">
|
||||
<v-card>
|
||||
<v-card-title class="justify-space-between">
|
||||
<span class="custom-title-4">개인 대시보드 관리</span>
|
||||
<BtnSearch @click="search()" class="mr-1" />
|
||||
</v-card-title>
|
||||
<v-row
|
||||
align="center"
|
||||
no-gutters
|
||||
:style="{ height: 'calc(100% - 62px)' }"
|
||||
class="px-5"
|
||||
>
|
||||
<v-col :cols="6" class="h100">
|
||||
<span
|
||||
class="body-1 font-weight-bold d-flex align-center"
|
||||
:style="{ minHeight: '36px' }"
|
||||
>[미배정] 위젯 리스트</span
|
||||
>
|
||||
<div
|
||||
ref="gridParent"
|
||||
class="py-5"
|
||||
:style="{ height: 'calc(50% - 100px)' }"
|
||||
>
|
||||
<component
|
||||
:ref="gridName"
|
||||
:is="loadGrid ? 'Grid' : null"
|
||||
:parentPrgmId="myPrgmId"
|
||||
:gridName="gridName"
|
||||
@getRowsData="getUnAsgnRowData"
|
||||
/>
|
||||
</div>
|
||||
<div class="">
|
||||
<component
|
||||
:is="'Form'"
|
||||
:parentPrgmId="myPrgmId"
|
||||
:bindingData="gridName"
|
||||
:detailList="detailList"
|
||||
/>
|
||||
<v-row class="search-box py-2" align="center" no-gutters>
|
||||
<v-col :cols="2">
|
||||
<label class="search-box-label">
|
||||
<v-icon x-small color="primary" class="mr-1"
|
||||
>mdi-record-circle</v-icon
|
||||
>
|
||||
썸네일
|
||||
</label>
|
||||
</v-col>
|
||||
<v-col :cols="10">
|
||||
<img
|
||||
ref="uploadItemImage"
|
||||
id="itemImage"
|
||||
src=""
|
||||
style="width: 100%; height: 210px; border: 1px solid; object-fit: cover;"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</v-col>
|
||||
<v-col :cols="1">
|
||||
<ActionButtons
|
||||
:parentPrgmId="myPrgmId"
|
||||
:leftGridName="gridName"
|
||||
:rightGridName="gridName2"
|
||||
:btnActionsFnc="dualGridBtnActions"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col :cols="5" class="h100">
|
||||
<v-row
|
||||
justify="space-between"
|
||||
align="center"
|
||||
no-gutters
|
||||
class="pl-5 pr-1"
|
||||
>
|
||||
<v-col>
|
||||
<span class="body-1 font-weight-bold"
|
||||
>[배정] 위젯 리스트</span
|
||||
>
|
||||
</v-col>
|
||||
<v-col class="text-right">
|
||||
<Buttons
|
||||
:parentPrgmId="myPrgmId"
|
||||
:bindingData="gridName2"
|
||||
:btnActionsFnc="btnActions"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<div
|
||||
ref="gridParent2"
|
||||
class="pa-5"
|
||||
:style="{ height: 'calc(100% - 64px)' }"
|
||||
>
|
||||
<component
|
||||
:ref="gridName2"
|
||||
:is="loadGrid2 ? 'Grid' : null"
|
||||
:parentPrgmId="myPrgmId"
|
||||
:gridName="gridName2"
|
||||
:editorGrid="true"
|
||||
@getRowsData="getAsgnRowData"
|
||||
/>
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { mapState, mapMutations, mapActions } from 'vuex';
|
||||
import mixinGlobal from '@/mixin/global.js';
|
||||
import InputText from '@/components/common/input/InputText';
|
||||
import BtnSearch from '~/components/common/button/BtnSearch';
|
||||
import Grid from '~/components/common/Grid';
|
||||
import Buttons from '~/components/common/button/Buttons';
|
||||
import ActionButtons from '~/components/common/button/ActionButtons';
|
||||
import BtnExcelDownload from '~/components/common/button/BtnExcelDownload';
|
||||
import Utility from '~/plugins/utility';
|
||||
import Form from '~/components/common/form/Form';
|
||||
// import ChangePassword from "~/components/common/modal/ChangePassword";
|
||||
|
||||
let myTitle;
|
||||
let myPrgmId;
|
||||
|
||||
export default {
|
||||
mixins: [mixinGlobal],
|
||||
async asyncData(context) {
|
||||
const myState = context.store.state;
|
||||
myPrgmId = context.route.query.prgmId;
|
||||
await context.store.commit('setActiveMenuInfo', myState.menuData[myPrgmId]);
|
||||
myTitle = await myState.activeMenuInfo.menuNm;
|
||||
},
|
||||
meta: {
|
||||
title: () => {
|
||||
return myTitle;
|
||||
},
|
||||
prgmId: myPrgmId,
|
||||
closable: true,
|
||||
},
|
||||
components: {
|
||||
Grid,
|
||||
BtnSearch,
|
||||
BtnExcelDownload,
|
||||
InputText,
|
||||
ActionButtons,
|
||||
Buttons,
|
||||
Form,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
myPrgmId: myPrgmId,
|
||||
gridName: 'rowGrid',
|
||||
gridName2: 'rowGrid2',
|
||||
loadGrid: false,
|
||||
loadGrid2: false,
|
||||
leftSelectRowData: {},
|
||||
rightSelectRowData: {},
|
||||
test: false,
|
||||
detailList: myDetail,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
pageData: state => state.pageData[myPrgmId],
|
||||
}),
|
||||
chkIsFind() {
|
||||
// 조회 플래그
|
||||
return this.pageData.isFind;
|
||||
},
|
||||
|
||||
ChkRowGridSelectData() {
|
||||
return this.pageData.rowGridSelectData;
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
chkIsFind(val) {
|
||||
if (val) this.search();
|
||||
},
|
||||
},
|
||||
async beforeCreate() {
|
||||
myPrgmId = this.$route.query.prgmId;
|
||||
await this.$store.dispatch('chkOpenTabList', {
|
||||
key: 'create',
|
||||
prgmId: myPrgmId,
|
||||
defaultData: defaultData,
|
||||
});
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.chkOpenTabList({ key: 'destroy', prgmId: myPrgmId });
|
||||
},
|
||||
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',
|
||||
}),
|
||||
async init() {
|
||||
await this.gridInit();
|
||||
},
|
||||
|
||||
async gridInit() {
|
||||
//---------------------gridOption 설정 시작----------------------------
|
||||
const gridHeight = this.$refs.gridParent.offsetHeight - 30;
|
||||
const gridHeight2 = this.$refs.gridParent2.offsetHeight - 30;
|
||||
// const gridHeight = this.$refs.contents.offsetHeight - 30;
|
||||
|
||||
const myOptions = {
|
||||
scrollX: false,
|
||||
};
|
||||
this.setGridOption({
|
||||
gridKey: this.gridName,
|
||||
// value: myOptions
|
||||
value: Object.assign(Utility.defaultGridOption(gridHeight), myOptions),
|
||||
});
|
||||
|
||||
this.setGridOption({
|
||||
gridKey: this.gridName2,
|
||||
// value: myOptions
|
||||
value: Object.assign(Utility.defaultGridOption(gridHeight2), myOptions),
|
||||
});
|
||||
|
||||
const myColumns = [
|
||||
{ header: '위젯ID', name: 'widgetId' },
|
||||
{ header: '위젯명', name: 'widgetNm' },
|
||||
{ header: '썸네일', name: 'widgetThumbnail', hidden: true },
|
||||
];
|
||||
|
||||
const myColumns2 = [
|
||||
{ header: '위젯ID', name: 'widgetId' },
|
||||
{ header: '위젯명', name: 'widgetNm' },
|
||||
{
|
||||
header: '순서',
|
||||
name: 'widgetOrdrSeq',
|
||||
align: 'center',
|
||||
editor: 'text',
|
||||
},
|
||||
{
|
||||
header: '재조회기간(분)',
|
||||
name: 'widgetReflashMm',
|
||||
align: 'center',
|
||||
editor: 'text',
|
||||
},
|
||||
];
|
||||
|
||||
this.setGridColumn({
|
||||
gridKey: this.gridName,
|
||||
value: myColumns,
|
||||
});
|
||||
this.setGridColumn({
|
||||
gridKey: this.gridName2,
|
||||
value: myColumns2,
|
||||
});
|
||||
|
||||
//---------------------gridColumn 설정 끝----------------------------
|
||||
await this.getRowGridData();
|
||||
},
|
||||
|
||||
async search() {
|
||||
await this.setPageData({
|
||||
isFind: false,
|
||||
});
|
||||
await this.getRowGridData();
|
||||
},
|
||||
|
||||
async getRowGridData() {
|
||||
this.loadGrid = false;
|
||||
this.loadGrid2 = false;
|
||||
let res = [];
|
||||
res = await this.postApiReturn({
|
||||
apiKey: 'selectNotMyWidget',
|
||||
resKey: 'widgetData',
|
||||
sendParam: {
|
||||
blocId: this.pageData.blocId,
|
||||
comId: this.pageData.comId,
|
||||
},
|
||||
});
|
||||
|
||||
let res2 = [];
|
||||
res2 = await this.postApiReturn({
|
||||
apiKey: 'selectMyWidget',
|
||||
resKey: 'widgetData',
|
||||
sendParam: {
|
||||
blocId: this.pageData.blocId,
|
||||
comId: this.pageData.comId,
|
||||
},
|
||||
});
|
||||
|
||||
this.setGridData({
|
||||
gridKey: this.gridName,
|
||||
value: res,
|
||||
});
|
||||
|
||||
this.setGridData({
|
||||
gridKey: this.gridName2,
|
||||
value: res2,
|
||||
});
|
||||
|
||||
this.loadGrid = true;
|
||||
this.loadGrid2 = true;
|
||||
|
||||
this.setPageData({ isFind: false });
|
||||
this.$nextTick(() => {
|
||||
if (res.length > 0) {
|
||||
this.$refs[this.gridName].focus({
|
||||
// rowKey: this.chkRowGridSelectKey || 0,
|
||||
rowKey: 0,
|
||||
setScroll: true,
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getUnAsgnRowData(data) {
|
||||
const getRowData = data;
|
||||
this.leftSelectRowData = Object.assign({}, getRowData);
|
||||
if (data.widgetThumbnail == null) {
|
||||
itemImage.src = '';
|
||||
} else {
|
||||
itemImage.src = 'data:image/png;base64, ' + data.widgetThumbnail;
|
||||
}
|
||||
this.setGridSelectData({
|
||||
gridKey: this.gridName,
|
||||
gridSelect: true,
|
||||
rowGridSelectKey: data.rowKey,
|
||||
rowGridSelectData: data,
|
||||
});
|
||||
},
|
||||
|
||||
getAsgnRowData(data) {
|
||||
const getRowData = data;
|
||||
this.rightSelectRowData = Object.assign({}, getRowData);
|
||||
},
|
||||
async dualGridBtnActions(action) {
|
||||
let addTargetGrid = '';
|
||||
let removeTargetGrid = '';
|
||||
switch (action) {
|
||||
case 'addLeftToRight':
|
||||
addTargetGrid = this.$refs[this.gridName2];
|
||||
removeTargetGrid = this.$refs[this.gridName];
|
||||
if (!this.leftSelectRowData.widgetId) {
|
||||
alert('선택된 위젯이 없습니다.');
|
||||
return false;
|
||||
} else {
|
||||
addTargetGrid.addTreeRow({
|
||||
widgetNm: this.leftSelectRowData.widgetNm,
|
||||
widgetId: this.leftSelectRowData.widgetId,
|
||||
widgetOrdrSeq: addTargetGrid.gridData.data.length + 1,
|
||||
widgetReflashMm: 15,
|
||||
});
|
||||
removeTargetGrid.removeRow('immediately');
|
||||
this.leftSelectRowData = ''; // 배정 후 초기화
|
||||
}
|
||||
break;
|
||||
|
||||
case 'removeRightToLeft':
|
||||
addTargetGrid = this.$refs[this.gridName];
|
||||
removeTargetGrid = this.$refs[this.gridName2];
|
||||
if (!this.rightSelectRowData.widgetId) {
|
||||
alert('선택된 위젯이 없습니다.');
|
||||
return false;
|
||||
} else {
|
||||
addTargetGrid.addTreeRow({
|
||||
widgetNm: this.rightSelectRowData.widgetNm,
|
||||
widgetId: this.rightSelectRowData.widgetId,
|
||||
});
|
||||
removeTargetGrid.removeRow('immediately');
|
||||
this.rightSelectRowData = ''; // 미배정 후 초기화
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
async btnActions(action) {
|
||||
let dataArr = [];
|
||||
switch (action) {
|
||||
case 'add':
|
||||
this.$refs[this.gridName2 + this.myPrgmId].addRow();
|
||||
break;
|
||||
|
||||
case 'remove':
|
||||
this.$refs[this.gridName2 + this.myPrgmId].removeRow();
|
||||
break;
|
||||
|
||||
case 'save':
|
||||
dataArr = this.$refs[this.gridName2].save();
|
||||
dataArr = dataArr.map(item => {
|
||||
const newData = {
|
||||
...item,
|
||||
widgetId: item.widgetId,
|
||||
widgetNm: item.widgetNm,
|
||||
widgetOrdrSeq: item.widgetOrdrSeq,
|
||||
};
|
||||
return newData;
|
||||
});
|
||||
if (dataArr.length > 0) {
|
||||
const sendParam = {
|
||||
datas: { dsWidget: dataArr },
|
||||
params: {},
|
||||
};
|
||||
await this.postUpdateApi({
|
||||
apiKey: 'saveMyWidget',
|
||||
sendParam: sendParam,
|
||||
});
|
||||
|
||||
//this.search();
|
||||
} else {
|
||||
alert('저장할 내용이 없습니다.');
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const defaultData = {
|
||||
/* 검색옵션 */
|
||||
isFind: false,
|
||||
roleNm: '',
|
||||
roleId: '',
|
||||
comId: '',
|
||||
|
||||
// 선택된 그룹코드 상세 데이터
|
||||
rowGridSelectKey: 0,
|
||||
rowGridSelectData: {},
|
||||
|
||||
/* data 세팅 */
|
||||
rowGrid: {
|
||||
data: [],
|
||||
column: [], // myColumns,
|
||||
option: {}, // myOptions
|
||||
defaultRow: {},
|
||||
rowGridSelectKey: 0,
|
||||
rowGridSelectData: null,
|
||||
},
|
||||
rowGrid2: {
|
||||
data: [],
|
||||
column: [], // myColumns,
|
||||
option: {}, // myOptions
|
||||
defaultRow: {
|
||||
widgetId: null,
|
||||
widgetNm: null,
|
||||
widgetOrdrSeq: null,
|
||||
widgetReflashMm: null,
|
||||
rowStat: null,
|
||||
},
|
||||
buttonAuth: {
|
||||
add: false,
|
||||
remove: false,
|
||||
save: true,
|
||||
excel: false,
|
||||
},
|
||||
},
|
||||
xlsFileInfo: {
|
||||
// 출력하려는 grid 와 같은 이름으로 세팅
|
||||
rowGrid: {
|
||||
fileName: null, // 갑이 없으면 해당 페이지 메뉴명
|
||||
sheetName: null, // 갑이 없으면 'Sheet1'
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const myDetail = [
|
||||
{
|
||||
type: 'InputText',
|
||||
label: '위젯ID',
|
||||
valueNm: 'widgetId',
|
||||
cols: 6,
|
||||
class: 'py-2',
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
type: 'InputText',
|
||||
label: '위젯명',
|
||||
valueNm: 'widgetNm',
|
||||
cols: 6,
|
||||
class: 'py-2',
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
type: 'TextArea',
|
||||
label: '위젯 설명',
|
||||
valueNm: 'widgetDesc',
|
||||
disabled: true,
|
||||
cols: 12,
|
||||
textCols: 10,
|
||||
rows: 4,
|
||||
class: 'py-2',
|
||||
},
|
||||
];
|
||||
|
||||
function numberFormatter({ value }) {
|
||||
if (value == null) {
|
||||
return 0;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
@import '@/assets/scss/common.scss';
|
||||
</style>
|
481
pages/comm/auth/MenuMngPage.vue
Normal file
481
pages/comm/auth/MenuMngPage.vue
Normal file
@ -0,0 +1,481 @@
|
||||
<template>
|
||||
<div class="l-layout">
|
||||
<v-row ref="searchFilter">
|
||||
<v-col :cols="12">
|
||||
<v-card class="searchFilter">
|
||||
<v-row align="center" no-gutters>
|
||||
<v-col :cols="4">
|
||||
<component
|
||||
:is="'selectCodeList'"
|
||||
:parentPrgmId="myPrgmId"
|
||||
:label="'시스템구분'"
|
||||
dataKey="sysDivCd"
|
||||
:sendParam="{ commGrpCd: 'CO_SYSDIV', useFg: '1' }"
|
||||
:addAll="true"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col :cols="4">
|
||||
<component
|
||||
:is="'selectCodeList'"
|
||||
:parentPrgmId="myPrgmId"
|
||||
:label="'사용여부'"
|
||||
:dataKey="'useFg'"
|
||||
:sendParam="{ commGrpCd: 'CO_USEFG', useFg: '1' }"
|
||||
:addAll="true"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col :cols="4" class="text-right">
|
||||
<v-btn :ripple="false" @click="search()">조회</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<v-row ref="contents">
|
||||
<v-col :cols="4" class="h100">
|
||||
<v-card class="pb-5">
|
||||
<div class="d-flex align-center justify-space-between pa-5">
|
||||
<v-card-title class="pa-0">메뉴 리스트</v-card-title>
|
||||
<div>
|
||||
<Buttons
|
||||
:parentPrgmId="myPrgmId"
|
||||
:bindingData="gridName"
|
||||
:btnActionsFnc="btnActions"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="h100 px-5" style="height:calc(100% - 70px)">
|
||||
<div ref="treeGridParent" class="w100 h100">
|
||||
<component
|
||||
:ref="gridName + myPrgmId"
|
||||
:is="loadTree ? 'Grid' : null"
|
||||
:gridName="gridName"
|
||||
:parentPrgmId="myPrgmId"
|
||||
@getRowsData="getRowData"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</v-card>
|
||||
</v-col>
|
||||
<v-col :cols="8" class="h100">
|
||||
<v-card class="pb-5">
|
||||
<div class="d-flex align-center justify-space-between pa-5">
|
||||
<v-card-title class="pa-0">메뉴 상세</v-card-title>
|
||||
</div>
|
||||
<div class="px-5" style="height:calc(100% - 76px)">
|
||||
<component
|
||||
:is="'Form'"
|
||||
:parentPrgmId="myPrgmId"
|
||||
:detailList="detailList"
|
||||
@gridEditingFinish="gridEditingFinish"
|
||||
/>
|
||||
</div>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import mixinGlobal from '@/mixin/global.js';
|
||||
import Utility from '~/plugins/utility';
|
||||
import { mapState, mapMutations, mapActions } from 'vuex';
|
||||
import Grid from '~/components/common/Grid';
|
||||
import Buttons from '~/components/common/button/Buttons';
|
||||
import selectCodeList from '@/components/common/select/selectCodeList';
|
||||
import Form from '~/components/common/form/Form';
|
||||
|
||||
let myTitle;
|
||||
let myPrgmId;
|
||||
export default {
|
||||
mixins: [mixinGlobal],
|
||||
async asyncData(context) {
|
||||
const myState = context.store.state;
|
||||
myPrgmId = context.route.query.prgmId;
|
||||
await context.store.commit('setActiveMenuInfo', myState.menuData[myPrgmId]);
|
||||
myTitle = await myState.activeMenuInfo.menuNm;
|
||||
},
|
||||
meta: {
|
||||
title: () => {
|
||||
return myTitle;
|
||||
},
|
||||
prgmId: myPrgmId,
|
||||
closable: true,
|
||||
},
|
||||
components: {
|
||||
Grid,
|
||||
Buttons,
|
||||
selectCodeList,
|
||||
Form,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
myPrgmId: myPrgmId,
|
||||
gridName: 'treeGrid',
|
||||
loadTree: false,
|
||||
detailList: myDetail,
|
||||
addRowFg: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
pageData: state => state.pageData[myPrgmId],
|
||||
}),
|
||||
chkIsFind() {
|
||||
// 조회 플래그
|
||||
return this.pageData.isFind;
|
||||
},
|
||||
chkSysDivCd() {
|
||||
// 사용여부 선택 감지
|
||||
return this.pageData.sysDivCd;
|
||||
},
|
||||
chkUseFg() {
|
||||
// 사용여부 선택 감지
|
||||
return this.pageData.useFg;
|
||||
},
|
||||
ChkRowGridSelectData() {
|
||||
return this.pageData.rowGridSelectData;
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
chkIsFind(val) {
|
||||
if (val) this.search();
|
||||
},
|
||||
chkSysDivCd() {
|
||||
this.setPageData({ isFind: true });
|
||||
},
|
||||
chkUseFg() {
|
||||
this.setPageData({ isFind: true });
|
||||
},
|
||||
},
|
||||
async beforeCreate() {
|
||||
myPrgmId = this.$route.query.prgmId;
|
||||
await this.$store.dispatch('chkOpenTabList', {
|
||||
key: 'create',
|
||||
prgmId: myPrgmId,
|
||||
defaultData: defaultData,
|
||||
});
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.gridInit();
|
||||
},
|
||||
search() {
|
||||
this.loadTree = false;
|
||||
this.addRowFg = false;
|
||||
this.getTreeData();
|
||||
},
|
||||
gridInit() {
|
||||
const treeGridHeight = this.$refs.treeGridParent.offsetHeight - 30;
|
||||
const myOptionsTree = {
|
||||
treeColumnOptions: {
|
||||
name: 'menuNm',
|
||||
},
|
||||
scrollX: false,
|
||||
};
|
||||
this.setGridOption({
|
||||
gridKey: this.gridName,
|
||||
// value: myOptionsTree
|
||||
value: Object.assign(
|
||||
Utility.defaultGridOption(treeGridHeight),
|
||||
myOptionsTree,
|
||||
),
|
||||
});
|
||||
this.setGridColumn({
|
||||
gridKey: this.gridName,
|
||||
value: [
|
||||
{ header: '메뉴명', name: 'menuNm' },
|
||||
{ header: 'prgmId ', name: 'prgmId', hidden: true },
|
||||
{ header: 'sysDivCd ', name: 'sysDivCd', hidden: true },
|
||||
],
|
||||
});
|
||||
|
||||
this.getTreeData();
|
||||
},
|
||||
// 메뉴리스트 조회
|
||||
async getTreeData() {
|
||||
let res = await this.postApiReturn({
|
||||
apiKey: 'selectMenu',
|
||||
resKey: 'menuData',
|
||||
sendParam: {
|
||||
sysDivCd: this.pageData.sysDivCd,
|
||||
useFg: this.pageData.useFg,
|
||||
comId: this.comId,
|
||||
},
|
||||
});
|
||||
res = res.map(item => {
|
||||
const newItem = {
|
||||
...item,
|
||||
menuIdNm: item.menuNm,
|
||||
menuId: item.menuId,
|
||||
parentId: item.parentId,
|
||||
useFg: item.useFg === '1' ? true : false,
|
||||
rowStat: null,
|
||||
upMenuId:
|
||||
item.upMenuId && item.upMenuId != '0'
|
||||
? item.upMenuId
|
||||
: item.upMenuId == '0'
|
||||
? '0'
|
||||
: 'ROOT',
|
||||
};
|
||||
return newItem;
|
||||
});
|
||||
|
||||
const setTreeData = await this.setTree({
|
||||
treeKey: 'MENU_ID',
|
||||
value: res,
|
||||
});
|
||||
this.loadTree = true;
|
||||
// console.log("setTreeData = ", setTreeData);
|
||||
await this.setGridData({
|
||||
gridKey: this.gridName,
|
||||
value: setTreeData.ROOT || [],
|
||||
});
|
||||
// 첫번째 row 선택상태
|
||||
this.$refs[this.gridName + this.myPrgmId].focus({
|
||||
//rowKey: 0,
|
||||
rowKey:
|
||||
this.pageData.rowGridSelectKey == '' ||
|
||||
this.pageData.rowGridSelectKey == null
|
||||
? 0
|
||||
: this.pageData.rowGridSelectKey ==
|
||||
this.$refs[this.gridName + this.myPrgmId].getData().length - 1
|
||||
? this.pageData.rowGridSelectKey
|
||||
: 0,
|
||||
columnName: 'menuNm',
|
||||
setScroll: true,
|
||||
});
|
||||
this.setPageData({ isFind: false });
|
||||
},
|
||||
async getRowData(data) {
|
||||
this.setPageData({
|
||||
rowGridSelectKey: data.rowKey,
|
||||
rowGridSelectData: data,
|
||||
});
|
||||
},
|
||||
async btnActions(action) {
|
||||
let dataArr = [];
|
||||
switch (action) {
|
||||
case 'add':
|
||||
if (!this.addRowFg) {
|
||||
let upMenuId = this.ChkRowGridSelectData.menuId;
|
||||
if (upMenuId == 'ROOT' || upMenuId == '00') upMenuId = '0';
|
||||
this.$refs[this.gridName + this.myPrgmId].addTreeRow({
|
||||
upMenuId: upMenuId,
|
||||
});
|
||||
this.addRowFg = true;
|
||||
} else {
|
||||
alert('한번에 한가지 메뉴만 추가 가능합니다.');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'remove':
|
||||
this.$refs[this.gridName + this.myPrgmId].removeTreeRow();
|
||||
if (this.addRowFg) this.addRowFg = false;
|
||||
break;
|
||||
|
||||
case 'save':
|
||||
dataArr = this.$refs[this.gridName + this.myPrgmId].save();
|
||||
var validCheck = true;
|
||||
|
||||
if (dataArr.length > 0) {
|
||||
dataArr.forEach(item => {
|
||||
if (
|
||||
item.upMenuId == '' ||
|
||||
item.menuNm == '' ||
|
||||
item.sortSeq == null
|
||||
) {
|
||||
validCheck = false;
|
||||
alert('필수 입력값을 입력해주세요.');
|
||||
}
|
||||
});
|
||||
|
||||
if (validCheck) {
|
||||
const sendParam = {
|
||||
datas: {
|
||||
dsMenu: dataArr.map(item => ({
|
||||
...item,
|
||||
useFg: item.useFg == true ? '1' : '0',
|
||||
comId: this.comId,
|
||||
})),
|
||||
},
|
||||
params: {},
|
||||
};
|
||||
|
||||
await this.postUpdateApi({
|
||||
apiKey: 'saveMenu',
|
||||
sendParam: sendParam,
|
||||
});
|
||||
|
||||
this.loadTree = false;
|
||||
this.$nextTick(() => {
|
||||
this.setPageData({ isFind: true });
|
||||
});
|
||||
this.loadTree = true;
|
||||
}
|
||||
} else {
|
||||
alert('저장할 내용이 없습니다.');
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
gridEditingFinish(data) {
|
||||
this.$refs[this.gridName + this.myPrgmId].editingFinish(data);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const defaultData = {
|
||||
isFind: false, // true 경우 조회
|
||||
|
||||
/* 검색옵션 */
|
||||
sysDivCd: '',
|
||||
sysDivCdList: [],
|
||||
useFg: '',
|
||||
useFgList: [],
|
||||
|
||||
// 선택된 그룹코드 상세 데이터
|
||||
rowGridSelectKey: 0,
|
||||
rowGridSelectData: null,
|
||||
|
||||
/* data 세팅 */
|
||||
treeGrid: {
|
||||
data: [],
|
||||
column: [],
|
||||
option: {},
|
||||
defaultRow: {
|
||||
upMenuId: '',
|
||||
menuId: '',
|
||||
menuNm: '',
|
||||
prgmId: '',
|
||||
sysDivCd: '',
|
||||
useFg: '1',
|
||||
sortSeq: '',
|
||||
regUserNo: '',
|
||||
regDttm: '',
|
||||
procUserNo: '',
|
||||
procDttm: '',
|
||||
rowStat: '',
|
||||
},
|
||||
buttonAuth: {
|
||||
add: true,
|
||||
remove: true,
|
||||
save: true,
|
||||
excel: false,
|
||||
},
|
||||
},
|
||||
};
|
||||
const myDetail = [
|
||||
{
|
||||
type: 'InputText',
|
||||
label: '메뉴코드',
|
||||
valueNm: 'menuId',
|
||||
readonly: true,
|
||||
cols: 6,
|
||||
class: 'py-2',
|
||||
required: false,
|
||||
placeholder: '시스템 자동입력',
|
||||
},
|
||||
{
|
||||
type: 'InputText',
|
||||
label: '상위메뉴코드',
|
||||
valueNm: 'upMenuId',
|
||||
disabled: false,
|
||||
cols: 6,
|
||||
class: 'py-2',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
type: 'InputText',
|
||||
label: '메뉴명',
|
||||
valueNm: 'menuNm',
|
||||
disabled: false,
|
||||
cols: 6,
|
||||
class: 'py-2',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
type: 'InputText',
|
||||
label: '프로그램ID',
|
||||
valueNm: 'prgmId',
|
||||
disabled: false,
|
||||
cols: 6,
|
||||
class: 'py-2',
|
||||
},
|
||||
{
|
||||
type: 'SelectBox',
|
||||
label: '시스템구분',
|
||||
valueNm: 'sysDivCd',
|
||||
disabled: false,
|
||||
cols: 6,
|
||||
class: 'py-2',
|
||||
list: 'sysDivCdList',
|
||||
itemText: 'commCdNm',
|
||||
itemValue: 'commCd',
|
||||
},
|
||||
{
|
||||
type: 'CheckBox',
|
||||
label: '사용여부',
|
||||
valueNm: 'useFg',
|
||||
disabled: false,
|
||||
cols: 6,
|
||||
class: 'py-2',
|
||||
value: { '1': true, '0': false },
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
type: 'InputText',
|
||||
label: '정렬순서',
|
||||
valueNm: 'sortSeq',
|
||||
disabled: false,
|
||||
cols: 6,
|
||||
class: 'py-2',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
type: 'InputText',
|
||||
label: '등록자No',
|
||||
valueNm: 'regUserNo',
|
||||
disabled: true,
|
||||
cols: 6,
|
||||
class: 'py-2',
|
||||
placeholder: '시스템 자동입력',
|
||||
},
|
||||
{
|
||||
type: 'InputText',
|
||||
label: '등록일시',
|
||||
valueNm: 'regDttm',
|
||||
disabled: true,
|
||||
cols: 6,
|
||||
class: 'py-2',
|
||||
placeholder: '시스템 자동입력',
|
||||
},
|
||||
{
|
||||
type: 'InputText',
|
||||
label: '수정자No',
|
||||
valueNm: 'procUserNo',
|
||||
disabled: true,
|
||||
cols: 6,
|
||||
class: 'py-2',
|
||||
placeholder: '시스템 자동입력',
|
||||
},
|
||||
{
|
||||
type: 'InputText',
|
||||
label: '수정일시',
|
||||
valueNm: 'procDttm',
|
||||
disabled: true,
|
||||
cols: 6,
|
||||
class: 'py-2',
|
||||
placeholder: '시스템 자동입력',
|
||||
},
|
||||
];
|
||||
</script>
|
||||
<style lang="scss">
|
||||
@import '@/assets/scss/common.scss';
|
||||
</style>
|
832
pages/comm/auth/MenuRoleMngPage.vue
Normal file
832
pages/comm/auth/MenuRoleMngPage.vue
Normal file
@ -0,0 +1,832 @@
|
||||
<template>
|
||||
<div class="l-layout">
|
||||
<v-row ref="searchFilter">
|
||||
<v-col :cols="12">
|
||||
<v-card class="searchFilter">
|
||||
<v-row algin="center" no-gutters>
|
||||
<v-col :cols="3">
|
||||
<InputText
|
||||
:parentPrgmId="myPrgmId"
|
||||
label="역할ID"
|
||||
valueNm="roleId"
|
||||
:searchOption="true"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col :cols="3">
|
||||
<InputText
|
||||
:parentPrgmId="myPrgmId"
|
||||
label="역할명"
|
||||
valueNm="roleNm"
|
||||
:searchOption="true"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col :cols="6" class="text-right">
|
||||
<!-- <v-btn @click="test = !test">WWW</v-btn> -->
|
||||
<BtnSearch />
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row ref="contents">
|
||||
<v-col cols="12" lg="2" class="h100">
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<span class="custom-title-4">역할 리스트</span>
|
||||
</v-card-title>
|
||||
<div class="px-5" style="height:calc(100% - 100px)">
|
||||
<div
|
||||
ref="gridParent"
|
||||
class="w100 h100"
|
||||
>
|
||||
<component
|
||||
:is="loadGrid ? 'Grid' : null"
|
||||
:ref="gridName + myPrgmId"
|
||||
:gridName="gridName"
|
||||
:parentPrgmId="myPrgmId"
|
||||
@getRowsData="getRowData"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</v-card>
|
||||
</v-col>
|
||||
<v-col cols="12" lg="10" class="h100">
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<span class="custom-title-4">역할 메뉴별 권한</span>
|
||||
</v-card-title>
|
||||
<v-row
|
||||
align="center"
|
||||
no-gutters
|
||||
:style="{ height: 'calc(100% - 62px)' }"
|
||||
class="px-5"
|
||||
>
|
||||
<v-col :cols="4" class="h100">
|
||||
<span
|
||||
class="body-1 font-weight-bold d-flex align-center"
|
||||
:style="{ minHeight: '36px' }"
|
||||
>[미배정]메뉴리스트</span
|
||||
>
|
||||
<div class="px-5" style="height:calc(100% - 64px)">
|
||||
<div
|
||||
ref="treeGridParent"
|
||||
class="w100 h100"
|
||||
>
|
||||
<component
|
||||
:is="loadTreeGrid ? 'Grid' : null"
|
||||
:ref="gridName2 + myPrgmId"
|
||||
:gridName="gridName2"
|
||||
:parentPrgmId="myPrgmId"
|
||||
@getRowsData="getUnAsgnRowData"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</v-col>
|
||||
<v-col :cols="1">
|
||||
<ActionButtons
|
||||
:parentPrgmId="myPrgmId"
|
||||
:leftGridName="gridName2"
|
||||
:rightGridName="gridName3"
|
||||
:btnActionsFnc="dualGridBtnActions"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col :cols="7" class="h100">
|
||||
<v-row
|
||||
justify="space-between"
|
||||
align="center"
|
||||
no-gutters
|
||||
class="px-5"
|
||||
>
|
||||
<v-col :cols="11">
|
||||
<span class="body-1 font-weight-bold"
|
||||
>[배정]메뉴별권한 리스트</span
|
||||
>
|
||||
</v-col>
|
||||
<v-col :cols="1" class="text-right">
|
||||
<Buttons
|
||||
:parentPrgmId="myPrgmId"
|
||||
:bindingData="gridName3"
|
||||
:btnActionsFnc="btnActions"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<div class="px-5" style="height:calc(100% - 64px)">
|
||||
<div
|
||||
ref="treeGridParent2"
|
||||
class="w100 h100"
|
||||
>
|
||||
<component
|
||||
:is="loadTreeGrid2 ? 'Grid' : null"
|
||||
:ref="gridName3 + myPrgmId"
|
||||
:gridName="gridName3"
|
||||
:parentPrgmId="myPrgmId"
|
||||
:editorGrid="true"
|
||||
@getRowsData="getAsgnRowData"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { mapState, mapMutations, mapActions } from 'vuex';
|
||||
import mixinGlobal from '@/mixin/global.js';
|
||||
import { resize } from '@/mixin/resize.js';
|
||||
import InputText from '@/components/common/input/InputText';
|
||||
import BtnSearch from '~/components/common/button/BtnSearch';
|
||||
import Grid from '~/components/common/Grid';
|
||||
import Buttons from '~/components/common/button/Buttons';
|
||||
import ActionButtons from '~/components/common/button/ActionButtons';
|
||||
import BtnExcelDownload from '~/components/common/button/BtnExcelDownload';
|
||||
import Utility from '~/plugins/utility';
|
||||
|
||||
// import ChangePassword from "~/components/common/modal/ChangePassword";
|
||||
|
||||
let myTitle;
|
||||
let myPrgmId;
|
||||
|
||||
export default {
|
||||
mixins: [mixinGlobal, resize],
|
||||
async asyncData(context) {
|
||||
const myState = context.store.state;
|
||||
myPrgmId = context.route.query.prgmId;
|
||||
await context.store.commit('setActiveMenuInfo', myState.menuData[myPrgmId]);
|
||||
myTitle = await myState.activeMenuInfo.menuNm;
|
||||
},
|
||||
meta: {
|
||||
title: () => {
|
||||
return myTitle;
|
||||
},
|
||||
prgmId: myPrgmId,
|
||||
closable: true,
|
||||
},
|
||||
components: {
|
||||
Grid,
|
||||
BtnSearch,
|
||||
BtnExcelDownload,
|
||||
InputText,
|
||||
ActionButtons,
|
||||
Buttons,
|
||||
// ChangePassword
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
myPrgmId: myPrgmId,
|
||||
gridName: 'rowGrid',
|
||||
gridName2: 'treeGrid',
|
||||
gridName3: 'treeGrid2',
|
||||
loadGrid: false,
|
||||
loadTreeGrid: false,
|
||||
loadTreeGrid2: false,
|
||||
leftSelectRowData: {},
|
||||
rightSelectRowData: {},
|
||||
test: false,
|
||||
rowKey: null,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
pageData: state => state.pageData[myPrgmId],
|
||||
}),
|
||||
loadFlag() {
|
||||
var init1 = this.pageData.useFgList.length > 0 ? true : false;
|
||||
|
||||
return init1;
|
||||
},
|
||||
chkIsFind() {
|
||||
// 조회 플래그
|
||||
return this.pageData.isFind;
|
||||
},
|
||||
|
||||
// chkRoleId() {
|
||||
// // 에너지 선택 감지
|
||||
// // return this.pageData.roleId;
|
||||
// },
|
||||
|
||||
// chkRoleNm() {
|
||||
// // 공정/설비 변경 감지
|
||||
// // return this.pageData.roleNm;
|
||||
// },
|
||||
|
||||
ChkRowGridSelectData() {
|
||||
return this.pageData.rowGridSelectData;
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
chkIsFind(val) {
|
||||
if (val) this.search();
|
||||
},
|
||||
async loadFlag(val) {
|
||||
if (val) {
|
||||
await this.gridInit();
|
||||
}
|
||||
// await this.gridInit();
|
||||
},
|
||||
|
||||
// chkRoleId() {
|
||||
// this.setPageData({ isFind: true });
|
||||
// },
|
||||
|
||||
// chkRoleNm() {
|
||||
// this.setPageData({ isFind: true });
|
||||
// },
|
||||
|
||||
// initFlag(val){
|
||||
// if(val){
|
||||
// this.init();
|
||||
// }
|
||||
// }
|
||||
},
|
||||
async beforeCreate() {
|
||||
myPrgmId = this.$route.query.prgmId;
|
||||
await this.$store.dispatch('chkOpenTabList', {
|
||||
key: 'create',
|
||||
prgmId: myPrgmId,
|
||||
defaultData: defaultData,
|
||||
});
|
||||
// this.pageData.facInfo = localStorage.getItem(myPrgmId + "CheckedRow") !=null ? JSON.parse(localStorage.getItem(myPrgmId + "CheckedRow")) : {}
|
||||
},
|
||||
created() {
|
||||
this.getCodeList({
|
||||
dataKey: 'useFg',
|
||||
params: { commGrpCd: 'CO_USEFG', useFg: '1' },
|
||||
addAll: false,
|
||||
});
|
||||
},
|
||||
mounted() {
|
||||
// this.init();
|
||||
if (this.loadFlag) {
|
||||
this.gridInit();
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.chkOpenTabList({ key: 'destroy', prgmId: myPrgmId });
|
||||
// console.log(myPrgmId, " , 3.vue::beforeDestroy");
|
||||
},
|
||||
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',
|
||||
}),
|
||||
async init() {
|
||||
// await this.gridInit();
|
||||
},
|
||||
|
||||
async gridInit() {
|
||||
//---------------------gridOption 설정 시작----------------------------
|
||||
const gridHeight = this.$refs.gridParent.offsetHeight - 30;
|
||||
const treeGridHeight = this.$refs.treeGridParent.offsetHeight - 30;
|
||||
const treeGridHeight2 = this.$refs.treeGridParent2.offsetHeight - 30;
|
||||
// const gridHeight = this.$refs.contents.offsetHeight - 30;
|
||||
|
||||
const myOptions = {
|
||||
columnOptions: {
|
||||
resizable: true,
|
||||
},
|
||||
//rowHeaders: [{type: 'rowNum'}],
|
||||
bodyHeight: gridHeight,
|
||||
minBodyHeight: gridHeight,
|
||||
header: {
|
||||
height: 36,
|
||||
},
|
||||
rowHeight: 36,
|
||||
minRowHeight: 36,
|
||||
summary: {
|
||||
columnContent: {
|
||||
height: 36,
|
||||
position: 'top',
|
||||
},
|
||||
},
|
||||
scrollX: false,
|
||||
// scrollY: false,
|
||||
};
|
||||
|
||||
const myOptionsTree = {
|
||||
treeColumnOptions: {
|
||||
name: 'menuNm',
|
||||
},
|
||||
scrollX: false,
|
||||
// scrollY: false,
|
||||
};
|
||||
|
||||
this.setGridOption({
|
||||
gridKey: this.gridName,
|
||||
value: myOptions,
|
||||
});
|
||||
|
||||
this.setGridOption({
|
||||
gridKey: this.gridName2,
|
||||
value: Object.assign(
|
||||
Utility.defaultGridOption(treeGridHeight),
|
||||
myOptionsTree,
|
||||
),
|
||||
});
|
||||
this.setGridOption({
|
||||
gridKey: this.gridName3,
|
||||
value: Object.assign(
|
||||
Utility.defaultGridOption(treeGridHeight2),
|
||||
myOptionsTree,
|
||||
),
|
||||
});
|
||||
//---------------------gridOption 설정 끝----------------------------
|
||||
|
||||
//---------------------gridName3의 체크박스 설정 시작----------------------------
|
||||
class CustumChecbox {
|
||||
constructor(props) {
|
||||
const el = document.createElement('input');
|
||||
const { grid, rowKey, columnInfo } = props;
|
||||
el.type = 'checkbox';
|
||||
el.value = props.value;
|
||||
this.el = el;
|
||||
|
||||
this.render(props);
|
||||
this.el.addEventListener('change', () => {
|
||||
const originValue = el.value;
|
||||
const changedValue = el.checked ? '1' : '0';
|
||||
|
||||
grid.setValue(rowKey, columnInfo.name, changedValue);
|
||||
|
||||
if (originValue == changedValue) {
|
||||
grid.removeRowClassName(rowKey, 'row-insert');
|
||||
grid.setValue(rowKey, 'rowStat', null);
|
||||
} else {
|
||||
grid.setValue(rowKey, 'rowStat', 'U');
|
||||
grid.addRowClassName(rowKey, 'row-insert');
|
||||
}
|
||||
});
|
||||
}
|
||||
getElement() {
|
||||
return this.el;
|
||||
}
|
||||
render(props) {
|
||||
const val = props.value;
|
||||
this.el.checked = val == '1' ? true : false;
|
||||
}
|
||||
}
|
||||
//---------------------gridName3의 체크박스 설정 끝----------------------------
|
||||
|
||||
//---------------------gridColumn 설정 시작----------------------------
|
||||
const _this = this;
|
||||
|
||||
const myColumns = [
|
||||
{ header: '역할ID', name: 'roleId', align: 'center', minWidth: 70 },
|
||||
{ header: '역할명', name: 'roleNm', minWidth: 70 },
|
||||
{
|
||||
header: '사용여부',
|
||||
name: 'useFg',
|
||||
align: 'center',
|
||||
minWidth: 84,
|
||||
formatter({ value }) {
|
||||
const newValue = _this.pageData.useFgList.filter(
|
||||
item => item.commCd == value,
|
||||
);
|
||||
return newValue[0].commCdNm;
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const myTreeColumns = [
|
||||
{
|
||||
header: '메뉴명',
|
||||
name: 'menuNm',
|
||||
validation: {
|
||||
dataType: 'string',
|
||||
validatorFn: (value, row) => {
|
||||
return row['isExists'] == '0';
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
const myTreeColumns2 = [
|
||||
{ header: '역할ID', name: 'roleId', hidden: true },
|
||||
{ header: '메뉴ID', name: 'menuId', hidden: true },
|
||||
{ header: '메뉴명', name: 'menuNm', minWidth: '235' },
|
||||
{
|
||||
header: '사용여부',
|
||||
name: 'useFg',
|
||||
align: 'center',
|
||||
renderer: {
|
||||
type: CustumChecbox,
|
||||
},
|
||||
},
|
||||
{
|
||||
header: '조회',
|
||||
name: 'authCd1',
|
||||
align: 'center',
|
||||
renderer: {
|
||||
type: CustumChecbox,
|
||||
},
|
||||
},
|
||||
{
|
||||
header: '추가',
|
||||
name: 'authCd2',
|
||||
align: 'center',
|
||||
renderer: {
|
||||
type: CustumChecbox,
|
||||
},
|
||||
},
|
||||
{
|
||||
header: '수정',
|
||||
name: 'authCd3',
|
||||
align: 'center',
|
||||
renderer: {
|
||||
type: CustumChecbox,
|
||||
},
|
||||
},
|
||||
{
|
||||
header: '삭제',
|
||||
name: 'authCd4',
|
||||
align: 'center',
|
||||
renderer: {
|
||||
type: CustumChecbox,
|
||||
},
|
||||
},
|
||||
{
|
||||
header: '저장',
|
||||
name: 'authCd5',
|
||||
align: 'center',
|
||||
renderer: {
|
||||
type: CustumChecbox,
|
||||
},
|
||||
},
|
||||
{
|
||||
header: '엑셀',
|
||||
name: 'authCd6',
|
||||
align: 'center',
|
||||
renderer: {
|
||||
type: CustumChecbox,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
this.setGridColumn({
|
||||
gridKey: this.gridName,
|
||||
value: myColumns,
|
||||
});
|
||||
this.setGridColumn({
|
||||
gridKey: this.gridName2,
|
||||
value: myTreeColumns,
|
||||
});
|
||||
this.setGridColumn({
|
||||
gridKey: this.gridName3,
|
||||
value: myTreeColumns2,
|
||||
});
|
||||
//---------------------gridColumn 설정 끝----------------------------
|
||||
await this.getRowGridData();
|
||||
},
|
||||
|
||||
async search() {
|
||||
if (this.loadFlag == false) {
|
||||
return;
|
||||
}
|
||||
await this.setPageData({
|
||||
isFind: false,
|
||||
});
|
||||
await this.getRowGridData();
|
||||
},
|
||||
|
||||
async getRowGridData() {
|
||||
this.loadGrid = false;
|
||||
|
||||
let res = [];
|
||||
res = await this.postApiReturn({
|
||||
apiKey: 'selectRole',
|
||||
resKey: 'roleData',
|
||||
sendParam: {
|
||||
roleId: this.pageData.roleId,
|
||||
roleNm: this.pageData.roleNm,
|
||||
comId: this.pageData.comId,
|
||||
},
|
||||
});
|
||||
|
||||
// const newRes = res.map(item => {
|
||||
// const newObj = {
|
||||
// ...item,
|
||||
// rowStat: null
|
||||
// };
|
||||
// return newObj;
|
||||
// });
|
||||
|
||||
// console.log("res!!!!!!", res);
|
||||
|
||||
this.setGridData({
|
||||
gridKey: this.gridName,
|
||||
value: res,
|
||||
});
|
||||
this.loadGrid = true;
|
||||
|
||||
this.setPageData({ isFind: false });
|
||||
this.$nextTick(() => {
|
||||
if (this.loadGrid && res.length > 0) {
|
||||
this.$refs[this.gridName + this.myPrgmId].focus({
|
||||
//rowKey: 0,
|
||||
rowKey:
|
||||
this.pageData.rowGridSelectKey == '' ||
|
||||
this.pageData.rowGridSelectKey == null
|
||||
? 0
|
||||
: this.pageData.rowGridSelectKey ==
|
||||
this.$refs[this.gridName + this.myPrgmId].getData().length - 1
|
||||
? this.pageData.rowGridSelectKey
|
||||
: 0,
|
||||
columnName: 'roleId',
|
||||
setScroll: true,
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
async getRowData(data) {
|
||||
await this.setPageData({
|
||||
rowGridSelectKey: data.rowKey,
|
||||
rowGridSelectData: {
|
||||
roleId: data.roleId,
|
||||
roleNm: data.roleNm,
|
||||
useFg: data.useFg,
|
||||
},
|
||||
});
|
||||
|
||||
const dt = {
|
||||
roleId: data.roleId,
|
||||
roleNm: data.roleNm,
|
||||
useFg: data.useFg,
|
||||
};
|
||||
await this.setMenuGrid(dt);
|
||||
|
||||
this.rowKey = data.rowKey;
|
||||
},
|
||||
async setMenuGrid(data) {
|
||||
this.loadTreeGrid = false;
|
||||
this.loadTreeGrid2 = false;
|
||||
await this.getUnAsgnTreeData(data);
|
||||
await this.getAsgnTreeData(data);
|
||||
},
|
||||
async getUnAsgnTreeData(selectedData) {
|
||||
let res = await this.postApiReturn({
|
||||
apiKey: 'selectUnAsgnMenu',
|
||||
resKey: 'menuRoleData',
|
||||
sendParam: {
|
||||
roleId: selectedData.roleId,
|
||||
roleNm: selectedData.roleNm,
|
||||
useFg: selectedData.useFg,
|
||||
comId: this.pageData.comId,
|
||||
},
|
||||
});
|
||||
res = res.map(item => {
|
||||
const newItem = {
|
||||
...item,
|
||||
menuIdNm: item.menuNm,
|
||||
menuId: item.menuId == 0 ? '00' : item.menuId,
|
||||
parentId: item.parentId == 0 ? '00' : item.parentId,
|
||||
rowStat: null,
|
||||
upMenuId:
|
||||
item.upMenuId && item.upMenuId != '0'
|
||||
? item.upMenuId
|
||||
: item.upMenuId == '0'
|
||||
? '00'
|
||||
: 'ROOT',
|
||||
};
|
||||
return newItem;
|
||||
});
|
||||
const setTreeData = await this.setTree({
|
||||
treeKey: 'MENU_ID',
|
||||
value: res,
|
||||
});
|
||||
|
||||
this.loadTreeGrid = true;
|
||||
// console.log("setTreeData = ", setTreeData);
|
||||
await this.setGridData({
|
||||
gridKey: this.gridName2,
|
||||
value: setTreeData.ROOT || [],
|
||||
});
|
||||
},
|
||||
|
||||
async getAsgnTreeData(selectedData) {
|
||||
let res = await this.postApiReturn({
|
||||
apiKey: 'selectMenuRole',
|
||||
resKey: 'menuRoleData',
|
||||
sendParam: {
|
||||
roleId: selectedData.roleId,
|
||||
roleNm: selectedData.roleNm,
|
||||
useFg: selectedData.useFg,
|
||||
comId: this.pageData.comId,
|
||||
},
|
||||
});
|
||||
res = res.map(item => {
|
||||
const newItem = {
|
||||
...item,
|
||||
menuIdNm: item.menuNm,
|
||||
menuId: item.menuId == 0 ? '00' : item.menuId,
|
||||
parentId: item.parentId == 0 ? '00' : item.parentId,
|
||||
rowStat: null,
|
||||
upMenuId:
|
||||
item.upMenuId && item.upMenuId != '0'
|
||||
? item.upMenuId
|
||||
: item.upMenuId == '0'
|
||||
? '00'
|
||||
: 'ROOT',
|
||||
};
|
||||
return newItem;
|
||||
});
|
||||
|
||||
const setTreeData = await this.setTree({
|
||||
treeKey: 'MENU_ID',
|
||||
value: res,
|
||||
});
|
||||
|
||||
this.loadTreeGrid2 = true;
|
||||
await this.setGridData({
|
||||
gridKey: this.gridName3,
|
||||
value: setTreeData.ROOT || [],
|
||||
});
|
||||
},
|
||||
|
||||
getUnAsgnRowData(data) {
|
||||
const getRowData = data;
|
||||
this.leftSelectRowData = Object.assign({}, getRowData);
|
||||
},
|
||||
|
||||
getAsgnRowData(data) {
|
||||
const getRowData = data;
|
||||
this.rightSelectRowData = Object.assign({}, getRowData);
|
||||
},
|
||||
async dualGridBtnActions(action) {
|
||||
let addTargetGrid = '';
|
||||
let removeTargetGrid = '';
|
||||
switch (action) {
|
||||
case 'addLeftToRight':
|
||||
addTargetGrid = this.$refs[this.gridName3 + this.myPrgmId];
|
||||
removeTargetGrid = this.$refs[this.gridName2 + this.myPrgmId];
|
||||
if (!this.leftSelectRowData.menuNm) {
|
||||
alert('선택된 메뉴가 없습니다.');
|
||||
return false;
|
||||
} else {
|
||||
addTargetGrid.addTreeRow({
|
||||
menuNm: this.leftSelectRowData.menuNm,
|
||||
menuId: this.leftSelectRowData.menuId,
|
||||
});
|
||||
removeTargetGrid.removeRow('immediately');
|
||||
this.leftSelectRowData = ''; // 배정 후 초기화
|
||||
}
|
||||
break;
|
||||
|
||||
case 'removeRightToLeft':
|
||||
addTargetGrid = this.$refs[this.gridName2 + this.myPrgmId];
|
||||
removeTargetGrid = this.$refs[this.gridName3 + this.myPrgmId];
|
||||
if (!this.rightSelectRowData.menuNm) {
|
||||
alert('선택된 메뉴가 없습니다.');
|
||||
return false;
|
||||
} else {
|
||||
addTargetGrid.addTreeRow({
|
||||
menuNm: this.rightSelectRowData.menuNm,
|
||||
});
|
||||
removeTargetGrid.removeRow('immediately');
|
||||
this.rightSelectRowData = ''; // 미배정 후 초기화
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
async btnActions(action) {
|
||||
let dataArr = [];
|
||||
switch (action) {
|
||||
case 'add':
|
||||
this.$refs[this.gridName3 + this.myPrgmId].addRow();
|
||||
break;
|
||||
|
||||
case 'remove':
|
||||
this.$refs[this.gridName3 + this.myPrgmId].removeRow();
|
||||
break;
|
||||
|
||||
case 'save':
|
||||
await this.$refs[this.gridName3 + this.myPrgmId].editingFinish({
|
||||
rowKey: this.rowKey,
|
||||
});
|
||||
|
||||
dataArr = this.$refs[this.gridName3 + this.myPrgmId].save();
|
||||
dataArr = dataArr.map(item => {
|
||||
const newData = {
|
||||
...item,
|
||||
menuId: item.menuId == '00' ? '0' : item.menuId,
|
||||
roleId: this.ChkRowGridSelectData.roleId,
|
||||
rowStat: item.rowStat == 'I' ? 'U' : item.rowStat,
|
||||
};
|
||||
return newData;
|
||||
});
|
||||
if (dataArr.length > 0) {
|
||||
const sendParam = {
|
||||
datas: { dsMenuRole: dataArr },
|
||||
params: {},
|
||||
};
|
||||
await this.postUpdateApi({
|
||||
apiKey: 'saveMenuRole',
|
||||
sendParam: sendParam,
|
||||
});
|
||||
|
||||
this.search();
|
||||
} else {
|
||||
alert('저장할 내용이 없습니다.');
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const defaultData = {
|
||||
/* 검색옵션 */
|
||||
isFind: false,
|
||||
roleNm: '',
|
||||
roleId: '',
|
||||
comId: '',
|
||||
useFg: '',
|
||||
useFgList: [],
|
||||
// 선택된 그룹코드 상세 데이터
|
||||
rowGridSelectKey: 0,
|
||||
rowGridSelectData: {},
|
||||
|
||||
/* data 세팅 */
|
||||
rowGrid: {
|
||||
data: [],
|
||||
column: [], // myColumns,
|
||||
option: {}, // myOptions
|
||||
defaultRow: {},
|
||||
},
|
||||
|
||||
treeGrid: {
|
||||
data: [],
|
||||
column: [],
|
||||
option: {},
|
||||
defaultRow: {
|
||||
isExists: '0',
|
||||
menuId: null,
|
||||
menuNm: null,
|
||||
parentId: null,
|
||||
upMenuId: null,
|
||||
useFg: 1,
|
||||
rowStat: null,
|
||||
},
|
||||
},
|
||||
treeGrid2: {
|
||||
data: [],
|
||||
column: [],
|
||||
option: {},
|
||||
defaultRow: {
|
||||
menuId: null,
|
||||
menuNm: null,
|
||||
roleId: null,
|
||||
parentId: null,
|
||||
upMenuId: '',
|
||||
useFg: 1,
|
||||
authCd1: '1',
|
||||
authCd2: '1',
|
||||
authCd3: '1',
|
||||
authCd4: '1',
|
||||
authCd5: '1',
|
||||
authCd6: '1',
|
||||
rowStat: null,
|
||||
},
|
||||
buttonAuth: {
|
||||
add: false,
|
||||
remove: false,
|
||||
save: true,
|
||||
excel: false,
|
||||
},
|
||||
},
|
||||
xlsFileInfo: {
|
||||
// 출력하려는 grid 와 같은 이름으로 세팅
|
||||
rowGrid: {
|
||||
fileName: null, // 갑이 없으면 해당 페이지 메뉴명
|
||||
sheetName: null, // 갑이 없으면 'Sheet1'
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
function numberFormatter({ value }) {
|
||||
if (value == null) {
|
||||
return 0;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
@import '@/assets/scss/common.scss';
|
||||
</style>
|
476
pages/comm/auth/RoleMngPage.vue
Normal file
476
pages/comm/auth/RoleMngPage.vue
Normal file
@ -0,0 +1,476 @@
|
||||
<template>
|
||||
<div class="l-layout">
|
||||
<v-row ref="searchFilter">
|
||||
<v-col :cols="12">
|
||||
<v-card class="searchFilter">
|
||||
<v-row align="center" no-gutters>
|
||||
<v-col :cols="3">
|
||||
<component
|
||||
:is="'InputText'"
|
||||
:parentPrgmId="myPrgmId"
|
||||
valueNm="roleId"
|
||||
label="역할코드"
|
||||
:searchOption="true"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col :cols="3">
|
||||
<component
|
||||
:is="'InputText'"
|
||||
:parentPrgmId="myPrgmId"
|
||||
valueNm="roleNm"
|
||||
label="역할명"
|
||||
:searchOption="true"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col :cols="3">
|
||||
<component
|
||||
:is="'selectCodeList'"
|
||||
:parentPrgmId="myPrgmId"
|
||||
:label="'사용여부'"
|
||||
:dataKey="'useFg'"
|
||||
:sendParam="{ commGrpCd: 'CO_USEFG', useFg: '1' }"
|
||||
:addAll="true"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col :cols="3" class="text-right">
|
||||
<v-btn :ripple="false" @click="search()">조회</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row ref="contents">
|
||||
<v-col :cols="4" class="h100">
|
||||
<v-card class="pb-5">
|
||||
<div class="d-flex align-center justify-space-between pa-5">
|
||||
<v-card-title class="pa-0">역할 리스트</v-card-title>
|
||||
<div>
|
||||
<Buttons
|
||||
:parentPrgmId="myPrgmId"
|
||||
:bindingData="gridName"
|
||||
:btnActionsFnc="btnActions"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="h100 px-5" style="height:calc(100% - 70px)">
|
||||
<div ref="gridParent" class="w100 h100">
|
||||
<component
|
||||
:ref="gridName + myPrgmId"
|
||||
:is="loadGrid ? 'Grid' : null"
|
||||
:gridName="gridName"
|
||||
:parentPrgmId="myPrgmId"
|
||||
@getRowsData="getRowData"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</v-card>
|
||||
</v-col>
|
||||
<v-col :cols="8" class="h100">
|
||||
<v-card class="pb-5">
|
||||
<div class="d-flex align-center justify-space-between pa-5">
|
||||
<v-card-title class="pa-0">역할 상세</v-card-title>
|
||||
</div>
|
||||
<div class="px-5">
|
||||
<component
|
||||
:is="'Form'"
|
||||
:parentPrgmId="myPrgmId"
|
||||
:detailList="detailList"
|
||||
@gridEditingFinish="gridEditingFinish"
|
||||
/>
|
||||
</div>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import mixinGlobal from '@/mixin/global.js';
|
||||
import { resize } from '@/mixin/resize.js';
|
||||
import Utility from '~/plugins/utility';
|
||||
import { mapState, mapMutations, mapActions } from 'vuex';
|
||||
import Grid from '~/components/common/Grid';
|
||||
import Buttons from '~/components/common/button/Buttons';
|
||||
import selectCodeList from '@/components/common/select/selectCodeList';
|
||||
import InputText from '@/components/common/input/InputText';
|
||||
import Form from '~/components/common/form/Form';
|
||||
|
||||
let myTitle;
|
||||
let myPrgmId;
|
||||
export default {
|
||||
mixins: [mixinGlobal, resize],
|
||||
async asyncData(context) {
|
||||
const myState = context.store.state;
|
||||
myPrgmId = context.route.query.prgmId;
|
||||
await context.store.commit('setActiveMenuInfo', myState.menuData[myPrgmId]);
|
||||
myTitle = await myState.activeMenuInfo.menuNm;
|
||||
},
|
||||
meta: {
|
||||
title: () => {
|
||||
return myTitle;
|
||||
},
|
||||
prgmId: myPrgmId,
|
||||
closable: true,
|
||||
},
|
||||
components: {
|
||||
Grid,
|
||||
Buttons,
|
||||
selectCodeList,
|
||||
InputText,
|
||||
Form,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
myPrgmId: myPrgmId,
|
||||
gridName: 'rowGrid',
|
||||
loadGrid: false,
|
||||
detailList: myDetail,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
pageData: state => state.pageData[myPrgmId],
|
||||
}),
|
||||
loadFlag() {
|
||||
var init1 = this.pageData.useFgList.length > 0 ? true : false;
|
||||
|
||||
return init1;
|
||||
},
|
||||
chkIsFind() {
|
||||
// 조회 플래그
|
||||
return this.pageData.isFind;
|
||||
},
|
||||
chkUseFg() {
|
||||
// 사용여부 선택 감지
|
||||
return this.pageData.useFg;
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
chkIsFind(val) {
|
||||
if (val) this.search();
|
||||
},
|
||||
async loadFlag(val) {
|
||||
if (val) {
|
||||
await this.gridInit();
|
||||
}
|
||||
// await this.gridInit();
|
||||
},
|
||||
chkUseFg() {
|
||||
this.setPageData({ isFind: true });
|
||||
},
|
||||
},
|
||||
async beforeCreate() {
|
||||
myPrgmId = this.$route.query.prgmId;
|
||||
await this.$store.dispatch('chkOpenTabList', {
|
||||
key: 'create',
|
||||
prgmId: myPrgmId,
|
||||
defaultData: defaultData,
|
||||
});
|
||||
},
|
||||
mounted() {
|
||||
if (this.loadFlag) {
|
||||
this.gridInit();
|
||||
}
|
||||
// this.init();
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
// this.gridInit();
|
||||
},
|
||||
search() {
|
||||
if (this.loadFlag == false) {
|
||||
return;
|
||||
}
|
||||
this.getRowGridData();
|
||||
},
|
||||
gridInit() {
|
||||
const gridHeight = this.$refs.gridParent.offsetHeight - 36;
|
||||
|
||||
const myOptions = {
|
||||
scrollX: false,
|
||||
};
|
||||
|
||||
this.setGridOption({
|
||||
gridKey: this.gridName,
|
||||
value: Object.assign(Utility.defaultGridOption(gridHeight), myOptions),
|
||||
});
|
||||
|
||||
const _this = this;
|
||||
const myColumns = [
|
||||
{ header: '역할ID', name: 'roleId', align: 'center' },
|
||||
{ header: '역할명', name: 'roleNm' },
|
||||
{
|
||||
header: '사용여부',
|
||||
name: 'useFg',
|
||||
align: 'center',
|
||||
formatter({ value }) {
|
||||
value = value === true ? '1' : '0';
|
||||
const newValue = _this.pageData.useFgList.filter(
|
||||
item => item.commCd == value,
|
||||
);
|
||||
return newValue[0].commCdNm;
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
this.setGridColumn({
|
||||
gridKey: this.gridName,
|
||||
value: myColumns,
|
||||
});
|
||||
|
||||
this.getRowGridData();
|
||||
},
|
||||
// 메뉴리스트 조회
|
||||
async getRowGridData() {
|
||||
let res = await this.postApiReturn({
|
||||
apiKey: 'selectRole',
|
||||
resKey: 'roleData',
|
||||
sendParam: {
|
||||
roleId: this.pageData.roleId,
|
||||
roleNm: this.pageData.roleNm,
|
||||
useFg: this.pageData.useFg,
|
||||
},
|
||||
});
|
||||
res = res.map(item => {
|
||||
const newItem = {
|
||||
...item,
|
||||
rowStat: null,
|
||||
useFg: item.useFg === '1' ? true : false, // 화면 개발 편의를 위해 boolean 타입으로 교체, 저장시 "1", "0" 으로 바꿔 보내야 함
|
||||
};
|
||||
return newItem;
|
||||
});
|
||||
this.xlsDataBind(res);
|
||||
this.loadGrid = true;
|
||||
|
||||
this.setGridData({
|
||||
gridKey: this.gridName,
|
||||
value: res,
|
||||
});
|
||||
|
||||
// 첫번째 row 선택상태
|
||||
this.$nextTick(() => {
|
||||
this.$refs[this.gridName + this.myPrgmId].focus({
|
||||
//rowKey: 0,
|
||||
rowKey:
|
||||
this.pageData.rowGridSelectKey == '' ||
|
||||
this.pageData.rowGridSelectKey == null
|
||||
? 0
|
||||
: this.pageData.rowGridSelectKey ==
|
||||
this.$refs[this.gridName + this.myPrgmId].getData().length - 1
|
||||
? this.pageData.rowGridSelectKey
|
||||
: 0,
|
||||
columnName: 'roleId',
|
||||
setScroll: true,
|
||||
});
|
||||
this.setPageData({ isFind: false });
|
||||
});
|
||||
},
|
||||
async getRowData(data) {
|
||||
this.setPageData({
|
||||
rowGridSelectKey: data.rowKey,
|
||||
rowGridSelectData: data,
|
||||
});
|
||||
},
|
||||
async btnActions(action) {
|
||||
let dataArr = [];
|
||||
switch (action) {
|
||||
case 'add':
|
||||
this.$refs[this.gridName + this.myPrgmId].addRow();
|
||||
break;
|
||||
|
||||
case 'remove':
|
||||
this.$refs[this.gridName + this.myPrgmId].removeRow();
|
||||
break;
|
||||
|
||||
case 'save':
|
||||
dataArr = this.$refs[this.gridName + this.myPrgmId].save();
|
||||
var validCheck = true;
|
||||
if (dataArr.length > 0) {
|
||||
dataArr.forEach(item => {
|
||||
if (item.roleNm == '' || item.roleNm == null) {
|
||||
validCheck = false;
|
||||
alert('필수 입력값을 입력해주세요.');
|
||||
}
|
||||
});
|
||||
if (validCheck) {
|
||||
const sendParam = {
|
||||
datas: {
|
||||
dsRole: dataArr.map(item => ({
|
||||
...item,
|
||||
useFg: item.useFg ? '1' : '0',
|
||||
})),
|
||||
},
|
||||
params: {},
|
||||
};
|
||||
await this.postUpdateApi({
|
||||
apiKey: 'saveRole',
|
||||
sendParam: sendParam,
|
||||
});
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.setPageData({ isFind: true });
|
||||
});
|
||||
}
|
||||
} else {
|
||||
alert('저장할 내용이 없습니다.');
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
xlsDataBind(res) {
|
||||
const xlsRowData = res.map(item => {
|
||||
const obj = {
|
||||
...item,
|
||||
useFg: item.useFg == '1' ? '사용' : '사용안함',
|
||||
};
|
||||
return obj;
|
||||
});
|
||||
this.setPageData({
|
||||
xlsFileInfo: {
|
||||
[this.gridName]: {
|
||||
rowData: xlsRowData,
|
||||
},
|
||||
},
|
||||
});
|
||||
},
|
||||
gridEditingFinish(data) {
|
||||
this.$refs[this.gridName + this.myPrgmId].editingFinish(data);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const defaultData = {
|
||||
isFind: false, // true 경우 조회
|
||||
|
||||
/* 검색옵션 */
|
||||
roleId: '',
|
||||
roleNm: '',
|
||||
useFg: '',
|
||||
useFgList: [],
|
||||
|
||||
// 선택된 그룹코드 상세 데이터
|
||||
rowGridSelectKey: 0,
|
||||
rowGridSelectData: null,
|
||||
|
||||
/* data 세팅 */
|
||||
rowGrid: {
|
||||
data: [],
|
||||
column: [],
|
||||
option: {},
|
||||
defaultRow: {
|
||||
roleId: null,
|
||||
roleNm: null,
|
||||
useFg: 1,
|
||||
rmrk: null,
|
||||
regUserNo: null,
|
||||
regDttm: null,
|
||||
procUserNo: null,
|
||||
procDttm: null,
|
||||
rowStat: null,
|
||||
},
|
||||
buttonAuth: {
|
||||
add: true,
|
||||
remove: true,
|
||||
save: true,
|
||||
excel: true,
|
||||
},
|
||||
},
|
||||
|
||||
xlsFileInfo: {
|
||||
// 출력하려는 grid 와 같은 이름으로 세팅
|
||||
rowGrid: {
|
||||
// rowData: [],
|
||||
fileName: null, // 갑이 없으면 해당 페이지 메뉴명
|
||||
sheetName: null, // 갑이 없으면 'Sheet1'
|
||||
},
|
||||
},
|
||||
};
|
||||
const myDetail = [
|
||||
{
|
||||
type: 'InputText',
|
||||
label: '역할코드',
|
||||
valueNm: 'roleId',
|
||||
readonly: true,
|
||||
cols: 6,
|
||||
class: 'py-2',
|
||||
required: false,
|
||||
placeholder: '시스템 자동입력',
|
||||
},
|
||||
{
|
||||
type: 'InputText',
|
||||
label: '역할명',
|
||||
valueNm: 'roleNm',
|
||||
disabled: false,
|
||||
cols: 6,
|
||||
class: 'py-2',
|
||||
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',
|
||||
},
|
||||
// {
|
||||
// type: "InputText",
|
||||
// label: "정렬순서",
|
||||
// valueNm: "sortSeq",
|
||||
// disabled: false,
|
||||
// cols: 6,
|
||||
// class: "py-2"
|
||||
// },
|
||||
{
|
||||
type: 'InputText',
|
||||
label: '등록자No',
|
||||
valueNm: 'regUserNo',
|
||||
disabled: true,
|
||||
cols: 6,
|
||||
class: 'py-2',
|
||||
placeholder: '시스템 자동입력',
|
||||
},
|
||||
{
|
||||
type: 'InputText',
|
||||
label: '등록일시',
|
||||
valueNm: 'regDttm',
|
||||
disabled: true,
|
||||
cols: 6,
|
||||
class: 'py-2',
|
||||
placeholder: '시스템 자동입력',
|
||||
},
|
||||
{
|
||||
type: 'InputText',
|
||||
label: '수정자No',
|
||||
valueNm: 'procUserNo',
|
||||
disabled: true,
|
||||
cols: 6,
|
||||
class: 'py-2',
|
||||
placeholder: '시스템 자동입력',
|
||||
},
|
||||
{
|
||||
type: 'InputText',
|
||||
label: '수정일시',
|
||||
valueNm: 'procDttm',
|
||||
disabled: true,
|
||||
cols: 6,
|
||||
class: 'py-2',
|
||||
placeholder: '시스템 자동입력',
|
||||
},
|
||||
];
|
||||
</script>
|
||||
<style lang="scss">
|
||||
@import '@/assets/scss/common.scss';
|
||||
</style>
|
1042
pages/comm/auth/UserRoleMngPage.vue
Normal file
1042
pages/comm/auth/UserRoleMngPage.vue
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user