diff --git a/src/app/ui/plan-template/addKeyname.html b/src/app/ui/plan-template/addKeyname.html index 394aab7..56c9170 100644 --- a/src/app/ui/plan-template/addKeyname.html +++ b/src/app/ui/plan-template/addKeyname.html @@ -4,7 +4,7 @@ * @Author: sueRimn * @Date: 2021-05-20 16:11:57 * @LastEditors: sueRimn - * @LastEditTime: 2021-05-24 09:52:10 + * @LastEditTime: 2021-05-28 16:53:04 -->
@@ -13,7 +13,7 @@
- +
@@ -22,17 +22,17 @@ - Ⅲ级 - Ⅳ级 - Ⅴ级 + Ⅲ级 + Ⅳ级 + Ⅴ级
- - {{unit.name}} + + {{unit.name}}
diff --git a/src/app/ui/plan-template/plan-template.component.html b/src/app/ui/plan-template/plan-template.component.html index 42d3d2f..0ae4bbd 100644 --- a/src/app/ui/plan-template/plan-template.component.html +++ b/src/app/ui/plan-template/plan-template.component.html @@ -4,7 +4,7 @@ * @Author: sueRimn * @Date: 2021-05-19 15:50:20 * @LastEditors: sueRimn - * @LastEditTime: 2021-05-26 16:41:51 + * @LastEditTime: 2021-05-28 17:07:26 -->
@@ -18,14 +18,14 @@
-
+
- {{item.name}} + {{item.unitname}}
- {{item.level}} - - + {{item.level==3?'Ⅲ级':item.level==4?'Ⅳ级':'Ⅴ级'}} + +
@@ -33,17 +33,17 @@
- {{planName}} + {{unitName}}
- +
- +
@@ -62,53 +62,74 @@
- +
{{element.surveyName}}
-
- - +
+ +
-
- +
+ +
+ + + + + + + + + + + + + + + + + +
名称类型默认值必填单位操作
{{attinf.addAttinfName}}{{attinf.level}}{{attinf.default}}{{attinf.must}}{{attinf.danwei}} 删除
diff --git a/src/app/ui/plan-template/plan-template.component.scss b/src/app/ui/plan-template/plan-template.component.scss index 223dc0b..14629e9 100644 --- a/src/app/ui/plan-template/plan-template.component.scss +++ b/src/app/ui/plan-template/plan-template.component.scss @@ -4,7 +4,7 @@ * @Author: sueRimn * @Date: 2021-05-19 15:50:20 * @LastEditors: sueRimn - * @LastEditTime: 2021-05-26 16:38:06 + * @LastEditTime: 2021-05-28 13:52:54 */ .box{ height: 97%; @@ -208,6 +208,11 @@ text-align: center; background-color: #F7F8FA; } + td{ + height: 40px; + text-align: center; + font-size: 16px; + } } } } diff --git a/src/app/ui/plan-template/plan-template.component.ts b/src/app/ui/plan-template/plan-template.component.ts index d6a2059..3e6d72f 100644 --- a/src/app/ui/plan-template/plan-template.component.ts +++ b/src/app/ui/plan-template/plan-template.component.ts @@ -4,7 +4,7 @@ * @Author: sueRimn * @Date: 2021-05-19 15:50:20 * @LastEditors: sueRimn - * @LastEditTime: 2021-05-26 16:58:15 + * @LastEditTime: 2021-05-28 17:11:44 */ import { Component, Inject, OnInit } from '@angular/core'; import { HttpClient } from '@angular/common/http' @@ -23,11 +23,12 @@ export class PlanTemplateComponent implements OnInit { ngOnInit(): void { } - - //获取左侧单位信息 + groupPanle=true//分组展开 + attPanle=true + //获取所有单位信息 newleftTabledata=[ - {name:"333",level:'Ⅲ级',unitid: "5e7c49e861550e2754d461ce",group:[]},//{groupName: "单位概况"} - {name:"444",level:'Ⅳ级',unitid: "5e7c49e861550e2754d461ce",group:[]} + {name:"333",level:3,basicCategoryId:"5e7c49e861550e2754d461ce",unitid: "5e7c8ffba3050b1a840ed4b6",unitname:'高层建筑',group:[]},//{groupName: "单位概况"} + {name:"444",level:5,basicCategoryId:"60127efe2757e904e5721d83",unitid: "5e7c9018a3050b1a840ed4b7",unitname:'地下建筑',group:[]} ] group=[] getLeftdata(){ @@ -57,6 +58,7 @@ export class PlanTemplateComponent implements OnInit { } } } + //console.log(this.newleftTabledata) }); } //删除预案 @@ -71,26 +73,31 @@ export class PlanTemplateComponent implements OnInit { upPlan(item,i){ const dialogRef = this.dialog.open(upPlanname, {//调用open方法打开对话框并且携带参数过去 width: '340px', - height:'330px', + height:'380px', disableClose:true, - data:{item:item} + data:{item:item,plandata:this.newleftTabledata} }); dialogRef.afterClosed().subscribe(result => { - console.log(result) if(result!=undefined){ this.newleftTabledata[i].name=result.name this.newleftTabledata[i].level=result.level + this.newleftTabledata[i].unitid=result.unitid + this.newleftTabledata[i].unitname=result.unitname } }); } //左侧预案模板点击事件 planName + unitName + leftclicki=-1//点了第几个模板 planClick(item){ //console.log(item) this.planName=item.name + this.unitName=item.unitname this.newleftTabledata.forEach((value,index,array)=>{ - if(array[index].name==this.planName){ + if(array[index].unitname==this.unitName){ this.group=array[index].group + this.leftclicki=index } }) } @@ -159,6 +166,7 @@ export class PlanTemplateComponent implements OnInit { } //新增属性 addAttribute(groupName){ + this.groupPanle=true if(groupName=='单位概况'){ const dialogRef = this.dialog.open(adddwsurvey, {//调用open方法打开对话框并且携带参数过去 width: '240px', @@ -180,30 +188,71 @@ export class PlanTemplateComponent implements OnInit { } } //删除具体属性 - delAttribute(surveyName){ - + delAttribute(groupName,surveyName){ + let isTrue = confirm('您确定要删除吗') + if(isTrue){ + this.group.forEach((value,index,array)=>{ + if (array[index].groupName==groupName) { + array[index].attribute.forEach((element,i) => { + if(element.surveyName==surveyName){ + array[index].attribute[i].completed=false + } + }); + } + }) + } + console.log(this.newleftTabledata) } //新增属性信息 - addAttInfo(){ + danweiInfTable=[] + addAttInfo(surveyName){ + this.attPanle=true const dialogRef = this.dialog.open(addattinf, {//调用open方法打开对话框并且携带参数过去 width: '240px', height:'400px', disableClose:true, - data:this.group + data:{group:this.group,surveyName:surveyName} }); dialogRef.afterClosed().subscribe(result => { - console.log(result) + //console.log(result) if(result!=undefined){ /* this.group.forEach((value,index,array)=>{ if(array[index].groupName=='单位概况'){ array[index].attribute=result } }) */ + this.newleftTabledata[this,this.leftclicki].group.forEach((value,index,array)=>{ + if(value.groupName=='单位概况'){ + array[index].attribute.forEach((element,i,attary) => { + if(element.surveyName==surveyName){ + attary[i].attinf=result + } + }); + } + }) + this.group=this.newleftTabledata[this,this.leftclicki].group + //console.log(this.danweiInfTable) } console.log(this.newleftTabledata) }); } + //保存 + save(){ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + let body={ + basicCategoryId:this.newleftTabledata[this.leftclicki].basicCategoryId, + buildingTypeId:this.newleftTabledata[this.leftclicki].unitid, + planCategory:Number(this.newleftTabledata[this.leftclicki].level), + data:{} + } + this.http.post("/api/PlanTemplate",body).subscribe((data:any)=>{ + this.snackBar.open('创建成功!','确定',config); + console.log(data) + }) + } //单位基本信息和建筑信息表格 displayedColumns: string[] = ['name','level','default','must', 'danwei','operation']; @@ -216,18 +265,20 @@ export class PlanTemplateComponent implements OnInit { }) export class addPlanname{ constructor(private http: HttpClient,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar) {} - unitname//预案名称 + planname//预案名称 level//预案级别 - unittype//单位类型 + unitid//单位类型id + unitname//单位类型名称 allunittype//所有单位信息 + basicCategoryId ngOnInit(): void { this.getUnittype() } //获取单位类型 getUnittype(){ - this.http.get("/api/BasicCategories").subscribe((data:any)=>{ + this.http.get("/api/BuildingTypes").subscribe((data:any)=>{ this.allunittype=data - //console.log(data) + console.log(this.allunittype) }) } //取消按钮 @@ -235,30 +286,40 @@ export class addPlanname{ this.dialogRef.close(); } newplan(){ + this.unitname=document.getElementById('unit').innerText const config = new MatSnackBarConfig(); config.verticalPosition = 'top'; config.duration = 3000 - if(this.unitname==undefined||this.unitname==''){ + if(this.planname==undefined||this.planname==''){ this.snackBar.open('请输入预案名称!','确定',config); } else if(this.level==undefined||this.level==''){ this.snackBar.open('请输入预案级别!','确定',config); - }else if(this.unittype==undefined||this.unittype==''){ + }else if(this.unitid==undefined||this.unitid==''){ this.snackBar.open('请选择单位类型!','确定',config); } else{ for(var i=0;i { + if(element.id==this.unitid){ + this.basicCategoryId=element.basicCategoryId + } + }); let planData={ - name:this.unitname, + name:this.planname, level:this.level, - unitid:this.unittype, + unitid:this.unitid, + unitname:this.unitname, + basicCategoryId:this.basicCategoryId, group:[] } this.dialogRef.close(planData) @@ -273,11 +334,20 @@ export class addPlanname{ }) export class upPlanname{ constructor(private http: HttpClient,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar) {} - unitname=this.data.item.name//预案名称 + name=this.data.item.name//预案名称 level=this.data.item.level//预案级别 + unitName=this.data.item.unitname//单位类型 + unitid=this.data.item.unitid + allunittype ngOnInit(): void{ - /* this.unitname=this.data.name - this.level=this.data.level */ + this.getUnittype() + } + //获取单位类型 + getUnittype(){ + this.http.get("/api/BuildingTypes").subscribe((data:any)=>{ + this.allunittype=data + //console.log(this.allunittype) + }) } //取消按钮 close(){ @@ -285,18 +355,31 @@ export class upPlanname{ } //确定按钮 upplan(){ + this.unitName=document.getElementById('unit').innerText const config = new MatSnackBarConfig(); config.verticalPosition = 'top'; config.duration = 3000 - if(this.unitname==undefined||this.unitname==''){ + if(this.name==undefined||this.name==''){ this.snackBar.open('请输入预案名称!','确定',config); } else if(this.level==undefined||this.level==''){ this.snackBar.open('请输入预案级别!','确定',config); }else{ + for(var i=0;i { if(element.groupName=='单位概况'&&element.attribute!=undefined){ this.addwsurvey=element.attribute @@ -399,7 +482,7 @@ defineClick(){ this.dialogRef.close(this.addwsurvey) } } -//编辑属性信息弹窗 +//编辑单位概况单位基本信息属性信息弹窗 @Component({ selector: 'addattinf', templateUrl: './addattinf.html', @@ -416,6 +499,18 @@ export class addattinf{ {addAttinfName:'单位地址',completed:false,level:'单行文本',default:'-',must:'是',danwei:'-'}, {addAttinfName:'单位照片',completed:false,level:'单行文本',default:'-',must:'是',danwei:'-'} ] +ngOnInit(): void{ + //console.log(this.data) + this.data.group.forEach(element => { + if(element.groupName=='单位概况'&&element.attribute!=undefined){ + element.attribute.forEach(value => { + if(this.data.surveyName=='单位基本信息'&&value.attinf!=undefined){ + this.addAttinf=value.attinf + } + }); + } + }); +} //取消按钮 close(){ this.dialogRef.close(); diff --git a/src/app/ui/plan-template/upPlan.html b/src/app/ui/plan-template/upPlan.html index 749206b..6d23c2c 100644 --- a/src/app/ui/plan-template/upPlan.html +++ b/src/app/ui/plan-template/upPlan.html @@ -4,7 +4,7 @@ * @Author: sueRimn * @Date: 2021-05-21 10:43:28 * @LastEditors: sueRimn - * @LastEditTime: 2021-05-21 11:05:14 + * @LastEditTime: 2021-05-28 10:44:56 -->
- 修改预案名称和级别 + 修改预案模板
- +
@@ -36,6 +36,14 @@
+
+ + + + {{unit.name}} + + +