diff --git a/package-lock.json b/package-lock.json index 9c835b1..5eccfb3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10532,7 +10532,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -10741,12 +10742,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.9.0", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -10765,6 +10768,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -10953,7 +10957,8 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -11009,6 +11014,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -11052,12 +11058,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, @@ -16895,7 +16903,8 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.9.0", @@ -17010,7 +17019,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -17598,7 +17608,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -18079,6 +18090,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } diff --git a/src/app/_theming.scss b/src/app/_theming.scss index 4fba0ec..bcfb325 100644 --- a/src/app/_theming.scss +++ b/src/app/_theming.scss @@ -529,7 +529,7 @@ $dark-disabled-text: rgba(black, 0.38); $dark-dividers: rgba(black, 0.12); $dark-focused: rgba(black, 0.12); $light-primary-text: white; -$light-secondary-text: rgba(white, 0.7); +$light-secondary-text: rgba(black, 0.7); $light-disabled-text: rgba(white, 0.5); $light-dividers: rgba(white, 0.12); $light-focused: rgba(white, 0.12); @@ -2135,7 +2135,7 @@ $_mat-button-ripple-opacity: 0.1; // ensure that the button is readable on custom background colors. It's wrong to always assume // that those buttons are always placed inside of containers with the default background // color of the theme (e.g. themed toolbars). - color: inherit; + color: black; background: transparent; @include _mat-button-theme-property($theme, 'color', text); @@ -4190,7 +4190,7 @@ $mat-tooltip-handset-vertical-padding: // Use the primary text on the dark theme, even though the lighter one uses // a secondary, because the contrast on the light primary text is poor. color: if($is-dark-theme, $dark-primary-text, $light-secondary-text); - background: if($is-dark-theme, map-get($mat-grey, 50), #323232); + background: if($is-dark-theme, map-get($mat-grey, 50), #fff); @include _mat-theme-elevation(6, $theme); } 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 f10846f..03126f6 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 @@ -19,7 +19,7 @@ 单位名称 总分 - + {{item.name}} {{item.score}} @@ -37,7 +37,7 @@
-
+

{{unit.name}}

