|
|
|
import { Component, OnInit, Inject } 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';
|
|
|
|
|
|
|
|
@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) {}
|
|
|
|
// 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)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@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)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|