Browse Source

[新增]superadmin账号卸油增加删除功能

beijing
邵佳豪 2 years ago
parent
commit
71022db02b
  1. 2
      src/app/pages/records/oil-unloading-process-list/oil-unloading-process-list.component.html
  2. 38
      src/app/pages/records/oil-unloading-process-list/oil-unloading-process-list.component.ts

2
src/app/pages/records/oil-unloading-process-list/oil-unloading-process-list.component.html

@ -149,6 +149,8 @@
</td>
<td>
<span style="color: #36A2FF;cursor: pointer;" (click)="look(item)">查看</span>
<span *ngIf="loginUserInfo.userName === 'superadmin'"
style="color: #FF4B65;cursor: pointer;margin-left: 6px;" (click)="delete(item)">删除</span>
</td>
</tr>
</tbody>

38
src/app/pages/records/oil-unloading-process-list/oil-unloading-process-list.component.ts

@ -100,6 +100,7 @@ export class OilUnloadingProcessListComponent implements OnInit {
button = false;
tableScrollHeight;
resizeListener;
loginUserInfo;
ngOnInit(): void {
this.tableScrollHeight = "100px";
// 页面监听
@ -126,7 +127,7 @@ export class OilUnloadingProcessListComponent implements OnInit {
loginUserInfo = JSON.parse(sessionStorage.getItem("userdata"));
this.returnLastMenus(false);
}
this.loginUserInfo = loginUserInfo;
if (
loginUserInfo.roles.find((item) => {
return item.name == "ViolationPositiveCensorer";
@ -929,6 +930,41 @@ export class OilUnloadingProcessListComponent implements OnInit {
const instance = modal.getContentComponent();
}
//删除某个卸油
delete(item) {
console.log(item);
this.modal.confirm({
nzTitle: `确认要删除${item.gasStation.stationName}的此条卸油记录吗`,
nzOkText: "确定",
nzOkType: "primary",
nzOkDanger: true,
nzOnOk: () => {
this.http
.delete("/api/services/app/OilUnloadingProcess/Delete", {
params: {
Id: item.id,
},
})
.subscribe({
next: (data) => {
this.message.create("success", "删除成功");
for (let index = 0; index < this.list.length; index++) {
const element = this.list[index];
if (element.id == item.id) {
this.list.splice(index, 1);
this.totalCount = String(Number(this.totalCount) - 1);
this.SkipCount = String(Number(this.SkipCount) - 1);
this.list = [...this.list];
}
}
},
});
},
nzCancelText: "取消",
nzOnCancel: () => console.log("Cancel"),
});
}
gorecordList() {
if (this.router.url.indexOf("petrolStation") != -1) {
this.router.navigate(["/records/petrolStation"]);

Loading…
Cancel
Save