발송통계 조회기간을 8-10월로 조회 했다가 다시 9월부터 11월까지 하려고 하면 달력에서 11월이 block 되는 현상 수정

This commit is contained in:
kimjhjjang
2022-11-29 10:44:15 +09:00
parent c201b27afb
commit 67e078707e
4 changed files with 633 additions and 452 deletions

View File

@@ -1,5 +1,4 @@
<template>
<div class="contents">
<div class="contents_wrap">
<div class="top_wrap">
@@ -13,68 +12,82 @@
<div class="search_wrap">
<div class="input_box cal">
<label for="right" class="label txt">조회기간</label>
<p> 최대 3개월까지 조회 가능합니다.</p>
<p>최대 3개월까지 조회 가능합니다.</p>
<div class="term">
<div class="group" style="width:500px;">
<span class="custom_input icon_date">
<vuejs-datepicker
:language="ko"
:format="customFormatter"
:disabled-dates="disabledSDate"
:minimumView="sDateDiv"
:maximumView="sDateDiv"
v-model="startDate"
@selected="selectedStartDate(0)"
@closed="closeDate('start')"
></vuejs-datepicker>
</span>~
<div class="group" style="width: 500px">
<span class="custom_input icon_date">
<vuejs-datepicker
:language="ko"
:format="customFormatter"
:disabled-dates="disabledEDate"
:minimumView="sDateDiv"
:maximumView="sDateDiv"
v-model="endDate"
@selected="selectedEndDate(0)"
@closed="closeDate('end')"
></vuejs-datepicker>
</span>
<vuejs-datepicker
:language="ko"
:format="customFormatter"
:disabled-dates="disabledSDate"
:minimumView="sDateDiv"
:maximumView="sDateDiv"
v-model="startDate"
@selected="selectedStartDate"
@closed="closeDate('start')"
></vuejs-datepicker> </span
>~
<span class="custom_input icon_date">
<vuejs-datepicker
:language="ko"
:format="customFormatter"
:disabled-dates="disabledEDate"
:minimumView="sDateDiv"
:maximumView="sDateDiv"
v-model="endDate"
@selected="selectedEndDate(0)"
@closed="closeDate('end')"
></vuejs-datepicker>
</span>
</div>
</div>
</div>
<div class="input_box id">
<label for="name" class="label">고객사명</label>
<input class="search-box" type="text" id="name" placeholder="검색어 입력" v-model.trim="grid.params.custNm" maxlength="100">
<input
class="search-box"
type="text"
id="name"
placeholder="검색어 입력"
v-model.trim="grid.params.custNm"
maxlength="100"
/>
</div>
<div class="input_box">
<label for="name" class="label">사업자번호</label>
<input class="search-box" type="text" id="name" placeholder="검색어 입력" v-model.trim="grid.params.bizrno" @keypress="onlyNum"
@input="onlyNum" minlength="10" maxlength="10">
<input
class="search-box"
type="text"
id="name"
placeholder="검색어 입력"
v-model.trim="grid.params.bizrno"
@keypress="onlyNum"
@input="onlyNum"
minlength="10"
maxlength="10"
/>
</div>
<button type="button" class="button grey" @click="search">조회</button>
</div>
<div class="info">
<div class="count">집계결과</div>
<div class="button_group">
<button type="button" class="button blue download" @click="monthExcelDown();">엑셀 다운로드</button>
<button type="button" class="button blue download" @click="monthExcelDown()">엑셀 다운로드</button>
</div>
</div>
<div class="table calculate scroll">
<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.header"
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.header"
></custom-grid>
</div>
<common-modal ref="commmonModal"></common-modal>
@@ -84,11 +97,11 @@
<script>
import moment from 'moment';
import statsApi from "../service/statsApi.js";
import statsApi from '../service/statsApi.js';
import customGrid from '@/components/CustomGrid';
import xlsx from '@/common/excel';
import commonModal from "@/components/modal/commonModal";
import {utils_mixin, chkPattern2} from '../service/mixins';
import commonModal from '@/components/modal/commonModal';
import { utils_mixin, chkPattern2 } from '../service/mixins';
export default {
name: 'bsnmMonthList',
@@ -117,132 +130,177 @@ export default {
// 테이블 리스트 데이터
perPageCnt: 50,
options: [
{text: '20', value: 20},
{text: '50', value: 50},
{text: '100', value: 100}
{ text: '20', value: 20 },
{ text: '50', value: 50 },
{ text: '100', value: 100 },
],
totalItems: 0,
grid: {
url: '/api/v1/bo/stats/bsnmMonthList',
pagePerRows: 20,
pagination: true,
isCheckbox: false, // true:첫번째 컬럼 앞에 체크박스 생성 / false:체크박스 제거
isCheckbox: false, // true:첫번째 컬럼 앞에 체크박스 생성 / false:체크박스 제거
initialRequest: false,
addCls: 'box_OFvis',
header: [
[
{header: '날짜', childNames: []},
{header: '고객사명', childNames: []},
{header: '사업자번호', childNames: []},
{header: '전체', childNames: ['sndCnt', 'succCntRt']},
{header: 'SMS', childNames: ['sndCntS', 'succCntRtS']},
{header: 'LMS', childNames: ['sndCntL', 'succCntRtL']},
{header: 'MMS', childNames: ['sndCntM', 'succCntRtM']},
{header: '알림톡', childNames: ['sndCntR', 'succCntRtR']},
]
{ header: '날짜', childNames: [] },
{ header: '고객사명', childNames: [] },
{ header: '사업자번호', childNames: [] },
{ header: '전체', childNames: ['sndCnt', 'succCntRt'] },
{ header: 'SMS', childNames: ['sndCntS', 'succCntRtS'] },
{ header: 'LMS', childNames: ['sndCntL', 'succCntRtL'] },
{ header: 'MMS', childNames: ['sndCntM', 'succCntRtM'] },
{ header: '알림톡', childNames: ['sndCntR', 'succCntRtR'] },
],
],
columns: [
{name: 'sumYm', header: '날짜', align: 'center'},
{name: 'custNm', header: '고객사명', align: 'center'},
{ name: 'sumYm', header: '날짜', align: 'center' },
{ name: 'custNm', header: '고객사명', align: 'center' },
{
name: 'bizrno', header: '사업자번호', align: 'center'
name: 'bizrno',
header: '사업자번호',
align: 'center',
// , formatter: props => {
// let result = props.bizrno.substring(0, 3) + '-' + props.bizrno.substring(3, 5) + '-' + props.bizrno.substring(5, 10)
// return result;
// }
},
{
name: 'sndCnt', header: '발송건수', align: 'center', cls: 'td_line',
formatter: props => {
name: 'sndCnt',
header: '발송건수',
align: 'center',
cls: 'td_line',
formatter: (props) => {
let result = props.sndCnt.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
return result;
}
},
},
{
name: 'succCntRt',
header: '성공건수/(%)',
align: 'center',
cls: 'td_line',
formatter: props => {
return "<p>" + props.succCnt.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') + "</p>\n<p>(" + props.succRt + "%)</p>";
}
formatter: (props) => {
return (
'<p>' +
props.succCnt.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') +
'</p>\n<p>(' +
props.succRt +
'%)</p>'
);
},
},
{
name: 'sndCntS', header: '발송건수', align: 'center', cls: 'td_line',
formatter: props => {
name: 'sndCntS',
header: '발송건수',
align: 'center',
cls: 'td_line',
formatter: (props) => {
let result = props.sndCntS.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
return result;
}
},
},
{
name: 'succCntRtS',
header: '성공건수/(%)',
align: 'center',
cls: 'td_line',
formatter: props => {
return "<p>" + props.succCntS.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') + "</p>\n<p>(" + props.succRtS + "%)</p>";
}
formatter: (props) => {
return (
'<p>' +
props.succCntS.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') +
'</p>\n<p>(' +
props.succRtS +
'%)</p>'
);
},
},
{
name: 'sndCntL', header: '발송건수', align: 'center', cls: 'td_line',
formatter: props => {
name: 'sndCntL',
header: '발송건수',
align: 'center',
cls: 'td_line',
formatter: (props) => {
let result = props.sndCntL.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
return result;
}
},
},
{
name: 'succCntRtL',
header: '성공건수/(%)',
align: 'center',
cls: 'td_line',
formatter: props => {
return "<p>" + props.succCntL.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') + "</p>\n<p>(" + props.succRtL + "%)</p>";
}
formatter: (props) => {
return (
'<p>' +
props.succCntL.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') +
'</p>\n<p>(' +
props.succRtL +
'%)</p>'
);
},
},
{
name: 'sndCntM', header: '발송건수', align: 'center', cls: 'td_line',
formatter: props => {
name: 'sndCntM',
header: '발송건수',
align: 'center',
cls: 'td_line',
formatter: (props) => {
let result = props.sndCntM.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
return result;
}
},
},
{
name: 'succCntRtM',
header: '성공건수/(%)',
align: 'center',
cls: 'td_line',
formatter: props => {
return "<p>" + props.succCntM.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') + "</p>\n<p>(" + props.succRtM + "%)</p>";
}
formatter: (props) => {
return (
'<p>' +
props.succCntM.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') +
'</p>\n<p>(' +
props.succRtM +
'%)</p>'
);
},
},
{
name: 'sndCntR', header: '발송건수', align: 'center', cls: 'td_line',
formatter: props => {
name: 'sndCntR',
header: '발송건수',
align: 'center',
cls: 'td_line',
formatter: (props) => {
let result = props.sndCntR.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
return result;
}
},
},
{
name: 'succCntRtR',
header: '성공건수/(%)',
align: 'center',
cls: 'td_line',
formatter: props => {
return "<p>" + props.succCntR.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') + "</p>\n<p>(" + props.succRtR + ")</p>";
}
formatter: (props) => {
return (
'<p>' +
props.succCntR.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') +
'</p>\n<p>(' +
props.succRtR +
')</p>'
);
},
},
],
noDataStr: '검색 결과가 없습니다.',
params: {
startMon: '',
endMon: ''
endMon: '',
},
excelHeader: []
}
excelHeader: [],
},
};
},
components: {
@@ -253,12 +311,10 @@ export default {
created() {
this.setPeriodDay(0);
this.getExcelHeader();
},
destroyed() {
this.grid.params.custNm = '';
this.grid.params.bizrno = '';
},
mounted() {
let page = 1;
@@ -276,12 +332,11 @@ export default {
this.search(isKeep);
},
beforeRouteLeave(to, from, next) {
const getP = this.$refs.table.getPagination();
this.$store.commit('searchcondition/updateSearchCondition', {
page: getP._currentPage,
perPage: this.perPageCnt,
params: this.grid.params
params: this.grid.params,
});
// 라우트 하기전 실행
next();
@@ -292,21 +347,25 @@ export default {
startMon: moment(this.startDate).format('YYYYMM'),
endMon: moment(this.endDate).format('YYYYMM'),
custNm: this.grid.params.custNm,
bizrno: this.grid.params.bizrno
bizrno: this.grid.params.bizrno,
};
if (moment(this.grid.params.startMon).isBefore(moment(this.grid.params.endMon).subtract(2, 'months').format('YYYYMM'))) {
if (
moment(this.grid.params.startMon).isBefore(
moment(this.grid.params.endMon).subtract(2, 'months').format('YYYYMM')
)
) {
this.row.title = '발송통계';
this.row.msg1 = '검색 기간은 최대 3개월까지 선택 가능 합니다.';
this.$refs.commmonModal.alertModalOpen(this.row);
return false
return false;
}
this.$refs.table.search(this.grid.params, isKeep);
this.sendStoreData();
},
toMove(routeName) {
this.$router.push({name: routeName, params: {page: 1, searchText: ''}});
this.$router.push({ name: routeName, params: { page: 1, searchText: '' } });
},
setPeriodDay(day) {
this.periodDay = day;
@@ -324,7 +383,14 @@ export default {
if (this.startDate > this.endDate) {
this.startDate = this.endDate;
}
const todayDate = new Date();
let selectDay = new Date(day);
let after3Month = new Date(selectDay.setMonth(selectDay.getMonth() + 2));
if (after3Month > todayDate) {
this.endDate = new Date();
} else {
this.endDate = after3Month;
}
},
selectedEndDate(day) {
if (day != undefined && day != null) {
@@ -334,11 +400,22 @@ export default {
closeDate(type) {
if (type != undefined && type != null) {
if (type == 'start') {
this.disabledSDate = {from: this.endDate};
this.disabledEDate = {to: this.startDate, from: this.endDate};
this.disabledSDate = { from: new Date() };
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()};
let stDate = new Date(this.startDate);
let fromDate = new Date(stDate.setMonth(stDate.getMonth() + 2));
let endDate = this.endDate;
const nowDate = new Date();
let selectedEndDate = endDate.getMonth() + 2;
if (Number(selectedEndDate) > Number(nowDate.getMonth())) {
this.disabledSDate = { from: new Date() };
this.disabledEDate = { to: this.startDate, from: new Date() };
} else {
this.disabledSDate = { from: new Date() };
this.disabledEDate = { to: this.startDate, from: fromDate };
}
}
}
},
@@ -351,7 +428,8 @@ export default {
return moment(date).format('YYYY-MM-DD');
}
},
changePerPage: function () { // 페이지당 조회할 개수
changePerPage: function () {
// 페이지당 조회할 개수
this.grid.pagePerRows = this.perPageCnt;
this.search(true);
},
@@ -360,7 +438,7 @@ export default {
this.$store.commit('searchcondition/updateSearchCondition', {
page: getP._currentPage,
perPage: this.perPageCnt,
params: this.grid.params
params: this.grid.params,
});
const getCondition = this.$store.getters['searchcondition/getSearchCondition'];
@@ -372,7 +450,7 @@ export default {
},
getExcelHeader() {
// 헤더를 mockup으로 관리한다.
statsApi.getExcelHeader(this.pageType).then(res => {
statsApi.getExcelHeader(this.pageType).then((res) => {
this.excelHeader = res;
});
},
@@ -387,10 +465,10 @@ export default {
result.data.list = result.data.list.map((item) => {
return {
...item,
custNm: this.fromHtmlEntities(item.custNm)
}
custNm: this.fromHtmlEntities(item.custNm),
};
});
if (result != null && result.retCode == "0000") {
if (result != null && result.retCode == '0000') {
return result.data;
} else {
return false;
@@ -413,17 +491,15 @@ export default {
const data = await this.getExcelDataDown();
let options = {
header: this.excelHeader,
dataOrder: 'header'
dataOrder: 'header',
};
xlsx.export(data.list, saveFileName, options).then(() => {
});
xlsx.export(data.list, saveFileName, options).then(() => {});
},
fromHtmlEntities(str) {
return (str + '').replace(/&#\d+;/gm, function (s) {
return String.fromCharCode(s.match(/\d+/gm)[0]);
});
},
}
},
};
</script>
</script>