# 示例2：主子循环块

**类型：** 循环块报表（主子表循环）
**特征：** `loopBlockList` 定义循环区域，每个单元格加 `"loopBlock":1`，主表 `#{brpuzpqacl.xxx}` + 子表 `#{flbaplxbnu.xxx}`

## 关键配置

- `loopBlockList`：`[{"sci":0,"index":1,"eci":8,"sri":0,"eri":36,"db":"brpuzpqacl"}]`
- 循环块内所有单元格标记 `"loopBlock":1`
- 主表数据源：`brpuzpqacl`
- 子表数据源：`flbaplxbnu`

## 报表 JSON

```json
{"loopBlockList":[{"sci":0,"index":1,"eci":8,"sri":0,"eri":36,"db":"brpuzpqacl"}],"querySetting":{"izOpenQueryBar":false,"izDefaultQuery":true},"recordSubTableOrCollection":{"record":[],"range":[],"group":[]},"printConfig":{"layout":"portrait","paginationShow":false,"printCallBackUrl":"","paper":"A4","isBackend":false,"width":210,"paginationLocation":"middle","definition":1,"marginX":10,"height":297,"marginY":10},"hidden":{"rows":[],"conditions":{"rows":{},"cols":{}},"cols":[]},"queryFormSetting":{"idField":"","useQueryForm":false,"dbKey":""},"dbexps":[],"toolPrintSizeObj":{"printType":"A4","widthPx":718,"heightPx":1047},"dicts":[],"fillFormToolbar":{"show":true,"btnList":["save","subTable_add","verify","subTable_del","print","close","first","prev","next","paging","total","last","exportPDF","exportExcel","exportWord"]},"freeze":"A1","dataRectWidth":682,"isViewContentHorizontalCenter":false,"autofilter":{},"validations":[],"cols":{"0":{"width":39},"1":{"width":73},"2":{"width":89},"3":{"width":101},"4":{"width":80},"8":{"width":29},"len":50},"area":false,"pyGroupEngine":false,"submitHandlers":[],"excel_config_id":"1171669477423927296","hiddenCells":[],"zonedEditionList":[],"rows":{"0":{"cells":{"0":{"loopBlock":1,"text":""},"1":{"loopBlock":1,"merge":[0,6],"style":8,"text":"订货商信息","height":0},"2":{"loopBlock":1,"text":""},"3":{"loopBlock":1,"text":""},"4":{"loopBlock":1,"text":""},"5":{"loopBlock":1,"text":""},"6":{"loopBlock":1,"text":""},"7":{"loopBlock":1,"text":""},"8":{"loopBlock":1,"text":""}},"height":57},"1":{"cells":{"0":{"loopBlock":1,"text":""},"1":{"loopBlock":1,"style":10,"text":"订单编号："},"2":{"loopBlock":1,"merge":[0,2],"style":42,"text":"#{brpuzpqacl.order_code}","height":0},"3":{"loopBlock":1,"text":""},"4":{"loopBlock":1,"text":""},"5":{"loopBlock":1,"text":""},"6":{"loopBlock":1,"text":""},"7":{"loopBlock":1,"text":""},"8":{"loopBlock":1,"text":""}},"height":34},"2":{"cells":{"0":{"loopBlock":1,"text":""},"1":{"loopBlock":1,"style":10,"text":"订单地址："},"2":{"loopBlock":1,"merge":[0,1],"style":42,"text":"#{brpuzpqacl.descc}","height":0},"3":{"loopBlock":1,"text":""},"4":{"loopBlock":1,"style":10,"text":"订单日期："},"5":{"loopBlock":1,"merge":[0,1],"style":43,"text":"#{brpuzpqacl.order_date}","height":0},"7":{"loopBlock":1,"text":""},"8":{"loopBlock":1,"text":""}},"height":34},"3":{"cells":{"0":{"loopBlock":1,"text":""},"1":{"loopBlock":1,"style":10,"text":"订单姓名："},"2":{"loopBlock":1,"merge":[0,1],"style":42,"text":"#{brpuzpqacl.create_by}","height":0},"3":{"loopBlock":1,"text":""},"4":{"loopBlock":1,"style":10,"text":"到货日期："},"5":{"loopBlock":1,"merge":[0,1],"style":42,"text":"#{brpuzpqacl.create_time}","height":0},"6":{"loopBlock":1,"text":""},"7":{"loopBlock":1,"text":""},"8":{"loopBlock":1,"text":""}},"height":31},"5":{"cells":{"0":{"loopBlock":1,"text":""},"1":{"loopBlock":1,"decimalPlaces":"4","merge":[0,6],"style":31,"text":"订单详情"},"8":{"loopBlock":1,"text":""}},"height":51},"6":{"cells":{"0":{"loopBlock":1,"text":""},"1":{"loopBlock":1,"style":15,"text":"商品编码"},"2":{"loopBlock":1,"style":15,"text":"商品名称"},"3":{"loopBlock":1,"style":15,"text":"销售时间"},"4":{"loopBlock":1,"style":15,"text":"销售数据量"},"5":{"loopBlock":1,"style":15,"text":"定价"},"6":{"loopBlock":1,"style":15,"text":"优惠价"},"7":{"loopBlock":1,"style":15,"text":"付款金额"},"8":{"loopBlock":1,"text":""}},"height":42},"7":{"cells":{"0":{"loopBlock":1,"text":""},"1":{"loopBlock":1,"style":18,"text":"#{flbaplxbnu.product_name}"},"2":{"loopBlock":1,"style":18,"text":"#{flbaplxbnu.product_name}"},"3":{"loopBlock":1,"style":18,"text":"#{flbaplxbnu.product_name}"},"4":{"loopBlock":1,"style":18,"text":"#{flbaplxbnu.num}"},"5":{"loopBlock":1,"decimalPlaces":"4","style":19,"text":"#{flbaplxbnu.price}"},"6":{"loopBlock":1,"decimalPlaces":"1","style":19,"text":"#{flbaplxbnu.price}"},"7":{"loopBlock":1,"style":18,"text":"#{flbaplxbnu.pro_type}"},"8":{"loopBlock":1,"text":""}}},"10":{"cells":{"0":{"loopBlock":1,"text":""},"1":{"loopBlock":1,"style":39,"text":"备注："}},"height":25},"11":{"cells":{"0":{"loopBlock":1,"text":""},"1":{"loopBlock":1,"merge":[0,6],"style":41,"text":"1、查看信息，在浏览器输入"?did=1"或"?did=2"","height":0}},"height":37},"len":102},"rpbar":{"show":true,"pageSize":"","btnList":[]},"name":"sheet1","styles":[{"border":{"top":["thin","#000"],"left":["thin","#000"],"bottom":["thin","#000"],"right":["thin","#000"]}},{"border":{"top":["thin","#000"],"left":["thin","#000"],"bottom":["thin","#000"],"right":["thin","#000"]},"align":"center"},{"border":{"top":["thin","#000"],"left":["thin","#000"],"bottom":["thin","#000"],"right":["thin","#000"]},"bgcolor":"#5b9cd6","align":"center"},{"font":{"size":18}},{"font":{"size":18,"bold":true}},{"align":"center"},{"align":"center","font":{"size":18,"bold":true}},{"bgcolor":"#5b9cd6","align":"center"},{"align":"center","font":{"size":18,"name":"宋体","bold":true}},{"bgcolor":"#5b9cd6","align":"center","font":{"name":"宋体"}},{"font":{"name":"宋体"}},{"bgcolor":"#5b9cd6","color":"#ffffff","align":"center","font":{"name":"宋体"}},{"border":{"top":["thin","#5b9cd6"],"left":["thin","#5b9cd6"],"bottom":["thin","#5b9cd6"],"right":["thin","#5b9cd6"]},"bgcolor":"#5b9cd6","color":"#ffffff","align":"center","font":{"name":"宋体"}},{"border":{"top":["thin","#5b9cd6"],"left":["thin","#5b9cd6"],"bottom":["thin","#5b9cd6"],"right":["thin","#5b9cd6"]},"font":{"name":"宋体"}},{"border":{"top":["thin","#bfbfbf"],"left":["thin","#bfbfbf"],"bottom":["thin","#bfbfbf"],"right":["thin","#bfbfbf"]}},{"border":{"top":["thin","#bfbfbf"],"left":["thin","#bfbfbf"],"bottom":["thin","#bfbfbf"],"right":["thin","#bfbfbf"]},"bgcolor":"#5b9cd6","color":"#ffffff","align":"center","font":{"name":"宋体"}},{"border":{"top":["thin","#bfbfbf"],"left":["thin","#bfbfbf"],"bottom":["thin","#bfbfbf"],"right":["thin","#bfbfbf"]},"font":{"name":"宋体"}},{},{"border":{"top":["thin","#bfbfbf"],"left":["thin","#bfbfbf"],"bottom":["thin","#bfbfbf"],"right":["thin","#bfbfbf"]},"align":"center","font":{"name":"宋体"}},{"border":{"top":["thin","#bfbfbf"],"left":["thin","#bfbfbf"],"bottom":["thin","#bfbfbf"],"right":["thin","#bfbfbf"]},"format":"number","align":"center","font":{"name":"宋体"}},{"border":{"top":["thin","#bfbfbf"],"left":["thin","#bfbfbf"],"bottom":["thin","#bfbfbf"],"right":["thin","#bfbfbf"]},"format":"normal","align":"center","font":{"name":"宋体"}}],"freezeLineColor":"rgb(185, 185, 185)","merges":["B1:H1","C2:E2","C3:D3","F3:G3","C4:D4","F4:G4","B6:H6","B12:H12"]}
```
