|
@@ -84,6 +84,7 @@ export class RepositoryManageAddComponent implements OnInit {
|
84
|
84
|
pageIndex: number = 1; //页码
|
85
|
85
|
listLength: number = 10; //总条数
|
86
|
86
|
pageSize: number = 10; //每页条数
|
|
87
|
+ btnLoading: boolean = false; //确认按钮loading状态
|
87
|
88
|
btnLoading1: boolean = false; //确认按钮loading状态
|
88
|
89
|
btnLoading2: boolean = false; //确认按钮loading状态
|
89
|
90
|
printLoading: boolean = false; //批量打印按钮loading状态
|
|
@@ -98,7 +99,8 @@ export class RepositoryManageAddComponent implements OnInit {
|
98
|
99
|
malfunctionData: any = []; //故障现象数据
|
99
|
100
|
productData: any = []; //产品数据
|
100
|
101
|
typeDic:any = []; //知识库状态字典
|
101
|
|
- fileData:any[] = []; //附件数据
|
|
102
|
+ fileData: UploadFile[] = [];//附件数据
|
|
103
|
+ fileAllData:any[] = []; //附件数据
|
102
|
104
|
building:''; //楼栋
|
103
|
105
|
deptIndex:number; //选中index
|
104
|
106
|
searchParentDeptSubject = new Subject();
|
|
@@ -110,8 +112,8 @@ export class RepositoryManageAddComponent implements OnInit {
|
110
|
112
|
isDeptLoading = false;
|
111
|
113
|
delGrantModal = false;
|
112
|
114
|
showInsp = false;
|
113
|
|
- changeInp(e, type) {
|
114
|
|
- this.searchParentDeptSubject.next([e, type]);
|
|
115
|
+ changeInp(e) {
|
|
116
|
+ this.searchParentDeptSubject.next([e]);
|
115
|
117
|
}
|
116
|
118
|
|
117
|
119
|
// 获取详情
|
|
@@ -136,7 +138,8 @@ export class RepositoryManageAddComponent implements OnInit {
|
136
|
138
|
this.detailData = data
|
137
|
139
|
this.solutionNumber = data.solutionNumber
|
138
|
140
|
this.versionNumber = data.versionNumber
|
139
|
|
- this.detailContent = data.content || ''
|
|
141
|
+ this.detailContent = data.content || null
|
|
142
|
+ this.editOrData = data.content || null
|
140
|
143
|
let item = this.dicData.find(i=>i.id == this.detailData.type.id)
|
141
|
144
|
if(item){
|
142
|
145
|
this.classItem = item.value
|
|
@@ -152,7 +155,6 @@ export class RepositoryManageAddComponent implements OnInit {
|
152
|
155
|
this.isSpinning = false
|
153
|
156
|
});
|
154
|
157
|
}
|
155
|
|
- fileAllData=null;
|
156
|
158
|
getFile(){
|
157
|
159
|
this.mainService
|
158
|
160
|
.getPreviewImage('solution', this.detailId)
|
|
@@ -187,8 +189,10 @@ export class RepositoryManageAddComponent implements OnInit {
|
187
|
189
|
this.mainService
|
188
|
190
|
.getFetchDataList("data", "assetProduct", postData)
|
189
|
191
|
.subscribe((result) => {
|
190
|
|
- this.isDeptLoading = false
|
191
|
|
- this.productData = result.list;
|
|
192
|
+ setTimeout(_=>{
|
|
193
|
+ this.isDeptLoading = false
|
|
194
|
+ this.productData = result.list;
|
|
195
|
+ },500)
|
192
|
196
|
});
|
193
|
197
|
}
|
194
|
198
|
|
|
@@ -206,6 +210,7 @@ export class RepositoryManageAddComponent implements OnInit {
|
206
|
210
|
return;
|
207
|
211
|
};
|
208
|
212
|
let postData = {
|
|
213
|
+ hasThird: 'true',
|
209
|
214
|
category: {
|
210
|
215
|
dutyIds: this.currentHospital.type.value === '6' ? this.currentHospital.id.toString() : undefined,
|
211
|
216
|
},
|
|
@@ -306,7 +311,7 @@ export class RepositoryManageAddComponent implements OnInit {
|
306
|
311
|
let data = {
|
307
|
312
|
title:this.validateForm.value.title,
|
308
|
313
|
repairVisible:this.validateForm.value.repairVisible,
|
309
|
|
- content:this.editOrData,
|
|
314
|
+ content:this.editOrData?this.editOrData:null,
|
310
|
315
|
id:'',
|
311
|
316
|
hosId:this.hosId,
|
312
|
317
|
inspectionForm:{
|
|
@@ -375,15 +380,15 @@ export class RepositoryManageAddComponent implements OnInit {
|
375
|
380
|
// 上传图片
|
376
|
381
|
uploadFile(id){
|
377
|
382
|
let url = `/service/common/common/uploadAttachment/solution/${id}/${id}`
|
|
383
|
+ const formData = new FormData()
|
378
|
384
|
for(let i of this.fileData){//新上传的附件
|
379
|
385
|
let item = this.fileAllData.find(t=>t.id == i.uid) //之前的附件
|
380
|
386
|
if(!item){
|
381
|
|
- const formData = new FormData();
|
382
|
387
|
if(i.originFileObj){
|
383
|
388
|
formData.append('file', i.originFileObj);
|
384
|
389
|
formData.append('filename', i.originFileObj.name);
|
385
|
390
|
}else{
|
386
|
|
- formData.append('file', i);
|
|
391
|
+ formData.append('file', i as any);
|
387
|
392
|
formData.append('filename', i.name);
|
388
|
393
|
}
|
389
|
394
|
|
|
@@ -427,42 +432,25 @@ export class RepositoryManageAddComponent implements OnInit {
|
427
|
432
|
});
|
428
|
433
|
}
|
429
|
434
|
|
430
|
|
- avatarLoading = false;
|
431
|
|
- avatarUrl: string;
|
432
|
|
- avatarUrl1: string;
|
433
|
|
- beforeUpload = (file: File) => {
|
|
435
|
+ beforeUpload = (file: UploadFile) => {
|
434
|
436
|
console.log(888,file)
|
435
|
|
- return new Observable((observer: Observer<boolean>) => {
|
436
|
|
- let type = file.name.split('.')
|
437
|
|
- const isPic = (type[1] === 'xlsx' || type[1] === 'pdf' ||
|
438
|
|
- type[1] === 'xls' || type[1] === 'ppt' || type[1] === 'txt');
|
439
|
|
- if (!isPic) {
|
440
|
|
- this.message.error('只能上传PDF、word、ppt、excel、txt等文件类型格式!');
|
441
|
|
- observer.complete();
|
442
|
|
- return;
|
443
|
|
- }
|
444
|
|
- const isLt4M = file.size / 1024 / 1024 < 10;
|
445
|
|
- if (!isLt4M) {
|
446
|
|
- this.message.error('图片大小不能大于10MB!');
|
447
|
|
- observer.complete();
|
448
|
|
- return;
|
449
|
|
- }
|
450
|
|
- observer.next(isPic && isLt4M);
|
451
|
|
- observer.complete();
|
452
|
|
- });
|
|
437
|
+ let type = file.name.split('.')
|
|
438
|
+ const isPic = (type[1] === 'xlsx' || type[1] === 'pdf' ||
|
|
439
|
+ type[1] === 'xls' || type[1] === 'ppt' || type[1] === 'txt' ||
|
|
440
|
+ type[1] === 'doc' || type[1] === 'docx');
|
|
441
|
+ if (!isPic) {
|
|
442
|
+ this.message.error('只能上传PDF、word、ppt、excel、txt等文件类型格式!');
|
|
443
|
+ return;
|
|
444
|
+ }
|
|
445
|
+ const isLt4M = file.size / 1024 / 1024 < 10;
|
|
446
|
+ if (!isLt4M) {
|
|
447
|
+ this.message.error('图片大小不能大于10MB!');
|
|
448
|
+ return;
|
|
449
|
+ }
|
|
450
|
+ this.fileData = this.fileData.concat(file);
|
|
451
|
+ return false;
|
453
|
452
|
};
|
454
|
453
|
|
455
|
|
- // 附件上传
|
456
|
|
- handleChange(info: { file: UploadFile }): void {
|
457
|
|
-
|
458
|
|
- }
|
459
|
|
-
|
460
|
|
- private getBase64(img: File, callback: (img: string) => void): void {
|
461
|
|
- const reader = new FileReader();
|
462
|
|
- reader.addEventListener('load', () => callback(reader.result!.toString()));
|
463
|
|
- reader.readAsDataURL(img);
|
464
|
|
- }
|
465
|
|
-
|
466
|
454
|
// 删除附件
|
467
|
455
|
removeFile = (file) => {
|
468
|
456
|
console.log(111,file)
|
|
@@ -485,36 +473,6 @@ export class RepositoryManageAddComponent implements OnInit {
|
485
|
473
|
|
486
|
474
|
}
|
487
|
475
|
|
488
|
|
- // 自定义上传
|
489
|
|
- customReq = (item: UploadXHRArgs) => {
|
490
|
|
- const formData = new FormData();
|
491
|
|
- // tslint:disable-next-line:no-any
|
492
|
|
- formData.append('file', item.file as any);
|
493
|
|
- formData.append('filename', item.file.name);
|
494
|
|
- const req = new HttpRequest('POST', item.action!, formData, {
|
495
|
|
- reportProgress: true,
|
496
|
|
- withCredentials: true
|
497
|
|
- });
|
498
|
|
- // Always returns a `Subscription` object. nz-upload would automatically unsubscribe it at correct time.
|
499
|
|
- return this.http.request(req).subscribe(
|
500
|
|
- // tslint:disable-next-line no-any
|
501
|
|
- (event: HttpEvent<any>) => {
|
502
|
|
- if (event.type === HttpEventType.UploadProgress) {
|
503
|
|
- if (event.total! > 0) {
|
504
|
|
- // tslint:disable-next-line:no-any
|
505
|
|
- (event as any).percent = (event.loaded / event.total!) * 100;
|
506
|
|
- }
|
507
|
|
- item.onProgress!(event, item.file!);
|
508
|
|
- } else if (event instanceof HttpResponse) {
|
509
|
|
- item.onSuccess!(event.body, item.file!, event);
|
510
|
|
- }
|
511
|
|
- },
|
512
|
|
- err => {
|
513
|
|
- item.onError!(err, item.file!);
|
514
|
|
- }
|
515
|
|
- );
|
516
|
|
- };
|
517
|
|
-
|
518
|
476
|
closeModel(){
|
519
|
477
|
this.initForm();
|
520
|
478
|
this.back()
|