Browse Source

[完善]处置节点默认选中

智慧矿山应急安全培训、考核、演练管理系统
邵佳豪 2 years ago
parent
commit
65b74a0b7f
  1. 8
      src/app/ui/collection-tools/examinationQuestions.ts
  2. 3
      src/app/ui/collection-tools/uploadDisposalNodes.html

8
src/app/ui/collection-tools/examinationQuestions.ts

@ -392,9 +392,15 @@ export class uploadDisposalNodes {
) {}
@ViewChild("nzTreeComponent", { static: false })
nzTreeComponent!: NzTreeComponent;
defaultCheckedKeys = [];
ngOnInit(): void {
this.treeData = [...this.data.treeData];
let checkedArr = [];
// console.log(666, JSON.parse(sessionStorage.getItem("examNodeList")));
JSON.parse(sessionStorage.getItem("examNodeList")).forEach((element) => {
checkedArr.push(element.id);
});
this.defaultCheckedKeys = [...checkedArr];
}
treeData: any = []; //tree

3
src/app/ui/collection-tools/uploadDisposalNodes.html

@ -1,7 +1,8 @@
<div id="disposalNodeTree">
<div
style="max-height: 500px;overflow-x: hidden;overflow-y: auto;margin-bottom: 25px;width: 330px;padding-right: 10px;">
<nz-tree #nzTreeComponent [nzData]="treeData" nzCheckable nzMultiple [nzTreeTemplate]="nzTreeTemplate"></nz-tree>
<nz-tree #nzTreeComponent [nzData]="treeData" nzCheckable nzMultiple [nzTreeTemplate]="nzTreeTemplate"
[nzCheckedKeys]="defaultCheckedKeys"></nz-tree>
<ng-template #nzTreeTemplate let-node let-origin="origin">
<div id="terrNodePublic">
<label title="{{node.title}}" class="overflowText textNode">{{node.title}}</label>

Loading…
Cancel
Save