上海预案管理平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

432 lines
30 KiB

<div style="height: 100%;display: flex; flex-direction: column;overflow: hidden;">
<!-- header -->
<mat-accordion id="unitBasicInfo">
<mat-expansion-panel expanded>
<mat-expansion-panel-header style="color: black;">
<mat-panel-title>
单位信息
</mat-panel-title>
<button type="button" color="primary" mat-button mat-raised-button
style="height: 35px; margin-right: 25px;" (click)="seeFirfightingDevice($event)">查看消防设施统计</button>
</mat-expansion-panel-header>
<div class="topbox">
<form (ngSubmit)="onSubmit(form.value,form.invalid,form)" #form="ngForm" class="example-container">
<div class="mainbox">
<div class="mainleft">
<div class="inputbox">
<span style="color: red;">*</span>
<span>统一社会信用代码:</span>
<mat-form-field>
<input matInput id="creditcode" name="creditcode" type='text' #usci="ngModel"
required minlength="1" maxlength="18" [(ngModel)]="unitinfo.usci"
(focus)="closeorganizationbox()"
pattern="^[0-9A-HJ-NP-RTUW-Y]{2}\d{6}[0-9A-HJ-NP-RTUW-Y]{10}$">
</mat-form-field>
<div *ngIf="usci.invalid && (usci.dirty || usci.touched)" class="alert-danger">
<div *ngIf="usci.errors.pattern" class="alert-danger">
统一社会信用代码格式不正确
</div>
</div>
</div>
<div class="inputbox">
<span style="color: red;">*</span>
<span>单位类型:</span>
<mat-form-field (click)="closeorganizationbox()">
<mat-select required name="unittype" [(ngModel)]="defaultbuildingTypes">
<mat-option [value]="item.id" *ngFor="let item of allunittype">{{item.name}}
</mat-option>
</mat-select>
</mat-form-field>
</div>
<div class="inputbox">
<span style="color: red;">*</span>
<span>联系人:</span>
<mat-form-field>
<input matInput id="linkman" name="linkman" type='text' required minlength="1"
[(ngModel)]="unitinfo.contacts" (focus)="closeorganizationbox()">
</mat-form-field>
</div>
<div class="inputbox">
<span style="color: red;">*</span>
<span>联系电话:</span>
<mat-form-field>
<input matInput id="linkphone" name="linkphone" type='text' #linkphone="ngModel"
required
pattern="^(?:\+?86)?1(?:3\d{3}|5[^4\D]\d{2}|8\d{3}|7(?:[35-8]\d{2}|4(?:0\d|1[0-2]|9\d))|9[0135-9]\d{2}|66\d{2})\d{6}$"
[(ngModel)]="unitinfo.phone" (focus)="closeorganizationbox()">
</mat-form-field>
<div *ngIf="linkphone.invalid && (linkphone.dirty || linkphone.touched)"
class="alert-danger">
<div *ngIf="linkphone.errors.pattern" class="alert-danger">
电话号码格式不正确
</div>
</div>
</div>
<div class="inputbox longinputbox">
<span style="color: red;">*</span>
<span>辖区中队:</span>
<mat-form-field class="longInput">
<input matInput id="organization" name="organization" type='text' required
minlength="1" [(ngModel)]="selectedorganization" (focus)="openorganizationbox()"
readonly="value">
</mat-form-field>
</div>
<div id="organizationbox" class="organizationbox" *ngIf="isorganizationbox">
<mat-tree [dataSource]="dataSource" [treeControl]="treeControl">
<mat-tree-node *matTreeNodeDef="let node" matTreeNodePadding (click)='add(node)'
class="organizationlist">
<button type="button" mat-icon-button disabled></button>
<li>{{node.name}}</li>
</mat-tree-node>
<mat-tree-node *matTreeNodeDef="let node;when: hasChild" matTreeNodePadding
(click)='add(node)' class="organizationlist">
<button type="button" mat-icon-button matTreeNodeToggle
[attr.aria-label]="'toggle ' + node.name">
<mat-icon class="mat-icon-rtl-mirror">
{{treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right'}}
</mat-icon>
</button>
<li>{{node.name}}</li>
</mat-tree-node>
</mat-tree>
</div>
<div class="inputbox longinputbox">
<span style="color: red;">*</span>
<span>单位地址:</span>
<mat-form-field class="longInput">
<input matInput id="unitaddress" name="unitaddress" type='text' required
minlength="1" [(ngModel)]="unitinfo.address" (focus)="closeorganizationbox()">
</mat-form-field>
</div>
<div class="uploadimg">
<span>单位照片:</span>
<div class="uploadingimg" id="viewerjs">
<img [src]="imgsrc ? imgsrc : noImg"
[attr.data-original]="imgsrc ? imgsrc.split('?')[0] : noImg">
</div>
<mat-spinner *ngIf="isspinner" diameter=50></mat-spinner>
</div>
<div class="image">
<input id="selectedfile" type="file" ng2FileSelect [uploader]="uploader"
(change)="filechange($event)" name="imgFile" accept=".jpg,.png,.jpeg">
<button type="submit" color="primary" class="submit1 sub1" mat-button
mat-raised-button>保存</button>
</div>
<div class="addbtn" class="sub2">
<button type="submit" color="primary" class="submit1" mat-button
mat-raised-button>保存</button>
</div>
</div>
<div class="mainright" id="setUnitPosition">
<div style="width: 100%;height: 100%;" id="container">
</div>
<div class="gistopbox" *ngIf="isGisTopBox">
<div class="positionItem">
<span>
经度 :
</span>
<div class="itemNum">
{{markerPosition.x || '暂未标注'}}
</div>
</div>
<div class="positionItem">
<span>
纬度 :
</span>
<div class="itemNum">
{{markerPosition.y || '暂未标注'}}
</div>
</div>
<div class="setPosition" (click)="setPosition()">
<mat-icon style="width: 22px;height: 22px;font-size: 22px;">place</mat-icon> 位置
</div>
</div>
<div class="gistopbox hidden" [ngClass]="{'show': isGisTopBoxTwo}">
<div class="inputBox">
<span>位置: </span>
<input name="position" [(ngModel)]="searchTitle" id="tipinput" class="positionInput"
type="text" autocomplete="off">
</div>
<div class="setPosition" (click)="search()">
搜索
</div>
</div>
</div>
</div>
</form>
</div>
</mat-expansion-panel>
</mat-accordion>
<!-- body -->
<div class="bodyBox" id="basicInfoBody">
<div>
<button type="button" mat-icon-button (click)="addhouseinfo()" class="addBuilding">
<mat-icon>add_circle_outline</mat-icon>
</button>
</div>
<div style="height: 100%; box-sizing:border-box;overflow-y: auto;padding-left: 26px;">
<mat-tab-group style="height: 100%;" [selectedIndex]="selectedIndex"
(selectedTabChange)="selectedTabChange($event)">
<mat-tab *ngFor="let item of houses;let key = index" label="{{item.name}}">
<ng-template matTabContent>
<form *ngIf="item.data && item.data.length!=0"
style="height: 100%; overflow-y:auto; display: block;"
(ngSubmit)="onSubmitBuildingInfo(form.value,item,key,form.invalid)" #form="ngForm"
class="example-container">
<div class="buildInfoInput marginLeft">
<span>建筑名称:</span>
<mat-form-field>
<input required matInput name="buildingName" type='text' minlength="1"
[(ngModel)]="item.name">
</mat-form-field>
<span style="color: red;">*</span>
</div>
<div class="buildInfoInput marginLeft">
<span>建筑类型:</span>
<mat-form-field>
<mat-select name="buildingTypeName" [(ngModel)]="item.buildingTypes[0].name">
<mat-option [value]="n.name" *ngFor="let n of allunittype"
(click)="templateBuildtype(n,item,key)">{{n.name}}</mat-option>
</mat-select>
</mat-form-field>
<span style="color: red;">*</span>
</div>
<div *ngFor="let element of item.data[0].buildingBasicGroups;let groupsIndex = index "
style="float: left;width:100%">
<!-- 类型为表单并且不是 罐区 -->
<div *ngIf="element.type == 0 && element.name.indexOf('罐区') == -1">
<p style="font-size: 22px;">{{element.name}}</p>
<div class="buildInfoInput marginLeft"
*ngFor="let i of element.propertyInfos;let inputIndex = index"
style="float: left;position: relative;">
<span>{{i.propertyName}}<span
*ngIf="i.physicalUnit">({{i.physicalUnit}})</span></span>
<!-- 如果类型是文本 -->
<mat-form-field *ngIf="i.propertyType == 0 && i.propertyName != '耐火等级'">
<input matInput name="{{groupsIndex}}{{inputIndex}}" type='text'
required="{{ i.required==true ? 'true' : 'false' }}"
[(ngModel)]="i.propertyValue">
</mat-form-field>
<!-- 如果类型是数字 -->
<mat-form-field *ngIf="i.propertyType == 2 && i.propertyName != '耐火等级'">
<input matInput name="{{groupsIndex}}{{inputIndex}}" type='number'
required="{{ i.required==true ? 'true' : 'false' }}"
[(ngModel)]="i.propertyValue"
(change)="inputchange($event,i.ruleName,i.ruleValue,i)">
</mat-form-field>
<!-- 如果类型是耐火等级 -->
<mat-form-field *ngIf="i.propertyName == '耐火等级'">
<mat-select name="{{groupsIndex}}{{inputIndex}}"
required="{{ i.required==true ? 'true' : 'false' }}"
placeholder="请选择耐火等级" [(ngModel)]="i.propertyValue">
<mat-option value="0">1级</mat-option>
<mat-option value="1">2级</mat-option>
<mat-option value="2">3级</mat-option>
<mat-option value="3">其它</mat-option>
</mat-select>
</mat-form-field>
<!-- 如果类型是多行文本 -->
<textarea *ngIf="i.propertyType == 1 && i.propertyName != '耐火等级'"
style="width: 180px;height: 60px;"
required="{{ i.required==true ? 'true' : 'false' }}"
[(ngModel)]="i.propertyValue"
name="{{groupsIndex}}{{inputIndex}}"></textarea>
<span style="color: red;" *ngIf="i.required">*</span>
<div *ngIf="i.isshowrule"
style="position: absolute;left: 205px;top: 45px;font-size: 11px;color: red;">
<span>{{i.rulevalue}}</span>
</div>
</div>
</div>
<!-- 类型为表格 并且不是 罐区 -->
<div *ngIf="element.type == 1 && element.name.indexOf('罐区') == -1">
<p style="font-size: 22px;">
<mat-checkbox color="primary" (change)="checkboxChange(element,$event,item)"
*ngIf="element.isOptional" [name]="element.name"
[(ngModel)]="element.submitted" style="float: left;margin-right: 10px;">
</mat-checkbox>
{{element.name}}
</p>
<table *ngIf="element.submitted">
<tr>
<th *ngFor="let item of element.propertyInfos[0].origin;let index = index">
<button *ngIf="index == 0" style="width: 24px;" type="button"
mat-icon-button class="addline"
(click)="addline(element.propertyInfos)">
<mat-icon>add_circle_outline</mat-icon>
</button>
<button *ngIf="index == 0" style="width: 24px;" type="button"
mat-icon-button class="removeline"
(click)="removeline(element.propertyInfos)">
<mat-icon>remove_circle_outline</mat-icon>
</button>
{{item.propertyName}}
<span style="color: red;" *ngIf="item.required">*</span>
</th>
</tr>
<tr *ngFor="let item of element.propertyInfos;let line = index">
<td *ngFor="let i of item.origin;let list = index">
<input *ngIf="i.propertyType != 1" style="height:45px" class="tankinfo"
name="{{element.name}}{{line + 1}}-{{list + 1}}"
type="{{i.propertyType == 0 ? 'text' : 'number'}}"
required="{{ i.required==true ? 'true' : 'false' }}"
[(ngModel)]="i.propertyValue">
<textarea class="tankinfo" *ngIf="i.propertyType == 1"
required="{{ i.required==true ? 'true' : 'false' }}"
[(ngModel)]="i.propertyValue"
name="{{element.name}}{{line + 1}}{{list + 1}}">
</textarea>
</td>
</tr>
</table>
</div>
<!-- 类型为表单 是罐区-->
<div *ngIf="element.type == 0 && element.name.indexOf('罐区') != -1">
<p style="font-size: 22px;">
<mat-checkbox color="primary" (change)="checkboxChange(element,$event,item)"
*ngIf="element.isOptional && element.name == '罐区1'" [name]="element.name"
[(ngModel)]="element.submitted" style="float: left;margin-right: 10px;">
</mat-checkbox>
<span *ngIf="element.name == '罐区1'">罐区信息</span>
</p>
<div *ngIf="element.submitted">
<p *ngIf="element.name == '罐区1'" style="margin: 5px 0;">
<button type="button" mat-raised-button color="primary"
(click)="addTankBox(item,groupsIndex)"
style="margin-right: 5px;">添加罐区</button>
<button type="button" mat-raised-button color="warn"
(click)="removeTankBox(item,groupsIndex)"
matTooltip="会将此建筑处于末尾的罐区移除">移除末尾罐区</button>
</p>
<p style="font-size: 22px;">{{element.name}}</p>
<div class="buildInfoInput marginLeft"
*ngFor="let i of element.propertyInfos;let inputIndex = index"
style="float: left;position: relative;">
<span>{{i.propertyName}}<span
*ngIf="i.physicalUnit">({{i.physicalUnit}})</span></span>
<!-- 如果类型是文本 -->
<mat-form-field *ngIf="i.propertyType == 0 && i.propertyName != '耐火等级'">
<input matInput name="{{groupsIndex}}{{inputIndex}}" type='text'
required="{{ i.required==true ? 'true' : 'false' }}"
[(ngModel)]="i.propertyValue">
</mat-form-field>
<!-- 如果类型是数字 -->
<mat-form-field *ngIf="i.propertyType == 2 && i.propertyName != '耐火等级'">
<input matInput name="{{groupsIndex}}{{inputIndex}}" type='number'
required="{{ i.required==true ? 'true' : 'false' }}"
[(ngModel)]="i.propertyValue"
(change)="inputchange($event,i.ruleName,i.ruleValue,i)">
</mat-form-field>
<!-- 如果类型是耐火等级 -->
<mat-form-field *ngIf="i.propertyName == '耐火等级'">
<mat-select name="{{groupsIndex}}{{inputIndex}}"
required="{{ i.required==true ? 'true' : 'false' }}"
placeholder="请选择耐火等级" [(ngModel)]="i.propertyValue">
<mat-option value="0">1级</mat-option>
<mat-option value="1">2级</mat-option>
<mat-option value="2">3级</mat-option>
<mat-option value="3">其它</mat-option>
</mat-select>
</mat-form-field>
<!-- 如果类型是多行文本 -->
<textarea *ngIf="i.propertyType == 1 && i.propertyName != '耐火等级'"
style="width: 180px;height: 60px;"
required="{{ i.required==true ? 'true' : 'false' }}"
[(ngModel)]="i.propertyValue"
name="{{groupsIndex}}{{inputIndex}}"></textarea>
<span style="color: red;" *ngIf="i.required">*</span>
<div *ngIf="i.isshowrule"
style="position: absolute;left: 205px;top: 45px;font-size: 11px;color: red;">
<span>{{i.rulevalue}}</span>
</div>
</div>
</div>
</div>
<!-- 类型为表格 是罐区 -->
<div *ngIf="element.type == 1 && element.name.indexOf('罐区') != -1">
<p style="font-size: 22px;" *ngIf="element.submitted">
{{element.name}}
</p>
<table *ngIf="element.submitted">
<tr>
<th *ngFor="let item of element.propertyInfos[0].origin;let index = index">
<button *ngIf="index == 0" style="width: 24px;" type="button"
mat-icon-button class="addline"
(click)="addline(element.propertyInfos)">
<mat-icon>add_circle_outline</mat-icon>
</button>
<button *ngIf="index == 0" style="width: 24px;" type="button"
mat-icon-button class="removeline"
(click)="removeline(element.propertyInfos)">
<mat-icon>remove_circle_outline</mat-icon>
</button>
{{item.propertyName}}
<span style="color: red;" *ngIf="item.required">*</span>
</th>
</tr>
<tr *ngFor="let item of element.propertyInfos;let line = index">
<td *ngFor="let i of item.origin;let list = index">
<input type="{{i.propertyType == 0 ? 'text' : 'number'}}"
style="height:45px" class="tankinfo"
name="{{element.name}}{{line + 1}}-{{list + 1}}"
required="{{ i.required==true ? 'true' : 'false' }}"
[(ngModel)]="i.propertyValue">
</td>
</tr>
</table>
</div>
</div>
<div class="CustomData" style="width: 200px;margin-top: 60px;">
<mat-checkbox color="primary" (change)="checkCustomData($event)" name="checkbuilding"
[(ngModel)]="item.isCustomData" style="float: left;margin-right: 10px;">
</mat-checkbox>
<h1 style="font-size: 22px;width: 200px;">自定义信息</h1>
</div>
<div style="position: relative;" *ngIf="item.isCustomData">
<button style="position: absolute;left: 80px;top: 8px;" type="button" mat-icon-button
(click)="addCustomData(item)" class="addCustomData">
<mat-icon>add_circle_outline</mat-icon>
</button>
<button style="position: absolute;left:120px;top: 8px;" type="button" mat-icon-button
(click)="popCustomData(item)" class="deleteCustomData">
<mat-icon>remove_circle_outline</mat-icon>
</button>
<div class="houseinfoinput marginLeft" style="float: left;"
*ngFor="let i of item.customData.customProperties;let key = index">
<mat-form-field>
<input matInput type='text' name="customData{{key}}Name" required
[(ngModel)]="i.name">
</mat-form-field>
<span>:</span>
<mat-form-field>
<input matInput type='text' name="customData{{key}}Value" required
[(ngModel)]="i.value">
</mat-form-field>
<span style="color: red;" *ngIf="i.required">*</span>
</div>
</div>
<div class="infobtnbox">
<button type="submit" mat-button mat-raised-button color="primary">保存</button>
<button type="button" mat-raised-button (click)="deletedbuilding(item,key)"
color="warn">删除</button>
</div>
</form>
</ng-template>
</mat-tab>
</mat-tab-group>
</div>
</div>
</div>