|
|
@ -1,10 +1,11 @@ |
|
|
|
import { Component, OnInit } from '@angular/core'; |
|
|
|
import { Component, OnInit } from '@angular/core'; |
|
|
|
import {FormBuilder, FormGroup} from '@angular/forms'; |
|
|
|
import {FormBuilder, FormGroup} from '@angular/forms'; |
|
|
|
import {IconService} from '../../../services/icon.service'; |
|
|
|
import {IconService} from '../../../services/icon.service'; |
|
|
|
import {NzMessageService} from 'ng-zorro-antd'; |
|
|
|
import {NzMessageService, NzModalService, NzUploadChangeParam} from 'ng-zorro-antd'; |
|
|
|
import {ActivatedRoute, Router} from '@angular/router'; |
|
|
|
import {ActivatedRoute, Router} from '@angular/router'; |
|
|
|
import {CommonsService} from '../../../services/commons.service'; |
|
|
|
import {CommonsService} from '../../../services/commons.service'; |
|
|
|
import {MerchantStoreService} from '../../../services/merchant-store.service'; |
|
|
|
import {MerchantStoreService} from '../../../services/merchant-store.service'; |
|
|
|
|
|
|
|
import {environment} from '../../../../environments/environment'; |
|
|
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
@Component({ |
|
|
|
selector: 'app-store-list', |
|
|
|
selector: 'app-store-list', |
|
|
@ -21,12 +22,18 @@ export class StoreListComponent implements OnInit { |
|
|
|
loading = true; |
|
|
|
loading = true; |
|
|
|
id = null; |
|
|
|
id = null; |
|
|
|
name: string; |
|
|
|
name: string; |
|
|
|
|
|
|
|
WEB_SERVE_URL = environment.baseUrl; |
|
|
|
|
|
|
|
importErrorStudentArray = []; |
|
|
|
|
|
|
|
errorStudentVisible = false; |
|
|
|
|
|
|
|
isSpinning = false; |
|
|
|
|
|
|
|
|
|
|
|
constructor( |
|
|
|
constructor( |
|
|
|
private form: FormBuilder, |
|
|
|
private form: FormBuilder, |
|
|
|
private merchantStore: MerchantStoreService, |
|
|
|
private merchantStore: MerchantStoreService, |
|
|
|
private iconService: IconService, |
|
|
|
private iconService: IconService, |
|
|
|
private message: NzMessageService, |
|
|
|
private message: NzMessageService, |
|
|
|
private router: Router, |
|
|
|
private router: Router, |
|
|
|
|
|
|
|
private modal: NzModalService, |
|
|
|
private activatedRoute: ActivatedRoute, |
|
|
|
private activatedRoute: ActivatedRoute, |
|
|
|
private common: CommonsService |
|
|
|
private common: CommonsService |
|
|
|
) { |
|
|
|
) { |
|
|
@ -125,4 +132,44 @@ export class StoreListComponent implements OnInit { |
|
|
|
}).then(r => console.log(r)); |
|
|
|
}).then(r => console.log(r)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handleCancelError(): void { |
|
|
|
|
|
|
|
this.errorStudentVisible = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handleChange(info: NzUploadChangeParam): void { |
|
|
|
|
|
|
|
this.isSpinning = true; |
|
|
|
|
|
|
|
if (info.file.status !== 'uploading') { |
|
|
|
|
|
|
|
console.log(info.file, info.fileList); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (info.file.status === 'done') { |
|
|
|
|
|
|
|
if (info.file.response.return_code === '000000') { |
|
|
|
|
|
|
|
this.loading = false; |
|
|
|
|
|
|
|
this.isSpinning = false; |
|
|
|
|
|
|
|
if (info.file.response.return_data.errorTotal === 0) { |
|
|
|
|
|
|
|
this.message.success('导入成功'); |
|
|
|
|
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.modal.warning({ |
|
|
|
|
|
|
|
nzTitle: '提示', |
|
|
|
|
|
|
|
nzOkText: '查看失败数据', |
|
|
|
|
|
|
|
nzContent: '只有部分数据导入成功', |
|
|
|
|
|
|
|
nzOnOk: () => this.showErrorStudentModal(info.file.response.return_data) |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.isSpinning = false; |
|
|
|
|
|
|
|
this.loading = false; |
|
|
|
|
|
|
|
this.message.error(info.file.response.return_msg); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (info.file.status === 'error') { |
|
|
|
|
|
|
|
this.message.error('上传错误'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 打开模态框
|
|
|
|
|
|
|
|
showErrorStudentModal(data: []) { |
|
|
|
|
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
|
|
|
|
this.importErrorStudentArray = data['errorData']; |
|
|
|
|
|
|
|
this.errorStudentVisible = true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|