前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >实现换床位号的功能。

实现换床位号的功能。

作者头像
用户4344670
发布2020-02-13 13:31:28
4590
发布2020-02-13 13:31:28
举报
文章被收录于专栏:vue的实战
  • 业务需求: 接收后台传递的已经分配的学生,床位号号不能重复。 也就是已经选择的床位,不能在重新选择。

选中.png

选.png

不能选.png

代码语言:javascript
复制
 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;
      //   }

      // });
    },
代码语言:javascript
复制
  watch: {
    getActiveList(val) {
      this.getActiveList.map((item, i) => {
        if (item !== "") {
          let a = this.bedList[item];
          this.bedList[item].disabled = true;
        }
      });
    }
  },
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档