123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- import {Component, OnInit} from '@angular/core';
- import {ActivatedRoute, Router} from "@angular/router";
- import {ConfigService, RequsetData} from "../../../service/config.service";
- import {AlertController, MenuController, ModalController} from "@ionic/angular";
- @Component({
- selector: 'app-examtest',
- templateUrl: './examtest.component.html',
- styleUrls: ['./examtest.component.scss'],
- })
- export class ExamtestComponent implements OnInit {
- getDataUrl = '/api/exammanage/questiontypeSetting/getList';
- getLibaryUrl = '/api/exampaper/getLibaryTree';
- questionTypeList: any = [];
- fileTypeData: any = {
- title: '所有题库',
- pSelectedName: '所有题库',
- rootKids: [],
- selectedNode: null,
- selectedParent: null,
- fileTypeName: ''
- };
- libaryTree = [];
- typeList: any[] = [];
- selectLibaryList = [];
- bakLibaryList=[];
- constructor(private menu: MenuController, private router: Router, private configService: ConfigService, private routeInfo: ActivatedRoute) {
- }
- ngOnInit() {
- this.routeInfo.queryParams.subscribe(params => {
- this.getQuestionTypeList();
- this.getLibaryTree();
- });
- }
- getQuestionTypeList() {
- this.configService.HttpGetRomote(this.getDataUrl, {}).subscribe((data: RequsetData) => {
- if (data.success) {
- this.questionTypeList = data.item;
- }
- });
- }
- getLibaryTree() {
- this.configService.HttpGetRomote(this.getLibaryUrl, {}).subscribe((data: RequsetData) => {
- if (data.success) {
- this.libaryTree = data.item;
- this.typeList = data.item;
- }
- });
- }
- selectFileType() {
- this.menu.enable(true, 'typeRoot').then(a => {
- });
- this.menu.open('typeRoot').then(a => {
- });
- }
- BackMenu() {
- if (this.fileTypeData.selectedNode.parentList != null) {
- this.typeList = this.fileTypeData.selectedNode.parentList;
- this.fileTypeData.selectedNode = this.fileTypeData.selectedNode.parentNode;
- }
- if (this.fileTypeData.selectedNode == null) {
- this.fileTypeData.pSelectedName = '所有题库';
- }
- }
- selectedTitle() {
- let result = false;
- if (this.fileTypeData.selectedNode == null) {
- result = true;
- } else {
- if (this.fileTypeData.selectedParent != null) {
- result = this.fileTypeData.selectedNode.filetypeid == this.fileTypeData.selectedParent.filetypeid;
- }
- }
- return result;
- }
- SelectTitleFileType() {
- this.fileTypeData.selectedNode = this.fileTypeData.selectedParent;
- }
- selectedItem(it: any) {
- let result = false;
- if (this.fileTypeData.selectedNode != null) {
- result = this.fileTypeData.selectedNode.id == it.id;
- }
- return result;
- }
- ShowKidsFileType(it: any) {
- if (it.childList == 0) {
- return true;
- }
- it.parentNode = this.fileTypeData.selectedNode;
- this.fileTypeData.selectedNode = it;
- this.fileTypeData.pSelectedName = it.name;
- it.parentList = this.typeList;
- this.typeList = it.childList;
- }
- chooseFileType() {
- this.selectLibaryList = this.bakLibaryList;//Object.assign({}, this.bakLibaryList);
- this.CloseMenu();
- }
- CloseMenu() {
- this.menu.close('typeRoot').then(a => {
- });
- }
- checkedChange(it, checked) {
- it.checked = checked;
- this.bakLibaryList = this.bakLibaryList.filter(x => x.id != it.id);
- if (checked) {
- this.bakLibaryList.push({id: it.id, name: it.name});
- }
- }
- eachLibaryTree(treeList: any[]) {
- treeList.forEach((item: any) => {
- if (item.checked) {
- this.selectLibaryList.push({id: item.id, name: item.name});
- }
- if (item.childList.length > 0) {
- this.eachLibaryTree(item.childList);
- }
- })
- }
- entryTest() {
- }
- }
|