유치채널 엑셀 다운로드 수정

This commit is contained in:
USER
2022-09-21 09:05:30 +09:00
parent 39622f7609
commit a3fb4e5a2c
6 changed files with 123 additions and 169 deletions

View File

@@ -222,18 +222,10 @@ export default {
},
created() {
this.getExcelHeader();
if(this.$route.params.userSeq != null){ //리스트에서 상세 호출
//this.loginId = this.$route.params.loginId;
this.$store.commit('dataStore/updateUserSeq', this.$route.params.userSeq);
//this.$store.commit('dataStore/updateUserId', this.$route.params.userId);
if(this.$route.params.userSeq != null){ //리스트에서 상세 호출
this.$store.commit('dataStore/updateUserSeq', this.$route.params.userSeq);
this.channelDetail(this.$route.params.userSeq);
}
// else{
// var userSeq = this.$store.getters["dataStore/getUserSeq"];
// var userId = this.$store.getters["dataStore/getUserId"];
// this.loginId = userId;
// this.channelDetail(userSeq);
// }
}
},
destroyed() {
this.$store.commit('dataStore/updateUserSeq', '');
@@ -242,6 +234,7 @@ export default {
methods: {
async channelDetail(userSeq) {
this.row.userSeq = userSeq;
try {
const response = await channelMgtApi.channelDetail(this.row);
const result = response.data;
@@ -323,6 +316,36 @@ export default {
let today = moment().format('YYYYMMDDHHmmss');
const saveFileName = `유치고객발송건수_${today}.xls`;
const data = await this.getExcelDataDown();
// 엑셀 합계 데이터 구하기
var sndCntTotal = 0;
var sndCntSTotal = 0;
var sndCntLTotal = 0;
var sndCntMTotal = 0;
var sndCntATotal = 0;
for (var i = 0; i < data.list.length; i++) {
sndCntTotal = sndCntTotal + Number(data.list[i].sndCnt);
sndCntSTotal = sndCntSTotal + Number(data.list[i].sndCntS);
sndCntLTotal = sndCntLTotal + Number(data.list[i].sndCntL);
sndCntMTotal = sndCntMTotal + Number(data.list[i].sndCntM);
sndCntATotal = sndCntATotal + Number(data.list[i].sndCntA);
}
console.log("sndCntTotal : "+ sndCntTotal);
console.log("sndCntSTotal : "+ sndCntSTotal);
console.log("sndCntLTotal : "+ sndCntLTotal);
console.log("sndCntMTotal : "+ sndCntMTotal);
console.log("sndCntATotal : "+ sndCntATotal);
let totalRow = {
'sumYm' : '합계',
'sndCnt' : sndCntTotal,
'sndCntA' : sndCntATotal,
'sndCntL' : sndCntLTotal,
'sndCntM' : sndCntMTotal,
'sndCntS' : sndCntSTotal
};
// 합계 데이터 추가
data.list.unshift(totalRow);
let options = {
header: this.excelHeader,
@@ -335,13 +358,8 @@ export default {
async getExcelDataDown() {
try {
let response;
const params = {
// sndCntS: this.sndCntS,
// sndCntL: this.sndCntL,
// sndCntM: this.sndCntM,
// sndCntA: this.sndCntA,
userSeq: this.userSeq
const params = {
userSeq: this.row.userSeq
};
response = await channelMgtApi.sendNumberListExcel(params);
@@ -356,10 +374,7 @@ export default {
return false;
}
}, // end of getExcelDataDown
goChannelList() {
// this.row.userSeq = this.$route.params.userSeq;
// alert(this.row.userSeq);
goChannelList() {
this.$router.push({name: 'channelList'});
},
searchIDPopOpen: function () {