Browse Source

[完善]四周毗邻图片压缩

develop
陈鹏飞 5 years ago
parent
commit
b5c88329f3
  1. 2
      proxy.config.json
  2. 4
      src/app/ui/allaround/allaround.component.html
  3. 2
      src/app/ui/allaround/allaround.component.ts
  4. 2
      src/app/ui/fire-fighting-device/addGrouping.html
  5. 77
      src/app/ui/fire-fighting-device/fire-fighting-device.component.html
  6. 2
      src/app/ui/fire-fighting-device/fire-fighting-device.component.scss
  7. 102
      src/app/ui/fire-fighting-device/fire-fighting-device.component.ts

2
proxy.config.json

@ -1,6 +1,6 @@
{
"/api": {
"target": "http://59.111.63.117:8090",
"target": "http://39.106.78.171:8088",
"secure": false,
"changeOrigin": true
}

4
src/app/ui/allaround/allaround.component.html

@ -5,7 +5,7 @@
<div class="imgBox" *ngFor="let item of AllAdjoining" >
<div class="fixedImg" *ngIf="item.imageUrls.length">
<img [src]="item.imageUrls[0]" onerror="javascript:this.src='../../../assets/images/upload.png'" (click)='imgdetails(item.imageUrls)'>
<img [src]="item.imgURL" onerror="javascript:this.src='../../../assets/images/upload.png'" (click)='imgdetails(item.imageUrls)'>
</div>
<div class="fixedImg" *ngIf="!item.imageUrls.length">
<img src="../../../assets/images/upload.png" (click)='imgdetails(item.imageUrls)'>
@ -43,7 +43,7 @@
<div class="imgBox" *ngFor="let items of item.allImgs">
<div class="fixedImg" *ngIf="items.imageUrls.length">
<img [src]="items.imageUrls[0]" onerror="javascript:this.src='../../../assets/images/upload.png'" (click)='imgdetails(items.imageUrls)'>
<img [src]="items.imgURL" onerror="javascript:this.src='../../../assets/images/upload.png'" (click)='imgdetails(items.imageUrls)'>
</div>
<div class="fixedImg" *ngIf="!items.imageUrls.length"><img src="../../../assets/images/upload.png" (click)='imgdetails(items.imageUrls)'></div>
<div style="margin-top: 5px;">

2
src/app/ui/allaround/allaround.component.ts

@ -27,6 +27,7 @@ export class AllaroundComponent implements OnInit {
getAllCompany () {
this.http.get('/api/CompanyAccount/CompanyAdjoins').subscribe(data=>{
this.AllAdjoining = data
this.AllAdjoining.forEach(element => {element.imgURL = element.imageUrls[0] +'?x-oss-process=image/resize,m_fill,h_170,w_299'})
})
}
@ -48,6 +49,7 @@ export class AllaroundComponent implements OnInit {
let id = {buildingId:element.id}
this.http.get('/api/CompanyAccount/BuildingAdjoins',{params:id}).subscribe(data=>{
element.allImgs = data
element.allImgs.forEach(element => {element.imgURL = element.imageUrls[0] +'?x-oss-process=image/resize,m_fill,h_170,w_299'});
})
});
}

2
src/app/ui/fire-fighting-device/addGrouping.html

@ -5,7 +5,7 @@
<mat-form-field>
<input matInput placeholder="请输入消防设施内置项名称" required ngModel name="name" maxlength="30">
</mat-form-field>
<p style="font-size: 14px; color: red; margin-bottom: 15px;">*注: 该名称如果与当前分组内置项重名,会自动覆盖之前内置项</p>
<p style="font-size: 14px; color: red; margin-bottom: 15px;">*注: 该名称不允许与当前分组内置项重名</p>
<div mat-dialog-actions>
<button mat-raised-button color="primary" type="submit"

77
src/app/ui/fire-fighting-device/fire-fighting-device.component.html

