Browse Source

[修改]修改新建考题时的分数位置,完善新建二维预案

master
邵佳豪 4 years ago
parent
commit
2b376eb047
  1. 2
      src/app/examiner/create-test-score/addPlanTwo.html
  2. 2
      src/app/examiner/create-test-score/addPlanTwo.scss
  3. 30
      src/app/examiner/create-test-score/create-test-score.component.html
  4. 11
      src/app/examiner/create-test-score/create-test-score.component.scss
  5. 213
      src/app/examiner/create-test-score/create-test-score.component.ts
  6. 4
      src/app/navigation/navigation.component.scss
  7. 2
      src/app/navigation/navigation.component.ts
  8. 6
      src/app/tabbar/tabbar.component.html

2
src/app/examiner/create-test-score/addPlanTwo.html

@ -67,7 +67,7 @@
</div> </div>
</div> </div>
<div class="btnbox"> <div class="btnbox">
<div class="btn"> <div class="btn" (click)="confirm()">
确定 确定
</div> </div>
<div class="btn" (click)="close()"> <div class="btn" (click)="close()">

2
src/app/examiner/create-test-score/addPlanTwo.scss

@ -11,6 +11,7 @@
} }
.tablebox{ .tablebox{
width: 600px; width: 600px;
margin: 3px 0;
table{ table{
width: 100%; width: 100%;
} }
@ -18,6 +19,7 @@
.customPlanName{ .customPlanName{
input{ input{
width: 260px; width: 260px;
height: 36px;
border: 0; border: 0;
background-color: #F2F5F6; background-color: #F2F5F6;
box-sizing: border-box; box-sizing: border-box;

30
src/app/examiner/create-test-score/create-test-score.component.html

@ -46,7 +46,15 @@
<mat-expansion-panel-header collapsedHeight ='40px' expandedHeight='40px' style="position: relative;padding-left:20px;background: #F5FDFE;"> <mat-expansion-panel-header collapsedHeight ='40px' expandedHeight='40px' style="position: relative;padding-left:20px;background: #F5FDFE;">
<mat-panel-title> <mat-panel-title>
基本信息 基本信息
<span class="colorspan" style="margin-left: 20px;">{{unit.basicInfoScore ? unit.basicInfoScore : 0}}分</span> <!-- <span class="colorspan" style="margin-left: 20px;">{{unit.basicInfoScore ? unit.basicInfoScore : 0}}分</span> -->
<span style="margin-left: 20px;">
总分值: <input class="scoreInput" type="number" (click)="stopPropagation($event)"
[(ngModel)]="unit.basicInfoScore" (input)="sumScore('基本信息',key)"> 分,
单项
<span style="color: #FF8678;">
{{unit.basicInfoItemScore ? unit.basicInfoItemScore : 0}}
</span>
</span>
</mat-panel-title> </mat-panel-title>
</mat-expansion-panel-header> </mat-expansion-panel-header>
@ -66,11 +74,9 @@
</nz-tree> </nz-tree>
<ng-template #nzTreeTemplate let-node let-origin="origin"> <ng-template #nzTreeTemplate let-node let-origin="origin">
<div class="treeNodeTemplate"> <div class="treeNodeTemplate">
<label title="{{node.title}}" class="overflowText textNode">{{node.title}}</label> <label title="{{node.origin.name}}" class="overflowText textNode">{{node.origin.name}}</label>
<div class="scoreDiv" *ngIf="node.origin.zIndex == '0'"> <div class="scoreDiv" *ngIf="node.level == '0'">
<span class="colorspan lookitem">查看</span> <span class="colorspan lookitem">查看</span>
<span class="item">单项<input type="number" [(ngModel)]="node.origin.itemScore" (input)="itemScore(node,key)"></span>
<span class="item">总共<input type="number" [(ngModel)]="node.origin.sumScore" (input)="sumScore(node,key)"></span>
</div> </div>
</div> </div>
@ -84,7 +90,13 @@
<mat-expansion-panel-header collapsedHeight ='40px' expandedHeight='40px' style="position: relative;padding-left:20px;background: #F5FDFE;"> <mat-expansion-panel-header collapsedHeight ='40px' expandedHeight='40px' style="position: relative;padding-left:20px;background: #F5FDFE;">
<mat-panel-title> <mat-panel-title>
四周毗邻 四周毗邻
<span class="colorspan" style="margin-left: 20px;">{{unit.aroundScore ? unit.aroundScore : 0}}分</span> <span style="margin-left: 20px;">
总分值: <input class="scoreInput" type="number" (click)="stopPropagation($event)"
[(ngModel)]="unit.aroundScore" (input)="sumScore('四周毗邻',key)"> 分,
单项 <span style="color: #FF8678;">
{{unit.aroundItemScore ? unit.aroundItemScore : 0}}
</span>
</span>
</mat-panel-title> </mat-panel-title>
</mat-expansion-panel-header> </mat-expansion-panel-header>
@ -104,11 +116,9 @@
</nz-tree> </nz-tree>
<ng-template #nzTreeTemplate let-node let-origin="origin"> <ng-template #nzTreeTemplate let-node let-origin="origin">
<div class="treeNodeTemplate"> <div class="treeNodeTemplate">
<label title="{{node.title}}" class="overflowText textNode">{{node.title}}</label> <label title="{{node.origin.name}}" class="overflowText textNode">{{node.origin.name}}</label>
<div class="scoreDiv" *ngIf="node.origin.zIndex == '0'"> <div class="scoreDiv" *ngIf="node.level == '0'">
<span class="colorspan lookitem">查看</span> <span class="colorspan lookitem">查看</span>
<span class="item">单项<input type="number" [(ngModel)]="node.origin.itemScore" (input)="itemScore(node,key)"></span>
<span class="item">总共<input type="number" [(ngModel)]="node.origin.sumScore" (input)="sumScore(node,key)"></span>
</div> </div>
</div> </div>

11
src/app/examiner/create-test-score/create-test-score.component.scss

@ -98,14 +98,15 @@ table { text-align: center; border-collapse: collapse; padding:2px;}
overflow-y: auto; overflow-y: auto;
padding: 18px; padding: 18px;
.basicinfodiv{ .basicinfodiv{
.scoreInput{
text-align: center;
width: 60px;
color: #FF8678;
}
.treeNodeTemplate{ .treeNodeTemplate{
.scoreDiv{ .scoreDiv{
display: inline-block; display: inline-block;
input{
text-align: center;
width: 40px;
margin: 0 3px;
}
.lookitem{ .lookitem{
margin: 0 20px; margin: 0 20px;
} }

213
src/app/examiner/create-test-score/create-test-score.component.ts

@ -18,98 +18,91 @@ export class CreateTestScoreComponent implements OnInit {
ngOnInit(): void { ngOnInit(): void {
} }
//模拟预案数据
planDatas:any = [
{name:'5楼电路故障灾情扑救',or:'上海总队',time:'2020-09-24',isOpen:'未公开',level:'总队',scroe:0},
{name:'6楼电路故障灾情扑救',or:'上海总队',time:'2020-09-24',isOpen:'未公开',level:'总队',scroe:0},
{name:'7楼电路故障灾情扑救',or:'上海总队',time:'2020-09-24',isOpen:'未公开',level:'总队',scroe:0}
]
defaultCheckedKeys = []; //指定选中复选框的树节点 key值
defaultExpandedKeys = []; //展开指定的树节点 key值
defaultSelectedKeys = []; //指定选中的树节点 key值
examScore:any = 0//整个试卷的总分
//模拟单位数据 //模拟单位数据
unitDatas:any = [ unitDatas:any = [
{name:'富丽华大酒店1',score:0,basicInfoScore:0,basicInfoNodes : [ {name:'富丽华大酒店1',score:0,basicInfoScore:0,basicInfoItemScore:0,basicInfoNodes : [
{ {
title: '单位信息', name: '单位信息',
key: '0-0', key: '0-0',
type:'基本信息',
expanded: true, expanded: true,
zIndex : '0',
itemScore: 0,
sumScore: 0,
children: [ children: [
{title: '统一社会信用代码',key: '1',isLeaf:true}, {name: '统一社会信用代码',key: '1',isLeaf:true},
{title: '单位类型',key: '2',isLeaf:true}, {name: '单位类型',key: '2',isLeaf:true},
{title: '联系人',key: '3',isLeaf:true}, {name: '联系人',key: '3',isLeaf:true},
{title: '联系电话',key: '4',isLeaf:true}, {name: '联系电话',key: '4',isLeaf:true},
{title: '辖区中队',key: '5',isLeaf:true}, {name: '辖区中队',key: '5',isLeaf:true},
{title: '单位地址',key: '6',isLeaf:true} {name: '单位地址',key: '6',isLeaf:true}
] ]
}, },
{ {
title: '建筑信息', name: '建筑信息',
key: '0-1', key: '0-1',
type:'基本信息',
expanded: true, expanded: true,
zIndex : '0',
itemScore: 0,
sumScore: 0,
children: [ children: [
{ title: '面积', key: '0-1-0-0',isLeaf:true}, { name: '面积', key: '0-1-0-0',isLeaf:true},
{ title: '高度', key: '0-1-0-1',isLeaf:true}, { name: '高度', key: '0-1-0-1',isLeaf:true},
{ title: '层数', key: '0-1-0-2',isLeaf:true} { name: '层数', key: '0-1-0-2',isLeaf:true}
] ]
}, },
],aroundScore:0,aroundNodes :[ ],aroundScore:0,aroundItemScore:0,aroundNodes :[
{ {
title: '单位四周毗邻', name: '单位四周毗邻',
key: '11', key: '11',
expanded: true, expanded: true,
zIndex : '0', type:'四周毗邻',
itemScore: 0,
sumScore: 0,
children: [ children: [
{title: '东方向',key: '55',isLeaf:true}, {name: '东方向',key: '55',isLeaf:true},
] ]
}, },
{ {
title: '建筑四周毗邻', name: '建筑四周毗邻',
key: '22', key: '22',
expanded: true, expanded: true,
zIndex : '0', type:'四周毗邻',
itemScore: 0,
sumScore: 0,
children: [ children: [
{title: '东方向',key: '55',isLeaf:true}, {name: '东方向',key: '55',isLeaf:true},
] ]
}, },
]}, ]},
{name:'富丽华大酒店2',score:0,basicInfoScore:0} // {name:'富丽华大酒店2',score:0,basicInfoScore:0}
] ]
unitId:any = [{name:'富丽华大酒店1'}]
//获取单位数据
getUnitData(){
}
calculateScore(key){//计算分数
//key代表第几个建筑
//计算当前建筑基本信息分数
var basicInfoScore = 0
this.unitDatas[key].basicInfoNodes.forEach(element => {
basicInfoScore += Number(element.sumScore)
})
this.unitDatas[key].basicInfoScore = basicInfoScore
//计算当前建筑四周毗邻分数
var aroundScore = 0
this.unitDatas[key].aroundNodes.forEach(element => {
aroundScore += Number(element.sumScore)
})
this.unitDatas[key].aroundScore = aroundScore
//阻止input事件冒泡
stopPropagation($event){
console.log($event)
$event.stopPropagation()
}
//模拟预案数据
planDatas:any = [
{name:'5楼电路故障灾情扑救',or:'上海总队',time:'2020-09-24',isOpen:'未公开',level:'总队',scroe:0},
{name:'6楼电路故障灾情扑救',or:'上海总队',time:'2020-09-24',isOpen:'未公开',level:'总队',scroe:0},
{name:'7楼电路故障灾情扑救',or:'上海总队',time:'2020-09-24',isOpen:'未公开',level:'总队',scroe:0}
]
defaultCheckedKeys = []; //指定选中复选框的树节点 key值
defaultExpandedKeys = []; //展开指定的树节点 key值
defaultSelectedKeys = []; //指定选中的树节点 key值
examScore:any = 0//整个试卷的总分
//计算分数
calculateScore(key){
//key代表第几个建筑
//计算整个单位的总分 //计算整个单位的总分
var unitScore = 0
this.unitDatas[key].score = basicInfoScore + aroundScore + 0 this.unitDatas[key].score = this.unitDatas[key].basicInfoScore + this.unitDatas[key].aroundScore
//计算整个试卷的总分 //计算整个试卷的总分
let examScore = 0 let examScore = 0
@ -121,51 +114,67 @@ export class CreateTestScoreComponent implements OnInit {
//tree的选择事件 //tree的选择事件
nzEvent(event: NzFormatEmitEvent,key): void { nzEvent(event: NzFormatEmitEvent,key): void {
if(event.node.level == 0){//如果点击第一层
let itemTrue = [] if(event.node.origin.type == '基本信息' || (event.node.parentNode && event.node.parentNode.origin.type == '基本信息')){
event.node.origin.children.forEach(item => { let selectedNum = []
if(item.checked){ this.unitDatas[key].basicInfoNodes.forEach(item => {
itemTrue.push(item) item.children.forEach(i => {
i.checked ? selectedNum.push(i) : ''
})
})
if(selectedNum.length != 0 ){
this.unitDatas[key].basicInfoScore ? this.unitDatas[key].basicInfoItemScore = this.unitDatas[key].basicInfoScore / selectedNum.length : null
}else{
this.unitDatas[key].basicInfoItemScore = 0
} }
}) }
event.node.origin.sumScore = event.node.origin.itemScore * itemTrue.length if(event.node.origin.type == '四周毗邻' || (event.node.parentNode && event.node.parentNode.origin.type == '四周毗邻')){
let selectedNum = []
this.calculateScore(key)//更新标题栏分数 this.unitDatas[key].aroundNodes.forEach(item => {
item.children.forEach(i => {
}else{ i.checked ? selectedNum.push(i) : ''
let itemTrue = [] })
event.node.parentNode.origin.children.forEach(item => { })
if(item.checked){ console.log(7894,selectedNum)
itemTrue.push(item) if(selectedNum.length != 0 ){
this.unitDatas[key].aroundScore ? this.unitDatas[key].aroundItemScore = this.unitDatas[key].aroundScore / selectedNum.length : null
}else{
this.unitDatas[key].aroundItemScore = 0
} }
}) }
event.node.parentNode.origin.sumScore = event.node.parentNode.origin.itemScore * itemTrue.length
this.calculateScore(key)//更新标题栏分数
}
} }
//每项分数动态计算 //单位各项总分数动态计算
itemScore(node,key){ sumScore(type,key){
let itemTrue = [] //key代表第几个建筑 type代表哪个部分
node.origin.children.forEach(item => { if(type == '基本信息'){
if(item.checked){ let selectedNum = 0
itemTrue.push(item) this.unitDatas[key].basicInfoNodes.forEach(item => {
item.children.forEach(i => {
i.checked ? selectedNum++ : ''
})
})
if(selectedNum != 0){
this.unitDatas[key].basicInfoItemScore = this.unitDatas[key].basicInfoScore / selectedNum
}else{
this.unitDatas[key].basicInfoItemScore = 0
} }
})
node.origin.sumScore = node.origin.itemScore * itemTrue.length }
this.calculateScore(key)//更新标题栏分数 if(type == '四周毗邻'){
} let selectedNum = 0
//总分数动态计算 this.unitDatas[key].aroundNodes.forEach(item => {
sumScore(node,key){ item.children.forEach(i => {
//key代表第几个建筑 i.checked ? selectedNum++ : ''
let itemTrue = [] })
node.origin.children.forEach(item => { })
if(item.checked){ if(selectedNum != 0){
itemTrue.push(item) this.unitDatas[key].aroundItemScore = this.unitDatas[key].aroundScore / selectedNum
}else{
this.unitDatas[key].aroundItemScore = 0
} }
})
node.origin.itemScore = node.origin.sumScore / itemTrue.length }
this.calculateScore(key)//更新标题栏分数 this.calculateScore(key)//更新标题栏分数
} }
@ -258,7 +267,15 @@ export class AddPlanTwoDialog {
onNoClick(): void { onNoClick(): void {
this.dialogRef.close(); this.dialogRef.close();
} }
//确定
confirm(){
if(this.planType == 1){
console.log(this.selection)
}else{
}
}
//取消
close(){ close(){
this.dialogRef.close(); this.dialogRef.close();
} }

4
src/app/navigation/navigation.component.scss

@ -9,7 +9,6 @@ mat-accordion{
mat-sidenav{ mat-sidenav{
box-shadow: 2px 0px 5px #888888; box-shadow: 2px 0px 5px #888888;
color: white; color: white;
//background: url(../../assets/images/main_bg.png) 100% 100%;
background-color: #07CDCF; background-color: #07CDCF;
width: 216px; width: 216px;
overflow-x: hidden; overflow-x: hidden;
@ -34,9 +33,6 @@ mat-sidenav{
text-overflow:ellipsis; text-overflow:ellipsis;
white-space: nowrap; white-space: nowrap;
} }
li:hover{
background-color: #5d9cf2;
}
} }
} }

2
src/app/navigation/navigation.component.ts

@ -21,7 +21,7 @@ export class NavigationComponent implements OnInit {
allDataBank:any //所有的资料库 allDataBank:any //所有的资料库
selectedDataBank:any //当前选中的资料库 selectedDataBank:any //当前选中的资料库
hoverDataBank:any //当前鼠标移入的资料库 hoverDataBank:any//当前鼠标移入的资料库
isOneClick:boolean //是否第一次进入网页 isOneClick:boolean //是否第一次进入网页
leftMenuname="" leftMenuname=""

6
src/app/tabbar/tabbar.component.html

@ -13,10 +13,10 @@
<!-- 已登录状态 --> <!-- 已登录状态 -->
<button mat-icon-button class="login"> <!-- <button mat-icon-button class="login">
<mat-icon>account_circle</mat-icon> <mat-icon>account_circle</mat-icon>
</button> </button> -->
<span style="position: absolute;right:80px;color: #1E2323;font-size: 16px;">用户名:{{realName}}<mat-icon [matMenuTriggerFor]="appMenu" style="color: #1E2323;position: relative;top: 8px;cursor: pointer;">keyboard_arrow_down</mat-icon></span> <span style="position: absolute;right:80px;color: #1E2323;font-size: 16px;">{{realName}}<mat-icon [matMenuTriggerFor]="appMenu" style="color: #1E2323;position: relative;top: 8px;cursor: pointer;">keyboard_arrow_down</mat-icon></span>
<mat-menu #appMenu="matMenu"> <mat-menu #appMenu="matMenu">
<!-- <button mat-menu-item (click)='changeUserData()'> <!-- <button mat-menu-item (click)='changeUserData()'>
<mat-icon>perm_identity</mat-icon> <mat-icon>perm_identity</mat-icon>

Loading…
Cancel
Save