TC 수정건 적용 (디자인 및 기능)

This commit is contained in:
kimre
2022-07-18 19:34:34 +09:00
parent 2bfa07c17f
commit a6c6db6f22
40 changed files with 1783 additions and 1170 deletions

View File

@@ -22,7 +22,7 @@
ref="file"
style="display: none"
@change="readFile"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
/>
<button class="btn-default" @click="sampleDown">샘플 다운로드</button>
<button class="button btn-p2color" @click="$refs.file.click()">파일 업로드</button>
@@ -38,6 +38,7 @@
</div>
</div>
<!-- <validationConfirm-modal ref="validationConfirmPop"></validationConfirm-modal>-->
<common-modal ref="commmonModal"></common-modal>
</div>
</div>
</template>
@@ -49,6 +50,7 @@ import {utils_mixin, chkPattern2} from '../service/mixins';
import xlsx from '@/common/excel';
import moment from 'moment';
import XLSX from 'xlsx';
import commonModal from "../components/commonModal";
// import ValidationConfirmPop from "./ValidationConfirmPop";
export default {
@@ -65,10 +67,14 @@ export default {
nData: [],
oData: [],
totalItems: 0,
totalCnt: 0,
failCnt: 0,
insertRowCnt: 0
};
},
components: {
// ValidationConfirmPop,
commonModal
},
created() {
this.getExcelHeader();
@@ -102,7 +108,7 @@ export default {
this.row.serviceId = this.adminId;
// 팝업으로 교체 예정
// if (confirm('정상 업로드 되었습니다.')) {
this.excelPopClose();
this.excelPopClose();
this.$parent.memberDetail(this.adminId);
// }
},
@@ -115,7 +121,7 @@ export default {
this.row.title = '청약고객관리';
this.row.msg1 = '저장 하였습니다.';
this.$refs.commmonModal.alertModalOpen(this.row);
this.toComplete();
this.toComplete();
}
} catch (err) {
this.row.title = '청약고객관리';
@@ -145,8 +151,32 @@ export default {
this.nData = [];
this.oData = [];
const file = event.target.files[0];
// 파일 개수 제한
if(file != null){
let element = document.getElementById('uploadFile');
while (element.firstChild) {
element.removeChild(element.firstChild);
}
}
console.log(file.name);
// 파일 이름 체크
var fileName = file.name;
var fileExpend = fileName .slice(fileName .indexOf(".") + 1).toLowerCase();
if(fileExpend != "xlsx"){
//alert("파일은 (xlsx) 형식만 등록 가능합니다.");
this.row.title = '파일 업로드';
this.row.msg1 = '샘플과 동일한 확장자가 아닙니다.';
this.row.msg1 = '다시 업로드 해주세요.';
this.$refs.commmonModal.alertModalOpen(this.row);
return false;
}
// inner Html.
const button = document.createElement('button');
@@ -176,18 +206,20 @@ export default {
let workbook = XLSX.read(data, {type: 'binary'});
workbook.SheetNames.forEach((sheetName) => {
const rowObj = XLSX.utils.sheet_to_json(workbook.Sheets[sheetName], {raw: true});
console.log(rowObj);
tmpResult = rowObj;
const limitCnt = 100;
const totalCnt = Number(this.totalItems) + rowObj.length;
if (totalCnt > limitCnt) {
this.totalCnt = Number(this.totalItems) + rowObj.length;
this.insertRowCnt = rowObj.length;
console.log('totalCnt : '+this.totalCnt +' limitCnt : '+limitCnt);
if (this.totalCnt > limitCnt) {
this.row.title = '청약고객관리';
this.row.msg1 = '100건이상은 등록되지 않습니다.';
this.$refs.commmonModal.alertModalOpen(this.row);
return false;
}
for (const [idx, r] of rowObj.entries()) {
if (idx > limitCnt - 1) {
break;
@@ -286,12 +318,12 @@ export default {
const result = response.data;
console.log(result);
if (result != null && result.retCode == '0000') {
this.totalCnt = result.data.totalCnt;
//this.totalCnt = result.data.totalCnt;
this.successCnt = result.data.successCnt;
this.failCnt = result.data.failCnt;
this.failCnt = Number(this.failCnt) + Number(result.data.failCnt);
if (result.data.failCnt > 0) {
this.row.totalCnt = this.totalCnt
this.row.totalCnt = this.insertRowCnt
this.row.successCnt = this.successCnt
this.row.failCnt = this.failCnt
this.$parent.$refs.validationConfirmPopModal.failFileuploadOpen(this.row);
@@ -319,6 +351,14 @@ export default {
this.$parent.memberDetail(this.adminId);
}
},
checkFocus() {
this.$refs.file.value = null;
let element = document.getElementById('uploadFile');
while (element.firstChild) {
element.removeChild(element.firstChild);
}
}
},
};
</script>

View File

@@ -338,8 +338,8 @@ export default {
for (var i = 0; i < dimmed.length; i++) {
dimmed[i].style.display = 'none';
}
// 목록페이지 이동
this.$parent.toComplete();
// 화면 리로드
this.$parent.successFileuploadOk();
},
// 정상완료 후 목록페이지 이동
toComplete() {