import { Component, OnInit } from '@angular/core'; import { MsgHelper, RhStorageService } from 'rh-base/core'; import { DevProfileSettingQueryDto, RhSafeAny } from 'rh-base/model'; import { RhBaseDynamicService } from 'rh-base/shared'; @Component({ selector: 'rh-all-dynamic-configuration', templateUrl: './all-dynamic-configuration.component.html', styleUrls: ['./all-dynamic-configuration.component.less'] }) export class RhAllDynamicConfigurationComponent implements OnInit { list: RhSafeAny[] = []; tableList: RhSafeAny[] = []; formList: RhSafeAny[] = []; descriptionList: RhSafeAny[] = []; query = DevProfileSettingQueryDto.create(); featureCode = ''; url = ''; name = ''; isShowDrawer = false; objectJson: any; constructor(private operater: RhBaseDynamicService, private store: RhStorageService) {} ngOnInit(): void { this.query.FactoryCode = this.store.getFactoryCode(); } getDatas() { this.query.Mode = 8; const { MenuCode } = this.query; const [tableList, formList, descriptionList, list] = [[] as RhSafeAny[], [] as RhSafeAny[], [] as RhSafeAny[], [] as RhSafeAny[]]; if (!MenuCode) { MsgHelper.ShowErrorMessage('url地址必录'); return; } this.operater.GetDevProfileSettingDatas(this.query).subscribe((res) => { if (res.Success) { res.Attach.forEach((item) => { delete item.Value; switch (item.FeatureType) { case 'table': tableList.push(item); break; case 'form': formList.push(item); break; case 'description': descriptionList.push(item); break; } }); this.tableList = tableList; this.formList = formList; this.descriptionList = descriptionList; this.list = res.Attach; } else { MsgHelper.ShowErrorMessage(res.Message); this.list = list; this.tableList = tableList; this.formList = formList; this.descriptionList = descriptionList; } }); } // 打开json配置 getJson(value: any) { // if (typeof value === 'string') { // value = JSON.parse(value); // } // this.objectJson = value ? value : {}; // this.isShowDrawer = true; } closeDrawer() { this.isShowDrawer = false; } }