實現換床位號的功能。
- 2020 年 2 月 13 日
- 筆記
- 業務需求: 接收後台傳遞的已經分配的學生,床位號號不能重複。 也就是已經選擇的床位,不能在重新選擇。

選中.png

選.png

不能選.png
selectCode(codeid) { // 獲得已經選中的床位 // dormAddStuList 右側的列表 var shopMs = this.dormAddStuList.reduce((list, item) => { list.push(item.nums); /// return list; }, []); // 獲得列表返回的床位 shopMs = shopMs.concat(...this.getActiveList); // 上一次已經選中的床位,現在又重新修改。 let gg; this.activeList.forEach(item => { if (shopMs.indexOf(item) < 0) { gg = item; } }); // 如果是上一次選過的床位 if (gg) { this.bedList[gg].disabled = false; } // 所有不能選的床位號 為true shopMs.map((item, i) => { if (item !== "") { let a = this.bedList[item]; this.bedList[item].disabled = true; } }); this.activeList = shopMs; /// // this.bedList.map((item, index) => { // if (item.value == codeid ) { // this.num = item.num; // item.disabled = true; // } else { // item.disabled = false; // } // }); },
watch: { getActiveList(val) { this.getActiveList.map((item, i) => { if (item !== "") { let a = this.bedList[item]; this.bedList[item].disabled = true; } }); } },