diff --git a/src/app/ui/plan-template/addgroup.scss b/src/app/ui/plan-template/addgroup.scss
index b66790c..ecfba06 100644
--- a/src/app/ui/plan-template/addgroup.scss
+++ b/src/app/ui/plan-template/addgroup.scss
@@ -12,8 +12,9 @@
}
}
.center{
+ overflow: auto;
width: 100%;
- height: 75%;
+ height: 80%;
.group{
height: 35px;
//margin-left: 20px;
@@ -30,7 +31,7 @@
}
.bottom{
width: 100%;
- margin-top: 40px;
+ margin-top: 20px;
button{
width: 80px;
height: 36px;
diff --git a/src/app/ui/plan-template/plan-template.component.html b/src/app/ui/plan-template/plan-template.component.html
index 0ae4bbd..0f39a8f 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-28 17:07:26
+ * @LastEditTime: 2021-05-29 16:52:44
-->
-
+
{{item.unitname}}
-
{{item.level==3?'Ⅲ级':item.level==4?'Ⅳ级':'Ⅴ级'}}
-
-
+
{{item.planCategory==3?'Ⅲ级':item.planCategory==4?'Ⅳ级':'Ⅴ级'}}
+
+
@@ -113,21 +113,15 @@
-->
- 名称 |
- 类型 |
- 默认值 |
- 必填 |
- 单位 |
- 操作 |
+ 名称 |
+ 类型 |
+ 操作 |
- {{attinf.addAttinfName}} |
- {{attinf.level}} |
- {{attinf.default}} |
- {{attinf.must}} |
- {{attinf.danwei}} |
- 删除 |
+ {{attinf.propertyName}} |
+ {{attinf.propertyType==0?'单行文本':attinf.propertyType==1?'多行文本':'数值'}} |
+ 删除 |
diff --git a/src/app/ui/plan-template/plan-template.component.ts b/src/app/ui/plan-template/plan-template.component.ts
index 3e6d72f..2fcaf86 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-28 17:11:44
+ * @LastEditTime: 2021-05-29 16:50:13
*/
import { Component, Inject, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http'
@@ -21,30 +21,42 @@ export class PlanTemplateComponent implements OnInit {
constructor(private http:HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar) { }
ngOnInit(): void {
-
+ this.getLeftdata()
}
groupPanle=true//分组展开
attPanle=true
//获取所有单位信息
newleftTabledata=[
- {name:"333",level:3,basicCategoryId:"5e7c49e861550e2754d461ce",unitid: "5e7c8ffba3050b1a840ed4b6",unitname:'高层建筑',group:[]},//{groupName: "单位概况"}
- {name:"444",level:5,basicCategoryId:"60127efe2757e904e5721d83",unitid: "5e7c9018a3050b1a840ed4b7",unitname:'地下建筑',group:[]}
+ /* {planCategory:3,basicCategoryId:"5e7c49e861550e2754d461ce",buildingTypeId: "5e7c8ffba3050b1a840ed4b6",unitname:'高层建筑',data:[]},
+ {planCategory:5,basicCategoryId:"60127efe2757e904e5721d83",buildingTypeId: "5e7c9018a3050b1a840ed4b7",unitname:'地下建筑',data:[]} */
]
group=[]
getLeftdata(){
- /* this.http.get("/api/PlanTemplate").subscribe((data:any)=>{
- this.leftTabledata=data
- console.log(this.leftTabledata)
- }) */
+ this.http.get("/api/PlanTemplate").subscribe((data:any)=>{
+ this.newleftTabledata=data
+ this.newleftTabledata.forEach((value,index,array)=>{
+ value.data= JSON.parse(value.data)
+ })
+ this.http.get("/api/BuildingTypes").subscribe((buildData:any)=>{
+ this.newleftTabledata.forEach((value,index,array)=>{
+ buildData.forEach((element,i,buildArray) => {
+ if(value.buildingTypeId==element.id){
+ array[index].unitname=buildArray[i].name
+ }
+ });
+ })
+ })
+ })
+
}
- //新建预案弹窗
+ //新建模板弹窗
addKeyunit(){
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
const dialogRef = this.dialog.open(addPlanname, {//调用open方法打开对话框并且携带参数过去
width: '340px',
- height:'380px',
+ height:'340px',
disableClose:true,
data:{plandata:this.newleftTabledata}
});
@@ -52,66 +64,88 @@ export class PlanTemplateComponent implements OnInit {
//console.log(result)
if(result!=undefined){
this.newleftTabledata.push(result)
- for(var i=0;i
{
+ this.snackBar.open('创建成功!','确定',config);
+ })
}
//console.log(this.newleftTabledata)
});
}
- //删除预案
- deletePlan(i){
- let isTrue = confirm('您确定要删除该条预案吗')
+ //删除模板
+ deletePlan(id,i){
+ console.log(id)
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = 'top';
+ config.duration = 3000
+ let isTrue = confirm('您确定要删除该模板吗')
if(isTrue){
- this.newleftTabledata.splice(i,1)
+ if(id!=undefined){
+ this.http.delete(`/api/PlanTemplate/${id}`).subscribe((data:any)=>{
+ this.snackBar.open('删除模板成功!','确定',config);
+ this.newleftTabledata.splice(i,1)
+ })
+ }
+ else{
+ this.newleftTabledata.splice(i,1)
+ }
}
}
- //修改预案名称和级别
+ //修改模板
upPlan(item,i){
const dialogRef = this.dialog.open(upPlanname, {//调用open方法打开对话框并且携带参数过去
width: '340px',
- height:'380px',
+ height:'340px',
disableClose:true,
data:{item:item,plandata:this.newleftTabledata}
});
dialogRef.afterClosed().subscribe(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].name=result.name
+ this.newleftTabledata[i].basicCategoryId=result.basicCategoryId
+ this.newleftTabledata[i].planCategory=result.planCategory
+ this.newleftTabledata[i].buildingTypeId=result.buildingTypeId
this.newleftTabledata[i].unitname=result.unitname
}
});
}
//左侧预案模板点击事件
- planName
+ Id
+ planCategory
+ buildingTypeId
unitName
leftclicki=-1//点了第几个模板
planClick(item){
//console.log(item)
- this.planName=item.name
+ this.Id=item.id
+ this.planCategory=item.planCategory
this.unitName=item.unitname
+ this.buildingTypeId=item.buildingTypeId
this.newleftTabledata.forEach((value,index,array)=>{
- if(array[index].unitname==this.unitName){
- this.group=array[index].group
+ if(array[index].buildingTypeId==this.buildingTypeId){
+ this.group=array[index].data
this.leftclicki=index
}
})
+
}
//右侧新增分组点击事件
addGroupClick(){
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
- if(this.planName==undefined){
+ if(this.unitName==undefined){
this.snackBar.open('请选择预案模板!','确定',config);
}else{
this.newleftTabledata.forEach((value,index,array)=>{
- if(array[index].name==this.planName){
- this.group=array[index].group
+ if(array[index].buildingTypeId==this.buildingTypeId){
+ this.group=array[index].data
}
})
const dialogRef = this.dialog.open(addGroup, {//调用open方法打开对话框并且携带参数过去
@@ -123,27 +157,15 @@ export class PlanTemplateComponent implements OnInit {
dialogRef.afterClosed().subscribe(result => {
//console.log(result,this.newleftTabledata)
this.newleftTabledata.forEach((value,index,array)=>{
- if(array[index].name==this.planName){
+ if(array[index].buildingTypeId==this.buildingTypeId){
if(result!=undefined){
result.forEach((valuer,i,rarr) => {
- //console.log(valuer)
- /* let groupName={
- groupName:valuer
- } */
//添加分组名称
- array[index].group=rarr
+ array[index].data=rarr
});
}
- //去重
- for(var i=0;i {
//console.log(result)
@@ -221,7 +243,7 @@ export class PlanTemplateComponent implements OnInit {
array[index].attribute=result
}
}) */
- this.newleftTabledata[this,this.leftclicki].group.forEach((value,index,array)=>{
+ this.newleftTabledata[this,this.leftclicki].data.forEach((value,index,array)=>{
if(value.groupName=='单位概况'){
array[index].attribute.forEach((element,i,attary) => {
if(element.surveyName==surveyName){
@@ -230,7 +252,7 @@ export class PlanTemplateComponent implements OnInit {
});
}
})
- this.group=this.newleftTabledata[this,this.leftclicki].group
+ this.group=this.newleftTabledata[this,this.leftclicki].data
//console.log(this.danweiInfTable)
}
console.log(this.newleftTabledata)
@@ -243,15 +265,25 @@ export class PlanTemplateComponent implements OnInit {
config.verticalPosition = 'top';
config.duration = 3000
let body={
+ id:this.Id,
basicCategoryId:this.newleftTabledata[this.leftclicki].basicCategoryId,
- buildingTypeId:this.newleftTabledata[this.leftclicki].unitid,
- planCategory:Number(this.newleftTabledata[this.leftclicki].level),
- data:{}
+ buildingTypeId:this.newleftTabledata[this.leftclicki].buildingTypeId,
+ planCategory:Number(this.newleftTabledata[this.leftclicki].planCategory),
+ data:JSON.stringify(this.newleftTabledata[this.leftclicki].data)
}
- this.http.post("/api/PlanTemplate",body).subscribe((data:any)=>{
- this.snackBar.open('创建成功!','确定',config);
- console.log(data)
- })
+ if(this.newleftTabledata[this.leftclicki].id==undefined){
+ this.http.post("/api/PlanTemplate",this.newleftTabledata[this.leftclicki]).subscribe((data:any)=>{
+ this.snackBar.open('创建成功!','确定',config);
+ console.log(data)
+ })
+ }
+ else{
+ this.http.put(`/api/PlanTemplate/${this.Id}`,body).subscribe((data:any)=>{
+ this.snackBar.open('保存成功!','确定',config);
+ console.log(data)
+ })
+ }
+
}
//单位基本信息和建筑信息表格
displayedColumns: string[] = ['name','level','default','must', 'danwei','operation'];
@@ -290,17 +322,14 @@ export class addPlanname{
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
- if(this.planname==undefined||this.planname==''){
- this.snackBar.open('请输入预案名称!','确定',config);
- }
- else if(this.level==undefined||this.level==''){
- this.snackBar.open('请输入预案级别!','确定',config);
+ if(this.level==undefined||this.level==''){
+ this.snackBar.open('请选择预案级别!','确定',config);
}else if(this.unitid==undefined||this.unitid==''){
this.snackBar.open('请选择单位类型!','确定',config);
}
else{
for(var i=0;i,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar) {}
- name=this.data.item.name//预案名称
- level=this.data.item.level//预案级别
+ name//预案名称
+ level=this.data.item.planCategory//预案级别
unitName=this.data.item.unitname//单位类型
- unitid=this.data.item.unitid
+ unitid=this.data.item.buildingTypeId
allunittype
+ basicCategoryId
ngOnInit(): void{
+ this.level=String(this.data.item.planCategory)
+ console.log(this.level)
this.getUnittype()
}
//获取单位类型
@@ -359,14 +391,13 @@ export class upPlanname{
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
- if(this.name==undefined||this.name==''){
+ /* if(this.name==undefined||this.name==''){
this.snackBar.open('请输入预案名称!','确定',config);
- }
- else if(this.level==undefined||this.level==''){
- this.snackBar.open('请输入预案级别!','确定',config);
- }else{
+ } */
+ if(this.level!=this.data.item.planCategory||this.unitid!=this.data.item.buildingTypeId){
+ //this.snackBar.open('请输入预案级别!','确定',config);
for(var i=0;i {
+ if(element.id==this.unitid){
+ this.basicCategoryId=element.basicCategoryId
+ }
+ });
let planData={
- name:this.name,
- level:this.level,
- unitid:this.unitid,
+ //name:this.name,
+ planCategory:this.level,
+ buildingTypeId:this.unitid,
+ basicCategoryId:this.basicCategoryId,
unitname:this.unitName
}
this.dialogRef.close(planData)
@@ -409,7 +446,8 @@ export class addGroup{
}
});
}) */
- if(this.data.length>0){
+ console.log(this.data)
+ if(this.data!=null){
this.addgtoup=this.data
}
@@ -491,21 +529,39 @@ defineClick(){
export class addattinf{
constructor(private http: HttpClient,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar) {}
addAttinf=[
- {addAttinfName:'统一社会信用代码',completed:false,level:'单行文本',default:'-',must:'是',danwei:'-'},
- {addAttinfName:'单位类型',completed:false,level:'单行文本',default:'-',must:'是',danwei:'-'},
- {addAttinfName:'联系人',completed:false,level:'单行文本',default:'-',must:'是',danwei:'-'},
- {addAttinfName:'联系电话',completed:false,level:'单行文本',default:'-',must:'是',danwei:'-'},
- {addAttinfName:'辖区中队',completed:false,level:'单行文本',default:'-',must:'是',danwei:'-'},
- {addAttinfName:'单位地址',completed:false,level:'单行文本',default:'-',must:'是',danwei:'-'},
- {addAttinfName:'单位照片',completed:false,level:'单行文本',default:'-',must:'是',danwei:'-'}
+ {propertyName:'统一社会信用代码',completed:false,propertyType:0},
+ {propertyName:'单位类型',completed:false,propertyType:0},
+ {propertyName:'联系人',completed:false,propertyType:0},
+ {propertyName:'联系电话',completed:false,propertyType:0},
+ {propertyName:'辖区中队',completed:false,propertyType:0},
+ {propertyName:'单位地址',completed:false,propertyType:0},
+ {propertyName:'单位照片',completed:false,propertyType:0}//,default:'-',must:'是',danwei:'-'
]
+addAttinfBuild
ngOnInit(): void{
//console.log(this.data)
- this.data.group.forEach(element => {
+ this.getattinf()
+}
+//获取弹窗信息
+getattinf(){
+ this.data.newleftTabledata[this.data.leftclicki].data.forEach(element => {
if(element.groupName=='单位概况'&&element.attribute!=undefined){
element.attribute.forEach(value => {
- if(this.data.surveyName=='单位基本信息'&&value.attinf!=undefined){
+ if(value.surveyName=='单位基本信息'&&value.attinf!=undefined){
this.addAttinf=value.attinf
+ }else if(value.surveyName=='建筑信息'&&value.attinf==undefined){
+ let paramsdata:any ={
+ categoryId:this.data.newleftTabledata[this.data.leftclicki].basicCategoryId
+ }
+ this.http.get("/api/BasicGroups",{params:paramsdata}).subscribe((data:any)=>{
+ this.addAttinfBuild=data[0].propertyInfos
+ this.addAttinfBuild.forEach(element => {
+ element.completed=false
+ });
+ console.log(this.addAttinfBuild)
+ })
+ }else if(value.surveyName=='建筑信息'&&value.attinf!=undefined){
+ this.addAttinfBuild=value.attinf
}
});
}
@@ -517,6 +573,6 @@ close(){
}
//确定按钮
defineClick(){
- this.dialogRef.close(this.addAttinf)
+ this.dialogRef.close(this.data.surveyName=='单位基本信息'?this.addAttinf:this.addAttinfBuild)
}
}
\ No newline at end of file
diff --git a/src/app/ui/plan-template/upPlan.html b/src/app/ui/plan-template/upPlan.html
index 6d23c2c..16b22b9 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-28 10:44:56
+ * @LastEditTime: 2021-05-29 10:52:11
-->
- Ⅲ级
- Ⅳ级
- Ⅴ级
+ Ⅲ级
+ Ⅳ级
+ Ⅴ级