Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 按两列角度筛选客户端数组_Angular_Typescript - Fatal编程技术网

Angular 按两列角度筛选客户端数组

Angular 按两列角度筛选客户端数组,angular,typescript,Angular,Typescript,我有客户课 export class Client { clientId: number; name: string ; district: string; province: string; zip: string; city: string; // tslint:disable-next-line: variable-name full_Address: string; latitude: number; lon

我有客户课

export class Client {
    clientId: number;
    name: string ;
    district: string;
    province: string;
    zip: string;
    city: string;
    // tslint:disable-next-line: variable-name
    full_Address: string;
    latitude: number;
    longitude: number;
    segment: string;
    ph: string;
    bh: number;
    canal: string;
    isSimple: string;
    maxSaleDate : Date;
}
我想按列isSimple(具有value TAK或NIE)或列canal(具有value Producent或Handel)筛选客户

在这里,我单击所有输入,然后根据这些输入进行过滤

我有点被简单的过滤器过滤掉了

这是我的代码:

returnFilterSimpleValue(value : any) : string {

    switch (value == undefined) {
      case true:
          return 'NIE';
      default :
          return 'TAK';
    }

  }



const filter={
      Producent:this.checkedTypeOfClient.find(x=>x.name=="Producent").checked,
      Handel:this.checkedTypeOfClient.find(x=>x.name=="Handel").checked,
      Simple:this.checkedTypeOfClient.find(x=>x.name=="Simple").checked
   }

   let canalFilterType = this.checkedTypeOfClient.filter(x => (x.name == "Producent" && x.checked == true)
                                                        || (x.name == "Handel" && x.checked == true))
                                                        .map(y => y.name);


    let simpleFilterType = this.returnFilterSimpleValue(this.checkedTypeOfClient.find(x => x.name == 
              "Simple" && x.checked == true)) ;


     let simpleFilter = this.returnFilterSimpleValue(filter.Simple);

    this.currentClientList = this.baseClientList;

    this.currentClientList = this.currentClientList.filter(client => {
        (this.checkedSegment.includes(client.segment) && this.checkedPH.includes(client.ph))
                  && (simpleFilterType.includes(client.isSimple) && canalFilterType.includes(client.canal))

       return (this.checkedSegment.includes(client.segment) && this.checkedPH.includes(client.ph))
                      && (simpleFilterType.includes(client.isSimple) || canalFilterType.includes(client.canal)
                      );
    });