|
|
|
import { Component, OnInit, Inject, ViewChild } from '@angular/core';
|
|
|
|
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
|
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
|
|
|
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
|
|
|
|
import {CanvasShareDataService,DisposalNodeData} from '../../canvas-share-data.service' //引入服务
|
|
|
|
import { FlatTreeControl } from '@angular/cdk/tree';
|
|
|
|
import { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree';
|
|
|
|
import { NzFormatBeforeDropEvent, NzFormatEmitEvent,NzTreeComponent } from 'ng-zorro-antd/tree';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'dialog-examination-questions',
|
|
|
|
templateUrl: './examinationQuestions.html',
|
|
|
|
styleUrls: ['./collection-tools.component.scss',]
|
|
|
|
})
|
|
|
|
export class examinationQuestions {
|
|
|
|
|
|
|
|
constructor(private http:HttpClient, public dialog: MatDialog, public snackBar: MatSnackBar, public dialogRef: MatDialogRef<any>,
|
|
|
|
@Inject(MAT_DIALOG_DATA) public data) {}
|
|
|
|
|
|
|
|
defaultCheckedKeys = []; //指定选中复选框的树节点 key值
|
|
|
|
defaultExpandedKeys = []; //展开指定的树节点 key值
|
|
|
|
defaultSelectedKeys = []; //指定选中的树节点 key值
|
|
|
|
ngOnInit(): void {
|
|
|
|
console.log(this.data.treeData)
|
|
|
|
}
|
|
|
|
nzEvent($event){
|
|
|
|
|
|
|
|
}
|
|
|
|
//提交
|
|
|
|
submit () {
|
|
|
|
console.log(this.data)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'dialog-upload-questions',
|
|
|
|
templateUrl: './uploadQuestions.html',
|
|
|
|
styleUrls: ['./collection-tools.component.scss',]
|
|
|
|
})
|
|
|
|
export class uploadQuestions {
|
|
|
|
|
|
|
|
constructor(private http:HttpClient, public dialog: MatDialog, public snackBar: MatSnackBar, public dialogRef: MatDialogRef<any>,
|
|
|
|
@Inject(MAT_DIALOG_DATA) public data) {}
|
|
|
|
// tree配置
|
|
|
|
private _transformer = (node, level: number) => {//要给渲染节点传那些属性参数
|
|
|
|
return {
|
|
|
|
expandable: !!node.children && node.children.length > 0,
|
|
|
|
name: node.name || node.Name,
|
|
|
|
level: level,
|
|
|
|
id: node.id || node.Id,
|
|
|
|
children:node.children,
|
|
|
|
isTemplate:node.isTemplate,
|
|
|
|
isNewElement:node.isNewElement,
|
|
|
|
isLook:node.isLook,
|
|
|
|
isLookPattern:node.isLookPattern || null
|
|
|
|
};
|
|
|
|
}
|
|
|
|
treeControl = new FlatTreeControl<any>(node => node.level, node => node.expandable);
|
|
|
|
treeFlattener = new MatTreeFlattener(this._transformer, node => node.level, node => node.expandable, node => node.children);
|
|
|
|
dataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener);
|
|
|
|
hasChild = (_: number, node: any) => node.expandable;
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
|
this.dataSource.data = this.data.treeData
|
|
|
|
this.treeControl.expandAll()
|
|
|
|
}
|
|
|
|
|
|
|
|
//上传
|
|
|
|
submit () {
|
|
|
|
console.log(this.data.question)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'dialog-disposal-nodes',
|
|
|
|
templateUrl: './uploadDisposalNodes.html',
|
|
|
|
styleUrls: ['./collection-tools.component.scss',]
|
|
|
|
})
|
|
|
|
export class uploadDisposalNodes {
|
|
|
|
|
|
|
|
constructor(private http:HttpClient, public dialog: MatDialog, public snackBar: MatSnackBar, public dialogRef: MatDialogRef<any>,
|
|
|
|
@Inject(MAT_DIALOG_DATA) public data) {}
|
|
|
|
@ViewChild('nzTreeComponent', { static: false }) nzTreeComponent!: NzTreeComponent;
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
|
this.treeData = [...this.data.treeData]
|
|
|
|
}
|
|
|
|
treeData:any = []; //tree
|
|
|
|
|
|
|
|
//提交 保存考试节点
|
|
|
|
submit () {
|
|
|
|
let checkList = []
|
|
|
|
this.data.oldTreeData.forEach(element => {
|
|
|
|
let isChecked = (this.nzTreeComponent.getTreeNodeByKey(element.id)).isChecked
|
|
|
|
isChecked? checkList.push(element) : null
|
|
|
|
});
|
|
|
|
console.log(checkList)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|