Browse Source

增加全选的按钮

wangn 5 years ago
parent
commit
e473fb25d9
1 changed files with 35 additions and 1 deletions
  1. 35 1
      ghsApp/src/pagesArrears/details.vue

+ 35 - 1
ghsApp/src/pagesArrears/details.vue

@@ -74,7 +74,8 @@ export default {
 			totalAmount: "",
 			totalAmount: "",
 			num: "",
 			num: "",
 			detailsList: [],
 			detailsList: [],
-			listLoading: false
+			listLoading: false,
+      isAllCheck: false
 		};
 		};
 	},
 	},
 	onPullDownRefresh() {
 	onPullDownRefresh() {
@@ -112,6 +113,15 @@ export default {
 			return amount;
 			return amount;
 		}
 		}
 	},
 	},
+  watch: {
+    selectList () {
+      if (this.selectList.length === this.detailsList.length) {
+        this.isAllCheck = true
+      } else {
+        this.isAllCheck = false
+      }
+    }
+  },
 	methods: {
 	methods: {
 		async initData() {
 		async initData() {
 			try {
 			try {
@@ -133,6 +143,19 @@ export default {
 				this.listLoading = false;
 				this.listLoading = false;
 			}
 			}
 		},
 		},
+    // 全选
+    allCheck () {
+      this.isAllCheck = !this.isAllCheck
+      if (this.isAllCheck) {
+        this.detailsList.map(ele => {
+          ele.checked = true
+        });
+      } else {
+        this.detailsList.map(ele => {
+          ele.checked = false
+        });
+      }
+    },
 		checkItemEvent(item) {
 		checkItemEvent(item) {
 			for (let index = 0; index < this.detailsList.length; index++) {
 			for (let index = 0; index < this.detailsList.length; index++) {
 				const element = this.detailsList[index].id;
 				const element = this.detailsList[index].id;
@@ -279,5 +302,16 @@ export default {
 			}
 			}
 		}
 		}
 	}
 	}
+  .details-select {
+    margin-right: 20upx;
+    display: inline-block;
+    .iconweixuanzhong,
+    .iconxuanzhong {
+      font-size: 40upx !important;
+    }
+    .iconxuanzhong {
+      color: $mainColor !important;
+    }
+  }
 }
 }
 </style>
 </style>