zoukankan      html  css  js  c++  java
  • elementui选中数据,加入另一个数据表格

      // 点击药品或检查项目抽屉页面的添加并关闭按钮
        hanldeAddCareItem() {
          const coType = this.submitCareOrder.careOrder.coType
          if (this.selectItemList.length === 0) {
            this.msgError('请选择【' + (coType === '0' ? '药品' : '检查项目') + '】')
            return
          }
          if (coType === '0') { // 药品
            this.selectItemList.filter(item => { // filter() 不会改变原始数组。抽屉选中的数组
              const obj = { //构造obj
                itemRefId: item.medicinesId,
                itemName: item.medicinesName,
                itemType: coType,
                num: 1,
                price: item.prescriptionPrice,
                amount: 1 * item.prescriptionPrice,
                remark: '请按说明服用'
              }
              let flag = false// 默认里面没有加
              this.submitCareOrder.careOrderItems.filter(i => {//需要往里加的药品数组
                if (i.itemRefId === obj.itemRefId) {
                  i.num = i.num + 1 //如果有相同的数量加1
                  flag = true// 说明之前加过
                }
              })
              if (!flag) {
                this.submitCareOrder.careOrderItems.push(obj)//如果符合条件追加obj
              }
              this.openDrawerMedicines = false
            })
          } else { // 检查项目
            this.selectItemList.filter(item => {
              const obj = {
                itemRefId: item.checkItemId,
                itemName: item.checkItemName,
                itemType: coType,
                num: 1,
                price: item.unitPrice,
                amount: 1 * item.unitPrice,
                remark: '按要求检查'
              }
              let flag = false// 默认里面没有加
              this.submitCareOrder.careOrderItems.filter(i => {
                if (i.itemRefId === obj.itemRefId) {
                  i.num = i.num + 1
                  flag = true// 说明之前加过
                }
              })
              if (!flag) {
                this.submitCareOrder.careOrderItems.push(obj)
              }
              this.openDrawerCheckItem = false
            })
          }
          // 计算总价
          this.computeOrderItemAllAmount()
        },
  • 相关阅读:
    使用gitlab, jenkins搭建CI(持续集成)系统(1) -- 准备环境
    后台开发技术(2)--接入层设计
    后台开发技术(1)--概述
    【Go】学习笔记兼吐槽(1)
    【PyCharm】书签的使用
    【pygame】Python 不到 300 行代码实现俄罗斯方块
    【杂谈】详解医保报销
    【Python 库】requests 详解超时和重试
    【Python 库】读取 .doc、.docx 两种 Word 文件简述及“Word 未能引发事件”错误
    【Python】鲜为人知的功能特性(下)
  • 原文地址:https://www.cnblogs.com/javakangkang/p/14002955.html
Copyright © 2011-2022 走看看