Commit 7961c4b1 authored by wangqinghua's avatar wangqinghua

update

parent 1b6d7aa9
......@@ -53,8 +53,7 @@
<button (click)="showUploadModalOrg()" nz-button nzType="default">导入组织</button>
<button (click)="showUploadModalUser()" nz-button nzType="default">导入用户</button>
</div>
<nz-table #basicTable [nzData]="dataSet" [nzFrontPagination]="false" [nzTotal]="totalNum" [nzPageIndex]="pageNum" [nzPageSize]="pageSize" (nzPageIndexChange)="changePage($event)"
>
<nz-table #basicTable [nzData]="dataSet" [nzFrontPagination]="false" [nzTotal]="totalNum" [nzPageIndex]="pageNum" [nzPageSize]="pageSize" (nzPageIndexChange)="changePage($event)">
<thead>
<tr>
<th nzShowCheckbox [(nzChecked)]="allChecked" [nzIndeterminate]="indeterminate" (nzCheckedChange)="checkAll($event)"></th>
......
......@@ -25,13 +25,13 @@
<div nz-col nzSpan="3">
<button (click)="showAddModal()" nz-button nzType="default"><i class="anticon anticon-plus-circle-o"></i>添加资产</button>
</div>
<div nz-col nzSpan="3">
<button nz-button nzType="default"><i class="anticon anticon-upload"></i>导入资产</button>
<div nz-col nzSpan="18">
<button (click)="showUploadModal()" nz-button nzType="default"><i class="anticon anticon-upload"></i>导入资产</button>
<button (click)="downLoad()" nz-button nzType="default"><i class="anticon anticon-download"></i>下载模版</button>
<button (click)="downloadInventory()" nz-button nzType="default"><i class="anticon anticon-folder"></i>导出资产</button>
<button (click)="batchDeleteInventory()" nz-button nzType="default"><i class="anticon anticon-close-circle-o"></i>删除资产</button>
</div>
<div nz-col nzSpan="3">
<button nz-button nzType="default"><i class="anticon anticon-download"></i>下载模版</button>
</div>
<div nz-col nzSpan="6">
</div>
</div>
......@@ -39,6 +39,7 @@
<nz-table #nzTable [nzData]="childrenList">
<thead>
<tr>
<th nzShowCheckbox [nzIndeterminate]="indeterminate" [nzChecked]="allChecked" (nzCheckedChange)="checkAll($event)"></th>
<th>资产编号</th>
<th>资产名称</th>
<th>资产总数</th>
......@@ -53,6 +54,7 @@
</thead>
<tbody>
<tr *ngFor="let data of childrenList">
<td nzShowCheckbox [(nzChecked)]="data.checked" (nzCheckedChange)="selectItem(data,$event)"></td>
<td class="round-tag tag-form">
{{data.inventoryNo}}
</td>
......@@ -82,5 +84,5 @@
<!--新增资产-->
<smart-assets #smartAssets (done)="getList()"></smart-assets>
<!--入资产-->
<!--入资产-->
<smart-upload #smartUpload></smart-upload>
\ No newline at end of file
......@@ -5,6 +5,8 @@ import {CommonService} from '../../../shared/common/common.service';
import {NzMessageService} from 'ng-zorro-antd';
import {AssetsComponent} from '../../modal/assets/assets.component';
import {UploadComponent} from '../../modal/upload/upload.component';
import {SERVER_API_URL} from '../../../app.constants';
import {SystemService} from '../../../system/system.service';
@Component({
selector: 'smart-child-assets',
......@@ -19,8 +21,14 @@ export class ChildAssetsComponent implements OnInit {
childrenList;
childName;
allChecked = false;
selectList = [];
disabledButton = true;
indeterminate = false;
constructor(private workSer: WorkService, private routerInfo: ActivatedRoute,private router:Router,
private conmonSer:CommonService,private message:NzMessageService) {
private message:NzMessageService,private systemSer:SystemService,
private commonSer:CommonService) {
this.routerInfo.queryParams.subscribe(
(res) => {
this.childId = res.id;
......@@ -29,6 +37,35 @@ export class ChildAssetsComponent implements OnInit {
);
}
checkAll(value: boolean): void {
this.childrenList.forEach(data => data.checked = value);
this.refreshStatus();
}
currentPageDataChange($event: Array<{ checked: boolean }>): void {
this.childrenList = $event;
}
selectItem(item, e) {
if (e) {
this.selectList.push(item);
} else {
this.selectList.forEach((value, index) => {
if (value.id == item.id) {
this.selectList.splice(index, 1);
}
});
}
this.refreshStatus();
}
refreshStatus(): void {
const allChecked = this.childrenList.every(value => value.checked === true);
const allUnChecked = this.childrenList.every(value => !value.checked);
this.allChecked = allChecked;
this.indeterminate = (!allChecked) && (!allUnChecked);
}
ngOnInit() {
this.getList();
}
......@@ -41,13 +78,13 @@ export class ChildAssetsComponent implements OnInit {
);
}
//删除资产
//删除资产--单个
deleteInVentory(item){
const data = {
inventoryIds:[]
};
data.inventoryIds.push(item.id);
this.conmonSer.confirmThing("删除","确定删除该资产?",()=>{
this.commonSer.confirmThing("删除","确定删除该资产?",()=>{
this.workSer.deleteInventory(data).subscribe(
(res)=>{
if(res.errCode == 10000){
......@@ -61,6 +98,11 @@ export class ChildAssetsComponent implements OnInit {
})
}
//批量删除
batchDeleteInventory(){
}
//添加资产
showAddModal() {
this.smartAssets.showAddModal("添加资产");
......@@ -85,4 +127,17 @@ export class ChildAssetsComponent implements OnInit {
this.smartUpload.showModal("上传资产文件");
}
//下载模版
downLoad(){
this.systemSer.downloadTemplate("inventory",SERVER_API_URL + "/api/template/download/").subscribe(
(data)=>{
this.commonSer.downloadFile("资产模版1",data);
}
)
}
//导出资产
downloadInventory(){
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment