Merge branch 'develop' of https://gitlab.eascs.com/tms-ui/tms-obc-web into develop
This commit is contained in:
		@ -1,3 +1,3 @@
 | 
			
		||||
<app-dynamic-setting-h5 [tabs]="tabs" [configList]="configList" [selectedTab]="selectedTab"
 | 
			
		||||
    (selectedEvent)="getConfigList($event?.id)" (saveEvent)="saveAction($event)">
 | 
			
		||||
    (selectedEvent)="getConfigList($event)" (saveEvent)="saveAction($event)">
 | 
			
		||||
</app-dynamic-setting-h5>
 | 
			
		||||
@ -13,7 +13,6 @@ export class BasicSettingComponent implements OnInit {
 | 
			
		||||
  selectedTab: any = null;
 | 
			
		||||
 | 
			
		||||
  configList: any = [];
 | 
			
		||||
 | 
			
		||||
  constructor(public service: SystemService) {}
 | 
			
		||||
 | 
			
		||||
  ngOnInit() {
 | 
			
		||||
@ -27,21 +26,24 @@ export class BasicSettingComponent implements OnInit {
 | 
			
		||||
        if (typeData) {
 | 
			
		||||
          this.tabs = typeData.children;
 | 
			
		||||
          this.selectedTab = typeData.children[0];
 | 
			
		||||
          this.getConfigList(this.selectedTab.id);
 | 
			
		||||
          this.getConfigList(this.selectedTab);
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getConfigList(id: string) {
 | 
			
		||||
    this.service.request(this.service.$api_get_config_by_parent_id, { id }).subscribe((res: Array<any>) => {
 | 
			
		||||
  getConfigList(selectedTab: any) {
 | 
			
		||||
    this.selectedTab = selectedTab;
 | 
			
		||||
    this.service.request(this.service.$api_get_config_by_parent_id, { id: selectedTab.id }).subscribe((res: Array<any>) => {
 | 
			
		||||
      if (res?.length > 0) {
 | 
			
		||||
        res = res.map(item => ({
 | 
			
		||||
          ...item,
 | 
			
		||||
          remark: item.remark ? JSON.parse(item.remark) : null,
 | 
			
		||||
          extend: item.extend ? JSON.parse(item.extend) : [],
 | 
			
		||||
          itemValue: item.itemValue ? JSON.parse(item.itemValue) : item.itemValue
 | 
			
		||||
          itemValue: item.itemValue ? JSON.parse(item.itemValue) : item.itemValue,
 | 
			
		||||
          itemData: item.itemData ? JSON.parse(item.itemData) : item.itemData
 | 
			
		||||
        }));
 | 
			
		||||
        console.log(res);
 | 
			
		||||
        
 | 
			
		||||
        this.configList = res;
 | 
			
		||||
      } else {
 | 
			
		||||
        this.configList = [];
 | 
			
		||||
@ -49,17 +51,16 @@ export class BasicSettingComponent implements OnInit {
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  changeType(type: any): void {
 | 
			
		||||
    this.selectedTab = type;
 | 
			
		||||
    this.getConfigList(this.selectedTab.id);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  saveAction(params: any) {
 | 
			
		||||
    this.service.request(this.service.$api_update_config_batch, params).subscribe(res => {
 | 
			
		||||
      if (res) {
 | 
			
		||||
        this.service.msgSrv.success('修改配置成功');
 | 
			
		||||
        this.getConfigList(this.selectedTab.id);
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
    console.log(params);
 | 
			
		||||
    
 | 
			
		||||
    // this.service.request(this.service.$api_update_config_batch, params).subscribe(res => {
 | 
			
		||||
    //   if (res) {
 | 
			
		||||
    //     this.service.msgSrv.success('修改配置成功');
 | 
			
		||||
    //     setTimeout(() => {
 | 
			
		||||
    //       this.getConfigList(this.selectedTab);
 | 
			
		||||
    //     }, 100);
 | 
			
		||||
    //   }
 | 
			
		||||
    // });
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user