Browse Source

word,excel文件完善

beijing
陈鹏飞 3 years ago
parent
commit
e9e425e292
  1. 6
      src/app/pages/license/file-category/details-file-category/details-file-category.component.html
  2. 32
      src/app/pages/license/file-category/details-file-category/details-file-category.component.ts
  3. 5
      src/app/pages/license/file-category/edit-file-category/edit-file-category.component.html
  4. 33
      src/app/pages/license/file-category/edit-file-category/edit-file-category.component.ts
  5. 6
      src/app/pages/license/file-category/file-category.component.html
  6. 29
      src/app/pages/license/file-category/file-category.component.ts
  7. 9
      src/app/pages/license/update-category/update-category.component.html

6
src/app/pages/license/file-category/details-file-category/details-file-category.component.html

@ -13,7 +13,11 @@
<div class="cutoffrule"></div>
<!-- <p>是否年检: &nbsp;&nbsp;是</p>
<div class="cutoffrule"></div> -->
<p>证件图片: &nbsp;&nbsp;<img *ngIf="data.imageUrl" [src]="data.imageUrl" (click)="viewImg(data.imageUrl)"></p>
<p>证件图片: &nbsp;&nbsp;
<img *ngIf="data.imageUrl && getFileType(data.imageUrl) == 'img'" [src]="data.imageUrl" (click)="viewImg(data.imageUrl)">
<img *ngIf="data.imageUrl && getFileType(data.imageUrl) == 'word'" src="../../../../assets/images/license/word.png" (click)="lookFile(data)">
<img *ngIf="data.imageUrl && getFileType(data.imageUrl) == 'pdf'" src="../../../../assets/images/license/pdf.png" (click)="lookFile(data)">
</p>
<div class="cutoffrule"></div>
<p class="recordP">
<span>审核记录</span>

32
src/app/pages/license/file-category/details-file-category/details-file-category.component.ts

