frontdesk/src/app/app.module.ts | ●●●●● patch | view | raw | blame | history | |
frontdesk/src/app/routes/filearchives/upvolume/upvolume.component.ts | ●●●●● patch | view | raw | blame | history | |
frontdesk/src/app/service/common/temporaryCache.service.ts | ●●●●● patch | view | raw | blame | history | |
frontdesk/src/app/shared/components/showArchiveParts/showArchiveParts.component.html | ●●●●● patch | view | raw | blame | history | |
frontdesk/src/app/shared/components/showArchiveParts/showArchiveParts.component.ts | ●●●●● patch | view | raw | blame | history | |
frontdesk/src/app/shared/components/uploadfile/uploadfile.component.ts | ●●●●● patch | view | raw | blame | history |
frontdesk/src/app/app.module.ts
@@ -7,6 +7,7 @@ import { AppComponent } from './app.component'; import { HttpService } from './service/common/http.service'; import { ListSort } from './service/common/listSort.service'; import { TemporaryCache } from './service/common/temporaryCache.service'; import { CookieService } from './service/common/cookie.service'; import { CoreModule } from './core/core.module'; import { LayoutModule } from './layout/layout.module'; @@ -50,6 +51,7 @@ {provide: LocationStrategy,useClass: HashLocationStrategy}, HttpService, ListSort, TemporaryCache, CookieService, AddressService, OrgDataService frontdesk/src/app/routes/filearchives/upvolume/upvolume.component.ts
@@ -272,7 +272,7 @@ archiveModalClose(archiveModal) { this.modelhideUril.modelhide(archiveModal); } archiveModalCloseById(archiveModal,id) { archiveModalCloseById(archiveModal,id,clearState) { this.modelhideUril.modelhideById(archiveModal,id); } frontdesk/src/app/service/common/temporaryCache.service.ts
New file @@ -0,0 +1,29 @@ import { Injectable } from '@angular/core'; import { Subject } from 'rxjs'; @Injectable() export class TemporaryCache { private tcdeStatas = new Subject<string>(); tcStatas$ = this.tcdeStatas.asObservable(); tC = []; archiveData; tcSave(data){ this.tC.push(data); }; tcGet(keys){ if(keys!=undefined){ for(let i=0;i<this.tC.length;i++){ if(this.tC[i].key === keys){ return this.tC[i].value; } } } }; tcCall(archiveData){ if(archiveData!=undefined){ this.archiveData = archiveData; } this.tcdeStatas.next(this.archiveData); }; } frontdesk/src/app/shared/components/showArchiveParts/showArchiveParts.component.html
@@ -237,7 +237,7 @@ <ng-container *ngFor="let item of fileAdjustmentList"> <div class="row"> <ng-container *ngIf="item.dataType === '11' "> <uploadfile [data]="item" [adjustmentFlg]="true" (addFile)="emitFileData($event,'add')" (deleteFile)="emitFileData($event,'delete')" ></uploadfile> <uploadfile [tcData]="archiveData.archiveCode" [data]="item" [adjustmentFlg]="true" (addFile)="emitFileData($event,'add')" (deleteFile)="emitFileData($event,'delete')" ></uploadfile> </ng-container> </div> <div class="row"> frontdesk/src/app/shared/components/showArchiveParts/showArchiveParts.component.ts
@@ -5,6 +5,7 @@ import { commonTools } from '../../modules/commonTools'; import { UrlUtil } from '../../util/urlUtil'; import { element } from 'protractor'; import { TemporaryCache } from '../../../service/common/temporaryCache.service'; const swal = require('sweetalert'); const config = require('../../../../assets/json/cloudVoucher.json'); @@ -96,7 +97,7 @@ addFileIds = []; destX: any = []; constructor(private templateUtil: TemplateUtil, private httpService: HttpService, private urlUtil: UrlUtil,private listSort: ListSort) {} constructor(private templateUtil: TemplateUtil, private httpService: HttpService, private urlUtil: UrlUtil,private listSort: ListSort,private TemporaryCache: TemporaryCache) {} ngOnInit(): void {} @@ -219,7 +220,6 @@ this.fileflg = false; this.fileList = []; this.httpService.post(this.httpService.selectArciveFile, {'fileCode': fileCode}, (res) => { console.log(res); if (res.data !== undefined && res.data.length !== 0 ) { this.fileflg = true; this.fileList = res.data; @@ -246,7 +246,6 @@ dataType: dataType, uploadedFileList: list, }); console.log(this.fileAdjustmentList); } // 密集 @@ -274,6 +273,9 @@ changeDetailStep(step): void { this.detailStep = step; if(step === 6){ this.TemporaryCache.tcCall(this.archiveData); } } relationAchive(pageProperty): void { frontdesk/src/app/shared/components/uploadfile/uploadfile.component.ts
@@ -4,6 +4,7 @@ import { HttpService } from '../../../service/common/http.service'; import { UrlUtil } from '../../../shared/util/urlUtil'; import { Http } from '@angular/http'; import { TemporaryCache } from '../../../service/common/temporaryCache.service'; declare var $: any; const swal = require('sweetalert'); @@ -46,7 +47,7 @@ addFileList: [], value: '' }; @Input()tcData; title = '文件上传'; descript = ''; @@ -63,10 +64,19 @@ private httpService: HttpService, private http: Http, private urlUtil: UrlUtil, ) {} private TemporaryCache: TemporaryCache, ) { this.TemporaryCache.tcStatas$.subscribe( () => { const tcValue = this.TemporaryCache.tcGet(this.tcData); if(this.uploader.files === [] && tcValue!= []){ this.uploader.files = tcValue; } } ); } ngOnInit() { console.log( this.data.uploadedFileList); this.uploader = new Resumable({ target: this.urlUtil.upFilePsotUrl, testTarget: this.urlUtil.upFileGetUrl, @@ -75,6 +85,12 @@ throttleProgressCallbacks: 1, chunkSize: 1 * 1024 * 1024 }); if(this.TemporaryCache.tcGet(this.tcData)){ const tcValue = this.TemporaryCache.tcGet(this.tcData); if(this.uploader.files){ this.uploader.files = tcValue; } } this.data.addFileList = []; }; @@ -101,7 +117,6 @@ }); this.data.uploadedFileList = []; this.data.uploadedFileList = tmpElemArray; console.log(tmpElemArray) this.uploader.files.forEach((data) => { if (data.fileName !== file.fileName) { @@ -113,7 +128,7 @@ swal('文件:' + file.fileName + '上传失败!', '请从新上传', 'info'); }; this.httpService.post('uploadservlet/getFastPath', {fileName: file.fileName}, (res) => { if (res.data === undefined || res.data === '') { if (res.data === undefined) { fun(); } else { const data = { @@ -124,9 +139,8 @@ }; this.data.addFileList.push(data); data['fileOrder'] = this.data.uploadedFileList.length + 1; console.log(this.data); this.addFile.emit(data); this.TemporaryCache.tcSave({key:this.tcData,value:this.uploader.files}); swal('文件' + file.fileName + '上传完成', '', 'success'); } }); @@ -270,7 +284,6 @@ }); this.data.uploadedFileList = []; this.data.uploadedFileList = tmpElemArray; console.log(tmpElemArray); } removeAdd(item) { @@ -306,7 +319,6 @@ } preview(item) { console.log(item); const type = item.fileName.split('.'); const fileType = type[type.length - 1]; let size = 0;