@ -52,14 +52,13 @@
</mat-expansion-panel-header>
<div *ngFor="let items of item.propertyInfos" class="InputField">
<label>{{items.propertyName}}:</label>
<input type="text" *ngIf="items.propertyType!=1&&items.propertyType!=2&&items.propertyType!=4&&items.propertyType!=6"
[(ngModel)]="items.propertyValue" name="propertyValue">
<textarea maxlength="250" *ngIf="items.propertyType==1" [(ngModel)]="items.propertyValue" name="propertyValue"></textarea>
<input type="number" *ngIf="items.propertyType==2 ||items.propertyType==4"
[(ngModel)]="items.propertyValue" name="propertyValue">
<mat-radio-group *ngIf="items.propertyType==6">
<mat-radio-button value=true style="margin-left: 5px;"></mat-radio-button>
<mat-radio-button value=false style="margin-left: 5px;"></mat-radio-button>
<input type="number" *ngIf="items.propertyType==2 ||items.propertyType==4" [(ngModel)]="items.propertyValue" name="propertyValue">
<mat-radio-group *ngIf="items.propertyType==6" [(ngModel)]="items.propertyValue" name="propertyValue">
<mat-radio-button style="margin-left: 5px;" [value]='radio.value' *ngFor="let radio of singleElection">{{radio.name}}</mat-radio-button>
</mat-radio-group>
</div>
</mat-expansion-panel>
@ -70,7 +69,73 @@
</div>
</mat-tab>
<mat-tab label="建筑消防设施">
<mat-tab label="{{newItem.name}}" *ngFor="let newItem of allBuildingGrouping">
<div class="contentBox">
<div style="width: 100%;margin-top: 25px;" *ngFor="let item of newItem.buildingFacilityGroups">
<h3 style="text-align: center;font-weight: 550;">{{item.name}}</h3>
<div style="margin-bottom: 10px;">
<mat-icon title="创建">add_circle_outline</mat-icon>
<mat-icon title="保存" style="margin-left: 25px;">description</mat-icon>
<mat-icon title="删除" style="margin-left: 25px;">delete</mat-icon>
</div>
<div>
<mat-accordion multi>
<mat-expansion-panel disabled>
<mat-expansion-panel-header>
<label class="textContent"></label>
<label class="textContent">项目</label>
<label class="textContent">照片</label>
<label class="lastTextContent">主要情况</label>
</mat-expansion-panel-header>
</mat-expansion-panel>
<mat-expansion-panel *ngFor="let items of item.facilityItems" disabled [expanded]=items.expanded>
<mat-expansion-panel-header>
<label class="textContent">
<mat-checkbox [disabled]='items.isBuiltin'></mat-checkbox>
</label>
<label class="textContent">{{items.name}}</label>
<label class="textContent"><a href="javascript:void(0)" (click)='previewImg()'>查看图片</a></label>
<label class="lastTextContent" *ngIf="items.isBuiltin">{{items.details}}</label>
<label class="lastTextContent" *ngIf="!items.isBuiltin">
<input type="text" [(ngModel)]="items.details" style="width: 80%;">
</label>
<label><mat-icon title="切换" (click)='SwitchBoard(items)' *ngIf="items.isBuiltin">radio_button_checked</mat-icon></label>
</mat-expansion-panel-header>
</mat-expansion-panel>
</mat-accordion>
</div>
</div>
<div style="width: 100%;margin-top: 25px;" *ngFor="let item of newItem.buildingOptionalGroups">
<mat-accordion multi>
<mat-expansion-panel>
<mat-expansion-panel-header>
<h3 style="text-align: center;font-weight: 550;">{{item.name}}</h3>
<mat-icon title="保存" style="margin-left: 25px;">description</mat-icon>
</mat-expansion-panel-header>
<div *ngFor="let items of item.propertyInfos" class="InputField">
<label>{{items.propertyName}}:</label>
<input type="text" *ngIf="items.propertyType!=1&&items.propertyType!=2&&items.propertyType!=4&&items.propertyType!=6"
[(ngModel)]="items.propertyValue" name="propertyValue">
<textarea maxlength="250" *ngIf="items.propertyType==1" [(ngModel)]="items.propertyValue" name="propertyValue"></textarea>
<input type="number" *ngIf="items.propertyType==2 ||items.propertyType==4" [(ngModel)]="items.propertyValue" name="propertyValue">
<mat-radio-group *ngIf="items.propertyType==6" [(ngModel)]="items.propertyValue" name="propertyValue">
<mat-radio-button style="margin-left: 5px;" [value]='radio.value' *ngFor="let radio of singleElection">{{radio.name}}</mat-radio-button>
</mat-radio-group>
</div>
</mat-expansion-panel>
</mat-accordion>
</div>
</div>
</mat-tab>
</mat-tab-group>

2
src/app/ui/fire-fighting-device/fire-fighting-device.component.scss