@ -4,6 +4,7 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { HttpClient } from '@angular/common/http';
import { ObjectsSimpleService } from 'src/app/service/objectsSimple.service';
import Viewer from 'viewerjs';
import { NzMessageService } from 'ng-zorro-antd/message';
@Component({
selector: 'app-details-file-category',
@ -13,7 +14,7 @@ import Viewer from 'viewerjs';
export class DetailsFileCategoryComponent implements OnInit {
@Input() data?: any;
constructor(private modal: NzModalRef, private http: HttpClient) { }
constructor(private modal: NzModalRef, private http: HttpClient,private message: NzMessageService) { }
ngOnInit(): void {
this.getAuditLogging()
@ -47,6 +48,19 @@ export class DetailsFileCategoryComponent implements OnInit {
this.modal.destroy({ data: 'this the result data' });
}
//获取文件格式
getFileType(name: string):string {
let suffix
if (name.substring(name.length-4).includes('png') || name.substring(name.length-4).includes('jpg') || name.substring(name.length-4).includes('jpeg') || name.substring(name.length-4).includes('webp')) {
suffix = 'img'
} else if (name.substring(name.length-4).includes('doc') || name.substring(name.length-4).includes('docx')) {
suffix = 'word'
} else if (name.substring(name.length-4).includes('pdf')) {
suffix = 'pdf'
}
return suffix
}
//查看图片
viewImg(url) {
let dom = document.getElementById(`viewerjs`)
@ -67,4 +81,20 @@ export class DetailsFileCategoryComponent implements OnInit {
}, 0);
}
//查看文件
lookFile(item) {
if (!item.imageUrl) {
return
}
if (this.getFileType(item.imageUrl) == 'word') {
let arr = item.imageUrl.split('.')
arr[arr.length - 1] = 'pdf'
window.open(arr.join('.'))
} else if (this.getFileType(item.imageUrl) == 'pdf') {
window.open(item.imageUrl)
} else {
this.message.create('warning', '暂不支持查看!');
}
}
}

5
src/app/pages/license/file-category/edit-file-category/edit-file-category.component.html

@ -26,7 +26,10 @@
<div class="uploadDivbox">
<div class="uploadDiv" style="margin-right: 12px;">
<img *ngIf="data2 && data2.imageUrl" style="width: 100%;height: 100%;cursor: pointer;" [src]="data2.imageUrl" (click)="viewImg(data2.imageUrl)">
<img *ngIf="data2.imageUrl && getFileType(data2.imageUrl) == 'img'" style="width: 100%;height: 100%;cursor: pointer;" [src]="data2.imageUrl" (click)="viewImg(data2.imageUrl)">
<img *ngIf="data2.imageUrl && getFileType(data2.imageUrl) == 'word'" src="../../../../assets/images/license/word.png" (click)="lookFile(data2)">
<img *ngIf="data2.imageUrl && getFileType(data2.imageUrl) == 'pdf'" src="../../../../assets/images/license/pdf.png" (click)="lookFile(data2)">
<input *ngIf="!data2.imageUrl" (change)="filechange($event)" class="fileinput" type="file" name="" id="">
<button *ngIf="!data2.imageUrl" nz-button [nzLoading]=""><i nz-icon nzType="upload"
nzTheme="outline"></i>上传附件</button>

33
src/app/pages/license/file-category/edit-file-category/edit-file-category.component.ts

@ -4,6 +4,7 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { HttpClient } from '@angular/common/http';
import { ObjectsSimpleService } from 'src/app/service/objectsSimple.service';
import Viewer from 'viewerjs';
import { NzMessageService } from 'ng-zorro-antd/message';
@Component({
selector: 'app-edit-file-category',
templateUrl: './edit-file-category.component.html',
@ -14,7 +15,7 @@ export class EditFileCategoryComponent implements OnInit {
@Input() data?: any;
validateForm!: FormGroup;
constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient, private objectsSrv: ObjectsSimpleService) { }
constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient, private objectsSrv: ObjectsSimpleService,private message: NzMessageService) { }
data2
@ -94,9 +95,21 @@ export class EditFileCategoryComponent implements OnInit {
}
//获取文件格式
getFileType(name: string):string {
let suffix
if (name.substring(name.length-4).includes('png') || name.substring(name.length-4).includes('jpg') || name.substring(name.length-4).includes('jpeg') || name.substring(name.length-4).includes('webp')) {
suffix = 'img'
} else if (name.substring(name.length-4).includes('doc') || name.substring(name.length-4).includes('docx')) {
suffix = 'word'
} else if (name.substring(name.length-4).includes('pdf')) {
suffix = 'pdf'
}
return suffix
}
//查看图片
viewImg(url) {
// url.split('?')[0]
let dom = document.getElementById(`viewerjs`)
let pObjs = dom.childNodes;
let node = document.createElement("img")
@ -115,4 +128,20 @@ export class EditFileCategoryComponent implements OnInit {
}, 0);
}
//查看文件
lookFile(item) {
if (!item.imageUrl) {
return
}
if (this.getFileType(item.imageUrl) == 'word') {
let arr = item.imageUrl.split('.')
arr[arr.length - 1] = 'pdf'
window.open(arr.join('.'))
} else if (this.getFileType(item.imageUrl) == 'pdf') {
window.open(item.imageUrl)
} else {
this.message.create('warning', '暂不支持查看!');
}
}
}

6
src/app/pages/license/file-category/file-category.component.html

@ -8,7 +8,7 @@
<span style="margin-left: 25%;">证件名称</span>
</th>
<th>有效期类型</th>
<th>图片</th>
<th>附件</th>
<th>提交时间</th>
<th>审核状态</th>
<th>操作</th>
@ -25,7 +25,9 @@
<span *ngIf="item.validatyType == 2"></span>
</td>
<td>
<img *ngIf="item.imageUrl" [src]="item.imageUrl" (click)="viewImg(item.imageUrl)">
<img *ngIf="item.imageUrl && getFileType(item.imageUrl) == 'img'" [src]="item.imageUrl" (click)="viewImg(item.imageUrl)">
<img *ngIf="item.imageUrl && getFileType(item.imageUrl) == 'word'" src="../../../../assets/images/license/word.png" (click)="lookFile(item)">
<img *ngIf="item.imageUrl && getFileType(item.imageUrl) == 'pdf'" src="../../../../assets/images/license/pdf.png" (click)="lookFile(item)">
</td>
<td>{{item.committedTime | date:"yyyy/MM/dd"}}<span *ngIf="!item.committedTime">未提交审核</span></td>
<td>

29
src/app/pages/license/file-category/file-category.component.ts

@ -41,6 +41,19 @@ export class FileCategoryComponent implements OnInit {
})
}
//获取文件格式
getFileType(name: string):string {
let suffix
if (name.substring(name.length-4).includes('png') || name.substring(name.length-4).includes('jpg') || name.substring(name.length-4).includes('jpeg') || name.substring(name.length-4).includes('webp')) {
suffix = 'img'
} else if (name.substring(name.length-4).includes('doc') || name.substring(name.length-4).includes('docx')) {
suffix = 'word'
} else if (name.substring(name.length-4).includes('pdf')) {
suffix = 'pdf'
}
return suffix
}
//查看图片
viewImg(url) {
let dom = document.getElementById(`viewerjs`)
@ -61,6 +74,22 @@ export class FileCategoryComponent implements OnInit {
}, 0);
}
//查看文件
lookFile(item) {
if (!item.imageUrl) {
return
}
if (this.getFileType(item.imageUrl) == 'word') {
let arr = item.imageUrl.split('.')
arr[arr.length - 1] = 'pdf'
window.open(arr.join('.'))
} else if (this.getFileType(item.imageUrl) == 'pdf') {
window.open(item.imageUrl)
} else {
this.message.create('warning', '暂不支持查看!');
}
}
dispose() {
}

9
src/app/pages/license/update-category/update-category.component.html

@ -27,12 +27,9 @@
<td>{{item.licenseCode || ''}}</td>
<td>{{item.isLongTerm ? '长期证照' : (item.validityEndTime | date:"yyyy/MM/dd")}}</td>
<td>
<img *ngIf="item.imageUrl && getFileType(item.imageUrl) == 'img'" [src]="item.imageUrl"
(click)="viewImg(item.imageUrl)">
<img *ngIf="item.imageUrl && getFileType(item.imageUrl) == 'word'"
src="../../../../assets/images/license/word.png" (click)="lookFile(item)">
<img *ngIf="item.imageUrl && getFileType(item.imageUrl) == 'pdf'"
src="../../../../assets/images/license/pdf.png" (click)="lookFile(item)">
<img *ngIf="item.imageUrl && getFileType(item.imageUrl) == 'img'" [src]="item.imageUrl" (click)="viewImg(item.imageUrl)">
<img *ngIf="item.imageUrl && getFileType(item.imageUrl) == 'word'" src="../../../../assets/images/license/word.png" (click)="lookFile(item)">
<img *ngIf="item.imageUrl && getFileType(item.imageUrl) == 'pdf'" src="../../../../assets/images/license/pdf.png" (click)="lookFile(item)">
</td>
<td>
<ng-container *ngIf="item.isLongTerm; else elseTemplate">

Loading…
Cancel
Save