|
@@ -2,10 +2,12 @@ import { Component, OnInit, ViewChild, TemplateRef } from '@angular/core';
|
|
|
import { _HttpClient, ModalHelper } from '@delon/theme';
|
|
|
import { STColumn, STComponent } from '@delon/abc';
|
|
|
import { SFSchema } from '@delon/form';
|
|
|
-import { NzDropdownService, NzModalService, NzDropdownContextComponent, NzTreeNode, NzFormatEmitEvent } from 'ng-zorro-antd';
|
|
|
+import { NzDropdownService, NzModalService, NzDropdownContextComponent, NzTreeNode, NzFormatEmitEvent, NzNotificationService } from 'ng-zorro-antd';
|
|
|
import { FormBuilder, Validators, FormGroup } from '@angular/forms';
|
|
|
import { BaseArchivesProjectApproval } from 'app/entity/basedata/base-archives-project-approval';
|
|
|
import { BasedataProjectApprovalAddComponent } from './add/add.component';
|
|
|
+import { BaseArchivesProjectApprovalService } from 'app/services/basedata/base-archives-project-approval.service';
|
|
|
+import { I18NService } from '@core';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-basedata-project-approval',
|
|
@@ -16,7 +18,10 @@ export class BasedataProjectApprovalComponent implements OnInit {
|
|
|
constructor(
|
|
|
private nzDropdownService: NzDropdownService,
|
|
|
private modalService:NzModalService,
|
|
|
- private fb: FormBuilder
|
|
|
+ private fb: FormBuilder,
|
|
|
+ private baseArchivesProjectApprovalService:BaseArchivesProjectApprovalService,
|
|
|
+ private nzNotificationService:NzNotificationService,
|
|
|
+ private i18NService:I18NService
|
|
|
) { }
|
|
|
|
|
|
ngOnInit() {
|
|
@@ -40,35 +45,11 @@ export class BasedataProjectApprovalComponent implements OnInit {
|
|
|
// this.contractClassService.getAllContractClass1().then((response) => {
|
|
|
// this.nodes = response.result
|
|
|
// })
|
|
|
- this.nodes=[
|
|
|
- {
|
|
|
- code: "001",
|
|
|
- createBy: "admin",
|
|
|
- createTime: "2019-05-17 12:01:32",
|
|
|
- isLeaf: false,
|
|
|
- key: "604d450067afc7b7f52a8987d60bd745",
|
|
|
- parentId: "",
|
|
|
- parentIds: null,
|
|
|
- title: "产品",
|
|
|
- value: "604d450067afc7b7f52a8987d60bd745",
|
|
|
- status:"1",
|
|
|
- children:[
|
|
|
- {
|
|
|
- code: "0001",
|
|
|
- createBy: "admin",
|
|
|
- createTime: "2019-05-17 12:01:32",
|
|
|
- isLeaf: true,
|
|
|
- key: "2",
|
|
|
- parentId: "604d450067afc7b7f52a8987d60bd745",
|
|
|
- parentIds: null,
|
|
|
- title: "架构",
|
|
|
- value: "2",
|
|
|
- status:"0",
|
|
|
- children:null
|
|
|
- }
|
|
|
- ]
|
|
|
- }
|
|
|
- ]
|
|
|
+ let baseArchivesProjectApproval=new BaseArchivesProjectApproval();
|
|
|
+ baseArchivesProjectApproval.pkOrg=sessionStorage.getItem("pkOrg");
|
|
|
+ this.baseArchivesProjectApprovalService.getTreeList(baseArchivesProjectApproval).then((response)=>{
|
|
|
+ this.nodes=response.result;
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
//双击节点自动打开树分支
|
|
@@ -99,10 +80,12 @@ export class BasedataProjectApprovalComponent implements OnInit {
|
|
|
}else{
|
|
|
this.status=true;
|
|
|
}
|
|
|
+ //赋值给修改表单
|
|
|
this.baseArchivesProjectApproval = {
|
|
|
name: getdDepart.title,
|
|
|
code: getdDepart.code,
|
|
|
- id: getdDepart.key
|
|
|
+ id: getdDepart.key,
|
|
|
+ parentId:getdDepart.parentId
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -137,7 +120,9 @@ export class BasedataProjectApprovalComponent implements OnInit {
|
|
|
type: "primary",
|
|
|
// loading:this.modelSaveLoading,
|
|
|
onClick: addModel => {
|
|
|
- addModel.submitForm()
|
|
|
+ addModel.submitForm().then(()=>{
|
|
|
+ this.getListContractTree();
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
]
|
|
@@ -168,7 +153,9 @@ export class BasedataProjectApprovalComponent implements OnInit {
|
|
|
type: "primary",
|
|
|
// loading:this.modelSaveLoading,
|
|
|
onClick: addModel => {
|
|
|
- addModel.submitForm()
|
|
|
+ addModel.submitForm().then(()=>{
|
|
|
+ this.getListContractTree();
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
]
|
|
@@ -183,7 +170,19 @@ export class BasedataProjectApprovalComponent implements OnInit {
|
|
|
* 删除
|
|
|
*/
|
|
|
delete(){
|
|
|
-
|
|
|
+ let baseArchivesProjectApproval=new BaseArchivesProjectApproval();
|
|
|
+ baseArchivesProjectApproval.id=this.id;
|
|
|
+ this.baseArchivesProjectApprovalService.delete(baseArchivesProjectApproval).then((response)=>{
|
|
|
+ if (response.success) {
|
|
|
+ //删除成功
|
|
|
+ this.nzNotificationService.success(this.i18NService.fanyi('successful.deletion'), '');
|
|
|
+ this.dropdown.close()
|
|
|
+ this.getListContractTree();
|
|
|
+ } else {
|
|
|
+ //删除失败
|
|
|
+ this.nzNotificationService.error(this.i18NService.fanyi('delete.failed'), '');
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
/**
|
|
|
* 修改保存
|
|
@@ -201,7 +200,16 @@ export class BasedataProjectApprovalComponent implements OnInit {
|
|
|
}else{
|
|
|
this.baseArchivesProjectApproval.status="0"
|
|
|
}
|
|
|
- alert(this.baseArchivesProjectApproval.code)
|
|
|
+ this.baseArchivesProjectApprovalService.update(this.baseArchivesProjectApproval).then((response)=>{
|
|
|
+ if (response.success) {
|
|
|
+ //保存成功
|
|
|
+ this.nzNotificationService.success(this.i18NService.fanyi('save.ok'), '');
|
|
|
+ this.getListContractTree();
|
|
|
+ } else {
|
|
|
+ //保存失败
|
|
|
+ this.nzNotificationService.error(this.i18NService.fanyi('save.not'), '');
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|