• 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()
        },
  • 相关阅读:
    第九次作业
    第八次作业
    第七次作业
    组合数学—递推关系与母函数
    组合数学—排列组合
    三角函数
    OpenCV初步
    计算机视觉如何入门
    GDB调试技巧:总结篇
    PyQt5之窗口类型
  • 原文地址:https://www.cnblogs.com/javakangkang/p/14002955.html
Copyright © 2020-2023  润新知