Skip to content

Commit b65582e

Browse files
author
李洪亮
committed
修改删除提示的逻辑
1 parent 9aa7a5a commit b65582e

File tree

2 files changed

+66
-16
lines changed

2 files changed

+66
-16
lines changed

src/app/note/note.component.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,7 @@
4545
.am-toast.am-toast-nomask.am-toast.am-toast-nomask.am-toast.am-toast-nomask-top {
4646
top: 60px;
4747
}
48+
.delete {
49+
color: "#ffffff";
50+
background: "#e94f4f";
51+
}

src/app/note/note.component.ts

Lines changed: 62 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -320,20 +320,72 @@ export class NoteComponent implements OnInit, AfterViewInit {
320320
this.toast.info('请勾选一行', 1500);
321321
return false;
322322
}
323-
this.modal.alert('删除', '确定要删除么', [
324-
{ text: '取消', onPress: () => { } },
325-
{
326-
text: '删除',
327-
onPress: () =>
328-
new Promise(resolve => {
323+
// this.modal.alert('删除', '确定要删除么', [
324+
// { text: '取消', onPress: () => { } },
325+
// {
326+
// text: '删除',
327+
// onPress: () =>
328+
// new Promise(resolve => {
329+
// if (this.isHidden) {
330+
// this.accountBook.cars[this.activeTabIndex].datas.forEach((data, i) => {
331+
// if (this.setOfCheckedId.has(data.id)) {
332+
// const data = cloneDeep(this.accountBook.cars[this.activeTabIndex].datas);
333+
// data.splice(i, 1);
334+
// this.accountBook.cars[this.activeTabIndex].datas = data;
335+
// this.save(true);
336+
// resolve(true);
337+
// }
338+
// })
339+
// } else if (this.activeTabIndex === this.accountBook.cars.length) {
340+
341+
// this.accountBook.outCars.forEach((car, i) => {
342+
// if (this.setOfCheckedId.has(car.id)) {
343+
// const data = cloneDeep(this.accountBook.outCars);
344+
// data.splice(i, 1);
345+
// this.accountBook.outCars = data;
346+
// this.save(true);
347+
// resolve(true);
348+
// }
349+
// })
350+
// } else {
351+
// this.accountBook.guozhaCars.forEach((car, i) => {
352+
// if (this.setOfCheckedId.has(car.id)) {
353+
// const data = cloneDeep(this.accountBook.guozhaCars);
354+
// data.splice(i, 1);
355+
// this.accountBook.guozhaCars = data;
356+
// this.save(true);
357+
// resolve(true);
358+
// }
359+
// })
360+
// }
361+
362+
// }),
363+
// style: {
364+
// color: '#ffffff',
365+
// background: '#e94f4f'
366+
// }
367+
// }
368+
// ]);
369+
370+
this.alertCtrl.create({
371+
header: '删除',
372+
message:'确定要删除么',
373+
buttons: [
374+
{
375+
text:'取消',
376+
role: 'cancel',
377+
},
378+
{
379+
text:'删除',
380+
cssClass: 'delete',
381+
handler: ()=>{
329382
if (this.isHidden) {
330383
this.accountBook.cars[this.activeTabIndex].datas.forEach((data, i) => {
331384
if (this.setOfCheckedId.has(data.id)) {
332385
const data = cloneDeep(this.accountBook.cars[this.activeTabIndex].datas);
333386
data.splice(i, 1);
334387
this.accountBook.cars[this.activeTabIndex].datas = data;
335388
this.save(true);
336-
resolve(true);
337389
}
338390
})
339391
} else if (this.activeTabIndex === this.accountBook.cars.length) {
@@ -344,7 +396,6 @@ export class NoteComponent implements OnInit, AfterViewInit {
344396
data.splice(i, 1);
345397
this.accountBook.outCars = data;
346398
this.save(true);
347-
resolve(true);
348399
}
349400
})
350401
} else {
@@ -354,18 +405,13 @@ export class NoteComponent implements OnInit, AfterViewInit {
354405
data.splice(i, 1);
355406
this.accountBook.guozhaCars = data;
356407
this.save(true);
357-
resolve(true);
358408
}
359409
})
360410
}
361-
362-
}),
363-
style: {
364-
color: '#ffffff',
365-
background: '#e94f4f'
411+
}
366412
}
367-
}
368-
]);
413+
]
414+
})
369415
}
370416
/**
371417
* 添加车辆弹出框

0 commit comments

Comments
 (0)