From df06d5adebeedb5edca6264450671792ccbd9d4e Mon Sep 17 00:00:00 2001
From: Your Name <123456>
Date: 星期一, 26 九月 2022 16:19:36 +0800
Subject: [PATCH] 修改

---
 src/views/specialWorkSystem/foundationSet/material/index.vue |   75 ++++++++++++++++++++++++++-----------
 1 files changed, 53 insertions(+), 22 deletions(-)

diff --git a/src/views/specialWorkSystem/foundationSet/material/index.vue b/src/views/specialWorkSystem/foundationSet/material/index.vue
index b056cb7..2de6ce6 100644
--- a/src/views/specialWorkSystem/foundationSet/material/index.vue
+++ b/src/views/specialWorkSystem/foundationSet/material/index.vue
@@ -556,28 +556,59 @@
             let res = await materialApi().getRecordList();
             if (res.data.code === '200') {
                 state.allList  = JSON.parse(JSON.stringify(res.data.data))
-                state.checkData = state.allList.map((item)=>{
-                    if(item.list && item.list != null){
-                        console.log('1111111111111')
-                        item.list.map((i)=>{
-                            i.checked = false
-                            i.defaultVal = null
-                            i.configurationLevel = null
-                            i.consumables = false
-                            return {
-                                checked: i.checked,
-                                materialName: i.name,
-                                consumables: i.consumables,
-                                defaultVal: i.defaultVal,
-                                configurationLevel: i.configurationLevel,
-                                materialType: i.materialType,
-                                materialTypeName: i.materialTypeName,
-                                emergencyMaterialId: i.id
-                            }
-                        })
-                    }
-                    return item
-                })
+                // const test = [{id:1,name:'1',children:[{one:1,two:'1'},]},{id:2,name:'2',children:[{one:2,two:'2'},]}]
+                // test.map(item => {
+                //     item.children.map(i =>{
+                //         debugger
+                //         return {
+                //             three:true
+                //         }
+                //         const obj = i
+                //         console.log(obj);
+                //     })
+                //     return item
+                // })
+                // console.log(test);
+                for(let i in state.allList){
+                    state.allList[i].list = state.allList[i].list?.map((item:any) => {
+                        const obj = {
+                            checked: false,
+                            materialName: item.name,
+                            consumables: false,
+                            defaultVal: null,
+                            configurationLevel: null,
+                            materialType: item.materialType,
+                            materialTypeName: item.materialTypeName,
+                            emergencyMaterialId: item.id
+                        }
+                        return {...obj}
+                    })
+                }
+                state.checkData = JSON.parse(JSON.stringify(state.allList))
+                // state.checkData = state.allList.map((item)=>{
+                //     if(item.list && item.list != null){
+                //         console.log('1111111111111')
+                //         item.list.map((i)=>{
+                //             i.checked = false
+                //             i.defaultVal = null
+                //             i.configurationLevel = null
+                //             i.consumables = false
+                //             debugger
+                //             const obj = {
+                //                 checked: i.checked,
+                //                 materialName: i.name,
+                //                 consumables: i.consumables,
+                //                 defaultVal: i.defaultVal,
+                //                 configurationLevel: i.configurationLevel,
+                //                 materialType: i.materialType,
+                //                 materialTypeName: i.materialTypeName,
+                //                 emergencyMaterialId: i.id
+                //             }
+                //             return {...obj}
+                //         })
+                //     }
+                //     return item
+                // })
             } else {
                 ElMessage({
                     type: 'warning',

--
Gitblit v1.9.2