Browse Source

7月8日检验检查

yq1 8 months ago
parent
commit
01408ee92d
1 changed files with 56 additions and 37 deletions
  1. 56 37
      src/pages/doctorAdvice/components/new_Inspectiondetails.vue

+ 56 - 37
src/pages/doctorAdvice/components/new_Inspectiondetails.vue View File

37
           {{ getTime(scope.row.inspect_date) }}
37
           {{ getTime(scope.row.inspect_date) }}
38
          </template>
38
          </template>
39
         </el-table-column>
39
         </el-table-column>
40
-        <el-table-column v-for="(item,index) in columns" :key="index"
40
+        <el-table-column
41
+          v-for="(item,index) in columns" :key="index"
42
+          :prop="item.prop"
43
+          :label="item.label" 
44
+          width="150">
45
+         <!-- <template slot-scope="scope" >
46
+          {{ scope.row.prop }}
47
+         </template> -->
48
+        </el-table-column>
49
+        <!-- <el-table-column v-for="(item,index) in columns" :key="index"
41
           :prop="item.prop"
50
           :prop="item.prop"
42
           :label="item.label"
51
           :label="item.label"
43
           width="">
52
           width="">
44
           <template slot-scope="scope">
53
           <template slot-scope="scope">
45
-            {{ getname(scope.row,item.prop) }}
54
+            <div >
55
+              {{ getname(scope.row.prop) }}
56
+              {{ scope.row.prop }}
57
+            </div>
58
+            
46
           </template>
59
           </template>
47
-        </el-table-column>
60
+        </el-table-column> -->
48
 
61
 
49
       </el-table>
62
       </el-table>
50
     </div>
63
     </div>
128
       blood_id:0,
141
       blood_id:0,
129
       route_date:0,
142
       route_date:0,
130
       patient_name:'',
143
       patient_name:'',
144
+      datable:[]
131
     }
145
     }
132
   },
146
   },
133
   mounted(){
147
   mounted(){
172
        
186
        
173
         const list = response.data.data.inspection
187
         const list = response.data.data.inspection
174
         console.log('response11111',list);
188
         console.log('response11111',list);
189
+
175
         // this.tableData = list
190
         // this.tableData = list
176
         var columns = []
191
         var columns = []
177
         const date = []
192
         const date = []
178
         var date1 =[]
193
         var date1 =[]
179
         let table = [{inspect_date:''}]
194
         let table = [{inspect_date:''}]
180
         const datable =[]
195
         const datable =[]
181
-        // columns = Object.keys(list[0]).map((item,key) =>({
182
-        //   prop:item[8],
183
-        //   label:item[6],
184
-        // }))
185
-        // console.log('Object.keys(response.data.data.list[0])',columns);
186
-        list.forEach((item,index) => {
187
-          const obj1={
188
-            prop:'inspect_value'+(index+1),
189
-            label:item.item_name
196
+        // const arr ={}
197
+        const child = list[0].Child
198
+        for(let i=0;i<child.length;i++){
199
+          const obj ={
200
+            label:child[i].item_name,
201
+            // prop:child[i].item_name
202
+            prop:'value'+(i+1)
190
           }
203
           }
191
-          date.push(item.inspect_date)
192
-           date1=[...new Set(date)]
193
-          
194
-          columns.push(obj1)
195
-          // for(let i in columns){
196
-          //   if(columns[i].label == item.item_name){
197
-          //     table[0][columns[i].prop]=item.inspect_value
198
-          //   }
199
-          // }
200
-          // table.push(obj2)
201
-        });
202
-          for(let i in date1){
204
+          columns.push(obj)
205
+        }
206
+        console.log('list[0].Child121',columns);
207
+        
208
+        list.forEach(item =>{
209
+          const datable1 ={
210
+            inspect_date:item.inspect_date,
211
+          }
212
+          datable.push(datable1)
213
+
214
+          item.Child.forEach((item1,index1) =>{
203
             const arr={
215
             const arr={
204
-              inspect_date:date1[i]
216
+              inspect_date:item.inspect_date,
217
+              name:item1.item_name,
218
+              id:item1.id,
219
+              value:item1.inspect_value
205
             }
220
             }
206
-            datable.push(arr)
207
-          }
208
-          list.forEach(item =>{
209
-            for(let i in columns){
210
-              for(let j in datable){
211
-                if(columns[i].label == item.item_name && datable[j].inspect_date == item.inspect_date){
212
-                  datable[j][columns[i].prop]=item.inspect_value
221
+            for(let i in datable){
222
+              for(let j in columns){
223
+                if(item1.inspect_date == datable[i].inspect_date && columns[j].label == item1.item_name){
224
+                  if(item1.inspect_value !=''){
225
+                    datable[i][columns[j].prop] = item1.inspect_value
226
+                  }else{
227
+                    datable[i][columns[j].prop] = 0
228
+                  }
229
+                  
213
                 }
230
                 }
214
               }
231
               }
215
             }
232
             }
216
           })
233
           })
217
-          table =datable
218
-        console.log('bbbbb',datable);
219
-        console.log('ppppp',table);
234
+          // datable.push(arr)
235
+        })
220
         table =datable
236
         table =datable
237
+        this.datable = datable
238
+        console.log('ppppp',columns);
239
+        
221
         this.tableData = table
240
         this.tableData = table
222
-        this.columns = columns      
223
-        // console.log('Object.keys(response.data.data.list[0])',this.columns,this.tableData);
241
+        this.columns = columns    
242
+        console.log('11111',this.tableData);  
224
       })
243
       })
225
       
244
       
226
     },
245
     },