mirror of
http://git.mhez-qa.uplus.co.kr/hubez/hubez-admin.git
synced 2025-12-06 23:34:18 +09:00
423 lines
14 KiB
Vue
423 lines
14 KiB
Vue
<template>
|
|
|
|
<div class="contents">
|
|
<div class="contents_wrap">
|
|
<div class="top_wrap">
|
|
<h3 class="title">청약고객관리</h3>
|
|
<p class="breadcrumb">고객관리 > 청약고객관리 > 청약고객관리</p>
|
|
</div>
|
|
|
|
<div class="top_tab">
|
|
<a href="javascript:void(0);" class="on">청약고객관리</a>
|
|
<a href="javascript:void(0);" @click="toMove('memberList')">회원관리</a>
|
|
</div>
|
|
|
|
<div class="search_form">
|
|
<div class="search_wrap">
|
|
<div class="group">
|
|
<div class="input_box cal">
|
|
<label for="right" class="label">조회기간</label>
|
|
<div class="term">
|
|
<span class="custom_input icon_date">
|
|
<vuejs-datepicker
|
|
:language="ko"
|
|
:format="customFormatter"
|
|
:disabled-dates="disabledSDate"
|
|
v-model="startDate"
|
|
@selected="selectedStartDate(0)"
|
|
@closed="closeDate('start')"
|
|
></vuejs-datepicker>
|
|
</span>~
|
|
<span class="custom_input icon_date">
|
|
<vuejs-datepicker
|
|
:language="ko"
|
|
:format="customFormatter"
|
|
:disabled-dates="disabledEDate"
|
|
v-model="endDate"
|
|
@selected="selectedEndDate(0)"
|
|
@closed="closeDate('end')"
|
|
></vuejs-datepicker>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<div class="select_box id">
|
|
<label for="right" class="label">상태</label>
|
|
<select name="" id="" v-model="searchType1" @keyup.enter="search">
|
|
<option value="" selected>전체</option>
|
|
<option v-for="(option, i) in statType" v-bind:value="option.code" v-bind:key="i">
|
|
{{ option.codeNm }}
|
|
</option>
|
|
</select>
|
|
</div>
|
|
<div class="select_box">
|
|
<label for="right" class="label">유치채널</label>
|
|
<select name="" id="" v-model="searchType2" @keyup.enter="search">
|
|
<option value="" selected>전체</option>
|
|
<option value="01" >고객셀프가입</option>
|
|
<option value="02" >대리점</option>
|
|
<option value="03" >고객센터</option>
|
|
<option value="04" >직접영업</option>
|
|
<!-- <option v-for="(option, i) in userType" v-bind:value="option.code" v-bind:key="i">
|
|
{{ option.codeNm }}
|
|
</option> -->
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="group">
|
|
<div class="select_box">
|
|
<label for="right" class="label">상세검색</label>
|
|
<select name="" id="" v-model="searchType3" @keyup.enter="search">
|
|
<option value="">전체</option>
|
|
<option value="01">고객사명</option>
|
|
<option value="02">가입번호</option>
|
|
<option value="03">서비스ID</option>
|
|
</select>
|
|
</div>
|
|
<div class="input_box">
|
|
<input class="search-box" type="text" id="search" placeholder="검색어 입력" v-model="grid.params.searchText1"/>
|
|
</div>
|
|
<button type="button" class="button grey" @click="search">조회</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="info">
|
|
<div class="count">총 <span>{{ totalItems.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') }}</span>건
|
|
<div class="select_box NumberSe">
|
|
<select name="" id="" v-model="perPageCnt" @change="changePerPage()">
|
|
<option v-for="option in options" v-bind:value="option.value" v-bind:key="option.value">{{ option.text }}</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="button_group">
|
|
<button type="button" class="button blue download" @click="excelDown();">엑셀 다운로드</button>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="table">
|
|
<custom-grid
|
|
ref="table"
|
|
:totalItems="'totalItems'"
|
|
:url="grid.url"
|
|
:pagePerRows="grid.pagePerRows"
|
|
:initialRequest="grid.initialRequest"
|
|
:pagination="grid.pagination"
|
|
:isCheckbox="grid.isCheckbox"
|
|
:columns="grid.columns"
|
|
:noDataStr="grid.noDataStr"
|
|
:addCls="grid.addCls"
|
|
:header="grid.headder"
|
|
></custom-grid>
|
|
</div>
|
|
|
|
<common-modal ref="commmonModal"></common-modal>
|
|
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import customGrid from '@/components/CustomGrid';
|
|
import moment from 'moment';
|
|
import api from '@/service/api.js';
|
|
import custMgtApi from "../service/custMgtApi.js";
|
|
import xlsx from '@/common/excel';
|
|
import commonModal from "@/components/modal/commonModal";
|
|
|
|
class CustomATagRenderer {
|
|
constructor(props) {
|
|
this.props = props;
|
|
const el = document.createElement('a');
|
|
el.href = 'javascript:void(0);';
|
|
el.className = 'btn_text';
|
|
el.innerText= String(props.colValue)
|
|
this.el = el;
|
|
}
|
|
|
|
getElement() {
|
|
return this.el;
|
|
}
|
|
|
|
addEvent(selEl) {
|
|
selEl.addEventListener("click", () => {
|
|
const { callback } = this.props["cgrido" + this.props.colName].options;
|
|
callback(this.props);
|
|
});
|
|
}
|
|
}
|
|
|
|
export default {
|
|
name: 'subsList',
|
|
data() {
|
|
return {
|
|
// 달력 데이터
|
|
ko: vdp_translation_ko.js,
|
|
periodDay: 7,
|
|
sDateDiv: 'day',
|
|
startDate: new Date(),
|
|
endDate: new Date(),
|
|
|
|
statType: [],
|
|
userType: [],
|
|
row:{},
|
|
|
|
pageType: 'SUBS',
|
|
searchType1:'',
|
|
searchType2:'',
|
|
searchType3:'',
|
|
// 테이블 리스트 데이터
|
|
perPageCnt: 50,
|
|
options: [
|
|
{ text: '20', value: 20},
|
|
{ text: '50', value: 50},
|
|
{ text: '100', value: 100}
|
|
],
|
|
totalItems: 0,
|
|
grid: {
|
|
url: '/api/v1/bo/custMgt/subsList',
|
|
pagePerRows: 20,
|
|
pagination: true,
|
|
isCheckbox: false, // true:첫번째 컬럼 앞에 체크박스 생성 / false:체크박스 제거
|
|
initialRequest: false,
|
|
addCls: 'box_OFvis',
|
|
|
|
columns: [
|
|
{ name: 'no', header: 'No', align: 'center', width: 60},
|
|
{ name: 'serviceId', header: '서비스 ID\n(관리자 ID)', align: 'center', width: 160 , renderer: {
|
|
type: CustomATagRenderer
|
|
, options: {
|
|
callback: this.custDetail,
|
|
}
|
|
}
|
|
},
|
|
{ name: 'custNm', header: '고객사명', align: 'center', width: 130},
|
|
{ name: 'regNo', header: '가입번호', align: 'center', width: 130},
|
|
{ name: 'regDt', header: '가입일', align: 'center', width: 130, cls: 'td_line'},
|
|
{ name: 'stat', header: '상태', align: 'center', width: 130},
|
|
{ name: 'channel', header: '유치채널', align: 'center', width: 130},
|
|
{ name: 'plan', header: '요금제', align: 'center', width: 130},
|
|
{ name: 'carryOver', header: '이월누적금액', align: 'center', width: 130}
|
|
],
|
|
noDataStr: '검색 결과가 없습니다.',
|
|
params: {
|
|
searchType1: '',
|
|
searchType2: '',
|
|
searchType3: '',
|
|
searchText1: '',
|
|
startDt: '',
|
|
endDt: ''
|
|
},
|
|
excelHeader: []
|
|
}
|
|
};
|
|
},
|
|
components: {
|
|
customGrid: customGrid,
|
|
commonModal,
|
|
vuejsDatepicker,
|
|
},
|
|
created(){
|
|
|
|
this.setCodeData();
|
|
this.getExcelHeader();
|
|
this.setPeriodDay(0);
|
|
|
|
},
|
|
destroyed() {
|
|
this.$store.commit('searchcondition/updateSearchCondition', {
|
|
page: 1,
|
|
perPage: 50,
|
|
params: {
|
|
searchType1: '',
|
|
searchType2: '',
|
|
searchType3: '',
|
|
searchText1: '',
|
|
startDt: '',
|
|
endDt: ''
|
|
}
|
|
});
|
|
|
|
},
|
|
mounted() {
|
|
// 달력 세팅
|
|
|
|
let page = 1;
|
|
// 페이지 정보 및 검색 조건
|
|
const getCondition = this.$store.getters['searchcondition/getSearchCondition'];
|
|
console.log('getCondition : '+getCondition);
|
|
|
|
// store에 저장된 페이지 정보 및 검색 조건을 불러오기
|
|
let isKeep = false;
|
|
if (getCondition) {
|
|
this.grid.pagePerRows = getCondition.perPage;
|
|
this.grid.params = getCondition.params;
|
|
page = getCondition.page;
|
|
isKeep = true;
|
|
}
|
|
this.search(isKeep);
|
|
},
|
|
beforeRouteLeave(to, from, next) {
|
|
|
|
const getP = this.$refs.table.getPagination();
|
|
console.log("==========getP : " + getP._currentPage);
|
|
this.$store.commit('searchcondition/updateSearchCondition', {
|
|
page: getP._currentPage,
|
|
perPage: this.perPageCnt,
|
|
params: this.grid.params
|
|
});
|
|
// 라우트 하기전 실행
|
|
next();
|
|
},
|
|
methods: {
|
|
search: function(isKeep) {
|
|
this.grid.params.startDt = moment(this.startDate).format('YYYYMMDD');
|
|
this.grid.params.endDt = moment(this.endDate).format('YYYYMMDD');
|
|
console.log('this.perPageCnt'+this.perPageCnt);
|
|
console.log(this.grid.params);
|
|
|
|
this.grid.params.searchType1 = this.searchType1
|
|
this.grid.params.searchType2 = this.searchType2
|
|
this.grid.params.searchType3 = this.searchType3
|
|
|
|
this.$refs.table.search(this.grid.params, isKeep);
|
|
this.sendStoreData();
|
|
},
|
|
toMove(routeName) {
|
|
this.$router.push({ name: routeName, params: { page: 1, searchText: '' } });
|
|
},
|
|
custDetail(props){
|
|
console.log(props);
|
|
this.row.serviceId = props.serviceId;
|
|
this.$router.push({ name: 'subsDetail', params: this.row });
|
|
},
|
|
changePerPage: function(){ // 페이지당 조회할 개수
|
|
this.grid.pagePerRows = this.perPageCnt;
|
|
this.search(true);
|
|
},
|
|
sendStoreData: function() {
|
|
const getP = this.$refs.table.getPagination();
|
|
console.log("==========getP : " + getP._currentPage);
|
|
this.$store.commit('searchcondition/updateSearchCondition', {
|
|
page: getP._currentPage,
|
|
perPage: this.perPageCnt,
|
|
params: this.grid.params
|
|
});
|
|
|
|
const getCondition = this.$store.getters['searchcondition/getSearchCondition'];
|
|
console.log("getCondition : "+ getCondition.perPage);
|
|
},
|
|
setCodeData() {
|
|
// 상태 옵션 셋팅.
|
|
api.commCode({'grpCd' : 'SVCUSER_STTUS_CD'}).then(response => {
|
|
this.statType = response.data.data.list;
|
|
});
|
|
//
|
|
api.commCode({'grpCd' : 'SVCUSER_TP_CD'}).then(response => {
|
|
this.userType = response.data.data.list;
|
|
});
|
|
},
|
|
async getExcelDataDown() {
|
|
try {
|
|
let response;
|
|
const params = {
|
|
startDt: this.grid.params.startDt,
|
|
endDt: this.grid.params.endDt,
|
|
searchType1: this.grid.params.searchType1,
|
|
searchType2: this.grid.params.searchType2,
|
|
searchType3: this.grid.params.searchType3,
|
|
searchText1: this.grid.params.searchText1
|
|
};
|
|
|
|
response = await custMgtApi.subsListExcel(params);
|
|
|
|
const result = response.data;
|
|
if (result != null && result.retCode == "0000") {
|
|
return result.data;
|
|
}else{
|
|
return false;
|
|
}
|
|
} catch (err) {
|
|
return false;
|
|
}
|
|
}, // end of getExcelDataDown
|
|
async excelDown() {
|
|
if (this.$refs.table.getData().length <= 0) {
|
|
this.row.title = '청약고객관리';
|
|
this.row.msg1 = '조회된 데이터가 없습니다.';
|
|
this.$refs.commmonModal.alertModalOpen(this.row);
|
|
return false;
|
|
}
|
|
|
|
let today = moment().format('YYYYMMDDHHmmss');
|
|
const saveFileName = `청약고객정보_${today}.xlsx`;
|
|
|
|
const data = await this.getExcelDataDown();
|
|
let options = {
|
|
header: this.excelHeader,
|
|
dataOrder: 'header'
|
|
};
|
|
// console.log(data);
|
|
xlsx.export(data.list, saveFileName, options).then(() => {});
|
|
},
|
|
getExcelHeader() {
|
|
// 헤더를 mockup으로 관리한다.
|
|
custMgtApi.getExcelHeader(this.pageType).then(res => {
|
|
this.excelHeader = res;
|
|
});
|
|
},
|
|
setPeriodDay(day) {
|
|
this.periodDay = day;
|
|
this.endDate = new Date();
|
|
// this.startDate = moment(this.endDate)
|
|
// .subtract(day, 'day')
|
|
// .toDate();
|
|
this.initSetStartDate();
|
|
|
|
this.closeDate('start');
|
|
this.closeDate('end');
|
|
},
|
|
|
|
selectedStartDate(day) {
|
|
if (day != undefined && day != null) {
|
|
this.periodDay = day;
|
|
}
|
|
if (this.startDate > this.endDate) {
|
|
this.startDate = this.endDate;
|
|
}
|
|
console.log(this.disabledSDate)
|
|
// this.grid.params.startDt = day
|
|
},
|
|
selectedEndDate(day) {
|
|
if (day != undefined && day != null) {
|
|
this.periodDay = day;
|
|
}
|
|
},
|
|
closeDate(type) {
|
|
if (type != undefined && type != null) {
|
|
if (type == 'start') {
|
|
this.disabledSDate = { from: this.endDate };
|
|
this.disabledEDate = { to: this.startDate, from: this.endDate };
|
|
} else if (type == 'end') {
|
|
this.disabledSDate = { from: this.endDate };
|
|
this.disabledEDate = { to: this.startDate, from: new Date() };
|
|
}
|
|
}
|
|
},
|
|
customFormatter: function(date) {
|
|
if (this.sDateDiv == 'month') {
|
|
return moment(date).format('YYYY-MM');
|
|
} else if (this.sDateDiv == 'year') {
|
|
return moment(date).format('YYYY');
|
|
} else {
|
|
return moment(date).format('YYYY-MM-DD');
|
|
}
|
|
},
|
|
initSetStartDate(){
|
|
let setYear = Number(moment(new Date()).format('YYYY'));
|
|
let initStartDate = new Date(setYear, 0, 1);
|
|
this.startDate = initStartDate;
|
|
console.log(moment(this.startDate).format('YYYY-MM-DD'));
|
|
},
|
|
},
|
|
};
|
|
</script> |