import {Component, OnInit, EventEmitter} from '@angular/core'; import {DialogRef, ModalComponent, CloseGuard} from 'ngx-modialog'; import {BSModalContext} from 'ngx-modialog/plugins/bootstrap'; import UtilService from "@common/services/util/index"; import ModuleService from "@common/modules/manage/services/module"; import StorageService from "@common/services/storage"; declare var $: any; export class SelectTargetModuleContext extends BSModalContext { constructor(private args:any={}) { super(); /* * 点击背景是否隐藏模态框 * @value true 不隐藏 * @value false 隐藏 * */ this.isBlocking = true; /* * 模态框位置 * @value modal-top 居顶 * */ this.dialogClass = 'modal-dialog'; } } @Component({ selector: 'selectTargetModule', templateUrl: './template.html', styleUrls: ['./style.less'] }) export default class SelectTargetModule implements OnInit, ModalComponent { data: any = {}; otherData: any = {}; context: any = {}; list: any = []; constructor(public dialog: DialogRef, private moduleService: ModuleService, private storageService: StorageService, private utilService: UtilService) { this.context = dialog.context; } ngOnInit(): void { this.moduleService.getList().then((data: any) => { this.list = data.result; }); if (this.storageService.get('module')) { this.data.module = this.storageService.get('module'); } } submit() { this.otherData.loading = true; this.storageService.set('module', this.data.module); this.context.args.callback(); this.dialog.close(); } }