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()
        },
  • 相关阅读:
    Knowing how all your components work together: distributed tracing with Zipkin
    Java Annotation Processors
    深度剖析JDK动态代理机制
    Java 代理模式(二) Java中的动态代理
    Java 代理模式(一) 静态代理
    CGLib动态代理原理及实现
    Understanding sun.misc.Unsafe
    Finding Memory Leaks with SAP Memory Analyzer
    ubuntu18.04 安装mysql server
    Sqoop+mysql+Hive+ Ozzie数据仓库案例
  • 原文地址:https://www.cnblogs.com/javakangkang/p/14002955.html
Copyright © 2011-2022 走看看