import { Subject } from 'rxjs';
import { debounceTime } from 'rxjs/operators';
import { ToolService } from './../../../../services/tool.service';
import { Component, OnInit, Output, Input } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { EventEmitter } from '@angular/core';
import { MainService } from 'src/app/services/main.service';

@Component({
  selector: 'app-search-more',
  templateUrl: './search-more.component.html',
  styleUrls: ['./search-more.component.less']
})
export class SearchMoreComponent implements OnInit {
  @Output() submitEvent = new EventEmitter();
  @Output() cancelEvent = new EventEmitter();
  @Input() fieldConfig: any = { fields: [], config: [] };
  @Input() hosId: any;
  @Input() parentDutyId: any;
  @Input() dutyId: any;
  @Input() queryType: any;
	@Input() going: boolean = false;
  validateForm: FormGroup;//表单
  searchTimerSubject = new Subject();
  constructor(
    private fb: FormBuilder,
    private tool: ToolService,
    private mainService: MainService,
  ) { }
	
	isHangList:any = [
		{name:'是',id:1},
		{name:'否',id:0}
	]
	overtimeList:any = [
		{name:'是',id:1},
		{name:'否',id:0}
	]
	
  ngOnInit() {
    this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
      let fun = v[0];
      fun.call(this, v[1]);
    });
		console.log(4444,this.fieldConfig)
    this.initForm();
    this.getSourceList();
		this.getWorkHourEvaluateList();
  }
  // 隐藏模态框
  hideModal() {
    this.cancelEvent.emit()
  }
  // 初始化form表单
  initForm() {
    this.groupList = this.fieldConfig.fields.groupDTO ? [this.fieldConfig.fields.groupDTO] : [];
    this.userList = this.fieldConfig.fields.userDTO ? [this.fieldConfig.fields.userDTO] : [];
    this.category1List = this.fieldConfig.fields.category1DTO ? [this.fieldConfig.fields.category1DTO] : [];
    this.category2List = this.fieldConfig.fields.category2DTO ? [this.fieldConfig.fields.category2DTO] : [];
    this.category3List = this.fieldConfig.fields.category3DTO ? [this.fieldConfig.fields.category3DTO] : [];
    this.sourceList = this.fieldConfig.fields.sourceDTO ? [this.fieldConfig.fields.sourceDTO] : [];
    this.buildingList = this.fieldConfig.fields.buildingDTO ? [this.fieldConfig.fields.buildingDTO] : [];
    this.floorList = this.fieldConfig.fields.floorDTO ? [this.fieldConfig.fields.floorDTO] : [];
    this.companyList = this.fieldConfig.fields.companyDTO ? [this.fieldConfig.fields.companyDTO] : [];
    this.workHourParentList = this.fieldConfig.fields.workHourParentDTO ? [this.fieldConfig.fields.workHourParentDTO] : [];
    this.repairDeptList = this.fieldConfig.fields.repairDeptDTO ? [this.fieldConfig.fields.repairDeptDTO] : [];
		this.deptTypeList = this.fieldConfig.fields.deptTypeDTO ? [this.fieldConfig.fields.deptTypeDTO] : [];
		this.evaluateList = this.fieldConfig.fields.evaluateDTO ? [this.fieldConfig.fields.evaluateDTO] : [];
		this.workHourSmallList = this.fieldConfig.fields.workHourSmallDTO ? [this.fieldConfig.fields.workHourSmallDTO] : [];
		this.repairUserList = this.fieldConfig.fields.repairUserDTO ? [this.fieldConfig.fields.repairUserDTO] : [];
		this.isHangList = [{name:'是',id:1},{name:'否',id:0}];
		this.overtimeList = [{name:'是',id:1},{name:'否',id:0}];
		
		this.validateForm = this.fb.group({
      groupId: [this.fieldConfig.fields.groupId || null],
      userId: [this.fieldConfig.fields.userId === undefined ? null : this.fieldConfig.fields.userId],
      category1Id: [this.fieldConfig.fields.category1DTO ? this.fieldConfig.fields.category1DTO.id  : null],
      category2Id: [this.fieldConfig.fields.category2DTO ? this.fieldConfig.fields.category2DTO.id  : null],
      category3Id: [this.fieldConfig.fields.category3DTO ? this.fieldConfig.fields.category3DTO.id  : null],
      sourceId: [this.fieldConfig.fields.sourceId || null],
      buildingId: [this.fieldConfig.fields.buildingId || null],
      floorId: [this.fieldConfig.fields.floorId === undefined ? null : this.fieldConfig.fields.floorId],
      companyId: [this.fieldConfig.fields.companyDTO ? this.fieldConfig.fields.companyDTO.id  : null],
      workHourParentId: [this.fieldConfig.fields.workHourParentDTO ? this.fieldConfig.fields.workHourParentDTO.id  : null],
			workHourSmallId: [this.fieldConfig.fields.workHourSmallDTO ? this.fieldConfig.fields.workHourSmallDTO.id  : null],
			repairDeptId: [this.fieldConfig.fields.repairDeptDTO ? this.fieldConfig.fields.repairDeptDTO.id  : null],
			deptTypeId: [this.fieldConfig.fields.deptTypeId || null],
			evaluateId: [this.fieldConfig.fields.evaluateId || null],
			repairUserId: [this.fieldConfig.fields.repairUserId === undefined ? null : this.fieldConfig.fields.repairUserId],
			consumableId: [this.fieldConfig.fields.consumableId || null],
			isHangId: [this.fieldConfig.fields.isHangDTO ? this.fieldConfig.fields.isHangDTO.id  : null],
			codeNum: [this.fieldConfig.fields.codeNum || null],
			overtimeId: [this.fieldConfig.fields.overtimeDTO ? this.fieldConfig.fields.overtimeDTO.id  : null],
		});
		
		if(this.going && this.fieldConfig.fields.groupId){
			this.getGroupList();
		}
		
		if(this.going && this.fieldConfig.fields.userId){
			this.getUserList();
		}
		
		if(this.going && this.fieldConfig.fields.category1DTO){
			this.getCategory1List();
		}
		
		if(this.going && this.fieldConfig.fields.category2DTO){
			this.getCategory2List();
		}
		
		if(this.going && this.fieldConfig.fields.category3DTO){
			this.getCategory3List();
		}
		
		if(this.going && this.fieldConfig.fields.buildingId){
			this.getBuildingList();
		}
		
		if(this.going && this.fieldConfig.fields.floorId){
			this.getFloorList();
		}
		
		if(this.going && this.fieldConfig.fields.companyId){
			this.getCompanyList();
		}
		
		
  }
  // 表单提交
  submitForm(): void {
    for (const i in this.validateForm.controls) {
      this.validateForm.controls[i].markAsDirty({ onlySelf: true });
      this.validateForm.controls[i].updateValueAndValidity();
    }
    if (this.validateForm.invalid) return;

    let categoryId, hierarchy;
    if(this.validateForm.value.category3Id){
      categoryId = this.validateForm.value.category3Id;
      hierarchy = 3;
    }else if(this.validateForm.value.category2Id){
      categoryId = this.validateForm.value.category2Id;
      hierarchy = 2;
    }else if(this.validateForm.value.category1Id){
      categoryId = this.validateForm.value.category1Id;
      hierarchy = 1;
    }
    let fields:any = {}
    if(this.fieldConfig.config.group){
      fields.groupId = this.validateForm.value.groupId;
      fields.groupDTO = this.groupList.find(item => item.id == this.validateForm.value.groupId);
    }

    if(this.fieldConfig.config.groupAndUser){
      fields.groupId = this.validateForm.value.groupId;
      fields.groupDTO = this.groupList.find(item => item.id == this.validateForm.value.groupId);
      fields.userId = this.validateForm.value.userId;
      fields.userDTO = this.userList.find(item => item.id == this.validateForm.value.userId);
    }
    if(this.fieldConfig.config.category123){
      fields.categoryId = categoryId;
      fields.hierarchy = hierarchy;
      fields.category1DTO = this.category1List.find(item => item.id == this.validateForm.value.category1Id);
      fields.category2DTO = this.category2List.find(item => item.id == this.validateForm.value.category2Id);
      fields.category3DTO = this.category3List.find(item => item.id == this.validateForm.value.category3Id);
    }
    if(this.fieldConfig.config.source){
      fields.sourceId = this.validateForm.value.sourceId;
      fields.sourceDTO = this.sourceList.find(item => item.id == this.validateForm.value.sourceId);
    }
    if(this.fieldConfig.config.buildingAndFloor){
      fields.buildingId = this.validateForm.value.buildingId;
      fields.buildingDTO = this.buildingList.find(item => item.id == this.validateForm.value.buildingId);
      fields.floorId = this.validateForm.value.floorId;
      fields.floorDTO = this.floorList.find(item => item.id == this.validateForm.value.floorId);
    }
    if(this.fieldConfig.config.company){
      fields.companyId = this.validateForm.value.companyId;
      fields.companyDTO = this.companyList.find(item => item.id == this.validateForm.value.companyId);
    }
    if(this.fieldConfig.config.workHourParent){
      fields.workHourParentId = this.validateForm.value.workHourParentId;
      fields.workHourParentDTO = this.workHourParentList.find(item => item.id == this.validateForm.value.workHourParentId);
    }
		if(this.fieldConfig.config.workHourSmall){
		  fields.workHourSmallId = this.validateForm.value.workHourSmallId;
		  fields.workHourSmallDTO = this.workHourSmallList.find(item => item.id == this.validateForm.value.workHourSmallId);
		}
    if(this.fieldConfig.config.repairDept){
      fields.repairDeptId = this.validateForm.value.repairDeptId;
      fields.repairDeptDTO = this.repairDeptList.find(item => item.id == this.validateForm.value.repairDeptId);
    }
		if(this.fieldConfig.config.deptType){
		  fields.deptTypeId = this.validateForm.value.deptTypeId;
		  fields.deptTypeDTO = this.deptTypeList.find(item => item.id == this.validateForm.value.deptTypeId);
		}
		
		if(this.fieldConfig.config.evaluate){
			fields.evaluateId = this.validateForm.value.evaluateId;
			fields.evaluateDTO = this.evaluateList.find(item => item.id == this.validateForm.value.evaluateId);
		}
		
		if(this.fieldConfig.config.repairUser){
			fields.repairUserId = this.validateForm.value.repairUserId;
			fields.repairUserDTO = this.repairUserList.find(item => item.id == this.validateForm.value.repairUserId);
		}
		
		if(this.fieldConfig.config.consumable){
			fields.consumableId = this.validateForm.value.consumableId;
			fields.consumableDTO = this.consumableList.find(item => item.id == this.validateForm.value.consumableId);
		}
		
		if(this.fieldConfig.config.isHang){
			fields.isHangId = this.validateForm.value.isHangId;
			fields.isHangDTO = this.isHangList.find(item => item.id == this.validateForm.value.isHangId);
		}
		
		
		if(this.fieldConfig.config.code){
			fields.codeNum = this.validateForm.value.codeNum;
			fields.codeNumDTO = this.validateForm.value.codeNum;
		}
		
		if(this.fieldConfig.config.overtime){
			fields.overtimeId = this.validateForm.value.overtimeId;
			fields.overtimeDTO = this.overtimeList.find(item => item.id == this.validateForm.value.overtimeId);
		}
				
    this.submitEvent.emit(fields);
    this.hideModal();
  }

  get getHosId(){
    return this.parentDutyId || this.dutyId || this.hosId;
  }

  // 防抖
  isLoading = false;
  isSelecting:boolean = false; // 是否在选中状态
  searchTimer(fun, e) {
    if (this.isSelecting) {
      this.isSelecting = false; // 重置标志
      return; // 跳过处理
    }
    this.isLoading = true;
    this.searchTimerSubject.next([fun, e]);
  }

  // 设置标志
  setIsSelecting(flag){
    this.isSelecting = flag; // 设置标志
  }

  // =================维修分组===================

  // 维修分组搜索
  changeGroupInp(e) {
    this.searchTimer(this.getGroupList, e);
  }

  // 获取维修分组列表
  groupList:any[] = [];
  getGroupList(keyword?){
    let postData: any = {
      idx: 0,
      sum: 20,
      group2: {
        statisticalHosId: this.getHosId,
        groupName: keyword,
        type: 3,
      },
    };
    this.isLoading = true;
    this.mainService.getFetchDataList("simple/data", "group2", postData).subscribe(result => {
      this.isLoading = false;
      if(result.status == 200){
        this.groupList = result.list || [];
      }else{
        this.groupList = [];
      }
    });
  }
  openChangeGroup(flag){
    flag && this.setIsSelecting(false);
    flag && this.getGroupList();
  }

  changeGroup(id){
    this.setIsSelecting(true);
    this.userList = [];
    this.validateForm.controls.userId.setValue(null);
    this.getUserList();
  }

	// =================科室类型===================

	// 科室类型
	openChangeDeptType(flag){
	  flag && this.getDeptTypeList();
	}

	// 获取科室类型列表
	deptTypeList:any[] = [];
	getDeptTypeList(keyword?) {
	  this.isLoading = true;
	  this.mainService
	    .getDictionary("list", "dept_type")
	    .subscribe((data) => {
	      this.isLoading = false;
	      this.deptTypeList = data;
	    });
	}

  // =================维修人员===================

  // 维修人员搜索
  changeUserInp(e) {
    this.searchTimer(this.getUserList, e);
  }

  // 获取维修人员列表
  userList:any[] = [];
  getUserList(keyword = ''){
    // if(!this.validateForm.value.groupId){
    //   this.isLoading = false;
    //   this.userList = [];
    //   return;
    // }
    let postData: any = {
      idx: 0,
      sum: 20,
      user: {
        name: keyword,
        simpleQuery: true,
        // groupdata: { id: this.validateForm.value.groupId },
        roleCodes: 'first-line support,second-line support,incident manager',
        engineer: 1,
      },
    };
    this.isLoading = true;
    this.mainService.getFetchDataList("simple/data", "user", postData).subscribe(result => {
      this.isLoading = false;
      if(result.status == 200){
        this.userList = result.list || [];
      }else{
        this.userList = [];
      }
    });
  }
  openChangeUser(flag){
    flag && this.setIsSelecting(false);
    flag && this.getUserList();
  }

  // =================一级分类===================

  // 一级分类搜索
  changeCategory1Inp(e) {
    this.searchTimer(this.getCategory1List, e);
  }

  // 获取一级分类列表
  category1List:any[] = [];
  getCategory1List(keyword?){
    let postData: any = {
      category: {
        category: keyword,
        selectType: 'mutlQuery',
        statisticalHosId: this.getHosId,
        hierarchy: 1,
      },
    };
    this.isLoading = true;
    this.mainService.incidentPost("listIncidentCategory", postData).subscribe(result => {
      this.isLoading = false;
      if(result.status == 200){
        this.category1List = result.data || [];
      }else{
        this.category1List = [];
      }
    });
  }
  openChangeCategory1(flag){
    flag && this.setIsSelecting(false);
    flag && this.getCategory1List();
  }

  changeCategory1(id){
    this.setIsSelecting(true);
    this.category2List = [];
    this.validateForm.controls.category2Id.setValue(null);
    this.getCategory2List();

    this.category3List = [];
    this.validateForm.controls.category3Id.setValue(null);
  }

  // =================二级分类===================

  // 二级分类搜索
  changeCategory2Inp(e) {
    this.searchTimer(this.getCategory2List, e);
  }

  // 获取二级分类列表
  category2List:any[] = [];
  getCategory2List(keyword = ''){
    if(!this.validateForm.value.category1Id){
      this.isLoading = false;
      this.category2List = [];
      return;
    }
    let postData: any = {
      category: {
        category: keyword,
        selectType: 'mutlQuery',
        parent: { id: this.validateForm.value.category1Id },
      },
    };
    this.isLoading = true;
    this.mainService.incidentPost("listIncidentCategory", postData).subscribe(result => {
      this.isLoading = false;
      if(result.status == 200){
        this.category2List = result.data || [];
      }else{
        this.category2List = [];
      }
    });
  }
  openChangeCategory2(flag){
    flag && this.setIsSelecting(false);
    flag && this.getCategory2List();
  }

  changeCategory2(id){
    this.setIsSelecting(true);
    this.category3List = [];
    this.validateForm.controls.category3Id.setValue(null);
    this.getCategory3List();
  }

  // =================三级分类===================

  // 三级分类搜索
  changeCategory3Inp(e) {
    this.searchTimer(this.getCategory3List, e);
  }

  // 获取三级分类列表
  category3List:any[] = [];
  getCategory3List(keyword = ''){
    if(!this.validateForm.value.category2Id){
      this.isLoading = false;
      this.category3List = [];
      return;
    }
    let postData: any = {
      category: {
        category: keyword,
        selectType: 'mutlQuery',
        parent: { id: this.validateForm.value.category2Id },
      },
    };
    this.isLoading = true;
    this.mainService.incidentPost("listIncidentCategory", postData).subscribe(result => {
      this.isLoading = false;
      if(result.status == 200){
        this.category3List = result.data || [];
      }else{
        this.category3List = [];
      }
    });
  }
  openChangeCategory3(flag){
    flag && this.setIsSelecting(false);
    flag && this.getCategory3List();
  }

  // =================故障来源===================

  // 获取故障来源列表
  sourceList:any[] = [];
  getSourceList(){
    this.mainService.getDictionary("list", "incident_source").subscribe(result => {
      this.sourceList = result;
    });
  }

  // =================楼栋===================

  // 楼栋搜索
  changeBuildingInp(e) {
    this.searchTimer(this.getBuildingList, e);
  }

  // 获取楼栋列表
  buildingList:any[] = [];
  getBuildingList(keyword?){
    let postData: any = {
      idx: 0,
      sum: 20,
      building: {
        simpleQuery: true,
        buildingName: keyword,
        statisticalHosId:this.getHosId,
      },
    };
    this.isLoading = true;
    this.mainService.getFetchDataList("simple/data", "building", postData).subscribe(result => {
      this.isLoading = false;
      if(result.status == 200){
        this.buildingList = result.list || [];
      }else{
        this.buildingList = [];
      }
    });
  }
  openChangeBuilding(flag){
    flag && this.setIsSelecting(false);
    flag && this.getBuildingList();
  }

  changeBuilding(id){
    this.setIsSelecting(true);
    this.floorList = [];
    this.validateForm.controls.floorId.setValue(null);
    this.getFloorList();
  }

  // =================楼层===================

  // 楼层搜索
  changeFloorInp(e) {
    this.searchTimer(this.getFloorList, e);
  }

  // 获取楼层列表
  floorList:any[] = [];
  getFloorList(keyword = ''){
    if(!this.validateForm.value.buildingId){
      this.isLoading = false;
      this.floorList = [];
      return;
    }
    let postData: any = {
      idx: 0,
      sum: 20,
      floor: {
        floorName: keyword,
        buildId : this.validateForm.value.buildingId,
      },
    };
    this.isLoading = true;
    this.mainService.getFetchDataList("simple/data", "floor", postData).subscribe(result => {
      this.isLoading = false;
      if(result.status == 200){
        this.floorList = result.list || [];
      }else{
        this.floorList = [];
      }
    });
  }
  openChangeFloor(flag){
    flag && this.setIsSelecting(false);
    flag && this.getFloorList();
  }

  // =================三方公司===================

  // 三方公司搜索
  changeCompanyInp(e) {
    this.searchTimer(this.getCompanyList, e);
  }

  // 获取三方公司列表
  companyList:any[] = [];
  getCompanyList(keyword?){
    let postData: any = {
      idx: 0,
      sum: 20,
      company: {
        busiType: { key: "company_busi_type", value: "2" },
        name: keyword,
        statisticalHosId: this.getHosId,
      },
    };
    this.isLoading = true;
    this.mainService.getFetchDataList("simple/data", "company", postData).subscribe(result => {
      this.isLoading = false;
      if(result.status == 200){
        this.companyList = result.list || [];
      }else{
        this.companyList = [];
      }
    });
  }
  openChangeCompany(flag){
    flag && this.setIsSelecting(false);
    flag && this.getCompanyList();
  }

  // =================报修科室===================

  // 报修科室搜索
  changeRepairDeptInp(e) {
    this.searchTimer(this.getRepairDeptList, e);
  }

  // 获取报修科室列表
  repairDeptList:any[] = [];
  getRepairDeptList(keyword?){
    let postData: any = {
      idx: 0,
      sum: 20,
      department: {
        statisticalHosId: this.getHosId,
        dept: keyword,
        searchType: 1,
      },
    };
    this.isLoading = true;
    this.mainService.getFetchDataList("simple/data", "department", postData).subscribe(result => {
      this.isLoading = false;
      if(result.status == 200){
        this.repairDeptList = result.list || [];
      }else{
        this.repairDeptList = [];
      }
    });
  }
  openChangeRepairDept(flag){
    flag && this.setIsSelecting(false);
    flag && this.getRepairDeptList();
  }

  // =================工时大类===================

  // 工时大类搜索
  changeWorkHourParentInp(e) {
    this.searchTimer(this.getWorkHourParentList, e);
  }

  // 获取工时大类列表
  workHourParentList:any[] = [];
  getWorkHourParentList(keyword?){
    let postData: any = {
      idx: 0,
      sum: 20,
      workHourManagement: {
        keyWords: keyword,
        treeLevel: 1,
        statisticalHosId: this.getHosId,
      },
    };
    this.isLoading = true;
    this.mainService.getFetchDataList("simple/data", "workHourManagement", postData).subscribe(result => {
      this.isLoading = false;
      if(result.status == 200){
        this.workHourParentList = result.list || [];
      }else{
        this.workHourParentList = [];
      }
    });
  }
  openChangeWorkHourParent(flag){
		this.validateForm.controls.workHourSmallId.setValue(null);
    flag && this.setIsSelecting(false);
    flag && this.getWorkHourParentList();
  }
	
	// =================工时小类===================
	
	// 工时小类搜索
	changeWorkHourSmallInp(e) {
	  this.searchTimer(this.getWorkHourSmallList, e);
	}
	
	// 获取工时小类列表
	workHourSmallList:any[] = [];
	getWorkHourSmallList(keyword?){
		if(!this.validateForm.value.workHourParentId){
		  this.isLoading = false;
		  this.workHourSmallList = [];
		  return;
		}
	  let postData: any = {
	    idx: 0,
	    sum: 20,
	    workHourManagement: {
	      keyWords: keyword,
	      treeLevel: 2,
				parent:{
					id: this.validateForm.value.workHourParentId
				},
				quoteOther:0,
	      statisticalHosId: this.getHosId,
	    },
	  };
	  this.isLoading = true;
	  this.mainService.getFetchDataList("simple/data", "workHourManagement", postData).subscribe(result => {
	    this.isLoading = false;
	    if(result.status == 200){
	      this.workHourSmallList = result.list || [];
	    }else{
	      this.workHourSmallList = [];
	    }
	  });
	}
	openChangeWorkHourSmall(flag){
	  flag && this.setIsSelecting(false);
	  flag && this.getWorkHourSmallList();
	}
	
	// =================评价===================
	
	// 获取评价列表 
	evaluateList:any[] = [];
	getWorkHourEvaluateList(){
		this.isLoading = true;
		this.mainService
		  .getDictionary("list", "incident_degree")
		  .subscribe((data) => {
		    this.isLoading = false;
		    this.evaluateList = data;
		  });
	}
	
	// =================申请人员===================
	
	// 申请人员搜索
	changerepairUserInp(e) {
	  this.searchTimer(this.getrepairUserList, e);
	}
	
	// 获取申请人员列表
	repairUserList:any[] = [];
	getrepairUserList(keyword = ''){
	  let postData: any = {
	    idx: 0,
	    sum: 20,
			user: {
			  name: keyword,
			  // engineer: 1,
			  // simpleQuery: true,
			},
	  };
	  this.isLoading = true;
	  this.mainService.getFetchDataList("simple/data", "user", postData).subscribe(result => {
	    this.isLoading = false;
	    if(result.status == 200){
	      this.repairUserList = result.list || [];
	    }else{
	      this.repairUserList = [];
	    }
	  });
	}
	openChangerepairUser(flag){
	  flag && this.setIsSelecting(false);
	  flag && this.getrepairUserList();
	}
	
	// =================耗材===================
	
	// 耗材搜索
	changeConsumableInp(e) {
	  this.searchTimer(this.getConsumableList, e);
	}
	
	// 获取耗材列表
	consumableList:any[] = [];
	getConsumableList(keyword = ''){
	  let data = {
	    idx: 0,
	    sum: 20,
	    consumable: {
				name: keyword,
	      quoteOther: 0,
	    },
	  };
	  this.isLoading = true;
	  this.mainService
	    .getFetchDataList("simple/data", "consumable", data)
	    .subscribe((data) => {
	      this.isLoading = false;
	      if (data.status == 200) {
	        this.consumableList = data.list || [];
	      }else{
					this.repairUserList = [];
				}
	    });
	}
	openChangeConsumable(flag){
	  flag && this.setIsSelecting(false);
	  flag && this.getConsumableList();
	}
}
