collappseネストcheckbox-group checkbox

5001 ワード

すべてのメインプロジェクトのデータは一つのインターフェースから一つの配列に戻ります.配列の中には一つのサブ項目をカプセル化したデータがあります.これはネストされた最初の配列から戻す必要があります.
data:[{code: "202000221", name: "zhangsan", code1: "xymb", code2: "sass", id_r: "0", id_p: "0", blockList: [,…]},
{code: "202000221", name: "zhangsan", code1: "xymb", code2: "sass", id_r: "0", id_p: "0", blockList: [,…]},
{code: "202000221", name: "zhangsan", code1: "xymb", code2: "sass", id_r: "0", id_p: "0", blockList: [,…]}]
blockListはまた一つの配列で、中にはいくつかのデータ情報があります.
{{ drug.blockMc}}
//     ,       ,       ,            (         )
    getCheckedAllItems(arr) {
      let itemBlockObj = []
      arr.filter(item => {
            if (item.wesCheckedPill.length > 0) {
            //        push       
              itemBlockObj.push({
                name: item.name,
                code: String(this.code), //       
                personCode: Number(this.personCode), //      
                roomName: this.roomNum
              })
            }
      })
      return itemBlockObj
    },
//        
handleCheckAllChange(index) {
	let { checkAllWes = false } = this.westernBlockList[index]
          //       ,      lable     v-model 
          if (checkAllWes) {
            this._drugCheckList = []
            let _drugList = this.westernBlockList[index].mzCfMbMxList
            if (_drugList) {
              for (let item of _drugList) {
                this._drugCheckList.push(item.xmdm)
              }
            }
            this.westernBlockList[index].wesCheckedDrug = this._drugCheckList
          } else {
            this.westernBlockList[index].wesCheckedDrug = []
          }
          this.westernBlockList[index].isIndeterminate = false
         }
//         
handleCheckItemChange(index) {
	this.wesCheckedDrugCount = this.westernBlockList[index].wesCheckedPill.length //         
	let wesDrugCount = this.westernBlockList[index].mzBlockList.length // mzBlockList         
	//                      
	this.westernBlockList[index].checkAllWes = this.wesCheckedDrugCount === wesDrugCount
	//        true
	this.westernBlockList[index].isIndeterminate = this.wesCheckedDrugCount > 0 && this.wesCheckedDrugCount < wesDrugCount
}
//    key  mzBlockList   value    this.getCheckedItems()       ,     
//            :
{
  "mzBlockList": [
    {
      "name": "string",
      "code": "string",
      "personCode": "string",
      "roomName": [
        "string"
      ]
    }
  ]
}
this.quoteParams = { mzBlockList: this.getCheckedItems() } 
//               :
//               roomNum:    
{
  "mzBlockList": [
    {
      "name": "202000186",
      "code": "1",
      "personCode": "310115783675001",
      "roomNum": [
        "xy00078",
        "xy00285"
      ]
    },
    // //               roomNum:    
    {
      "name": "202000221",
      "code": "1",
      "personCode": "310115783675001",
      "roomNum": [
        "xy00036"
      ]
    }
  ]
}