@@ -85,7 +85,7 @@ - +
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 1d174d9..8aef403 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 @@ -1,4 +1,5 @@ import { SelectionModel } from '@angular/cdk/collections'; +import { HttpClient } from '@angular/common/http'; import { Component, Inject, OnInit } from '@angular/core'; import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatTableDataSource } from '@angular/material/table'; @@ -10,12 +11,16 @@ import { NzFormatEmitEvent } from 'ng-zorro-antd/tree'; }) export class CreateTestScoreComponent implements OnInit { - constructor(public dialog: MatDialog) { } + constructor(public dialog: MatDialog,private http: HttpClient) { } selectedTab:number = 1 //选中的选项卡 selectTab(index){ this.selectedTab = index } ngOnInit(): void { + this.unitId.forEach(item => { + + }) + this.getUnitData() } //模拟单位数据 @@ -69,17 +74,110 @@ export class CreateTestScoreComponent implements OnInit { // {name:'富丽华大酒店2',score:0,basicInfoScore:0} ] - unitId:any = [{name:'富丽华大酒店1'}] + + //上个页面传过来的单位数据 + unitId:any = [{name:'最最最最最',id:'5fb76c42919f2b44e464016f'}, + // {name:'华南城集团有限公司',id:'5ee19fe06f91049f5e23e937'}, + // {name:'贵港油库',id:'5fa35d68f8eb762cb03c662e'} + ] + //获取单位数据 getUnitData(){ + this.unitId.forEach((element,index) => { + element.score = 0 + element.basicInfoScore = 0 + element.basicInfoItemScore = 0 + + this.http.get(`/api/Companies/${element.id}`).subscribe((data:any)=>{ + console.log('单位信息',index,data) + let unitData = { + name: '单位信息', + type:'基本信息', + expanded: false, + key:element.id + '单位信息' + index, + children:[] + } + data.usci ? unitData.children.push({ + name: '统一社会信用代码',key: element.id+'统一社会信用代码',isLeaf:true,value:data.usci + }) : null + data.buildingTypes[0].name ? unitData.children.push({ + name: '单位类型',key: element.id+'单位类型',isLeaf:true,value:data.buildingTypes[0].name + }) : null + data.contacts ? unitData.children.push({ + name: '联系人',key: element.id+'联系人',isLeaf:true,value:data.contacts + }) : null + data.phone ? unitData.children.push({ + name: '联系电话',key: element.id+'联系电话',isLeaf:true,value:data.phone + }) : null + data.organizationName ? unitData.children.push({ + name: '辖区中队',key: element.id+'辖区中队',isLeaf:true,value:data.organizationName + }) : null + data.address ? unitData.children.push({ + name: '单位地址',key: element.id+'单位地址',isLeaf:true,value:data.address + }) : null + + element.basicInfoNodes = [] + element.basicInfoNodes.push(unitData) + + var buildingsData:any + this.http.get("/api/Buildings",{ + params:{ + companyId:element.id + } + }).subscribe(async (data:any)=>{ + buildingsData = data + for (let i = 0, length = data.length; i < length; i++){ + const result = await new Promise((resolve) =>{ + this.http.get("/api/BuildingBasicInfos",{ // 循环请求当前单位建筑每一个建筑的信息保存到数组中 + params:{ + companyId :element.id, + buildingId:data[i].id, + buildingType:data[i].buildingTypes[0].id + } + }).subscribe((buildingsData:any)=>{ + console.log(1234,buildingsData) + buildingsData.name = data[i].name + buildingsData.buildingType = data[i].buildingTypes[0].name + let propertyInfosArr = [] + buildingsData[0].buildingBasicGroups[0].propertyInfos.forEach((x,key) => { + if(x.propertyValue){ + x.key = data[i].name + x.propertyName + key + x.isLeaf = true + x.name = x.propertyName + propertyInfosArr.push(x) + } + }) + element.basicInfoNodes.push({ + name: buildingsData.name, + type:'基本信息', + expanded: false, + key:buildingsData[0].id, + children:propertyInfosArr + }) + + element.basicInfoNodes = [...element.basicInfoNodes] + resolve(i) + }) + }) + } + console.log(987,this.unitId) + }) + + }) + + }) } + //获得建筑信息 + getAllBuildingsInfo(unitId){ + + + } //阻止input事件冒泡 stopPropagation($event){ - console.log($event) $event.stopPropagation() } //模拟预案数据 @@ -102,11 +200,11 @@ export class CreateTestScoreComponent implements OnInit { //key代表第几个建筑 //计算整个单位的总分 - this.unitDatas[key].score = this.unitDatas[key].basicInfoScore + this.unitDatas[key].aroundScore + this.unitId[key].score = this.unitId[key].basicInfoScore + 0 //计算整个试卷的总分 let examScore = 0 - this.unitDatas.forEach(element => { + this.unitId.forEach(element => { examScore += Number(element.score) }) this.examScore = examScore @@ -116,30 +214,31 @@ export class CreateTestScoreComponent implements OnInit { nzEvent(event: NzFormatEmitEvent,key): void { if(event.node.origin.type == '基本信息' || (event.node.parentNode && event.node.parentNode.origin.type == '基本信息')){ + let selectedNum = [] - this.unitDatas[key].basicInfoNodes.forEach(item => { + this.unitId[key].basicInfoNodes.forEach(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 + this.unitId[key].basicInfoScore ? this.unitId[key].basicInfoItemScore = this.unitId[key].basicInfoScore / selectedNum.length : null }else{ - this.unitDatas[key].basicInfoItemScore = 0 + this.unitId[key].basicInfoItemScore = 0 } } if(event.node.origin.type == '四周毗邻' || (event.node.parentNode && event.node.parentNode.origin.type == '四周毗邻')){ let selectedNum = [] - this.unitDatas[key].aroundNodes.forEach(item => { + this.unitId[key].aroundNodes.forEach(item => { item.children.forEach(i => { i.checked ? selectedNum.push(i) : '' }) }) console.log(7894,selectedNum) if(selectedNum.length != 0 ){ - this.unitDatas[key].aroundScore ? this.unitDatas[key].aroundItemScore = this.unitDatas[key].aroundScore / selectedNum.length : null + this.unitId[key].aroundScore ? this.unitId[key].aroundItemScore = this.unitId[key].aroundScore / selectedNum.length : null }else{ - this.unitDatas[key].aroundItemScore = 0 + this.unitId[key].aroundItemScore = 0 } } } @@ -149,29 +248,29 @@ export class CreateTestScoreComponent implements OnInit { //key代表第几个建筑 type代表哪个部分 if(type == '基本信息'){ let selectedNum = 0 - this.unitDatas[key].basicInfoNodes.forEach(item => { + this.unitId[key].basicInfoNodes.forEach(item => { item.children.forEach(i => { i.checked ? selectedNum++ : '' }) }) if(selectedNum != 0){ - this.unitDatas[key].basicInfoItemScore = this.unitDatas[key].basicInfoScore / selectedNum + this.unitId[key].basicInfoItemScore = this.unitId[key].basicInfoScore / selectedNum }else{ - this.unitDatas[key].basicInfoItemScore = 0 + this.unitId[key].basicInfoItemScore = 0 } } if(type == '四周毗邻'){ let selectedNum = 0 - this.unitDatas[key].aroundNodes.forEach(item => { + this.unitId[key].aroundNodes.forEach(item => { item.children.forEach(i => { i.checked ? selectedNum++ : '' }) }) if(selectedNum != 0){ - this.unitDatas[key].aroundItemScore = this.unitDatas[key].aroundScore / selectedNum + this.unitId[key].aroundItemScore = this.unitId[key].aroundScore / selectedNum }else{ - this.unitDatas[key].aroundItemScore = 0 + this.unitId[key].aroundItemScore = 0 } }