考核考试系统
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.
 
 
 
 
 

56 lines
1.4 KiB

import { Pipe, PipeTransform } from '@angular/core';
@Pipe({name: 'name'})
export class NamePipe implements PipeTransform {
transform(name: string): string {
let nameArr = name.split("/")
return nameArr[nameArr.length - 1]
}
}
@Pipe({name: 'name2'})
export class NamePipe2 implements PipeTransform {
transform(name: string): string {
let nameArr = name.split("/")
return nameArr[nameArr.length - 2]
}
}
@Pipe({name: 'name3'})
export class NamePipe3 implements PipeTransform {
transform(name: string): string {
if(name.charAt(name.length-1) == "/"){
return name.substr(0, name.length - 1).replace(/\//g,'>').substring(9,name.length)
}else{
return name.replace(/\//g,'>').substring(9,name.length)
}
}
}
@Pipe({name: 'testState'})
export class testState implements PipeTransform {
transform(name: string): string {
if(name == "1"){
return "未开考"
}else if(name == "2"){
return "开考中"
}else{
return "已结束"
}
}
}
export enum PlanLevelEnum {
"编制级别0",
"总队",
"支队",
"编制级别3",
"大队",
"编制级别5",
"编制级别6",
"编制级别7",
"中队"
}
@Pipe({name: 'planlevel'})
export class PlanLevel implements PipeTransform {
transform(value: number): string {
return PlanLevelEnum[value]
}
}