@ -35,6 +35,7 @@
input {
height: 22px;
line-height: 22px;
padding-left: 5px;
border-radius: 3px;
}
@ -45,6 +46,7 @@ input {
label {margin-right: 10px;}
}
textarea {
vertical-align: middle;
border-radius: 5px;
padding: 5px;
width: 300px;

102
src/app/ui/fire-fighting-device/fire-fighting-device.component.ts

@ -7,6 +7,10 @@ import { MatSnackBarConfig, MatSnackBar } from '@angular/material/snack-bar';
export interface Food {
value: string;
name: string;
}
@Component({
selector: 'app-fire-fighting-device',
templateUrl: './fire-fighting-device.component.html',
@ -16,12 +20,16 @@ export class FireFightingDeviceComponent implements OnInit {
constructor(public http: HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar) { }
displayedColumns: string[] = ['checked','project', 'phone', 'mainmsg'];
ngOnInit(): void {
this.getCompanyInformation()
this.getAllBuilding()
}
//定义属性数据
singleElection:Food[]=[
{value:'true', name: '有'},
{value:'false', name: '无'}]
companyBuiltInGrouping:any = []; //单位消防设施内置分组
companyOptionalGrouping:any = []; //单位消防设施可选分组
@ -38,10 +46,8 @@ export class FireFightingDeviceComponent implements OnInit {
element.facilityItems.forEach(elements => {
elements.expanded = false});
});
console.log(this.companyBuiltInGrouping)
console.log(this.companyOptionalGrouping)
})
}
}) //http
} //if
})
}
@ -50,30 +56,36 @@ export class FireFightingDeviceComponent implements OnInit {
let data = e
let dialogRef = this.dialog.open(ImgsDataDetail,{data});
dialogRef.afterClosed().subscribe(data=>{
if (data) {this.editCompanyGrouping(e)} });
if (data && (e.facilityItems.find(item=>item.name==data.name))===undefined) { e.facilityItems.push(data) } });
}
//保存单位消防设施内置分组项
editCompanyGrouping(e) {
let header = {groupId:e.id}
e.facilityItems.forEach((element,index) => {
if (!element.isBuiltin) {
let msg = {
isBuiltin: element.isBuiltin,
details: element.details,
name: element.name,
isEachFloor: element.isEachFloor,
order: element.order}
this.http.post('/api/CompanyAccount/CompanyFacilityItems',msg,{params:header}).subscribe(data=>{
if (index==e.facilityItems.length-1) {
this.getCompanyInformation()
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('数据更新成功','确定',config);}
})
}
});
if (e.facilityItems[e.facilityItems.length-1].isBuiltin) {
this.getCompanyInformation()
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('数据更新成功','确定',config);
} else {
e.facilityItems.forEach((element,index) => {
if (!element.isBuiltin) {
let msg = {
isBuiltin: element.isBuiltin,
details: element.details,
name: element.name,
isEachFloor: element.isEachFloor,
order: element.order}
this.http.post('/api/CompanyAccount/CompanyFacilityItems',msg,{params:header}).subscribe(data=>{
if (index==e.facilityItems.length-1) {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('数据更新成功','确定',config);} })
} //if
}); //forEach
}
}
//checked单位消防设施内置分组项时
@ -93,7 +105,8 @@ export class FireFightingDeviceComponent implements OnInit {
e.selectBuiltInGrouping.forEach((element,index) => {
let msg = {groupId:e.id,name:element.name}
this.http.delete('/api/CompanyAccount/CompanyFacilityItems',{params:msg}).subscribe(data=>{
if (index==e.selectBuiltInGrouping.length-1){this.getCompanyInformation()}})
e.selectBuiltInGrouping.splice(e.selectBuiltInGrouping.findIndex(old=>old===element),1)
e.facilityItems.splice(e.facilityItems.findIndex(old=>old===element),1) })
});
}
} else {
@ -107,7 +120,17 @@ export class FireFightingDeviceComponent implements OnInit {
//保存单位消防设施可选分组
editCompanyOptional (e,item) {
e.stopPropagation() //阻止冒泡
console.log(item)
item.propertyInfos.forEach((element,index) => {
element.propertyValue = String(element.propertyValue)
if (index == item.propertyInfos.length-1 ) {
this.http.post('/api/CompanyAccount/CompanyOptionalGroups',item).subscribe(data=>{
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('数据更新成功','确定',config);
})
} //if
});
}
//切换展开面板
@ -120,8 +143,33 @@ export class FireFightingDeviceComponent implements OnInit {
console.log('IMG')
}
allBuildingGrouping:any; //所有建筑的消防设施 内置分组+可选分组
//获取所有建筑
getAllBuilding () {
this.http.get('/api/CompanyAccount/Buildings').subscribe((data:any)=>{
this.allBuildingGrouping = data
if (this.allBuildingGrouping.length) { this.getAllBuildingFacilities() }
})
}
//获取所有建筑的消防设施
getAllBuildingFacilities () {
this.allBuildingGrouping.forEach(element => {
let header = {buildingId: element.id, buildingType: element.buildingTypes[0].id}
this.http.get('/api/CompanyAccount/BuildingFacilities',{params:header}).subscribe(data=>{
element.buildingFacilityGroups = data[0].summary.buildingFacilityGroups
element.buildingOptionalGroups = data[0].summary.buildingOptionalGroups
element.buildingFacilityGroups.forEach(elements => { //循环每个建筑内置分组项
elements.selectBuiltInGrouping = []
elements.facilityItems.forEach(newElement => { newElement.expanded = false });
});
})
});
}
}

Loading…
Cancel
Save