diff --git a/src/app/examiner/create-test-score/create-test-score.component.html b/src/app/examiner/create-test-score/create-test-score.component.html
index 702d53f..b5d129d 100644
--- a/src/app/examiner/create-test-score/create-test-score.component.html
+++ b/src/app/examiner/create-test-score/create-test-score.component.html
@@ -126,6 +126,132 @@
+
+
+
+
+
+ 重点部位
+
+ 总分值: 分,
+ 单项
+ {{unit.keySiteItemScore ? unit.keySiteItemScore : 0}}
+ 分
+
+
+
+
+
+
+
+
+
+
+
+ 查看
+
+
+
+
+
+
+
+
+
+
+
+
+ 功能分区
+
+ 总分值: 分,
+ 单项
+ {{unit.funDivItemScore ? unit.funDivItemScore : 0}}
+ 分
+
+
+
+
+
+
+
+
+
+
+
+ 查看
+
+
+
+
+
+
+
+
+
+
+
+
+ 数据核验
+
+ 总分值: 分,
+ 单项
+ {{unit.fireFacItemScore ? unit.fireFacItemScore : 0}}
+ 分
+
+
+
+
+
+
+
+
+
+
+
+ 查看
+
+
+
+
+
+
+
diff --git a/src/app/examiner/create-test-score/create-test-score.component.ts b/src/app/examiner/create-test-score/create-test-score.component.ts
index 510cceb..50830ad 100644
--- a/src/app/examiner/create-test-score/create-test-score.component.ts
+++ b/src/app/examiner/create-test-score/create-test-score.component.ts
@@ -19,6 +19,9 @@ export class CreateTestScoreComponent implements OnInit {
ngOnInit(): void {
this.getUnitData()
this.getAround()
+ this.getKeySite()
+ this.getFunDiv()
+ this.getFireFac()
}
//模拟单位数据
@@ -72,18 +75,13 @@ export class CreateTestScoreComponent implements OnInit {
// {name:'富丽华大酒店2',score:0,basicInfoScore:0}
]
-
//上个页面传过来的单位数据
unitId:any = [{name:'最最最最最',id:'5fb76c42919f2b44e464016f'},
{name:'华南城集团有限公司',id:'5ee19fe06f91049f5e23e937'},
{name:'贵港油库',id:'5fa35d68f8eb762cb03c662e'}
]
-
-
-
-
- //获取单位数据
+ //获取单位基本信息
getUnitData(){
this.unitId.forEach((element,index) => {
element.score = 0
@@ -235,7 +233,8 @@ export class CreateTestScoreComponent implements OnInit {
item.direction == 5 ? item.title = '西南方向' : null
item.direction == 6 ? item.title = '东北方向' : null
item.direction == 7 ? item.title = '西北方向' : null
- item.isLeaf = true
+ item.isLeaf = true,
+ item.key = item.id
})
//如果存在单位毗邻
if(data.length != 0){
@@ -258,9 +257,9 @@ export class CreateTestScoreComponent implements OnInit {
}
})
let that = this
- async function getAllArchitecture(buildongsdata){
- for (let i = 0, length = buildongsdata.length; i < length; i++){
- let id = {buildingId:buildongsdata[i].id}
+ async function getAllArchitecture(buildingsdata){
+ for (let i = 0, length = buildingsdata.length; i < length; i++){
+ let id = {buildingId:buildingsdata[i].id}
let result = await new Promise((resolve, reject) => {
that.http.get('/api/BuildingAdjoins',{params:id}).subscribe((data:any)=>{
data.forEach(item => {
@@ -273,10 +272,11 @@ export class CreateTestScoreComponent implements OnInit {
item.direction == 6 ? item.title = '东北方向' : null
item.direction == 7 ? item.title = '西北方向' : null
item.isLeaf = true
+ item.key = item.id
})
if(data.length != 0){
that.unitId[index].aroundNodes.push({
- name: buildongsdata[i].name,
+ name: buildingsdata[i].name,
key: (Math.random()*10000000).toString(16).substr(0,4)+(new Date()).getTime()+Math.random().toString().substr(2,5),
expanded: false,
type:'四周毗邻',
@@ -292,33 +292,248 @@ export class CreateTestScoreComponent implements OnInit {
}
})
}
+ //获取重点部位
+ getKeySite(){
+ let that = this
+ this.unitId.forEach((element,index) =>{
+ element.keySiteScore = 0
+ element.keySiteItemScore = 0
+ element.keySiteNodes = []
+ //获得单位重点部位
+ let id = {companyId:element.id}
+ this.http.get('/api/CompanyImportantLocations',{params:id}).subscribe((data:any)=>{
+ //如果存在单位毗邻
+ let newData = []
+ data.forEach(item => {
+ item.isLeaf = true
+ item.key = item.id
+ item.name ? newData.push(item) : null
+ })
+ if(data.length != 0){
+ this.unitId[index].keySiteNodes.push({
+ name: '单位重点部位',
+ key: (Math.random()*10000000).toString(16).substr(0,4)+(new Date()).getTime()+Math.random().toString().substr(2,5),
+ expanded: false,
+ type:'重点部位',
+ children: newData
+ })
+ element.keySiteNodes = [...element.keySiteNodes]
+ }})
+
+ //获得建筑重点部位
+ this.http.get('/api/Buildings',{params:id}).subscribe((data:any)=>{
+ if (data.length) {
+ getAllBuildingPositon(data)
+ }
+ })
+ //获取当前单位所有建筑重点部位
+ async function getAllBuildingPositon (buildingsdata) {
+ for (let i = 0, length = buildingsdata.length; i < length; i++){
+ let id = {buildingId:buildingsdata[i].id}
+ let result = await new Promise((resolve, reject) =>{
+ that.http.get('/api/BuildingImportantLocations',{params:id}).subscribe((data:any)=>{
+ let newData = []
+ data.forEach(item => {
+ item.isLeaf = true
+ item.key = item.id
+ item.name ? newData.push(item) : null
+ })
+ if(newData.length != 0){
+ that.unitId[index].keySiteNodes.push({
+ name: buildingsdata[i].name,
+ key: (Math.random()*10000000).toString(16).substr(0,4)+(new Date()).getTime()+Math.random().toString().substr(2,5),
+ expanded: false,
+ type:'重点部位',
+ children: newData
+ })
+ element.keySiteNodes = [...element.keySiteNodes]
+ }
+ resolve('2')
+ })
+ })
+
+ }
+ }
+ })
+ //获取单位重点部位
+
+
+ }
+ //获取功能分区
+ getFunDiv(){
+ let that = this
+ this.unitId.forEach((element,index) =>{
+ element.funDivScore = 0
+ element.funDivItemScore = 0
+ element.funDivNodes = []
+ let id = {companyId:element.id}
+ //单位功能分区
+ this.http.get('/api/CompanyFunctionalDivisions',{params:id}).subscribe((data:any)=>{
+ //如果存在单位的单位功能分区
+ let newData = []
+ data.forEach(item => {
+ item.isLeaf = true
+ item.key = item.id
+ item.region ? newData.push(item) : null
+ })
+ if(data.length != 0){
+ this.unitId[index].funDivNodes.push({
+ name: '单位功能分区',
+ key: (Math.random()*10000000).toString(16).substr(0,4)+(new Date()).getTime()+Math.random().toString().substr(2,5),
+ expanded: false,
+ type:'功能分区',
+ children: newData
+ })
+ element.funDivNodes = [...element.funDivNodes]
+ }
+ })
+
+ //建筑功能分区
+ this.http.get('/api/Buildings',{params:id}).subscribe((data:any)=>{
+ if (data.length) {
+ getAllBuildingFunDiv(data)
+ }
+ })
+ //获取当前单位所有建筑功能分区
+ async function getAllBuildingFunDiv (buildingsdata) {
+ for (let i = 0, length = buildingsdata.length; i < length; i++){
+ let id = {buildingId:buildingsdata[i].id}
+ let result = await new Promise((resolve, reject) =>{
+ that.http.get('/api/BuildingFunctionalDivisions',{params:id}).subscribe((data:any)=>{
+ let newData = []
+ data.forEach(item => {
+ item.isLeaf = true
+ item.key = item.id
+ item.region ? newData.push(item) : null
+
+ })
+ if(newData.length != 0){
+ that.unitId[index].funDivNodes.push({
+ name: buildingsdata[i].name,
+ key: (Math.random()*10000000).toString(16).substr(0,4)+(new Date()).getTime()+Math.random().toString().substr(2,5),
+ expanded: false,
+ type:'功能分区',
+ children: newData
+ })
+ element.funDivNodes = [...element.funDivNodes]
+ }
+ resolve('2')
+ })
+ })
+
+ }
+ }
+
+ })
+ }
+ //获取消防设施
+ getFireFac(){
+ let that = this
+ this.unitId.forEach((element,index) =>{
+ element.fireFacScore = 0
+ element.fireFacItemScore = 0
+ element.fireFacNodes = []
+ let companyId = element.id
+ //获取单位级别消防设施
+ this.http.get(`/api/Companies/${companyId}`).subscribe((data:any)=>{
+ if (data.buildingTypes.length) {
+ let newData = {buildingType: data.buildingTypes[0].id,companyId : companyId}
+ this.http.get('/api/CompanyFacilities',{params:newData}).subscribe((data:any)=>{ //获得单位的消防设施
+
+ data[0].summary.companyFacilityGroups.forEach(element => { //循环单位内置分组项
+ element.facilityItems.forEach((elements,index) => {
+ elements.total = element.facilityCount[index]
+ });
+ });
+ let newData = []
+ data[0].summary.companyFacilityGroups.forEach(item => {
+ item.facilityItems.forEach(i => {
+ i.isLeaf = true
+ i.key = (Math.random()*10000000).toString(16).substr(0,4)+(new Date()).getTime()+Math.random().toString().substr(2,5),
+ (i.total && (i.total!= '总数:0' && i.total!= '总数:0')) ? newData.push(i) : null
+ })
+ })
+ if(newData.length != 0){
+ this.unitId[index].fireFacNodes.push({
+ name: '单位消防设施',
+ key: (Math.random()*10000000).toString(16).substr(0,4)+(new Date()).getTime()+Math.random().toString().substr(2,5),
+ expanded: false,
+ type:'消防设施',
+ children: newData
+ })
+ element.fireFacNodes = [...element.fireFacNodes]
+ }
+ })
+ }
+ })
+
+ //获取各建筑消防设施
+ this.http.get('/api/Buildings',{params:{
+ companyId:companyId
+ }}).subscribe((data:any)=>{
+ if (data.length != 0) { getAllBuildingFireFac(data) }
+ })
+ async function getAllBuildingFireFac (buildingsdata) {
+ console.log('建筑'+index,buildingsdata)
+ for (let i = 0, length = buildingsdata.length; i < length; i++){
+ let header = {buildingId: buildingsdata[i].id, buildingType: buildingsdata[i].buildingTypes[0].id,companyId:buildingsdata[i].companyId}
+ let result = await new Promise((resolve, reject) =>{
+ that.http.get('/api/BuildingFacilities',{params:header}).subscribe((data:any)=>{
+ console.log(index+'消防设施'+ i,data)
+
+ data[0].summary.buildingFacilityGroups.forEach(element => { //循环单位内置分组项
+ element.facilityItems.forEach((elements,index) => {
+ elements.total = element.facilityCount[index]
+ });
+ });
+ let newData = []
+ data[0].summary.buildingFacilityGroups.forEach(item => {
+ item.facilityItems.forEach(i => {
+ i.isLeaf = true
+ i.key = (Math.random()*10000000).toString(16).substr(0,4)+(new Date()).getTime()+Math.random().toString().substr(2,5),
+ (i.total && (i.total!= '总数:0' && i.total!= '总数:0')) ? newData.push(i) : null
+ })
+ })
+ if(newData.length != 0){
+ that.unitId[index].fireFacNodes.push({
+ name: buildingsdata[i].name,
+ key: buildingsdata[i].id,
+ expanded: false,
+ type:'消防设施',
+ children: newData
+ })
+ element.fireFacNodes = [...element.fireFacNodes]
+ }
+ resolve('消防设施')
+ })
+ })
+
+ }
+ }
+ })
+ }
//查看树节点
lookTreeNode(node){
- // console.log(node.origin)
const dialogRef = this.dialog.open(LookTreeNodeDialog, {
- // width: '380px',
- // height: '136px',
id:'lookTreeNode',
data: node.origin
});
-
dialogRef.afterClosed().subscribe(result => {
console.log('The dialog was closed');
});
}
-
//阻止input事件冒泡
stopPropagation($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}
+ {name:'5楼电路故障灾情扑救',or:'上海总队',time:'2020-09-24',isOpen:'未公开',level:'总队',score:0},
+ {name:'6楼电路故障灾情扑救',or:'上海总队',time:'2020-09-24',isOpen:'未公开',level:'总队',score:0},
+ {name:'7楼电路故障灾情扑救',or:'上海总队',time:'2020-09-24',isOpen:'未公开',level:'总队',score:0}
]
defaultCheckedKeys = []; //指定选中复选框的树节点 key值
@@ -334,14 +549,19 @@ export class CreateTestScoreComponent implements OnInit {
//key代表第几个建筑
//计算整个单位的总分
- this.unitId[key].score = this.unitId[key].basicInfoScore + this.unitId[key].aroundScore
+ this.unitId[key].score = this.unitId[key].basicInfoScore + this.unitId[key].aroundScore + this.unitId[key].keySiteScore + this.unitId[key].funDivScore + this.unitId[key].fireFacScore
//计算整个试卷的总分
- let examScore = 0
- this.unitId.forEach(element => {
- examScore += Number(element.score)
- })
- this.examScore = examScore
+ //计算整个试卷的总分
+ let examScore = 0
+ this.unitId.forEach(element => {
+ examScore += element.score
+ })
+ let examScore2 = 0
+ this.planDatas.forEach(element => {
+ examScore2 += Number(element.score)
+ })
+ this.examScore = examScore + examScore2
}
//tree的选择事件
@@ -374,6 +594,45 @@ export class CreateTestScoreComponent implements OnInit {
this.unitId[key].aroundItemScore = 0
}
}
+ if(event.node.origin.type == '重点部位' || (event.node.parentNode && event.node.parentNode.origin.type == '重点部位')){
+ let selectedNum = []
+ this.unitId[key].keySiteNodes.forEach(item => {
+ item.children.forEach(i => {
+ i.checked ? selectedNum.push(i) : ''
+ })
+ })
+ if(selectedNum.length != 0 ){
+ this.unitId[key].keySiteScore ? this.unitId[key].keySiteItemScore = this.unitId[key].keySiteScore / selectedNum.length : null
+ }else{
+ this.unitId[key].keySiteItemScore = 0
+ }
+ }
+ if(event.node.origin.type == '功能分区' || (event.node.parentNode && event.node.parentNode.origin.type == '功能分区')){
+ let selectedNum = []
+ this.unitId[key].funDivNodes .forEach(item => {
+ item.children.forEach(i => {
+ i.checked ? selectedNum.push(i) : ''
+ })
+ })
+ if(selectedNum.length != 0 ){
+ this.unitId[key].funDivScore ? this.unitId[key].funDivItemScore = this.unitId[key].funDivScore / selectedNum.length : null
+ }else{
+ this.unitId[key].funDivItemScore = 0
+ }
+ }
+ if(event.node.origin.type == '消防设施' || (event.node.parentNode && event.node.parentNode.origin.type == '消防设施')){
+ let selectedNum = []
+ this.unitId[key].fireFacNodes.forEach(item => {
+ item.children.forEach(i => {
+ i.checked ? selectedNum.push(i) : ''
+ })
+ })
+ if(selectedNum.length != 0 ){
+ this.unitId[key].fireFacScore ? this.unitId[key].fireFacItemScore = this.unitId[key].fireFacScore / selectedNum.length : null
+ }else{
+ this.unitId[key].fireFacItemScore = 0
+ }
+ }
}
//单位各项总分数动态计算
@@ -391,7 +650,6 @@ export class CreateTestScoreComponent implements OnInit {
}else{
this.unitId[key].basicInfoItemScore = 0
}
-
}
if(type == '四周毗邻'){
let selectedNum = 0
@@ -405,7 +663,45 @@ export class CreateTestScoreComponent implements OnInit {
}else{
this.unitId[key].aroundItemScore = 0
}
-
+ }
+ if(type == '重点部位'){
+ let selectedNum = 0
+ this.unitId[key].keySiteNodes.forEach(item => {
+ item.children.forEach(i => {
+ i.checked ? selectedNum++ : ''
+ })
+ })
+ if(selectedNum != 0){
+ this.unitId[key].keySiteItemScore = this.unitId[key].keySiteScore / selectedNum
+ }else{
+ this.unitId[key].keySiteItemScore = 0
+ }
+ }
+ if(type == '功能分区'){
+ let selectedNum = 0
+ this.unitId[key].funDivNodes.forEach(item => {
+ item.children.forEach(i => {
+ i.checked ? selectedNum++ : ''
+ })
+ })
+ if(selectedNum != 0){
+ this.unitId[key].funDivItemScore = this.unitId[key].funDivScore / selectedNum
+ }else{
+ this.unitId[key].funDivItemScore = 0
+ }
+ }
+ if(type == '消防设施'){
+ let selectedNum = 0
+ this.unitId[key].fireFacNodes.forEach(item => {
+ item.children.forEach(i => {
+ i.checked ? selectedNum++ : ''
+ })
+ })
+ if(selectedNum != 0){
+ this.unitId[key].fireFacItemScore = this.unitId[key].fireFacScore / selectedNum
+ }else{
+ this.unitId[key].fireFacItemScore = 0
+ }
}
this.calculateScore(key)//更新标题栏分数
@@ -425,7 +721,16 @@ export class CreateTestScoreComponent implements OnInit {
}
//每条预案分数增加在试卷分数
planItemScore(item){
- this.examScore += item.score
+ //计算整个试卷的总分
+ let examScore = 0
+ this.unitId.forEach(element => {
+ examScore += element.score
+ })
+ let examScore2 = 0
+ this.planDatas.forEach(element => {
+ examScore2 += Number(element.score)
+ })
+ this.examScore = examScore + examScore2
}
}
diff --git a/src/app/examiner/create-test-score/lookTreeNode.html b/src/app/examiner/create-test-score/lookTreeNode.html
index a268037..f05b3eb 100644
--- a/src/app/examiner/create-test-score/lookTreeNode.html
+++ b/src/app/examiner/create-test-score/lookTreeNode.html
@@ -1,11 +1,11 @@
-
+
{{item.name}} |
- {{item.value || item.propertyValue}} |
+ {{item.value || item.propertyValue || item.total}} |
@@ -26,4 +26,32 @@
{{item.name}} |
+
+
+ 重点部位名称 |
+ 重点部位所在位置 |
+ 建筑结构 |
+ 使用性质 |
+ 主要危险性 |
+
+
+ {{item.name || '无'}} |
+ {{item.position || '无'}} |
+ {{item.structure || '无'}} |
+ {{item.nature || '无'}} |
+ {{item.hazards || '无'}} |
+
+
+
+
+ 区域 |
+ 面积 |
+ 基本情况 |
+
+
+ {{item.region || '无'}} |
+ {{item.area || '无'}} |
+ {{item.details || '无'}} |
+
+
\ No newline at end of file