Browse Source

基本信息功能

非煤矿山灾害智能感知和预警系统
jingbowen 3 years ago
parent
commit
fbdd911c4f
  1. 4
      src/app/home/basic-info/unit-details/unit-details.component.html
  2. 3
      src/app/home/basic-info/unit/unit.component.html
  3. 13
      src/app/home/basic-info/unit/unit.component.ts

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

@ -6,7 +6,7 @@
<!-- <button nz-button nzType="primary">新增建筑</button> <!-- <button nz-button nzType="primary">新增建筑</button>
<button nz-button nzType="primary">查看消防设施统计</button> --> <button nz-button nzType="primary">查看消防设施统计</button> -->
</div> </div>
<div class="button-right"><button nz-button nzType="primary">保存</button></div> <div class="button-right"><button nz-button nzType="primary" (click)="exportClick()">下载</button></div>
</div> </div>
<div class="title">单位信息</div> <div class="title">单位信息</div>
<div class="content" style="display: flex;"> <div class="content" style="display: flex;">
@ -57,7 +57,7 @@
</form> </form>
</div> </div>
<div class="content-right" style="width: 50%;"> <div class="content-right" style="width: 50%;">
<button (click)=" exportClick()">123</button>
</div> </div>
</div> </div>
<div> <div>

3
src/app/home/basic-info/unit/unit.component.html

@ -45,7 +45,7 @@
</div> </div>
<div class="translate"> <div class="translate">
<button nz-button nzType="primary" (click)="addOr()"><i nz-icon nzType="plus-circle" nzTheme="outline"></i>新增</button> <button nz-button nzType="primary" (click)="addOr()"><i nz-icon nzType="plus-circle" nzTheme="outline"></i>新增</button>
<button nz-button nzType="primary"><i nz-icon nzType="edit" nzTheme="outline"></i>修改</button> <!-- <button nz-button nzType="primary"><i nz-icon nzType="edit" nzTheme="outline"></i>修改</button> -->
<button nz-button nzType="primary" nzDanger><i nz-icon nzType="delete" nzTheme="outline"></i>删除</button> <button nz-button nzType="primary" nzDanger><i nz-icon nzType="delete" nzTheme="outline"></i>删除</button>
</div> </div>
<nz-table [nzBordered]="true" #basicTable [nzData]="listOfData"> <nz-table [nzBordered]="true" #basicTable [nzData]="listOfData">
@ -84,6 +84,7 @@
<td>{{ data.state }}</td> <td>{{ data.state }}</td>
<td class="caozuo"> <td class="caozuo">
<span><a [routerLink]="['/basicInfo/unit/details']" routerLinkActive="router-link-active">查看详情</a></span> <span><a [routerLink]="['/basicInfo/unit/details']" routerLinkActive="router-link-active">查看详情</a></span>
<span><a [routerLink]="['/basicInfo/unit/details']" routerLinkActive="router-link-active">修改</a></span>
<span><a>关闭</a></span> <span><a>关闭</a></span>
</td> </td>

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

@ -47,6 +47,7 @@ export class UnitComponent implements OnInit {
this.listOfData = data.items this.listOfData = data.items
this.listOfData = [...this.listOfData] this.listOfData = [...this.listOfData]
console.log(this.listOfData); console.log(this.listOfData);
for (let index = 0; index < this.listOfData.length; index++) { for (let index = 0; index < this.listOfData.length; index++) {
this.listOfData[index].creationTime=this.listOfData[index].creationTime.substring(0,10) this.listOfData[index].creationTime=this.listOfData[index].creationTime.substring(0,10)
@ -60,6 +61,7 @@ export class UnitComponent implements OnInit {
} }
addOr(node?: any) { addOr(node?: any) {
console.log(node);
const modal = this.modal.create({ const modal = this.modal.create({
nzTitle: "新增单位", nzTitle: "新增单位",
@ -71,7 +73,7 @@ export class UnitComponent implements OnInit {
console.log(instance.validateForm); console.log(instance.validateForm);
if (instance.validateForm.valid) { if (instance.validateForm.valid) {
console.log(instance.validateForm); console.log(instance.validateForm);
// return return
await new Promise(resolve => { await new Promise(resolve => {
let body = { let body = {
companyName: instance.validateForm.value.unit, companyName: instance.validateForm.value.unit,
@ -86,12 +88,15 @@ export class UnitComponent implements OnInit {
} }
this.http.post('/api/Companies', body).subscribe({ this.http.post('/api/Companies', body).subscribe({
next: (data: any) => { next: (data: any) => {
console.log(data, 80808) this.message.create('success', '编辑成功!');
modal.destroy()
this.getCompanies()
return true
}, },
error: (err) => { error: (err) => {
console.log(err) console.log(err)
this.message.create('warning', '创建失败');
return false
} }
} }

Loading…
Cancel
Save