6f5dcc4a by 杨威

幢单元下的户全选和清除

1 parent 99f1ad87
...@@ -36,7 +36,8 @@ ...@@ -36,7 +36,8 @@
36 <!-- 幢单元名称 --> 36 <!-- 幢单元名称 -->
37 <div class="zdy-name name"> 37 <div class="zdy-name name">
38 <p> 38 <p>
39 {{ zdys.zdymc }} 39 <!-- {{ zdys.zdymc }} -->
40 <el-checkbox @change='zdySelectAll($event,zdys.cs)'>{{ lpbData.xmmc }}</el-checkbox>
40 </p> 41 </p>
41 </div> 42 </div>
42 43
...@@ -171,7 +172,8 @@ ...@@ -171,7 +172,8 @@
171 <!-- 幢单元名称 --> 172 <!-- 幢单元名称 -->
172 <div class="zdy-name name"> 173 <div class="zdy-name name">
173 <p> 174 <p>
174 {{ zdys.zdymc }} 175 <!-- {{ zdys.zdymc }} -->
176 <el-checkbox @change='zdySelectAll($event,zdys.cs)'>{{ lpbData.xmmc }}</el-checkbox>
175 </p> 177 </p>
176 </div> 178 </div>
177 <!-- 循环幢单元下的层户 --> 179 <!-- 循环幢单元下的层户 -->
...@@ -957,8 +959,8 @@ export default { ...@@ -957,8 +959,8 @@ export default {
957 this.hcxlzVisible = true 959 this.hcxlzVisible = true
958 }, 960 },
959 //楼盘表户全选 961 //楼盘表户全选
960 lpbSelectAll(value){ 962 lpbSelectAll(val){
961 if(value){ 963 if(val){
962 this.$refs.hBsm.forEach((item) => { 964 this.$refs.hBsm.forEach((item) => {
963 item.className = "tdSelect"; 965 item.className = "tdSelect";
964 this.hbsmList.push(item.dataset.bsm); // 将户bsm放进hbsmList 966 this.hbsmList.push(item.dataset.bsm); // 将户bsm放进hbsmList
...@@ -969,6 +971,40 @@ export default { ...@@ -969,6 +971,40 @@ export default {
969 this.hbsmList = []; 971 this.hbsmList = [];
970 }); 972 });
971 } 973 }
974 },
975 //幢单元全选
976 zdySelectAll(val,cs){
977 let zdyHbsmList = [];
978 cs.forEach(i=>{
979 i.hs.forEach(j=>{
980 zdyHbsmList.push(j.bsm)
981 })
982 });
983 if (val) {
984 this.$nextTick(()=>{
985 console.log(zdyHbsmList);
986 this.$refs.hBsm.forEach((item) => {
987 console.log(item.dataset.bsm);
988 if (zdyHbsmList.indexOf(item.dataset.bsm)>-1) {
989 item.className = "tdSelect";
990 this.hbsmList = zdyHbsmList; // 将户bsm放进hbsmList
991 }
992 });
993 })
994 }else{
995 this.$refs.hBsm.forEach((item) => {
996 console.log(item.dataset.bsm);
997 if (zdyHbsmList.indexOf(item.dataset.bsm)>-1) {
998 item.className = "";
999 }
1000 zdyHbsmList.forEach(j=>{
1001 if (item.dataset.bsm == j) {
1002 this.hbsmList = this.hbsmList.filter(i=>i!=j)
1003 }
1004 })
1005 });
1006
1007 }
972 } 1008 }
973 }, 1009 },
974 computed: { 1010 computed: {
......