Browse Source

word数据

非煤矿山灾害智能感知和预警系统
jingbowen 3 years ago
parent
commit
c24dd392d5
  1. 4
      proxy.config.json
  2. 8
      src/app/home/basic-info/add-unit/add-unit.component.html
  3. 11
      src/app/home/basic-info/add-unit/add-unit.component.ts
  4. 24
      src/app/home/basic-info/unit-details/unit-details.component.html
  5. 50
      src/app/home/basic-info/unit-details/unit-details.component.ts
  6. 32
      src/app/home/basic-info/unit/unit.component.ts

4
proxy.config.json

@ -1,11 +1,11 @@
{
"/api": {
"target": "http://39.106.78.171:8920",
"target": "https://121.36.37.70:8204",
"secure": false,
"changeOrigin": true
},
"/signalr": {
"target": "http://39.106.78.171:8920",
"target": "https://121.36.37.70:8204",
"secure": false,
"ws": true,
"logLevel": "debug"

8
src/app/home/basic-info/add-unit/add-unit.component.html

@ -37,7 +37,7 @@
<nz-form-item>
<nz-form-label nzRequired [nzSm]="7" [nzXs]="24" nzFor="所属救援站">所属救援站</nz-form-label>
<nz-form-control>
<nz-select formControlName="role2" nzPlaceHolder="请选择所属救援站" nzMode="multiple">
<nz-select formControlName="role" nzPlaceHolder="请选择所属救援站" nzMode="multiple">
<nz-option *ngFor="let item of listOfData2" [nzValue]="item.normalizedName" [nzLabel]="item.displayName">
</nz-option>
</nz-select>
@ -46,7 +46,7 @@
<nz-form-item >
<nz-form-label [nzSm]="7" [nzXs]="24" nzFor="所属大队">所属大队</nz-form-label>
<nz-form-control>
<nz-select formControlName="role3" nzPlaceHolder="请选择所属大队" nzMode="multiple">
<nz-select formControlName="role2" nzPlaceHolder="请选择所属大队" nzMode="multiple">
<nz-option *ngFor="let item of listOfData2" [nzValue]="item.normalizedName" [nzLabel]="item.displayName">
</nz-option>
</nz-select>
@ -55,7 +55,7 @@
<nz-form-item>
<nz-form-label nzRequired [nzSm]="7" [nzXs]="24" nzFor="使用性质">使用性质</nz-form-label>
<nz-form-control>
<nz-select formControlName="role4" nzPlaceHolder="请选择使用性质" nzMode="multiple">
<nz-select formControlName="role3" nzPlaceHolder="请选择使用性质" nzMode="multiple">
<nz-option *ngFor="let item of listOfData2" [nzValue]="item.normalizedName" [nzLabel]="item.displayName">
</nz-option>
</nz-select>
@ -64,7 +64,7 @@
<nz-form-item>
<nz-form-label [nzSm]="7" [nzXs]="24" nzFor="建筑类型">建筑类型</nz-form-label>
<nz-form-control>
<nz-select formControlName="role5" nzPlaceHolder="请选择建筑类型" nzMode="multiple">
<nz-select formControlName="role4" nzPlaceHolder="请选择建筑类型" nzMode="multiple">
<nz-option *ngFor="let item of listOfData2" [nzValue]="item.normalizedName" [nzLabel]="item.displayName">
</nz-option>
</nz-select>

11
src/app/home/basic-info/add-unit/add-unit.component.ts

@ -19,15 +19,14 @@ export class AddUnitComponent implements OnInit {
ngOnInit(): void {
this.validateForm = this.fb.group({
unit: [null, [Validators.required]],
name: [null, [Validators.required]],
iphone: [null, [Validators.required]],
addr: [null, [Validators.required]],
role: [[], [Validators.required]],
name: [null],
iphone: [null],
addr: [null],
role: [[]],
role2: [[]],
role3: [[]],
role4: [[]],
role5: [[]],
phonenum: [null, [Validators.required]]
phonenum: [null]
});
}

24
src/app/home/basic-info/unit-details/unit-details.component.html

@ -43,7 +43,7 @@
<nz-form-item>
<nz-form-label [nzSpan]="7" nzRequired>建筑类型</nz-form-label>
<nz-form-control [nzSpan]="12" nzHasFeedback nzErrorTip="Please input your password!">
<input nz-input type="password" formControlName="password" (ngModelChange)="validateConfirmPassword()" />
<input nz-input type="password" formControlName="passwor " (ngModelChange)="validateConfirmPassword()" />
</nz-form-control>
</nz-form-item>
@ -62,7 +62,7 @@
</div>
<div>
<div class="aaaa" #box>
<table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin: 0 auto; width:488.45pt">
<table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin: 0 auto; ">
<tr style="height:18.4pt">
<td colspan="20"
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:1pt; padding-left:5.4pt; padding-right:5.4pt; vertical-align:middle; width:477.65pt">
@ -210,12 +210,12 @@
<td
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; padding-left:5.4pt; padding-right:5.03pt; vertical-align:middle; width:48.95pt">
<p style="line-height:12pt; margin:0pt; orphans:0; text-align:center; widows:0"><span
style="font-family:宋体; font-size:9pt">辖区中队行驶路线及时间</span></p>
style="font-family:宋体; font-size:9pt; word-break: break-all; width: 70px;">辖区中队行驶路线及时间</span></p>
</td>
<td colspan="18"
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:1pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.4pt; padding-right:4.9pt; vertical-align:middle; width:377.05pt">
<p style="line-height:12pt; margin:0pt; orphans:0; text-align:center; widows:0"><span
style="font-family:宋体; font-size:9pt"><textarea type="text"></textarea></span></p>
style="font-family:宋体; font-size:9pt"><textarea style="width: 400px; height: 100px;" type="text"></textarea></span></p>
</td>
</tr>
<tr style="height:22.3pt">
@ -236,7 +236,7 @@
</td>
<td colspan="17"
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:1pt; padding-left:5.4pt; padding-right:4.9pt; vertical-align:middle; width:330.8pt">
<p style="margin:0pt; text-align:center"><span style="font-family:宋体; font-size:9pt"></span></p>
<p style="margin:0pt; text-align:center"><span style="font-family:宋体; font-size:9pt"><input style="width: 200px;" nz-input type="text"></span></p>
</td>
</tr>
<tr style="height:22.3pt">
@ -278,8 +278,7 @@
<td
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; padding-left:5.4pt; padding-right:5.03pt; vertical-align:middle; width:28.65pt">
<p style="line-height:12pt; margin:0pt; orphans:0; text-align:center; widows:0"><span
style="font-family:宋体; font-size:9pt">补给</span><br /><span
style="font-family:宋体; font-size:9pt">方式</span></p>
style="font-family:宋体; font-size:9pt">补给方式</span></p>
</td>
<td
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:1pt; padding-left:5.4pt; padding-right:4.9pt; vertical-align:middle; width:26.15pt">
@ -296,7 +295,7 @@
<td colspan="10"
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.4pt; padding-right:5.03pt; vertical-align:middle; width:153.1pt">
<p style="line-height:12pt; margin:0pt; orphans:0; text-align:center; widows:0"><span
style="font-family:'Times New Roman'; font-size:9pt">&#xa0;</span></p>
style="font-family:'Times New Roman'; font-size:9pt"><input nz-input style="width:120px" type="text"></span></p>
</td>
<td colspan="3"
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; padding-left:5.4pt; padding-right:5.03pt; vertical-align:middle; width:43.15pt">
@ -306,7 +305,7 @@
<td colspan="4"
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:1pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.4pt; padding-right:4.9pt; vertical-align:middle; width:112.95pt">
<p style="line-height:12pt; margin:0pt; orphans:0; text-align:center; widows:0"><span
style="font-family:'Times New Roman'; font-size:9pt">&#xa0;</span></p>
style="font-family:'Times New Roman'; font-size:9pt"><input nz-input style="width:140px" type="text"></span></p>
</td>
</tr>
<tr style="height:29.5pt">
@ -318,11 +317,12 @@
</td>
<td
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; padding-left:5.4pt; padding-right:5.03pt; vertical-align:middle; width:35.45pt">
<p style="line-height:12pt; margin:0pt; orphans:0; text-align:center; widows:0"><span
style="font-family:宋体; font-size:9pt">有(</span><span
<p style="line-height:12pt; margin:0pt; orphans:0; text-align:center; widows:0">
<!-- <span style="font-family:宋体; font-size:9pt">有(</span><span
style="font-family:宋体; font-size:9pt">)</span><br /><span
style="font-family:宋体; font-size:9pt">无(</span><span style="font-family:宋体; font-size:9pt"></span><span
style="font-family:宋体; font-size:9pt">)</span></p>
style="font-family:宋体; font-size:9pt">)</span></p> -->
<label nz-checkbox [(ngModel)]="datas.facilities.alarm">有无</label>
</td>
<td colspan="3"
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; padding-left:5.4pt; padding-right:5.03pt; vertical-align:middle; width:54.8pt">

50
src/app/home/basic-info/unit-details/unit-details.component.ts

@ -1,4 +1,4 @@
import { Component, Renderer2, OnDestroy, AfterViewInit,ElementRef, OnInit,ViewChild } from '@angular/core';
import { Component, Renderer2, OnDestroy, AfterViewInit, ElementRef, OnInit, ViewChild } from '@angular/core';
import { CustomReuseStrategy } from 'src/app/CustomReuseStrategy';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { asBlob } from 'html-docx-js-typescript'
@ -12,7 +12,7 @@ import { saveAs } from 'file-saver'
export class UnitDetailsComponent implements OnInit {
@ViewChild('box') box: ElementRef;
constructor(private fb: FormBuilder,private renderer: Renderer2,private el: ElementRef) {
constructor(private fb: FormBuilder, private renderer: Renderer2, private el: ElementRef) {
this.validateForm = this.fb.group({
userName: [''],
email: [''],
@ -21,9 +21,45 @@ export class UnitDetailsComponent implements OnInit {
comment: ['']
});
}
aaa="山东小满园"
datas: {
basicInfo: {
name: "",
addr: "",
phone: "",
total: "",
height: "",
layer: "",
structure:"",
coveredArea:"",
builtUpArea:"",
nature:"",
east:"",
south:"",
west:"",
north:"",
routeAndTime:"",
},
facilities:{
controlPosition:"",
poolNumbe:"",
poolPosition:"",
poolCapacity:"",
supplyMode:"",
waterSources:"",
waterSourcesPosition:"",
alarm:false,
}
}
aaa = "山东小满园"
validateForm!: FormGroup;
ngOnInit(): void {
setTimeout(() => {
console.log(666,this.datas);
}, 0);
}
submitForm(value: { userName: string; email: string; password: string; confirm: string; comment: string }): void {
for (const key in this.validateForm.controls) {
@ -54,13 +90,13 @@ export class UnitDetailsComponent implements OnInit {
<title>Document</title>
</head>
<body>
`+this.box.nativeElement.innerHTML+`
`+ this.box.nativeElement.innerHTML + `
</body>
</html>`
const fileData = asBlob(htmlString).then((data:any) => {
const fileData = asBlob(htmlString).then((data: any) => {
saveAs(data, 'file.docx') // 保存为docx文件
})
})
}
back() {

32
src/app/home/basic-info/unit/unit.component.ts

@ -55,11 +55,7 @@ export class UnitComponent implements OnInit {
});
this.http.get('/api/Companies').subscribe((data: any) => {
console.log(data);
})
}
constructor(private router: Router,private fb: FormBuilder, private http: HttpClient, private toTree: TreeService, private modal: NzModalService, private message: NzMessageService, private viewContainerRef: ViewContainerRef) { }
@ -81,8 +77,34 @@ export class UnitComponent implements OnInit {
nzWidth: 450,
nzComponentParams: {},
nzOnOk: async () => {
console.log(instance.validateForm);
if (instance.validateForm.valid) {
console.log(1);
console.log(instance.validateForm);
// return
await new Promise(resolve => {
let body = {
companyName: instance.validateForm.value.unit,
directorName: instance.validateForm.value.name,
directorPhone: instance.validateForm.value.iphone,
address:instance.validateForm.value.addr,
organizationId:instance.validateForm.value.role.id || 0,
relatedOrganizationId:instance.validateForm.value.role2.id || 0,
buildingTypeId:instance.validateForm.value.role3.id || 0,
useNature:instance.validateForm.value.role4.id || 0,
}
this.http.post('/api/Companies', body).subscribe({
next: (data: any) => {
console.log(data,80808)
},
error: (err) => {
console.log(err)
}
}
)
})
} else {
this.message.create('warning', '请填写完整!');

Loading…
Cancel
Save