You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
155 lines
4.3 KiB
155 lines
4.3 KiB
/* |
|
* @Descripttion: |
|
* @version: |
|
* @Author: sueRimn |
|
* @Date: 2020-12-25 10:19:31 |
|
* @LastEditors: sueRimn |
|
* @LastEditTime: 2021-01-28 13:40:31 |
|
*/ |
|
import { Component, OnInit } from '@angular/core'; |
|
import { FormControl } from '@angular/forms'; |
|
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; |
|
import { HttpClient } from '@angular/common/http' |
|
import { DomSanitizer } from '@angular/platform-browser'; |
|
import CryptoJS from 'crypto-js/crypto-js' |
|
|
|
@Component({ |
|
selector: 'app-plan-record', |
|
templateUrl: './plan-record.component.html', |
|
styleUrls: ['./plan-record.component.scss'] |
|
}) |
|
export class PlanRecordComponent implements OnInit { |
|
|
|
constructor(private http:HttpClient,public snackBar: MatSnackBar,private sanitizer: DomSanitizer) { } |
|
|
|
ngOnInit(): void { |
|
let level = sessionStorage.getItem("level"); |
|
if(level == "0"){//如果是总队 |
|
this.preparelevels = [ |
|
{name:"总队",value:"1"}, |
|
{name:"支队",value:"2"}, |
|
{name:"大队",value:"4"}, |
|
{name:"中队",value:"8"} |
|
] |
|
this.PlanLevel=0 |
|
} |
|
if(level == "1"){//如果是支队 |
|
this.preparelevels = [ |
|
{name:"支队",value:"1"}, |
|
{name:"大队",value:"2"}, |
|
{name:"中队",value:"3"} |
|
] |
|
this.PlanLevel=1 |
|
} |
|
if(level == "2"){//如果是大队 |
|
this.preparelevels = [ |
|
{name:"大队",value:"4"}, |
|
{name:"中队",value:"8"} |
|
] |
|
this.PlanLevel=2 |
|
} |
|
if(level == "3"){//如果是中队 |
|
this.preparelevels = [ |
|
{name:"中队",value:"8"} |
|
] |
|
this.PlanLevel=3 |
|
} |
|
this.iframeSrc=this.sanitizer.bypassSecurityTrustResourceUrl(this.src); |
|
this.getAlltabledate() |
|
} |
|
|
|
wordShow=true |
|
iframeSrc |
|
src='' |
|
selected = new FormControl(0); //选项卡 实例 |
|
preparelevels:any |
|
level=''//类型 |
|
verifyState=''//审核状态 |
|
projectlevel//组织机构 |
|
PlanLevel//编制级别 |
|
addtime//时间 |
|
endtime//结束时间 |
|
count//一共多少条 |
|
tableDate |
|
|
|
//获取表格数据 |
|
getAlltabledate(){ |
|
|
|
let paramsdata:any = { |
|
Operation:this.level||[], |
|
ContentType:Number(this.projectlevel)||[], |
|
Level:this.PlanLevel||[], |
|
verifyState:this.verifyState||[1,2,4,5], |
|
QueryStartTime:this.addtime||'', |
|
QueryEndTime:this.endtime||'' |
|
} |
|
this.http.get("/api/ContentVerifies",{params:paramsdata}).subscribe((data:any)=>{ |
|
//console.log(data) |
|
this.tableDate=data.items |
|
this.count=data.totalCount |
|
}) |
|
} |
|
//提交查询 |
|
onSubmit(value){ |
|
//console.log(value) |
|
this.getAlltabledate() |
|
} |
|
//刷新 |
|
record(){ |
|
this.verifyState='' |
|
this.level='' |
|
this.projectlevel='' |
|
this.addtime='' |
|
this.endtime='' |
|
let level = sessionStorage.getItem("level"); |
|
if(level == "0"){//如果是总队 |
|
this.PlanLevel=0 |
|
} |
|
if(level == "1"){//如果是支队 |
|
this.PlanLevel=1 |
|
} |
|
if(level == "2"){//如果是大队 |
|
this.PlanLevel=2 |
|
} |
|
if(level == "3"){//如果是中队 |
|
this.PlanLevel=3 |
|
} |
|
this.getAlltabledate() |
|
} |
|
//表格点击事件 |
|
tableClick(e,item){ |
|
//e.target.parentElement.bgColor='#2196F3' |
|
//console.log(e,item) |
|
let filename:string |
|
let fetchUrl |
|
this.http.get(`/api/PlanComponents/${item.itemId}`).subscribe((data:any)=>{ |
|
fetchUrl=data.attachmentUrls[0] |
|
this.http.get(`/api/ObjectMetadata/PlanPlatform/${fetchUrl}`).subscribe((data:any)=>{ |
|
filename=data.fileName |
|
let json={ |
|
doc: { |
|
docId: item.id, |
|
title: filename, |
|
//title: filename, |
|
fetchUrl: "http://39.106.78.171:8000/api/Objects/PlanPlatform/"+fetchUrl |
|
}, |
|
user: { |
|
uid: "test", |
|
nickName: "test", |
|
avatar: "", |
|
privilege: [ |
|
'FILE_READ','FILE_DOWNLOAD', 'FILE_PRINT' |
|
], |
|
}, |
|
} |
|
var stringjson=JSON.stringify(json) |
|
var wordArray = CryptoJS.enc.Utf8.parse(stringjson); |
|
var base64 = CryptoJS.enc.Base64.stringify(wordArray); |
|
this.src=`http://121.5.10.84/apps/editor/openPreview?data=${base64}` |
|
this.iframeSrc=this.sanitizer.bypassSecurityTrustResourceUrl(this.src); |
|
//window.open(`http://121.5.10.84/apps/editor/openPreview?data=${base64}`) |
|
}) |
|
}) |
|
} |
|
|
|
}
|
|
|